Wednesday, May 12, 2010

Where is Chetan?

For the new visitors to this page, a possible problem is the date of the last post before this one. I attribute that solely to a botched up restore of my posts from my local CMS/note taker to blogger(here) and then to my other wordpress blog hosted at chetanonstuff.com. I will try and sort this out as soon as possible but need to keep my fingers crossed till then. In the meantime I am available in your service via the usual means.

Tuesday, October 7, 2008

How to Install SyntaxHighlighter?

I always wanted to post code snippets on my blog here on Blogger and was searching for a way to do so. Today I just happened to knock on Google's door with the right query string and here I am ready to do it (Check my previous post if you want to see a sample)

Here are the exact steps I followed:

  1. I downloaded the SyntaxHighlighter rar from the project's google code page.
  2. Uploaded the rar to my hosting@bluehost to link the javascript etc. required for the library to function, unzipped it and mapped the URLs paths to here.
  3. Followed the very simple tutorial here. Thanks to the author for the wonderful and easy to follow tutorial.
And now I can post as much code I want. I plan to dissect the library as soon as I can get some free time but in case you are facing any problems with the installation/usage, we can work together to fix that. Although, I am stuck with the problem of slow load but I guess I know a way around it. More on this later.

Checking SyntaxHighlighter

Checking SyntaxHighlighter


public class CheckNulls {

//~ Methods -------------------------------------------

public static void main(String[] args) {
String s = null;
String t = null;
System.out.println(s == t);

try {
System.out.println(s.equals(t));
} catch (Exception e) {
// TODO: handle exception
}
}
}

Friday, October 3, 2008

Where is Chetan?

As always I was MIA again from the blogosphere but this time I was doing something good (I guess!). I bought a couple of domains for use and that explain the URL on your browser. I am still setting up my other domain ChetanOnStuff for use. I have setup Google Apps for my main domain. Also I have started another blog here on blogger called ChetanOnChess and I plan to work on these more. I am working to improve up my computing rig at home.

Hope I can stay on top of my game this time.

Thursday, July 31, 2008

Cannot delete foldername: The file name you specified is not valid or too long. Specify a different file name.

I was working on of my projects @office and wanted to delete a directory deep in the source tree. I use NTFS partitions(yes I am stuck with Windows XP) and I encountered this funny error:

Cannot delete 'a_huge_pathname/': The file name you specified is not valid or too long. Specify a different file name.

I looked at this and was surprised since I had never heard about this funny business before. The problem was with the path to the file being longer than 255 characters. Anyways had to get going so tried some of the tricks I could of think of then, including couple of lines in Ruby but just could not get through[:(].

Finally I landed here and the revelation was made. I only had to rename a couple of dirs to single char names and Voila! the directory was gone. Hurray! back to business.

Thursday, June 19, 2008

Flash Player 9 Goes Bonkers post update!!

Some days are just what you don't want them to be. I am working on a project involving integration of an existing Java application running in jboss app-server with Adobe Flex/AIR. I fired up my browser to run a swf that used to work about a couple of days back and got this:

Warning: Domain localhost does not specify a meta-policy. Applying default meta-policy 'all'. This configuration is deprecated. See http://www.adobe.com/go/strict_policy_files to fix this problem.

Googling gave me this link which is a huge doc by an Adobe engineer as the post says but somehow I managed to scrap through to change my crossdoamin.xml from

<cross-domain-policy>
<site-control policies="all">
<allow-access-from domain="localhost" ports="*">
<allow-access-from domain="127.0.0.1" ports="*">
</allow-access-from>
</allow-access-from></site-control></cross-domain-policy>

to

<cross-domain-policy xsi="http://www.w3.org/2001/XMLSchema-instance" nonamespaceschemalocation="http://www.adobe.com/xml/schemas/PolicyFile.xsd">
<allow-access-from domain="*">
<site-control policies="master-only">
</site-control>
</allow-access-from></cross-domain-policy>

and get the swf working again. The new crossdomain.xml has short circuited all the efforts Adobe guys put in to make this but I just had to get this going:(. I don't know why Adobe had to do this or strangely do this so quietly, may be I was too sleepy to get a whiff of it before it actually hit me.

God why do some days are just what you don't want them to be?
Thanks to these guys for encoding the HTML for the XML code aboove.
Update:
The logs posted above were available in my policyfiles.txt (located @ C:\Documents and Settings\chetan.arya\Application Data\Macromedia\Flash Player\Logs) file created after I modified my mm.cfg (located @ C:\Documents and Settings\chetan.arya) to read:
ErrorReportingEnable=1
TraceOutputFileEnable=1
MaxWarnings=0
TraceOutputFileName=C:\Documents and Settings\chetan.arya\Application Data\Macromedia\Flash Player\Logs\flashlog.txt
PolicyFileLog=1
PolicyFileLogAppend=1

Monday, June 9, 2008

http://runonce.msn.com/runonce2.aspx + IE7 problem

Recently one of my friends came up with this problem. I googled around and found this cool registry hack that worked in one shot:

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main]
"RunOnceComplete"=dword:00000001
"RunOnceHasShown"=dword:00000001

copy the content in red in a file say :Change_the_default_home_page.reg and double click. You are done.
The source for this post is: here

Tuesday, June 3, 2008

SQL Interview Question

Someone in my current organization is leaving us and is appearing for interviews. One of the questions that came up for him was as follows:
Given a table say named TEAMS having Integer id and String Name as its only two columns. Assume that this has list of teams in the IPL, the problem is to list all possible matches between the teams in this list and catch being that match between team A and team B is same as match between team B and team A.

After wracking for 10 minutes I came up with this which apparently is the correct solution.

Assuming the table has the following description( MySQL syntax):

CREATE TABLE `teams` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(45) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


the solution is:

select a.name, b.name from teams a, teams b where a.id < b.id


and this one works because the ID here is a type that can give a boolean result for the "<" test, Had it been one of those exotic UID/HEXID types, things would have been messy. Although my first response was: select a.name, b.name from teams a, teams b where a.name != b.name and a.id but a minute of introspection shows that the "!=" test is a waste.

Obviously better solutions are welcome.

Thursday, May 15, 2008

LinkedIn Profile

I am well and alive. The absence is attributable to the laziness that hounds a software engineer (:sigh). I am now an active member of LinkedIn.
My public profile is available at : www.linkedin.com/in/ChetanArya. Hope to see you there.

Thursday, December 6, 2007

Configure kismet on fiesty ubuntu

I wanted to run kismet for some of my free time "meddlings". Here is what I did:
1. sudo apt-get install kismet
2. su - (got local root - you can easily screw your system so mind now what you type:D)
3. cp /etc/kismet/kismet.conf /home/chetan/confs_backup
4. nano /etc/kismet/kismet.conf
a.) uncomment and change suiduser=chetan [username with which you login]
b.) uncomment and change :source=ipw3945,eth1,intelpro. I used these values because I have the intel pro 3945 card as this command shows

root@machine3:/home/chetan# lspci | grep -i network
02:00.0 Network controller: Intel Corporation PRO/Wireless 3945ABG Network Connection (rev 02)
5. ctrl+d(log off root)
6. sudo kismet&

and you are good to go.

Happy "kismetting" :D

Labels