Setting JAVA_HOME and ANT_HOME on Ubuntu / Linux Mint

This might be helpful for the newbies who are starting their career in software development with  Java lang. And of course its not like in old school when it comes to the industry, we use application build tools for proper deployment of enterprise applications. Such commonly used build tool is ‘ apache – ant ‘. Before starting any big work with java and ant, you have to define ‘Java home’ and ‘Ant home’ to make use of them. Follow the following steps by adding few lines to your ‘.bashrc’ file,

Step 01: Locating .bashrc file.
If your on ubuntu, bashrc can be found on home directory as ‘.bashrc’ . If its Linux Mint go to /etc and open ‘bash.bashrc’ as super user mode to edit via a teminal.

sodu gedit bash.bashrc

sodu gedit bash.bashrc

Step 02: Setting ANT_HOME
Include the following block of text at the bottom of your ‘bash.bashrc’ file (if ubuntu, then .bash).

ANT_HOME

ANT_HOME

I have stored my apache-ant folder in ‘/usr/local/’. Change the path according to your apache-ant folder location.

Step 03: Setting JAVA_HOME
Same as you did for ANT_HOME, include the following block of text at the bottom of bash.bashrc file. Include the correct path of java jvm.

JAVA_HOME

JAVA_HOME

You are good to go!

 BTW I’m listening to Pretty Girl (The Way)” by sugarcult. Its really cool :P

Setting up a LAMP Server

This post is to help the people who is willing to try out web technologies using LAMP. I think it will be more helpful to do a brief on ‘what is LAMP?’

LAMP represents the open source web platform. Its a portion of 4 resources
L – Linux (any distribution of gnu/linux).
A – Apache ( web server).
M – MySQL (relational database management system).
P – either Perl,Python or PHP (OO scripting language).
In this tutorial I’m using Linux Mint 7 Gloria, Apache2, MySQL and PHP5.

Step 01 → update your system’s package repository. So you can get the latest versions of available resources.

apt-get update

Step 02 → download and install Apache web server

apt-get install apache2

To check what the web server is running without any problems type ‘http://localhost‘ on your browser. If no problems, then it will give a test output as follows,

Step 03 → get PHP and its dependencies.

apt-get install php5 libapache2-mod-php5

after installing php you have to restart apache web server as follows,

/etc/init.d/apache2 restart

Step 04 → Now you need to make sure that PHP and Apache is working fine together. To do that use the following test php scrip and save it as phpinfo.php in server root(/var/www/).

phpinfo.php

phpinfo.php

Then call the script through the web browser. The URL should be like this, http://localhost/phpinfo.php . Then it should show all PHP configuration settings in a coloured table.

Step 05 →  get MySQL

apt-get install mysql-server

During the installation you will get a package configuration screen. Set root password for MySQl carefully. If you didn’t get that screen set password for MySQl manually,

mysql -u root
mysql> SET PASSWORD FOR ‘root’@’localhost’ = PASSWORD(‘user_pass_word’);

Step 06 → PhpMyAdmin installation

PhpMyAdmin is a web based free graphical database management and MySQL administration tool. This tool  makes all the MySQL database operations easy. Such as creating tables, creating databases inserting values, deleting values and lot more.

apt-get install phpmyadmin

during its installation it will ask what server to use. Apache or apache2 ? Select apache2 . Then it will prompt you to set a password for phpmyadmin. Done! To use Phpmyadmin type http://localhost/phpmyadmin on your browser.

PhpMyAdmin

PhpMyAdmin

Congrats! Your LAMP system is ready to do extraordinary things for you. :D

Note: all the command line actions above are held as ‘root’.

My Crazy Idea of Future Web

Hell of work I’m doing these days. But this funny and freaking idea of future web started to ghost through my mind! May be I’m overloaded with work and started to see things. Whatever..

The future web. What would it be like? It keeps developing and developing 24 hours nonstop. Millions and billions of geeks/freaks/nerds and hackers are trying to make a new change. Speed is optimized by software+hardware and reliability is Secured by firewalls  but on other hand its not a safe place anymore to visit.

