Programming


Introduction to Programming: What I wish I knew

Every Introduction to Programming class starts with a programming language, introduces various concepts like variables and functions and leaves with an understanding of some simple algorithms. Mine was no different. We used C and spent a lot of time trying to make students comfortable using Linux. This leaves a lot to be desired. Software engineering is hard and laying out certain principles at the beginning can help tremendously. This is a short list of supplemental resources I would have liked to have when I started programming.

Apache Cassandra: Iterate over all columns in a row

Recently I have been using Cassandra for one of my projects, and one of the needs is to iterate over all columns of a row. Each column represents an individual data, of type identified by row id, and keeps changing. So I can’t simply use a set of known column names. Using the setRange call on a SliceQuery and setting a large count is also not an option, since Cassandra will try to load the entire set of columns into memory.

foss.in 2010

The 10th and sadly last foss.in took place this week in Bangalore. I was there for all three days of the conference and it was great. This time around we were 6 students from my college. In addition, at the last minute a lot of KDE developers did turn up, including Vishesh Handa, Pradeepto, Abhishek and Sujith. Danese Cooper’s opening talk about the architecture of Wikipedia was inspiring. That one of the top 5 websites in the world, is powered by just 450 servers and 60 people is an inspiring tale of open source skill and passion.

Custom hash objects in Python

It's quite common to use strings, integers and other 'native' Python data types as hash keys. But sometimes it is much easier to be able to use your own class instances as keys. Python's magic methods allow you to do this. Note: This is not a tip on implementing hash functions, this is how you can remove a certain layer of peeking around into objects __hash and __cmp__ Consider a useless HTML parser with a simple node design where you want to associate the node name with its attributes.

Programming: The invisible wall

In the past few weeks, as I've tried and failed at various projects, there has been a realisation that you can only go so far with random reading and coding. The first few years of programming are spent coding projects pretty minor on the algorithms/data structures side. But when you finally start growing out of it and when 'cool' projects for you start to become more complex, a seemingly invisible wall smacks you.

If Programming Languages were Lego...

Assembly would be a huge set of 1x1 blocks. You could do everything other blocks could do, and more, but it took a lot of time and planning to put them all together the right way.C would be 1x1 with a few 2x1 and 4x1 thrown in for convenience.C++ would be just like C, but there would be all these new highly specific pieces which would only be used by a few people.

Why factor is cool

Before beginning, I must admit I haven't messed with Factor for a couple of weeks now, nor do I contribute to it, I'm a Factor n00b. Please contradict peacefully. Of course there are the usual reasons that it is open source, most of the standard libraries are in Factor itself, and that it has a really cool development environment. But almost every popular language these days has all that stuff.

Most programmers are atheists

If this survey represents a signifact portion of them. Of course these are the programmers who are involved on the web, not much of all the zombies coding for the sake of it.

Programming: What they don't teach in school

This is my honest opinion, feel happy to flame or contradict me, but be polite. Much has already been written about how much High School computer science teaching sucks ( High school computer science education ). As a student who has just left high school I just wanted to present my 2 cents on how bad the seperation between RealWorld programming and ClassRoom programming is. A common rebuttal is that there isn't enough time.

Factor -ize

Its been a week since i discovered Factor. So first, it's stack based, it's small, it's almost tiny. I've never programmed in a stack based language before. But I liked it, really makes you think. Infact I haven't got any program written yet, just playing around in the interactive interpreter. It's got really good documentation by way of the API, what it could use is a quick start guide, ie. a list of some basic operations of the stack, using conditionals and looping and arrays and hashmap, because right now you've to look through the documentation for each concept, which means the unity is broken.

Tetrablocks and Login Win32 versions

I forgot to post this but Windows executables of both Tetrablocks and Login have been uploaded to 22bits. Compiling them on Windows was a bit of a nightmare. Tetrablocks has got all of its text drawing code removed since I couldn't get SDL_ttf to link. So you won't see the score or the game over message when playing it on Windows.

ColourCode: 1.0 Released

I'm quite pleased to announce the release of version 1.0 of ColourCode. You can download and know more about it from the ColourCode homepage. Please leave your feedback and bugs in the comments

ColourCode: Some thoughts about the future

Before I write about the possible future of ColourCode, let me get a few things out of the way. First today I fixed an extensionless file bug, and you can now force languages in ColourCode. Now that thats out of the way, I was just thinking about how much interest I still have in ColourCode. I mean writing it was a lot of fun and gave me some new insights into design but I don't feel the same interest I had in parsing and analysing language files, that I had when I began ColourCode.

ColourCode: 1.0 almost done

ColourCode is done. It now has support for PHP and HTML which it didn't have before. Perl support will probably get in before the stable release. This version has been bumped to 1.0. I think I've made a really good project and that it deserves the 1.0 tag. PDF support will not enter the 1.0 release but is on track for 1.1. All that is left now is testing some highly tweaked files.

ColourCode:Updates

