Category : Tools

Git – Push to a new remote server repository

Short reminder to myself on how to create a new server repo and do the initial push to it from a workstation.

On the Server:

cd Repositories
mkdir Project.git
git init –bare

On the Workstation:

cd Project
git init
git add *
git commit “Initial commit”
git remote add origin username@server.com/disk/shares/repositories/project.git
git push –u origin master

Done.

Multiple Machine Configuration

If you are anything like me you’ll find yourself using a number of different PCs through a typical week. I have my work laptop, my work Dev machine, my home PC, my netbook and some semi permanent virtual machines that I have. It can be a bit of a pain keeping my standard installed apps updated across all of these.

I’m getting too used to my Android phone and Tablet auto updating their apps with little or no interaction – what I wanted was the same for more of the apps I use on the various PCs I use.
I haven’t quite got a full solution for it, but I do have a big step toward it – Portable Apps.image

Portable Apps are pretty good at keeping themselves updated, but the pain is the configuration. For example when I add a command to Executor (my launcher of choice) I had to update it on all machines, same with adding a new site to the Filezilla Site manager or Putty – it needed to be updated across all machines.
I could of course store the Portable Apps on a memory stick and carry that everywhere – but then the challenge is – carrying it everywhere.

So I have a solution that brings the ease of Portable Apps with the omnipresence capabilities of my free 25GB SkyDrive account (but you could use any file sync/share application).

imageI have a folder in SkyDrive that I have installed my chosen Portable Apps to, so they turn up on every machine.
I also have an install folder with tools and scripts that I run on each new machine that I install SkyDrive on that gives me common locations for the apps (regardless of the user I am logged in as), updates the PATH variable, adds apps to the Start folder and the like

The script does a number of things :-

It creates symbolically linked folders so I can go to c:\apps instead of c:\users\kenh\skydrive\apps (or different usernames on each machine)

rmdir c:\tools
rmdir c:\apps
rmdir c:\scripts
mklink /d c:\Tools "%userprofile%\SkyDrive\Tools"
mklink /d c:\Scripts "%userprofile%\SkyDrive\Scripts"
mklink /d "c:\Apps" "%userprofile%\SkyDrive\Apps"

It adds some data to the registry

regedit.exe /f CommandPromptHere.reg

It uses a tool called xxmklink (from the makers of xxcopy) to add a shortcut to Executor to the start up folder so that it runs every time Windows starts.

xxmklink "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup\Executor.lnk" "C:\Apps\PortableApps\Executor\Executor.exe" "" "C:\Apps\PortableApps\Executor"

It starts some applications

START "C:\Apps\PortableApps\Executor\Executor.exe"
START "C:\Apps\Start.exe"

And the final thing it does (currently) is to update the PATH variable using pathman.exe

pathman.exe /as c:\tools

This makes my life much easier, I can be the same kind of productive regardless of the machine I am working on – they all have the same configuration, versions of software and paths, and the best bit is that when Portable Apps updates itself on one machine, it is reflected on all others within a few minutes.

I need to look at how I can extend this further, with introducing more portable apps to replace heavyweight desktop installs. I’ll keep you updated.

Listen Live

imageToo much effort reading my ramblings ? Want to listen instead ? Now you can !!

Courtesy of the excellent odiogo, the excellent text to speech service. This is a free service that bloggers can use, it takes your RSS feed, splits it out to each separate post and then creates a MP3 for the post.

The text-to-speech quality is really good, only about 1 in 50 words is corrupt/unintelligible – easily high enough quality to get a good rendition of the post. Obviously it depends on the content of the post, I have not yet listened to a post with lots of sample code or the like, but I expect it would be pretty hard going.

Get the audio for this blog here. You can even subscribe in iTunes. I will also update the site to include the links in the sidebar.

GEO 51.4043197631836:-1.28760504722595

drop.io

