Skip to main content

Posts

Showing posts with the label programming

AJAX - Is it really worth it?

With the onset of interactive web pages that update dynamically the moment you move your mouse over a control, development of an AJAX (Asynchronous Javascript And XML) based web site adds to the complexity. For one, they mess up with your browser history and limit your ability to bookmark a particular page as almost all contents are loaded "in-page". The other disadvantage I see is the in-ability of custom scripts to access the site and extract information. For example, I can write a perl script that can access the Indian Railways page and query the arrival of a particular train. If the site used AJAX, it's going to be more difficult. Cellphones that bundle with micro-browsers either lack javascripting or access is usually blocked by service providers leaving you grapping with an empty framework with no actual data in it. Development wise, you introduce a sense of uncertainty into your web-page where when your page looks like it has completed loading, more data is still b...

SMS SPAM filtering?

Been there, done that. That's what you would hear if you are talking about SPAM filters for your e-mail. The other new area that I am constantly getting irritated about is the mobile SMS SPAM that make their way into my cell phone. One way or the others, we inadvertently give away our mobile phone nos to the various dealers who pass on the same to bulk SMS generators. They in turn make it a point to enlighten you of the various offers that you should be thankful to spend your money on! Thank God I am not charged for incoming messages! I know most providers like banks or the telecos provide a Do Not Call registry usually hidden away in the small-print. They abide by your request, but it is the other sources where you are forced to give away our number from where the main problem arises. One thing that I noticed that most mobile phone lack is an active SPAM filter for your mobile phones that can scan your incoming SMSes and over a course of time, learn from you, on what you regard as...

The portable game framework

Ever since I had seen GCompris , a children activity application, I always wanted to add modules that caters to the need of getting my son to learn while he plays games. GCompris supports a python interface for rapid board development. But one quip that I had was, GCompris is a Linux only application (though they have a commercial win32 port). Now, if I can find a framework that works both on the Linux as well as the windows platform, it would make great sense. Gcompris as of now only will restrict schools to the Linux OS (which is good, but most schools would probably be using Windows and getting them to change would prove difficult) would be good. An alternative framework would be Java with it's great 2D API (no fancy 3D here to confuse the kids). Others would by SDL with C/C++ or pygame (which I read has performance issues on the windows front. Read childsplay ). A new contender that I noticed was the Mono framework which sports a 2D API identical to the DotNet framework. My im...

Whois[she|he]

One of my favorite ploy to those who newly joined my previous company was to give them a command line application and ask them to find out how it worked. This magic command line tool happens to guess your gender if you give your name. char lastc = argv[1][strlen(argv[1])-1]; printf("%s is a %s\n", argv[1], (lastc == 'a' || lastc == 'i') ? "She" : "He"); Basically, it checks to see if your name ends with an 'a' or an 'i' and if it does, assumes that the person is a lady. Chances are, 95% of most Indian names fall into this category and this simple app seems to do magic. Most were able to (after a few tries) guess the grand algorithm, but a few poor souls could not, which eventually leads to step number 2. Step #2 is, as they were unable to decipher the algorithm, I said that I will provide with two separate command line apps called whois she and whois he . I also mentioned that as I had not done the validation part prope...

20 Years Before - 1988

