Does it make sense to do technical interviews and ask for basic algorithm stuff?

I’m currently preparing myself for a Google Phone interview. During my research I found this website, that listed common algorithms one can expect in a typical interview. I haven’t got my head around that yet, but jumped to the comments, which were very interesting:

These are horrible – if typical – interview questions. Asking horrible programming questions will get you horrible programmers.

I’ve been developing software professionally for 25 years. If someone asked me how I would implement a linked list, my answer would be “I wouldn’t. I’d a) develop in a language which supports lists natively or b) use a library.

If your interview tests people on their ability to reinvent wheels, you’re going to get programmers who are good at reinventing wheels. You want your interview questions to test a candidate’s ability to solve problems and make smart design decisions. Reinventing the wheel is almost never a smart design decision.

- Joe Peppersack

My response a bit later:

I basically agree, it doesn’t make sense in most companies, to reinvent the square wheel all the time. I had an interview with a startup that asked my how to implement a Hash-table …. in the end they didn’t know anything about my problem solving skills and ended up explaining a Hash-table to me. Still they were interested in me taking the job.

But for companies which are driven by algorithms, like Google or Facebook, it does make sense, to check whether the applicant know these things. Not to implement it by heart, but because the questions they asked are related to such algorithms. They don’t ask to implement a linked list, but they may asked how to detect a cycle in a linked list, or the start of the cycle. They want to see whether you can use the basic knowledge about algorithms to solve problems.

To know the algorithms by heart is one part, but to apply that knowledge to solve trick-questions, that’s what they want to see.

In the end, I know I’m not a good or bad programmer just by this knowledge, but I want that Job at Google :-)

I also once applied with a company that asked me how to implement a Hash-table. At that time I did Java programming for more than a lot years, 2 of them as contractor in a top financial company in Switzerland.

I told them I don’t know how to implement a Hash-table and that if I’d need something like a Hash-table…. I’ll use a Hash-table. I though, well that interview is over, but instead, they insisted on me to guess how I’d implement a Hash-table. I told them, I’m not willing to do guessing and spend time to come up with a mediocre solution that has already been solved and I would just look ridiculous. They agreed and explained me how a Hash-table worked :-)

For the next question the manager asked me a question about me J2EE background. He drew a big rectangle and said: “That’s the Java Application Server”. Then he drew a smaller rectangle in it and asked me: “What’s that?” I said: “It’s a rectangle” – “Yes, but what does it mean?” – “I don’t know. What does it mean?” – “It’s and integral part of every Java Application Server, can you tell me which one it is?” – “No, it could be any of the integral parts” – “Ok, just tell me an integral part of every Java Application Server” – “Well, is it an EJB?” – “No, its the J2EE Container” I just shrouded my shoulders. Whatever.

In the end they offered my a job :-)

Restore a Samsung I9000 Galaxy S

A colleague of mine had a really messed up Samsung Galaxy. He managed to have Clockworks Recovery on it, but that’s it. Furthermore the heimdall ui just didn’t work, so this command line helped:

[code]
heimdall flash --repartition --pit s1_odin_20100512.pit --IBL+PBL boot.bin --CACHE cache.rfs --FACTORYFS factoryfs.rfs --SBL Sbl.bin --PARAM param.lfs --KERNEL zImage --MODEM modem.bin --DBDATAFS dbdata.rfs
[/code]

Extract the firmware to the directory from where you execute the command above beforehand.

I found the stock firmware files here and created my own mirror here.

Show a localized placeholder example in a Django DateField

In case you have DateFields in your forms and are too lazy to add widgets (maybe also because they don’t work on mobile). This extension to the DateField offers a formatted date in the placeholder attribute of the widget:

[sourcecode language="python"]

def get_current_date_format_example():
return datetime.now().strftime(formats.get_format_lazy(‘DATE_INPUT_FORMATS’)[0])

class PlaceholderDateField(forms.DateField):
def widget_attrs(self, widget):
attr = super(PlaceholderDateField, self).widget_attrs(widget)
attr['placeholder'] = lazy(get_current_date_format_example, str)()
return attr
[/sourcecode]

Deploy a Django, South, Virtualenv with Git and Make

