Saturday, December 15, 2007

MP3 support in Fedora

I really don't know what took me so long to figure this out (again). Since my latest installation of Fedora about 2 months back, I've been trying to hard to get it to play MP3s. Not that I didn't know how. I had done that before, 'N' times. But I just couldn't manage to do it again!!

Finally, cracked it today. Here's how:

$ yum install gstreamer-plugins-ugly

That's it! Yes, that's it. Just answer with y (yes) whenever your permission is required to proceed. Download size is just under 1 MB. It will enable MP3 support in Rhythmbox, the default media player under Fedora (GNOME)

Sunday, December 9, 2007

Regional language (Indic scripts / Complex scripts) support in Fedora

The following instructions have been tested to work correctly only for Devnaagarii script.

To enable Indic support, you need two things:

  1. A font having Indic character definitions
  2. A 'complex script' rendering engine
The first part is taken care of by the Arial Unicode MS font (see my Windows fonts tutorial). The complex script rendering engine in Fedora is called pango. I dont't kno about other applications, but its certainly required for Mozilla/Firefox.

Now Firefox can be 'built' from its source code either with the pango engine, or without it. The ordinary version that you download has been compiled WITHOUT pango. And although the source code is freely available for everyone to comiple, trust me, trying to compile it yourself is no easy task.

A better option is to use whichever version of Firefox that came with your Fedora installation.Such versions (1.5.0.7, in my case, on FC6) have been compiled using the pango engine, and that should make your task easier. However, you must take care to see to it that you use the older version only when you need Indic support. Older versions can have security vulnerabilities that can put your computer/data at risk.

A thing I consider extremely worthwhile mentioning is that multiple versions of Firefox can peacefully co-exist under Fedora. All you need to do is keep them in separate folders. You can make the default link poin to the latest version, and run the old version manually by executing

$ FIREFOX_HOME/firefox

where FIREFOX_HOME is the directory where your old Firefox installation resides. In my case it is /usr/lib/firefox-1.5.0.7

That done, you should be able to view regional scripts (Indic) correctly...!

Windows Fonts support in Fedora

To install Windows (.ttf & .fot) fonts in Fedora, do the following:

  1. Install MS Office in Windows XP with 'Complete' configuration
  2. Copy the C:\Windows\Fonts folder onto a removable media
  3. Log in to Fedora
  4. Insert the removable media
  5. Go to System > Preferences > Fonts > Details > Go to font folder
  6. Drag and drop the font files from the removable media directly into the 'Fonts' folder that opens
  7. Restart the system

