Posts tagged 'Misc'

18

August 2012

Frustrations with Git on Windows (and Codeplex) / Suggestions to the Git Devs

During some ranting about Git on Twitter, Brendan Forster suggested I blog the things I would change. I don't have time to write a lot, but I thought I could spam out a list of things based on my first 30 minutes with Git on Windows.

Note: I've just installed GitHub for Windows as a result of these frustrations. I'm not usually a big GUI fan (I use Mercurial from the CLI always), but initial impressions are good. But still, I'm blogging about the CLI for now...

I grabbed a "Portable" version of Git, as I didn't want to soil my machine with something I knew was going to frustrate me. It contained a "git-cmd.bat" file that seemed to get me to a command prompt with git in the path.

Cloning

This one should be easy, right? Even with no knowledge of Git, I knew I could do git clone url. Well, turns out I couldn't do what I was used to doing with Mercurial (though this may be Codeplex's fault). I copy/pasted the URL to my fork of xUnit from the address bar, and hit enter. I got an error: fatal: http://(url) not found: did you run git update-server-info on the server?. WTF? Is this a Codeplex issue?

No, it wasn't. It was a user issue. The clone url for a repository on Codeplex is not the same as the homepage of the project. The last part of the message is rather misleading. I've no idea what update-server-info is, but I'm going to bet that more than 90% of the time that someone encounters this error, they just pasted the wrong url (or typo'd). The text should suggest this, rather than some server-side command that is probably rarely correct.

Suggestion: Re-word this message to be useful for the majority of cases.

Repository Status

In Mercurial, I type hg st to see repository status. It works, because I've typed enough characters that Mercurial knows that I must mean status. I tried git st and was greeted with a big list of commands that I "might have" meant, including even reset! Eh?

Suggestion: Steal Mercurials behaviour, and save keystrokes.

I did a quick count on how many keystrokes it took me to do the same thing (commit an edited file) in Mercurial and Git. It was 18 + the message in Mercurial, and 40 + the message in Git. WTF?

Repository Diff

In Mercurial, I type hg diff to see all of the outstanding changes that will be committed if I call commit. I did the same in Git and ended up stuck in some crazy mode that let me page up/page down, but apparently not exit. I tried Ctrl+C, Break, Escape, Enter and tons of other keys. I had no idea how to quit. After some Googling, I discovered it was :q. Classy. Just like all those other Windows applications.

Suggestion: Spit the diff out directly to the console like Mercurial (especially if it's so short it wouldn't fill the buffer). We already have the ability to scroll!

Suggestion: Don't use shortcut keys that aren't familiar to Windows users on Windows.

Suggestion: If you put the user into a mode that they need to "exit" to continue doing anything, tell them. Show something on screen that says "Press :q to exit"!

Commit

Ok, so I've seen my change. It all looks good. I need to commit it. Diff has already shown me the changes, so it knows what I want. git commit, right? Wrong! This command told me I hadn't added any changes to the staging area. What? Diff just showed me them! Turns out, I have to do "git add" first, so it knows what I want to commit.

Suggestion: Either don't show unstaged(?) changes in diff, just show a message saying there are some, or highlight the unstaged changes in some way.

(I'd almost go as far as ditching this staging crap, but I don't know enough Git to really understand the implications of that)

Commit (part 2)

With my changes staged, I can finally commit (hurray! so far this has taken longer than the 10-line-change I actually made!). So I type git commit. With Mercurial, this would fire up Notepad and let me type my commit message...

With Git, this launched VIM. That's right, VIM. You know, that standard Windows editor that everybody is familiar with? No, exactly. I started typing my commit message and my cursor starting moving all over the place and doing crazy things; I'd clearly mashed my way into executing commands or something... With that fixed, it was time to save and quit. I probably don't need to tell you how this works in Notepad! I tried Ctrl+S, Escape, Enter, Ctrl+C, and all sorts of other stuff. Again, I had to resort to Google. I wanted <ESCAPE>qw. Of course. Just like Microsoft Word; I should've known that! :-/

Suggestion: Use Notepad by default on Windows.

Suggestion: Don't use shortcut keys that aren't familiar to Windows users on Windows.

Suggestion: If you put the user into a mode that they need to "exit" to continue doing anything, tell them. Show something on screen that says "Press <ESCAPE>qw to exit"!

Pushing

With my change (finally) committed, it was time to push to Codeplex. This one isn't really Git's fault, but I spent 5 minutes trying to figure out why I got Authentication Failed messages when I entered my Microsoft Account details. Turns out, I have a Codeplex username/password from years ago which is "linked" to my Microsoft Account, and despite logging in to Codeplex using my Microsoft Account, this doesn't work with Git.

Suggestion: Let users push to Git using the same details they login to the site with! Or at a minimum, change the text that says "same as your website password" to make it more clear this is a Codeplex password, and not the one you probably used to login to the website!

Conclusion

My conclusion after all of this, is that Git is a fuckup on Windows. It's not friendly to Windows users, and it makes things way more complicated than they should be. If Mercurial had been half as complicated as this, I'd have never moved to (and advocated) DVCS.

I don't buy the "it's more complicated because it's more powerful" bullshit. What I was doing today should've been incredibly simple; and in Mercurial, it would have been. Mercurial is also cross-platform, so it's not like this terrible Windows support can be blamed on that.

I'm genuinely surprised that Git has become so popular on Windows (and at Microsoft) when it's such a mess. I can only assume this is down to GitHub doing a significantly better job than sites like BitBucket!

