This month we have Reshma Sohoni from SeedCamp and Jennifer O’Grady from Democracy PR – and I can’t wait to hear both these women speak and hear their stories. The details are all on the website but in short the event starts at 6pm, its at The Loft Leeds, and I hope I’ll see you there!
Tag Archives: tech
Presenting Under Linux: xrandr
I’ve been a linux user for a few years now but when I started working for Ibuildings I started giving presentations, either as a speaker or when delivering training – and for a long time I used to boot into Windows for those, using a VM if I needed to code.
The main reasons I wasn’t comfortable using Linux to present were:
- I have Powerpoint and I use the presenter view a lot
- Linux doesn’t automatically find and configure monitors like Windows can.
Since Ubuntu Intrepid Ibex (8.10), its been possible to reconfigure screen in Linux without restarting X. But I was kind of scared of xrandr and I still liked the Powerpoint presenter view so I just carried on with windows. Then I realised that Open Office had also released a presenter view and I gave it a try. With one obstacle removed it was time to learn to work xrandr, which means I can also work external monitors without fiddling with xorg.conf, very useful. I’m now pretty confident with it so here’s the benefit of my wisdom*
xrandr
The first thing to do is figure out what you have and what your options are. So plug in the second screen and run xrandr with no arguments. On my system I get something like this:
Screen 0: minimum 320 x 200, current 1024 x 768, maximum 2560 x 1024
VGA connected 1024x768+0+0 (normal left inverted right x axis y axis) 338mm x 270mm
1280x1024 60.0 + 75.0
1024x768 75.0* 60.0
800x600 75.0 60.3
640x480 75.0 59.9
720x400 70.1
LVDS connected 1024x768+0+0 (normal left inverted right x axis y axis) 304mm x 190mm
1280x800 60.0 + 50.0
1024x768 85.0 75.0* 70.1 60.0
832x624 74.6
800x600 85.1 72.2 75.0 60.3 56.2
640x480 85.0 72.8 75.0 59.9
720x400 85.0
640x400 85.1
640x350 85.1
HDMI-1 disconnected (normal left inverted right x axis y axis)
HDMI-2 disconnected (normal left inverted right x axis y axis)
This shows VGA (your external output) and LVDS (the laptop screen) and all the various modes they support. I sometimes see output under HDMI-1, and this seems to cause problems so I always turn off this output by running:
xrandr --output HDMI-1 --off
Next I send a command to set the resolutions on both screens. For projectors I tend to go with 800×600 as this almost always works and it means the text on my laptop screen is then so large I can see it from several feet away!
xrandr --output LVDS --mode 800x600 --output VGA --mode 800x600
Its perfectly fine to have different resolutions on both machines but bear in mind that X has one desktop and will show you sections of it on each monitor so if they’re different sizes you sometimes get either bits missing off one monitor or one of the outputs looks stretched. I don’t really have any general advice with this other than get the projector in the right ratio and then fiddle with the available modes to see what works for you.
To set the second screen to be different from the first (i.e. tiled rather than mirrored), just tell xrandr where you want it.
xrandr --output LVDS --mode 1280x800 --output VGA --mode 1024x768 --right-of LVDS
Again you’ll get sections of a single desktop, not two separate areas, so things might look odd if they are on both screens. For me this command has worked really well since I got to grips with it in the last few months, and I’ve plugged various machines in to various external monitors and given a few different talks. I’m sure there is a lot more to know about xrandr but I haven’t needed it yet – hope this is helpful! If you have any experiences with this or anything to add, just drop a line into the comments form.
* I’m not an expert by any means, but the above works for me on Ubuntu with my Thinkpad T400 and my Acer Aspire One.
Screen-Profiles – Improved Screen in Ubuntu Jaunty
The first thing to say is that if you have an existing .screenrc file, you don’t get any notification or prompt about the new features of screen, I was lucky and fell over the information. To get to the features:
- if you have a .screenrc, rename it for a moment
-
aptitude install screen-profiles screen-profiles-extras
- run screen
EDIT: From Karmic Koala (9.10) and later these packages are now byobu and byobu-extras – they work as outlined here however, just the package names changed.
The first thing you’ll notice is that there’s a whole lot more stuff going on at the bottom of the screen. I have had a custom .screenrc file which gave me tabs for a while, but now they’re part of the standard setup.
If you look in the bottom right corner you’ll see there’s an “F9 Menu” – yep, screen responds to a whole bunch of function keys! I’ll keep my traditional ctrl+a mapping I think, but you can reconfigure this to your hearts content. And look at the menu itself:
You can change the colour themes (more on that another day, I’m still playing with the settings) and you can also turn on and off a load of different widgets, basically lots of different system information. I’ve got most of it turned off on my laptop (since I already have a battery meter etc) but for a server this could be really useful. Examples:
I’m really happy to see Canonical improving this particular tool, and I wanted to mention it purely because existing users of screen won’t see the new functionality by default which seems like a bit of an oversight. If you’re a screen user, upgrade to Jaunty, try it out, and leave a comment on how it works out for you.
Kubuntu Freezing on Splash Screen after Jaunty Upgrade
The problem was that the files in the ~/.ICEauthority directory were owned by root so couldn’t be written to by my user. I followed the instructions I found on this post where someone had exactly the same problem, and just chowning the whole directory to my user fixed the problem and allowed me to boot Kubuntu.
Hopefully if anyone else has this problem they’ll find either this post or the other one and also find the easy fix! If this works for you, leave a comment.
Auth Mechanisms for Web Services
Quite a lot of services don’t require any authentication at all, similar to quite a lot of the web. In either setting, the information is there for users to consume when they want. However the difference comes when services start doing more than making data available. If changes can be effected by the service, then we need to identify who is requesting the change.
Traditional websites use a username and password, and we can do exactly the same thing here. Services work on a series of discrete requests and its common to require that the username and password be supplied with every request. However for high-load services or where a particularly fast response time is needed, we can use something similar to sessions, where the user first has to authenticate and is given a token. On subsequent requests they supply the token and we wave them through without requiring their credentials again.
There are a number of considerations involved in deciding whether this setup can work for a particular application:
- Does it take time to authenticate? For example is there an external system to wait for or lots of user information to retrieve?
- How guessable is the token? Any kind of reasonable length hashing will help you here. I tend to use salted md5 tokens*.
- How long will the token be valid for? If interaction with the service is likely to be a burst of related requests, you might allow validity for 30 minutes for example.
- Will you require other identifying information as well as the token? For example you might require that the user also supply their username, which would have to match the token. I’ve also seen systems which only accept tokens from the same user ip address as the user’s original authentication call came from.
Also think about storing these tokens. They can go in their own table along with the information you want to use frequently – this is the same idea as storing information about a user in a session, for example. So user id, maybe display name plus the token itself, some information about when it was created or when it expires, and anything else that will be needed to check the token’s validity. With this information being independent and just used to verify the user, there is also the option of storing this in an alternative, faster, mechanism such as memcache.
This isn’t by any means everything there is to think of, but just some ideas of things to consider when designing a service.
* I blogged about salting md5s in PHP recently, if you are interested
Quiet Diff
diff -ur dirA dirB
The result was large and messy and included a lot of .svn files (long story). So to get an idea of how many files had differences I ran diff with -q for Quiet. This just outputs one line per changed file and also a line for if a file only exists in one or other directory. I then used grep to ignore any lines with .svn in them, and finally passed the whole lot to wc (for Word Count) to tell me how many lines there are.
diff -urq dirA dirB | grep -v .svn | wc -l
If you get a number greater than zero, your codebases are not identical and you have discovered why your fault is “intermittent”.
Set Vim Shift Width
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
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
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
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.
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.