Posts Tagged ‘life’

Last night I was faced with a daunting task of making a meta-heuristic process a non-trivial amount of data in no more than a tenth of the time it was taking now.

Just to help you embrace the herculean task this was: My goal was to make the algorithm’s runtime lower than 1.5 seconds for any realistic data sample. It was taking anywhere from 5 to 20 and even 30 seconds at the time.

So I set off. First some profiling and some tidbits here and there, then tweaking and poking and yanking and scraping code for hours upon hours upon hours.

Nothing, no increase in performance. Nothing even remote to sane behaviour at all. Even though the algorithm was working, my debugging/profiling data wasn’t making any sense.

And I said fuck this shit and went to chillax and rest my mind over Men Who Stare at Goats for two hours.

There were some good laughs and some pretty good chillaxing being done. My I-don’t-know-which-exactly-or-what’s-it-called part of the brain was probably busy processing the afore mentioned problem in the background. Or maybe it wasn’t, who knows.

All I know is that when I came back to the problem I noticed something funky.

HEY THAT FUNCTION ARGUMENT SHOULDN’T BE A FUCKING CONSTANT WHAT THE FUCK IS GOING ON!

Characters 1 and t look a lot alike …

So anyway, long story short. The meta-heuristic that used to take 1500 epochs to do something now takes only ten to do the same thing, but slightly better.

That’s a pretty fucking good improovement right there!

Now the algorithm is constantly taking about a second to do its thing and I’m happy. Pushed it into production where profiling data will be collected of a more varied sample of data to see if all is well.

Chillaxing! It really does work.

Reblog this post [with Zemanta]

Tags: , , ,

21
Feb

The real-time WebCamp bash

   Posted by: Swizec    in Uncategorized

Carol Cleveland as the stereotypical "blo...
Image via Wikipedia

Yesterday another WebCamp took place in Ljubljana and it was the best *camp event I’ve ever been to. Congrats to all involved in making it happen, you guys rawk.

For some strange reason though I seem to have done almost nothing but hang out in the hall and only caught little bits and pieces of the talks here and there.

Perhaps the most surprising thing that I learned is that nobody writes good software anymore. Hell, why would you make your algorithms and page generators run faster … just slap some caching on there! First you make it cache all database calls. Then you start saving straight to cache too and sort of make commits to the actual storage happen a bit later when they don’t bother the user. If that’s not enough you can still just “cache” the whole output of your app in a static html file and serve that. And so on.

HELLO guise!? Bad sign ™ if you need to store the whole output of your software so it runs sufficiently well? O.o What are web developers smoking these days … I want some.

That’s the impression I got anyway from so many talks about optimisation and caching …

Another very cool talk, although I wasn’t in geek-mode enough to listen in on the whole thing, was by @refaktor who showed some funky simplistic server thingies that can perform real-time communication amongst each other. I did see the demo and it was very pretty. Hope he puts the code and talk somewhere public so I can give it a study some time.

I happened to steal two sessions of people’s time. The first was a public release of LazySharer that went alright I guess, some things went wrong but it all turned out well in the end.

And in a spur-of-the-moment kind of inspiration I also made a talk where we did nothing but watch stupid and silly youtube videos. We burned through our 20+10 minutes and ate away at half of next talk. Sorry Jure, hope you had enough time to talk about XMPP.

Group shot of the Monty Python crew in 1969
Image via Wikipedia

Seeming as how stupid videos were a marginal enough success for my tastes I got together some people and we set up a booth of sorts in the hall where we then played Monty Python and other silly videos for the rest of the day. Well actually we sort of got bored with it and then other people started playing whatever they wanted to see. It was great fun.

The WebCamp concluded a bit early because there were no more talks people wanted to give and half the public went MIA. So then the real party started because all the boring people had left.

Imagine this scene: 30-ish people, two cases of beer, a lot of pizza, 70 sooper chocolate muffins.

Yeah it was a blast. Apparently spiking those muffins with extra sugar and cocoa was the best idea we ever had at Preona. People went berserk for those things, eating three or more and stealing them for home consumption. Hell, if all this Synaptic Web stuff doesn’t work out for us we’ll open a muffin bakery.

Later on when almost everybody had left the evening evolved into Hekovnik’s first movie night. Inglorious Basterds on a huge LCD and four people on a sofa munching on stuff. Fun times.

