Tuesday, August 17, 2010

Script to add current folder to path variable

Adding directories to path variable is huge pain, just navigate to the directory you want to add to path variable and run this script

setx -m PATH "%PATH%;%CD%"
set PATH="%PATH%;%CD%"

You might want to save the above code snippet to a file and name it something like addtopath.bat

Once you have created the above file, obviosuly you should add its directory to path variable too maybe using the same script to save a few seconds

Wednesday, July 14, 2010

Installing multiple versions of flash in different firefox profile

I use the same laptop for flex development at office and general browsing at home. Flex developement required me to use Flash Debug version which was extremely irritating to use for general browsing because of Flash error popups on most flash sites.
Solution - Install different flash player for two different firefox profiles and make sure that Flex Builder uses the development profile.
Here's step by step how to do it
  1. Launch firefox profilemanger using
    [Path to firefox]\firefox.exe -profilemanager -no-remote
  2. Create a new Profile suppose home
  3. Now install first flash version(Retail 10.1 suppose) normally by downloading the installer from adobe site. Note that this won't be your default flash version, you install the one you want to be default second.
  4. Now copy the files NPSWF32.dll and flashplayer.xpt from %SYSTEMROOT%\SysWOW64\Macromed\Flash folder to plugins folder inside your newly created Firefox profile. If plugins folder doesn't exist create one. Note that the profile folder would be default created at %APPDATA%\Mozilla\Firefox\Profiles\bla-bla-[new profile name] folder e.g.
  5. Next install the default flash version normally(Debug 10.1 suppose)

    After this you should have two firefox profiles one using retail 10.1 Flash and other debug 10.1 flash, but you still need some way to launch two instances of firefox using different profiles
  6. For this we create a shortcut to firefox with following parameters
    -P home -no-remote where home is the new Profile you created in step 2
Now i just use this new shortcup for general browsing and configured flash builder to use default firefox profile for debugging.

Hope it helps

Thursday, May 20, 2010

Indian income tax calculator financial year 2010-2011

Download the document in xlsx format from http://www.scribd.com/doc/31709305/Indian-Income-Tax-Calculator-2010-2011

I donot take any responsiblity for errors in the document above, use at your own risk

Wednesday, May 5, 2010

Flash asynchronous alert and pause application problems solved

Single threaded architecture of flex poses a rather irritating problem with Alert dialog box poses, especially when the next step involves a confirmation from the user. I have written a SynchronousAlert class in actionscript 3.0 that basically relies on ExternalInterface to make the alert through javascript, this way the app is suspended till the external function call return. Plz note that i have used javascript alert just for demonstration here, If you need something fancier the code can easily be modified to actually make another dummy flash app to do the alert or a custom html popup alert can be shown.

Similarly to pause the application one coould just use the javascript's settimeout function rather than inside the flash
Find below the code for the synchronousAlert wrapper class

package components
import flash.display.Sprite;
import flash.external.ExternalInterface;
import flash.utils.setTimeout;

import mx.controls.Alert;
import mx.core.FlexGlobals;
import mx.core.IFlexModuleFactory;
import mx.events.CloseEvent;

public class SynchronousAlert
private var semapore:Boolean=false;
private var s:String=null;
public function SynchronousAlert()

public function show(text:String = "",
yesno:Boolean= false):uint
if(yesno) callConfirm(text);
else callAlert(text);

if(s==null) return Alert.OK;
if(s=="true") return Alert.YES;
else return Alert.NO;

public function callAlert(text:String):void {
var s:String;
if (ExternalInterface.available) {
var wrapperFunction:String = "alert";
s = ExternalInterface.call(wrapperFunction, text );
} else {
s = "Wrapper not available";

public function callConfirm(text:String):void {
if (ExternalInterface.available) {
var wrapperFunction:String = "confirm";
s = ExternalInterface.call(wrapperFunction, text);
} else {
s = null;


A example use of the above class could be

if((new SynchronousAlert).show("Are you sure you want to reset the scores",true)==Alert.YES) return true; else return false;

Feel free to use the above code with or without any credits

Friday, June 12, 2009

Formatting messages to look like twitter messages in php

Basically suppose you have twitter message in plain text form and you may want to display it on a webpage with all @names pointing to twitter profiles and links to apporpriate pages

just use the following php function

function formatTweet($tweet)
//select hyperlinks
$text = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]",
"\\0", $tweet);
$text = ereg_replace("@([a-zA-Z0-9_]+)","@\\1",$text);
return $text;

Tuesday, March 17, 2009

working sigmatel audio on windows 7

Unlucky me, despite hearing every where that windows 7 supports all hardware, my sigmatel sound card on intel 945 got stuck,I got all devices as disconnected except for my digital output which was actually disconnected. No worries i installed vista drivers and off it worked, until i upgraded to build 7057. Now the vista driver setup won't work saying windows 7 as incompatible, manually installing drivers didn't work. After searching on millions of sites finally i found these drivers

finally i have a working audio. hope the post helps you too
these work too

Wednesday, December 3, 2008

What is cube inc

Cube Inc is a startup by students of BITS-Pilani. The company has a wide focus varying in relation to software development from website devlopment to AI solutions. Long term projects include Cube Inc ERP solution for relatively smaller organisations. Cuniversity project a metasearch engine for open course ware sites.Another ambitious project is the cobot, which aims to build a full fledged house hold robot. Find our more about cube inc at its official site cubeinc.org