There are tons of example interview questions on the web. I would use those to look for gaps in your knowledge. I think the five areas in five essential phone-screen questions are a pretty good starting point. They are: coding, object-oriented design, scripting and regular expressions, data structures, and bits and bytes. Different interviewers focus on different areas, so even if some types of questions seem irrelevant or unimportant (bitwise operations are often scoffed at, whereas I don't care for regexes myself), you can't count on the interviewer to not ask them.

For a non-technical tip, definitely practice giving good, short answers. If you're not prepared, you'll start talking too much and wind up hanging yourself with enough rope. I made that mistake when I was asked what a closure was and realized too late that I had trouble explaining it. Even if you understand the concepts, you should practice giving good, short answers. Preferably with a friend.

Yes, being able to give good, snappy answers is critical. Practice melding your words carefully so you can illustrate any concept in one line. Just go over some concepts and practice, and you'll find it easier to find ones for other concepts gradually. Avoid metaphors, "it's like X, but Y" and too-technical responses. Some of the best programmers I've talked to are so because they're good at communicating - remember, your employer wants you to communicate well too!

The PHP SPL is really... surprisingly useful. I only just learned about it, but it's literally changed how my code works. It also allows for strict and fast data structures, as well as an OOP version of php's ridiculously procedural file handling functions. $file->fwrite yay!

When I was finding a job a couple of months ago, I noticed that things mostly fell into one of two types of questions: the "do you understand computer science concepts" questions, and the "do you know how to do X thing with Y technology we're using" questions. Some places ask a bit of both, but most lean heavily in one direction. (Google, Amazon, etc. are going to be more heavily slanted towards the CS-y stuff, while many web startups ask much more about specific languages/technologies.) Figuring out what to expect will be very helpful in preparing.

I went to the interview, but one of the people who were supposed to be there wasn't for some undisclosed reason, so I only got to do a brief non-technical interview (which went pretty well I think). So I'm going to be called for another interview later.

I really should work on some sort of portfolio. I've been putting Tunguska on my resume, but as it's fairly old (and I haven't really worked on it for a few years, and some parts has primordial C-code from back in late 2007), it's like a gallery of bad programming practices and dubious OOP design.

You, sir, name? wrote:I really should work on some sort of portfolio. I've been putting Tunguska on my resume, but as it's fairly old (and I haven't really worked on it for a few years, and some parts has primordial C-code from back in late 2007), it's like a gallery of bad programming practices and dubious OOP design.

I am working on a sort of 'code portfolio' for myself as well. I suppose it is more of a "past projects that might be worth talking about" folio. I want to show that I am active outside of school. Right now I did some work on a silly maze generator in C++. I have to learn about A* so I can find the spot with the most distance from the entrance and place an exit before it is completed though. After that I'd like to try to make a game out of it. Anyway my question is - if I don't have a lot to put into a sort of coding portfolio, how would you recommend approaching the problem of creating a code portfolio? I was planning on writing articles about various programming-related things on my personal website to sort of accompany the code.

Also, how would you write a C++ wrapper for linux syscalls? Would that be C++ code that calls the C functions internally while encapsulating it all in an OO fashion?

mister_m wrote:I have to learn about A* so I can find the spot with the most distance from the entrance and place an exit before it is completed though.

Actually, for finding the furthest point from the entrance, single-source shortest-paths is the easiest (and probably optimal?) solution, which is just breadth-first search from the source. A* is overkill.

In other words, suppose i have a path from the current directory to a file, say dir1/dir2/file.txt. (The path is relative, but you can assume it's in canonical form (no ..s) if you like.) What I want is a path from the directory containing that file to the current directory, so ../../ in that example.

With the "canonical form" assumption this just means a sequence of ../ with the same number of path components as the original path, minus the file. The following is probably good enough for me, but is very unsatisfying on a few counts:

Get both absolute paths, remove the initial part they have in common, and replace all the directories in one of them with ..s?

mister_m wrote:Also, how would you write a C++ wrapper for linux syscalls? Would that be C++ code that calls the C functions internally while encapsulating it all in an OO fashion?

Exactly. As a first step, mirroring the API in a not-very-OOP fashion with classes that wrap around file descriptors and similar and replace their error reporting with exceptions, and then adding more layers of abstraction.

Wrapping pthreads in C++ objects turned out to be a quite nice idea. Not only to get away from all the tedious error checking, but encapsulation and polymorphism also helps quite a lot. For example, instead of like pthreads having two nearly identical types mutex and spinlock, I have Mutex that is super-class to BasicMutex and Spinlock, and a factory-method to request the creation of a spinlock, that gives you a plain old mutex if the system has only one core.

I'm working on some useful objects to help multi-threading. A thread safe wrapper for std::queue seems quite useful.

I tried to create a thread pool, but I haven't gotten it working quite yet. It just reminded me how big of a headache debugging multi-threaded applications gives me.

Hm. I may limit my project to only wrapping pthreads. Seems more manageable.

I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

What's the kosher way of disabling copy constructors in C++ nowadays? I know c++0x has a new delete keyword that disables it altogether, but in older versions of the language? Is it enough to just declare it explicit and private have an empty body, or do I throw an exception, or what?

I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

Check out Boost's noncopyable. You don't necessarily have to use their code if you're not already using boost, but you can easily make your own. (It's also a rare header from them that you could probably just swipe and don't need anything else.)

But basically, make them private and then don't implement them at all.

I've met some trouble recently in chrome (could be webkit too, but I can't upgrade to 5.1 with the proper -webkit-radial-gradient syntax, *grumblegrumble* OS X 10.6 *grumblegrumble*). I've made faux soft gradients - basically a large radial gradient with lots of small ones plotted on top, giving these "blobs of light" effects. It makes for excellent and rich backdrops without requiring heavy images, and I can even give parallax effects to them when scrolling, giving depth.

Now, Firefox renders this really quickly - I can scroll up and down the page smoothly. On chrome, though, it lags a bit. Not much, but it's noticeable. I guess it might have to do with getting hardware rendering for these gradients. I would attach a full page for you to test, but alas, client work. Maybe in a few weeks.

Still, thank you for helping make CSS 3 work.

Spoiler:

And thank you for not making me add -chrome-linear-gradient to these already giant stockpiles of prefixed code. I NEED LESS.APP DAMMIT. WHY WONT IT WORK FOR OS X 10.5?! WHYYYYYYYYYYY IS THERE NO OLD VERSION ;______;

For added frustration-releasing effects: here's the code for that airmail-themed red/blue pattern.

You, sir, name? wrote:What's the kosher way of disabling copy constructors in C++ nowadays? I know c++0x has a new delete keyword that disables it altogether, but in older versions of the language? Is it enough to just declare it explicit and private have an empty body, or do I throw an exception, or what?

I checked in my hilaiously and sadly neglected copy of Effective C++ and there is a bullet point on Item 6 (explicitly disallow the use of compiler generated functions you do not want) that says the following:

To disallow functionality automatically provided by compilers, declare the corresponding member functions private and give no implementations.

There is an example in the chapter about using a base class called "Uncopyable" to do this:

Okay having given that explanation straight from the book, I have a question - as my C++ isn't that sharp. in the two private methods of Uncopyable - what does "const uncopyable&" mean? I know a const variable can't be modified, but what does the ampersand after the variable name mean? That is a const reference to an Uncopyable variable right? Why the const when it is passed by reference? To ensure that the data passed to the function by reference is safe from being changed at all? Also, what the heck is going on in the return type of the copy assignment operator?

mister_m wrote:There is an example in the chapter about using a base class called "Uncopyable" to do this:

That's the same as Boost's header above, except without the namespaces and include guards.

mister_m wrote:Okay having given that explanation straight from the book, I have a question - as my C++ isn't that sharp. in the two private methods of Uncopyable - what does "const uncopyable&" mean? I know a const variable can't be modified, but what does the ampersand after the variable name mean? That is a const reference to an Uncopyable variable right? Why the const when it is passed by reference? To ensure that the data passed to the function by reference is safe from being changed at all?

That's the normal declaration for a copy constructor (i.e., not specific to making something uncopyable). The object you're copying from isn't going to be modified, hence the const. It's a reference because otherwise the compiler would need to make a copy of the object before calling the copy constructor, and to do that it would need to use the copy constructor. (For the assignment operator, it's for efficiency.)

Also, what the heck is going on in the return type of the copy assignment operator?

You can do things like x = y = z to assign both x and y the value z. This is done by having (y = z) return the value y.

The potential boss seemed optimistic, so hopefully they realize that this stuff happens in a stressful situation. Especially since I nailed pretty much everything else (and knew what properties BSTs obey).

I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

The biggest thing I am worried about after graduating is starting to do interviews. I don't feel like I would be very good at them, and I took my data structures and algorithms classes in my first year so a lot of time has passed before I was really engaged in the material. I suppose the interview difficulty would depend on where exactly you interview, but I plan on spending time this year preparing myself.

Oh, right. For some reason I completely forgot about that since I last used C++0x. I still think the libsigc version is more convenient, but, now that I know about that, I'd rather use a built-in language feature.

http://internetometer.com/give/4279No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

I've met some trouble recently in chrome (could be webkit too, but I can't upgrade to 5.1 with the proper -webkit-radial-gradient syntax, *grumblegrumble* OS X 10.6 *grumblegrumble*). I've made faux soft gradients - basically a large radial gradient with lots of small ones plotted on top, giving these "blobs of light" effects. It makes for excellent and rich backdrops without requiring heavy images, and I can even give parallax effects to them when scrolling, giving depth.

Now, Firefox renders this really quickly - I can scroll up and down the page smoothly. On chrome, though, it lags a bit. Not much, but it's noticeable. I guess it might have to do with getting hardware rendering for these gradients. I would attach a full page for you to test, but alas, client work. Maybe in a few weeks.

Yeah, without an example, dunno. I sit next to the guys who deal with scrolling, and it's dark voodoo magic.

Still, thank you for helping make CSS 3 work.

Spoiler:

And thank you for not making me add -chrome-linear-gradient to these already giant stockpiles of prefixed code. I NEED LESS.APP DAMMIT. WHY WONT IT WORK FOR OS X 10.5?! WHYYYYYYYYYYY IS THERE NO OLD VERSION ;______;

And hey, I'm working on getting Image Values to advance down the standards track, so you'll be able to drop prefixes in a few months.

mister_m wrote:The biggest thing I am worried about after graduating is starting to do interviews. I don't feel like I would be very good at them, and I took my data structures and algorithms classes in my first year so a lot of time has passed before I was really engaged in the material. I suppose the interview difficulty would depend on where exactly you interview, but I plan on spending time this year preparing myself.

Refreshing that stuff turned out not to be that much work.

mister_m wrote:You sir, name? where did you interview if you don't mind my asking?

Don't want to say where until I know if I'm hired, but the job consists of developing in-house software for a major investment bank.

I edit my posts a lot and sometimes the words wrong order words appear in sentences get messed up.

==25700== 262,132 bytes in 1 blocks are definitely lost in loss record 320 of 321==25700== at 0x4C28FAC: malloc (vg_replace_malloc.c:236)==25700== by 0x513E8AA:???(in /usr/lib/nvidia-current/libGL.so.270.41.06)==25700== by 0x7FEFFFB2F:???

http://internetometer.com/give/4279No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

==25700== 262,132 bytes in 1 blocks are definitely lost in loss record 320 of 321==25700== at 0x4C28FAC: malloc (vg_replace_malloc.c:236)==25700== by 0x513E8AA:???(in /usr/lib/nvidia-current/libGL.so.270.41.06)==25700== by 0x7FEFFFB2F:???

This is purely anecdotal, but a while back I was playing around with pthreads and valgrind kept complaining that libpthreads was losing 1 block from initialisation as well. I could be wrong, but I've just put it down to "library magic". I recall finding some documentation from valgrind talking about how to suppress library errors since you can't do anything with those, so you might want to look into that so you only find your own errors.

You, sir, name? wrote:Unless you keep initialize and shut down down OpenGL in a loop in your program, how is this a problem?

Because I don't know for sure if it's happening when OpenGL is initialized, or somewhere else. I have heard somewhere that drivers sometimes don't free textures when you ask them to, but I guess there's no plausible way of finding out. I could eliminate some possibilities like that one experimentally, but I guess it doesn't matter, since I can't do much to fix it in my application.

http://internetometer.com/give/4279No one can agree how to count how many types of people there are. You could ask two people and get 10 different answers.

If you want to move a tab between windows in Chrome, you can just shut the tab in one window, open a new tab in the other window and select that page from the Recently Closed Tab list, since that list is shared between windows. This is especially useful if you have two maximized windows.