This is my crazy idea (please don’t get freaked out :D ).The future web may not have any browsers to browse or computer screens. Users may wear handy looking high tech “browsing goggles” . There will be nice comfortable “browsing chars” to give you those fancy vibrating and shaking real life effects. And your DTS surround system may serve as the noise of world wide web.

Then you power on your high power PC which definitely runs GNU/Linux. Then you turn on the browsing goggles…

First you will feel the empty 3D cyberspace around you, dark and silent. Then you may notice billions of tiny little particles of web sites. You may able to touch them,move them or throw them away in to the deep cyberspace as you wanted. Yeah they may Emmit beautiful colors too. I guess my favorite networks like google, youtube and wordpress will appear as giant colorful,glorious galaxies. Suddenly you wants to find something.. System takes 0.5mses to reads your brain signals and identify what you wanted and send a virtual character in front of you . Mostly it will be a kind looking lady in a pure white dress(mostly with the google logo). She identifies her self to you and asks your requirement. Then she may grab the the missing particle and give it to you…

Wow just think how it would be like! Freakingly awesome huh. I think Its better to stop now. Because you may already thinking that Dushi has gone crazy! Who knows this comic may be a prediction of the future web! What do you think of the future web? Will it be something like I mentioned ? Or is it just another freakish idea? What ever it is feel free to comment..

adios

Cyberspace in Future

Cyberspace in Future

Note : The technology mentioned above is never been built and I’m not doing cocaine or weed :D

Compressing and Archiving

‘.tar’, ‘.gz’, ‘.tar.gz’, ‘.bz2′, ‘tar.bz2′, ‘.zip’. What are these strange extensions? Mostly you ll think these are all compressed files. But its better to understand exactly what these are. And why do we need them.

According to above extensions some are for compressed and some tells that they are archived.

Compressing

In linux/unix environment there are 2 main compression algorithms. They are ‘gzip’ and ‘bzip’. The difference of ‘bzip’ from ‘gzip’ is that ‘bzip’ is more capable of making smaller files than ‘gzip’. But ‘bzip’ consumes much more memory and takes time.

Howto bzip:

as usual open up your favorite terminal/konsole :D . Then follow the commands. I m having 4 files inside /home/dushi/test directory.

ls

ls

now im gona compress file1.txt using bzip2.

bzip2

bzip2

Thats all. Now ‘file1.txt’ is replaced by ‘file1.txt.bz2′ :D

Lets decompress that newly compressed file back to ‘file1.txt’.

bzip2 -d

bzip2 -d

it will decompress the ‘.bz2′ file into its originals.

Howto gzip:

gzip

gzip

same as above its really simple. I’m gona compress ‘file2.txt’ using ‘gzip’. it gives ‘file2.txt.gz’.

gzip -d

gzip -d

use -d to decompress.

Archiving

The ‘.tar’ format is the most common archive format in linux/unix environment. They are mostly called as tarballs. Archives are not compressed files. It combines one or more files into a single file. The idea is to achieve easier storage and transportation. Specially in web.

Howto archive:

lets go back into my /home/dushi/test/ directory again.

ls

ls

There are 4 files. Two compressed files and two normal text files. Lets archive them all into ‘MyArchive.tar’ .

tar -cf

tar -cf

from about cmd makes a tarball as ‘MyArchive.tar’ :D . To extract files from it ,

tar -xf

tar -xf

Thats all u should know :)  for more options refer,

$man tar

$man gzip

adios

Tips and Tricks I use in Firefox

firefox

firefox

I like Firefox a lot. Because its really user friendly,and secure. it kept me browsing  for about a year I think. And still I use it to snoop into cyberspace. Love it. But not 3.0.10. it has lots of bugs.3.0.2 comes in handy.  Ok cut that crap. I thought to share the things what I know about firefox, the things I use for my daily browsing.

01.Making icons small to get more screen space

View –> Toolbars –> Customize –> Use Small icons

02.Some common shortcuts

  • F5  –> reload page
  • Alt  + Home    –> go to home page
  • Ctrl + W    –>Close present tab
  • Ctrl + N   –> open a new browser
  • Shift + Spacebar    –>  scroll up
  • Spacebar   –> scroll down
  • Ctrl + L   –> go to address bar
  • Ctrl + K   –>go to search box
  • Ctrl + +   –>zoom in
  • Ctrl + –   –> zoom out
  • Ctrl + T  –> new tab
  • Ctrl + D   –>book mark this page

