Posts Tagged ‘food for thought’

Riot Control
Image by Steve Crane via Flickr

Because this is a local topic the post is in slovene, apologies to both my international readers.

Zadnje dni ŠOU že kar malo precej najeda z vso propagando okoli malega dela in kako je to oh in sploh konec sveta, pa da sploh ne omenimo ubogih študentekov kako, da ga bomo nasrkali in ne bomo niti za kavico več imeli.

Pa pustimo, da študent sploh ne rabi kavice ampak se na faksu kaj naučit pa zraven en malo štipendije za knjige in kak sendvič.

Ok priznam, odkar sem na faksu še ni minil mesec, ko ne bi več časa zapravil za “službo” kot za študijske zadeve – izvzemši seveda izpitna obdobja potem ko sem se pred kakim letom malce spametoval.

A vseeno podpiram in pozdravljam malo delo, čeprav sem direktor malega startupa sestavljenega izključno iz študentarije. Malo delo bo super.

Zakaj?

Ja ker se nič ne bo spremenilo, samo malo se bo povečal obseg kdo vraga lahko dela in tisti ki delajo bodo imeli kako pravico več. Kurba je ko si dva tedna bolan in zato konec mesca ne morš plačat telefona, ali pa greš na malo dopusteka in magično zmanjka vsega denarja.

Zveni zelo viktorijansko mar ne? Mogoče celo ameriško.

Pfuj in pfej. Amerika in viktorijanstvo sta kul samo za nadbogate, študentarija in reveži se v nobenem primeru nimajo kaj preveč fino. Pri nas pa? Jah študent je car …

… in tako naj ostane.

Če znaš dobro delat, kar seveda znaš mar ne, sej te močno srbijo omejitve urnih postavk, to valjda pomeni da zdaj zaslužiš bajno več mar ne? Boš po preračunih z malim delom še vedno lahko zaslužil 6000 eurov na leto. In ja, to ravno pade v tisti minimum, da še ne plačaš davkov.

Osebno sem tista leta ko sem zaslužil več kot 6k gagal ko majmun cele dneve in naredil prekleto malo izpitov.

Kar se pa tiče demonstracij …

Jaz in ŠOU sva opravila. Današnja automagična prijava na nekakšen SMS klub in to da me zdaj kar nekaj spamajo sta bila pika na i. Ne grem se več.

Sem hotel it na demonstracije čist samo tako, za špas, mogoče bi bili pa izgredi in po mojem nisi zares živel dokler nisi bil vsaj enkrat v resnih izgredih – po možnosti v študentskih letih, kasneje ni več fore. Ampak izgredov ne bo, smo preveliki papki.

Ah kje so cajti, ki jih opisujejo stari ljubljančani, ko je študentarija zavojevala fakse in ohromila Ljubljano, da so povedali svoje. Zdaj so demonstracije samo še show in komerciala. Pa kak alkohol več se proda na ta račun.

Reblog this post [with Zemanta]

Tags: ,

Main Building
Image via Wikipedia

Seriously why aren’t there more teachers in the world? What a bunch of charlatans.

But I’m getting ahead of myself in this story.

Last week I was doing a lot of freelancing as a teacher and instructor in the dark arts of programming. There was this kid who desperately wanted to get a passing grade on a test this Wednesday. And there was this guy with a hat who has never in his life done any teaching and has spent all his life adamantly convinced he’s got no patience of such things. But he could do with some money in his pockets.

So the story begins. We had a three hour session almost every day and an even better reward than the easiest lump of money I ever made, was the fact that kid suggested, and seriously meant it, that I should think about becoming a teacher when I “grow up”. It was truly quite marvelous.

And all I did was explain some basic things to him and make him think.

Which brings us to the next question. Why was it that this poor bastard who has spent almost a year at the hands of professional teachers even needed someone to explain to him how a for loop works? How to distill an algorithm out of a problem description? How to … stuff?

I mean, seriously. What the hell!?

