Sunday, 26 June 2016

reverse of string in java with or without StringBuffer

How to reverse String in Java with or without StringBuffer Example


Reverse String in Java
There are many ways to reverse String in Java. You can use rich Java API to quickly reverse contents of any String object. Java library provides StringBuffer and StringBuilder class with reverse() method which can be used to reverse String in Java. Since converting between String and StringBuffer or StringBuilder is very easy it's the most easy way available to reverse String in Java. At the same time Writing Java program to reverse String in Java without StringBuffer is one of the popular Java String interview question, which requires you to reverse String by applying logic and by not using API methods. Since reverse is a recursive job, you can use recursion as well as loop to reverse String in Java. In this Java tutorial I have shown How to reverse String using StringBuffer, StringBuilder and using pure loop with logic. You can also checkHow to reverse String with recursion in Java, if you want to see recursive code. let's see complete Java program for this beautiful Java programming exercise.

program::

/**
 *
 * Java program to reverse String in Java. There are multiple ways to reverse
 * String in Java, you can either take help of standard Java API StringBuffer
 * to reverse String in Java. StringBuffer has a reverse() method which return StringBuffer
 * with reversed contents. On the other hand you can also reverse it by applying your
 * own logic, if asked to reverse String without using StringBuffer in Java. By the way
 * you can also use StringBuilder to reverse String in Java. StringBuilder is non thread-safe
 * version of StringBuffer and provides similar API. You can use StringBuilder's reverse()
 * method to reverse content and then convert it back to String
 *
 * @author http://java67.blogspot.com
 */

public class StringReverseExample {


    public static void main(String args[]) {
   
        //quick wasy to reverse String in Java - Use StringBuffer
        String word = "HelloWorld";
        String reverse = new StringBuffer(word).reverse().toString();
        System.out.printf(" original String : %s , reversed String %s  %n", word, reverse);
   
        //another quick to reverse String in Java - use StringBuilder
        word = "WakeUp";
        reverse = new StringBuilder(word).reverse().toString();
        System.out.printf(" original String : %s , reversed String %s %n", word, reverse);
   
        //one way to reverse String without using StringBuffer or StringBuilder is writing
        //own utility method
        word = "Band";
        reverse = reverse(word);
        System.out.printf(" original String : %s , reversed String %s %n", word, reverse);
    } 


    public static String reverse(String source){
        if(source == null || source.isEmpty()){
            return source;
        }    
        String reverse = "";
        for(int i = source.length() -1; i>=0; i--){
            reverse = reverse + source.charAt(i);
        }
   
        return reverse;
    }
 
}

Output:
original String : HelloWorld , reversed String dlroWolleH
original String : WakeUp , reversed String pUekaW
original String : Band , reversed String dnaB

Monday, 4 January 2016

Command Prompt Tricks, Hacks & Codes

Command Prompt Tricks, Hacks & Codes

Command Prompt is one of the most powerful tools in Windows; but sadly, it is also the most ignored one. Things were not always like this; but with the advent of GUI based operating systems, people started feeling that computing through command based tools was boring. This ultimately lead the command prompt into obscurity.

However, the command prompt is not useless. In fact, it can be pretty useful. This article provides some excellent tricks, secrets and hacks that will make you realize that the Windows Command Prompt is not only useful but also a tool that you should definitely give more respect to.

Ascii star wars command prompt
1-Watch ASCII version of the Star Wars Episode IV movie
Surprised yet? You can watch an ASCII version of the full Star Wars Episode IV Movie right in your command prompt window. Just open command prompt, type a small code and the movie will start playing immediately. Read the complete instructions here.

2- Create Matrix falling code effect
Have you watched “The Matrix”? Of course, you have. Then, you already know what I am talking about. In case you still don't know what I mean, take a look at this image! You can create the same effect in command prompt using just a few lines of code. Head over to this post for instructions.

command prompt tricks

3- Make Folders that you cannot delete
Are you tired of accidentally deleting important folders? Well, if you are, you can learn how to make undeletable folders here.

4- Shutdown your computer giving a funny reason
What if your computer shuts down saying that it is tired and doesn't want to work anymore? It would be fun, wouldn't it? You can do so by reading the instructions here.

5- Know your IP address, DNS Server's address and a lot more about your Internet Connection
Command Prompt can even let you know your IP address. Just type ipconfig/ all in the command prompt and press Enter. Along with your IP address and DNS servers, command prompt will also return a ton of information like your host name, primary DNS suffix, node type, whether IP Routing ,Wins Proxy, and DHCP are enabled, your network adapter's description, your physical (MAC) address etc .

6- Know if your neighbours are stealing your WiFi connection
command prompt codes
Command Prompt can let you know if someone is connected to your Local Area Connection and using it. Just follow the steps:-
1) Open your browser and visit http://192.168.1.1 or http://192.168.0.1 depending on your router.
2) Find the tab that mentions “Attached Devices” or something similar.
3) Find the computer name, IP address and MAC Address (sometimes called Physical Address or Hardware Address) of your computer using the previous trick.
4 )Compare it with those displayed by your router in Step 2. If you notice some strange devices, then your neighbour has been sneaking in on your internet connection and it is best to add a password.