Be careful, this is not a hammer that hits every nail, it’s more a concrete example, from what you can derive your own set of files. The things that often differ are the usage of virtualenv, type of webserver and whatnot. I just want to show, that it’s very easy to setup and deploy a Django application with a simple Makefile and git. I’m sure there are other simple ways, if you know a even simpler one, I’d be happy to here about!

Here it goes:

On the target host:
mkdir -p /mypath/git/project_name
mkdir /mypath/project_name
cd /mypath/git/project_name
git init
git config --bool core.bare true

Create a file in /mypath/git/project_name/.git/hooks/post-receive
#!/bin/sh
dest=/mypath/git/project_name
echo "Deploying into $dest"
GIT_WORK_TREE=$dest git checkout --force
cd $dest
make deploy

In the local git clone
git remote add live ssh://user@server.com/mypath/git/project_name.git

Make a file: “Makefile”

a = . bin/activate
e = DJANGO_SETTINGS_MODULE=project_name.settings_deployment
d = /mypath/project_name/htdocs/
b = pg_dump -U dbuser -Fc dbname > dumps/pg_dump_`date +"%Y_%m_%d_%H%M%S"`.dump
bd = $(a);$(e) python manage.py dumpdata --natural --indent 2 --exclude=auth.Permission --exclude=contenttypes > dumps/dumpdata_`date +"%Y_%m_%d_%H%M%S"`.json
backup:
$(b)

dumpdata:
$(bd)

install:
virtualenv .
mkdir -p $(d)static
mkdir -p $(d)media
mkdir -p $(d)dumps
$(a);pip install -r requirements.pip
$(a);$(e) python manage.py syncdb --all --no-input

deploy:
chmod +x start_fcgi.sh
chmod +x RUN
$(b)
$(a);pip install -r requirements.pip
$(a);$(e) python manage.py collectstatic --clear --noinput
$(a);$(e) python manage.py syncdb --noinput --no-initial-data
IF YOU USE SOUTH:
$(a);$(e) python manage.py migrate
DO THE THING THAT IS REQUIRED TO RESTART/RELOAD your Webserver
$(bd)

clean:
rm -rf bin/ lib/ build/ dist/ *.egg-info/ include/ local/

settings_deployment.py looks like this:

from .settings import *
import os
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'dbname',
'USER': 'dbuser',
'PASSWORD': 'dbpasword',
'HOST': '',
'PORT': '',
}
}
VIRTUALENV = os.path.join(BASE_DIR, 'lib/python2.7/site-packages')

FORCE_SCRIPT_NAME = ''

manage.py looks like that:

#!/usr/bin/env python
import os
import sys
from django.conf import settings
import site

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "outdoorchef_cms.settings")
# load virtualenv if set
if settings.VIRTUALENV:
site.addsitedir(settings.VIRTUALENV)

from django.core.management import execute_from_command_line

execute_from_command_line(sys.argv)

There you go :-)

(I will further refine this article, I just posted it for reference, because I needed it myself. Please don’t hesitate to ask questions)

Bad experience: I/PaaS try-outs

Today I tried out OpenStack and Docker and both times, it was a disappointing experience :-/

Docker

Docker’s installation was very painless, but then I gave a stupid error:

vagrant@precise64:~$ sudo docker pull shykes/pybuilder
2013/09/20 08:36:27 dial unix /var/run/docker.sock: no such file or directory

Trying to fix it…. didn’t work

vagrant@precise64:~$ docker -d&
vagrant@precise64:~$ 2013/09/20 08:36:33 pid file found, ensure docker is not running or delete /var/run/docker.pid

[1]+ Exit 1 docker -d

Open Stack

Followed the Step by Step instructions form here.

Installation crashed at some point……

andre@openstack:~$ sudo
sudo: >>> /etc/sudoers.d/50_stack_sh: syntax error near line 1 <<< sudo: >>> /etc/sudoers.d/50_stack_sh: syntax error near line 2 <<<
sudo: parse error in /etc/sudoers.d/50_stack_sh near line 1
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

So much for that :-) I stick to Debian.

Screen Shot 2013-09-20 at 8.23.28 AM

On a side note: a small minded attitude makes you look funny afterwards

I once was working in a company which made literally millions with selling ring-tones, wallpapers and skins for the now old-fashioned phones from Nokia.  The company powered 248.ch.

