Filed under: Coding

A Coder's Handwriting

This is a phrase coined by i-don't-know-who. But this is a phrase used my a colleague of mine at office. When ever there is any issue in the code on the TFS, instead of doing a history check and the past check-ins, this guys identifies the author of that code based on its "handwriting". Interestingly enough more often than not, he is correct. And surprisingly enough, when you think about it for a minute, there seems to be some sense in his method.

Read the rest of this post »

Vertical Scrollbar Visibility

So, this is something very basic i learned today. The scrollbar in silverlight appears only when the length of the container is predefined and not depended on its parent container. For example, if you set the grid row height in which you have placed you textbox to "AUTO", you will never be able to see/activate the scrollbar. Simply because the textbox assumes that you have set the parent grid in a manner that will keep the size in check. Instead of activating the Scrollbar in the container, in this case the text box, it will simply stretch the textbox beyond the parent container boundary.

Read the rest of this post »

NameValueCollection and Proxies

Today i learnt yet another painful lesson at work. When you generate a service proxy using SvcUtil, the NameValueCollection data type does not get parsed. In my case it parsed it into a ArrayOfXElement object type by creating  a System.Collections.Specialized namespace within the proxy. I Googled around, then asked around, thinking that i missed some basic object type in c# (read ArrayOfXElement). But that was thankfully not the case. I found a lot of workaround for the given issue. Many involved writing a simple parser (as a wrapper, don't get worried). But a simpler and wiser approach was not to use a NameValueCollection in the first place. Use a Dictionary instead. The same issue comes up in the event of a ArrayList it seems. Use a List object for that. After a little bit of googling i found that the NameValueCollection and the Arraylist are Week Types. According to this discussion thread: http://stackoverflow.com/questions/939118/wcf-serialization-problem-using-namevaluecollection Week types and Weekly typed are two different things. How and why are questions which i am still trying to resolve. But the big and small is this: Do not use NameValueCollections, its an unnecessary headache.

Requirements

Every project is a result of a set of requirements. The success and the failure that project depends upon the extent to which those requirements are satisfied with the project. This is not another piece of literature that will tell you the importance of understanding a client's or consumer's requirements because it is important for the consumer. I am a coder, and i will like to, for a change, try and point out the issues a coder has if the requirements are not clearly defined. To be more explicit, i really do not care about how poor requirement analysis usually effects the consumer, i am more concerned about how it effects the coder, who is expected to transform those requirements to a finished product and machine. My point being, if the coder himself is unclear about the specs., then we have bigger concerns, bigger than the client.

Read the rest of this post »

Browser Actions - Chrome Extensions

Today i got some time from work to at a good look at the chrome extensions and its development. I have been doing a lot of reading in order to understand what the whole buzz is about. Another reason as to why i have been procrastinating the development of my 1st Extension is due to a lack of good idea(s). So i have to get my creative juices flowing. May i will over this weekend. But, all that reading has done me some good and i wanted to share as to how simple it is to build these extensions. So this post is about a specific UI concept in Chrome Extensions and it is known as a Browser Action.

Read the rest of this post »

The Single most Important thing for a Coder

I was having this discussion with a friend of mine today as to what the most important thing for a coder is. Is it good coding ability or good coding standards? Is it about writing basic code which everyone can read or is it about writing brilliant code which no one can fathom, leave alone understand? Is it about knowing one technology/API/framework to a point from where you can rebuild its competitor technology/API/framework, or is it better to have a decent working knowledge of most known technologies around you? I keep having this talk with a lot of my friends and fellow coders. There are many attributes to this ever debated and talked of topic. However, there is this one standard denominator which puts all those talks and debates in unison.

Read the rest of this post »

A Pop-Up Story

This is a tale of what i did at work today. It was lousy in a few ways but educating in many others (its all about perspective). Well, i was doing a lot of code refactoring today and it was truly, and no jokes here, truly a good leaning experience. The theme of today's lesson was simple, Encapsulation. In more elaborate terms, i learnt that service calls should not be made from pop ups. Why? Well, no one has given me any clear reason so far. But somehow it makes sense. A pop up is something very intermediate, right? Its primarily used for peripheral functions. All the actions of uploading data, giving out warning and status messages figures in pop ups. So why should you be making service calls from it? Apart from that, there is another reason why you should not be doing something like that: a pop up is essentially a control as well. Any control you ever make has to be under all circumstances independent of anything else.

Read the rest of this post »

Defensive Coding

I will keep this short and simple. Today a senior of mine uttered this phrase, when i was talking ab0ut spanning out null checks all over the code. He said that it will be defensive coding and i soon realized why. The moment you have null check for everything in your code it becomes a little difficult to track down the root of the issue. While your code will be all running and may never break down, there will be issues which will look so mysterious to you that you will end up wasting an entire day just trying to debug one of them.

Read the rest of this post »

Haiku

No, this is not the operating system. Sorry to disappoint. This is actually an interesting question i came across a few days back. The problem is actually quite simple: code generate as many Haikus as the user wants. Now, why this got me interested is because i used to write a couple of Haikus myself. And i was decent at it as well (it was enough to get a couple of them published in my college magazine). So i sat about thinking what the possible methods of generating Japanese 3 line poetry with a 5-7-5 syllable rule via code be possible. Here is one idea that bounced my mind today and i would like to share it.

Read the rest of this post »