Archive for the ‘Inspiration’ Category

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]

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]

Last night I watched a bloody amazing video of a university professor who was just oozing awesome. Seriously, this guy is all kinds of cool and I would love to someday have a professor that structures his lectures and classes like this guy does.

Now watch the video, I’m not here to blab, I’m here to make you watch this :)

Reblog this post [with Zemanta]
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]
7
Dec

Heaven is where your code lies

   Posted by: Swizec Tags: , , ,

Here I am at Hekovnik, alone in the romantic ambient of spotlights, whiteboards and loud music that makes me just wanna code code code. Yep, it’s Iron Maiden, felt like it, and son, I am not disappoint.

Romantic ambient

Lounging on the sofa, with my trusty MacBook in lap, shiny logo greeting anyone daring to enter my bubble of deep concentration and flowing code masterpieces.

IMG00077

It’s time like these that I truly love what I do, I know us developers are a fussy bunch and like to get all up in arms over the littlest thing that upsets us. That we love nothing better than to nag about some app or another taking 10 fucking milliseconds too long to open! The travesty!

But fact remains, I love being programmer, despite stupid tests not passing, despite frequent choices not to use testing that end up biting us in the arse, despite always changing design specs, despite all the bugs and all the weird shit and that little typo that brings the whole system to its knees and takes a week to fix …

heaven really is where your code lies, because code is an expression of one’s self, because code is art and no matter what anyone ever says, I will continue to see myself more as a poet than an engineer.

Reblog this post [with Zemanta]
"Charles Dickens as he appears when readi...
Image via Wikipedia

For an utter age now I have been trying to read proper literature more often. There’s a pile of books on my desk, all shiny and new, but unfortunately barely even leafed through. Just waiting patiently and asking me to please give them a read, are they bad books, perhaps they’re too fat? No you’re not fat book honey, I’m just busy.

Two days ago I said, fuck it, this situation needs to be resolved, I used to read a lot, I love reading, so what’s the problem?

As it turns out the problem is that starting is hard, isn’t that always the problem? Beginnings are always hard, sometimes it’s hard even to start going to bed or, hell, start having sex (and I don’t mean when you’re a virgin, I mean on a daily basis). But there was this other problem, I still didn’t have a lot of time.

And so I came up with the concept of 20 minutes a day. Twenty minutes might seem like a lot of time at first, but think about it. 20 minutes is the kind of time you waste walking to school, going to the post office, hell, just waiting for risotto to cook takes around 20 minutes. It’s NOTHING!

Everyone’s got 20 minutes of free time in any given day.

Yeah so everyone’s got twenty minutes, obviously that’s so little time you can’t do anything with it. WRONG! You absolutely positively can do a lot of valuable stuff with that time. For instance you could read ten pages of Dickens, yes Dickens of all things, it reads slow, but in 20 minutes a lot can be done. Or you could devote 20 minutes of unadulterated attention to your children if you’ve got any, or your pets. Or you could spend the 20 minutes getting through your RSS feeds (it’s doable), or do some Pilates like you’ve been wanting to for years.

The thing is you just gotta get off your fucking lazy arse and DO IT! Go on, take 20 minutes out of your busy day and do something for yourself.

Reblog this post [with Zemanta]