Hi everyone,
Today, I have come across one situation where money(currency) field has to be validated. According to Indian currency, we will consider 2 digits after period(.)
When I want to validate the particular field, I have tried with substring() and indexOf() methods. But I am not getting the expected result. I want to have the output ending with .##, So, I have come to know about NumberFormat class from java.text package.
Here goes sample code with output:
Input: 234 / 234.232 / 234.3
Output: 234.0 / 234.23 / 234.3
NumberFormat nf = new DecimalFormat(".##");
System.out.println("Input: "+234+"Output: "+nf.format(234));
Please send your feedback and queries to psrdotcom@gmail.com
August 09, 2011
June 24, 2011
Android Number Input Field Validation
Input Field Validation:
code:
editText.setOnFocusChangeListener(new OnFocusChangeListener(){
@Override
public void onFocusChange(View v,boolean hasFocus)
{
//check for emptiness
if(editText.length()==0)
{
editText.setError(error_required);
}
else if(!numberValidation(editText.getText().toString()))
{
editText.setError("Only Numbers");
}
}
}
);
In main.xml add,
EditText tag, android:numeric="integer/number/decimal"
References:
http://phaniraghav.wordpress.com/2011/05/07/android-edittext-validations-2/
http://stackoverflow.com/questions/5218691/display-input-validation-errors-in-popup
code:
editText.setOnFocusChangeListener(new OnFocusChangeListener(){
@Override
public void onFocusChange(View v,boolean hasFocus)
{
//check for emptiness
if(editText.length()==0)
{
editText.setError(error_required);
}
else if(!numberValidation(editText.getText().toString()))
{
editText.setError("Only Numbers");
}
}
}
);
In main.xml add,
EditText tag, android:numeric="integer/number/decimal"
References:
http://phaniraghav.wordpress.com/2011/05/07/android-edittext-validations-2/
http://stackoverflow.com/questions/5218691/display-input-validation-errors-in-popup
May 27, 2011
MD5, SHA1 checksum with Example to check the hash value for Integrity
What is hashing, everyone talks about hashing, data integrity etc.
let me explain with an example.
Download some file source or executable with md5 and sha1, for example purpose we used OpenSSL
Downloaded openssl-1.0.0d.tar.gz, MD5 and SHA1
Now we will compute md5 and sha1 from our side and verify, whether downloaded file is not modified by any other user.
Download FCIV(File Checksum Integrity Verifier) in windows. In Linux, use md5sum, sha1sum to check the integrity of the file.
I have tried the following commands in Windows
// Computing md5 of the file
E:\> fciv.exe -add openssl-1.0.0d.tar.gz
40b6ea380cc8a5bf9734c2f8bf7e701e openssl-1.0.0d.tar.gz
// Comparing with the downloaded md5 file
E:\> type openssl-1.0.0d.tar.gz.md5
40b6ea380cc8a5bf9734c2f8bf7e701e
// Computing sha1 of the file
E:\> fciv.exe -add openssl-1.0.0d.tar.gz -sha1
32ca934f380a547061ddab7221b1a34e4e07e8d5 openssl-1.0.0d.tar.gz
// Comparing with the downloaded sha1 file
E:\> type openssl-1.0.0d.tar.gz.sha1
32ca934f380a547061ddab7221b1a34e4e07e8d5
Now, we can say that, file integrity was maintained.
Please send the feedback to psrdotcom@gmail.com
let me explain with an example.
Download some file source or executable with md5 and sha1, for example purpose we used OpenSSL
Downloaded openssl-1.0.0d.tar.gz, MD5 and SHA1
Now we will compute md5 and sha1 from our side and verify, whether downloaded file is not modified by any other user.
Download FCIV(File Checksum Integrity Verifier) in windows. In Linux, use md5sum, sha1sum to check the integrity of the file.
I have tried the following commands in Windows
// Computing md5 of the file
E:\> fciv.exe -add openssl-1.0.0d.tar.gz
40b6ea380cc8a5bf9734c2f8bf7e701e openssl-1.0.0d.tar.gz
// Comparing with the downloaded md5 file
E:\> type openssl-1.0.0d.tar.gz.md5
40b6ea380cc8a5bf9734c2f8bf7e701e
// Computing sha1 of the file
E:\> fciv.exe -add openssl-1.0.0d.tar.gz -sha1
32ca934f380a547061ddab7221b1a34e4e07e8d5 openssl-1.0.0d.tar.gz
// Comparing with the downloaded sha1 file
E:\> type openssl-1.0.0d.tar.gz.sha1
32ca934f380a547061ddab7221b1a34e4e07e8d5
Now, we can say that, file integrity was maintained.
Please send the feedback to psrdotcom@gmail.com
May 18, 2011
Boot Windows XP, Vista, 7 from USB Pen Drive
Hi everyone,
I was thinking that, How can I get rid of carrying DVD to install OS on friend's laptop. When I googled, I got some useful info and want to share with you ppl.
Please use the following commands to make USB Bootable with Windows OS
STEP 1: Make USB Ready to made bootable
1) Run Diskpart, In Windows Vista and 7 it has come default, I think in Windows XP you need to install Diskpart.
2) New Window with Diskpart as prompt will be opened.
DISKPART>
3) See the connected disks by running
DISKPART> list disk
4) Select the USB disk with its name of the list disk command output. The output usually comes as disk 0, disk 1 etc.
DISKPART> select disk 1
5) Clean the disk by typing the command
DISKPART> clean
6) Make the disk partition as primary
DISKPART> create partition primary
7) Select the partition
DISKPART> select partition 1
8) Activate the partition
DISKPART> active
9) Format the partition with NTFS filesystem
DISKPART> format fs=NTFS
10) Type following command to exit
DISKPART> assign
DISKPART> exit
Now the disk is formatted and ready to made bootable
STEP 2: Make USB Bootable
Make USB drive as bootable by executing following commads
1) Insert or mount the Windows OS disk
Ex: DVD Drive path say G:
2) Use the bootsect.exe to make the USB bootable.
a) Open CommandPrompt
b) Change the directory to G:
cmd> G:
c) Change to boot directory
G:> cd boot
d) Run the following command to make USB Bootable, assume USB drive is H:
G:/boot> bootsect /nt60 h:
3) Close the command prompt
G:/boot> exit
STEP 3: Copy OS to USB
Say Example Windows OS DVD drive is G: and USB Drive is H:
Run the following commands to copy the contents from DVD to USB
i) cmd> G:
ii) G:> copy *.* h: /Y /V (or) xcopy /s *.* h:/
STEP 4: Install Windows OS from USB Drive
Please restart and boot from the USB drive to install Windows OS
References:
http://kmwoley.com/blog/?p=345
Please send your valuable feedback to psrdotcom@gmail.com
I was thinking that, How can I get rid of carrying DVD to install OS on friend's laptop. When I googled, I got some useful info and want to share with you ppl.
Please use the following commands to make USB Bootable with Windows OS
STEP 1: Make USB Ready to made bootable
1) Run Diskpart, In Windows Vista and 7 it has come default, I think in Windows XP you need to install Diskpart.
2) New Window with Diskpart as prompt will be opened.
DISKPART>
3) See the connected disks by running
DISKPART> list disk
4) Select the USB disk with its name of the list disk command output. The output usually comes as disk 0, disk 1 etc.
DISKPART> select disk 1
5) Clean the disk by typing the command
DISKPART> clean
6) Make the disk partition as primary
DISKPART> create partition primary
7) Select the partition
DISKPART> select partition 1
8) Activate the partition
DISKPART> active
9) Format the partition with NTFS filesystem
DISKPART> format fs=NTFS
10) Type following command to exit
DISKPART> assign
DISKPART> exit
Now the disk is formatted and ready to made bootable
STEP 2: Make USB Bootable
Make USB drive as bootable by executing following commads
1) Insert or mount the Windows OS disk
Ex: DVD Drive path say G:
2) Use the bootsect.exe to make the USB bootable.
a) Open CommandPrompt
b) Change the directory to G:
cmd> G:
c) Change to boot directory
G:> cd boot
d) Run the following command to make USB Bootable, assume USB drive is H:
G:/boot> bootsect /nt60 h:
3) Close the command prompt
G:/boot> exit
STEP 3: Copy OS to USB
Say Example Windows OS DVD drive is G: and USB Drive is H:
Run the following commands to copy the contents from DVD to USB
i) cmd> G:
ii) G:> copy *.* h: /Y /V (or) xcopy /s *.* h:/
STEP 4: Install Windows OS from USB Drive
Please restart and boot from the USB drive to install Windows OS
References:
http://kmwoley.com/blog/?p=345
Please send your valuable feedback to psrdotcom@gmail.com
April 23, 2011
Devotional Trip to Ahobilam and Mahanandi
Hi everyone,
Myself, along with 2 other friends visited Ahobilam and Mahanandi.
We started our journey from Hyderabad to Aallagadda (Place near to Ahobilam) at night.
We reached Aallagadda by 7AM. From Aallagadda, with in 45 minutes, we reached Ahobilam.
In TTD Guest house, our refreshment was done. Then we had breakfast from A.P.Tourism Hotel.
@11:00AM: We first visited, Lower Ahobilam Temple, Which is very beautiful. On that day, "Swamy vari kalyanam" is going on and we are very lucky to see the "swami vari kalyanam"
@11:35AM: From Lower Ahobilam to Upper Ahobilam, we had taken Autorickshaw on sharing basis. Road and everything is fine and good. We enjoyed the journey.
@12:10PM: In Upper Ahobilam, we first visited "Ugra Narasimhaswamy Temple", which is quite easy to walk and go.
@12:25PM: But from then onwards, we have to do trekking to reach the other temples. If you are planning with the family members(especially Ladies), then please don't try to do the trekking. Its difficult to go. Please wear shoe, while you are planning trekking.
@1:30PM: After trekking for about 5km, we reached "Jwala Narasimha Swamy" temple. From there we can further but due to whether condition, we withdrawn to go further.
@1:40PM: While returning, we had come across "Malola Nrusimha Swamy" Temple. We got to halt there for a while due to rain. After some half an hour, we started our return journey. Since, it was after rain, the surface and stones are very slippery. Slowly we had come down. Please carry water and some eatables like carrot(to get energy)
@3:05PM: To return from Uppder Ahobilam to Lower Ahobilam, we had choosen Autorickshaw again.
@3:30PM: In Lower Ahobilam, we had our lunch.
@4:00PM: We started our journey towards Mahanandi via Aallagadda->Nandyala (Since we went by bus, there is no other route as such), If you are planning by car, then it is very easy to visit all these places in less time.
@7:00PM: We reached Mahanandi, and had bath in the inside lake. The water is very clean and had fun. Go with family and friends, we will have lot of fun here.
@8:30PM: We had dharshan and plan to return from Mahanandi to Nandyala.(Since it is night time, we are unable to take more pics)
@9:15PM: We reached Nandyala, and booked return ticket to Hyderabad.
Overall the trip is very good and joyful.
Myself, along with 2 other friends visited Ahobilam and Mahanandi.
We started our journey from Hyderabad to Aallagadda (Place near to Ahobilam) at night.
We reached Aallagadda by 7AM. From Aallagadda, with in 45 minutes, we reached Ahobilam.
In TTD Guest house, our refreshment was done. Then we had breakfast from A.P.Tourism Hotel.
@11:00AM: We first visited, Lower Ahobilam Temple, Which is very beautiful. On that day, "Swamy vari kalyanam" is going on and we are very lucky to see the "swami vari kalyanam"
@11:35AM: From Lower Ahobilam to Upper Ahobilam, we had taken Autorickshaw on sharing basis. Road and everything is fine and good. We enjoyed the journey.
@12:10PM: In Upper Ahobilam, we first visited "Ugra Narasimhaswamy Temple", which is quite easy to walk and go.
@12:25PM: But from then onwards, we have to do trekking to reach the other temples. If you are planning with the family members(especially Ladies), then please don't try to do the trekking. Its difficult to go. Please wear shoe, while you are planning trekking.
@1:30PM: After trekking for about 5km, we reached "Jwala Narasimha Swamy" temple. From there we can further but due to whether condition, we withdrawn to go further.
@1:40PM: While returning, we had come across "Malola Nrusimha Swamy" Temple. We got to halt there for a while due to rain. After some half an hour, we started our return journey. Since, it was after rain, the surface and stones are very slippery. Slowly we had come down. Please carry water and some eatables like carrot(to get energy)
@3:05PM: To return from Uppder Ahobilam to Lower Ahobilam, we had choosen Autorickshaw again.
@3:30PM: In Lower Ahobilam, we had our lunch.
@4:00PM: We started our journey towards Mahanandi via Aallagadda->Nandyala (Since we went by bus, there is no other route as such), If you are planning by car, then it is very easy to visit all these places in less time.
@7:00PM: We reached Mahanandi, and had bath in the inside lake. The water is very clean and had fun. Go with family and friends, we will have lot of fun here.
@8:30PM: We had dharshan and plan to return from Mahanandi to Nandyala.(Since it is night time, we are unable to take more pics)
@9:15PM: We reached Nandyala, and booked return ticket to Hyderabad.
Overall the trip is very good and joyful.
April 06, 2011
Compile and Execute C# (C sharp) code without Visual Studio and with .NET Framework
Hi everyone,
Today I have come across executing C# (C Sharp) code with out Visual Studio, but you must have .NET Framework installed on your computer.
Procedure:
http://blogs.oberon.ch/tamberg/2007-10-17/compiling-csharp-without-visual-studio.html
Please post your comments and feedback.
Today I have come across executing C# (C Sharp) code with out Visual Studio, but you must have .NET Framework installed on your computer.
Procedure:
- Install .NET Framework, if not installed.
- Set the path of the .NET Framework Edition in environment variables or by using SET PATH command. ex: C:\Windows\Microsoft.NET\Framework\v3.5
- Write the C# script, Save file with extension .cs
ex: D:\csharp\trail.cs
using System;
public class Example
{
public static void Main()
{
Console.Write("\nIts Done\n");
Console.ReadLine(); //Waits until user press Return(Enter) key
}
} - Open command prompt, change the directory to specified folder(ex: D:\csharp\)
- Execute the following command cmd> csc trail.cs
- We will get trail.exe in the specified folder(ex: D:\csharp\), if it executed successfully
- Double click the trail.exe and see the output.
- We have successfully executed C#(C sharp) code without visual studio and with .NET Framework only
http://blogs.oberon.ch/tamberg/2007-10-17/compiling-csharp-without-visual-studio.html
Please post your comments and feedback.
March 16, 2011
Schedule your GMail Messages. Send mails even you logged out of GMail.
Hi everyone,
Today I come across scheduling our GMail messages with browser extension.
Scheduling the mail is possible in GMail if you have Google Chrome or Firefox now.
Even you logout of the GMail, it will automatically send the mail at the scheduled time.
Just follow these steps to schedule your e-mail.
1) Download these extension in Google Chrome or Mozilla Firefox browser and follow the instructions.
http://www.boomeranggmail.com/download.html
2) Click on Boomerang link (Top-Right, Before your mail id name)
3) New window will be opened, Click on Allow button.
4) In GMail, Compose one new message with subject and content.
5) Click on Send Later (After Send Button) to schedule your mail.
6) If you want to send at specific time, first save the message and select "At Specific Time".
7) Select Date and give the Time in the following format
mm/dd/yyyy hh:mi AM/PM
8) Click on confirm button.
9) You can see your scheduled messages in Boomerang-Outbox folder in GMail or in Boomerang window, by clicking the Boomerang link on Top-Right of the window.
Please send your comments and feedback to psrdotcom@gmail.com
Today I come across scheduling our GMail messages with browser extension.
Scheduling the mail is possible in GMail if you have Google Chrome or Firefox now.
Even you logout of the GMail, it will automatically send the mail at the scheduled time.
Just follow these steps to schedule your e-mail.
1) Download these extension in Google Chrome or Mozilla Firefox browser and follow the instructions.
http://www.boomeranggmail.com/download.html
2) Click on Boomerang link (Top-Right, Before your mail id name)
3) New window will be opened, Click on Allow button.
4) In GMail, Compose one new message with subject and content.
5) Click on Send Later (After Send Button) to schedule your mail.
6) If you want to send at specific time, first save the message and select "At Specific Time".
7) Select Date and give the Time in the following format
mm/dd/yyyy hh:mi AM/PM
8) Click on confirm button.
9) You can see your scheduled messages in Boomerang-Outbox folder in GMail or in Boomerang window, by clicking the Boomerang link on Top-Right of the window.
Please send your comments and feedback to psrdotcom@gmail.com
Subscribe to:
Posts (Atom)
Featured Post
Java Introdcution
Please send your review and feedback to psrdotcom@gmail.com
-
Hi all, I spent 2 days on configuring this. I read lot of blogs and instrutction steps from various sites. I would like share my experienc...
-
Hi folks, Today we will see how we can get the folder path of the windows user specific app data for storing any program (app) based inform...
-
For the academic purpose i had written a small program in Matlab. I have tried encoding and decoding the image by using Huffman coding. ...