Monthly Archives: May 2007

Samba and windows

If you’ve got long usernames or usernames with spaces in you will want to look up the username map function of samba. This allows you to provide a file that maps long or complicated usernames to the ones on the box.

More information is available in the O’Reilly Using Samba book.

Getting a job as a programmer straight out of Uni

If you’re looking for a job as a programmer, software developer or whatever you want to call it there is one thing you ought to make sure you are ready to do at the interview. Program. It shouldn’t come as a suprise; you might be asked back for a second technical interview or you might get asked technical questions in the first interview but you will need to.

The type of questions asked are usually simple ones with very small dependencies. I favour simple text parsing questions myself. Some people favour date processing. You aren’t really likely to be asked to download an RSS feed and print the authors of the articles. With all the libraries out there these days this sort of thing shouldn’t take much code but it does require familiarity wiht the right libraries. It’s far easier to ask a question that just makes use of the core language and a few simple functions if necessary.

When I am asking an interview question I am looking for a few things,

  • can they write code?
  • can they deal with changes to the specification, or correcting their assumptions

I’m not massively interested in whether what they’ve written would compile as is. I am not worried about bugs, just that they can code and that I can communicate what I need coded to them.

I don’t even worry about the language that the code is being written in too much. The only reason that that would count against a candidate is if they had said they were good at a language and then could not present a decent example written in the language.

Some people start with some sort of code example to explain then move onto getting you to write your own code. I favour starting with a blank sheet and asking for some code. It tends to seperate those who are rusty from those who are practiced.

There are plenty of other things that I look for in an interview but the most common thing that’s a show stopper is this. It’s not a local problem either, as you can see from this article

One other thing to note is that being asked lots of different questions that you don’t know the answer to doesn’t necessarily mean that the interviewer hates you. When I am in an interview I am normally looking to give a candidate a chance to prove themselves. I don’t want to miss a really good candidate. If they are having difficulty demonstrating their technical ability to me I will ask as many different questions as possible in order to hopefully find an area that they are knowledgeable about and give them a chance to shine. It’s like school examiners, they normally want to give you the marks, you just have to show them something worthwhile.

Getting textpattern to do the cool section/name linking style

I started to get the scary notion that I have a basic understanding of Apache configuration when I figured out why my textpattern url’s didn’t work.

The way that these url’s work without there being underlying files is by using mod_rewrite. If you’ve dropped your site into the standard /var/www directory and wondered why it doesn’t work despite the .htaccess looking correct and the module being loaded take a look at the overall site configuration. By default /var/www has an AllowOveride None statement on all my installations so far.

To fix it either create a new config for the directory that the textpattern is running in or change that to allow the override.

Vim settings for whitespace

Indentation and whitespace alone can spawn whole religious wars with programmers. Some programs however have specific requirements or very strong ‘recomendations’ when it comes to tabs and whitespace so you may need to deal with both tabs and spaces for tabs.

Makefiles require tab characters as part of their syntax. Python strongly recommends you use spaces instead of tabs. In order to make sure that vim does the right thing when you edit these files you can add these commands to you .vimrc file,

autocmd FileType make set noexpandtab shiftwidth=8
autocmd FileType python set expandtab

This is in addition to your standard settings like autoindent,

set autoindent
set tabstop=4
set shiftwidth=4
set softtabstop=4

Detecting hackers in your webmail

I wish I thought of this one. It’s not perfect and may take some work to get right but Jeremiah Grossman’s post on detecting a hacker in your account is a pretty neat idea.

You know you’re a geek when…

You get excited by classes like FileInfo. The FileInfo class in the .net framework appears to solve most of those annoying filename/path handling problems that always used to involve plenty of string manipulation and lots of dodgy assumptions.

You can create an object of the FileInfo class with a relative or absolute path and then ask it for the various parts of the file/path. If you give it a relative path it can still give you a sensible full path. It also allows you to do the standard stuff like check to see if the file exists. All in all very simple and useful.

FileInfo iniFile = new FileInfo("myprogram.ini");
if(iniFile.Exists)
{
    IniFile ini = new IniFile(iniFile.FullName);
   // read the ini file settings.
}

O’Reilly Safari Bookshelf review

I subscribed to the Safari bookshelf a couple of months ago and I thought it would be worth describing their system in more detail. I blew through the trial period’s page limit in under a day when I tried it initially. It is worth using however to see if you can handle reading books online.

This review is as accurate as possible at the time of writing, April 2007. If they change anything for the better I might try to mention it on the blog. I am talking about the ‘Library’ subscription where you have no limits about the number of books you read.

It’s true that reading books online is slower and clunkier than the dead tree variety. Safari however does do a pretty good job of presenting the books and I was pleasantly suprised at how easy reading a book page by page was. There are two possible views for a book, a print fidelity view which matches how the book appears in print and an html view which can be easier to read/flow in a web browser. Not all books present all views.

Downloads are a lot more limited than I expected. You basically get 5 download tokens per month if you have the library service and they have a 3 month expiry period. These tokens allow downloading a chapter to PDF. The PDF is as far as I can see doesn’t have any restrictions but it does have your name in the document. From my point of view this is fine, it gives me a good way to print a chapter out in decent quality. The thing that I thought was limited was the quantity of downloads allowed. I had expected to be able to download books to read offline but that is not the case. You can download some chapters but you won’t get through many books per month, in fact if you tried it just by downloads you would take several months per book.

Search is deceptive. If you search for keywords rather than a title you will get reasonable results. The problem I had was that because of the way they were formatted I didn’t realise it at first. My expectations after search with Google is that search results would show some of the relevant text. The safari search results looked like it was showing me the first 3 chapters of the books it thought had relevant content. In actual fact they are the 3 chapters with the relevant content. Once I got over that I realised it was incredibly useful and allowed me to find useful information in books I wouldn’t have thought to look in. That does make it more useful than simply having access to lots of books.

The book range is pretty impressive. The main reason I held off looking at Safari originally was because I thought it was going to be Oreilly only publications. As it turns out they have lots of respected publications on there. Not all books are there but definitely enough to be useful.

It doesn’t tend to work in small browsers. I tried to access the service from my windows mobile and a Nokia 770 without success. I just couldn’t log in. This makes the service a lot less desirable if you don’t tend to be near a network connection all the time when computing. I suspect that they will have a load of issues with making it available to mobiles that aren’t just technical but I hope they overcome them. It would be an absolutely killer service if it worked on a mobile. Working well would be amazing!

In short, Safari is great if you are connected and want to be able to dip into lots of books. They have a great range and search is quite useful. If you commonly need to look into a lot of subject’s it’s really valuable.

C++ parser bug

Ever had problems using templates in C++? Did you suddenly start to get problems when you started to use compound templates? Like a map of strings to vectors of strings for example. If so it was probably an odd bug in the parser (I really ought to find details of it in a book somewhere).

To prove the point try the following code,

map<string, vector<string>> var;

versus

map<string, vector<string> > var;

The first line will cause lots of errors, the second won’t. The C++ parser just doesn’t like the >>’s. It needs there to be a space. I guess it must be the lexxer interpretting the >>’s as the >> operator. Either way I’m guessing that has been the biggest obstacle to the STL’s adoption.

Follow

Get every new post delivered to your Inbox.

Join 58 other followers