They trouble these young dudes with details like variable types, function prototypes and the fact that this thing called Dev-C needs a System(“PAUSE”) at the end.

All the while they don’t even understand that a variable will just keep its value and that this (and loops) is the basic principle behind everything a computer does and that you can change the way a computer does something by tweaking values in variables.

Ataturk teaching the children of Turkey the La...
Image via Wikipedia

Pretty pathetic if you ask me.

When I was a little dude in that kid’s shoes I hated flowcharts and I hated everything to do with real programming. All I wanted to do was pump out functioning code. But the thing is, far before that there was somebody to instill The Way a Programmer Thinks in my head. I already knew most of the basic stuff.

But for those who don’t understand thinking like a programmer. Who can’t empathise with a computer. They need a different learning method and schools and universities (at least around here) are horrible when it comes to that. All they ever do at school is try teaching you languages before you even learn how to talk.

Ever tried speaking a foreign language right out of the dictionary?

That’s how people try to teach you programming these days.

It sucks and it’s got to change.

Personally I think pupils should be taught to do nothing but programming for at least a year when they start. Then, maybe, they could start getting into coding.

Reblog this post [with Zemanta]

Tags: , , , , ,

21
Apr

Do you memento mori?

   Posted by: Swizec    in Inspiration

Today I read a nice post about the 6 myths that stand in your way. And there was one that stood out the most

Myth: There is time

Reality: You have less time now than you have ever had. You have less time now than you had an hour ago. You are nearer to your death than you have ever been. Plan thoroughly, but don’t wait too long before taking action.

And then when you remember that Steve Jobs had a speech devoted almost completely to this notion of memento mori.

Hell, the Romans came up with the whole memento mori crap far far ago … I forget how the tradition went, but they used to punch winning generals in the face or something … or was it that a slave was following them through the whole festivity whispering “memento mori” in their ear. Something like that.

Then there’s that tradition in greek weedings (judging from Big Fat Greek Wedding) where the bride is thrown off her chair – just to remind her she’s mortal too.

And way back when some smart poetry geek came up with the idea of Carpe Diem (later transformed to Carpe Noctem and Carpe Pijem, the slovene version). Again basically the same concept!

Then there’s an interesting story I read on a forum once, it happened to a forumite’s cousin or somesuch:

She was a lass, around 23 years of age. Two lovely children, a loving husband, nice house and so on. One day they have a fight over something extremely mundane and boring. She gets pissed off and storms out of the house … only to be mowed down by a truck.

To death.

So yeah, I know as humans we like to think we’re something special, that each and everyone of us is a special little snowflake unique and wonderful in their own right.

Well you’re not. You too will die, today, tomorrow, in an hour, it doesn’t matter.

And nothing of value will be lost!

Nothing!

Nobody will care, absolutely nobody.

I think people often forget these things and spend their whole lives doing boring shit they don’t care about. Stop that!

For the end, a quote from Anthony de Mello:

Most people, even though they don’t know it, are asleep. They’re born asleep, they marry in their sleep, they breed children in their sleep, they die in their sleep without ever waking up

But that just brings to mind this:

I dunno, just remember that whatever you do, all your life, you’re on the verge of imminent death. Never forget.

Reblog this post [with Zemanta]

Tags: , , , , ,

19
Apr

The sad state of BlackBerry apps

   Posted by: Swizec    in Uncategorized

Image representing iPhone as depicted in Crunc...
Image via CrunchBase

This morning just as I was battling with the question of going for a morning run or not I came across this facebook status

<a status I am currently unable to find>

But anyway, it was of something called @runkeeper and a dude reported he just ran 0.00 kilometers.

So why would this matter?

Because it gave me the idea that hey, if I tracked my runs I could get empirical data on what I’m doing and being the geek that I am this would inspire me to run more, harder and oftener.

Yayz! \o/

Then I went looking for this RunKeeper app … well whaddya know, it only exists for iPhones, who cares about you dirty BlackBerry users. You all suck anyway, you never do cool things! (gee I wonder why)

