You are currently browsing the tag archive for the 'Programming' tag.
Chanced upon this very interesting trivia in the Wired article on the new book by Chris Anderson (FREE):
Honeywell Kitchen Computer Advertisement
“Honeywell Kitchen Computer, priced at $10,600″
…
“the Kitchen Computer was aimed at housewives and featured integrated counter space. Those housewives would, however, require a programming course (included in the price), since the only way to enter data was with binary toggle switches, and the machine’s only display was binary lights. Needless to say, not a single Kitchen Computer is recorded as having sold.”
The text of the advertisement read (source: Wikipedia):
“Her souffles are supreme, her meal planning a challenge? She’s what the Honeywell people had in mind when they devised our Kitchen Computer. She’ll learn to program it with a cross-reference to her favorite recipes by N-M’s own Helen Corbitt. Then by simply pushing a few buttons obtain a complete menu organized around the entree. And if she pales at reckoning her lunch tabs, she can program it to balance the family checkbook. 84A 10,600.00 complete with two week programming course. 84B Fed with Corbitt data: the original Helen Corbitt cookbook with over 1,000 recipes $100 (.75) 84C Her Potluck, 375 of our famed Zodiac restaurant’s best kept secret recipes 3.95 (.75) Corbitt Epicure 84D Her Labaird Apron, one-size, ours alone by Clairdon House, multi-pastel provencial cotton 26.00 (.90) Trophy Room”
Hmmmm …
Chuck Jazdzewski gives very topical advice to programmers in a post on his blog [link].
The main bullet points:
- Keep Learning
- Learn to communicate
- Be Predictable
- Own up to Your Mistakes
- Never let Bad Code off your Desk
- Programming is Fun but Shipping is your Job
Needless to say, the last one is my favourite :-)
I found this game on youtube where you have to drive a car to safety by clicking on annotations they present at seemingly random places during the video’s playback. While a little lame to call it a game, it sure is a way to make youtube interactive and a little more engaging, and perhaps something YouTube team itself might like to experiment with [via pluggd.in]
This has been made by Hexolabs, an IIT Kanpur startup.
Link: http://www.easyeclipse.org
I went back to Java after quite sometime, and had a tough time installing some plugins (Visual Editor in particular, it is not supported as yet on the current Europa release and only on the previous Callisto) this site is really handy in case you want to get a setup with everything you need already installed. They have bundled everything together and everything just works!
They have also divvied it up into broad areas such as ‘Desktop’, ‘Web’, ‘LAMP’ and so on — targeted towards programmers in that category. Apart from the fact that they have these distros, it was also a great place to find out what were the most useful plugins for development on the eclipse platform. I didn’t even know they have very useful plugins even for things like database management and SVN.
A life saver for people not experts on eclipse, I must say.
And indeed, it has happened. Poetry has finally infiltrated the bastion of the uber-geek — the Linux Kernel. Rusty Russell, who contributes as lguest, likes to submit patches with verse in their documentation. Wordsworth would definitely approve, though Linus thinks otherwise. Sample these:
There once was a virtualization coder,
Whose patches kept getting older,
Each time upstream would drop,
His documentation would slightly rot…
The ballads were hard to stay/ And Alan Cox jumped into the fray:
There once was a man they called rusty
Who patches were terribly crusty…
Perhaps there should be a programming language written in verse. With the poetic license, semantics would be hard to freeze, wot say?
[Via Linux Today]
Making web-sites scale is a non-trivial thing to do. It requires a lot of knowledge of the operating system, the web servers, databases, using php scripts and so on. However, a very simple technique is to use add a lot of caching, and wring out as much productivity and efficiency as you can out of the hardware/software.
This article describes some of these techniques and I know for sure that a bunch of them work quite well (such as the PHP-accelerator which caches compiled php files). Give it a try!
Another simpler option which lazy bums like me would prefer is to use a managed hosting solution like that of WordPress.
A quick way to find the lines of code under a subdirectory:
find | grep “.cs$” | awk ‘//{print “\”"$0″\”";}’| xargs wc
It recursively finds all the files under a directory, passes through a grep filter (which you would have to update based on your preferred language of development), awks it to enclose it with quotes and then passes to wc using xargs. Neat!
My current project now has about 31k lines of code, out of which about 9.5k is mine. Messy!
[Thanks to Robin for help with the commands]
My friend sent me this blog post which claims that C is not the most efficient programming language. The basis of the author’s claim is that in most modern computing systems careful hand-crafted optimizations are difficult to do and one has to rely on the prowess of the compiler to produce efficient executables. C, which enables complex pointer arithmetic, makes it very difficult for the compiler to do some optimizations because its free-flowing memory access pattern leads to complications in doing alias analysis. This essentially means that it is difficult to figure out if two pointers can point to the same region in memory in C. If we can figure out that the memory foot prints of two pointers are disjoint, the compiler might be able to step in and do some efficient optimizations, which it is unable to do.
The post makes for interesting reading. The author speaks about an experiment with the implementation of an LCS algorithm on OCaml, C and other languages and claims that OCaml outperformed C.
Food for thought indeed. However, I was not sure if employing good pointer aliasing analysis algorithms in his simple case and performing better optimizations would have enabled C to outperform. His one example may not be representative of all programs and there are too many other variables that have not been studied.
Serialization is the process of writing data out in a storage medium in a pre-defined format so that it can be read back programmatically. Even though there can be many forms of Serialization (even usage of databases is Serialization in some sense), in most cases, serialization is used to persist the program state onto a file and read it back so that computation can proceed from an intermediate state.
I remember at one point of time, I used to fret and worry about having to decide a format to write my data in, and then write procedures for writing them out into a file and then reading them back. And then look for minute bugs which crop up in this process. Developer productivity goes for a six while the manager manages a sinister laugh in the sidelines as the employee sweats it out with printf and scanf.
No more! Thankfully there is something called object serialization that comes to our rescue. With the dawn of languages such as Java and the .NET platform, serialization was made very simple, in fact so simple that little cherubs (in their garden playing harps or rather System.IO.Harp) could just add a single attribute to the class name and all the perspiration is taken care of by the framework.
In the .NET framework, serialization can be very simply implemented by adding the [Serializable] attribute to the class. Any fields that one doesn’t want to be serialized can be marked with a [NonSerialized] attribute. Thereafter, you just use a BinaryFormatter to format data into a suitable binary format, open a FileStream to write it out to a file, and bingo, you’re done!
However, I was not convinced it could be so easy. The objects typically form a graph structure and might be cyclical. Would the automatic implementation of .NET Serialization be able to handle this cyclical structure, or would I need to fish DFS and BFS from my old dusty textbooks, parse them in an acyclic manner and write them in a suitable order. All my worries were misplaced! It just works… it’s magical. You can be a dork and use the object serialization in .NET!
There is a small catch though. Static fields of a class are not serialized automatically (among some other gotchas). And you need to implement the ISerializable interface and provide custom implementations of the GetObjectData method and a constructor of the class which takes SerializationInfo as a parameter (See some examples here) in order to deal with these special cases. In my simple case, I had an identifier for every object which I allocated based on a idCount variable which was a static integer. Hence, in the custom constructor, I set the value of the idCount to the highest id value I had seen so far during deserialization so that I don’t generate old id values gain.
id = info.GetInt32(“id”);
if ((this.id + 1) > idCount)
idCount = (this.id + 1);
But still, object serialization is a great boon for most of us developers who don’t wish to tear their hair out trying to write code that is not even important for their work!
–
Ok. So, I discovered that in case you override the Serialization using the ISerializable interface, you need to override it for all the derived classes. A lot of hard work I am not willing to do. Another trick could be that in case of the base class, instead of implementing the ISerializable interface, implement the IDeserializationCallback, which essentially lets you override the OnDeserialization method which is called after the deserialization is done, and you can write custom logic there to populate the static or the Non-Serialized fields.

Subscribe via Email
What I'm reading
My Bookmarks
Follow me on twitter
My linkedin profile
Recent Comments