Luckily, it looks like GitHub for Windows might fill the gap between the totally-ridiculously-complicated-CLI and the complicated-and-badly-performing-explorer-humping Tortoise applications. No doubt I'll be tweeting more about that soon ;-)

I'm sure the Git fanboys/Linux Zealots will disagree with all of this and tell me I'm wrong. And that is why Git fails so badly on Windows. The zealots care more about trying to force their way on users rather than trying to build something that is easy to use and fits in with what different people are familiar with.

Git devs: When in Rome, do as the Romans do.

06

May 2012

Free dependency graph generation using PowerShell and yUML

I don't like the idea of paying for (or installing) a tool to just show me some simple relationships between my Visual Studio projects, but it's something that is pretty useful when trying to tidy up a huge legacy codebase.

I whipped together a quick PowerShell script that spits out project references in a format ready for pasting into yuml.me to draw a chart:

The output will look something like this:

27

February 2012

Enabling Cron on a Western Digital My Book World Edition

Earlier today, a tweet from a colleague got me wondering whether I could set up cron on my NAS drive to give me the ability to run scheduled tasks. I don't leave any machines on at home, but my NAS drive is on 24/7, so it could be useful - especially as a backup system if Google open an API to Takeout!

I managed to get it working with some help from this post, so I thought I blog the details here (it turned out to be simpler than that post suggested) should it be useful to you (or to me, should I ever need to do this again).

There was no requirement to do anything crazy to make this work. I didn't install anything on the NAS, everything was there - even the SSH access is enabled via the web app!

  1. Log in to the My Book admin web app.
  2. Go to the Advanced section.
  3. Tick to enable SSH access at the top of the page (note: you may need to update your firmware to get this option).
  4. SSH into to the IP address of your mybook, using the username "root" and the password displayed on the page where you enabled SSH access.
  5. Create a folder to store our crontabs. Since /var/spool is mapped to /tmp it'll be wiped at rebooted, so we need to keep our own.
    mkdir /etc/crontabs
  6. Create a job that touches /tmp/crontab.test every minute (for testing).
    echo "* * * * * touch /tmp/crontab.test" > /etc/crontabs/root
  7. Create an entry in init.d to start crond using our /etc/crontabs folder.
    echo "/usr/sbin/crond -c /etc/crontabs" > /etc/init.d/S99crond
  8. Set permissions for execution.
    chmod 755 /etc/init.d/S99crond

That was all there was to it. I ran "reboot" and let the NAS reboot, then confirmed that /tmp/crontab.test was being touched every minute (with "ls /tmp/crontab.test -l").

Note: You should disable SSH access when you're done, or change the password. Otherwise, anybody on your network may be able to gain root access to your NAS!

If you make changes, you'll need to restart crond. You can do this with:

  1. killall crond
  2. /usr/sbin/crond -c /etc/crontabs

Next up, I'd like to find a way to edit the cron scripts from my Chromebook via something like Cloud9IDE rather than SSH/Vi ;(

07

January 2012

Google Chrome NativeClient - The New ActiveX? Is it Good for the Web?

I like the possibilities that NativeClient in Chrome will open up, but I can't help think that we're going backwards... Do you remember when we used to see "Best viewed in Internet Explorer" and other crazy stuff written on websites?

Surely with Chrome/NaCl we're just going to end up with "This game/app only works in Google Chrome with NativeClient". This doesn't seem like a good thing for anyone (devs or consumers). We were just starting to get web standards right, with cross-platform coding easier than it's ever been.

I think it's highly unlikely that other browser makers will add NaCl. Certainly not Microsoft - it just makes Chrome, Chromebooks, ChromeOS more attractive to their Windows customers. I don't think they'll want to help that cause!

I love the Chromebook because it's designed for the web. It's apps are cross-browser/platform by design. It's not like Windows, Linux, iOS, Android, etc., where all the "default" apps are locked to the OS. My biggest problem with the recent take off in mobile computing is that apps are tied to the OS. This just isn't right. I should be able to pick an OS based on my preferences, and not lose all my apps, or have a restricted choice of what I can run. ChromeOS will only run things written in an open standard that work on every other common consumer OS. Do we really want to destroy this?

Don't get me wrong, I think the idea of being able to run near native code over the web is an *excellent* idea. Web-based apps solve so many problems with deployment, updates, security, etc., and being able to run performant apps in the same way is great. However, we need something open for the web, not another thing Google have gone away and built on their own and try to force upon others (just look at Wave, Dart, etc.). If they intend for NaCl to be in all browsers, then it needs to be developed openly with input from all parties, not just sprung on the world (note: I don't know if this is their intention).

Is NaCl just going to be the new ActiveX?

28

October 2011

Using a Google Apps account as an Open ID login with a custom URL

For a long time, I've been using the address of this blog to login to websites that support OpenID. Rather than handling this myself, I used OpenID Delegation to let Google handle the login for me. However, it's always bugged me that due to the requirement of Google Profiles, I've always had to use my GMail account to login:

<link rel="openid2.provider" href="https://www.google.com/accounts/o8/ud?source=profiles">
<link rel="openid2.local_id" href="http://www.google.com/profiles/danny.tuppeny">

That was, until now. With Google+ launching for Google Apps yesterday, we now have profiles URLs for Google Apps accounts! It's as simple as changing the openid2.local_id tag to point at this URL, and now I can use my Google Apps account to login to websites using Open ID without being tied to Google in the future!

<link rel="openid2.provider" href="https://www.google.com/accounts/o8/ud?source=profiles">
<link rel="openid2.local_id" href="https://plus.google.com/113181962167438638669">
« Older posts