Language support ColourCode now has support for C# and Javascript, completing support for the original language set. I'l be adding Perl and HTML soon enough. Bugs On the C based languages front there is a small logic error in the multiline comment system. I am currently trying to iron it out. Snippet feature dropped I've decided to drop the snippet feature since its not universal (doesn't make sense in PDF) and since CSS is now dynamically generated, giving the CSS data to the user and having him embed it will be quite annoying.

ColourCode: Almost done

In the last two days ColourCode has reached a stage where I can say that it is finally ready for release. Everything apart from implementing language handlers is done. PDF support might not be added. It all depends on how patient I am in releasing it. Meanwhile you can download a nightly build and view demos for Ruby and Python from the link above.

ColourCode: Making progress

ColourCode has been getting along quite well for the last week. I now firmly have the basic design for my plans in working code. The language parser and handlers are coordinating well and this might just be one of the best designs I've ever envisioned. Once the main program is in place writing language handlers and formatters for ColourCode will be really easy. At this stage only the Ruby language handler is complete, and until I can make it work perfectly for a large amount of code, no other handlers are expected.

TetraBlocks: on freeze

TetraBlocks has been put of freeze for a few days. I've got pieces rotating and stuff, but thats it for now. Right now its time to concentrate on more generic issues like writing a small highscore and menu framework, because I know that these two things are necessary in almost any game you will ever create. So if I can get those two things done, it will save me a lot of time.

Desertion...

...or why I never maintain my old programs much. The reason I create some software, fix a few bugs, do a few minor version upgrades and then let it be, until someone really needs something is because, well, I like to do a lot of different projects in different fields. Now it so happens that I am still in school, now going to standard 12, which in India means bad. So I get just about 2 hours a day on the computer.

Pixelframe Preview

As Pixelframe is nearing completion I have uploaded a pre-alpha not as a download but as a demo. Most of the features are complete. The few remaining are sorting out bugs and writing some documentation. To see the demo with two galleries try these links http://22bits.exofire.net/demos/pixelframe/client/?album=Wallpapershttp://22bits.exofire.net/demos/pixelframe/client/?album=InkscapeIf you have comments about improvements, please post them below.

Dynamic delegation in PHP

While working on Pixelframe I devised 2 methods to dynamically delegate tasks to appropriate functions. These methods may already be known and used but these are mine and I thought it would be good to post them. These are particularly useful for handling requests where you call a certain function/script based on one parameter ( say 'action' ) and pass the rest of the parameters to the function /script. So here goes.

Trac(k)ing

Recently I discovered the Trac SCM for project management. And its really great. Especially for lone developer projects. It has a inbuilt server, so know need to configure Apache for mod_python.Good offline documentation embedded within the projectSmall download sizeSimple setup for projectsSVN browsing and good diffsWiki feature allow TODO list maintenanceThe last is particularly useful when you have been storing TODOs in your SVN commits till now :D. So I am using Trac for both ColourCode and my secret project(soon to be revealed), and I am loving it.

Learning the hard way

I have come acrooss some rare occasions in programming in which the language/environment/common sense really wants you to learn after literally breaking you head. Thats what happened today in a javascript app I am doing (Shh! Its still a secret). For 2 days I have been trying to use everything I know to clean up a problem I was having with every node firing the event when only one should've been.

Colourcode 0.2 released

ColourCode 0.2 has been released. In addition to the features mentioned in the previous post it now supports C# and Shellscript and Javascript. Check it out at the ColourCode homepage

Colourcode 0.2 nearing release

I am quite pleased to announce that ColourCode 0.2 on which I have been working for the last week is nearing release. 0.2 has the following features over 0.1 support for multiline comments , also when they are embedded inlineoptionally printing line numbersSupport for quote escapes in strings when a backslash precedes it ATM there are a few bugs Also there will be support for more languages

ColourCode 0.1beta released

I am pleased to announce the release of version 0.1beta of ColourCode. ColourCode is a Ruby program to generate syntax highlighted HTML files. Currently it supports HTML, Java, C++, Ruby and Python. For more information and (not)features see the ColourCode homepage

Initial ColourCode Success

As I mentioned in a previous post, I am working on a Ruby generic syntax highlighter. Well today it had its first measure of success by producing this HTML: It is buggy as can be seen from the mess up near the end, and write now I haven't chosen the best colours nor a complete correct language definition for Ruby or any other language, but the major part is done.

Books

I got two new books today, Practical C++ Programming and Code Complete 2/e . Both are supposed to be really good, so lets see what knowledge I gain from it

Long time no write

Well I have been quite busy/tired/bored to write these past few days, so today I willed myself to write. The Christmas holidays have begun and I am getting a little more time on the computer. It was my birthday on the 22nd and so now I am officially 16 as reflected in the sidebar. I have also been planning a lot of projects. They are a code-to-html syntax highlighter in Ruby, a JS toolkit, a Ajaxified To Do Note application and a blog system.

Learning

I have decided to take a break from creating software to learning some new things for a few days. So I have started learning Ruby, advanced JavaScript which I didn't know before, especially DOM scripting and Ajax. And I am also reading Beginning Algorithms which is a really good book for an introduction to algorithms in a easy to understand concrete way. That said I am starting to like Ruby and feel the same enjoyment that is felt when coding in Python.