03.Navigate between tabs

  • Ctrl + Tab   –> navigate forward among tabs
  • Ctrl + Shift + Tab –>go to previous tab
  • Ctrl + 1-9 –>go to corresponding numbered tab

04.Some cool mouse tricks

  • Middle click on a tab –> closes tab
  • Middle click on a link –> opens in a new tab
  • Shift + scroll up –> go to next page
  • Shift + scroll down  –> go to previous page

05.Auto Complete

I really like this shortcut! Go to address bar by pressing Ctrl + L then type ‘Wikipedia’. Yes without the www and com. Now press Ctrl + Enter. Wow it automatically filled ‘www.’ and ‘.com’. Like that you can use,

  • Shift + Enter for ‘.net’
  • Ctrl + Shift + Enter for ‘.org’

Awesome huh!

These are just basic tips. Now lets go little deeper. Hacking ‘about:confin’ is the coolest part. This ‘about:config’ contains all the configuration settings of Firefox. So you should be more careful when handling it.

Accessing ‘about:config’ page  –  type ‘about:config‘ in the address bar. Yes make that promise! and here we go….

about:config

about:config

These are the configuration entries of about:config. You can filter them by entering the key words in the ‘Filter’ field. All fields can be updated with double clicking on them. Ok lets do some work…

[1]  Control RAM usage

If you’re having low amount of memory in your PC, this option will be useful. Filter ‘browser.cache‘. Double click on ‘browser.cache.disk.capacity‘. The default value will be 50000. If you’re having between 512MB and 1GB of ram, 15000 would be fine.

browser.cache.disk.capacity

browser.cache.disk.capacity

[2]  Reduce RAM usage further when the browser is minimized.

In ‘about:config‘ right-click anywhere. Then select new boolean. Name it as ‘config.trim_on_minimize‘ and set it to true. Finally restart the browser.

[3]   Disable Antivirus Scanning

This is for windows users. By default Firefox 3 scans all the downloads with the default antivirus software for your protection. But how ever this will reduce your speed (when the file is big). If u want to stop that (but better f you can keep it) edit the following,

‘browser.download.manager.scanWhenDone’ and modify its value into False.

browser.download.manager.scanWhenDone

browser.download.manager.scanWhenDone

[4]   Handling spell checking in all text fields

Filter ‘layout.spellcheckDefault’. By default the value is 1.

layout.spellcheckDefault

layout.spellcheckDefaul

You can change it into following value

  • 1 – spell checker for multi-lines text boxes only.
  • 2 – enable the spell checker for all text boxes.
  • 0 – disable the spell checker.

[5] Open Search Box Results In New Tab

Filter into  browser.search.openintab‘. By default its value is false, tells to display the search results in the same window. Make it into ‘true’. Then the search results will show in a new tab.

[6] Configure Backspace Button

I like my browser takes me to the previous page when  press  ‘backspace’. Make it your own. Fined ‘browser.backspace_action’. You can have 3 options,

  • 0– go back previous page
  • 1-page up
  • 2-does nothing (default case)

[7] Autohide Toolbar in Fullscreen mode

browser.fullscreen.autohide ‘ this config decides whether to show the tool bar or not in fullscrean. True – always auto hide and False – always show.

[8] Configuring the Scrolling Tabs

When you open many tabs a scrolling bar will show up.

Configuring the Scrolling Tabs

Configuring the Scrolling Tabs

And you can use it to find your tabs. Instead of that, you can change the tab width or else make it ‘0’ so that scroll bar will never show up. It’s very easy for me to find what I wanted because every thing is in a single frame. Filter into ‘browser.tabs.tabMinWidth‘ and change the default 100px for your choice.

[9]  Show/Disable Close button on Tabs

Maybe you would like to have close buttons for your choice. It’s possible with ‘browser.tabs.closeButtons‘ config. The following options are available,

  • 0 – display the close button on the active tab (what I m using)
  • 1 – display on all tabs(default)
  • 2 –  don’t display any close buttons
  • 3 – display a single close button at the end of the tab strip