I was recording some audio earlier today and the quality from my cheap, generic headset/microphone was woeful.dropio_logo-1, so I searched around for a service that I could make a telephone call into and it would record the spoken audio and give me a WAV or MP3file.

I came across http://drop.io – this is a neat little Web 2.0 service that allows sharing of files, media etc, sending stuff via email, receiving stuff via email, fax, voice etc.

One of the features was a US telephone voicemail service that recorded my spoken content and stored it in my private ‘drop’ as an MP3 – exactly what I was looking for.

Whilst I could have, undoubtedly, found the specific service I was looking for from a UK provider the cool features that these guys provide made me want to use them :-

  • Conference Calling number (not recorded). drop.io
  • Voicemail Number (audio is recorded and left in your ‘drop’ as a MP3).
  • Add content via a custom @drop.io email address.
  • Add content via fax.
  • Email alerts to any updates to your drop.
  • RSS feed for action on your drop.
  • Security model where I can invite people to view my drop, or add content etc.
  • Add notes / links to your drop.
  • Zip up the whole drop and provide a link.
  • Really nice, clean look and feel.
  • FREE !!

You can also upgrade to pro version (paid for) that provide more than the 1GB of storage or keep drops open for longer than the defaults or even shorten the url of your drop (in the free version this is http://drop.io/user_chosen_drop_name min of 7 characters) – to two letters http://drop.io.kj for example…

GEO 51.4043197631836:-1.28760504722595

Homebrew Home Server

So a while back (31st Dec 2007), my beta license for Windows Home Server (WHS) expired and I hacked together an alternative quicklinks_whs_logosolution.

I have been updating my (almost) free/opensource alternative (it still needs a Windows OS) over the past couple of days and now have a pretty viable solution.

I have a machine (the Home Server) running Windows (any version would do) with two large additional drives in it (Data1 and Data2).
Data1 is the primary data drive and on there I created a number of folders / shares:HomeServerFolders

  • Photos
  • Documents
  • Music
  • Videos
  • Software
  • Backups
  • Downloads

I re-homed each of my ‘special’ folders in Vista (Docs, Music, Video, Photos) to these shares, so all data is stored on the Home Server. You could create a separate shared folder for each user with the correct permissions, but I share all the docs/photos etc between all machines so no need for me.

Next I wanted the WHS feature of duplicating the stored data across more than drive, so I grabbed a copy of the Robocopy and created a batch file with the following commands :

  • robocopy d:documents e:documents /MIR /SEC /LOG:c:robocopy.txt /NDL /NFL
  • robocopy d:music e:music /MIR /SEC /LOG+:c:robocopy.txt /NDL /NFL
  • robocopy d:videos e:videos /MIR /SEC /LOG+:c:robocopy.txt /NDL /NFL
  • robocopy d:software e:software /MIR /SEC /LOG+:c:robocopy.txt /NDL /NFL
  • robocopy d:photos e:photos /MIR /SEC /LOG+:c:robocopy.txt /NDL /NFL
  • robocopy d:backups e:backups /MIR /SEC /LOG+:c:robocopy.txt /NDL /NFL
  • robocopy d:downloads e:downloads /MIR /SEC /LOG+:c:robocopy.txt /NDL /NFL

This replicates all the folders across to the other data drive (Data2) thereby mitigating against a single drive failure. All the replication results / logs are stored in a file (c:robocopy.txt) and I wanted that emailed to me so I grabbed a copy of Blat and added the following command line to the batch file :blat

  • c:toolsblat262fullblat.exe c:robocopy.txt -to YOUREMAILADDRESS -subject “RoboCopy Results” -server mail.YOURMAILSERVER.com-f “RoboCopy on Home Server” -u YOURUSERNAME -pw YOURPASSWORD

I named the batch file ‘replicate.bat’, put it in the c:tools folder and then scheduled the batch file to run every night at 2am with this command line :

  • SCHTASKS /Create /SC DAILY /TN Replicate /TR c:toolsreplicate.bat /ST 02:00

Excellent – now the data is replicated across two drives, and I get an email every day with the results of the replication process (in case anything goes wrong).

HTTPFSNext I wanted to ensure I have remote access to my files from anywhere. I grabbed a copy of the excellent HTTP File System and put that on the Home Server.

HFSScreenshotI set the root to the Data1 drive, created a user account for myself and gave it ‘upload’ ability and that gives me fully web based access to upload and/or download any file.

The next piece in the puzzle is to get full backups of the machines. For this I had planned to use VMware Server and the excellent VMware Converter tool, however it seems the command line options for the tool they provide p2vtool only works with a licensed version.

It’s a great tool and pulls a whole physical machine image into a VMware virtual machine – and is a great way to get the failed machine back to life – what it doesn’t do is restore a machine, but I’m most likely to rebuild any failed machine anyway – I simply need access to any files / data on there that might not have made it to the shared server folders…

 

GEO 51.4043197631836:-1.28760504722595

PowerShell Plus

One of my colleagues switched me on to PowerShell Plus and I’m loving it.

PowerShellPlusUI Code editor, snippets, values of variables, logging tools and much more, including a really neat feature called ‘MiniMode’ (see the toolbar icon at the extreme right in the image.

This ‘MiniMode’ closes all toolbars/toolwindows except the main console but also makes the console window transparent (user configurable level of transparency). This mode is real easy to work with…

PowerShellPlusMiniMode

There is a free single user license for non commercial use.

I encourage you to try it out.

GEO 51.4043197631836:-1.28760504722595

Automating Installs

I was spending far too much time installing OS’s – virtual machines, lab machines etc.

Unattended In order to automate / streamline this I wanted to look at not just the Windows tools as well as other options. Remote Installation Service (RIS) and unattended.txt files go so far, but during my investigations I came across ‘Unattended‘. This open source tool takes unattended.txt, mixes in silent installs for hundreds of other common applications and supercharges the whole lot…

So the deal is, you extract some files from 4 zip archives, configure a DNS alias, share the folder, copy over the i386 folder from your OS CD/DVD, burn an ISO (or create a boot disk) image and your done – 25 minutes end to end.

The boot CD/Disk loads some network drivers, maps a Z drive to ‘ntinstallinstall’ (the machine and share with the files and OS on it) and passes control to a bunch of Perl scripts, these ask some questions from which it creates an unattended.txt file and executes the OS install (reboots and all). When the install completes it can also (optionally) run silent installers for other applications (Office, Open Office, Acrobat Reader, PDF Creator, Visual Studio, Perl etc..) as well as Windows Updates and critical fixes (they keep an up-to-date list on the homepage).

So, in summary, after booting from the install CD then 2 minutes of console based questions I can leave things for an hour or two and come back to a fully installed Windows OS, office applications, sales tools, developer tools – whatever. The scripts that install the additional apps are customizable (you can even enter your product keys) and you can build up suites from individual scripts (so I can have a script to install Visual Studio, another for the MSDN library, another for each of the various developer tools and then I can combine them all into a ‘developer_machine’ script…

Have a look – if you are doing more than one install (even just two) then this can save you time…

C# class to update DynDNS

I’m in Western Mass (Westboro, MA) again this week and while that normally means 16 hour days (there is nothing much else to do but sit around a hotel room so why not…), this week I decided to work on a personal project for a bit.

Part of it was some code to check a machines public IP address and update it to DynDNS. Luckily they have an excellent developers / API section that explains everything you need to do this. There are two sections to it, detecting the machines public IP address and updating the hostnames associated with your account, both of which they provide a service for.

It’s pretty easy to follow and within an hour or so I had come up with a class to do both tasks. Here is a snippet for the ‘CheckIP’ function:

public static string CheckIP()

{

    // check the current public IP address

    string ipString = string.Empty;

    WebClient wc = new WebClient();

    try

    {

        string result = wc.DownloadString(“http://checkip.dyndns.com”);

        return ParseCheckResult(result);

    }

    catch (WebException)

    {

        ipString = string.Empty;

    }

    return ipString;

}

Just call a URL (http://checkip.dyndns.com) and it returns your public IP address, there was some parsing of the return text but it is pretty simple. Click the link and see for yourself.

 

Next was the ‘UpdateIP’ function, here’s the snippet:

public static string UpdateIP(string username, string password, string ipaddr, string hosts)

{

    // check the current public IP address against what we want to update to

    string updateurl = “http://members.dyndns.org/nic/update?hostname”;

    string result = string.Empty;

    WebClient wc = new WebClient();

    string url = string.Format(@”{0}={1}&myip={2}&wildcard=NOCHG&mx=NOCHG&backmx=NOCHG”, updateurl, hosts, ipaddr);

    try

    {

        wc.Credentials = new NetworkCredential(username, password);

        wc.Headers.Add(“User-Agent”, “KSL – WHS Updater – 1.0”);

 

It is basically just a case of passing a querystring with all the details to http://members.dyndns.org/nic/update , ensuring you set the credentials to your DynDNS account username and password and specifying a unique User-Agent.

 

The complete project files (including a small ‘user’ application to test it) can be found here (61K).

A good week

This week (so far) has been good – in terms of completing things, productivity and new products.

First off, Microsoft finally released PowerShell for Vista. No more having to ‘play’ on my old lab machine to get to grips with this stuff. There seem to be a number of people reporting failed installs(due to EFS encryption being disabled), just read the comments of the PowerShell blog announcement.

Next, we’re just coming to the final couple of days of a ‘Supporting Exchange 2007, Office 2007 and Vista SPRINT’ at work (we use a form of SCRUM as our development process) – all is looking good and we have beta sites lined up.

Then, I noticed Eileen’s (the most communicative Microsoft employee on the planet) post about Office 2003 to Office 2007 command references. An interactive demo from Microsoft when you can click the toolbars and menus of an Office 2003 application and it tells you how to find the equivalent command/function in Office 2007. I spent some time finding the 10 or so commands I’d been having difficulty with and increased my productivity.
Here’s her post : http://blogs.technet.com/eileen_brown/archive/2007/01/31/old-to-new-reference-guides.aspx

Then late last night (again at work) we just completed our internal testing before sending our Archive One product for Microsoft Platform testing. We are testing against 5 of the 6 platform tests (we don’t fit into the ‘Managed Code’ test category as we make extensive use of MAPI which basically requires C++ / Unmanaged code)

Camtasia and Powershell on Vista

I’ve been on Vista (on my work laptop) for a couple of months now and finding it really difficult to get some stuff done.

I’m (directly) working on some training modules for our Archive One products and managing / assisting a couple of people who are working on Sales Video Demos of these products.

The Sales Video Demo are making extensive use of Camtasia and my training modules are making some use of it. Their version 4.0.0 of Camtasia Studio is not supported on Vista and I can verify that it DOES NOT work on it (although you CAN install it, expect to get lots of application errors / crashes).
TechSmith (the makers Camtasia) say that there is limited functionality available under Vista (you can record your screen to AVI format, but that’s it).

There is a beta version of Camtasia available from here that works with Vista (pretty well actually) and the TechSmith guys plan to release full support for Vista by the end of this month.

As we’re heavily into Exchange Server and the 2007 version is now released (and makes extensive use of Powershell of management), I’ve been meaning to get to grips with Powershell.

Powershell is NOT supported under Vista yet either. They do have a Powershell RC2 available that works under Vista RC1 (build 5600). The details are available from their download page. Vista support is also planned for the end of this month.

I guess I should have probably waited a bit longer before migrating to Vista. Anyway in the meantime I have a test Win2003 Server set up that I’m using for Powershell.