<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Naren</title>
	<atom:link href="http://blog.narent.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://blog.narent.com</link>
	<description>Least Generic to Most Specific</description>
	<lastBuildDate>Mon, 10 Aug 2009 06:17:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Viewing page source after JS/AJAX changes</title>
		<link>http://blog.narent.com/?p=36</link>
		<comments>http://blog.narent.com/?p=36#comments</comments>
		<pubDate>Mon, 10 Aug 2009 06:17:23 +0000</pubDate>
		<dc:creator>narendra.tumkur</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://blog.narent.com/?p=36</guid>
		<description><![CDATA[Ever needed to look at the source of a web page after it has been modified via JS/AJAX? In most browsers, viewing source on the page will show you the HTML as it was downloaded from the server before any changes were made &#8220;scriptually&#8221; . To view the source of the page as it is [...]]]></description>
			<content:encoded><![CDATA[<p>Ever needed to look at the source of a web page after it has been modified via JS/AJAX? In most browsers, viewing source on the page will show you the HTML as it was downloaded from the server before any changes were made &#8220;scriptually&#8221; . To view the source of the page as it is being currently displayed do the following:<span id="more-36"></span><br />
When you want to view the source type<br />
<code><br />
javascript:'&lt;xmp&gt;'+window.document.body.parentNode.innerHTML+'&lt;/xmp&gt;'<br />
</code><br />
into the address bar and hit enter. For ease of use, you can add a bookmark to the above address.</p>
<p>This works in both IE and FF.</p>
<p>Cheers <img src='http://blog.narent.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.narent.com/?feed=rss2&amp;p=36</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Starting XNA Game Development</title>
		<link>http://blog.narent.com/?p=34</link>
		<comments>http://blog.narent.com/?p=34#comments</comments>
		<pubDate>Mon, 27 Jul 2009 07:17:32 +0000</pubDate>
		<dc:creator>narendra.tumkur</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[XBOX]]></category>

		<guid isPermaLink="false">http://blog.narent.com/?p=34</guid>
		<description><![CDATA[I&#8217;ve had a Wii for a while now have amassed quite a few games. My favourite title by fae would have to be Mario Galaxy. But lately I have been finding myself craving games that aren&#8217;t so &#8220;cutesy&#8221;. So, I decided to get myself an XBOX 360&#8230; and I am quite pleased with the quality [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had a Wii for a while now have amassed quite a few games. My favourite title by fae would have to be Mario Galaxy. But lately I have been finding myself craving games that aren&#8217;t so &#8220;cutesy&#8221;. <span id="more-34"></span>So, I decided to get myself an XBOX 360&#8230; and I am quite pleased with the quality of games available.</p>
<p>Halo 3 is as good an FPS as I&#8217;ve played (although the controls take a little while to get used to) and Lips is a fantastic clone of Sing Star (from PS2/3).</p>
<p>But something I had not counted on when I got the XBOX was how easy it is to write games for it. All I needed to do was download the XNA Game Studio addon to Visual Studio and voila! I had an instant game development platform.</p>
<p>I have quite a few ideas, so watch this space!!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.narent.com/?feed=rss2&amp;p=34</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing New Fonts for X11 on Mac OS X</title>
		<link>http://blog.narent.com/?p=27</link>
		<comments>http://blog.narent.com/?p=27#comments</comments>
		<pubDate>Mon, 01 Jun 2009 03:53:19 +0000</pubDate>
		<dc:creator>narendra.tumkur</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.narent.com/?p=27</guid>
		<description><![CDATA[Simply copy the ttf file to the .fonts directory in your home directory. If there is no .fonts directory, create one.
cd ~
mkdir .fonts
cp mynewfont.ttf ~/.fonts
]]></description>
			<content:encoded><![CDATA[<p>Simply copy the ttf file to the .fonts directory in your home directory. If there is no .fonts directory, create one.</p>
<p><span style="font-family: Consolas;">cd ~<br />
mkdir .fonts<br />
cp mynewfont.ttf ~/.fonts</span></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.narent.com/?feed=rss2&amp;p=27</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running NSTimer on Separate Thread</title>
		<link>http://blog.narent.com/?p=21</link>
		<comments>http://blog.narent.com/?p=21#comments</comments>
		<pubDate>Thu, 28 May 2009 22:41:19 +0000</pubDate>
		<dc:creator>narendra.tumkur</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[NSRunLoop]]></category>
		<category><![CDATA[NSThread]]></category>
		<category><![CDATA[NSTimer]]></category>
		<category><![CDATA[Objective-c]]></category>

		<guid isPermaLink="false">http://blog.narent.com/?p=21</guid>
		<description><![CDATA[I&#8217;ve been working in something requiring an NTimer to fire every second. The documentation says that an NSTimer needs to be attached to a NSRunLoop to fire. So I started off with the following:
NSTimer* timer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(timerTick:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSEventTrackingRunLoopMode];
So, what I am doing here is creating a new NSTimer [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working in something requiring an NTimer to fire every second. The documentation says that an NSTimer needs to be attached to a NSRunLoop to fire. So I started off with the following:</p>
<p><code>NSTimer* timer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(timerTick:) userInfo:nil repeats:YES];<br />
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSEventTrackingRunLoopMode];</code></p>
<p>So, what I am doing here is creating a new NSTimer which fires in 1 second intervals and sends the timerTick message to self every time it fires. On the 2nd line, I am attaching the NSTimer object to the current runloop. This all worked fine. Until&#8230;!</p>
<p><span id="more-21"></span></p>
<p>It turns out in UI applications, the NSRunLoop is responsible for getting input from all the input devices/timers that are attached to it. The timer would fire and the tickerTick message got sent as expected until the runloop got busy doing something else. For example if I pressed a button on the UI and kept it pressed, the runloop was busy reading the mouse down input and the timer ticks would get ignored completely.</p>
<p>So, the solution was to run the NSTimer in a separate thread so it can have a NSRunLoop dedicated to responding to it and nothing else.</p>
<p>Here is the code:</p>
<p><code>-(void) startTimer<br />
{<br />
NSThread* timerThread = [[NSThread alloc] initWithTarget:self selector:@selector(startTimerThread) object:nil]; //Create a new thread<br />
[timerThread start]; //start the thread<br />
}</code></p>
<p><code>//the thread starts by sending this message<br />
-(void) startTimerThread<br />
{<br />
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];<br />
NSRunLoop* runLoop = [NSRunLoop currentRunLoop];<br />
[[NSTimer scheduledTimerWithTimeInterval: 1.0<br />
target: self<br />
selector: @selector(timerTick:)<br />
userInfo: nil<br />
repeats: YES] retain];</code></p>
<p><code>[runLoop run];<br />
[pool release];<br />
}<br />
</code></p>
<p><code>- (void)timerTick:(NSTimer *)timer<br />
{<br />
NSLog(@"Tick!");<br />
}</code></p>
<p>The NSRunLoop for the new thread needs to be explicitly set to run. If this is not done, the thread will start the timer, and then duly exit the function (and therefore the thread) and no ticks will be received. Also, the NSAutoreleasePool object needs to be created to manage the objects that are created in the new thread.</p>
<p>Cheers <img src='http://blog.narent.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.narent.com/?feed=rss2&amp;p=21</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Coup d’état</title>
		<link>http://blog.narent.com/?p=10</link>
		<comments>http://blog.narent.com/?p=10#comments</comments>
		<pubDate>Thu, 13 Mar 2008 12:03:44 +0000</pubDate>
		<dc:creator>Naren</dc:creator>
				<category><![CDATA[Words and Terms]]></category>

		<guid isPermaLink="false">http://narent.wordpress.com/?p=10</guid>
		<description><![CDATA[Overthrow of the ruling party by a part of the ruling establishment.
A recent event illustrating this is the overthrow of the democratically elected government of Pakistan by the military in 1999.
]]></description>
			<content:encoded><![CDATA[<p>Overthrow of the ruling party by a part of the ruling establishment.</p>
<p>A recent event illustrating this is the overthrow of the democratically elected government of Pakistan by the military in 1999.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.narent.com/?feed=rss2&amp;p=10</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Essentials</title>
		<link>http://blog.narent.com/?p=9</link>
		<comments>http://blog.narent.com/?p=9#comments</comments>
		<pubDate>Sun, 09 Mar 2008 10:00:00 +0000</pubDate>
		<dc:creator>Naren</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Refresher]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://narent.wordpress.com/?p=9</guid>
		<description><![CDATA[Looking into creating my own ASP.Net Control Extenders (like in the Ajax Control Toolkit), I found myself having to brush up on my Javascript. So here is a quick revision of what I (and maybe you too) need to remember.
Function declaration:

function SayHelloTo(nameStr) {

document.write('Hello ' + nameStr);

}
Function with return statement:

function add(x, y) {

return x + y;

}
Variable [...]]]></description>
			<content:encoded><![CDATA[<p>Looking into creating my own ASP.Net Control Extenders (like in the <a href="http://www.asp.net/ajax/ajaxcontroltoolkit/samples/">Ajax Control Toolkit</a>), I found myself having to brush up on my Javascript. So here is a quick revision of what I (and maybe you too) need to remember.</p>
<p><b>Function declaration:</b></p>
<pre>
function SayHelloTo(nameStr) {

document.write('Hello ' + nameStr);

}</pre>
<p><b>Function with return statement:</b></p>
<pre>
function add(x, y) {

return x + y;</pre>
<p><span id="more-9"></span></p>
<pre>}</pre>
<p><b>Variable declaration within a function:</b></p>
<pre>
function add(x, y) {

var z = x+y;

return z;

}</pre>
<p><b>Classes in Javascript:</b></p>
<pre>
function car(makeStr, modelStr, colourStr) {

this.make = makeStr;

this.model = modelStr;

this.colour = colourStr;

}</pre>
<p>Note how the declaration of a class is exactly the same as declaring a function with the salient keyword being <b>this</b> in the declaration of the variables within the function.</p>
<p><b>To create an instance of an object:</b></p>
<pre>
car1 = new car('Toyota', 'Camry', 'Red');</pre>
<p><b>To access a property within the object:</b></p>
<pre>
car1.make = 'Ford';</pre>
<p><b>Class methods:</b></p>
<pre>
function drive()

{

with (this) document.write(make+' is going for a drive');

}</pre>
<p>Once again, note the <b>this</b> keyword.</p>
<p>Declaring class methods as above is however expensive on memory as each car object has a corresponding drive object.</p>
<p><b>Functions and constants can instead be declared in what is called the prototype for a class:</b></p>
<pre>
car.prototype.drive = drive;</pre>
<p><b>Constants may also be defined in the prototype:</b></p>
<pre>
car.prototype.topSpeed = 100;</pre>
<p><b>A class prototype can also be declared all at once with the function bodies:</b></p>
<pre>
car.prototype =

{

drive : function()

{

document.write(this.make+' is going for a drive');

},stop : function()

{

document.write(this.make+' is stopping');

}

}</pre>
<p>Happy Javascripting <img src='http://blog.narent.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.narent.com/?feed=rss2&amp;p=9</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Forms Fade in and Fade out Extension Methods</title>
		<link>http://blog.narent.com/?p=8</link>
		<comments>http://blog.narent.com/?p=8#comments</comments>
		<pubDate>Fri, 07 Mar 2008 03:36:30 +0000</pubDate>
		<dc:creator>Naren</dc:creator>
				<category><![CDATA[Desktop Applications]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[C# 3.0]]></category>
		<category><![CDATA[Effect]]></category>
		<category><![CDATA[Extension Method]]></category>
		<category><![CDATA[Fade]]></category>
		<category><![CDATA[Fade in]]></category>
		<category><![CDATA[Fade out]]></category>
		<category><![CDATA[Fading]]></category>
		<category><![CDATA[Forms]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[System.Windows.Forms]]></category>
		<category><![CDATA[Timer]]></category>
		<category><![CDATA[UI]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Windows Forms]]></category>
		<category><![CDATA[Winforms]]></category>

		<guid isPermaLink="false">http://narent.wordpress.com/?p=4</guid>
		<description><![CDATA[Following is some code I had to write the other day to fade a Windows Forms Form in and out of view. I have implemented the methods FadeIn and FadeOut as extension methods on the System.Windows.Forms.Form class. To use this, simply import the namespace that you copy the class FormExtensions into into the code file [...]]]></description>
			<content:encoded><![CDATA[<p>Following is some code I had to write the other day to fade a Windows Forms Form in and out of view. I have implemented the methods FadeIn and FadeOut as extension methods on the System.Windows.Forms.Form class. To use this, simply import the namespace that you copy the class FormExtensions into into the code file of your form. And then call the methods FadeIn and FadeOut as required. Happy Fading <img src='http://blog.narent.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<pre>
using System.Windows.Forms;

///
/// Contains methods to extend System.Windows.Forms.Form to have the ability to fade in and fade out
///
public static class FormExtensions
{
    ///
    /// Fade the form in
    ///
    ///
    public static void FadeIn(this Form form, int seconds)
    {</pre>
<p><span id="more-8"></span></p>
<pre>Fader fader = new Fader(form, seconds);
        fader.FadeIn();
    }

    ///
    /// Fade the form out
    ///
    ///
    public static void FadeOut(this Form form)
    {
        Fader fader = new Fader(form);
        fader.FadeOut();
    }
}

public class Fader
{
    public Fader(Form targetForm)
    {
        TargetForm = targetForm;
        FadeTimer = new Timer();
        FadeTimer.Interval = 40;
        FadeTimer.Tick += new EventHandler(FaderTimer_Tick);
        OpacityDelta = .05;
    }

    public Fader(Form targetForm, int seconds) : this(targetForm)
    {
        const int frameRate = 20;
        OpacityDelta = 1.0 / (frameRate * seconds);
        FadeTimer.Interval = 1000/frameRate;
    }

    void FaderTimer_Tick(object sender, EventArgs e)
    {
        TargetForm.Opacity += OpacityDelta;
        if ((OpacityDelta &gt; 0 &amp;&amp; TargetForm.Opacity &gt;= 1))
        {
            FadeTimer.Enabled = false;
        }
        else if (OpacityDelta &lt; 0 &amp;&amp; TargetForm.Opacity &lt;= 0)
        {
            FadeTimer.Enabled = false;
        }
    }

    public void FadeIn()
    {
        TargetForm.Opacity = 0;
        OpacityDelta= Math.Abs(OpacityDelta);
        FadeTimer.Enabled = true;
    }

    public void FadeOut()
    {
        OpacityDelta = -1.0*Math.Abs(OpacityDelta);
        FadeTimer.Enabled = true;
    }

    private Form TargetForm { get; set; }
    private Timer FadeTimer { get; set; }
    private Double OpacityDelta { get; set; }
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.narent.com/?feed=rss2&amp;p=8</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