Although those people having a brainstorming session on the other side of the room were a bit loud at times :P

PS: there were three pizzas (out of 40) left over and no muffins (out of 70). I think this is a great achievement.

Reblog this post [with Zemanta]

Tags: , , , , ,

Major Crandall's UH-1D helicopter climbs skywa...
Image via Wikipedia

Ah, finally, we can breathe again!

The last couple of weeks … was it two, was it three? Can’t really tell, feels like I’ve left the office just yesterday while at the same time seeming like it’s been years since I last set foot in the office to do any real work.

This my friends, this ejection from the stream of time, this rejection from life, this abortion from the normality of our daily lives, this horrible feeling of floating in time like naught is happening but what you can see on your immediate palm …

… this is what exam season does to you.

For me it is, luckily, already over. Some of my best buddies have another week of wartime ahead of them. Waring with evil warlords, waging battle with delusional teaching assistants. To them I wish good luck! Good luck I say!

To the rest of us I say, Gidday mate! Finally, finally we have come out of that Vietnam that is the few weeks of exams. Those stressful days when your future hangs precariously at a balance and your parents are wagging their eternal finger into your face “you better pass those exams mister lest we reject you from the family unit and make you get a real job”

But alas dear mother! Alas I say! Alas! For I have passed three out of five exams and that means I’ve got a 60% success rate and not even all of those were a weak mere pass! Nay! For I am victorious! Victoriously have I come out of that hell that is pure suffering.

Could’ve done better though. Crap.

PS: said season also fucks with your mind.

Reblog this post [with Zemanta]

Tags: ,

27
Jan

Apple pulls another Newton with the iPad

   Posted by: Swizec    in Uncategorized

Lately we’ve been hearing a lot, and I mean a bloody metric shitload, of rumours, speculation and other fun things about the soon-to-be-announced Apple tablet. You know how those Apple fanboys get, the first time hype started building about this thing was several years ago, but lately it’s been getting soooo pervasive you just knew it was the real deal this time.

Of course after all this hype the features I expected were:

  • the casing is made of solid gold
  • it can make me a sandwich
  • it brings coffee
  • it fits in my pocket
  • it is very very useful
  • it can wipe my arse after I take a dump
  • it can fly me to the moon and back
  • it works like The Guide mk.2 (If you don’t know what this means you should be ashamed of yourself)

So let’s see what Apple gave us:

  • oversized iPhone that can’t make calls

Errr … what!? Seriously Apple? Seriously? This!? Really!? We’re doing this again!?

Ok look, I love Apple, hell I even want an iPhone. And I really believe the devices they create are marvelous pieces of technology that work very well. But this fucking piece of crap is the biggest technological let-down I have ever had the displeasure of seeing.

I mean seriously, what the fuck was Apple smoking when they designed this thing? They’re supposed to be this sooper innovative company performing feats of magic right before our eyes, but instead, they take all the old technology, add nothing of the new, and call it the next big awesomest thing.

Fuck off Apple. Call me when you start making useful and exciting stuff again.

At least with the Newton it was marvelous technology that was too far ahead of its time, the iPad is just boring, mundane and boring.

Oh and you can tell they know it’s boring and useless because it’s PRICED THE SAME AS THEIR OLD PRODUCT!

Reblog this post [with Zemanta]

Tags: , , , , , , ,

18
Jan

Python multiprocessing is fucking sweet

   Posted by: Swizec    in Uncategorized

CRAY-1 (no longer used, of course) displayed i...
Image via Wikipedia

You know how it is said every programmer needs to learn how to do parallelisation and funky stuff on multi-core multi-processor beast of machines? And how such machines aren’t even really beasts these days, they’re our run of the mill desktop and portable computers.

This is the world we live in.

It’s getting worse by the hour!

Very soon the first thing a young programmer will hear out of a lecturer’s mouth will be Thread-Safe.

But there’s something we can do about that even today. First of all, we can kiss threading good bye. Sure it’s sweet and yes it sort of works. But ew! It’s like trying to make a marine corps do their job with everyone’s finger in someone else’s arse. That’s the problem with threads you see, they keep picking each other’s arses and noses and then nobody can do any work.

Multi processing to the rescue!

