Set Vim Shift Width

I have had a problem with vim for a while. Although I have my tabstop set to 4, when I use >> or << to indent or undent (technical term) my code, it moves the code by 8 characters. As I'm now working with phpcodesniffer, I’m pretty motivated to get my editor set correctly so I don’t waste time on formatting.

The setting I want is the shift width. I added this in my .vimrc file:

set sw=4

Hopefully this will help someone else with the same issues. I’ve been grappling with the tab/space/indentation settings for vim as long as I’ve been using it and I don’t think I’m done yet. Maybe one day I’ll solve it and write a big overview but for now, you can read the previous installment and pass on any tips you may have via the comments!

As an aside, I now completely understand why projects have vim settings in their files – I’ve got different coding standards going on inside different projects so I’m spending a lot of time fiddling with .vimrc these days!

Ada Lovelace Day: Kathy Sierra

In honour of Ada Lovelace Day, this is a blog post about a woman I admire in technology: Kathy Sierra.

I’ve been a big fan of Kathy’s site for a number of years, hers was the first site I saw where eloquent prose was wrapped around technical and relevant content. I’ve widened my reading list since that day but it made a big impression then, and re-reading the articles now it is clear I still have plenty to learn from them. Kathy’s blog Creating Passionate Users is stuffed full of great articles, and I prescribe all of them as good reading if you have the time. There are some gems in there though, that have completely shaped my own attitude to my profession and learning – its tough to pick favourites, but I would like to give mention to Angry/Negative people can be bad for your brain, the true but unchangeable When only the glib win, we all lose and of course Code like a girl.

A while after I started reading the blog, I started to hear more about Kathy Sierra herself and some of the things she’s done in her career – and its pretty impressive reading. She started her career in the fitness industry but with a strong interest in how the brain processes information she moved over into writing games. As a master trainer at Sun (wow!) she developed more ideas about learning and went on to co-found the Head First books. These are technical books with a very visual style, different from the drier offerings we usually see on software topics. Kathy also founded JavaRanch and is now a popular speaker across the technical conference circuit, inspiring many.

From the article so far, you can see why I name Kathy Sierra as an influence for me as a woman in technology – she has achieved so much and shared knowledge with so many. However, there’s another reason I hold Kathy in my mind. Almost exactly two years ago, she cancelled a speaking engagement at ETech following her reciept of threats of violence (including sexual violence). Her blog hasn’t had another post since her post regarding that episode. There was a virtual storm when it happened, with some very strong opinions on both sides of the fence – I even blogged about it myself at the time. Two years on, no more inspirational blog posts for me to read and my sense of injustice is as strong now as it was then. I also have this dark sense of vulnerability. I’m a woman in IT; I speak, I blog. I’m visible and one day I hope I’ll be successful – and of course I’ll always get comments made to me that are inappropriate, offensive and intended to hurt. That’s the price of being female and visible online, and the “pix pls” thing comes with the territory. But to be simultaneously female, popular, and successful in an online field … lets just say I’ve had my eyes opened to the dangers if I ever manage more than one of those.

I’ll wrap up by thanking Kathy for all her excellent writings, hopefully one day I will see her speak but already I’ve been educated and inspired. I wish I hadn’t also learned the darker things from her experience, but they’re definitely secondary and came along helpfully early in my career. Kathy Sierra is my inspirational woman in Technology – who is yours?

Open Office Presenter View

I was delighted to discover recently that Open Office have released a working version of their long-anticipated Presenter View. Both Powerpoint (from Microsoft) and Keynote (on the Mac) have these views which allow someone giving a presentation to see the current slide, the next slide(s), any notes associated with the current slide and some timing/progress information. Personally I’ve been booting into windows solely to deliver presentations for a couple of years now, partly for the Powerpoint Presenter View and partly because Linux isn’t very friendly about driving second screens.

Well, one of those problems has been eliminated with this new plugin for Open Office. It only works with Open Office 3 or above (I’m using 3.0.1). You’ll also need to download the extension from the project page which you can find here:

http://extensions.services.openoffice.org/project/presenter-screen

Go to Tools -> Package Manager and browse to the .oxt file you downloaded from the site, and restart Impress – hopefully everything should just work! The settings are hidden in the “Slideshow Settings” screen, look right at the bottom. And with luck, you’ll see your slides on your second screen as usual, and something like this on your main screen:

All I need to do now is figure out why I sometimes have issues with xrandr and projectors, and I’ll be ready to go!

Maker Faire UK

Yesterday I took the opportunity to pop along to the Maker Faire in Newcastle – its so exciting to see events like these in the UK! The marquee there was pretty small but what it had was great fun. I saw several things there that had me really drooling – one was a harp, another was a bracelet with LEDs on it, the idea being that you could have the LEDs get more intense or more agitated when you received more tweets/emails (except this wasn’t a working prototype, just a pretty idea). There were all sorts of other people there, including folksy and oomlout and an O’Reilly stand where I bought an instructables book.

We also popped over to the Discovery Museum, just up the road where there were a few more events happening. I haven’t been before and had a lot of fun looking around the various bits, especially the Science Maze. At the back of the science maze was a workshop where you could make a “throwie” – an LED taped to a battery and some magnets, for throwing at fridges and things, and then a darkroom with surfaces to throw them in.

