Skip to main content

Posts

Showing posts from 2012

Multiple Instances of GTalk

How to use Gtalk on Windows with multiple Gmail accounts? Here is the solution... I was using a chat messenger which use to support multiple messenger but after using it for some time I realized that my machine has become unresponsive :P. So I decided to come back to my old lovely GTalk but the only problem is we can not have multiple instance of  'The GTalk'. So I searched for an solution and luckily I found one. Step I Create a shortcut for gtalk and let's keep it on desktop. Step II Now right click on the shortcut icon and select 'Properties'. Step III In Shortcut tab the value for 'Target' will be something like "C:\Users\Home\AppData\Roaming\Google\Google Talk\googletalk.exe" /startmenu (The above value will change according to your gtalk location but they will be quite similar) Now change this value to "C:\Users\Amol\AppData\Roaming\Google\Google Talk\googletalk.exe" /startmenu /nomutex i.e. add "/nomutex&

Create Table in Liquibase

For creating table using liquibase you can use below code and add it in your liquibase file. <createTable tableName=“employee”>      <column name="id" type="int">      <constraints primaryKey="true" nullable="false"/>   </column>      <column name="first_name" type="varchar(255)"/>   <column name="last_name" type="varchar(255)"/>   <column name="username" type="varchar(255)">      <constraints unique="true" nullable="false"/>   </column> </createTable> The use is pretty simple it's the way it looks : Tag: <createTable></createTable> This is an opening/ending tag for creating a table. These tags will enclose column sub tags which will define columns for the table. Attribute:   tableName : Name of the table which you want to create. (This is a mandatory  

Couldn't execute 'show fields from `association`'

Encountered this error while taking mysql dump mysqldump: Couldn't execute 'show fields from `association`': Can't create/write to file '/tmp/#sql_647f_0.MYI' (Errcode: 2) (1) Reason : Can’t find tmp location to save it’s files OS :  centos Solution : Step I Open my.cnf (in this case it was at the location /etc/my.cnf). Step II Under [mysqld] add one more parameterad as : tmpdir=/var/tmp that solved the problem Usually mysql uses /tmp or /var/tmp or /usr/tmp for storing it’s variable but if it doesn’t then try the above method.

Failed to connect to remote VM. Connection refused.

Encountered this error while trying to debug my project. IDE: Eclipse Server: Jboss Error:  Failed to connect to remote VM. Connection refused. Reason : When we install JBoss server the debug option is disabled by default. Solution : Go to ur jboss directory “<directory>/bin” and edit run.bat. Search for: rem set JAVA_OPTS = -Xdebug -Xrunjdwp:transport=dt_socket, address=8787, server=y, suspend=y %JAVA_OPTS% ‘rem’ in above statement shows that this line is comments. So remove ‘rem’ and set suspend=n.

Carnivorous Island from "Life of PI"

Yann Martel described about an floating carnivorous Island for symbolizing that something seemingly good in life can turn out to be harmful, so we should keep going with our journey of life... About the carnivorous Island from movie. In the movie 'Life of PI' after PI struggles to live in the pacific with the Bengal tiger suddenly one morning Pi  found himself at a Island. After spending so many days in the middle of the sea he found himself very lucky to find a Island. After spending some time he thought might be this was the end of his suffering and he can spend rest of his life at that island. He makes h is bed on a tree and sleeps there, in the middle of the night he wakes up and find that there were dead fish in the fresh water where he took swim in the day time. While trying to understand the mystery he plucks a fruit from the same tree and peel it off and finds a human tooth inside that fruit and then he realize that it was an carnivorous Island. The fresh water tur

How to add custom theme to new blogger?

Even though blogger come with many themes they don't seems satisfying but luckily we don't have to rely on these themes you can add one of your own either by creating it by yourself or just download it from any site. There are many such sites which will provide you free templates for blogger. Just Google for "Free blogger templates". So below are the steps to set up a custom theme for blogger. Step I Go to your blogger dashboard as shown in Fig.1. Fig. 1 Select 'Template' option from the panel to the left hand side of the dashboard. The option is circled in the Fig. 1. Step II Clicking on template will bring the Template page (Refer Fig.2). If you scroll down on this page you will find different basic templates provided by blogger.They are quite beautiful in-fact but we are talking about adding a custom theme so we won't go in detail of this :) . Method 1 ) The one way of creating a custom theme is by clicking on "Customi

Check if the browser is safari using javascript

For checking if the browser is safari or not you can use below javascript function. function isSafari() {      var is_safari = navigator.userAgent.toLowerCase().indexOf('safari/') > -1;      if(is_safari)     {          return true;     }     else     {         return false;     } } The above method will return true or false depending on the browser. i.e.  if the browser is safari then the above method will return true and if it's not then the method will return false. Hope this will help :)