Running an algorithm in several processes is the only thing that makes it run on several processesors in parallel and it gives each process its own memory space and everyone is nicely contained in their own little world. But fuck, now you can’t exactly pick another process’s arse when you need to … like when eating through a common queue of tasks.

And then python’s multiprocessing module, library, thingy, whatever it’s called, comes into play.

It. Just. Makes. Everything. So. Fucking. Easy!

This weekend I was working on a scrobbler for Delicious. Basically this thing is supposed to go through a user’s Delicious history, scrape every website it finds, send the results to three different semantic API’s and build connections between the tags those API’s return and the ones the user used to tag the particular link.

Now obviously there’s a lot of downtime involved here for every iteration. You’re easily looking at 10 solid seconds of waiting per website. This means that scrobbling 838 pages (my stress test) would take about two and a half hours. With multiprocessing it took something like 20 minutes.

The beauty of this approach is that I’ve never ever ever done anything in parallel. And yet I could do funky things like worker pools, queues, semaphoring and a bunch of other stuff I’ve only heard of in fairy tales until now … in an hour.

So there you go, an investment of a few hours for learning from scratch and some tweaking to create a ten-fold increase in speed.

Reblog this post [with Zemanta]

Tags: , , , , , , , ,

12
Jan

How ikigai has changed my style

   Posted by: Swizec    in Inspiration

This is the second post in the series of How <x> changed my style where I shall talk about tools and events that had a significant impact on my style of doing things. If you happen to like this idea, I would be very happy if you could help it spread like wildfire, because it’s a form of pay-it-forward where we say Thanks for cool stuff.

A few weeks ago, or was it days, I forget, I stumbled upon a rather fascinating video about living to be a hundred years old and more. But not just sitting around and waiting to die kind of 100+, the kind where at 100 you’re still happily running around, building fences and doing stupid crap most westerners really wouldn’t expect you to do anymore.

Everything in there is fine and good, but the most important bottom line I picked up on was the importance of having an ikigai. It’s all wonderfully explained in the video so I won’t go into what ikigai is, I’d rather say a little bit about what it feels like to discover one’s ikigai. (it doesn’t matter whether you know what it’s called or not, I didn’t for months)

As late as just last Spring my life revolved around going to a school I hated, having a job that was alright but not quite that and occasionally getting together with my girlfriend. I was doing some nifty stuff in the evenings and late at night, but mostly it was just another burden no matter how much I loved it and felt like I believed in it.

Then something changed, I can’t exactly put my finger on it, but it changed. The symptom of this change was that I quit my job and devoted most of my attention to the side-project, which evolved far far far away from what it was back then.

And suddenly much was different. School suddenly seemed interesting and awesome, I started learning exciting new things every day for the first time since being a kid. Getting up in the morning was … well it’s still fucking hard, I’m just not a morning person :P … but staying up at night was painless as hell. Meh, I won’t pretend like I can describe this, just try it.

Reblog this post [with Zemanta]

Tags: , ,

11
Jan

How Lisp changed my style

   Posted by: Swizec    in Inspiration

IBM 402 Accounting Machine plug-board wiring. ...
Image via Wikipedia

This is the first post in the series of How <x> changed my style where I shall talk about tools and events that had a significant impact on my style of doing things. If you happen to like this idea, I would be very happy if you could help it spread like wildfire, because it’s a form of pay-it-forward where we say Thanks for cool stuff.

Some months ago, fuck has it been two? three? four?,  I attended a series of lectures on Lisp and functional programming and some other useful thingies by Simon Belak. At first it all felt like just another useful tool under my belt. Cool, Lisp, yeah, so what do I do with this? Meh, it’s cool, knowing this can’t do any more harm than a parenthesis thrown at a boomerangual trajectory smashing the windscreen of our hapless programmer.

However it did do damage, dear god it did so much damage! It fucked with my mind man, it fucked with everything. Nothing has been the same since!

No not really, but lately I have started noticing some pretty remarkable changes in the way I write code and more importantly, the way I think about code. Suddenly everything is a function is a function is a function! It’s quite remarkable really, sure I’ll often still code the very obvious object as an object, but I’m no longer forcing object oriented programming where it doesn’t belong.

And then there are even more radical examples of my brain changing, for the better I believe. Let’s take a simple comparison of writing a function that calculates the average of a list of numbers. In the old days I’d write it like so:

avg = 0
for key in self.tags:
	avg += self.tags[key]
avg /= len(self.tags)

These days, and it was fucking surprising when I noticed myself doing this, the same function gets written with a much bigger lisp:

avg = reduce(lambda a,b: a+b, tags.itervalues())/len(tags)

I really couldn’t go so far as to say whether this change in style and thinking is good or bad, but it certainly is interesting to just sit back and watch yourself from a distance as you morph and change before your very eyes.

So what’s changed your style lately?

Reblog this post [with Zemanta]

Tags: , , , , ,

After tonight’s midterm I simply couldn’t resist driving around and about Ljubljana in this magnificent snowy weather we’re having. It’s very rare to get a chance to drive in conditions where everyone is nice and calm. Nobody honks at you, nobody tries to swerve around you and do stupid things, nobody is in a hurry. It’s just fucking awesome!

Not to mention the snow and the occasional drift around a corner! Orgasmic! Oh!

Although winter services could be a little more vigilant, I got thrown all over the place driving through tracks others made. There was snow up to 20 centimeters deep someplaces! On main roads!!

Anyway, had fun, was awesome, got stuck in the snow on the parking lot at home. That was a big lol, but a surprisingly large amount of people I don’t know decided to be helpful and we got the car into a parking space in no time.

IMG00156IMG00153IMG00152

Reblog this post [with Zemanta]

Tags: , , ,

6
Jan

The greatest casual game ever devised

   Posted by: Swizec    in Uncategorized

Machinarium 2009-10-20 02-22-26-27
Image by deadman009 via Flickr
Machinarium 2009-10-21 03-01-19-71
Image by deadman009 via Flickr
Machinarium 2009-10-20 03-35-26-50
Image by deadman009 via Flickr
Machinarium 2009-10-20 02-42-19-66
Image by deadman009 via Flickr
Machinarium 2009-10-21 02-57-02-40
Image by deadman009 via Flickr
Machinarium 2009-10-20 01-28-26-39
Image by deadman009 via Flickr

Now and anon I like to fire up a game when I’m feeling a dash unmotivated to do pretty much anything. Most often I simply don’t have time to play, so when I do play I want the game to be something fascinatingly epic but in such a way as can be enjoyed ten minutes here, twenty minutes there, an hour over yonder. NOT something you have to play for three hours straight before you get in the groove.

Two nights ago I discovered Machinarium through a hapless link in a msn chat.

I was instantly hooked, the art is simply amazing, the level of detail beyond all comparison. The gameplay itself. Oh! Don’t get me started, I could *gasm all over at the mere thought of the brilliance therein.

Basically you play a robot that goes through a few adventures and solves many a puzzle in a beautifully designed world to, well I dont’ know what yet, haven’t gotten that far. It would seem though that it’s got something to do with love because whenever his memories are shown they’re about a lady robot.

It is also one of the hardest puzzle games I’ve ever had the pleasure of playing. Shivers, Monkey Island, Abe’s Oddysee/Exoddus? Don’t get me started, weaksauce in comparison to Machinarium! Downright bloody weaksauce! Often you will encounter a proper logic game, one as can be bought in stores sometimes, you’ve got to solve just to open a door.

Other times you are left solving five puzzles just to get to an item that solves a previous puzzle.

The best thing though? It’s absolutely DRM and any and all copy protection free. Buy the game, get the downloads for all OS’s and a soundtrack! Yay! How could I resist? So I didn’t, I shelved out the few euro it takes and it was possibly one of the best moneys ever spent.

Big game publisher, if you are reading this, yes, yes I do only buy games if they come without DRM. Sometimes I consider buying a big-name game, but usually get disappointed by the process half-way through and bail.

Reblog this post [with Zemanta]

Tags: , , , , , ,

4
Jan

3 pikchurs of a pretty goat

   Posted by: Swizec    in Insanity

While I was browsing through my blackberry a few moments ago to find a certain photo I stumbled upon some photos I took this Christmas.

They’re of a very bloody cute small boy goat thing. My grandmother says this is as big as they get and by god the little rascals are awesome. Soon as I came into the barn this guy jumped on me and demanded petting!

PETTING!

A goat!!

:D

Here he is, now let’s make him famous just because he’s so cool.

IMG00104IMG00097IMG00090

Tags: , ,

Page 1 of 1412345...Last »