When I had attended a course for GW BASIC. I already had a computer at home, and it was called the ZX Spectrum with, wait for it, 48k memory. Before formally learning the BASIC, I had restricted myself to a few prints and beeps and meticulously typing out program listings off computer books which eventually resulted in a star walled winding road with a car in the middle. The beeps always allowed you to specify the frequency and duration to compose a simple tune of your own. The I/O was innovative with the ability to use standard audio cassette tapes to record your programs and load it back. Hmmm. The good old sequential storage medium. And mostly, I was using it for playing games. There was one called DLAN, a space simulator which I had spent countless hours trying to save the Earth and solar system from menacing alien fighters which featured a 3D environment along with a full solar system map, portholes and docking to a planet to refuel and carry out simple maintenance activities. La...
Inside a Text Editor Ever since my college days, after dabbling with vi and a few other editors, I always had an yearning to create my own. Now, I am still stuck with XEmacs and jEdit and had a chance to compile / study the sources and documentation of EMACS and a free editor component called Scintilla. Until now, I was under the the belief that text editors used a doubly linked list to represent the text in memory. The advantages of this approach being insertions and deletions are much more easier which is just a matter of just un-linking a node off the list. But the shortcomming is that they tend to fragment memory with each node or line take a bit of memory. The other alternative approach is to have a dynamic array which is a contiguous space of memory and can sometimes be directly written off to a file. The disadvantages are that insertion and deletion are costly and you need to reallocate quite frequently. While goint throug the source and documentation of text editors, I chanced ...
Visual Studio - tread safely Wizards - A slowdown to productivity? Had a chance to write a few small apps in C# using the IDE. One thing that felt a bit daunted was the amount of code that is being generated automatically specifically with the GUI initialization code and the resx files. Intellisence? Not for the 'declare later' group The second is how intellisence interferes with your code. If you use a variable without declaring it (say in a for loop), intellisence inserts the nearest matching class or type name or variable in code, which I have to backtrack to remove and the go back and declare the variable and then specify that in my loop. The mystic resx files Whenever you start including images or other resources, they get compiled as a resx file which is xml file with the binary data embedded into it (using base64 encoding?). Though I have included the core resource files in the project, the resx files becomes difficult to manage, especially when multiple members are work...
MaxMileage Been some time since I've posted. Had been busy reading the final volume of the Harry Potter series which I managed to acquire on the day of the release at the Central Railway station. Putting things aside, I had also managed to learn a little bit of DotNet programming and created a simple project @ SourceForge. With my interest in fuel economy, I had created a simple application to keep track of your progress and view the data as charts. It's not a complete application yet! I know a few hundred similar apps exists, but this I felt was more apt for my needs and I get a chance to program too.
XEmacs - Still resisting the dark side The other day, I had been contemplating changing to a fancier text editor. Though I do little programming now, I still find a need for a programmer's editor as I will be frequently writing simple scripts or processing csv files created by Microsoft Excel or log files. The other editor that I am familiar with is JEdit , which I had used for a brief period and have even contributed a macro . It had a good GUI, syntax highlighting for numerous programming languages and scripts, searching capability, plugin support, extensibility and so on. But, the one point it faltered was on the memory usage side. Just opening the editor took away a good 40MB of my scarce RAM. I guess it needed the memory to display those fancy icons and GUI controls. XEmacs in comparison, ends up using less than 10MB and is way faster too. Some indispensable commands Over the course of time, I have started relying on a few commands, so useful that I use them almost daily. You...
XEmacs init.el It's been almost eleven years since when I was introduced to GNU EMACS. It came in as a DOS based editor which failed to load files that were over 640k. This was followed by DPMI support which provided flaky support to open files larger than than and unreliable under Windows 3.1. I then migrated to GNU EMACS on win32 and finally settled down with XEmacs on XP. Over the years, my (X)EMACS config file has and still undergoing changes and here is the latest configuration that I maintain. Note: I am not a lisp hacker, but have basically accumulated a list of handy configuration options and snippets that were indispensable during the course of my programming career. ;; ;; Shoban's XEmacs init.el ;; ;; ---------------------------------------------------------------------- ;; load paths ;(pushnew "~/.xemacs/xemacs-packages/dmacro" load-path :test 'equal) (pushnew "~/.xemacs/xemacs-packages" load-path :test 'equal) (setq Info-directory-list ...
Of Hollywood, frameworks, APIs and inversion of control I recently chanced to learn about a pattern called the 'Inversion of Control'. This is primarily used to abstract out the creational part of dependent components from a class is question. In simple terms, a class need not create dependent objects. This independence of the creational logic allows such classes to be more loosely coupled to dependent objects, thus resulting in easy replacement of the dependent objects during run-time. This technique is used by unit-tests to isolate a particular class from its dependencies so that the class / object in question can be tested alone. We usually resort to using creational patterns like the singleton or the factories to decouple the creator from the logic of creation. What we essentially do is, we just add one more level of indirection to the actual creation logic. Earlier, we used to manually use new to create an object. With the singleton, our class uses the singleton, which in...
Learnings on software development http://www.taylor.se/reddit.html and Digg posted an article on the learnings from ten years of software development. May I add: 2. The difficult part of software development is communication Primarily, this boils down to both verbal and written communication. Both are used at different combinations at different scenarios. When you are discussing features or effort or schedule with your customer, it makes sense if these are written as it allows you to archive the information and refer to it at a later point of time. Who knows, six months down the lane, it would be you who would be scrambling down your e-mail chain trying to figure out why a feature has to be implemented the way it is. Even if you have a verbal discussion, it is a good idea to follow up with the minutes or a gist along with a set of action items. On the other hand, when it comes to appraisals, evaluation or goal setting sessions, it is primarily verbal communication followed with the a...
Dot Net development the free way There is a new trend catching up... More mainstream application targeted towards the x86-architecture tend to move towards the Dot Net platform as compared to Java since a few years back. With majority of the users holding their roots to Windows, Dot Net seems to be better in terms of performance as well as integration with the OS. That's why I decided to learn Dot Net programming. With learning to programming using the Dot Net framework, comes the question of getting a compiler, editor or an IDE. Microsoft has provided the framework SDK for free for anyone to install. But unfortunately this comes along with command-line tools like the raw compiler or the console based debugger. Agreed, Visual Studio 2005 is there. But, it does not justify the cost to just learn a new programming model. The alternatives? A few exists. SharpDevelop , an open source IDE is available for those who are interested in a true blue open sourced IDE. But it has many kinks th...
Architectural Patterns and kernels Monolithic architecture - Exposes a high level interface where with core services closely coupled with each other. Linux and other monolithic kernels provide a high level system call API and internally, services like memory management, I/O etc are tightly coupled. Pro: Performance Con: Defect on one service may affect other services Microkernel architecture - Services decoupled and run on own process. Use message passing mechanism to communicate with each other to reduce coupling. Pro: Easy to extend or add new features. Malfunctioning service can be restarted without affecting others Con: Slower Hybrid kernels - Micro kernels that have non-essential code in kernel space for efficiency. Microsoft Windows NT and strains are an example Exokernels - Provides a library for core OS features (in terms of the developer requesting particular pages of memory or blocks of diskspace). Application developer builds on top. Multiple li...
Some Behavioral Patterns Visitor: Abstracts operations on a data structure and to avoid making changes to existing data structures. Allows new operations to be added without changing data structures Strategy: Abstracts similar algorithms so that it can be interchanged without affecting the data structure. Used to eliminate switch-case statements Iterator: Provides a unified mechanism to traverse data structures without encapsulating the traversal logic