7- Know if someone is hacking your computer/ Trace a Hacker
Command Prompt hacks
Want to know if someone is hacking your computer? Command Prompt can help you find if someone you don't know is connected to your computer stealing private data. Just execute netstat -a and the command prompt will return a list of computers that your computer is connected to. In the results returned, Proto column gives the type of data transmission taking place (TCP or UDP) , Local address column gives the port with which your computer is connected to an external computer and the Foreign Address column gives the external computer you are connected to along with the port being used for the connection. State gives the state of the connection (whether a connection is actually established, or waiting for transmission or is “Timed Out”).

These tricks work on Windows 8.1, Windows 8, Windows 7, Windows Vista, Windows XP and all previous versions of Windows.

Saturday, 8 March 2014

Trick To Surf Internet Without Browsers In Windows XP.

Trick To Surf Internet Without Browsers In Windows XP.

Hi Friends, Today we will Learn to surf internet Without Any Broswer. Everyone Knows That we Need Browsers like Google Chrome, Mozilla, Internet Explorer To browse the net. But How About If I say To Use Internet Without These Browsers ?







If  Ever You Find a PC With Windows Xp But You are Not Permitted to use Browsers To Use Internet Then This Tutorial Will Be Helpfull To you. XP Users Can Even Try this Trick in thier PC .
Step 1: Click On start > all Programs> Accessories > Calculator.
Step 2: Once You open Calculator, Click on Help and then Help Topics.
Step 3: Now Right Click On the Title Bar and Click on ” JUMP TO URL ”
Step 4: Now Just Type The URL Starting With http://

Thats it You just Browsed Internet without Any Broswer But with Calculator.

How to Open Browsers in Private Browsing Mode.

How to Open Browsers in Private Browsing Mode.


Friends Today We will Learn How to Open Browsers in Private Browsing Mode, it simply means That whenever you will start your Browser it will Directly Start in Private Browsing mode,


Private Browsing Prevents your Browser From Saving, Search Results, Browsing History, Cookies and Other Private data .
Today we will see How to Enable Private Browsing In following Browsers Every time You start it.
  1. Google Chrome
  2. Mozilla Firefox
  3. Internet explorer


Private Browsing in Google Chrome.

Google Chrome is liked by most of us and also Used by Most of us.
To enable Private Browsing in Chrome just follow the below simple Steps.

Step 1: In Google Chrome we need to Activate Incognito Mode By default On Start.
Right Click on the Google Chrome Short cut which you use to Launch Google Chrome , either on Desktop, Taskbar or Start menu and Select Properties.




For Taskbar: Right Click on the Chrome icon then right click on Google chrome the click on Properties.



Step 2: Now Click on Shortcut Tab and Add ” Space character, a dash and the Word incognito ” Exactly as shown in the picture below, then Click on OK.


Thats it Now on Google Chrome Will start In Incognito Mode next time you launch Chrome from that Shrotcut.

Private Browser in Firefox.

Private Browsing in Firefox is easy as it provides the option. 
 Step 1: Click on Firefox Menu Button and then Select Option >Option
Now click the Privacy Icon  and Select ” Never Remember History ” a dialogue box will appear saying Firefox must restart to enable this Feature, Click on OK.


Now on Firefox will never Remember your Browsing History.



Private Browsing in Internet Explorer.
Procedure For Private Browsing In Internet explorer is Almost Same As in Google Chrome. Step 1:  Right click on Internet Explorer Icon in taskbar then again Right Click on Internet Explorer and Click on Properties.

Step 2: Now Click on Shortcut Tab and Add ” Space character, a dash and the Word private ” Exactly as shown in the picture below, then Click on OK

Thats it Internet Explorer Will open In private Browsing Moden next time you Launch Internet Explorer Via that Shortucut.
Enjoy Private Browsing.

How to create your own run commands

How to create your own run commands

I hope you all already know what is a run command. But if don’t, It is a default function provided by windows OS to jump on any software you want to work on. It is like a shortcut to avoid the step by step procedure . Since it is not possible to keep icons of all the programs on the desktop, windows has equipped this RUN command for ease of use.To open the RUN window simply press Windows key and then R key on your keyboard. (i.e. Window+R). Then type any program name that you want to execute and you are done the program will start running. But the drawback is that there are only few inbuilt programs which can be used via this method. But here I am showing you the trick to create commands that are not built in within the windows and you can run any of the software by typing any keyword you wish to assign to that software.


Here are some Easy Steps to Create your Own Run Command:

STEP 1.

First of all choose the software for which you are going to make custom run command [e.g. I am going to show you the demo of custom run command for Mozilla Firefox]

STEP 2.

Right click on desktop of your system and create a new shortcut as shown in following screenshot.

STEP 3.

A dialog box will appear , asking you path of the shortcut you just created as shown below :

STEP 4.

Click on Browse button and Choose the path of the desired software

[e.g. for Mozilla firefox just browse C:\Program Files\Mozilla Firefox\firefox.exe]


STEP 5.

After completing step 4 simply cick on Next button and give the desired name to that shortcut which you will be using later in Run window.
[e.g . For Mozilla Firefox I am using ff].

STEP 6.

Now click on Finish button. With completion of step 5 an icon of that software will appear on your desktop. It will indicate that the process has been successfully completed and you are almost done.

STEP 7.

Now simply cut and paste that newly created shortcut into your root drive’s window folder.
[e.g. C:\WINDOWS] (you must need administrator privileges to do this.)

STEP 8.

Here you finished all the setup and now ready to run the software.
Simply go to Run and type the keyword you had assigned earlier in setup phase and your software will start executing.
I believe today i added something To your Knowledge. Thanks for Reading.

 

How to Remove Windows 7 Genuine Notification

How to Remove Windows 7 Genuine Notification


How to Remove Windows 7 Genuine
Not able to remove genuine Windows 7 successfully from your computer or laptop? Well then your problem is solved. The following few steps are quite easy and they will help you to very conveniently remove genuine Windows 7 from your PC. Many versions of Windows 8 are already in the market then why stay stuck with Windows 7. Even if you want to load some older version of Windows in your PC then also the following steps will help you out to successfully remove Windows 7 from your PC. The steps are very clear and precise.
Win-Genuine-Not

The steps for removing Windows 7 Genuine from your PC are as follows:
  • Step 1: The first step is to pressing the Windows Key present on the left hand side of the keyboard. You can also simply click on the start button. Either way the start menu will appear once you do one of the above mentioned two things.
  • Step 2: Once the start option shows up go to the run option. Click on the run option. When you click on the run option, the run window will appear.
  • Step 3: Once the run window appears after clicking on the run option, you have to type “cmd” in it.CMD is the command to open the command prompt window. After typing cmd in the run window press enter and the command prompt window will open.
  • Step 4: Once the cmd window opens right click on it. After the right click options appear, you have to choose the option of “Run as Administrator”. This option will give you extended privileges to make changes to your system. Make sure you run your cmd window as administrator otherwise the removal process for genuine Windows 7 will not be successful.
  • Step 5: The fifth step is typing the following command in the cmd window: “slmgr -rearm”. Remember the space between the slmgr and – in the command you are typing. Without the space cmd won’t recognize the command. After you have successfully typed this command, press enter.
  • Step 6: A new message box appears after clicking enter. You have to click “ok” on this message.
  • Step 7: The last step is restarting your computer system. When your PC is starting another message will show up. This message will ask you to activate your Window. For now click on the “cancel” option on the message box. Your system continues to start and you have very successfully removed the genuine Windows 7 from your PC. Congratulations!
The above steps are one of the most fool proof ways “of removing genuine Windows 7 from your PC. A lot of people struggle with removing their current OS of PC. The above steps are for Windows 7 only. Every OS has a somewhat different removal procedure so make sure that you are not following these steps for some other version of Windows. One thing that can be said with 100% guarantee is that these steps will work effectively for removing genuine Windows 7.

How to know admin password through guest account.

How to know admin password through guest account – (NEW)


How to know admin password through guest account
hack admin password
At any point of time did you ever wish that you could hack your college’s computer with the help of a guest account? Well, you will not have to worry as here are some of the methods of hacking in an administrator account from a guest account. All of this can be easily done be resetting the administrator password so as to enjoy all of the privileges which an administrator enjoys on windows.  Are you game? Well then read on…
Concept: You will have press down the key of for a minimum of five times. After that you will get the dialog box. This facility will even work on the logon screen. However, if we change the “sethc.exe” as this key is accountable for the sticky key dialog, with that of the “cmd.exe:, and later on call the sethc.exe by holding down the shift key five times at the time of logon, you will be taken to the command prompt with right to go directly to the administrator rights because no user is logged on. It is with the help of this source that it will be possible for you to hack password of the administrator account via the guest account.
What you will need? Guest account with access to write on system 32.
Procedure:
  1. Simply go straight to C:/windows/system32
  2. Now all you have to do is replicate cmd.exe and place it on your desktop
  3. Simply rename the cmd.exe changed to sethc.exe
  4. Now just replicate the brand new sethc.exe to the system 32. And when the windows ask for rewriting the file then hit the yes icon.
  5. At the point of time, you are asked to rewrite , simply rewrite he sethc.exe
  6. On having completed this step log out from the guest account. Come to the user section and choose window, press the shift key for about five times. Rather than making use of the sticky Key confirmation dialog the command prompt allowing you all administrator rights will open up.
  7. You simply type “net-user- administrator as bbbb”. In this case “bbbb” can be any password you like. Press enter.
  8. You will soon come across the words “completed successfully”. All you have to do is that you exit the command prompt. Now you are ready to login into the administrator with your new password.
Method 2
  1. You will have to log on to the Guest Account of the computer system
  2. Now with the help of your mouse make a right click and select Manage from the “My Computer icon”.
  3. To the left of the sidebar you will be able to find the Local users as well as the Groups. Simply click it and select users.
  4. It will be in the main panel that you will come across administrator.
  5. Simply right click on the Administrator and click set password.
  6. Create the new password and Press Enter and Enjoy.
Didn’t you find logging onto the administrator of your friend’s computer to be very easy?