It sucks, you know, not being able to sleep? I find myself awake at the most awkward of hours, staring blankly at the laptop screen. Three nights ago, I went to sleep at 3 AM. Two nights ago, I attempted to go to sleep earlier but was lying in bed unable to, and then I went into a sneezing frenzy and found it so difficult to breathe that tears were coming out of my eyes. This morning I awoke at around 2 AM, and I've been wide awake for the past 18 and a half hours.
Did I tell you how much I hate IDEs? I also hate languages that are no good without IDEs and import statements, like Java and C#. So this morning, 2 AM onwards, I was busily typing away everything in my mind inside a gedit window because I hate IDEs. And of course, once I'm done I open up the IDE to make sure all the imports are in place and everything is in a runnable state. 5 minutes to clean up all the code and make sure the imports are in place, and we're a go. Start up the SDK, wait for Android to boot up and eagerly unlock the screen on the old Gingerbread ROM. And then BAM, unexpected application error, force quit, and there goes hours of work.The exception thrown doesn't really help matters, and a solution seems out of reach.
So, spirit broken, I waste the rest of the day idly checking out what real programmers are up to on IRC, and switching tabs between that lethal mixture of facebook, gmail and reddit. Rinse, repeat. I swear I'm going to lose it one of these days.
Showing posts with label code. Show all posts
Showing posts with label code. Show all posts
Wednesday, November 2, 2011
Open Source: Why it matters to you
Computers have crept up on us on an impressive scale in the last 30 years or so. They were once behemoths stuck in large rooms, but with the advent of the microchip things have gotten a lot more exciting. First came devices like the personal computer that took computing to the masses, but today computers are virtually everywhere - even if you don't know about it. From your mp3 player, to your microwave, to the chip that controls the fuel injectors in your car - embedded devices and smartphones are everywhere.
This places an extraordinary amount of responsibility on those people - the programmers, the electronics engineers and the quality assurance engineers - who create and programme these devices. One little conversion error on your car's ABS system might cost you your life (remember the Mars Polar Lander?), and a mis-scoped variable in a stock market system could even bring the global financial system down. Therefore it is in everybody's interest that knowledge on how these highly critical systems work is not limited to a privileged (or is it powerful?) few, and that it is shared by all. Think of it as science, or law. If only the judge knew how the law works - and the law is something that affects all of us - there would be chaos. (Similarly, in science, people not knowing how magnets work has led toissues hilarity in the past)
So that is the situation - computers are becoming indispensable in the modern world, and the knowledge on how critical systems work is at risk of falling into the hands of a few selected individuals. This cannot end well, right?
Open Source to the rescue
This is where initiatives like the Free Software Foundation (and their awesome General Public License) come into play. Under the terms of this license, the source code - the knowledge, the step-by-step instructions of how software works, is released to be viewed by all. Not only can you view it, you can modify it to meet your requirements (or to fix bugs) and share it freely. Just like law and science are taught freely, and is accessible to all with the relevant domain knowledge, the knowledge of how software systems work can also be shared freely.
This is not just a great theory - it has proven results. It is what makes Linux a great kernel (which powers most of the servers and embedded systems that are critical for the survival of the modern world), and Firefox an excellent browser, and all your servers run on Apache, and your smartphones on Android. It gives the power to harness the great infrastructure we've built back to the users, the masses, the community. It makes sure that one select group doesn't get to hold the world for ransom. It makes sure that the your brakes won't fail - because half the world's programmers have had a look at that code and have certified it as bug-free. It lets you sleep soundly at night, knowing that the future of the world is securely in the hands of a community of global programmers - who are just as concerned as you are about the reliability of the software.
Note: I know that 'open source' does not necessarily mean 'free' as in free speech, but I thought including all the different licenses in the post would be confusing for casual readers.
This places an extraordinary amount of responsibility on those people - the programmers, the electronics engineers and the quality assurance engineers - who create and programme these devices. One little conversion error on your car's ABS system might cost you your life (remember the Mars Polar Lander?), and a mis-scoped variable in a stock market system could even bring the global financial system down. Therefore it is in everybody's interest that knowledge on how these highly critical systems work is not limited to a privileged (or is it powerful?) few, and that it is shared by all. Think of it as science, or law. If only the judge knew how the law works - and the law is something that affects all of us - there would be chaos. (Similarly, in science, people not knowing how magnets work has led to
So that is the situation - computers are becoming indispensable in the modern world, and the knowledge on how critical systems work is at risk of falling into the hands of a few selected individuals. This cannot end well, right?
Open Source to the rescue
This is where initiatives like the Free Software Foundation (and their awesome General Public License) come into play. Under the terms of this license, the source code - the knowledge, the step-by-step instructions of how software works, is released to be viewed by all. Not only can you view it, you can modify it to meet your requirements (or to fix bugs) and share it freely. Just like law and science are taught freely, and is accessible to all with the relevant domain knowledge, the knowledge of how software systems work can also be shared freely.
This is not just a great theory - it has proven results. It is what makes Linux a great kernel (which powers most of the servers and embedded systems that are critical for the survival of the modern world), and Firefox an excellent browser, and all your servers run on Apache, and your smartphones on Android. It gives the power to harness the great infrastructure we've built back to the users, the masses, the community. It makes sure that one select group doesn't get to hold the world for ransom. It makes sure that the your brakes won't fail - because half the world's programmers have had a look at that code and have certified it as bug-free. It lets you sleep soundly at night, knowing that the future of the world is securely in the hands of a community of global programmers - who are just as concerned as you are about the reliability of the software.
"Given enough eyeballs, all bugs are shallow" - Linus' Law
Note: I know that 'open source' does not necessarily mean 'free' as in free speech, but I thought including all the different licenses in the post would be confusing for casual readers.
Thursday, October 13, 2011
For dmr
![]() |
| Logo I designed for Kottu, in tribute to dmr |
C was the very first language I learned at university. I had dabbled in bits and pieces of code before, with VB6 (ugh), a bit of C++ (utter failure) and maybe JavaScript. But C was my first proper language, and I fell in love. And I've seen many languages since, but none that were as easy to grasp, yet as useful as C. Today's languages are much fancier, but there's something about it that you can't beat.
Dennis MacAlistair Ritchie can be described in many words, but I would call him a true genius. In his own words: "Unix is simple. It just takes a genius to understand its simplicity". He, and the rest of the Bell labs team, took a very pragmatic approach to programming. They kept things simple, and put power in the hands of the user, with merely the warning to use it wisely. The theoreticians can say what they will, but in practical terms UNIX (and the C language it was written in - becoming one of the first major operating systems to be implemented in a high-level language) has responded by being one of the most successful operating systems in history. Today, a major part of the world's IT infrastructure runs on UNIX-derivatives and UNIX-clones. BSD (and its child Mac OSX) is wildly popular, and so is GNU/Linux. Even though the original UNIX code is not used in these implementations, the features, the layout of the file-system, the shell, the common utilities... the basic concepts and most of all the awesome little language that all of it is written in pretty much owe their existence to the work of the original Bell labs team.
Imagine what it must've been like to walk with giants? I would give everything I own to go back and work at circa-1970 Bell labs. :)
Rest in peace, Dr. Ritchie. Future generations will continue to read K&R, appreciate your genius and your contributions (and your humility about it all) and hopefully your life will be celebrated much more in the coming years. You deserved a much better send-off than that which you received today.
P.S. There was a quote of either Thompson's or Ritchie's that I've read and was trying to track down all day (if any of you guys know where it is, please send me the link) about how they never usually duplicated work while writing code, but once accidentally wrote the same utility in assembly code. They then went through the code, to find that they had implemented it almost identically - line for line. That story just blew my mind away. :)
Edit: Adding this cool Japan Prize video that I found today. The Japan Prize 2011 was awarded to Dennis and Ken.
Tuesday, October 11, 2011
On Kottu development, and oxygen for ideas
![]() |
| Kottu, after the 8.0 redesign |
The thing with designing a software system you have no idea about is that you don't know how deep the water is, and you never will, until you jump right in. When Indi contacted me back in July with the proposal to join him at Kottu, I was stunned. It was truly a dream come true. I loved Kottu, Kottu was every young blogger's best friend. And it was where people could find good content,
Coming back to the jumping in the water business: there is no way you can get something as complex and dynamic as Kottu right first time around. And I jumped right in, rewrote the whole code base from scratch. Every software best practice that I learned went flying out the window, and I cobbled up the least complicated thing that worked. No OOP, no comments, no nothing. Getting a working system out (no matter how ugly the code looked) was first priority. And only after going public with that did everything else flow along: documentation (still partial), code refactoring (check out the Posts class, which is basically what the whole back-end of Kottu looks like now) and more features.
When Kottu 7.8 beta first launched, we had no thumbnails, no categories and a bunch of those buggy Javascript social widgets that made loading the home page take ages. Only user feedback and time fixed those issues, and I don't think it is humanly possible for it to have happened any other way. Good systems don't just happen. Of course, there was UNIX, but let's not try to pretend we're Richie and Thompson, shall we? ;)
Right, then. The back-end of Kottu hit version 8.0 with some nice little refactoring (basically a revamped utils folder.) There are some development goals that I hope to achieve before we hit version 8.0 officially. (Note: These are not long-term goals like Indi has described here, but more of short-term, little, code-based goals)
- Refactoring the front end
There is a lot of code that gets duplicated in index.php and search.php and elsewhere in the front end. I hope to unify everything into a PageGen class to make generating pages easier and the code much cleaner. - Caching
Kottu stupidly generates every page dynamically... every.single.time. I plan to put an end to this madness and store cached copies of several frequently accessed pages (or options within Kottu, say for example "Sinhala + Popular Today"). This would make me feel less guilty about running long and costly queries to give users a bit more of the beautiful data we have at Kottu. Don't tell anyone, but there will be graphs! ;) Shh! - Better documentation
If you ask people why many open source projects fail, they would say that the two primary factors are developers losing interest, and lax user documentation. I've been a typical programmer, and been slacking off when I was supposed to be writing the f@#%ing manual (couldn't resist, sorry!) :D Yeah, there is a nice little markdown file on our Github, but we need more, including better on site documentation (not about the code, obviously, but think of a better About Us page). - Not-so-active blogs, what is?
Okay, so there are active bloggers, and there are not-so-active bloggers. Thing about Kottu is we're dealing with limited resources, servers that might melt sooner or later, and other real world problems. We currently have 907 blogs listed on Kottu (wait, I'm sure that number was higher... dafuq?). What does FeedGet.php do? It takes 50 blogs (least recently polled), goes to each of those RSS feeds and adds any new posts to our database. Now, FeedGet.php is cronjob'd to run every 5 (!!!) minutes, the minimum limit allowed by our hosting provider, but still it takes approximately 1 hour 30 minutes to repoll a feed. So, if we polled your feed just before you posted a blog post, then sorry.com, bro. You will have to wait for one and a half hours for your blogpost to appear on Kottu. (We can't poll more that 50 feeds at a time due to the fact that PHP is a freaking crack addict that gobbles up insane amounts of memory without de-allocating any)
What do we do now? What do we do now that doesn't get me banned from the next blogger meetup? Maybe we should poll not-so-active blogs less frequently, giving priority to active blogs - which are more likely to have new posts. And as soon as a less-than-active blogger makes his comeback, his blog is made active again, and gets polled in the usual way. It's sort of evil, yes, but necessary if we're to increase the response time of Kottu. And it also encourages bloggers to be more active. Whaddaya think?
So, finally, don't let the version numbering and jibber jabber fool you. Kottu is pretty much a work in progress, and Indi and I will continue to tinker and attempt to make it better and faster and cuter. And hopefully, I will realise my dream of a happier, friendlier, active little Blogosphere, like we had back when I first started in February 2009. Those were the days, maaan! :')
P.S. The title of the post is from an awesome awesome article by the guy behind Wordpress. READ IT! It totally changed the way I view software,
Thursday, July 21, 2011
Bus Route Finder
A month and a half back, I made a map of bus routes in Colombo that became a surprise hit. This, coupled with the number of calls Himal was getting asking which bus to take, made me think that a website that tells you which buses to take from location A to location B would be pretty useful. With my beginner-level knowledge of SQL, JavaScript and PHP, I was able to cobble together a website that helps you find the bus route to your destination.
The system is far from perfect (it has only 25 or so bus routes, from the 70 odd listed in the Colombo bus routes Wikipedia article), and so it could do with some improvement, which is why I'm releasing the source code and the database SQL under the GNU GPL. :) So, I hope someone who's better with buses and code can take this to the next level. So, do feel free to modify, change, and host as you please, and please excuse the n00bish code, I'm kinda new to this! :D
A better algorithm for finding buses would be really nice, since all buses are not created equal. Waiting for a 135 that never came on a Sunday afternoon in Narahenpita, or getting late for an appointment because some fool recommended you take a 255 (worst bus ever!!!) from Kottawa to Mount Lavinia, is uncool. A better system with some sort of ranking algorithm would solve this problem, me thinks. :)
Hope you guys find the system useful. There is a mobile version of the site, but my stupid web host won't let me automatically redirect users to it using htaccess. :( A special Thank You to all my friends who helped me with this, and especially Mr. Inosh Perera, who helped me with the 187 bus route and also suggested I add Google Maps geolocations to bus halts. :)
Update: Bus Route Finder on GitHub (Thanks, John!) :D
The system is far from perfect (it has only 25 or so bus routes, from the 70 odd listed in the Colombo bus routes Wikipedia article), and so it could do with some improvement, which is why I'm releasing the source code and the database SQL under the GNU GPL. :) So, I hope someone who's better with buses and code can take this to the next level. So, do feel free to modify, change, and host as you please, and please excuse the n00bish code, I'm kinda new to this! :D
A better algorithm for finding buses would be really nice, since all buses are not created equal. Waiting for a 135 that never came on a Sunday afternoon in Narahenpita, or getting late for an appointment because some fool recommended you take a 255 (worst bus ever!!!) from Kottawa to Mount Lavinia, is uncool. A better system with some sort of ranking algorithm would solve this problem, me thinks. :)
Hope you guys find the system useful. There is a mobile version of the site, but my stupid web host won't let me automatically redirect users to it using htaccess. :( A special Thank You to all my friends who helped me with this, and especially Mr. Inosh Perera, who helped me with the 187 bus route and also suggested I add Google Maps geolocations to bus halts. :)
Update: Bus Route Finder on GitHub (Thanks, John!) :D
Sunday, July 3, 2011
I Know What You Did Last Summer
So, a couple of months have passed since finals and the university student inside me has been awoken from the long slumber that he took during the vacation months. Our fourth semester at SLIIT promises to be filled with challenges, the most important of which is the infamous "Second Year Project". We have been blessed with a great client, and it's now up to the group to deliver. This project offers us a chance to get our hands dirty with all aspects of the development process, from requirement gathering and analysis, to designing the system, to making databases, writing documentation, keeping the client and the lecturers happy with progress reports, as well as my favourite part - getting down and dirty with some mean code. ;)
The holiday months, alas, were not spent being entirely useless. :P I helped my friends at The Pooch Foundation by designing a website for them. When you're short on development time, bad code and design tends to seep through, and the website went through some horrid n00b html versions before coming out with the current iteration, which I quite like. The great thing about it is that it uses jQuery to look very, very good. ;) And the sad thing about it is that it uses jQuery, which tends not to run in some machines (like at uni), even if JavaScript is enabled. :/ But the project, as a whole, was brilliant. I learned PHP and jQuery on the job, and the intricacies of writing code for other people. ;) This new found love for PHP, coupled with something else has resulted in me working on a small project of mine, which I'll update you on within the week. :D Needless to say I am terribly excited about this, and it's something which -with enough user input- can grow into something that I hope a lot of people will find useful.
So, with the promise of blogging again in the not-too-distant future, I bid you adieu.
The holiday months, alas, were not spent being entirely useless. :P I helped my friends at The Pooch Foundation by designing a website for them. When you're short on development time, bad code and design tends to seep through, and the website went through some horrid n00b html versions before coming out with the current iteration, which I quite like. The great thing about it is that it uses jQuery to look very, very good. ;) And the sad thing about it is that it uses jQuery, which tends not to run in some machines (like at uni), even if JavaScript is enabled. :/ But the project, as a whole, was brilliant. I learned PHP and jQuery on the job, and the intricacies of writing code for other people. ;) This new found love for PHP, coupled with something else has resulted in me working on a small project of mine, which I'll update you on within the week. :D Needless to say I am terribly excited about this, and it's something which -with enough user input- can grow into something that I hope a lot of people will find useful.
So, with the promise of blogging again in the not-too-distant future, I bid you adieu.
Sunday, April 24, 2011
Crickexams
So, good old SLIIT is going through exam season these days. The common rooms are crowded, and the staircases are full of last minute crammers with books and papers lying all around. :) My exams so far have had mixed results, PS was a miss and SPD was a definite hit.
So, remember me saying we might have World Cup coverage around these parts? :D Yeah. Well, the closest I got to the World Cup is when I went to watch the Kenya vs. Sri Lanka match on March 1 with my mates. But fear not, this post is sort of related to cricket.
I helped out a friend of mine studying in Australia with his programming assignment. It was a neat little C program that read from a file, did some basic data manipulation and graphed the results. After being stuck for so long doing non-programming things at uni (Ugh, I thought this degree was about learning to code. How wrong I was...) it was a treat to write some good code and it inspired me to write this follow up program. It's a tiny piece of code that graphs runs against overs, like those Manhattans that they show during cricket matches. The code can be found here.
Here's what the output looks like:
So, remember me saying we might have World Cup coverage around these parts? :D Yeah. Well, the closest I got to the World Cup is when I went to watch the Kenya vs. Sri Lanka match on March 1 with my mates. But fear not, this post is sort of related to cricket.
I helped out a friend of mine studying in Australia with his programming assignment. It was a neat little C program that read from a file, did some basic data manipulation and graphed the results. After being stuck for so long doing non-programming things at uni (Ugh, I thought this degree was about learning to code. How wrong I was...) it was a treat to write some good code and it inspired me to write this follow up program. It's a tiny piece of code that graphs runs against overs, like those Manhattans that they show during cricket matches. The code can be found here.
Here's what the output looks like:
Thursday, April 7, 2011
Date a girl who Codes
This (Facebook note) was inspired by the Tumblr post Date A Girl Who Reads (by Rosemarie Urquico) which GG had posted on Facebook. :) Disclaimer: I'm NOT an Emacs user. ;)
Date a girl who codes. Date a girl who spends her time on Stack Overflow and not TMZ. Her computer's fucked because she messed with the kernel too much, not because she downloaded "Free Smileys". Date a girl who knows a couple of languages, compiled her first program when she was 11.
Find a girl who codes. You’ll know that she does because she'll always have Emacs open. (What do you mean vi? Are you crazy to even look at the devil's spawn?) She lovingly looks through the Java API, and quietly cries out when she finds that one interface that's been giving her a hard time. You see the weird chick staring at her laptop with her hands on her head? That’s the coder. They can never resist the urge to code, even in public.
She’s the girl coding while waiting in that coffee shop down the street. If you take a peek at her mug, the non-dairy creamer is floating on top because she’s kind of engrossed already. Lost in a world of inheritance and multiple threads. Sit down. She might not notice you, as most coders don't like to be interrupted. Ask her what's up with her indentation.
Get ready to have a cup of coffee thrown on you.
Let her know what you really think of Stallman. See if she can code Lisp. Understand that if she's a fan of Bash scripting, she’s just saying that to sound intelligent. Ask her if she loves Canonical or she would like to work there.
It’s easy to date a girl who codes. Leave her alone when she's coding, but never for too long. Tell her to look out the window from time to time. Giving your eyes rest is important for coders, lest you want her to go blind. Buy her Knuth's "The Art of Computer Programming". Let her know that you understand that code is love. That every opened curly bracket is a commitment. Understand that she knows the difference between how code works and reality but by god, she’s going to try to make her life a little binary. It will never be your fault if she does.
She has to give it a shot somehow.
[Can't be fucked writing any further. I've got more important things to do.]
:P
P.S. If you meet the aforementioned girl, please give me a ring! O_O
Date a girl who codes. Date a girl who spends her time on Stack Overflow and not TMZ. Her computer's fucked because she messed with the kernel too much, not because she downloaded "Free Smileys". Date a girl who knows a couple of languages, compiled her first program when she was 11.
Find a girl who codes. You’ll know that she does because she'll always have Emacs open. (What do you mean vi? Are you crazy to even look at the devil's spawn?) She lovingly looks through the Java API, and quietly cries out when she finds that one interface that's been giving her a hard time. You see the weird chick staring at her laptop with her hands on her head? That’s the coder. They can never resist the urge to code, even in public.
She’s the girl coding while waiting in that coffee shop down the street. If you take a peek at her mug, the non-dairy creamer is floating on top because she’s kind of engrossed already. Lost in a world of inheritance and multiple threads. Sit down. She might not notice you, as most coders don't like to be interrupted. Ask her what's up with her indentation.
Get ready to have a cup of coffee thrown on you.
Let her know what you really think of Stallman. See if she can code Lisp. Understand that if she's a fan of Bash scripting, she’s just saying that to sound intelligent. Ask her if she loves Canonical or she would like to work there.
It’s easy to date a girl who codes. Leave her alone when she's coding, but never for too long. Tell her to look out the window from time to time. Giving your eyes rest is important for coders, lest you want her to go blind. Buy her Knuth's "The Art of Computer Programming". Let her know that you understand that code is love. That every opened curly bracket is a commitment. Understand that she knows the difference between how code works and reality but by god, she’s going to try to make her life a little binary. It will never be your fault if she does.
She has to give it a shot somehow.
[Can't be fucked writing any further. I've got more important things to do.]
:P
P.S. If you meet the aforementioned girl, please give me a ring! O_O
Saturday, February 26, 2011
The stages of a programming language
Every programming student is taught the four or five generations of programming languages. Well, here's a new system of categorization that some kid with too much time on his hands came up with. :D (Note that this was just done for kicks, and doesn't claim to be factually correct or anything)
Stage 1:
Stage 2:
Stage 3:
Stage 4:
Stage 5:
Stage 1:
![]() |
| Assembly language |
Stage 2:
![]() |
| C |
Stage 3:
![]() |
| C++, Objective C, Vala |
Stage 4:
![]() |
| Java |
Stage 5:
![]() |
| Python? IDK really. |
Monday, January 31, 2011
Javin'
So, hello there after a long long time! :D It's been almost two and a half months since I last posted, so I'd like to wish everyone a very Happy New Year first!
So, yours truly and his friends have now been elevated to the rank of second year students, tasked with keeping the peace and giving the first years a hard time (Well, not really. They have been giving everyone else a hard time, though!). So with being a second year student comes the opportunity to study that intriguing language, Java. I have to admit, I'm not a big fan of the language - or Java culture. People seem to love it, and use it as a golden hammer in programming (check out this xkcd comic), or as we say in Sinhala - a කෝකටත් ෛතලය. In their mad dash to popularise the language, they've spread a lot of misinformation (I once saw in a book belonging to a cousin of mine that the -local- author had stated that Java was faster than C and C++, a fact that any real programmer knows is utter bull). But anyway, I'll share a simple programme I did in Java today. It does nothing of use really, but I just love the fact that I wrote some single line methods. ;)
So, here it is. The things I love about Java are many (as anyone switching over from the rigid C++ environment will tell you), but the foremost among them is the ease with which strings can be handled. I mean C++ makes you wish you weren't born when it comes to string handling, and while Java isn't exactly perfect, it does much better than C++. I just wish there was a compiled language that combined Java's ease of use with C++'s speed and power. But I guess it's already invented (there are literally hundreds of programming languages listed on Wikipedia alone) and I'll discover it someday. ;)
That's all the time we have for today, but do stay tuned. We might have World Cup coverage (haha, fat chance!). :D
So, yours truly and his friends have now been elevated to the rank of second year students, tasked with keeping the peace and giving the first years a hard time (Well, not really. They have been giving everyone else a hard time, though!). So with being a second year student comes the opportunity to study that intriguing language, Java. I have to admit, I'm not a big fan of the language - or Java culture. People seem to love it, and use it as a golden hammer in programming (check out this xkcd comic), or as we say in Sinhala - a කෝකටත් ෛතලය. In their mad dash to popularise the language, they've spread a lot of misinformation (I once saw in a book belonging to a cousin of mine that the -local- author had stated that Java was faster than C and C++, a fact that any real programmer knows is utter bull). But anyway, I'll share a simple programme I did in Java today. It does nothing of use really, but I just love the fact that I wrote some single line methods. ;)
So, here it is. The things I love about Java are many (as anyone switching over from the rigid C++ environment will tell you), but the foremost among them is the ease with which strings can be handled. I mean C++ makes you wish you weren't born when it comes to string handling, and while Java isn't exactly perfect, it does much better than C++. I just wish there was a compiled language that combined Java's ease of use with C++'s speed and power. But I guess it's already invented (there are literally hundreds of programming languages listed on Wikipedia alone) and I'll discover it someday. ;)
That's all the time we have for today, but do stay tuned. We might have World Cup coverage (haha, fat chance!). :D
Tuesday, November 30, 2010
Recap
November started off on a positive note with a presentation at uni that went off pretty well on the first day of the month. But plenty of other things that were planned didn't happen as expected, but it was a good month nonetheless.
I learned a fair bit of C, and can implement everything we learned up to now at uni using it. Object orientation and such are obviously not supported, but the workarounds exist and as many programmers say "C is easier to learn in its entirety, and that is the biggest advantage it gives a coder". Basically, when you know exactly what the language can and cannot do, it makes coding so much easier and more productive.
A thing I didn't get to do was visit ol' Tommy. The time elapsed since I last saw him has hit a new high of 5 freaking months! :( And I don't think I'll get to visit him this weekend either. Sucks ass.
A lot of the travel planned for November had to be shelved, especially due to the bizarre weather conditions. The family did visit Katharagama and the south, but it was a rain affected journey. The planned hike to Nuwara Eliya with Uni buddies didn't work out, and neither did Arugam Bay with Sai and the old thread gang. I did get to spend an extraordinary amount of time at Sai's place though (thanks for the lunches, Sai! :D And the lulz too.) Spending time with one of your best friends in the whole world who only drops by the island once every 15 months or so is one of the true delights of life. :)
Hmmm, so what else. Watched a couple of movies, including "Toy Story 3" (How the hell does Pixar impress over and over again like that???) and "The Social Network" by David Fincher. The latter was one of the best movies I had ever seen. It had the obvious geek appeal for me ("OMG Zuckerberg uses Linux!!!") and also the first Beatles song in a soundtrack that I've heard in a long time (Baby, You're a Rich Man, off Magical Mystery Tour. Beautiful song.) But what I loved about the film is that he achieved in a couple of years things that most people wouldn't in their entire lifetime. And it made me think... What's the point of being called a geek, what's the point of knowing what a wget command does if you don't apply that stuff and do something exciting, do something that you can be proud of? Will you forever be remembered as a nameless faceless glorified typist who slaved away coding some buggy commercial software, or will you be remembered as a Torvalds, a Stallman or a Cohen? Someone who gave up a boring, well paying life to do something that they genuinely found exciting and worth working towards? It's something I'll have a long hard think about in the next couple of months.
I learned a fair bit of C, and can implement everything we learned up to now at uni using it. Object orientation and such are obviously not supported, but the workarounds exist and as many programmers say "C is easier to learn in its entirety, and that is the biggest advantage it gives a coder". Basically, when you know exactly what the language can and cannot do, it makes coding so much easier and more productive.
A thing I didn't get to do was visit ol' Tommy. The time elapsed since I last saw him has hit a new high of 5 freaking months! :( And I don't think I'll get to visit him this weekend either. Sucks ass.
A lot of the travel planned for November had to be shelved, especially due to the bizarre weather conditions. The family did visit Katharagama and the south, but it was a rain affected journey. The planned hike to Nuwara Eliya with Uni buddies didn't work out, and neither did Arugam Bay with Sai and the old thread gang. I did get to spend an extraordinary amount of time at Sai's place though (thanks for the lunches, Sai! :D And the lulz too.) Spending time with one of your best friends in the whole world who only drops by the island once every 15 months or so is one of the true delights of life. :)
Hmmm, so what else. Watched a couple of movies, including "Toy Story 3" (How the hell does Pixar impress over and over again like that???) and "The Social Network" by David Fincher. The latter was one of the best movies I had ever seen. It had the obvious geek appeal for me ("OMG Zuckerberg uses Linux!!!") and also the first Beatles song in a soundtrack that I've heard in a long time (Baby, You're a Rich Man, off Magical Mystery Tour. Beautiful song.) But what I loved about the film is that he achieved in a couple of years things that most people wouldn't in their entire lifetime. And it made me think... What's the point of being called a geek, what's the point of knowing what a wget command does if you don't apply that stuff and do something exciting, do something that you can be proud of? Will you forever be remembered as a nameless faceless glorified typist who slaved away coding some buggy commercial software, or will you be remembered as a Torvalds, a Stallman or a Cohen? Someone who gave up a boring, well paying life to do something that they genuinely found exciting and worth working towards? It's something I'll have a long hard think about in the next couple of months.
Thursday, November 18, 2010
2nd Semester ST Project
The main intention I had when setting up this blog was to share coding related stuff and other content that would be deemed boring and too tech-y for my other blog. The following post is about an accomplishment of mine that I'm very happy about, and this seems like the perfect place to share it.
Software Technology was my favourite subject during my (recently concluded) second semester at SLIIT. We were blessed with a wonderful lecturer and assistant lecturer and this, combined with my love for code, resulted in one of the most enjoyable learning experiences I've ever had in my life, comparable to that time during A/Ls that we learned about sub-atomic particles and nuclear energy, or the time in 8th grade which I started my first website on Yahoo! Geocities. (RIP)
So, at the end of the semester, we had to do an assignment based on the stuff we learned. It was done in C++, in Visual Studio, this neat little Windows Forms Application. But all that Microsoft goodness came at a price, and our simple application was 1.8 megabytes large. Another drawback was that it wasn't portable, meaning poor old me couldn't compile it in my GNU/Linux machine.
So after we finished our semester, and began our two month long vacation, I reimplemented the program in C. I simplified the problem that we were given (it would otherwise need an insane amount of coding, which I - a lone programmer without the incentive of assignment marks - would find difficult to do), but also switched the data structure we used to store the records from a linked list to a binary tree. The advantages of using a binary tree would be that searching and inserting would be pretty fast. I also did use a post order deletion method to ensure that every record on the tree was deleted before exiting the program, so as to ensure that there were no memory leaks.
My original idea for the C program was to implement it in GTK+ (a cross platform widget toolkit, itself written in C), but I settled for the command line in the end because I had no experience with GTK (and very little experience with C itself) and the learning curve could've been too steep to handle. But I did what I could do, and I finished up with this, a working system that does what does. :) And in the process, I learned how to use malloc and got a new found sense of respect for the 'new' feature in C++ which makes memory allocation so much easier.
So this concludes this long, boring and pointless ramble about a piece of code that doesn't really do much at all. But it is released under the GNU general public licence, not because the free software foundation needs crapware like mine, but because it feels so right to give back to the community that has given us so much, including (but not limited to) the OS that I'm using (GNU), the kernel (Linux), the distro (Ubuntu), the web browser (Firefox) as well as the compiler (GCC) and the text editor (gedit) that I used to create the program. Long live software freedom! :)
Software Technology was my favourite subject during my (recently concluded) second semester at SLIIT. We were blessed with a wonderful lecturer and assistant lecturer and this, combined with my love for code, resulted in one of the most enjoyable learning experiences I've ever had in my life, comparable to that time during A/Ls that we learned about sub-atomic particles and nuclear energy, or the time in 8th grade which I started my first website on Yahoo! Geocities. (RIP)
So, at the end of the semester, we had to do an assignment based on the stuff we learned. It was done in C++, in Visual Studio, this neat little Windows Forms Application. But all that Microsoft goodness came at a price, and our simple application was 1.8 megabytes large. Another drawback was that it wasn't portable, meaning poor old me couldn't compile it in my GNU/Linux machine.
So after we finished our semester, and began our two month long vacation, I reimplemented the program in C. I simplified the problem that we were given (it would otherwise need an insane amount of coding, which I - a lone programmer without the incentive of assignment marks - would find difficult to do), but also switched the data structure we used to store the records from a linked list to a binary tree. The advantages of using a binary tree would be that searching and inserting would be pretty fast. I also did use a post order deletion method to ensure that every record on the tree was deleted before exiting the program, so as to ensure that there were no memory leaks.
My original idea for the C program was to implement it in GTK+ (a cross platform widget toolkit, itself written in C), but I settled for the command line in the end because I had no experience with GTK (and very little experience with C itself) and the learning curve could've been too steep to handle. But I did what I could do, and I finished up with this, a working system that does what does. :) And in the process, I learned how to use malloc and got a new found sense of respect for the 'new' feature in C++ which makes memory allocation so much easier.
So this concludes this long, boring and pointless ramble about a piece of code that doesn't really do much at all. But it is released under the GNU general public licence, not because the free software foundation needs crapware like mine, but because it feels so right to give back to the community that has given us so much, including (but not limited to) the OS that I'm using (GNU), the kernel (Linux), the distro (Ubuntu), the web browser (Firefox) as well as the compiler (GCC) and the text editor (gedit) that I used to create the program. Long live software freedom! :)
Subscribe to:
Posts (Atom)