(Tutorial courtesy: http://www.fedorafaq.org)

Saturday, December 8, 2007

Derby Basics

Once ij is set up, you can try the following commands at ij-prompt:

Creating a database 'MyDB'
ij> CONNECT 'jdbc:derby:MyDB;create=true';
ij (CONNECTION1)>

Opening a database
ij (CONNECTION1)> CONNECT 'jdbc:derby:MyDB';

Creating tables, inserting records and displaying records is as per standard SQL command set

To close a connection:
ij (CONNECTION1)> DISCONNECT

Java DB / Apache Derby Operating Instructions (Fedora)

ij is an interactive SQL scripting tool that comes with Derby. It can be used with the Derby Embedded JDBC driver or with a client JDBC driver, such as the Derby Network Client.

Upon setup of Java EE SDK (as per my tutorial), do the following

$ export DERBY_INSTALL=/opt/SDK/javadb
$ export CLASSPATH=DERBY_INSTALL/lib/derby.jar:DERBY_INSTALL/lib/derbytools.jar
$ echo $CLASSPATH
/opt/SDK/javadb/lib/derby.jar:/opt/SDK/javadb/lib/derbytools7.jar:
$

Now,
$ java org.apache.derby.tools.ij

This will start IJ, with the IJ prompt ij>

Play MP3 in Fedora without hassles

After fiddling along with GStreamer, Totem, Rhythmbox and more such stuff, I discovered an easy way to play MP3s (though not AAC):

Use LimeWire's in-built media player. Its a simple solution, and I really dont know why it took me so long to figure that out. For those heavy-users of LimeWire, its a handy tool, and avoids the mess of having to install MP3 codecs for hte default players.

Thursday, December 6, 2007

FireFTP tested for the first time (5th Dec 2007)

FireFTP, the Firefox-based file transfer utility was tested today
successfully. The test was carried out on the Brinkster-hosted
CSI-TCET website. This opens ur another world of opportunities, with
me now being able to manage a website, irrepective of the accessing
platform.

--
Sameer P. Karve
Mobile: +91-98-3344-2464

IEEE Member ID 80599447



--
Sameer P. Karve
Mobile: +91-98-3344-2464

IEEE Member ID 80599447



--
Sameer P. Karve
Mobile: +91-98-3344-2464

IEEE Member ID 80599447

Sunday, November 25, 2007

Internet Messenger setup in Fedora Core 6

The built-in multi-protocol Internet Messenger GAIM is good enough for use with MSN, GTalk and Yahoo. Here are the settings you need to do for each of the serives. Firstly, go to Applications > Internet > Internet Messenger.

Yahoo accounts
  1. In the Account dialog, click on Add
  2. In the Add account dialog, select Protocol as Yahoo
  3. Screen Name: yourYahooUsername
  4. Enter the password, select 'Remember password.
  5. Save. Your account is created. It will log in automatically
GTalk accounts
  1. In the Account dialog, click on Add
  2. In the Add account dialog, select protocol as Jabber
  3. Screen name is your GMail ID, WITHOUT "@gmail.com"
  4. Server: gmail.com
  5. Under the Advanced tab, make Connect Server as talk.google.com
  6. Leave other options unchanged. Save.
  7. Your GTalk account will be activated
MSN / Windows Live accounts
  1. In the Add account dialog, select protocol as MSN
  2. In screen name, enter your COMPLETE Hotmail ID
  3. Enter the password, remember password
  4. Your MSN / Hotmail / Windows Live account will be created
This completes the setup of the most popular IM clients around

Network setup in Fedora Core 6

In today's times, being connected to the Internet has become probably as much as a necessity as food and water and air. Network setup in FC6 is easy, but different than what you've been used to in Windows. This guide is specific to the following environment:
  1. Location:Mumbai, INDIA
  2. ISP: MTNL
  3. Service: Tri-Band ADSL
  4. Router: UT-Starcom model UT-300R2U
  5. Router pre-configured with DHCP, bearing local IP 192.168.1.1
Given this setup, you may proceed in the following way:
  1. Switch on the router before you switch on the PC
  2. Go to System > Administration > Network
  3. Select Device eth0 and click on Edit
  4. Under the Ethernet Device dialog, select Statically set IP addresses and enter the following Manual IP address settings
  5. Address: 192.168.1.2
  6. Subnet Mask: 255.255.255.0
  7. Default gateway address: 192.168.1.1
  8. Click OK
  9. Now, back to Network Configuration dialog, select the DNS tab
  10. Enter Primary DNS as 203.94.227.43
  11. Enter Secondary DNS as 203.94.243.70
  12. Click File > Save
  13. You can start your browser and ride the waves of the internet !

Printer setup in Fedora Core 6

Printing with FC6 is really easy. Here's how I setup my HP PSC 500 Officejet:

  1. Switch on your printer before starting your PC
  2. Log in as root
  3. Go to System > Administration > Printing
  4. Click on New Printer
  5. Printer Name: HP_PSC_500
  6. Description: HP PSC 500
  7. Location: Next to monitor
  8. In Select Connection dialog, select HP PSC 500 LPT parport0 HPLIP
  9. In Select Printer From Database option, select HP
  10. Under Models select PSC 500
  11. Once the printer is installed, the Printer Configuration dialog will be shown
  12. Select Local Printers > HP_PSC_500
  13. Click on Make default printer
  14. Under Printer Options, select Page size as A4
  15. Select Print test page under the Settings tab
  16. If the page is printed correctly, no reason to worry!
  17. Click on Apply and close the Printer Configuration dialog
The printer is setup. Although this guide is highly specific, I hope you have understood the basic steps in setting up a printer on Linux. You can follow the same steps (not literally) to setup your printers as well. A thing to note is that you should never be stuck with an old OS and a latest printer model, as that will mean the absence of the printer definition in the OS database. Ofcourse, there would be a workaround, but I haven't tried it out.

Java EE SDK Installation Instructions

For as long as this link works, its a good generic reference for anyone wanting to update their JRE in Fedora/Linux. The steps below are specific to installing Sun's Java EE SDK (inclusive of JDK and JRE 1.6.0_06) on Fedora Core 6 32-bit i386. Should you be able to succesfully complete the following steps, you shall have the most enviable Java setups around. Here's how you go about it:

Before we begin, there are a few things you need to know. Whenever I mention something like:

$cd /opt

..it means that the command cd /opt must be typed at the prompt (so called as the dollar prompt) in the Terminal (that is Applications > Accessories > Terminal). Don't worry, you won't see a dollar sign in the terminal, but its just a convention of writing. Note that you must not type the dollar sign while entering the command.

Secondly, there is no such thing as a registry, in Linux. So you don't have to 'install' applications using an installer. You will generally get a .tar.gz or a .zip file from the download sites. These files must be simply extracted, and the resulting folder must be copied to any location of your choice. However, by convention, such folders are copied into /usr/lib/ directory under your file system. (The file system can be accessed from Applications > System Tools > File Browser). However, since there is no installation, some manual configuring effort is required. This effort is largely context dependent, and will vary as per:
  1. Distribution of Linux (Fedora, RedHat, Ubuntu, Debian, Mandriva, Gentoo.....)
  2. Version of distribution (Fedora 8, RedHat 10.....)
  3. The hardware platform for the distribution (i386 in my case, for Intel 32-bit processors)
  4. Application version you've downloaded
  5. Where you've saved (or subsequently copied) the extracted folder
Thirdly, when performing setup operations, you must always login as root.

Now, with a basic understanding of these things, lets get to the real thing:

Stage 1: Downloading the correct file, to the correct place
  1. Go to http://java.sun.com
  2. Select Downloads > Java EE
  3. Click on Download with JDK
  4. Accept the License Agreement
  5. Click on the link to Java EE SDK 5 Update 3 under Linux platform
  6. If you are using Firefox with default settings, the java_ee_sdk-5_03-linux.bin file will get downloaded to your Desktop
  7. Once done, copy the bin file to /opt (under your File System)
Stage 2: Installing the EE Server
  1. Open Applications > Accessories > Terminal
  2. $cd /opt
  3. $chmod +x java_ee_sdk-5_03-linux.bin
  4. $./java_ee_sdk-5_03-linux.bin
  5. Now, Java's GUI installation will begin.
  6. Proceed through the installation normally
  7. At the end, click on Start Server. If the installation proceeded succesfully, you should see a "Your server is up and running" page when you type http://localhost:8080/ in your browser
  8. Also, a SDK directory will be created under /opt
This completes half the story, that is, you built the environment. But still, other applications don't know of its presence, and, in my opinion, you should make it loud and clear! So here's what you do:

Stage 3: Setting up environment variables
  1. Open Applications > Accessories > Text Editor
  2. Copy paste the following things in a new (blank) file:
export JAVA_HOME=/opt/SDK/jdk
export JRE_HOME=/opt/SDK/jdk/jre
export PATH=$JAVA_HOME/bin:$PATH
export J2RE_HOME=/opt/SDK/jdk/jre
export PATH=$J2RE_HOME/bin:$PATH

Stage 4: Configuring the environment for use throughout Fedora
  1. Now save the file as java.sh in /etc/profile.d under your File System
  2. Back, to the terminal, do the following things:
  3. $source /etc/profile.d/java.sh
  4. $which java
  5. If you have proceeded correctly upto this stage, you should see /opt/SDK/jdk/jre/bin/java as the result.
  6. Proceed ahead ONLY IF you get this result. Else, you've gone wrong and must retrace. There's no point in moving forward if you don't get this result.
  7. Now, continue typing in terminal with the following commands:
  8. $usr/sbin/alternatives --install /usr/bin/java java /opt/SDK/jdk/jre/bin/java 2
  9. $usr/sbin/alternatives --config java
  10. Type 2 and hit enter
  11. $java -version
  12. If installation is complete, it should give the following result:
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode)