Well, after minutes upon minutes upon minutes upon dirty minutes of looking for something I finally came across an app that supports blackberries in the seedy underbelly of the internet’s shady alleys where drug dealing pederast’s push their wares.

It is called SportyPal.

Hoorah!

I downloaded it, fired it up and went for my run. After half an hour I come back home, look at the app and … why the flying shit is this? The stupid thing didn’t even manage to start getting GPS data during this time. Yep, 30 minutes of running and it didn’t even begin tracking anything.

Then two minutes later it failed with a “I’m sorry”

Reblog this post [with Zemanta]

Tags: , , , , , ,

18
Mar

Student+entrepreneur != hard

   Posted by: Swizec    in Inspiration

Ricardo Dominguez (left) rallied late to win a...
Image via Wikipedia

Yesterday I gave a guest talk sort of thing at the Jobfair on my faculty. The point was to perform the function of a live demo for my startup incubator and help them get more startups that way.

My personal point was to get some blokes to go “HEY! I wanna to help with that too!”, which of course did not happen because the audience was mostly electronics and hardware people. But nevertheless, it was a lovely chat.

Although, I noticed a very interesting trend. None of them felt very keen on becoming entrepreneurs while still at uni. They thought it was too hard, that next to classes and studying they don’t really have time to do anything else. Hell, I even got an almostpplause for being such an impressive lad that I can do both AND keep a girlfriend.

But seriously, it’s not hard at all. Just take this week’s Tuesday as an example:

On Tuesday I worked for nine hours, five of which were studying/taking a hard maths exam (I count school as work because it’s my “job”). I went to the playhouse and I watched an episode of House. I also helped my girlfriend prepare a presentation for school.

And I still went to bed by midnight.

See, it’s that fucking hard!

Not only have I never passed as many exams as I have now that I’m also an entrepreneur, I’ve also taken up a new sport (boxing), which takes six hours out of every week.

Sure it’s not all fun and games and many people find it difficult to jam 60 to 70 working hours into every week. But if you think being a student and an entrepreneur is hard, you’re trippin’ man. Seriously.

Just get off yer arse and do it. The television and alcohol can take care of themselves.

Reblog this post [with Zemanta]

Tags: , , , , , ,

5
Mar

Philosophers are crazy people!

   Posted by: Swizec    in Insanity

They seriously are, just look at how well they can take a joke!

Dude seriously, the answer to that is “HaHa oh you” not all of that.

Oh well, kudos for proving that caring about paradoxes is just silly because they either don’t exist or they do exist and you’re a jackass.

Also, did you know that if you assume any paradox to be correct you can mathematically prove/derive anything.

Point of fact:

Reblog this post [with Zemanta]

Tags: , , , , ,

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: , , ,

This is a howto that might come in handy to some people, but mostly I just want to document how I poked around some very angry django dragons and created something marvelous. There are also people on twitter who were wondering what the fuck I was doing.

So let’s start by describing the problem. We have a base user model named pUser (yes stupid naming convention) that is tied to a cookie, which holds an id. These users are then tied to a number of different API accounts. In my case it is Delicious, Twitter and Facebook. The user_id is also used to tie a bunch of meta data in different other models to them.

The problem is that we do not want to trouble users with a special login for our service. But they are using different computers and browsers, so the same physical user can have multiple user id’s.

However through their Delicious et al. credentials we can tie them back together into a single entity. But we do not want to trouble the rest of the code with this detail, it should just work seamlessly because otherwise we’d be forced to introduce checking for this stuff at about 50 different places in the project.

My approach to solving this goes as follows; at the end will be the three tests that indicate that the solution is valid. A hardcore test through the actual UI also confirmed that everything works.

Funky geek stuff follows, you have been warned

First we introduce a model that connects different user id’s to the main user (i.e. the first id said user was given)

class UserNormalisation(models.Model):
	main_id = models.IntegerField()
	sub_id = models.IntegerField()
 
	class Meta:
		unique_together = ("main_id", "sub_id")

