Creating big applications is a long and difficult process. It is also very vague and non-linear. Design documents change as per the fluctuating needs of the client, limitations of the development environment and programming language, paucity of time and funding, and of course, developer competence. Before one sits down to start writing code, one must have a conceptual overview of the application. This is the architecture phase. Once this conceptual overview has been fleshed out, one starts thinking about the patterns, data types and algorithms to be used. Note that by patterns I mean application patterns and by data types, I mean abstract data types and not data structures. A queue or a stack is an abstract data type and NOT a data structure, queues and stacks can be implemented using either arrays, linked lists or heaps. These are data structures. Data types provide intent, while data structures provide the means. A pattern I want to discuss is the Producer/Consumer queue.
This pattern is useful if you have jobs that are generated which need to be executed in a sequential manner. So we have a queue of tasks and a worker thread that executes those tasks on-the-fly as they are enqueued in the queue. So how is it implemented? Very straightforward. We have a queue, a locking object, pool of threads and a thread monitor. To enqueue, first lock the locking object and call pulse in the monitor. To consume, simply lock the queue, dequeue, and pass on the task to a waiting thread. To dispose simply enqueue NULL in the queue and wait for the threads to terminate.
Sunday, March 28, 2010
Friday, March 26, 2010
Lamer and lamer
Obsession is not a good thing. Well, most of the time it is, but becoming too obsessed with something will make you a very lonely person. Obsession is also a sign of greatness; no man who was a master of his craft was a sociable person (exceptions are always there though). Perhaps loneliness is the price one pays for everlasting glory? Anyway my "plan" is coming around quite nicely. If I am lucky I could get 3 maybe 4 slots. If that happens I can rest easy....for some time ;)
So for some news; placed 4th in Eastern Groups, 4th in powerlifting :( , completed Dragon Age: The Awakening, and cramming my head with a lot of code.
Presently I am working on a on-the-fly analysis of code. Lets see how this will turn out.
So for some news; placed 4th in Eastern Groups, 4th in powerlifting :( , completed Dragon Age: The Awakening, and cramming my head with a lot of code.
Presently I am working on a on-the-fly analysis of code. Lets see how this will turn out.
Wednesday, March 17, 2010
Code Metrics Addin update (beta version available)

I have been working quite a bit on the metrics addin. In the process I also learned quite a bit about the idiosyncrasies of the C# language as well as gained familiarity with NRefactory and the MonoDevelop Dom model. The next logical step would be to implement CQL which should be quite straightforward as I will just need to map CQL to LINQ queries and query the context data structure that I already have.
Here is a screenshot for you to enjoy. A very weird thing is that NRefactory refuses to parse lines in between # regions. So a namespace defined as
#if_something
namespace name1#else_something_else
namespace name2
{....
will not be parsed. Somehow the Dom model recognizes it though.

Saturday, March 6, 2010
Diligence and discipline
Two words that are definitely missing from my life right now. On the academic front I have lost all interest. Seriously, at this point of time in my life, I am sick and tired of never ending exams. They are totally pointless and a complete waste of time. I have no interest in suggesting alternatives because that will be an exercise in futility. Speaking of which I have a powerlifting event I have to participate in tomorrow. I did a 80 kg benchpress some time back. Hope I am in good form tomorrow!
My code metrics project is going on pretty well. Have a lot to learn though, especially the .NET threading model and GTK# as well. I also need to get started with all the pending work of SMS Invite :)
My code metrics project is going on pretty well. Have a lot to learn though, especially the .NET threading model and GTK# as well. I also need to get started with all the pending work of SMS Invite :)
Thursday, February 18, 2010
A lot to write about....
...but no time to write it. Will write a long one after exams which end next Friday. Till then, must study, must study, must study....
Thursday, February 11, 2010
OCS# and Custom Invitations
Some time back I checked out an interesting project called Social Web for the KDE desktop. It brings the power of social networking into normal desktop apps. The back end of this systems is a REST based API called Open Collaboration Services. Although there is a QT based C++ binding for it called Attica, I thought it might be fun to whip up a C# binding for the library. And while I am at it, an Android client as well? ;)
Its quite fun to think about the kind of apps one could dream up using OCS. If normal desktop apps integrate OCS into their services, one would not need to start their browser, go to facebook or myspace or whichever social site they are a member of, login and access their apps. You could do all that from your desktop itself. Consider a music player. Say you really liked a particular song and want it to appear on the recommendation listing of your friends. All you have to do is mark it with a 5 star rating and make that data public. The backend will post this data to your profile on the web using OCS and your friends can pull this data as and when they need it. Creating a robust recommendation on top of this system should then be a pretty easy task.
Also I am taking care of custom messages in SMS Invite. I had a solution using XML in mind but I have not really started off on it yet. Lets see where this goes...
Its quite fun to think about the kind of apps one could dream up using OCS. If normal desktop apps integrate OCS into their services, one would not need to start their browser, go to facebook or myspace or whichever social site they are a member of, login and access their apps. You could do all that from your desktop itself. Consider a music player. Say you really liked a particular song and want it to appear on the recommendation listing of your friends. All you have to do is mark it with a 5 star rating and make that data public. The backend will post this data to your profile on the web using OCS and your friends can pull this data as and when they need it. Creating a robust recommendation on top of this system should then be a pretty easy task.
Also I am taking care of custom messages in SMS Invite. I had a solution using XML in mind but I have not really started off on it yet. Lets see where this goes...
Saturday, February 6, 2010
Antibiotics and antihistamines
I have fallen ill thrice since the beginning of the new year. I recovered the last two times without taking any medicines but now I am not taking any chances. Primarily because I am running a fever and my throat's hurting. When this happens there is a chance that the infection will spread to the ear causing the worst suffering I could ever imagine. So I am currently taking Roxithromycin (150 mg) and Fexofenadine Hydrochloride. Roxithromycin is a broad spectrum antibiotic that takes care of most respiratory infections. Fexofenadine is an antihistamine, and is used as an antiallergen.
Anyway, all I can say is that never take good health for granted.
Anyway, all I can say is that never take good health for granted.
Subscribe to:
Posts (Atom)