Entries Tagged 'tech' ↓

A poke every 864 seconds

Because I work on web software, other geeks ask me for help with really odd side-projects…

I want to repeatedly do a superpoke action on facebook.
like every 5 minutes
ok
what’s the easiest way to set that up?
I tried wget and it needs both to set the browser type and also a cookie for logged in which I don’t know how to do via wget

curl may be better for that - more options
alternative is Mechanize

so my facebook poking problem has been solved.
oh?
I just used a small amount of javascript and an iframe
hahahaha
I had it poke her once every other minute, however you’re limited to 100 pokes per day per person apparently before it starts deleting the old ones.
so I’ll set it to once every 864 seconds for now

For those of you puzzled by 864: 24 hours * 60 minutes * 60 seconds = 86,400 seconds.

One-click mashup: gmap + geonames bookmarklet

Doing some research for url_pipe for DemoCampMontreal4, I went around looking for the state-of-the-art in feed technology. Some of this stuff was too cool not to turn into a bookmarklet.

Create a bookmark (e.g. “Map this!”), with the following for location:
javascript:links = document.getElementsByTagName('link');for(var i=0; i < links.length; i++) {if (links[i].rel == 'alternate') {this.location = 'http://maps.google.com/maps?f=q&hl=en&q=' + 'http://ws.geonames.org/rssToGeoRSS?feedUrl=' + encodeURIComponent(links[i].href);}}

Now try clicking it on while visiting the Standoutjobs blog or Crunchboard for an instant mapping mashup.

How it works: this will grab the first alternate link on a page (RSS/Atom - it could break if it’s print!), and send you to Google Maps. The magic bit is provided by Geonames’ rss-to-georss converter, which adds geographic location to a feed before GMap gets its hands on it.

Again, this could break very easily. If you go to the 37signals job board, there is no alternate link - the RSS is in the main body. Nothing really bad happens, it’s just not very elegant.

Any suggestions as to how to make this better, or improvements are appreciated. Wordpress doesn’t like code in comments, so please post any code on your favourite pasting site. (It also wouldn’t let me create an easy to drag bookmarklet. Any hints on how to make it do that would be appreciated).

Mocking webservices in Ruby on Rails

Marc-André’s presentation last night at Montreal on Rails rocked. He tackled the issue of making unit tests faster by mocking web services.

It was a timely presentation, with at least one RoR shop in the city feeling the pain of testing models that depend on those services. When tests run slow and are difficult to write, we obviously want to write fewer of them.

Why the best web hackers hate Microsoft

The best web developer have the most reasons to hate IE and Microsoft. They pay the highest productivity tax.

For scaling, it’s been pointed out that it’s normal for the database to be the bottleneck after you add a cluster of web servers. If you take out the bottleneck of model and controllers, you end up spending most of your development time in the view.

So the most productive programmers end up spending a higher percentage of their time dealing with view issues. And that, inevitably, means having to deal with cross-browser compatibility issues. Although there are standards for how certain code is supposed to display on a browser, there is no reliable way to ensure it works asides from actually trying it in each one.

When things don’t look good in all browsers, it’s usually Internet Explorer that is not behaving properly. We try something, test it again in all browsers. Rinse and repeat.

This is what I call the Microsoft productivity tax. The faster you are at writing web apps, and the more unusual the project, the higher the tax.

So, a word to all my tech friends that work on non-web projects: Piss Off. My hatred of Microsoft isn’t some knee-jerk commie thing. Think about how you would feel if for a couple weeks a year you wasted time on cross-browser issues, mainly working around MSIE inadequacies.

DemoCampMontreal3: Defensio, Vinismo and the web as platform

DemoCampMontreal3 already has great wrap-ups by Marc-André and Heri, so I won’t re-hash things here. What struck me was the change in the type of applications shown. Of 4 applications, one was fairly simple (Workcruncher). All the rest were either mash-ups or mashable.

  • Vinismo is a semantic wiki with a creative commons license, and an RDF API.
  • Defensio’s spam filter is delivered through an API.
  • Jerome Paradis‘ Allo Stop for jet planes uses a google map to display information that was extracted from various sources, including a mailing list.

Good APIs and data licenses are good first steps for business cooperation. The more startups like Vinismo and Defensio, the more niche plays like jet-sharing become easy to implement. We need more mashable startups, and I hope these are a sign of more to come.

Today’s O’Reilly Radar has a blog post about Wesabe, Making the web into a banking platform (whether they like it or not). It has some provocative insights, go read it.

I’m looking forward to the next democamp. Jonathan and I should have url_pipe ready by then, tackling another way to loosely couple data providers and consumers.

I’m a Ruby Guru!

Ben and Fred at Standoutjobs got me to move from Quebec to Montreal to become a Ruby Guru. I will be guru #2 after the very talented Marc-André Cournoyer. Like him, I now have a standard-issue MacBook Pro with a second screen.

I was very reluctant to leave beautiful Quebec city. I had a great apartment downtown on St-Jean street and was looking forward to a summer chilling on terraces.