Then we give our Delicious model a ModelManager that will perform duplicity checking and tie different users together as needed.

class DeliciousManager(models.Manager):
	def create(self, **kwargs):
		try:
			old = Delicious.objects.get(username=kwargs['username'])
			new = super(DeliciousManager, self).create(**kwargs)
			try:
				UserNormalisation(main_id = old.user.id,
						  sub_id = new.user.id).save()
			except IntegrityError:
				pass
			new.delete()
			return old
		except Delicious.DoesNotExist:
			return super(DeliciousManager, self).create(**kwargs)
 
class Delicious(models.Model):
	user = models.ForeignKey( pUser )
	username = models.CharField( max_length=255 )
	password = models.CharField( max_length=255 )
	isScrobbled = models.BooleanField( default=False )
 
	objects = DeliciousManager()

Basically when the createfunction is called it checks whether a Delicious model with the same username already exists and if it does, then a row is added to the UserNormalisation table to tie the two user id’s together.

And here’s the real magic, the changes we did to the pUser model.

class pUserManager(models.Manager):
	def get(self, **kwargs):
		user = super(pUserManager, self).get(**kwargs)
		try:
			id = UserNormalisation.objects.get(sub_id=user.id).main_id
			user = super(pUserManager, self).get(id=id)
		except UserNormalisation.DoesNotExist:
			pass
		return user
 
class pUser(models.Model):
	username = models.CharField( max_length=50 )
	password = models.CharField( max_length=255 )
	creation = models.DateTimeField( auto_now=True )
 
	objects = pUserManager()
 
	def __init__(self, *args, **kwargs):
		super(pUser, self).__init__(*args, **kwargs)
		try:
			id = UserNormalisation.objects.get(sub_id=self.id).main_id
			self.id = id
 
		except UserNormalisation.DoesNotExist:
			pass

The pUserManager should have a few more functions that do essentially the same thing for other operations (filter comes to mind). Essentially whenever a pUser is fetched from the db the manager will return the real user as per the UserNormalisation model.

Another trick that makes this work seamlessly even when used as a connecting model (primary key for instance) in a different table is that __init__ function. What I’ve discovered is that there it’s enough to just change the user’s id in place and everything will work.

Here are the tests that confirm all of this funky stuff actually performs as expected

	def test_normalisation(self):
		user = pUser(username="test", password="test")
		user.save()
 
		user2 = pUser(username="test2", password="test")
		user2.save()
 
		norm = UserNormalisation(main_id=user.id, sub_id=user2.id)
		norm.save()
 
		fixture = pUser.objects.get(id=user2.id)
		self.assertEquals( fixture.id, user.id )
 
	def test_normalisation2(self):
		user = pUser()
		user.save()
		user2 = pUser()
		user2.save()
 
		user.delicious_set.create(username="test", password="test")
		fixture = user2.delicious_set.create(username="test", password="test")
 
		self.assertEquals( fixture.user.id, user.id )
		self.assertEquals( UserNormalisation.objects.get(sub_id=user2.id).main_id, user.id )
		self.assertEquals( fixture.user, user )
 
	def test_normalisation3(self):
		user = pUser()
		user.save()
		user2 = pUser()
		user2.save()
 
		user.delicious_set.create(username="test", password="test")
		fixture = user2.delicious_set.create(username="test", password="test")
 
		norm = UserNormalisation.objects.all()
 
		Concepts.relate(user=user2, concept1="tag1", concept2="tag2")
		relation = ConceptRelation.objects.filter(user=user2, concept1="tag1")[0]
		self.assertEquals( relation.user.id, user.id )
		self.assertEquals( relation.user, user )

Take special note to the latter two examples. In test_normalisation2 you can see that when a delicious_set is created for user2, the two users become the same thing because both we’re using the same delicious username both times. Something similar happens in test_normalisation3, but there we see that creating a ConceptRelation for user2 actually creates it for the first user because they both behave as if they were the original user.

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: , , , , , , ,

Page 1 of 1012345...Last »