While debugging code Java programmers often use System.out.println(). It is important to write separate message in each System.out.println() so you can understand from the output where the problem lies.
Now it is time-consuming and somewhat tedious to invent new message for each System.out.println() debug message. What if you could call methods which allows you to print the current file name and line number?
That would automatically ensure unique message in every System.out.println(). Also it will help you to immediately pinpoint the offending code. You can copy-paste something like this anywhere in your code (embellish it with more topical information as needed) and be able to pinpoint its location:
I will show the implementation of getLineNumber() below and leave the rest as an exercise:
/** Get the current line number. * @return int - Current line number. */ public static int getLineNumber() { return Thread.currentThread().getStackTrace()[2].getLineNumber(); }
Have you noticed the magic number - 2? Can you explain it?
The best way to suppress unchecked or other warnings is to fix the cause of the warning. However in some rare cases, the warning is incorrect and there is no logical way to solve it without compromising the intended functionality. For such cases there is a simple solution:
Add the following just before the method definition:
@SuppressWarnings("unchecked")
This stops any unchecked warnings from the code within the method.
Google search is undoubtedly the most helpful and widely used search engine in the world. Whoever you are, if you use internet then you must have used Google every time you have logged in. Such is the utility of the Google that it has become synonymous with the word internet. Did you know that Google search offers many more things than just presenting you with your relevant search topics? You can find almost all the necessary information from Google search. Today, I am going to tell you about 15 features which can help you in numerous ways. They will update you about time zones, tell you about latest weather, football scores, even help you in doing maths. So let's get started.
1. Weather
To see the weather for any city, type "weather" followed by the city and state.
Type weather California to know the weather there. It can prove to be very valuable if you are going for a short trip to some place and you need to know if your trip is going to be brighter or not.
2. Stock Quotes
To see current market data for a given company or fund, type the ticker symbol into the search box. On the results page, you can click the link to see more data from Google Finance.
Type CBS and you can see the stock options of CBS from Google search. An absolute delight for share market followers and financers.
3. Time
You must have known this. To see the time in many cities around the world, type in "time" and the name of the city.
Type time Mumbai and you will be provided with IST at ease.
4. Sports Scores
To see scores and schedules for sports teams type the team name or league name into the search box.
Type san francisco 49ers and see for yourself.
5. Calculator
Now solve any big homework or numerical problem at ease. It even supports basic functions like sqrt and etc.
Type 6*9+10 or whatever, and get the result. A delight for quick accountants and students.
6. Book Search
If you’re looking for results from Google Book Search, you can enter the name of the author or book title into the search box and they return any book content as if your normal web results. You can click through on the record to view more detailed info about that author or title. I suppose you know this for sure.
7.Unit Conversion
Yes, Google support unit conversion as well. You can use Google to convert between many different units of measurement of height, weight, and mass among others. Just enter your desired conversion into the search box and get the result.
Type 32 C in F to convert 32 degree Celsius temperature into Fahrenheit.
8. Dictionary
To see a definition for a word or phrase, simply type the word "define" then a space, then the word(s) you want defined.
type define delusion to get the result. 9. Spell Checker
Yes there is a spell checker option too. It notifies you right at the time when you have made a typo and also suggests you the possible remedy.
type Sttring and you will be suggested with string, which is the right word.
10. Local Search
If you’re looking for a store, restaurant, or other local business you can search for the category of business and the location and it return results right on the page, along with a map, reviews, and contact information. It is very useful if you are new to a place but need places to visit.
Type Continental food 02138 to find the rest.
11. Movie Showtime
To find reviews and showtimes for movies playing near you, type movies or the name of a current film into the Google search box.
Though I am not sure about this option. I tried searching for some movies but without much success about their showtimes.
12. Find Your House
Suppose, you want to find yourself a new house in your locale or to a place you will be shifting soon. So what do you do? Type homes cityname and you will get all the real estate information.
Type homes LA for an experiment
13. Flight Status and Information
If you are at home and want to know about certain flight and status, you can use say american airlines 18 to know about that flight and its status and further information.
14. Currency Conversion
Its not only about unit. You can check your currency converted to other currencies as well.
Type 100 INR to USD and see the result.
15. Plus (+) operator
Google ignores common words and characters such as where, the, how, and other digits and letters that slow down your search without improving the results. Basically most of the conjunctions and prepositions are overlooked and so are the verbs too. If a common word is essential to getting the results you want, you can make sure we pay attention to it by putting a + sign in front of it.
Type He me +and you and every word will be searched, leaving none.
16. Bonus Tip:
Sometimes the best way to ask a question is to get Google to fill in the blank by adding an asterisk (*) at the part of the sentence or question that you want finished into the Google search box.
Type Edison invented * or tendulkar has * test runs to get the exact result. Conclusion
That is not all. You can also get area codes, maps, related search sites and etc from Google Search. It not only searches for the topics you want to consult but also provides you with handful information within a fraction of a second. Explore it and let us know about anything you wanna add. Happy Googling.
Registry Editing Has Been Disabled By Your Administrator
if yes then you need not to worry. There are two solutions for this.
Solution-1:
Go to Start -> Run –> type gpedit.msc
In the left hand menu, go to User Config –> Administrative Templated –> System.
Now In the right hand pane, select “Prevent access to registry editing tools”. It will probably be not configured or enabled. If it’s enabled, disable it and if it’s not configured, first enable it, apply settings and then disable it. Most probably the settings have been applied instantly. If not, then run gpupdate in command prompt to apply the group policies.
Solution-2:
This is a very simple trick.
Go to Start -> Run -> type REG add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableRegistryTools /t REG_DWORD /d 0 /f
Task manager is a very strong utility tool for Windows users. You can see the processes, prioritize them, end inactive or non-responding processes and many more things. But suddenly one day you get this error message like,
Task Manager has been disabled by your administrator
Don't worry. There are not 1 but 4 ways to deal with this problem.
Solution-1
Click Start, Run and type this command exactly as given below: Better copy and paste it to be exact.
Solution- 2:
* Click Start, Run and type Regedit.exe * Navigate to the following branch:
HKEY_CURRENT_USER \ Software \ Microsoft \ Windows \ CurrentVersion \ Policies\ System
* In the right-pane, delete the value named DisableTaskMgr * Close Regedit.exe
Solution- 3: (recommended for XP users)
* Click Start, Run, type gpedit.msc and click OK. * Navigate to this branch:
User Configuration / Administrative Templates / System / Ctrl+Alt+Delete Options / Remove Task Manager
* Double-click the Remove Task Manager option. * Set the policy to Not Configured.
Solution- 4:
If you find it troublesome to do anything with the registry or settings all by yourself then just download and run this REG fix and double-click it and you are done!
Do you want to change Windows name to yours. Then follow the trick. This trick will enable you to show your name in the Windows Information page. Whatever you put, will be seen as the properties section of My Computer. Surprise your friends and others with this one.
Trick
Open notepad and copy the following lines into it and save it with the name OEMINFO.INI in the c:\windows\system32 directory:
[General] Manufacturer=Your Name Here Model=Your Model Here [Support Information] Line1=Your Name Line2=Your Address Line3=Your Email Address
Save the file,
Right click on my computer select properties,
In the general tab, a button will be highlighted (support information) click on it, you will be able to see the changes.
Now if you want to display some more information then simply increase the line in the file.
There have been times when we needed a PDF file to edit. So we have converted that to a word document with the help of hundreds of free software across the internet. But what if you need a word document to be converted to PDF? If you love to read through the computer screen then PDF is always the best option. So is it for print-outs. Here are 5 easy ways to let you convert a word document to a PDF file format.
1. Using Open Office
1. Download OpenOffice from openoffice.org
2. Install it to your computer.
3. Open the Word document you want to convert.
4. From the main menu select File > Export as PDF (There is also an export to PDF button right on the main taskbar.)
5. Choose a filename for your PDF.
6. Choose the options you want, or just hit save/ok.
2. Click 'browse' and select the file on your computer.
3. Click 'Convert to PDF' and wait for it to process.
4. They will send the link to your PDF file to your e-mail inbox.
5. There are also printpdf.com and doc2pdf.net. You can try them too. But I chose it only because its fast, secure and more importantly supports upto 20 MB of file size to convert to PDF which others don't.
7. Under the file menu; on the far left, under the Google logo select save as PDF. Though there have been complaints that the saved file differs from the actual. The conversion is not centpercent error free.
Windows makes every thing too personal to be comfortable sometimes. Linux is still not an option to consider for many. So, is there a way to make your private information really private? Do you wanna lock and password protect some files inside a computer that can not be viewed by others? Of course you have software for that. But why would you like to have a software which can easily be done by a few tweaks. Here is a simple trick.
Trick
1.Suppose you have a folder named mhm in D:\mhm
2.In the same drive next to the folder create a new notepad file with the exact statement ren mhm mhm.{21EC2020-3AEA-1069-A2DD-08002B30309D}
3.Now save this text file as loc.bat
4.Create another notepad file and type ren mhm.{21EC2020-3AEA-1069-A2DD-08002B30309D} mhm
5.Save this as key.bat
6.Now there are two batch files . Double click loc.bat and your folder will change into Control Panel and the contents inside the folder will not be obtainable simply.
7.To open the folder double click key.bat and you get back your original folder .
8. If you want, keep the file key.bat at some other place. Whenever you need to access that folder just copy and paste the file at the previous location and double click.
Windows users are used to formatting and re-installing Windows Vista or Windows XP. But a genuine problem may arise if you lose or forget the product key you are given. Windows don't actually save the key you enter in its crudest form. Its encrypted and hidden inside the registry and you can not hunt it down unless you know how. So you must be wondering, HOW? Here is how.
First download Magical Jelly Bean Keyfinder. Its a freeware open source utility that retrieves your Product Key (cd key) used to install Windows from your registry. It allows you to print or save your keys for safekeeping.
Run the key finder program. Follow any instructions provided by the software.
The numbers and letters displayed by the program represent the Windows Vista product key. The product key should be formatted like xxxxx-xxxxx-xxxxx-xxxxx-xxxxx - five sets of five letters and numbers.
Write this key code down exactly as the program displays it to you for use when reinstalling Windows Vista.
So you got the lost or forgotten product key, right? Keep it safe.
Do you frequently need a calculator for applications you do in your Windows?
Do you find it annoying enough to hunt down the audio recorder every time from the Start Menu?
-Well don't worry. You have used Windows+E to launch the explorer, now you will do it for all the appications too. Here is a very simple trick which will allow you to launch any Windows application at the touch of a button.
Setting up a keyboard shortcut for any application in your start menu is fast and simple. Steps below explain how to create program shortcuts in Windows:
Navigate the start menu to the application you want to shortcut. In this example, we will create a shortcut for the Calculator (one that I use all the time).
Right-click on the application, and click on Properties.
field titled Shortcut key. Go to that field and type the letter C (or any other key you wish to use to launch the Calculator).
Click OK
Now, whenever you want to quickly launch Calculator, just hit Ctrl-Alt-C (or whatever key you chose). I use application launch shortcut keys all the time for Calculator and Notepad. You can use it for those programs you constantly use and are sick of navigating through the Start menu to launch.