June 26th, 2011 — Uncategorized
Recently I was working on a Solaris box remotely and lost my temper. I can’t remember why, and it’s not relevant. What is relevant is that in my rage, I swore at my file system. I know it was childish, and I definitely know better, but in the heat of the moment, I made a mistake. Unfortunately, I was in the process of naming a file in Vi, and I ended up with a file name full of punctuation marks. Realising my mistake, I immediately tried to remove the offending file. To my surprise, while I could see the file by issuing a simple ls, I couldn’t remove it. Bash issued a syntax error, interpreting the punctuation marks as special symbols. I now realise that I could have very easily escaped the offending characters, but I wasn’t that smart at the time, so what follows was my rather roundabout solution. While these steps may not be useful in this scenario, parts of the solution may prove useful for others.
Remembering back to my systems architecture classes at university, I started thinking of how I might get to my file via its inode rather than its file name. A quick search of the man page for ls revealed that I could list all of the inodes in a directory. Success; I now had another method of accessing the file. Checking the man page for mv and rm, I couldn’t see any way to rename or delete the file via its inode. Having recently done some work with find I knew how versatile and useful a tool it is. Checking its man page, I was pleased to find that I could search for files by their inode number. Combining this with the exec flag, I was able to rename my file to something sensible. The code snippet below gives an example of how this all fits together.
ajmccluskey@solaris $ ls
^()$@ Documents
ajmccluskey@solaris $ ls -i
264015 ^()$@ 262180 Documents
ajmccluskey@solaris $ find . -inum 264015 -exec mv {} test \;
ajmccluskey@solaris $ ls
test Documents
So there you have it. My lacking knowledge of Bash will never get in the way of me solving a problem; albeit in a very roundabout manner.
February 3rd, 2011 — Uncategorized
I enjoy making software. I also enjoy playing with the systems that support making software: for example source control, unit testing, continuous integration, issue tracking. As a result, I have wanted to set up my very own build server to manage personal projects for a while now. As an intermediate step to building my own server, which looks to be a rather large undertaking, I have elected to use bitbucket. Using bitbucket not only provides me with these services while I work on developing my own, it should help to inform the choices I make regarding my own system.
For those who are new to bitbucket, as I am, it is an online service that provides, among other things, Mercurial hosting for your source code. Its use of Mercurial, which is my current source control tool of choice, and its use of ssh keys for simple and secure communication are the two main reasons I have chosen it. Speaking of ssh keys for communication, there are two different ways to access your code once it is on bitbucket: via https using a username and password, or via SSH using public/private keys. I’ve elected to use SSH because using https requires that you enter a password whenever you commit, and I’m too lazy for that. My personal philosophy is to automate as much as possible, and make things as easy as possible long term; even if that requires additional effort up front.
Continue reading →
November 12th, 2010 — Uncategorized
For anyone out there who has read my previous posts on building your own OpenSolaris file server, I have another addition to make. In my second post regarding, among other things, setting up a VNC server, I included a script to start x11vnc. This setup has always worked fine for me with one exception: the shift key. Whenever I want to type a capital letter, or use the shift key for any reason, it doesn’t work. Tonight, after a cursory google search, I found someone with an answer. I rushed off and added the option to my script before running it to apply the changes. Lo and behold, the shift key was working. “Great, that was too easy” I thought to myself. However, I quickly discovered that the arrow keys were doing weird things. The most problematic of these things being the lack of repeating the previous command entered at the command line when pressing the up arrow. This was not a sacrifice I was willing to make. Luckily, the ever informative serverfault came to the party with an even better solution.
I’ll leave it as an exercise for the reader to apply these changes to the original script. If you have problems, don’t hesitate to contact me or comment. Finally, a comment on the page with the first solution mentioned that this issue has been fixed in a more recent version of x11vnc, however I am yet to check this out.
October 16th, 2010 — Nerdy Stuff
While messing around with a personal project in Eclipse, I attempted to use the Visual Studio keyboard shortcut for autocomplete (ctrl + space). Rather than completing the variable name I had started typing, it began trying to convert my keyboard input into Chinese characters. At first I thought this might have been some idiosyncrasy of Eclipse. After a little research I discovered that Eclipse does in fact use ctrl + space for autocomplete, but Windows (bless its soul for trying to help) was hijacking the shortcut and using it to change languages. For anyone in a similar situation, here’s how you fix it in Windows 7:
- Open Control Panel -> Region and Language
- Select the “Keyboards and Languages” tab
- Click the “Change keyboards…” button
- Select the “Advanced Key Settings”
You should now see a list of actions and keyboard shortcuts. For each action that has a conflicting keyboard action, select it and click the “Change Key Sequence…” button. Here you can either change the action to have no shortcut at all, or give it an alternate shortcut. Keep clicking OK until you’re out of the menus. Immediately the keyboard shortcut stopped switching my language, and after a restart of Eclipse, started autocompleting. Simple!
References:
social.answers.microsoft.com
June 23rd, 2010 — Nerdy Stuff
I’m very excited to be typing this on my brand new ASUS PL30JT. When I was looking for user reviews of this machine over the last couple of days I didn’t find many, so I thought I’d take the opportunity to help others interested in this machine, as well as test out the keyboard a little more extensively. Please keep in mind that my last laptop is an Apple Macbook Pro circa 2005, so a lot of the standard features on new laptops are possibly novel and exciting to me.
Continue reading →