throwies

Later on there was an appearance by the “robot” Titan. He arrived, and stood up … I was astonished to see a walking robot (walking is really tricky), especially since his shoulders seemed very large – and in the next heartbeat I realised it was a man in a grey plastic suit. There’s a few photos though on my flickr stream along with a few others from the day.

All in all I am very excited to see something like this happening in the UK and am on the look-out for the next event of this kind.

Simple SVN Merging

Today I had a big SVN merge to do – i’m at the end of a development cycle and I needed to merge my branch of changes back into trunk. I dug out my crib sheet for merging and tweeted that I had – and a few people asked me to blog it so here it is.

diff the relevant paths until the + and – shoe the operations you want to perform to your working copy

change into the equivalent directory on your working copy and replace the word “diff” with the word “merge”

That’s it.

Seems like a bit of a short blog post for something that a lot of people find painful, so here’s what I actually did, in more depth.

Example

  1. I had the branch I’d been working on checked out. I committed all changes and triple-checked that I had done that
  2. I ran svn log --stop-on-copy and noted the revision number which was the commit where I created the branch
  3. Next I took a checkout of trunk so that I could break things in my own space
  4. I changed into the new checkout and from the root of it, figured out what I should be diffing, piped it to more and read through the output to make sure I really was applying what I thought I was applying. svn diff -r[branch create rev]:HEAD http://path/to/repo/branch/ | more
  5. Then I ran the same command again but without the |more and with diff now replaced by merge
  6. I then checked my working copy, if there were conflicts I’d have resolved them, checked the system still worked, that sort of thing
  7. Committed my changes

I hope that helps – the same principle applies whether you are applying one fix or many fixes to trunk or branches – the key is to think about what it is you want to merge, and make sure the diff looks right. You can play with the diff without breaking anything for as long as you need to (which today was just as well because the first thing I tried was completely not the right one!) and once it looks plausible – merge those changes in and then untangle anything which has gone wrong from there. Hope this helps!

Speaking at GeekUp Leeds

On 18th February, I’ll be making an appearance at Geekup Leeds, to give a talk entitled “Linux-Fu for PHP Developers”. Basically this is a tour of some of my most-favourite command line tools available in Linux, and its a pre-cursor to the talk I’ll give later this year at php|tek in Chicago. What’s different about the Leeds version is:

  1. I have no idea yet if I can type and talk at the same time
  2. Its in a pub
  3. I will be using the Geekup-standard 20/20 format – 20 seconds per slide, 20 slides

I’m not panicking exactly, but I am thinking I need to get some practise in and decide which commands need to be included in this initial short talk version. Suggestions welcome, add to the comments please!

Locked Joomla! Content

I run the website for my local netball club and when I implemented this site I chose Joomla! to run it on. It seemed like a good idea at the time, in fact I even thought some of the other club members might log in and type into the user-friendly WYSIWYG editor to make content appear. Well, it doesn’t happen often – and when it does it seems like Joomla! locks up all sorts of things, from articles to menu items, which means I can’t edit them!

It turns out there is a simple solution to this problem, in the admin panel, just go to System -> Global Checkin … and all the locked items will become unlocked!! The concept of locking anything which is web-based annoys me immensely, but at least I know how to work around it in this instance – hopefully I’ll remember next time I have this problem.

Locking Session in KDE

I’ve been using KDE full-time long enough that I ought to know this, but I had to look it up! I was working in a shared location and I wanted to lock my session when I walked away from my machine. There’s an option in the start menu but the keyboard shortcut is ctrl + alt + L – then you need your password to unlock it when you get back.

Ubuntu Launching Apps

Since I started using Linux on the desktop, I’ve always used katapult to launch applications. However I have another machine that doesn’t have katapult and (since I don’t use a mouse) I’ve always used Alt+F2 to launch appilcations on there. Well, since installing Kubuntu Hardy Heron I notice it (it = KDE4 I think) has a funky new launcher thing that appears when you press Alt+F2:

As you start typing, it autocompletes and shows the icons of possible matches below – then you can click (or tab and arrow) to them, or keep typing until only the one you want remains. Very cute!

Colourful Tabs in Screen

A while ago I posted about screen, and included my .screenrc file. I got some teasing for this, since the tabs show up pink. In fact this .screenrc file is one I stole from somewhere a few years ago and didn’t really think much about the colours. Since then I’ve fiddled with the colours and now use different colours on different servers, which is a nice little addition.

Its really easy to do – using the .screenrc from my previous post – just replace all the M and m characters in the last line with the colour you’d like. I started off with something like this:

Y is for Yellow

replacing m with y and M with Y I get:

Green and Cyan

I’ve also used g/G and c/C codes for other servers, which looks something like this:

Titles

I seem to be keen on subtitles in blog posts, but I’ve not labelled many of my screen tabs in these examples (I have no idea why, I usually do). The yellow example has one where one of the tabs is named and this is really helpful once you get past about three tabs and start losing which one was tailing the apache logs! To label a tab in screen, go to that tab and then ctrl+a, shift+a and you are typing in the box. Enjoy :)