Naren

June 1, 2009

Installing New Fonts for X11 on Mac OS X

Filed under: Uncategorized — narendra.tumkur @ 3:53 am

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

May 28, 2009

Running NSTimer on Separate Thread

Filed under: Apple, Cocoa, Technology — Tags: , , , , , — narendra.tumkur @ 10:41 pm

I’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 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…!

(more…)

March 13, 2008

Coup d’état

Filed under: Words and Terms — Naren @ 12:03 pm

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.

March 9, 2008

Javascript Essentials

Filed under: ASP.Net, Javascript, Technology, Web Applications — Tags: , , , — Naren @ 10:00 am

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;

(more…)

March 7, 2008

Windows Forms Fade in and Fade out Extension Methods

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 :)

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)
    {

(more…)

Powered by WordPress