Show/Disable Close button on Tabs

Show/Disable Close button on Tabs

[10] speed up Firefox

These setting are for people who use broadband connections like me. They really work. Helps to optimize your browsing speed. You can also give a shot and see.

Config name: network.http.max-connections
Default: 30
Modified value: 96

Config name: network.http.pipelining
Default: False
Modified value: True

Config name: network.http.pipelining.maxrequests
Default: 4
Modified value: any value higher than 4, but not more than 8

Config name: network.http.max-connections-per-server
Default: 15
Modified value: 32

Config name: network.http.proxy.pipelining
Default: False
Modified value: True

So these are some of the thing which I use for my daily browsing. It’s really helps me. There are so much other things too. I’m leaving them you to find out. Enjoy the tricks+hacks.

Adios

Command Line Package Management [Debian Based]

you can use ‘apt-get’ tool to manage packages via the CLI instead of using the GUI. ‘apt-get’ can be used to install and uninstall packages as we needed. For your convenience Im going to introduce another CLI tool , ‘dpkg’. Most of you may already have useded it.

Installing a program:

apt-get install

apt-get install

system will check the repositories and install it into the pc from a desired place. By default it will connect your PC to a FTP server and download the required package and its dependencies, then install. This method is highly effective for a good installation.

If you want to install a package which is already saved in your pc,

dpkg -i

dpkg -i

At times you have to download the package source code/binaries and compile it then install. To do that go in to that folder and follow the following steps,

#./configure
#make
#make install

Uninstalling a program:

same tools again!

dpkg --list

dpkg --list

using the above code you can get a list of installed programs.You can use ‘apt-get’ as shown bellow to remove programs,

apt-get remove

apt-get remove

when after performing an ‘apt-get install’, by experience you ll understand that its installing  also other packages as dependencies. We can also remove a program with all its dependencies.

apt-get --purge

apt-get --purge

these are the basics of Linux file management via CLI. Feel free to experiment the commands and rediscover the CLI.
……………..enjoy…………….

Airtel HSDPA [Sri Lanka]

Hi folks! Couldn’t write for about a month I think. But now I m back again with my Brand new HSDPA kit. Well HSDPA means speedy internet isn’t it? But I would have to say that life would be little more difficult and hard when you have Airtel HSDPA!

Airtel+e220

Airtel+e220

I’m using Airtel’s middle package. 600Rs per month, 3 GB free download and 1Mb/s speed. Ya its worth. But the problem is there coverage. It sucks. Not totally. But mostly! I also brought a Huawei e220 modem from Dialog GSM. It’s in good shape after unlocking. Now they both working well. But as I mentioned early I m not satisfied about Airtel HSDPA coverage and their system. Usually when some one tries to connect to a network (as other service providers do) it detects the user and gives the required setting. Like its ‘APN’ and stuff. But Airtel isn’t capable of that. I didn’t get any HSDPA settings when I tried to connect them for the 1st time. So I had to have some calls to a friend (chanux) of mine requesting to google the setting. Luckily I didn’t call their customer care, because after some time I found that its something like fallen from the sky (more..) . There APN was AirTelLive and I gave the access number as *99#. It worked! But first I got only GPRS signals. That’s because when the signal strength is low the modem software detects it and only allows the device to receive the most available signal type. If you are an Airtel data user this would be your ‘Frequently Faced Problem’.  To avoid this you can set the modem only to receive WCDMA/HSDPA signal frequencies. If you are also using an e220, go to Tools -> options -> Network and set the Network Type as WCDMA only. The handy thing is these setting are also being saved in the device. So Linux users like us don’t have to suffer thinking to find solutions to run the modem software in Linux.

So after doing some work now I’m receiving HSDPA signals. Now it only varies between WCDMA and HSDPA (no more GPRS). The signal strength is about 40% but it’s far better than having GPRS. Under 40% of signal strength I got hardly satisfied about my service provider. Also I didn’t find a way to detect my data usage over the month. It doesn’t matter if the Data package is unlimited. But there should be a way to detect it for limited users like us.  And have to say another thing! If you ever thinking to get support from Airtel’s website, then forget about it. Its totally Crap!

………………………Later……………………..

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: