Skip to main content

Posts

Showing posts from August, 2012

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