Stage 5: Installing the JRE plugin for Firefox

Now, the final stage remains that of hooking up the JRE with your browser. Assuming you have correctly installed Mozilla Firefox 2.0.0.9 in /usr/lib/firefox do the following:

$ln -s /opt/SDK/jdk/jre/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/firefox/plugins/libjavaplugin_oji.so

Note that the entire statement above is on a single line, without hitting anywhere in between.

This will complete the entire installation procedure. I know its long and tedious, but trust me, its well worth the effort.

Four pillars of internet completed

The migration to Fedora has gained strength, what with the completion of construction of the four pillars of the internet:
  1. Browser (Mozilla Firefox 2.0.0.9)
  2. Messenger (GAIM; multi-protocol for GTalk and Yahoo)
  3. File-sharing (Limewire 4.14)
  4. Server (Java EE SDK, bundled with JDK+JRE 1.6.0_03)
Now, the full internet experience of Windows is available on Fedora! Detailed setup guides and installation instructions will be published tomorrow. (Its 1:55 midnight as I type) There are lots of them....and they are VERY important. Cya.

Shhh...The next episode is about to begin

As if my achievements under Windows were not enough, now the domain of my knowledge acquisition has shifted to Linux (Fedora Core 6, in particular), and how! Today was a landmark day in the migration to Fedora. The dilapidated structure of Fedora 6 (its a very old release; the latest one being Fedora 8) was today strengthened by the addition of 3 great applications:
  1. Mozilla Firefox 2.0.0.9
  2. Java EE SDK (JDK+JRE included)
  3. Apache Tomcat 6.x
