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

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

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

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.

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:

  1. Install .NET Framework, if not installed.
  2. Set the path of the .NET Framework Edition in environment variables or by using SET PATH command.
  3. ex: C:\Windows\Microsoft.NET\Framework\v3.5
  4. 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
        }
    }
  5. Open command prompt, change the directory to specified folder(ex: D:\csharp\)
  6. Execute the following command
  7. cmd> csc trail.cs
  8. We will get trail.exe in the specified folder(ex: D:\csharp\), if it executed successfully
  9. Double click the trail.exe and see the output.
  10. We have successfully executed C#(C sharp) code without visual studio and with .NET Framework only
References:
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

February 24, 2011

Know Your Indian Train Reservation Berth Details Like Berth Position etc.

Hi everyone,

I booked my train ticket even it is in WaitingList. Because, I guessed that, It will get confirmed when chart prepares. After the chart preparation, my train ticket was confirmed with the berth number. They didn't put the information like, which berth it is? Is it Lower, Middle, Upper, SideLower or SideUpper.
I was curious to know the berth position. In the return journey, I thought like "why can't we know the berth position after having the berth number". And I just tried this logic in javascript because, you can give your train berth number and get the berth position in my blog itself.



Please enter your train berth number of Sleeper Class Or III Tier AC and click on the Disply Berth Position button.



I have created an Android application for this utility and its freely available in the market.
Android App supports from Android OS 2.1 Eclair and above.

You can download it from this link Train Berth Position Android App

Android app on Google Play
Train Berth Position Android App
If you have a android smartphone with QR reader then scan the below QR code to redirect you to Google Play and download the app with in no time.
Scan this QR to open app in Google Play
Please send your comments and feedback to psrdotcom@gmail.com

Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com