Prajwal Tuladhar’s Blog
 
programming, life and some random thoughts

Archive for May, 2008

May 20 2008

Twitter Problem

Published by under Miscellaneous

Something is technically wrong. This is according to the twitter. I have been trying to access twitter from 6 to 7 hours but unsuccessful as many others. There have number of posts and articles circling around the web expressing this very problem. Certainly twitter needs to upgrade their data center and request handling capacity. Its really frustrating :(

Twitter problem


Comments Off

May 17 2008

Cropper – Paint and screen capture utility

Published by under Miscellaneous

Cropper is a screen capture utility written in C#. I really did not know about this cool small utility. I got to know about this tool while reading this blog.  I am using it extensively instead of SnagIt. It’s small and really effective for embedding screen shots in documentation and blogs. Moreover useful plugins are also available. Here is a snapshot of cropper.

cropper_shot.

Happy Cropping :)


Comments Off

May 03 2008

I am loving ternary operators

Basically ternary operators takes three arguments and sometimes referred as ‘tertiary operator’. At first I don’t know why but I did feel hesitation to use ternary operators as at first it looks petty difficult to understand. Some of my coding friends also rarely use it and may be I got influenced from them. But as I explore coding standards and general patterns of big techies like Google and Yahoo!, I found they use maximum use of ternary operators. Especially in Javascript it does make sense because using them can save your time and size of your code. General syntax for ternary operators in C based languages and its predecessors like like C, C++, Java, C#, PHP, Javascript etc. is like this:

<strong>Condition ? Expression1 : Expression2</strong>

Ternary Operator in Javascript

<span class="kwrd">var</span> flag = <span class="kwrd">true</span>;
alert((flag) ? <span class="str">"Flag is set"</span> : <span class="str">"Flag is not set"</span>);
<a href="http://prajwal-tuladhar.net.np/wp-content/uploads/2008/05/javascript-alert.jpg"><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" border="0" alt="javascript_alert" src="http://prajwal-tuladhar.net.np/wp-content/uploads/2008/05/javascript-alert-thumb.jpg" width="405" height="175"></a> 
&nbsp;

Ternary Operator in C#

<span class="kwrd">int</span> flag = 4;
Console.WriteLine((flag &gt;= 5) ? <span class="str">"Flag is more than 4"</span> : <span class="str">"Flag is less 5"</span>);
&nbsp;

console_ternary


Comments Off

RSS Feed
Subscribe by email
Follow me @ Twitter