The applications, in effect have given me the latest browser, the latest enterprise (and JSP )server, and the latest JRE, required by many other applications as well. Tomcat, I suppose, will become redundant, what with EE-SDK taking over all Java development duties. In any case, I've been successfully able to run 2 simultaneous servers on Fedora.

Through the process, I've learnt a lot of new things like tarballs, echo, export, UNIX file system and so on. I am sure this knowledge will come in handy some day. The how-to's will follow:

Saturday, November 24, 2007

Firefox 2.0.0.9 installation on Fedora Core 6

Whew! After all that effort, I finally managed to upgrade the age-old Firefox 1.5 that comes bundled on the FC6 CDs. Here's how:
  1. Login as root
  2. Download the installation file (extension tar.gz) to your desktop
  3. Double-click to open
  4. Extract to /usr/lib/firefox
  5. Shut down all running copies of firefox, including download windows, if any
  6. Delete the firefox 1.5.x.x folder present in /usr/lib
  7. Open terminal
  8. $ yum install compat-libstdc++-33
  9. Proceed throught the installation process, giving Yes (y) wherever required
  10. Right click on the "Web browser" icon in the icon bar (on top) and select properties
  11. Change the command to /usr/lib/firefox/firefox
  12. Restart the system
  13. Firefox 2.0.0.9 is all yours
P.S. Trash all the manuals and how to's found around tthe net. All of them are incomplete in some respects.

Monday, November 19, 2007

The triad will be complete......

I'm not talking about Dobereiner, or about the Musketeers. The triad here is:

1. SonyEricsson K790i multi-media cell-phone
2. SonyErisccon HBH-PV-100 Bluetooth headset
3. SanDisk 4GB MemoryStick Micro (M2)

As if having a great phone didn't suffice, it was complemented a few days back by a disused, practically discarded bluetooth headset that had been lying in my drawer for months after my dad lost interest in it. I always like to collect discarded objects. Not from a historical collector's point of view, but with a will to get them working again. Then, why did it lie disused in my drawer for those many months? I wasn't able to figure out how to pair it with my cell-phone!! After trying all possible combinations on the headset's (3) keys, as well as my cell, I just gave up.

And then, a few days back, while clearing out my drawer, I stumpled upon this thing of great interest. I switched it on. I pressed its volume keys, and heard a ringer. I said, now, this can't be further from the truth. If the LED glows, if the speaker responds, if the volume keys work, it just can't be that the Bluetooth module has failed. That set my thoughts in motion, and I ended up Googling. After just a few minutes of search, I had found the solution. The headset was working, and it was mine!! The purpose behind why I had collected it, in the first place, had been achieved.

Today, it has become an inseparable part of my life. I can no longer imagine holding the phone in my hand for talking. Talking 'hands-free' has now become a way of life. With hands-free, my phone got its best partner. These two formed a beautiful pair.

Tomorrow, they will go one step further, when the card adds the necessary zing to the phone. This combination will be one of the most elaborate and advanced setups in the world. And I will be proud to have engineered this solution, one bit at a time...

4GB: Plans (Part 2)

Coming straight to the point, without beating around the bush, here's what I intend to do with my 4GB card:

1. All my media will be consolidated, and kept in a single location, that is, my cell. My songs, photos, videos, and files. No more syncing. There's just one place to find my matter: my cell.

2. I am a big fan of 'organising'. I've already organised my 430 MP3 files into 26 folders (first), for each letter of the English alphabet, and sub-classified into further folders, whenever each folder exceeds a limit of 20 files, that I've set. All this has been done keeping in mind the feeble processing power of a cell-phone, as compared to a desktop PC. This organising has been done quite a few weeks back, and I'm all ready to take the plunge

3. Further, I discovered to 'construct' playlists. Now someone would call that stupid. Playlists are meant to be constructed :P But there are many more things to be taken care of, when you need to transport those playlists between two devices, and more so, something as disparate as a desktop PC and a tiny multi-function cell-phone. Anyway, having discovered how to 'construct' text-file playlists (M3U) exactly tailored to my requirements, I now plan to organise my collection even further, and actually send those playlists to my cell for playback.