Anyways there were two occasion which, in retrospective, were the clear clue I should have jumped the boat:

Apple iPhone

It was released on June 29, 2007 and by the end of August I already imported a handful of them. I showed them around in the company, most developers were very excited about it. The official reaction from the management was:

It won’t be successful, because the specs are outdated, it doesn’t support WAP nor MMS and it’s not possible to install any software on it.

I tried to convince them, that the era of tech-specs is over, and usability is the new ideal. The result was: they decided to copy the ring tones and make a Symbian skin.

It was a very disappointing time.

Google Android

Only a couple months after the release of the iPhone, the Open Handset Alliance announced Android. I was very excited again and instantly download the SDK and all resources and started to learn it. The official response from the management was:

Android has no Future, because they have no Hardware

I was like, yeah, but it will run on a myriad of devices and is even open source, but that was just like trying to put out a fire with oil.

There are people who can not sustain an opinionated discussion without bringing in a lot of emotions :-/

Regarding emotions, when have you watched the iPhone Keynote the last time? Maybe it’s time to do it again…..

Screen Shot 2013-09-17 at 3.59.03 PM

iOS 7 style checkboxes comparison

Apple overhauled their iOS UI and finally settled somewhere between Android 4 and

Windows 8 but in white. Still more 3D and material look than Windows 8.

And now that’s why I hate Webapps that try to look like native app: All Phonegaps apps need heavy UI updates now to not look like your typical Android app.

So for a project we do some views in HTML and the rest as native app. To make it look over the top, I searched for already made iOS 7 style toggles.

  1. Pure CSS, no drag, animated, neat HTML:

    http://codepen.io/joshnh/pen/hjbuH

  2. Pure CSS, no drag, animated, a bit more grey, a bit more HTML

    http://codepen.io/daneden/pen/cmIHG

I sadly found not a single drag-able checkbox switch :-( Anyways the winner is Number 1, because it has the cleaner HTML:

 

A collection of more CSS 3 switches, but not in iOS 7 style:
http://bashooka.com/coding/pure-css-toggle-switches/

 

BTSync can change a lot…. I suppose

Murder!!!! Wait, that’s just the name of a bittorrent based tool Twitter uses to deploy their code: Twitter – Murder Bittorrent Deploy System…. and Facebook uses it too.

But actually Bittorrent is an awesome protocol for file synchronisation across multiple nodes. It’s especially good with big files over not perfectly reliable connections. It has encryption built in and is quite bandwidth efficient, as it only transfers the delta, instead of everything.

And a couple months ago, a company called BitTorrent released…. BTSync as experiment. But it’s awesome, because:

  • it runs on Windows, Mac, Linux and has ARM support, so it even runs on Routers and NAS devices, it runs also on Clouds Systems and Virtual Hosts
  • it runs on iPhone, iPad and Android devices
  • it’s very easy to install

I use it to sync all my photos from my desktop computer to my web server as backup, Furthermore I sync my iPhone photos to my desktop with it. It’s so good!

It's so shiny!

2013, the year of soldering

Well, thats me. I’m a geek at heart. Seriously. That means I can be moved emotionally by programming, computer and electronic stuff in the same way as personal, life changing decisions.

Hacking consoles

I learned more about soldering, cryptography and digital technology in the couple months working on my consoles than in all of my education and work experience. The xbox 360 can not be fully unlocked without putting a small logic board inside. It’s called the Reset Glitch Hack and it’s an wonderful adventure! It make every tech-geeks heart beat higher and allows you to run Linux on your XBox and all the funny piracy stuff.

I worked with the products from Xecuter, which are pretty easy to use. If you can solder :-)

The Playstation 3 is a little bit different. Actually no one succeeded yet in hacking the hardware employed cryptology, but there was a software based jailbreak with the firmware 3.55. Sony closed the jailbreak pretty fast and everyone was forced to update. But then people figured out how to read and write the Nand (and Nor) of the console and this made it possible to downgrade it back to 3.55. But only f the console was shipped with 3.55 or an earlier firmware.

There is now Cobra ODE, a device that makes it possible to run homebrew and piracy without downgrading the playstation first. … don’t know how well it works though.