Hello!

This content has been updated. You will be momentarily redirected to the current version.

Moved!



Moved! I now blog at http://www.saicharan.in



Wednesday, March 18, 2009

CVS, ViewVC integration with Google Prettify

Been wanting to do this for long: browse SVN/CVS via a web interface. Ofcourse, it is a solved problem. But I wanted this set up for my own local CVS repos.

ViewVC to the rescue.

Prerequisites: Python2.x, Apache2.0+, CVS, CVS/SVN Python Bindings.

Detailed installation process:
1. ViewVC:
I have CVSNT on my workstation. So I downloaded ViewVC-1.0.7 from http://www.viewvc.org/download.html (spcecifically, version 1.0.7 from http://viewvc.tigris.org/servlets/ProjectDocumentList?folderID=6004).

To install ViewVC, first unpack it to some folder, run 'python viewvc-install' from the command line, with the current directory as the unpacked directory. I chose all the defaults values when prompted.

Next, I configured viewvc to pick up my repositories by editing the /viewvc.conf file. I changed the cvs_roots and cvsnt_exe_path variables.

2. SVN Python bindings for ViewVC:
ViewVC is written in python and tigris.org provides python bindings to talk to the CVS/SVN repository. This can be got from subversion.tigris.org Documents Area. Be sure to download the version appropirate for your version of python. Simply run the installer. You will be asked to point the installer to the Apache installation directory.

3. mod_python:
You will need to download the mod_python for Apache if you dont have it already. You can check the /modules/ directory. Look for mod_python.so file. If it is not here, download it from here: http://www.apache.org/dist/httpd/modpython/win/3.3.1/ I used this: http://www.apache.org/dist/httpd/modpython/win/3.3.1/mod_python-3.3.1.win32-py2.5-Apache2.2.exe

4. Configuring Apache.
Edit the httpd.conf file to add the following:
a) LoadModule python_module modules/mod_python.so
b) ScriptAlias /viewcvs "C:/Program Files/viewvc-1.0.7/bin/mod_python/viewvc.py"

<location>
AddHandler python-program .py
PythonPath "[r'c:\\Program Files\\viewvc-1.0.7\\bin\\mod_python']+sys.path"
PythonHandler apache
PythonDebug On
AddDefaultCharset UTF-8
</location>

NOTE: The above will work if you have chosen the defaults while installing ViewVC.

Done! Goto: http://your-machine/viewcvs.

However, I got an error when I did this: "ImportError: No module named apache"