4. Another long-pending dream, that of carrying all my memories with me (at least those in the form of pictures). Now, I'll be able to. Earlier, I had tried a mass-transform using Adobe Photoshop Album Starter Edition software that came bundled in the SonyEricsson PC Suite CD. The mass-transform was to convert 3.2 MP pictures to QVGA (320*240 resolution, the same as my phone's screen size). However, the transform created 'new' files, all bearing the same date of modification. This was a disaster, as my phone's photo album is supposed to show pictures classified by the date on which they were clicked. Now, I think I finally may be able to exploit that feature. Though I doubt how to put 1,000 or more pics in the single 'Camera Album' folder. This procedure is necessary, as it is the only way in which the Timeline View functions. I've tried fiddling with that procedure, already, without success.

5. The songs will take up 2.1 GB, the pics will take 1 GB, the videos 300 MB. Whatever little is left (500 MB or therabout; a 4GB card will always come with a usable space of about 3.7GB) will be used to keep my personal files. However, it is very very important to format the card as soon as it arrives, and transfer a bulk of the files in one go, to prevent them from being fragmented across the card. The major section of songs and pics is intended to be static, that is, no deletion. The remaining space, of videos and files may be reused as required.

4GB: Plans

Now you must be wondering that if I've gone in for such a huge upgrade (by my standards), I must definitely be looking forward to doing a lot of things with it. What would they be? Here's a glance:

I've made the card purchase for Rs. 3,380 from ebay.in (thru their online credit-card based payment service PaisaPay, which I guess is the desi version of PayPal). Its a 4GB Memory Stick Micro (M2) for my Sony Ericsson K790i, which was gifted to me by my parents on the occasion of my 20th birthday in March 2007. All along, I made do with the default 64MB memory card that came in the package.

First things first. Is this card, an overhyped acquisition? NO. There are a lot of things to it. Firstly, ever since the invention of the iPod, it has become customary to carry your entire media collection (music, photos, videos, et all) on your portable device. The PC's role has been limited to downloading that content from the internet (officially, through iTunes store, or more popularly, over P2P networks like Gnutella/LimeWire), and feeding it into your portable media player.

