Topcoder screen cast
Ran across the blog of super-topcoder Petr Mitrichev. Especially cool are the screencasts of Petr displaying his mad programming skills in topcoder competitions.
The Nolan Bushnell Atari Interview
Fascinating history of the rise and fall of Atari from its founder: Nolan Bushnell.
Interesting how he talks about Atari in its day being able to attract the best and the brightest. How when everyone in Silicon Valley was going to bare cubes, they went the other way to offices and hot tubs! The way Nolan describes the rise of Atari, he could very well be talking about any number of other Sillicon Valley success stories. Since the early 70s so many companies have risen and fallen in the valley, but the core values that make a company succesful have not at all.
How to answer Behavioral Interview questions
I’m never sure what is the best way to answer behavioral interview questions.
I know, I know, there’s no “right” answer. But, clearly the fact that they get asked at all indicates that there are favorable and unfavorable answers.
Recently I read that in politics, politicians are taught that if you get asked a question that you don’t want to answer, then answer the question that you wish you had been asked instead.
This seems to work in politics, do people think that it is a good tactic to answer behavioral interview questions?
To make king concrete let’s try it out.
Question: what is your biggest weakness.
You wish you were asked: what are your biggest strengths.
Answer: I feel that my biggest strengths are blah…blah…blah… And of course the areas that are outside of my strengths I will work hard on improvng.
What do people think of this answer?
Where are the new jobs?
Interesting blog post by the new york times.
It suggests a flaw in the common wisdom that the only sectors where there are jobs is in education and health-care. While it is true that that’s where the most job openings are, the fields where the most actual hires are is in business and professional services, which coincidentally is where most of the layoffs have also occurred.
What I think we see here is a lot of “rearranging of the deck chairs” as the new york times puts it. Or in another words, companies replacing workers that they don’t need anymore with ones that they find more desirable. I think this also highlights a common fallacy that a lot of economists fall for when looking at “knowledge” industries. That workers, and their skills, are *not* interchangeable.
ASIC digital design blog
Ran into this awesome blog on chip design. Best part is the puzzles and challenges which are very fun and educational.
Serial entrepreneurs 50% more likely to succeed.
Great study from HBS which finds that:
- 34% of successful entrepreneurs are going to be successful in their next startup
- 23 % of repeat entrepreneurs who failed in their past startup will be successful in their next one
- 22 % of first time entrepreneurs will be successful.
There’s no teacher like experience.
And also, this is pretty encouraging, much better than the common wisdom of 1/10 startups will be successful that gets repeated a lot.
Gitweb installation in 5 minutes
I couldn’t really find an easy tutorial on getting Gitweb to work on a Mac, so I decided to write one.
The end result should be an interface like the one for the Linux Kernel.
Here are the steps that I used:
- Download the Git source. Gitweb comes with it.
- Unzip, and cd to the just downloaded source directory.
- Copy the files gitweb/git-logo.png, gitweb/git-favicon.png, gitweb/gitweb.css to a directory that your webserver can see. For example, on a Mac, someplace under ~/Sites/, say ~/Sites/gitweb.
- Enter:
- Copy the newly created gitweb/gitweb.cgi to your cgi script directory, on the Mac the defaulit one is /Library/WebServer/CGI-Executable.
make GITWEB_PROJECTROOT=”<user dir>/scm” \
GITWEB_CSS=”<user dir>/Sites/gitweb/gitweb.css” \
GITWEB_LOGO=”<user dir>/Sites/gitweb/git-logo.png” \
GITWEB_FAVICON=”<user dir>/Sites/gitweb/git-favicon.png” \
bindir=/usr/local/git/bin/ gitweb/gitweb.cgi
Where:
GITWEB_PROJECTROOT : is the directory that contains your git repository(s)
GITWEB_CSS etc. : is where you copied the files in step 3
bindir : is the directory that contains the git executable.
Now if you point your browswer to the gitweb.cgi file (e.g. “http://<host name>/cgi-bin/gitweb.cgi”), you should see the nice web interface in action.
Google Maps Tutorial - Part 2
Next installment of the Google Maps tutorial series.
First we start with the starting point google map implementation, from the last post.
Feel free to peek ahead to the final google map implementation after this interation. Make sure you left click on the map, and drag and drop the resulting markers.
In this iteration I will add map overlays, actualy two kinds of overlays: markers (GMarker) and lines (GPolyline), that are provided by the Google Maps API.
Also I'll add event handler to handle mouse click events using the GEvent API.
First, I added a function to draw a line and store it in a array called lines. Drawing lines is as simple as creating a GPolyline object and adding it to the map using the addOverlay method.
-
function plotLine(pt1, pt2) {
-
var polyline = new GPolyline([
-
pt1, pt2
-
], "#0000ff", 5, 0.5);
-
map.addOverlay(polyline);
-
lines.push(polyline);
-
}
Next I added a plot function to plot the entire boundary, which is stored in the boundary array. In the plot function I first delete all the lines so far, useful if the user changes the boundary by dragging and dropping the markers, and calling the above plotLine function with the array of points in the current boundary variable.
Note how I can remove existing overlays by invoking the removeOverlay method of map.
-
function plot() {
-
if (lines.length> 0) {
-
for (var idx in lines) {
-
map.removeOverlay(lines[idx]);
-
}
-
lines = new Array();
-
}
-
-
for (var i=0; i+1<boundary.length; i++) {
-
plotLine(boundary[i].getLatLng(),
-
boundary[i+1].getLatLng());
-
}
-
}
Finally I tie everything together by adding event handlers for a click event and a dragend event. The click event will place a new marker, which can then be subsequently moved by dragging and dropping it. The Google Maps API comes with a default marker icon when a new marker (GMarker object) is created. This can be overwridden with whatever icon you want by creating a GIcon object which I did here for the first placed marker.
Note how the addListener method is given a callback function which gets a pointer to the overlay and the point itself on a click event. The overlay is checked to see whether we clicked on an already existing overlay (if so do nothing), and the point is used to create a GMarker object and add it to the map using map.addOverlay.
-
GEvent.addListener(map, "click", function(overlay,point) {
-
if (overlay != null) {
-
} else {
-
var n = boundary.length;
-
if (first_point) {
-
var func_icon = new GIcon();
-
func_icon.image =
-
"http://gsacs1.enterprisedemo-google.com/googleMaps/green.png";
-
func_icon.iconSize = new GSize(26, 26);
-
func_icon.shadowSize = new GSize(20, 20);
-
func_icon.iconAnchor = new GPoint(14, 24);
-
func_icon.infoWindowAnchor = new GPoint(15, 1);
-
boundary.push(new GMarker(point,
-
{icon: func_icon, draggable: true, clickable : true}));
-
first_point = false;
-
} else {
-
boundary.push(new GMarker(point,
-
{draggable: true, clickable : true}));
-
}
-
map.addOverlay(boundary[n]);
-
GEvent.addListener(boundary[n], "dragend",
-
function() {
-
plot();
-
});
-
-
plot();
-
}
-
});
And that's it, for this iteration. Check out the final product, and stay tuned for the next iteration. Also, you might want to check out the plan for the entire Google Maps Taxi application.
Google Maps Tutorial - Part 1
As promised part 1 of the Google Maps tutorial. See the original post for the plan for this series of posts.
We are going to build on the code in the original post.
In this part we are going to add a text box that allows the user to enter a street address (e.g. 123 Main street), and the map will center on that location.
We have already seen how to center the map using the "setCenter" method of the GMap2 object. Unfortunately "setCenter" does not work with a street address, you need to specify the full latitude and longitude coordinates. In order to do the conversion between street address and latitude/longitude, we use the GClientGeocoder object that is part of the Google Maps API.
First in the initialize function, which is called when the web page is loaded, we create a GClientGeocoder object.
-
function initialize() {
-
if (GBrowserIsCompatible()) {
-
map = new GMap2(
-
document.getElementById("map_canvas"));
-
var center = new GLatLng(37.4419, -122.1419);
-
map.setCenter(center, zoom);
-
-
map.addControl(new GSmallMapControl());
-
geocoder = new GClientGeocoder();
-
}
-
}
Note also that we added a small map control to the map. This will put a small control on the corner of the map which the user can use to pan and zoom the map.
We create a form so that when the user enters the street address and submits the form, the function findCenter is called and it is passed the argument that the user entered in the text box.
-
function findCenter(address) {
-
if (geocoder) {
-
geocoder.getLocations(address, findCenterCallback)
-
}
-
}
This function issues a query to Google with the street address as an argument. You also specify a callback function, "findCenterCallback", which is called by Google when it is done processing the getLocations request.
The findCenterCallback gets the return response from Google, and the rest of the processing can be done on the client side javascript code.
-
function findCenterCallback(response) {
-
if (!response || response.Status.code != 200) {
-
alert("address not found");
-
} else {
-
place = response.Placemark[0];
-
point = new GLatLng(place.Point.coordinates[1],
-
place.Point.coordinates[0]);
-
map.setCenter(point, zoom);
-
}
-
}
First the "response" variable is checked to make sure there are no errors.
Then the lattitude and longitude coordinates are extracted from the response, and a new GLatLng object is created. This GLatLng object (point) can then be used to set the map center using the "setCenter" method.
And that's it we are done! You can check out the full taxi application demo
Stay tuned for next time, when we will work on part 2 of the tutorial.
Monitor Filesystems with Inotify
I recently had the problem of writing an application that needed to get notifications when changes happened to a particular directory. Specifically, I was writing a Linux kernel mode driver (KMD), which would create entries in the /dev/ file system on connection of various devices, and I needed a user mode program that would detect these connections.
A collegue pointed me to Inotify, which solved this problem perfectly. In particular I used the C++ interface which can be downloaded along with an example code.
You can download the C++ interface for inotify. This compiles fine with g++ (e.g. g++ -c inotify-cxx.cpp)
And the example code for inotify (example.cpp). To use: compile this and link against the inotify-cxx object file.
The example code shows how you can easily get the type of event (e.g. create file, delete file etc.), and the filename of the file.