So, I tried the alternate approach:
A) Copy <viewvc-install-dir>/bin/cgi/*.cgi to <apache-install-dir>/cgi-bin/
B) Add the following line to the <apache-install-dir>/conf/httpd.conf file:
ScriptAlias /viewvc /cgi-bin/viewvc.cgi
C) Restart Apache.

Done! Go to: http://localhost/cgi-bin/viewvc.cgi
It works for me!! I wish I could fix the other method too.

Good. Now that it works, I should be happy. But I was not :( When I 'view' a source file, it does not do the syntax highlighting (I use CVS with C++/C projects and I was not getting the syntax highlighting for these languages). So what do I do? Wanted to integrate some open source syntax highlighters. I dug thru' the code of viewvc.py and from there went on to find the place where the markup is done. (search the code base for view_markup function. I use RedHat sourcenavigator to browse and read code). They seemed to be using some PHP code to get the job done. However, I remembered I was very happy with Google's Prettify (any code you browse on code.google.com has probably used Google prettify to syntax highlight the code). So I decided to use it.

Also, using the Google Pettify is quite simple:
A) Add the following lines to the "head" section:

<link href="[docroot]/prettify/prettify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="[docroot]/prettify/prettify.js" > < /script >

B) Add "onload=prettyPrint()" attribute to the "body" tag.
C) Put your code in <pre class="prettyprint"> or <code class="prettyprint" >tags.
D) Done!

It took quite some reading of the ViewVC python code to figure out simple ways to do it. Here is my story:
I read thru the ViewVC python code and found that there was a header and footer being used for each page. Then there was a template for markup and each of the different views that ViweVC supports. Then I stumbled upon the EZT class (EaZyTemplates). Just what I needed to integrate with Google Prettify!! So I found the templates being loaded by ViewVC. They are loacated under <viewvc-install-dir>/templates/. Here are my modifications:
1. Download Google Prettify from: http://code.google.com/p/google-code-prettify/
2. Unzip it. Copy the src folder to <viewvc-install-dir>/templates/docroot/
3. I renamed the src folder to prettify (just to help me later)
4. Add the following lines to <viewvc-install-dir>/templates/include/header.ezt, in the "head" section:

<link href="[docroot]/prettify/prettify.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="%5Bdocroot%5D/prettify/prettify.js"></script>

also, modify the body tag to: <body onload="prettyPrint()">
5. Modify <viewvc-install-dir>/templates/markup.ezt:
Change this: <div id="vc_markup"><pre&t;[markup]</pre></div>
to: <div id="vc_markup"><pre class="prettyprint">[markup]</pre></div>

Done!.

Have fun! And post your questions as comments.

Sunday, March 01, 2009

Google default language

Each time I use Google from office, Google responds in Thai. I fixed that by going to www.google.com/ncr.

Now onwards, I hope to always get results in English :) Btw, if you happen to clear your cookies, you should go to www.google.com/ncr again.

NS2 nam error

I have been bothered by this error while running ns/nam for a long time now. Finally found that tk needed patching :( Here is the error that I got and the solution that helped me fix it.

Error:
[root@localhost]# nam:
[code omitted because of length]
: no event type or button # or keysym
while executing
"bind Listbox {

%W yview scroll [expr {- (%D / 120) * 4}] units

}"

invoked from within

"if {[tk windowingsystem] eq "classic" || [tk windowingsystem] eq "aqua"} {
bind Listbox {
%W yview scroll [expr {- (%D)}] units

}

bind Li..."


And, I got the solution to this on: http://forums.fedoraforum.org/showthread.php?t=206795.
Essentially you need to patch tk8.4.18 with the patches from: http://bugs.gentoo.org/show_bug.cgi?id=225999

Details of how to patch are available at: http://forums.fedoraforum.org/showpost.php?s=a2bb89875669ff26ed61cd371399a517&p=1131049&postcount=3

Monday, February 16, 2009

My Reading List

Very frequently my friends ask for my reading list. So I decided to follow the DRY and SRP principles to help them and help myself. Hence this blog entry. Here goes:

My favourite tech blogs/sites:

Programming blogs:
1. codinghorror.com
2. blog.objectmentor.com (this along with its original site at butunclebob.com)
3. thedailywtf.com
4. c2.com --> Advanced stuff. Really interesting though. It takes some time to follow their style of expression - but is definitely worth a shot.
5. Reddit.com In particular, http://www.reddit.com/r/programming/ & http://www.reddit.com/r/technology/

Programming + Technology + Perspectives (my favourite pass-times):
1. steve-yegge.blogspot.com
2. paulgraham.com
3. joelonsoftware.com
4. norvig.com
5. googleblog.blogspot.com
6. TED.com - My personal favorite for advances in human thought and creativity!

Tech News:
1. digg.com
2. slashdot.org

Management: ( Yeah, I am interested in Genuine management! )
1. sethgodin.typepad.com


PS: I will update this post as my reading list changes (Yes. that includes additions and deletions as well. For deletions, I will keep the links, but the text will be struck off like this).

Wednesday, September 17, 2008

Creating DLLs with MinGW

This morning, I was asked how to use existing C code in C++ code. So I took the route of converting the C code into a DLL and then linking to it from the C++ code. So I had to figure out how to do this using MinGW on Windows. Here is an account of my experiments (distilled ofcourse!):
There are three things you need to do:
1. Convert the existing into a DLL.
2. Include the header of the DLL in the sources where you wish to use the library.
3. Build your code, linking against your DLL.

Here are the steps:
a) For this, you need to add the following code to the header file containing the declarations of the functions that are to be used:

#ifdef __cplusplus
#define cppfudge "C"
#else
#define cppfudge
#endif

#ifdef BUILD_DLL
// the dll exports
#define EXPORT __declspec(dllexport)
#else
// the exe imports
#define EXPORT extern cppfudge __declspec(dllimport)
#endif

b) Front of each function that you want to use from the DLL, prepend the word EXPORT. For example:
EXPORT int hello(void);

c) Create the create the object code using the following command:
>gcc -c -DBUILD_DLL TestDLL.c, where TestDLL.c is the source file.

d) Next, use the object code to create the DLL with the following command:
>gcc -shared -o TestDLL.dll TestDLL.o -Wl,--out-implib,TestDLL.a, Note that TestDLL has to be replaced with whatever is the actual DLL name.
>Creating library file: TestDLL.a (This is the output of the command)

e) Now, compile the actual file (note that this file should include the TestDLL.h header)
>gcc Main.cpp -o Main.exe TestDLL.dll

f) Done! Run the executable:
>Main.exe
Hello World!

>

Here are the files that I have used to test these things. I have tested them on Windows XP using MinGW32. I have used the following link for reference: http://www.emmestech.com/moron_guides/moron2.html

Tuesday, July 29, 2008

Global C++ Exception Handler

Just found out that many C++ compilers provide the std::set_terminate() function for catching any unanticipated exceptions. Read here for more: http://www.extinguishedscholar.com/wpglob/?p=176

Tuesday, June 10, 2008

C/C++ resources online

The following is a continually updated list of my personal favorites for C/C++ reference:

C:
C-FAQs: http://c-faq.com/index.html
Overflows in C: http://www.fefe.de/intof.html

C++:
Stanford Library: http://cslibrary.stanford.edu
C++ Coding Conventions(CERN): http://pst.web.cern.ch/PST/HandBookWorkBook/Handbook/Programming/CodingStandard/c++standard.pdf
C++ Casting: http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/BitOp/cast.html & http://www.nacs.uci.edu/dcslib/sun/compilers/c-plusplus/c%2B%2B_ug/Cast.new.doc.html

ThinkPad T60 TouchPad Scroll in Office 2007

Found this link on Google. It was reported as on the day of posting as a possibly problematic site. But I went on and found the info in that site very useful. So here is the link:
http://www.lvlolvlo.net/2007/02/11/office-2007-on-a-thinkpad-ultranav-support-for-scrolling-fix/

Wrong Characters being Displayed

Had this problem with my keyboard layout getting changed just too often. The problem was as follows: Off and on, my keyboard was behaving erratically. It would mis-behave and then come back to normal. I suspected a change of keyboard layout - I had this problem earlier on my Linux Box and RI pointed out that my keyboard layout was UK English!

So, I too started off searching google for this, and things were mostly pointing to IME/Languages. When I opened the Regional Language Options in the Control Panel, the language bar popped up. I noticed that the language was set to Finnsh. Once I changed that to English, another icon appeared next to it - the Keyboard icon. It was in Finnish. So I changed it to English and all was well. But then I was wondering how these settings were changing so often. SO I went to the Regional Language Options in the Control Panel. Went to the languages tab and clicked on the Details button. From there, I selected the Finnish Language and Keyboard settings. At the bottom there is a Key Settings button. That was the major culprit. Click that button and you will see that Alt+Shift is assigned to "Switch between input Languages" option. I simply removed that key-binding to avoid un-intended switching between languages.

Also, I use the alt+shift combo often in my work - so that was the probem! Now we know! So change your keyboard settings and get back to efficient mode.

One last advice. If you ever face such a problem, make the language bar visible: Control Panel > Regional Language Options > Details > Language Bar Button > Show Language Bar. Once you see the language bar, you can know at once if your keyboard layout is the problem.

Wednesday, March 26, 2008

VirusRemoval.vbs Windows Script Host

Atlast! Got rid of that damn warning.

msconfig did not show up this thing. No amount of standard registry scans helped me find this. I looked at the standard Run, RunOnce & Shell hives under HKLM/Software/Microsoft/Windows/CurrentVersion/. Just no use. No entries that were tell-tale traces of this VirusRemoval.vbs.

But done at last! Took some patient Google-searching though. Some kind soul had provided the entire code of the VirusRemoval.vbs script file at:
http://www.thinkdigit.com/forum/showthread.php?t=71097. Looking at the code was enough to tell me where the virus had made entries in the registry.


Goto: HKLM/Software/Microsoft/WindowsNT/CurrentVersion/Winlogon. Under that, you will find a key called Userinit. Double click that key. A dialog box will open up with a string parameter. Edit that to remove just the offending entry. Warning: If you are not sure what the offending entry is, DONOT modify the key. Please post back the contents of the key here, and we could work out something!

After cleaning up my registry, the value of Userinit for me is: C:\WINDOWS\system32\userinit.exe

Good Luck!

Tuesday, March 18, 2008

Friday, February 15, 2008

yum ntfs-3g

To install ntfs support for Fedora linux, use the following as root:

yum install fuse fuse-libs ntfs-3g

reference: http://www.mjmwired.net/resources/mjm-fedora-f7.html#ntfs

Tuesday, February 05, 2008

Adobe Reader Commenting Not Allowed

At last!
Wanted to allow my prof. to be able to comment the pdf files that my LaTeX produces. But, even though I was NOT setting any such restrictions in LaTeX, the Adobe Reader always showed that Commenting was not allowed. After a Google search, I got this post in the Adobe Forums: http://www.adobeforums.com/webx/.3c05f5b1

In short: You cannot comment unless explicitly permitted. For this, you need to get to Adobe Acrobat (not the reader), and set the permission from: Commenting > Enable for Commenting in Adobe Reader.

Then you will be allowed to comment or markup :)

Update: If you don't mind a few additions of Foxit, you might want to try Foxit reader(www.foxitsoftware.com) for commenting your PDF documents without any of the above hassle.

Monday, February 04, 2008

WIndows Script Host: Unable to open file

For quite some time a lot of my friends kept getting a windows script host error whenever they tried to open a drive. It says: Windows Script Error: Unable to find file: "....vbs".

Spending some time on google led me to this site:
http://www.mydigitallife.info/2007/04/19/unable-to-open-hard-or-usb-flash-drive-with-windows-script-host-cannot-find-script-file-autorunvbs-error/

All we need to do is to either delete the autorun.inf file there or modify the content in to get rid of the offending startup file info. To delete the file:

del :\autorun.inf /f /s /q /a

To modify the file, first remove its hidden-file attribute: (see http://forums.techarena.in/showthread.php?t=717194)
attrib -s -h -r :\autorun.inf

Go ahead and edit this file now.

Sunday, February 03, 2008

TeXnicCenter and Adobe Reader 8.0

I recently upgraded my Adobe Reader to version 8. The new interface is cool and all that, but I had an issue with using TeXnicCenter. Whenever I view a compiled document from TeXnicCenter, and then closed the Adobe reader or recompiled the file (causing adobe reader to close the document), the Adobe reader was crashing. A Google search yielded the following link which is very useful. It is almost a text-book type of solution which just works!

http://dikkie.net/2007/02/16/texniccenter-and-adobe-reader-80/

Sunday, January 27, 2008

Why is switch case better than if else if?

Why is switch case better than else if? Or is it?
Here is some code I got into trouble with:
.
.
.
if(dim==0){
...//do lots of things
...return;
}
doSomeCommonThingsHere();
if(dim==3)
...doSomething3();
else if(dim==4)
...doSomething4();
else if(dim==5);
...doSomething5();
doSomeMoreCommonSomethings();
.
.
.
See anything?

I did not, initially. The semi colon after else if(dim==5). How I unearthed the bug? GDB was crashing. So no debugger to help me:( I figured out that only the dim==5 case was working well - and that none of the cases above it were working correctly. So I considered moving one of the earlier case code to the end to see if I can figure out the problem. While moving the code I accidentally noticed the semi-colon. Man! Computers are dumb - or was it me dumb?

Now did say switch case might have been better? Maybe. Because we are taught to put the break; statement at the end of each case to prevent it from falling-through right? What if I forgot to put the break; ? I guess it is easier to "find" a missing break than a missing ;. Did you see the semi-colon after missing?

Now why did I use such a large number of if-else-if statements? I was using "Incremental development". I did not see the other cases coming in hordes. Shortsighted you might say, but I did not even intend to do the other cases in the first place. WOW! How easily changing requirements can screw up such wonderfully working code. Screw the changing requirements. Now you see how difficult is the job of a designer - he has to really think of extensibility - see extensibility in a new light?

Consider for a moment the above code. I was actually telling the computer to do things wrong!!! When will these computers learn to understand (:D) Or will they ever?

Friday, September 14, 2007

MinGW GProf with Eclipse 3.3 (Europa )

To use MinGW gprof with Eclipse, in the project settings, under complier, enable the gprof option. Further, in the Linker section, under command line, add -pg to your list. Build the program. Run the program and check that the gmon.out file has been created.

You can run gprof as follows:
gprof.exe .

You can run gprof from within eclipse by configuring the external tools:
1. Open the external tools dialog
2. Double click on program to create a new program configuration
3. Give this profile a name, eg. gprof
4. In the location text box, give the FULL path to the grpof command
5. In the working directory, choose: ${workspace_loc:/path/to/executable}
6. Arguements: ${file_prompt} ${GMON}, where GMON has been assigned the path to the gmon.out file using the variables button.

References:
1.http://publib.boulder.ibm.com/infocenter/systems/topic/com.ibm.aix.cmds/doc/aixcmds2/gprof.htm
2.http://gcc.gnu.org/ml/fortran/2006-11/msg00217.html

Wednesday, April 18, 2007

ब्लोग्गीं, और हिंदी मे!

हेल्लो वर्ल्ड!
गूगल ki गूढ़ विल से हिंदी मे ब्लोग करना बहुत आसान हैं। इस फेतुरे के लिए शुक्रिया!!! लव यू गूगल! कीप उप थे गूढ़ वर्क!

Please excuse my rustic hindi...I was just experimenting :) If you are unable to read the Hindi correctly, then please read this article on enabling Indic fonts for various OSs: http://en.wikipedia.org/wiki/Wikipedia:Enabling_complex_text_support_for_Indic_scripts

Saturday, January 27, 2007

Routing and Remote Access Service Fails!

This afternoon, we were suddenly unable to browse the internet. Suspicious about the proxy server being down, I checkout from our main browsing computers. I was able to ping the students proxy.
A little more digging up led me to figure out that there was something wrong with our lab router that handles the internet traffic to the student's proxy; the main browsing systems bypass the router.
I disabled the routing service and set it up again. Though the routing service itself did not throw up any error, the event log had logged the error message. I was unable to browse even from the router itself. Also, the IIS server on the router also failed.
I restarted the system thinking it might help - but to no avail!
Checking the event log revealed that the Routing and Remote Access service had thrown up an error - Unable to add the internal adapter to the routing service - incorrect parameter. Looking at the event log messages for a few hours earlier, I hit upon a message saying that a duplicate name had been detected on the network. I then realized that this was quite likely since our server had a name Dell1, which was quite possible to be duplicated over the network since there were a plethora of Dell machines springing up here. So I renamed our machine and restarted - Bingo! it was running like a good ol' boy!
Lesson to be learnt: Event log is Holy Grail!.

Monday, January 22, 2007

This is a test post from Google Docs & Spreadsheets! If this works, the integration that Google is providing will be seamless. Just too good I should say.
One up to Google on their thoughtfulness.

Saturday, December 16, 2006

Now, thats a Palindrome...

Now that is a palindrome:

A man, a plan, a canoe, pasta, heros, rajahs, a coloratura, maps, snipe, percale, macaroni, a gag, a banana bag, a tan, a tag, a banana bag again (or a camel), a crepe, pins, Spam, a rut, a Rolo, cash, a jar, sore hats, a peon, a canal -- Panama!

From Common Lisp, the Language (2nd ed).

And now, this is a geek: http://www.norvig.com/pal2.html and this is a palindrome: http://www.norvig.com/pal1txt.html

Read more at the Google Blog.

Wednesday, December 13, 2006

Subclipse Proxy Configuration

Whew! That was a real big deal.

I wanted to checkout the newly open-sourced Google Web Toolkit using Eclipse via the Subversion plugin. I work behind a proxy and have a choice of three proxies offering varying capabilities and restrictions - some require authentication while others don't. When I tried checkout, I was in for a real surprise - I was getting an error message saying Error 407: Proxy authentication required. Since I did not set any proxy in the first place, I was wondering how a proxy was picked up and why I was not being prompted for authentication!

When I searched the Eclipse preferences dialog for SVN, I did not find any place where I can set up a proxy. Also, I wondered if Subclipse had somehow chosen to use my Windows default proxy configuration. So, I went to Control Panel > Internet Connection > Connections > LAN Settings. Nope, the default proxy that I had configured for my windows was different from the one that Subclipse was using - the default proxy did not require authentication while Subclipse was trying a proxy that required authentication. Exasperating!

Just wanted to be sure which proxy was being used. As usual, the Ethereal network protocol analyzer came to my rescue. I figured out that by default, Subclipse had chosen a proxy that needed authentication (I am yet to find out how it found the proxy address in the first place!) and had not prompted me for authentication. Then, a search through Eclipse help led me to this link: http://svnbook.red-bean.com/en/1.1/ch07.html#svn-ch-7-sect-1.2.

In short, I had to edit the registry to set my proxy - call that user friendly??? Well, since most of the time people who check out code are geeks, may be I should excuse this!!! Here is where I had to go:
HKCU\Software\Tigris.org\Subersion\Servers\Global\http-proxy-host and http-proxy-port values. Once I set up the proxy there, all worked well.

Whew!!! Breathe easy now :)

Wednesday, November 29, 2006

Testing the RAM for defects on Windows

Somebody had asked me to look at some problem being created by Ulead DVD Factory 10.0. The error reported was some failure to read a memory location. This message repeated for Nero also, after a few days.
I suspected faulty RAM, after seeing the log. The message was EXCEPTION_ACCESS_VIOLATION. But, I did not know the right tools for testing the RAM. So, a Google Search led me to the following tools:
1) MemTest
2) Microsoft's Windows Memory Diagnostic.

I did not test Memtest, but I used the Microsoft solution. It was easy to use, but the UI is not for the layman.

Notes:
-Please keep a floppy disk handy. If you are one of those forward looking geeks, and do not have a floppy drive, you need to have a CD writer. Check out the details provided here for working with a CD.
- After you run the program and have created a floppy, boot from the floppy.
- To run Advanced Diagnostic tests, hit the T button on your keyboard.

Sunday, November 19, 2006

Sorting Algorithms : A visual treatment

Check out this link at: http://netlib.bell-labs.com/cm/cs/pearls/sortanim.html
It is from the Programming Pearls site. Gives some insight into the working of the algorithm. Check the behaviour of different algorithms on different inputs. However, it would be more helpful if we also have some control over the speed; this will help the visualization better!

Let me see if I can fix that recipe (ofcourse, I will start with the SortAnim.java provided at the site).

Saturday, November 18, 2006

Eclipse Update behind a proxy

Updating Eclipse from behind a proxy was quite counter-intuitive for me; or was it??? I had expected to find the proxy setting in the same window where the updater hooks up to the internet. Unfortunately, with Eclipse, it was under Window > Preferences > Install/Update > Use HTTP Proxy...
But this option of not having to hunt around the eclipse site for the plug-ins is a real killer concept. Saves a lot of time too. One up to the Eclipse project.

Thursday, November 16, 2006

Installation of Sun Studio 10 on Sun Solaris Machine

1. First uninstall the existing version by typing:
 - cd /var/sadm/prod/com.sun.studio_10
- Run the batch uninstaller.
- Further info on uninstalling can be found at: http://docs.sun.com/source/819-0485/remove.html
2. Next, put the Tar file in the directory in which you wish to install. Untar it. Keep the tar file in the same directory as the installer file.
3. Run the installer and follow instructions.

Wednesday, November 15, 2006

C Tidbit

The assignment operator returns something! In the case of a character, it returns the character that was assigned. So, it is useful to write code this way:

while ((to[i] = from[i]) != '\0')

Excellent, free iCal Calendars

This is a log of my adventures with iCal Calendar clients and format.
I tried Outlook Calendar & Google Calendar. Both were good. But, when I tried Google Calendar, it was in the offing and so I could not get much out of it. It was good but was accessible only when on the net.

So, I hit upon Rainlander. It was good, it integrated with Outlook and also understood the iCal format. But, I wanted to fill out just one calendar and use it on any client - both application and web-based. So, I filled out the Google Calendar (whew, that took really long!). Then, I realized that I could not actually use it anywhere else at that stage of development of Google Calendar.

So, I again filled out the Outlook calendar (because I had read this time that I can use the outlook2ical utility, which is free!!!). Bingo, I used the outlook2ical utility and could export my Outlook calendar to the iCal format which is widely supported.

Next, I experimented with phpicalendar using the .ics file that I exported with outlook2ical utility. It is cool and easy to use (as long as I had XAMPP with me, I had nothing to worry!)

Using Minix on VMWare

  • There is nothing special that you need to do incase you need to run Minix on VMWare. Infact, you can download the VMWare ready image of Minix from here. Only, this image is not allowing ftp access to VMWare. After much effort, I found an image file for Minix 2.0.4 which was consolidated. The website is so confusing. It does not specify clearly what needs to be downloaded and they have lots of things there too!!!
  • To allow ping to work, just set up NAT as described here.
  • Read this post or this post to enable FTP and Telnet access to Minix.

VMWare : SSH access to RH9 from Windows using PuTTY

Refer to my previous post regarding setting up Internet access via RH9 Guest OS. Make sure you have similar settings. Then, just change the firewall settings to allow incoming SSH connections.

Nothing else needs to be done.

VMWare : Internet access from Guest VM (RedHat 9)

  • You donot need to create any internet sharing in windows etc. VMWare will take care of that for you.
  • To set up internet access from the guest VM, set the VM to use NAT for ethernet.
  • Set the IP address to the same segment as that of VMNet8. (just make sure that it is not .2).

Now you can access the Internet from the Guest VM!

VMWare : Do's & Donts

  • VMWare by default creates two Vitual Network Adapters: VMNet1 & VMNet8.
  • VMNet1 is useful for host-only connection.
  • VMNet8 is for NAT access.
  • Donot change the IP domains which are assigned by default. You could wreck the DHCP, DNS & Routing domian that VMWare creates.
  • To change these settings, please use: Edit > Virtual Network Settings > NAT.
  • By default, the IP Address .2 with the VMNet8 segment, is the IP address of VMWare's DNS & router.

Windows : Autorun is Disabled?

Here is a solution for the Geeks; it modifies the Windows registry:

  1. Start RegEdit (regedt32.exe).
2. Go to HKEY_LOCAL_MACHINE/System/CurrentControlSet/Services/Cdrom.
3. Edit the Autorun value to '1' to enable autorn, and '0'
to disable autorun.
4. Close RegEdit.

NOTE: You may have to restart the system.

A simpler solution (not guaranteed to work if autorun has been disabled in the registry, as in my case) is:

  1. Right-click on the drive.
2. Choose properties.
3. Choose Autoplay.
4. Choose the action you want to take for various file types.

Linux : Mounting a USB device - made simpler

1) At the terminal, log in as root.

2) Open the /etc/fstab file for editing.

3) Append the following entry to the file: /dev/sda1 /mnt/usb autofs 0 0

4) Start > System Tools > Disk Management

5) Select the device to be mounted and mount.

NOTES:

1) /dev/sda1 is the name of the device whose file system you want to mount at /mnt/usb (this too is your choice!)

2) autofs tells the mount command that the filesystem type should (attempted to) be detected automatically. If you want, you can explicitly specify a file system.

3) In the options, DONOT specify the kudzu option. The kudzu option will cause /etc/fstab to be updated when the usb device is unmounted or unplugged. Thus, the entry will vanish after this. For more information regarding kudzu, use man kudzu at the terminal.

4) In the options, please specify user and NOT owner. If you donot specify user, the DiskManagement will not show the USB device if this is launched by a non-root user (by default). The GUI for DiskManagement is actually a command called usermount that reads from /etc/fstab and displays a list. Hence, if user is NOT specified, the device will not show up in the list. Further, the user option indicates that ANY user can mount this device!!!

5) For convinience, the DiskManagement can be added to the launcher panel (Start > System Tools. Right Click on DiskManagement and click on Add to Launcher Panel)

Changing the default command for RedHat8 Launch Panel

For accessing the Windows Network using Samba, only Nautilus seemed to be understanding the smb:// protocol. I did not want to each time start a terminal and type nautilus to start Nautilus. So, I wanted to add a launch panel icon. I could not find a way to add and configure a new icon. So I dragged the Help icon from the Main Menu and modified its Properties to run the command /usr/bin/nautilus. But this by default opened my home directory. I wanted it to open smb://Hostname. I had experimented earlier at the terminal and found that nautilus took as its command line arguements the location to be opened. So, I changed the command to /usr/bin/nautilus smb://Hostname. This worked well for me. But, I wanted some more sophistication. I wanted to log in directly since smb:// (like ftp://), takes the username and password separated by a colon followed by @ and the hostname. So, I changed the command to /usr/bin/nautilus smb://User Name:Password@Hostname. Nut, commandline did not parse the space separated user name (which Windows allows). So, as an additional change, using my instincts from my working with Linux, I enclosed the User Name within single quotes. This worked well. Similar strategy is also required to be used with the password if it contains spaces. Remember that while typing the username and password in the address bar of nautilus or at the Properties panel of the Launch Panel, the Password in NOT masked. So, it is at your risk that you do this.

So, all said and done, here is how the command looked at the end of the experimental session:

/usr/bin/nautilus smb://'User Name':'Pass word'@Hostname

Samba Server Setup

Check if the Samba server is installed: You can check this by going to Main Menu > System Settings > Server Settings > Services. Then, look for a service named smb. If it is present, that means, the Samba server is installed. If it is not started, start it up.

If you donot have the Samba server installed on your system, you should install it from the RedHat 9 CDs. The server along with the GUI to configure Samba are present on CDs 1, 2 & 3.
- Insert CD1.
- Go to the CDROM and navigate to RedHat > RPMS.
Here, look for a file called samba*.rpm. Install it.
- Insert CD2. Navigate to RedHat > RPMS.
Install a package called redhat-config-samba*.
- Insert CD3. Navigate to RedHat > RPMS.
Install a package called samba-swat*

NOTE: SWAT is a browser based configuration tool for Samba. It talks be default on port 901. So, to use this, httpd should be running on Linux and the firewall should not block this port.) We will use the GUI rather than SWAT for configuration.

  • Go to the command prompt and type: /usr/bin/redhat-config-samba (it is in /usr/bin folder).
  • Login as root.
  • You will get a screen similar to the one shown here.
  • Go to Preferences > Server Settings. The default settings are shown here. I had to keep the group to something different from what was the Workgroup on my Windows system. Give a nice description; this is what people from other systems will see as the title for the Server (eg. In Windows, in the My Network Places, Show Work Group Computer, this is what will be seen.)
  • On the Security tab,
- set the Authentication Mode to User.
- set the Encrypted Password to Yes.
- set Guest account to the user for whom you are setting up this share.
(I donot as yet know how to allow for anonymous shares...)
- click OK.
  • Go to Preferences > Samba Users.
- click add.
- Select the Unix username for the user whom you want to
permit to use the share. When he logs in, he will be takent to his home
directory unless some other shared folder has been specified.
- If the user is logging in from Windows, provide his Windows username

(this simplifies authentication and hepls to map Windows users to Linux users, I think so, I am not sure about this part).

- Provide a password (preferrably different from his Linux login password).
- click OK.
  • Click Add, and add a shared folder to allow access from outside the Linux machine.
  • To access this share from Windows, Go to My Network Places > View Workgroup Computers > Microsoft Windows Networks. Go to the appropriate workgroup that you had specified earlier. Here you will find the Samba Server with the description you provided earlier. Open this Samba and there you go!!!

Now someone please tell me how to access the Windows Shares from Linux. Any help would be appreciated. :)

UPDATE: Okay, just discovered that File & Printer Sharing must be enabled on Windows for accessing the Shared Files! For this, please run the Network Setup Wizard with appropriate options!!!

VMWare : Internet / FTP / Telnet Access to Linux Guest from Windows Host

1) After installing VMWare workstation or VMWare Player, find out the IP Subnet of the VM Network Adapter named VMNet8. This is the VMAdapter that is used for NAT connectivity.
2) Set up the Linux host's IP address to be in the same IP Subnet as VMNet8. Just make sure that you donot use the IP addresses subnet.1 OR subnet.2 Subnet.1 is used by VMNet8 while subnet.2 is used as the IP of the NAT Gateway. (Refer to VMWorkstation documentation for more details).
4) Set the default Gateway to subnet.2
3) Set up VMWare to use Ethernet in NAT mode.
4) Done.

VMWare : Sharing Files by Connecting to Windows from Linux

Check out this link from VMWare Documentation: http://www.vmware.com/support/gsx3/doc/running_fileshare_lin2win_gsx.html#1089626

Minix - FTP & Tlenet Access

I had a problem accessing my Minix VMWare guest OS, via FTP or Telnet. Here is how the problem was solved...

A little bit of history:
Yesterday, I had to set up a RedHat 9 Guest OS for one of my faculty members. I realized that even though telnet was installed and running, I was unable to access it even locally!!! Then I realized that I had to edit the 'telnet' file in /etc/xinetd.d to allow incoming telnet connections (inspite of changes to the firewall configuration to allow incoming telnet connections).

Back to present:
So I realized that perhaps something similar needs to be done even with Minix (after all, it is a variant of Unix and must have similar security features!!!). But, when I went to the /etc folder in Minix, I found no xinetd.d folder. Looking around, I found the serv.access file. Guessing that it must be the right place to look, I opened it. Bingo!
There it was. Only, I had to decipher how the entires should look like in that file. Ever so helpful, a comment asked me to man serv.access. Also, I looked at the /usr/adm/log file. It was all there - all those access denied messages...

Initially, my /etc/serv.access file was like this:

# /etc/serv.access
# 2006-05-21
# See the serv.access(5) man pages to learn how to edit this file
# to make your system safe on the network.
# this is insecure! replace with something more specific asap
telnet ftp: +* log;

# this is better, keep outsiders out

# telnet ftp: +*.local log;

# this records all unsuccessful access attempts in/usr/adm/log

*: -* log;

After a reading the man page and a little tinkering, I changed the line "telnet ftp: +* log;" to "telnet ftp: + log;". i.e., I just removed the *. May be very insecure, but it does the job for me. Perhaps one could add an IP address or a range of IPs to enhance security (as described in the man page).

One another word:
This might be very helpful on the VMWare front:

I am still using NAT. I had to just set the IP address of my Minix to be on the same subnet as VMNet8 (which is the default subnet on which VMWare does NAT-ing). Also, the default gateway on the guest OS - Minix - had to be set to VMNet8-subnet-.2 ( The .2 IP is the gateway across which VMWare does NAT).

Thats it!!!. All works fine now...

Adding a Favicon

Check out this Wiki article : http://en.wikipedia.org/wiki/Favicon

FTP Server on Windows 2003 Server R2

We had set up IIS on Windows 2003 server. Along with HTTP, we also had to set up FTP server to allow our staff members to be able to upload info to their respective folders.
The initial set up worked, but it was readonly, inspite of the folder permission being write. Then, I checked out that if I logged in as admin, I could create folders! So, I went to check out the folder permissions for the admin account. It was exactly as I had configured the staff account (FULL CONTROL), except that the permission were only for the current folder. For the staff account permissions, I had chosen to give full control to "This folder, and subfolders and files(as intuition and common sense would have served anyone). But, I must confess that I donot fully understand the NTFS permissions structure. So, I changed the staff permissions to this folder only and bingo! it worked.

Networking Lessons

Subnets, Non-routable IPS:
Learner's Perspective - http://www.easydesksoftware.com/news/news28.htm

Admin's Perspective - http://www.pku.edu.cn/academic/research/computer-center/tc/html/TC0000.html
Admin's Perspective - http://www.pku.edu.cn/academic/research/computer-center/tc/html/TC0305.html

Network Access across a router

This document recapitulates the tasks that were needed to be done by us to enable access between the online and offline systems in the lab at my hostel:

1) First set up a DNS ( with a domain name say ssshcc.edu )
- Set up the forward and reverse lookup zones
2) Set up the DNS machine to act as the router also between the two segments.
3) For each computer on the online and offline segments, change the primary DNS suffix of the computer to the DNS domain name ( as specified in step 1 )
- Right Click My Computer > Properties
- Computer Name
- Change
- More
- Type in the new Primary DNS Suffix
4) For each machine in the online and offline segements, make sure that the guest account is allowed network access.
- Start > Control Panel > Local Security Policy > Local Policy > User Rights Assignment > Deny Logon over Network
- Remove the Users whom you wish to allow network access (if the name is in the list)
5) Make sure that the default gateways and Primary and Secondary DNServers are correctly entered in the Network Configuration.
6) In the lab, i.e., in the SSSHCC, the online systems donot have guest login interactively, but we want the guest users from the offline segement to be able to access the online systems. For this, we enable the Guest user account on the Online systems, but prevent their Interactive Login as follows:
- Start > Control Panel > Local Security Policy > Local Policy > User Rights Assignment > Deny Logon Locally
- Add Guest user.
7)Here, you can choose the custom list and add the required IPs or choose then Any computer option as required.
8) One last setting: The windows firewall by default allows only computers on the same segment to access each other. This needs to be changed:

It is like this: Port 445 (which is what windows uses for file and printer sharing) by default accepts connections only from computers on the same subnet as itself. This behaviour can be changed as described in the document: https://docs.google.com/View?docid=ajgs46pc346b_9dxvvjc.
You can find Microsoft's description of the solution(KB840634) at http://support.microsoft.com/kb/840634

Windows XP Pro: Network access: logon failure

Windows XP Pro: Network access: logon failure: the user has not been granted the requested logon type at this computer

Solutions:
0) Start > Control Panel > Administrative Tools > Local Security Policy > Local Policies > User Rights Assignment:
- Goto : Deny Access to this Computer from the Network
- Remove the user name to whom you wish give permission to access the computer over the network.
1) Just run the network setup wizard and turn on file and printer sharing. If that does not help, try the next link:
2) http://www.experts-exchange.com/Operating_Systems/Windows_Server_2003/Q_21072962.html?qid=21072962
3) http://www.experts-exchange.com/Operating_Systems/Windows_Server_2003/Q_21072962.html

Matlab license manager error: Solaris 10

If the Sun Machine is not properly shut down when Matlab (license) server is running, you will be unable to start matlab after the reboot. You will get an error -15.
To trouble shoot, I did the following:
- I knew that lmstart command present int $MATLAB/etc directory starts the matlab license manager.
- To start the license manager (i.e., to run the lmstart command), you need to be logged in as a non-root user.
- So, I tried to start the license manager.
- I got a message saying that I needed to delete some files: /var/tmp/lm_*.log and /var/tmp/lm_*.dat
- For this you need to log in as root.
- Once this is done, run lmstart again.
- Done.

Thursday, April 20, 2006

The Best GDB tutorial....

Once again, GDB comes to my rescue. Preparing for some exam, I need to debug. I need some advanced debug commands. Man pages are too long and do not provide examples. So, where do I go? To where I always went for GDB. To Peter Jay Salzman's web site tutorial ofcourse!
It seems to have been recently updated and it is great. Very technical and yet understandable too! - a rare combination. It is still under massive reconstruction as the web site puts it, but still great to go.
You can find his homepage here and his usful linux notes here.
He seems to use all those things that I am interested in (kind of one-stop for me!), except that I use Matlab while he prefers Mathematica. His LaTeX links are here. And here is his list of hackers (both good and bad as he puts it.)

Sunday, April 16, 2006

What the hell is that service?

Two days ago, my system became damn slow. Then, I started looking at the processes and services running. Then, I Googled them and found these amazing sites:

http://www.liutilities.com
http://www.processlibrary.com
http://www.auditmypc.com

For my own quick reference, here is the list of the processes that were running on my machine; now, most of them are scrapped. BTW, my machine is now like a tuned string, waiting to be played with.
*) Bonjour: Apple Computer's
*) vptray : Symatec AV VirusProtectionTray
*) qttask : QuickTime Task
*) cftmon :The cftmon.exe process is a component used in MsOffice to perform language related functions. It is closely tied to the 'Language Bar' present in MsOffice, so if you use the Language Bar you should leave this process running. If, on the other hand, you do not use the language bar, you should terminate this process to free up system resources.
*) igfxtray.exe is a process which allows you to access the Intel Graphics configuration and diagnostic application for the Intel 810 series graphics chipset. This program is a non-essential system process, and is installed for ease of use via the desktop tray.
*) Intel hotcommand hkcmd.exe is installed alongside Intel multimedia devices and allows configuration and diagnostic options for these devices. This program is non-essential process to the running of the system, but should not be terminated unless suspected to be causing problems.
*) vsmon.exe is a processs associated with the ZoneAlarm personal firewall. It is used to monitor Internet traffic and generate alerts depending on the security rules configured by the user.
*) Adobelmsvc.exe is a process which belongs to Adobe Acrobat. This program is non-essential process to the running of the system, but should not be terminated unless suspected to be causing problems.
*) mdnsresponder.exe is a process associated with "Bonjour for Windows" software. It is used by ITunes for music sharing. This is a non-essential process. Disabling or enabling this is down to user preference.
*) mdm.exe is associated with Microsoft Windows process debugging system. It allows the user to debug Internet Explorer errors by using a script interface tool. This is a non-essential process. Disabling or enabling this is down to user preference. Note: is also a process which is registered as the Win32.Lydra.a information stealing Trojan. This Trojan allows attackers to access your computer, personal data and information. It is a registered security risk and should be removed immediately.
*) AcroTray.exe is the Acrobat Assistant used when you print your documents to a PDF. While converting documents to a PDF this process should not be removed.
*) Adobelm_Cleanup.0001 is a process which belongs to Adobe Acrobat. This program is non-essential process to the running of the system, but should not be terminated unless suspected to be causing problems.
*) lsass.exe is a system process of the Microsoft Windows security mechanisms. It specifically deals with local security and login policies. This program is important for the stable and secure running of your computer and should not be terminated.
*) Scrss.exe is a process which is registered as the HacDef-R Trojan. This Trojan allows attackers to access your computer, stealing passwords, Internet banking and personal data. It is a registered security risk and should be removed immediately.
*) smss.exe is a process which is a part of the Microsoft Windows Operating System. It is called the Session Manager SubSystem and is responsible for handling sessions on your system. This program is important for the stable and secure running of your computer and should not be terminated.
*) PSNGive.exe is a process associated with the lite version of Post-it Note from 3M.

References:
http://www.auditmypc.com
http://www.processlibrary.com
http://www.liutilities.com

Installing Mandrake Linux

The other day, my one of my friends had a problem installing Mandrake Linux. On first thougts, I thought I would get an image aided tutorial ready, but then, I checked out the all resourceful Google and found these. The second link is classic:
http://member.melbpc.org.au/~parsonsd/linux/Mandrake10_Install.html
http://www.mandrake.tips.4.free.fr/install100.html

So, happy Mandraking!

Lookout - Outlook!!

Here is where I again had a hell lot of problems. I wanted to make a birthday calendar and export it in the standard iCal format to my Google Calendar etc, as iCal was hailed on the web as the defacto standard for calendars.
I started with Sunbird 0.3a1. Thinking that I could export things in iCal format, I filled in all the birthdays I wanted to. And, then I found that all I had done was a waste. It only allowed me to export selected items as iCal. Thinking that maybe the default format for the calendar is iCal, I looked in my profile directory and bingo! nothing like *.ical, *.vsc or *.vcal. Then the Mozilla Foundation's documentation told me that from this version of sunbird, the default file format was .sdb, some SQLite format. Gone waste was my effort.
Lesson #1: Always look for the existance of the features you need in the s/w you choose.

So, what do I do? Google it ofcourse!
This is what Google yielded and had some good reviews too: http://outlook2ical.sourceforge.net/
It was some VB script. Things went cool till I exported the calendar and imported it into Sunbird. The recurring events which were supposed to recur every year once were recurring every day for a month! Give up?
Lesson #2: Never trust feature description. Check out the features ur self.

What next?
I wanted to somehow get this b'day business running, so I filled out the calendar in Outlook (for the simple reason that it was faster to add in Outlook than in Sunbird, donno why). Then, I bumped into this: http://www.rainlendar.com. A very cute utility that seamlessly integrates with Outlook (oh my God!), reads from and understands iCal files! Thought this was a jackpot. Installed the software and loved its interface and cool features. Under the config > Plugins, i checked the Outlook option and refreshed the rainlendar on my desktop, it began showing the bithdays on the CORRECT days and onMouseOver(), it displayed the subject and description in a pop-up!
Cute piece of work.

Next, I wanted to take this calendar of outlook to my workplace. How?
I chose Calendar. Then I said File > Archive. I saved only the Calendar to an archive.pst (which was non-empty (~256 kb) ). Then I closed Outlook and made another copy of this file.
Next, on my Win XP with Outlook 2003, I found the archive of the current Outlook files here C:\Documents and Settings\%USER_NAME%\Local Settings\Application Data\Microsoft\Outlook\Outlook.pst
Just to see if I can import, I changed the name of the file from Outlook.pst to OldOutlook.pst. As expected, Outlook did not open saying it could not find the file Outlook.pst; but, it gave me file open dialog where I chose the archive.pst. Then agagin it gave some error and closed. The next time I opened Outlook, it opened, but there was nothing there. So, I decided to import the stuff. I chose File > Import and Export > Import from another file or program > Personal Files Folder (.pst).
Here I chose the backup file of the Outlook.pst that I had made earlier (did not want to take any chances with my calendar!). Then, I chose to import the calendar and hit the Finish button. Done!
I opened my calendar on the left tab and yo! the birthdays were there!!!

Okay, so much so far, but not good enough for me to export to iCal yet. Anyone ne ideas? Please lemme know.

Wednesday, April 12, 2006

Firefox extension updated!

At last! The SaveURI 0.1 for firefox is ready! Now I can breathe easy. It is available here. Try it and post your comments.
As I said earlier, this extension is useful for "remembering" the URL of every page that you visited and saved. This is still in beta as it has only just been submitted to Mozilla Foundation for review.
Cheers! Now I can do something else while I wait for the review. :)


Update:
Yesterday, the Firefox 1.5.0.1 running on my system said I needed to upgrade, on saying go ahead, it checked my extensions for compatibility and said SaveURI is incompatible with 1.5.0.2! Anyway, later, I downloaded FF 1.5.0.2 from Get Firefox and installed it. Then, I installed the SaveURI extension and it works just right!
Any ideas? Buzz me.

Update:
This morning (20th April), SaveURI 0.3 was ready. Queued it up for approval at the MDC. Waiting for their approval. If you want to try it, it is available here. Try it and let me know.

Monday, April 10, 2006

Post-it notes for the PC

That is one hell of a software for forgetfulls like me. You can cover your desktop with post-its and even set off an alarm on specific notes!. Terrific! You can download the lite version from here. You can try the newest version for 30 days from here. Beware! version 4.2 needs .Net framework 1.1. You can get that here.
The maker is father of paper-post-its -- 3M. Three cheers to 3M!

New Firefox Extension

Today, SaveURI- a firefox extension that I wrote is ready. It was a litte difficult to get things going, but it was fun.

By the way, this extension simply saves the URI or URL of every page that you save so that you don't have to search for the parent site link. This was a problem I had for long, especially when I was doing my master's project. The links were just not available on any of the pages that I had saved. I needed them all for my report references. I am glad I could solve my own problems.
You can download the extension here. Just be careful if you are using the CustomizeGooogle extension as SaveURI is in the test phase and WILL clash with the latter extenssion.

Welcome!

Welcome to my (b)log.
Here, I will be recording my experiments with Computers & Computing.