P2P content is more popular, although illegal, because of the fact that it does not content DRM (Digital Rights Management, lookup http://en.wikipedia.org/wiki/DRM), and hence, it is not locked onto a particular proprietary device. If you are a techie, I don't need to explain to you the importance of non-proprietary content.

So, the first and foremost use of the 4GB card is to store ALL of my media in one single location, and more importantly, always have that media with me, wherever I go. Now you must be wondering as to why am I laying such great stress on the media? It is because I own a precious collection of nearly 500 Hindi songs, that have been painstakingly collected from various sources. To add to that, a lot of effort has gone in tagging them with correct album, artist information and album art.

(--- Returning after a break, caused due to call with Petu, for a staggering 36 mins (avg call duration: 36 secs) -----)

(---- And another break, caused due to a call with Silent Assassin, lasting......ummm, forget it, didn't notice (This dude bought a K810, and needed some troubleshooting advice) ----)

Forget it, I'll complete my blog later.......now, there have been too many interruptions, and I need to have dinner.. Cya soon

4GB Memory Boost for my cell

The day I've been waiting for, for so long, is finally here. My K790 came bundled with a measly 64 MB memory card, (in addition to 70 MB phone memory), with which I've pulled on for 9 months until now (since March 2007). I always wished to have more memory (everybody does), mainly because this was such an advanced multimedia phone, and that I could do so much with it. But, it was financially unaffordable for me to buy a 2GB card (costing 4,000 Rs. then, and the highest capacity available, to the best of my knowledge). So I waited, and waited more. The prices were coming down steadily. Then the 4GB cards appeared on the market, for about 5,000 Rs. Still too pricey, I thought.

Then there was a jolt. Sandisk released 8GB M2 cards on 18th October 2007. 4GB card prices tumbld down. I planned to buy that 8GB card sometime in March next year. But I put up a discussion on one of the tech forums (http://www.esato.com) regarding the compatibility of this humongous card with my ordinary (:P) cell-phone. To my dismay, I learnt that one smart-ass had contacted Sony Corporation regarding the same, and they had replied that K790 supported only upto 4GB of removable memory.

So, I decided upon buying a 4GB card, sometime, for sure, before I embarked on my IV (Industrial Visit to Delhi-Dehradun, Jan 2008). Then, due to some reasons which cannot be disclosed here, I decided to make a purchase right here, right now. The research had been done for too long (8 months, to be precise). I had tracked the prices for a long time. I knew which deal was VFM and which one was not. I had byhearted the sequence of steps required to go to this particular item on ebay, owing to the innumerable 'wish visits' I had made!

Today, when the day finally came, I just placed the order. I expect the card to be delivered tomorrow, or worst case, the day after, as the seller is in the same city. This card is not just a tiny piece of plastic and silicon measuring 1 sq.cm., its much more than that. How? Read the next post.

Sunday, November 18, 2007

PHP Succesful

Good morning to one and all! Had a good night's sleep. With server dreams, ofcourse! So what was it that I dreamt? Having done much of the foundation work, now it was time to try PHP for real. I had done that before, but had lost touch.

So, today, I setup the PHP server for Apache 2.2 Once done, I put the HelloWorld.php file in my htdocs folder in Apache. And simply call the file from my browser. It worked! Now, I am beginning to wonder if PHP should be setup on other servers as well (not concurrently). Watch this space for the answer....

Saturday, November 17, 2007

Community Server for Testing (CST)

Now that I have come so far, what with four servers running concurrently (see previous posts), I thought, why not do something to help those newbies (like me, formerly) out there, who want to test different web applications/services at little or no cost?

For that, I plan to setup my PC as a community server for testing. I might keep it free, or charge peanuts for its use, just enough to cover the additional load in my electricity bill every month, owing to my PC's increased uptime.

I'll have the four servers running. Developers can upload their service on the required server and test it remotely. Simple, na?

Additionally, it can also be used a resource base. I can theoretically provide unlimited downloads to people, as their 'download' will actually be an 'upload' for my server. And MTNL (my ISP) doesn't charge me for uploading :P . Now thats what I call amazing !!

My Brilliant Brain ! (Hey, thats just an upcoming series on National Geographic Channel. What did you think, I am talking about myself???........Well, maybe you weren't entirely wrong either.........)

IIS external accesibility issue resolved

For those of you trying to figure out why IIS asks for username and password when you try to access it from Firefox, or a remote server, here's the solution:

  1. Go to Control Panel > Administrative Tools > Internet Information Services > (local computer) > Default website
  2. Right click and select Properties
  3. Under Directory Security tab > Anonymous access and authentication protocol section > click on the Edit button
  4. Check (select) Anonymous access (that is, enable it)
  5. Leave other things unchanged
  6. Click OK all the way out.
  7. Restart your server
  8. Done !

Update: Port manipulations fot Tomcat & IIS

I guess, I never rest. So here's plugging two holes in my previous post, the port manipulations for Apache Tomcat & Microsoft IIS. Here goes:

Apache Tomcat:

  1. Go to C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf
  2. Open server.xml in Dreamweaver or Notepad
  3. Change Connector port="7777" (for example, from the original 8080 or 80) where protocol="HTTP/1.1"
  4. Be careful of the latter part. There are multiple 'connector' tags in the whole XML document, but you must change only the right one.
  5. Save the file and restart the server.
  6. Confirm at localhost:7777
Windows IIS
  1. Go to Control Panel > Administrative Tools > Internet Information Services > (local computer name) > Default website.
  2. Right click and select Properties.
  3. Under the Website tab > Web Identification section > TCP Port > type 6666
  4. (You can type any port number you wish, as usual)
  5. Restart the server (software)
Thats it!

Multiple Concurrent Servers - A reality !!

When I wrote my last post, I really wasn't sure if I would be able to run multiple servers on my system concurrently. I made three attempts between my last post, and about 19:30. And those attempts all resulted in failure. But as they say, "When things seem evermore difficult, you are really close to solving the problem". And solve I did.

How? No Googling, for a change !! Just plain common sense (of a techie, ofcourse) (jeez, i m getting vain)

So here's the change you make to your router settings that I already mentioned in my previous post. Under Virtual Server, change the Local port from 8080 (or whatever else) to 0 (zero) A zero number means forward all requests. Do not forget to Save and Reboot.

Then, set the different listening ports for your multitude of servers. I havnt figured out a way of changing Tomcat's port, so I let it remain 8080. I thought it safe to keep IIS on the default (80) port. But I changed the Java Application Server and Apache HTTP as follows:

For Sun Java:
  1. Go to localhost:4848 (or whatever administrator port u've set up)
  2. Login with the administrative username and password (which you must have noted down)
  3. Go to Configuration > HTTP Service > HTTP Listeners > http-listener-1 > Listener port.
  4. Enter a random port address between 1025 to 65535. I prefer 5282 (JAVA on ur mobile phone keypad) as it is easy to remember
  5. Save and Logout.
For Apache HTTP:
  1. Go to C:\Program Files\Apache Software Foundation\Apache 2.2\conf\httpd.conf (or whatever is the equivalent conf directory on your system)
  2. You can open the file with notepad
  3. Look for the text Listen
  4. Change the number after that (should be 8080, or 80, before you make the changes) to any number of your choice (between 1025 and 65535)
  5. I chose 9393, just like that
  6. Save the file and close.
Restart your PC and your router. Once everything is up, start all your servers. In this case:
  1. http://localhost/
  2. http://localhost:8080/
  3. http://localhost:5282/
  4. http://localhost:9393/
Thats it. Go to your friend's place (it would be wiser to just call him up, and do the needful). Retrieve your IP address, for example, 59.182.147.56. Ask someone to type the following in simultaneously open browser tabs (or windows, in case the jerk of a friend still uses IE6, not Firefox):
  1. http://59.182.147.56/
  2. http://59.182.147.56:8080/
  3. http://59.182.147.56:5282/
  4. http://59.182.147.56:9393/
If all works fine, your jerk...oops...i mean friend, should get the default pages (or the index, in case you've put something there) for each of those servers.

Whew. Finally, I achieved what I set out to achieve. Now I can R.I.P. May god bless my soul. I don't think I'll be posting anytime soon. Cya until then.

Multiple Concurrent Servers?

I never stop at solving a problem. I go further and find a new problem. Having setup a 'Server @ home', what I want to do next is to have multiple servers running simultaneously. To begin with, atleast IIS and Tomcat. It will require some fiddling with the settings I mentioned in my previous post. Not sure what to do, but will do so nevertheless.

Updates soon.....ciao

Server @ home - Tutorial

Here's how you go about setting up a remotely accessible home-server:

Note that this manual pertains to my home setup only, which is:
  1. Windows XP SP1
  2. MTNL TriBand (Mumbai, INDIA)
  3. UTSTarcom router UT-300R2U
So here's how you go about:

You will need to make the changes in your router setup. No changes are required to be made to your PC setup. The router setup is done via a browser, using a fixed IP address. To figure it out:
  1. Run command prompt
  2. Type ipconfig
  3. Type the address of the Default Gateway in your browser
  4. Type in the username and password (admin, admin) in my case
  5. Go to Advanced tab
  6. Click on Virtual Server
  7. In Private IP, type the IP address as mentioned in your 'ipconfig' result
  8. Select protocol TCP
  9. Select local port 8080 (in case of Tomcat)
  10. Destination port: any port.
  11. Next, go to Filters.
  12. In Oubound filter, add any source IP, any destination IP, any source port, any destination port, any protocol, action Aceept.
  13. Do the same settings in inbound filter.
  14. Go to Tools > Misc and click on Save and reboot.
  15. Restart your PC
You are done with the setup. Now, to access your PC remotely, go to a friend's place (or any other damn PC outside your home; something that doesn't use your router). You will need your home PC running (not even on standby). Tomcat must also be running. You must have the IP address of the home PC (Found in Status under your router admin panel (thru the browser))

Now simply type the address, followed by the port number in your friend's browser. It should look something like: 59.182.27.28:8080

If you see Tomcat's welcome page, you've been succesful!!

Server @ home

Having solved the JSP/Servlet problem, a new one arose. The problem of plenty, as I would like to call it.

By now, I know too much. Or more correctly, too many technologies. To fuel my hunger for knowledge, I had ended up downloading all the servers of the world (or so I think). Now, I had the following:
  1. Microsoft IIS 5.0
  2. Apache HTTP Server 2.2.4
  3. Apache Tomcat 6.13
  4. Java EE Server 5 Update 3
  5. PHP Engine 5.2.2
My current default test site http://csi-tcet.org is hoster by Brinkster, which is a big fan of Billu (Bill Gates). So it provides only ASP and .net hosting (atleast under the Windows hosting scheme). That leaves me with a big bottleneck. Where do I test my products? Ofcourse, localhost is always an option. But it doesn't come anywhere close to the feel of a remote server. So, in principle, what I needed was a multi-protocol (so to say) remote server at my command.

And the only solution I saw, is t make my own PC as a remote server. I knew that PCs behin firewalls cannot be accessed. Googling revealed that what I needed to do was port forwarding. More googling brought up a site http://www.portforwarding.com A really useful resource. Looked up my model number, did a few things. Also looking up other tech forums, finally managed to get this thing done as well.

Now, I have my very own remotely accesible web-server at home!! How did I do it? Read the next post....

JSP Servlets - Explanation

Now that I've posted a full-fledged tutorial, I guess there's some explanation that needs to be done. If you are new to servlets (or Java/JSP, for that matter), please look up resources on the net. A good place to start would be http://java.sun.com/ So now, for those familiar with servlets and their use, here goes...

After having developed test websites in ASP for years, i had finally hit a road-block. The road-block was that even after separating the 'processing logic', from the display related stuff, I was still stuck with having to put everything in an HTML page. I saw the solution in servlets.

So, on 15th November 2007, I finally took the big leap, and made the switch to JSP. I started up a new project, SAMS - Standard APIs for Mobile Services. I vowed not to touch ASP, no matter what.

It wasn't easy. I had developed a certain comfort level with ASP, kind of a relationship.. Now I had to start over again with some'one' else. But start I did. It began with the most frequently used include directive. The next major hurdle I wanted to cross was database connectivity. I managed to set the JDBC:ODBC things straight after a few Google searches. JSP, for now, was done. It was up and running, and that was sufficient for me.

Now, it was time for me to move on. And I saw 'servlets' as the next step. I got a sample servlet file, and tried hard to compile it in JCreator, which would keep giving errors of library not found. Googled hard again, but to no avail. Then somehting struck me.....it might require Java EE. Looked that up, and found out that my guess was right.

Downloading EE was quite a decision. I don't have unlimited downloads on my plan. 1GB a month. That's it. I was at the middle of the month, with 485 GB (nearly half) used up. EE would add another 90 MB. After deliberating a bit, I reckoned it would be money well invested. SO I went forth and downlaoded EE.

Tomcat was set up previously. EE was installed. I had everything running. My servlet was supposed to work. But it didnt. My servlet had compiled alright. But i didnt know where to put the class file. Googled again. Googled hard. Found the configurations to be made to the web.xml file. Did them, and voila, finally, it was running!!!

I had spent a good 4 hours researching and implementing my first servlet. It was 12:30 a.m. of 16th Nov 2007. Was tired already, but though of documenting everything. Wasn't blogging then. So composed a mail to myself.

That mal is what has been posted as the previous blog. Hope that it will be useful to a lot of newbies out there.

Cheers!

JSP Servlets Tutorial

How to create and run a servlet?

You will require to have these Java components before you can run a servlet:
  1. Java Runtime Environment (JRE)
  2. Java software Development Kit (JDK)
  3. Java Enterprise Edition Software Development Kit (Java EE SDK)
These 3 can be downloaded as a complete package, or individually also. To download the complete package (recommended)
  1. Go to: "http://java.sun.com/javaee/downloads/index.jsp " and click on "Download with JDK button"
  2. Accept agreement by clicking on the radio button
  3. Under the header "Windows platfform" click on the file name to download
  4. You can save the setup file to a folder of your choice
  5. Once download completes, click on the file and run it. Proceed with the installation with all default options and settings
  6. Restart the PC
Besides that, you will also need the Apache Tomcat JSP Server, which can be setup as follows:
  1. Go to "http://tomcat.apache.org/"
  2. In the left column, under the "Download" heading, click on the link to the latest version
  3. Once on th downloads page, search for the heading "Binary Distributions"
  4. Click on "Windows Service Installer" to save the file
  5. You can save the setup file in a folder of your choice
  6. Once download completes, click on the file and run it. Proceed with the installation with all default options and settings
  7. Restart the PC
Assuming you have downloaded and setup all the tools, here's what you need to do to get your first servlet running
  1. Write a HelloServlet.java file (see attached)
  2. Save it to the JDK bin directory (In this case: "C:\Program Files\Java\jdk1.5.0_06\bin")
  3. Start Menu> Run > Type "cmd" (without quotes) in the box. MS-DOS Command prompt will open
  4. Change directory to JDK bin using the command (cd C:\Program Files\Java\jdk1.5.0_06\bin )
  5. Compile the HelloServlet.java file using 'javac' (command: javac HelloWorld.java)
  6. Your servlet will be compiled (if no errors are present) and put in the same bin directory
  7. Go to Windows Explorer (My Computer)
  8. Copy HelloServlet.class file FROM "C:\Program Files\Java\jdk1.5.0_06\bin" TO "C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\ROOT\WEB-INF\classes"
  9. Add servlet info (copy from attached file "add_to_web_inf") to the web.xml file (final file with added code attached) located in web-inf
  10. Stop the "Default Server" of Java EE SDK by right-clicking on the "Java EE 5 SDK" icon in system tray (besides the clock at right-bottom)
  11. Manually start the Tomcat server by going to "C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin" and clicking on "tomcat"
  12. Let the DOS window remain open throughout your session. If server starts successfully, it wil show INFO:server startup in 2748ms (example)
  13. Execute the servlet by typing the path "http://localhost:8080/sams/HelloServlet" in your browser
  14. Note: Do not add any extension to the servlet name in the path
---------
HelloServlet.java

import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

/**
* The simplest possible servlet.
*/

public class HelloServlet extends HttpServlet {

public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException
{
response.setContentType("text/plain");
PrintWriter out = response.getWriter();

out.println("Servlet invoked! ");
out.println(new Date());
}
}

-------------------------

Hello World

What else do u expect from a techie? This is the way we are supposed to greet the rest of the world, right?