How to check RAM size in Ubuntu using commands

Check RAM Size in Ubuntu

Sometime, we may need to know the System’s RAM size to check whether it meets a software’s requirements or to find available free RAM during application

To view the total available RAM type the following command


Output – (displays the total available RAM in KB)

total          used        free      shared  buff/cache   available
Mem:        1014488      183236      194352        5708      636900      787780
Swap:             0           0           0

Continue reading

Disable backward and forward button using javascript

I was facing the same problem and searching for a solution. I got no exact solution, so i wrote my own code.

STEP 1: Before writing the code i analyzed what the browser shortcuts for moving through the history. The shortcuts of different browsers to move through the history are :

given in format keyboard shortcuts (its key value)

Mozilla Firefox

Backspace (8) – 1 page back throught the history

Alt + left arrow (37) – 1 page back through the history

Alt + right arrow (39) – 1 page forward through the history

Shift + Backspace (8) – 1 page forward through the history

Continue reading

How to create a Jar file in command prompt

This article will tell you how to create a jar file using Java’s Jar command in command prompt. Basically jar file format is formed from ZIP file format. Jar files are mainly used for archiving, compression and decompression.

Note : Java should be installed in your system to execute Jar command and also correct java path should be set up before starting.

Using Jar command you can create,view,delete,update/modify,extract and execute the jar files.

1. Creating a Jar file


c – create JAR file
f – Output should go to file rather than stdout (terminal)
JAR_NAME – Name of the Jar file (can give any filename you want). Filename should be given .jar extension
INPUT_FILENAME(S) – One or more files to be included in the JAR file and each file will be separated by a space
DIRECTORY_NAME – If the “input files” are directory, then the contents of the directory (given in the DIRECTORY_NAME) are added to the jar recursively.

Note : c and f should be in any order but should not have any space in between them

Continue reading

Top 10 useful Mozilla tools for developers

Web Developer

The Web Developer extension adds various web developer tools to the browser.


Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse.
You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page

DOM Inspector

Inspect the DOM of HTML, XUL, and XML pages, including the mail…

SQLite Manager

Manage any SQLite database on your computer.

JavaScript Deobfuscator

This add-on will show you what JavaScript gets to run on a web page, even if it is obfuscated and generated on the fly.
Simply open JavaScript Deobfuscator from the Tools menu and watch the scripts being compiled/executed.

Continue reading

How to prevent browser from caching a page in rails

I used devise for authentication in my rails project. After I signed out; I clicked the back button in the browser; Oh!!! the browser was showing the previous page from which I clicked ‘sign out’.  I tested this and found that the browser is caching the page.

I used firebug to analyze the project page(s). I found that the

no-cahe is added

To add ‘no-cache’, I added the following lines @ the application_controller.rb file

before_filter :set_no_cache

and the function

def set_no_cache
response.headers["Cache-Control"] = "no-cache, no-store, max-age=0, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "Fri, 01 Jan 1990 00:00:00 GMT"

Restarted the server and found that after I signout and hit ‘back button’ of the browser; the page is redirected to the sign_in page. [ I have configured devise to redirect to sign_in when the session is not valid].

Hope this helps rails users like me.

and I analyzed the rails project page(s) using firebug andThe firebug analyzed results

no-cache implemeted

Steps to Convert the CLOB to VARCHAR2 Data Type

Steps to convert the CLOB(Character Large OBject) to Varchar2 data type.

Step 1: Create a new temporary column with varchar2
Step 2: Move the CLOB column content to new temporary column, if it is needed. (Note : By this situation you may loose the data depending upon Max length)
Step 3: Drop the CLOB column.
Step 4: Rename the temporary column with dropped CLOB column.


Step 1: ALTER TABLE your_table (temp_column VARCHAR(4000));
Step 2: UPDATE your_table SET temp_column = DBMS_LOB.SUBSTR(clob_column, 4000, 1);
Step 3: ALTER TABLE your_table DROP COLUMN clob_column;
Step 4: ALTER TABLE your_table COLUMN temp_column TO clob_column;

How to Convert the Data Type VARCHAR2 to CLOB in Oracle

We cannot directly convert the data type VARCHAR2 to CLOB(Character Large OBject). Using below two options, we can able to covert it.

Option 1:

Step 1 : Convert the VARCHAR2 To LONG Data Type
Step 2 : Convert the LONG to CLOB Data Type.



Option 2:

Step 1: Add a new column as CLOB
Step 2: UPDATE VARCHAR2 date to CLOB column
Step 3: DROP VARCHAR column
Step 4: Rename CLOB column to VARCHAR column name

Remove white spaces in a string c#

By using trim() we can remove white space characters from the beginning and end of a string.But to remove white space characters in middle we cannot use trim() method.

we can easily remove the white spaces/empty space in a string by replace method

string strSample = “Test with white space”;
strSample = strSample.Replace(” “, “”);

Result : strSample = “Testwithwhitespace”

How to enable gzip compression in jBoss?

To enable JBoss http protocol gzip compression you have to change the server.xml file.
Less than 4.0 Version : ${jBoss-home}\server\default\deploy\jbossweb-tomcat50.sar\server.xml
above 4.0 Version     : ${jBoss-home}\server\default\deploy\jboss-web.deployer\server.xml

Find this piece of xml code:
<Connector port=”8080″ address=”${jboss.bind.address}” maxThreads=”250″
maxHttpHeaderSize=”8192″ emptySessionPath=”true” protocol=”HTTP/1.1″
enableLookups=”false” redirectPort=”8443″ acceptCount=”100″ connectionTimeout=”20000″
disableUploadTimeout=”true” compression=”0″></Connector>

When compression is disabled compression parameter is set to 0.
To enable compression set it to 1.

After that you can see the difference.
It can compress HTML,CSS,JavaScript,Images File from 1 MB to around 300kb.

What is Generics in java?


Generics provides compile-time (static) type safety for collections and
eliminates the need for most typecasts (type conversion).

For Example:

List<String> stringList = new ArrayList<String>();

In the above example,we can add only the String in a ArrayList.If we add
Other than String mean it’s throw an error.

Other Uses Of Generics are:
In For loop we directly use without checking condition of length.

Previously Used For Loop:
String value=””;
for(int i=0;i<stringList.length();i++)

Generic For Loop
for(String value : stringList)