Posts Tagged ‘How-To’

How to: Reset MySQL root password

Resetting the root password of a MySQL database is trivial if you know the current password if you don't it is a little trickier. Thankfully it isn't too difficult to fix, and here we'll show one possible way of doing so.If you've got access to the root account already, because you know the password, you can change it easily:gaurav@gaurav:~$ mysql --user=root --pass mysql Enter password:mysql> update ...

How to: Capture browser close button event or exiting the page in javascript.

A lot of times we have requirement to do some stuff like invalidating session whenever user clicks browser close button thereby invoking close event in browser.Let us see how to achieve this using JavaScript. In JavaScript we have events such as onbeforeunload and onunload. These events as their name suggest, gets triggered whenever the page gets unload. This happens if user close the browser or ...

Dynamic combobox-listbox-drop-down using javascript

Dynamic combobox-listbox-drop-down using javascript
Want to populate dynamically combobox-listbox-drop-down using javascript? Let us see a very simple script to do this. First let us see createElement() of document object in javascript.//Create a table element dynamically var table = document.createElement("table");//Create a select element dynamically var select = document.createElement("select");//Create a option element dynamically var option = document.createElement("option");Thus, createElement method takes a parameter which is the string that specifies the name for the element node ...

Get Autoincrement value after INSERT query in MySQL

Lot of time we have requirement to update two tables simultaneously. Say for example, we have two tables CUSTOMER_DETAILS and CUSTOMER_ADDRESS. While adding a row in CUSTOMER_DETAILS, few details like address is first written in CUSTOMER_ADDRESS and its reference is added in CUSTOMER_DETAILS table. Now if ADD_ID is a primary key in CUSTOMER_ADDRESS table and if it is an auto increment field than how to ...

Creating orkut style status update div-textbox using jQuery.

Creating orkut style status update div-textbox using jQuery.
You must have seen orkut style status update box where in the details can be modified by clicking on it. Once user click the details, details gets populated inside a textbox and an update button. Once update button is clicked, the data gets updated in database.Similar status update box is available in wordpress ...

Creating ZIP and JAR Files in Java

ZIP files offer a packaging mechanism, allowing multiple files to be bundled together as one. Thus, when you need to download a group of files from the web, you can package them into one ZIP file for easier transport as a single file. The bundling can include additional information like directory hierarchy, thus preserving necessary paths for an application or series of resources once unbundled.This ...

Textbox with background image using CSS

Textbox with background image using CSS
All we need in order to create an input box like this is an image of a magnifying glass and some CSS code.This input box is simply created by adding a background image to the the input tag and a left padding so that the text doesn't overlap the background image. Download following image:This is an example of the CSS:.searchBox{ background-image:url('images/magnifying-glass.gif'); background-repeat:no-repeat; padding-left:20px; }Now, ...
Tags: ,

Multiple message resource property file in Struts

Recently I came up with a requirement where in we have to display messages from multiple bundle resource (message resource) property files in Struts using <bean:message>. Following are the steps for the same:Make an entry of message resource file name in struts-config.xml file.Once this is done, the message resource file can be accessed by using the key (in this case we have ...

MySQL Change root Password

Setting up mysql password is one of the essential tasks. root user is MySQL admin account. Please note that Linux / UNIX login root account for your operating system and MySQL root are different. They are separate and nothing to do with each other (indeed some admin removes root account and setup admin as mysql super user). mysqladmin command to change root password If you have never ...
Tags: ,

Files-Directory listing in Java

This example lists the files and subdirectories in a directory.File dir = new File("directoryName"); String; } } // It is also possible to filter the list of returned files. // This example does not return any files that start with ...
Page 4 of 512345
Copyright © 2012 ViralPatel.net. All rights reserved.