Get Selected value from Listbox Javascript

Since there is no direct way to get the selected value in the listbox you have to get it by iterating over the list.For same the code is given below. Below code will print all values in the listbox which were selected but you can modifiy the code as per your requirement. HTML code : <select id="listboxName"> <option value="1">One</option> <option value="2">Two</option> <option value="3">Three</option> </select> Javascript code : var mySelect = document.getElementById("listboxName"); for ( var i = 0 ; i < mySelect . options . length ; i ++) { if ( mySelect . options [ i ]. selected ) document . write ( " mySelect.options[i].text\n" ) } Hope this helps :)

Pac-Man Google Doodle

One my Favorites 'The Pac-Man' google doodle :) everyone of us have memories related to this game, when the colored creatures use to come near the Pac-Man are we were so scared and excited at the same time that this might kill our Pac-Man. Everything was just amazing about this game. Simple graphics and great fun and when google released the Google doodle pac-man all those amazing memories were back. Thank you google for giving our pac man back to us.

Enabling/Disabling Textbox using JavaScript

Below is the example for enabling or disabling of the text box whose id is "testTextbox". HTML code of the text box <p>   <input type="text" id="testTextbox" ></input> </p> Javascript code for enabling the text box document.getElementById("testTextbox").disabled = false; Javascript code for disabling the text box document.getElementById("testTextbox").disabled = true; you can add the above javascript code in any of the javascript function you want and call it on some event or you can keep them disabled by keeping the input tags attribute to disabled like this they will always remain disabled and then you can enable them on some event

Learn GRE vocabulary in fun way

I really found this helpful for remembering the GRE word list.I found it on a blogger but it's a property of vocab ahead. You can find the full word list at http://www.vocabahead.com/StudyRoom/tabid/61/Default.aspx Really thankful to vocabahead :)

Ternary Operator in Java and Javascript

Ternary Operators are basically replacement for if-else condition. Below is the example for java: if(condition == true) {     System.out.println("Condition is true"); } else {    System.out.println("Condition is false"); } The above example can be replaced by a ternary operator as : (condition == true)?System.out.println("Condition is true"):System.out.println("Condition is false"); The syntax remains almost same for javascript : if(condition == true) {     alert("Condition is true"); } else {    alert("Condition is false"); } (condition == true)?alert("Condition is true"):alert("Condition is false"); Ternary Operators reduces the readability of the code little bit but they give a better performance. If you are using if-else condition and there are millions of records to be processed then go for ternary operator.

Mark more than 100 mails as read in less than 10sec

I was going through my inbox and I realized I have more than 1000 emails that were unread, actually i don't need them either so I starting searching for a way for marking all these email as read rather than selecting them and marking as read. Below are my findings for the same : With this tip you can mark all of your emails as read. Step 1 : Open your inbox and select some email. Step 2 : Click on 'More' button which will show more options in that select "Filter messages like these". Step 3 : Clear all the fields and just put 'DOCFF55' in "Doesn't have:" text box. Step 4 : Click on "Next Step" Step 5 : Select "Mark as read" Step 6 : Check the check box next to "Create Filter" button. Step 7 : Click "Create Filter" Done !! You can also refer to the youtube video where I got the solution :) http://www.youtube.com/watch?v=zxzTFADzk2c

How to check if the postgres server is running?

Change your directory to /etc/init.d you can do that by running below command: > cd /etc/init.d then run below command for checking postgresql service > ls                         Note:  this command will list the objects in the init.d directory and this is not specific to postgres. check if the postgresql is present in the result returned by ls cmd. If it's not present then your postgres is not installed properly and try installing again. If the postgresql is present then run below cmd : > postgresql status this will ask you for postgres possword enter the password. this will return something like this : pg_ctl: server is running (PID: 6171) /usr/local/pgsql/bin/postgres "-D" "/usr/local/pgsql/data" [ Note : The status above indicates the server is up and running] If the server is not returning then it will be like : pg_ctl: no server running

How to login into Postgres using terminal in Linux

The default location of postgres in linux is : /opt/PostgreSQL/8.4/ You can go to this location by typing the below command > cd /opt/PostgreSQL/8.4/ change to bin directory > cd bin/ Now for logging into the postgres run following command : > /opt/PostgreSQL/8.4/bin/psql -U postgres where 'postgres' is the username that was asked to you while installing the postgres.After this command it will ask you for password. Then enter the password and you are logged in.

If condition in jstl tags

For using JSTL ( J SP S tandard T ag L ibrary) you must include the below code in your jsp page : <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> After including this you can use the JSTL tags in your jsp page with prefix as 'c'. Using if condition in the jsp : <c:if test="${variableName=='test'}">      <label>The condition is true</label> </c:if> this will show an label on the the jsp page as "The condition is true" if it satisfies the mentioned condition.

Set div background image from javascript

While working with JavaScript and html many time this happens that you need to set some CSS property via  JavaScript  .One of the scenario that I faced was setting div's background image via a  JavaScript  function. I had following code : <div id="tree" style="width:200px; height:150px;">    Test data  </div> Now while loading the page I had few condition depending on that it should set the background image of the div.So, I created a function in JavaScript and called it onLoad of the body tag in the html page. That JavaScript method is as following : function changeDivBackground() {      document.getElementById("tree").style.background = "url('images/backgroundImage.jpg')"; } This will set the background image for the div.

MySQL : can't rmdir './demo/' errno 17

Problem : "can't rmdir './test/' errno 17"   Error comes while dropping a database. Reason : For maintaining the data present in the databases MySQL maintains directory. These directories have same name as the database name. While executing the "drop database demo;" command for dropping the database if it's not able to delete it's directories then it throws the above exception Solution : This issue can be solved by manually deleting the database data related directory from the installed directory. Where is the data directory present for MySQL database in windows ? The default location of this directory would be : C:\Program Files (x86)\MySQL\MySQL Server 5.0\data Inside data directory you will see folders present for all the databases, in my case it is 'demo' folder. Deleting this folder solves my problem.

What are DSLR cameras?

DSLR stands for Digital Single Lens Reflex. Unlike other cameras DSLR have only one lens. Tthe photographer looks directly through the lens via a mirror so he gets what he sees. So when a photographers clicks a photo there is a voice produce by the camera that is due to mirror moves out of the way of the lens and the light falls directly on the lens that is the reason why the photographer sees a blackout.

How to create RSS feed for blogger ?

What is RSS? RSS stands for Really Simple Syndication This will keep sending the data to the users whoever is subscribed to your RSS feed link. It's like a content delivery vehicle which delivers all new data to the users. There are two types of RSS feeds. 1) Partial RSS Feeds : This will only send the headline of your newly published posts. 2) Full RSS feeds : This sends the whole content of the posts. Creating a full RSS feed url : Just add "/feeds/posts/default?alt=rss" in front of your url and this will become your RSS feed url. You can try with the below one :) http://apdynamicviews.blogspot.com/feeds/posts/default?alt=rss

Sticky notes for windows 7 : Large Note gadget

It's one of the most useful gadget that I found so far on windows 7. You can download it from here. The font present in it is great the typical yellow colors that we have for sticky notes make it look more beautiful, though you can change the color of the notes to your favourite. You can also add multiple pages in this. http://windows7themes.net/windows-7-notepad-gadget.html Another way to have a sticky notes on your windows 7 is by clicking on "Start" button and search for "Sticky notes" and there it is, the inbuilt sticky notes by Microsoft for windows 7.

Water is life.Save water! Save life!

EXIF : Canon EOS 1000D | f/5.6 | 1/60sec | ISO-400 | 55mm Did little post processing to achieve this.

Difference between getAttribute and getParameter

getParameter() -------------------------------------------- This is used for sending a parameter from client side to server side. Example : On client side  :    http://test.com/servlet?parameter=hi On server side :   request.getParameter('parameter'); The value returned by the request.getParameter is always "String". So, even if you are sending a numeric value in the parameter, on server side it will be treated as string only. So if you want a different data type in that case you have to typecast it. For example if you want a Long value from the parameter which is set as :  http://test.com/servlet?parameter=1 then (Long) request.getParameter('parameter'); this will return a Long value but do check for null value else it will throw an NullPointerException. getAttribute() -------------------------------------------- This is commonly used on server side. You can setAttribute value like this:  setAttribute('nameOfAttribute',valueOfAttr

Olympic Google Doodle Soccer

Previous Play it here :  https://www.google.com/doodles/soccer-2012 It was fun playing soccer. My score 46 three stars :) You might also like : Google Doodle Olympics 2012 Google Doodle Hurdle race Google Doodle Slalom-canoe / rowing Google Doodle Basketball

Adding/Removing label from blog post : Blogger

You can add label to your post for better management of the post and also your blog users can find topics more relevant to their requirements. So let's start with adding a label to your post : Step 1 : Go to your design dashboard and click on post link which is present at your left hand side.This will show you all of your post that you have posted so far. Fig. 1 Step 2 : Now select the post to whom you want to assign labels. Step 3 : Click on the label like icon on the right hand side (highlighted in the below image). This will show you a dropdown which will list all the labels that you have created so far, if there are no labels present then it will just show you "New Label..." text. Fig. 2 Click on New Label... text which will show you an pop up with a text field in it. Enter your desired label name and click on Ok. This will add your selected post under that label. Fig. 3 Removing a Label for a post : Follow till step 2 then click on the

Olympics Google Doodle Slalom-Canoe / Rowing

  Previous  Next Google doodle rowing games. Looking forward for few more. My score : 20.5s Two stars.  :) You can play it here :  https://www.google.com/doodles/slalom-canoe-2012 Let me know if you break my record :) You might also like : Google Doodle Olympics 2012 Google Doodle Hurdle race Google Doodle Basketball

How databasechangeloglock and databasechangelog table used by liquibase?

Liquibase takes care of executing the query on the database while maintaining the list of queries executed and also maintaining the locks over the tables simultaneously. The two tables that are used by the liquibase for this purpose are : Databasechangeloglock : This table have following columns ID | LOCKED| LOCKGRANTED | LOCKEDBY. This maintains the locks information granted to the user. The primary purpose of this table is to make sure that two machines don't attempt to modify the data at the same time. Databasechangelog : This table have following columns ID | AUTHOR | FILENAME | DATEEXECUTED | ORDEREXECUTED | EXECTYPE | MD5SUM | DESCRIPTION | COMMENTS | TAG | LIQUIBASE This table maintains the list of the statements that are executed on the database.

liquibase.exception.LockException: Could not acquire change log lock. Currently locked by...

liquibase.exception.LockException: Could not acquire change log lock. Currently locked by... Solution : Open your database and find the table named 'Databasechangeloglock', check the content of the Locked column. If it is set to '1' in that case the above exception will be thrown. Try setting it to '0' and set content of the 'LOCKGRANT' and 'LOCKEDBY' to (null). You might find this interesting. http://apdynamicviews.blogspot.in/2012/08/how-databasechangeloglock-and.html

Olympic Google Doodle Basketball

Previous   Next http://www.google.com/doodles/basketball-2012 Another great doodle from google but may be the craze that the hurdle race created was not there. Still enjoyed playing the basketball after a long time. My Score : 33s Two stars :) You might also like : Google Doodle Olympics 2012 Google Doodle Hurdle race Google Doodle Slalom-canoe / rowing

Difference Between LinkedList and Arraylist

Array list and linked list both implements list interface. ArrayList is more popular amongst programmer.The main difference between Arraylist and Linked list is arraylist implemented using re sizable array while linkedlist is implemented using doubly linked list. ArrayList LinkedList Arraylist is an index based data structure.Array provides O(1) performance for get(index) method but remove is costly in ArrayList as you need to rearrange all elements. LinkedList doesn't provide Random or index based access and you need to iterate over linked list to retrieve any element which is of order O(n). In case of arraylist for updating the list anywhere other than end of the list need re-indexing of the list. Insertion are easy and fast in linked list because there is no risk of resizing the data and copying the data into new array. ArrayList only have the data object Linked list has both data and address to the next link.Hence linked list has more

Olympics Google doodle Hurdles

Previous   Next http://www.google.com/doodles/hurdles-2012 Woww another great doodle from Google.Loved it.Tried it few hundred times :). It's just great. My score : 11.09s and Three stars :) You might also like : Google Doodle Olympics 2012 Google Doodle Basketball Google Doodle Slalom-canoe / rowing

Olympics 2012 Google Doodles

  Next Really love them "The Olympics 2012 Google Doodles" waiting for more :) You might also like : Google Doodle Hurdle race Google Doodle Basketball Google Doodle Slalom-canoe / rowing

A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance : Solved

This usually happen when the child entities are not referred by the parent entities. This might happen if you are setting a new object using the setter method of this child entity. For Example : parent.setChildrens(new ArrayList<?>); // This create the problem because in this case the parent won't find any reference to the original entity. Solution : parent.getChildrens().clear(); parent.getChildrens().addAll( collection) This will solve the problem

Java Uses both compiler and interpreter

Java is both compiled and interpreted language.First Java source code has to be translated into Byte code, which is done with the help of a compiler.But these byte codes are not machine instructions. Therefore ,in second stage this byte code has to be translated into machine code.This task is performed by an Interpreter.Hence, Java use both compiler and interpreter. Read more: http://wiki.answers.com/Q/Why_does_java_use_both_compiler_and_interpreter#ixzz22azx8Bfs

Java Hello World program

Before starting working with java I am assuming that you have jdk installed on your local machine. You can start writing java program using a notepad. Below are the steps for writing hello world program in java : 1) Create a file and rename it to HelloWorld.java 2) Open the above file and put the blow code in it 1| public class HelloWorld 2| { 3|   public static void main(String args[]) 4|   { 5|       System.out.println("Hello World"); 6|   } 7| } 3) Save the file. 4) Open a command prompt go to the location where u have saved this file and run the following command : C:>javac HelloWorld.java 5) This should run successfully with no errors. 6) Now run it using below command : C:>java HelloWorld 7) This should run successfully and should show you "Hello World" message on command prompt. 8) Congrats you are done with your first java program. Description : Line No.1 It's the declaration of a class. public * : It's a java acces