They have a convincing pitch, and the project is ambitious. Ben, Fred and Austin have all had previous business success. With such a track record, and by recruiting people like Marc-André, they are very likely to succeed. This should be fun, and a great learning opportunity.

Net addiction?

My whole life is managed through the internet. It’s my phone, yellow pages, maps. I use it to connect with friends and make plans to meet ‘in real life’.

The wireless connection here has been pretty unreliable. My landlord has been putting off hiring someone to repair the system. There’s a router on each of the 10 floors of the building, and a company has quoted $10,000 to configure it. 10 grand… some people are obviously making lots of cash on this wireless thing.

If I had a key to the room that has the router, I could simply power cycle it, but I have to go through layers of bureaucracy in my apartment building to get someone to do it. Last night, that took an hour, two before the connection came back.

Some might call this a case of addiction. 15 minutes without net and I’m starting to fidget. I don’t mind going for hours without an email when I know the connection is there when I want it.

People would probably freak out just like I did if their cell phone died. It’s a social connector and being out of the social loop is a scary thing for us social animals. For nerds, that connector is your net.

Feel free to comment anonymously if you think I’m addicted though :)

The right salary for the right programmer

A CEO and HR manager were shocked when a friend of mine asked for $20-30,000 more than he’s currently making.

His current employer has basically indicated that he’s too young to be considered a “senior”. That is perhaps socially acceptable, although it is certainly not legal. They can get away with it because younger programmers have smaller networks and fewer options.

This got me thinking about salaries, and tickled the memory of an article by Malcolm Gladwell, Basketball By The Numbers. In short, we’re terrible at judging how much players contribute to the success of a team.

[The authors of “The Wages of Wins”] argue that traditional talent evaluation over-rates the importance of points scored, and under-rates the importance of turnovers, rebounds and scoring percentage

If we applied similar metrics to a development team, could our win scores go down every time a colleague had to fix bugs caused by your commits, and go up for every useful feature we put in and every test we write? I’m sure you can think of more, but we’ll never have a perfect metric.

Steve Nash has a lower Win Score than Shawn Marion. Gladwell doesn’t think the statistics can tell the whole story:

Nash’s particular, largely unquantifiable; genius is that he manages to make everyone around him much better.

All this should sound very familiar to software developers. We all know the good and bad players on our team. You almost certainly have people you go to for advice, to brainstorm ideas for tough problems. Then again, maybe you spend half your time fixing another colleague’s code.

Salary can be a touchy issue, and it’s all the more controversial in professional sports. The correlation between salary and performance can be very weak in programming as well, especially because there is such a high variance in performance. A coding monkey can be twice as fast and efficient as another. But how do we measure the variance between your average junior and someone like Linus Torvalds? Or between a PHP beginner and David Heinemeier Hansson (creator of rails)?

A framework programmer that can supervise 3 people to do the work of 20 others is someone a manager should be happy to pay 50% more than those with a comparable education.

Since in most large companies managers don’t way to pay their underlings more than other people with the same age and experience or more than they are making the only way for good talent to get what they deserve is join or create a startup.

Microformats turn 2

The microformats blog is celebrating with an entry that points to resources and interesting news. The hCard profile import is particularly interesting and should be of note to all those studying social networks like Facebook and Myspace.

By opening its platform, Facebook commoditizes the social map. Microformats makes it completely free.

For those thinking of building a site with a social network component, there is a strategic risk to building under Facebook. A lot of people could end up supporting microformats to avoid platform lock-in. Riskier still would be building a financially successful application, only to have Facebook create its own in-house version.

Microformats are only 2 and still growing in influence. It’s a trend worth watching, as is Facebook’s opening of its API.

Ruby / ActiveRecord is too slow

I just got my hands on a postal code file. First, we cut out other provinces we don’t need:

grep '^"[GHJ]' POSTALCODEWORLD-CA-GOLD.CSV >> quebec.csv

My first strategy was to use ActiveRecord to create the records. The console code looked like this:

>> post_codes.each_line do |line|
?> fields = line.split(",")
>> PostCode.create(:postal_code => fields[0],...,
:street_to_suffix => fields[21])
>> end

I was too lazy to write all that myself, the create was generated. However, the performance was an issue. There are 300k lines in that file, and less than 4k were being entered per minute in the database. From MySQL’s command line, this is what my solution looked like:

LOAD DATA LOCAL INFILE '/Users/daniel/projects/[top_secret]/quebec.csv'
-> into table post_codes
-> FIELDS TERMINATED BY ','
-> ENCLOSED BY '"'
-> LINES TERMINATED BY '\r\n'
-> (postal_code,...,
street_to_suffix)
Query OK, 301571 rows affected, 7866 warnings (10.70 sec)
Records: 301571 Deleted: 0 Skipped: 0 Warnings: 0

From > 4500 seconds to 10.70 seconds. Ruby and ActiveRecord can be incredibly slow. And I don’t care, because it’s pretty and easy to use. When I do need execution speed, I’ll use a shortcut; otherwise, my happiness and code writing speed are more important.