Tuesday, October 30, 2007

My Blog Ping Server List

Windows Live Writer has an option to add 'ping servers'. Here is the list I collected from numerous sources. I didn't check their existence since there's nothing to loose if Writer fails to ping a server.


Monday, October 29, 2007

DebuggerStepThroughAttribute: Streamline your debugging

Properties are a great feature in .Net, no doubt. The only time I have a problem with them is when I have simple properties and I am stepping through code while debugging. Let me explain ... It so happens that while debugging, if you use F11 (Step Into), VS.Net will step into every property used as well. Many a times, this is a colossal waste of time, since I am fairly confident that the properties are simple and get/set correct values. I really need a way to force step over for these properties. Well guess what, there is a way. It's an attribute called 'System.Diagnostics.DebuggerStepThroughAttribute' that can be used with property get/set or even methods. When present, it will force the debugger to step over that property/method saving time and reducing debugging complexities. Here's the sample code :


1 public int Count

2 {

3 [DebuggerStepThroughAttribute]

4 get { return count; }

5 }

References MSDN Debuggerstepthroughattribute MSDN Debuggerstepthroughattribute Members

Sunday, October 28, 2007

BBCTheme v2

Here's the version 2 of the BBCTheme (Blogger Blue Cogitation Theme). Here are the new features:
  • Added collapsible post listing
  • Added 'digg' to post footer
  • Added twitter widget
  • Added My Links widget
  • Misc css changes
  • Updated footer message
  • Added placeholder for 'Google Analytics'

Download v2d (7kb .zip)

PS: The original theme was created by Mark Wagner. I have adapted this to the new Blogger Template. Feel free to use and modify it. If you are happy with what you see, please do post your blog URL in the comments. Look good!

Technorati Tags: , , , , , ,

Saturday, October 27, 2007

YAW: embed multiple flash objects in your blog

Yesterday was my wife's birthday, and I thought this year I could surprise her by sending her some funny e-cards on her Google Reader, through my blog post, which she ofcourse subscribes to. The cards could appear amongst other posts like a piece of sun dried tomato in a Greek sandwich. Hey, it must be lunch time!

Back from lunch! OK, so back to the post ...

So it should have been easy, right? Choose the cards, embed them in the blog post and submit! Not so fast cowboy! Let me tell you why. Here were my objectives:

  1. I had multiple flash cards and did not want them to auto-play on page load
  2. I wanted to show a preview of each card
  3. When clicked, the preview image should convert into a flash object and auto play

The first step was to choose some nice cards, googled 'flash birthday cards' and reached care2.

So here's the pseudo code ...

img onclick="PlayCard(...);"
a onclick="PlayCard(...);"
When either the image or anchor tag is clicked (onClick event), a call to a javascript method PlayCard is made. At this point, PlayCard replaces the innerHtml of the <div> tag in play here with the actual <embed> code. Simple JavaScript stuff! Here are the parameters that need to be passed in to the PlayCard method ...
    Download (787 bytes CardPlayer.js)
    Technorati Tags:

    Saturday, October 13, 2007

    Blogger Template: Blue Cogitation Theme

    The original theme was created by Mark Wagner. I have adapted this to the new Blogger Template. Feel free to use and modify it. If you are happy with what you see, please do post your blog URL in the comments. Look good!

    Download (6kb .zip)

    References Technorati Tags: , , , , ,

    Friday, October 12, 2007

    US Dollar depreciation and its effects: An analysis

    Analyzing the causality (relationship between events) between depreciating USD and its effects is confusing for a non-seasoned financial mind such as mine, but interesting none the less.

    • Declining USD means that loaners (other countries like China, Japan, etc) want higher interest rates for a shrinking USD
    • Rising interest rates means a decline in business activity and a decline in jobs (aka recession)
    • Recession means decline in federal and state government tax receipts
    • Declining tax revenue while federal and state spending is increasing means greater budget deficits
    • Increase in budget and trade deficit means an increasing current account deficit, resulting in more debt
    • Increasing debt means an eventual downgrade in US credit rating and/or lower confidence
    • Poor credit rating means higher interest rates, higher inflation, a further downward US economic spiral

    Now, Fed needs to worry about recession. It must therefore lower interest rates to increase economic activities.

    • Lower interest rates means turning away international loaners, resulting in greater account deficit
    • Lower interest rates means more cheap money within US
    • Cheap money results in resulting in greater economic activities including M&A, IPO and business expansion/creation
    • More business activity might result in placing wrong bets, resulting in huge losses (remember .com bubble anyone?)
    • Cheap money also results in greater number of real estate transactions, resulting in higher demand
    • Higher demand for real estate means dramatic price increase (aka bubble)
    • This bubble bursts when economy is doing well and Fed has to increase interest rates to tame inflation
    • Bubble bursts result in losses, which eventually might result in recession
    • And the cycle continues, typically every 10 years

    Well, here are some other implications of a depreciating USD

    • Depreciating USD means higher prices for commodities like oil, gold, silver etc
    • Depreciating USD with higher oil prices means increasing inflation in oil nations pecked to USD
    • Increasing inflation results in increased pressure to move away from USD (eg Kuwait)
    • This would mean oil will be traded in alternate currencies such as Euros, resulting lesser demand for USD, further increasing downward pressure

    Interestingly, these events have fermented over numerous years, during which time Allen Greenspan chaired the Fed. I wonder how much of where we are today was an effect of Greenspan's policies. Apparently, I am not the only one ...

    "During Greenspan's tenure, America was transformed from the world's largest creditor to its greatest debtor, from the world's mightiest industrial power to a second-rate service provider, and from a nation of responsible savers to one of reckless spenders," - Peter Schiffo

    Bits and Bytes of 1000 vs. 1024

    So what's the difference you ask? A lot, 2.4% to be specific. In the telecom world, where billions of dollars are spent trying to achieve 5-9s, 2.4% makes a huge difference. It is therefore important to understand the various standards. The main difference is metric numbers vs. binary numbers.

    Binary numbers: Binary system uses two basic units ...

    • bit: represented as 'b' or simply as 'bit'
    • Byte: represented as 'B'. 1B = 8bits
    The representation is the first two letters of the unit. So ...
    • kilo binary = kibi
    • mega binary = mebi
    • giga binary = gibi, and so on
    The conversion factor is as follows ...
    • 1 Kibit = 2^10 b = 1024 bit
    • 1 MiB = 2^20 B = 1 048 576 B
    • 1 GiB = 2^30 B = 1 073 741 824 B

    Metric numbers: The units are represented as the first letter. So ...

    • kilo = k
    • mega = m
    • giga = g, and so on
    The conversion factor is as follows ...
    • 1 kbit = 10^3 bit = 1,000 bit
    • 1 MB = 10^6 B = 1,000,000 B
    • 1 GB = 10^9 B = 1,000,000,000 B

    References NIST International System of Units page Here is a handy bit calculator Wikipedia byte page Technorati Tags: , , , , ,

    Sunday, October 7, 2007

    Cookieless session based ASP.Net applications

    Cookies are used for session management and forms authentication. If a user has his cookies disabled, there are two options: - Ignore such users <bad bad> - Use cookieless session instead

    How to: - No code change required, simply change the web.config file (required) <sessionState cookieless="true" /> - Refactor code to avoid storing valuable information (recommended) - Reduce the lifetime of a session to less than the default 20 minutes (recommended) - Use relative links in pages (recommended). To use absolute URLs, use ApplyAppPathModifier method on the HttpResponse class: <a runat="server" href=<% =Response.ApplyAppPathModifier("/test/page.aspx")%> >Click</a>

    Internals: - Cookieless sessions embed the session ID in the URL and store session information on the server ... http://yourserver/folder/(session ID here)/default.aspx - Two runtime modules are used: SessionStateModule and aspnet_filter.dll. - The <sessionState> node in web.config can also be used to configure other aspects of the session state management, including the storage medium and the connection strings.

    Pros: - Session management works in cookieless environment - Forms authentication works in cookieless environment [ASP.Net 2.0 only] - Cookieless environment avoids risks associated with cookie theft

    Cons: - Exposes app to session hijacking - Opening a new browser window result in a new session and thus the old session information is lost. - Web app pages can't embed absolute, fully qualified links. Such links will result in new session. Must always use relative links.

    References: http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/html/cookieless.asp http://www.microsoft.com/technet/technetmag/issues/2005/01/SessionHijacking/default.aspx http://msdn.microsoft.com/msdnmag/issues/04/08/WickedCode/default.aspx

    2 Useful Visual Studio .Net Windows Application Templates

    Here are two templates I use to as the starting point for all my Windows Application ...

    SDI Application Template

    Single-Document Interface

    Download template (15k, .zip)

    MDI Application Template

    Multi-Document Interface

    Download template (19k .zip)