Skip to main content

Posts

Showing posts with the label Tip

How to login into postgres without root password?

I am not a postgres guy I hardly know anything about it but when the duty calls you have to do anything to get it working. So today duty called :) where I need to take the dump of a postgres database and import it on another machine now the biggest challenge was logging into the postgres and run the command when you don't know the root user password and the sad thing was I installed that postgres long back but didn't kept the password. Now I have to first find the password (which was not possible) or find a way to access it somehow. Luckily I found one solution to my problem :) . According to the article we can allow any user to do operation without any password, okayyy this was interesting. I tried them and bingo it worked :) So I would like to share those steps here so that it will help some needful like me. Step 1. Stop the postgres. > service postgres stop Step 2. Reset the authentication mechanism (assuming defaults are already being used) ...

Multiple Instances of GTalk

How to use Gtalk on Windows with multiple Gmail accounts? Here is the solution... I was using a chat messenger which use to support multiple messenger but after using it for some time I realized that my machine has become unresponsive :P. So I decided to come back to my old lovely GTalk but the only problem is we can not have multiple instance of  'The GTalk'. So I searched for an solution and luckily I found one. Step I Create a shortcut for gtalk and let's keep it on desktop. Step II Now right click on the shortcut icon and select 'Properties'. Step III In Shortcut tab the value for 'Target' will be something like "C:\Users\Home\AppData\Roaming\Google\Google Talk\googletalk.exe" /startmenu (The above value will change according to your gtalk location but they will be quite similar) Now change this value to "C:\Users\Amol\AppData\Roaming\Google\Google Talk\googletalk.exe" /startmenu /nomutex i.e. add "/nomutex...

Ternary Operator in Java and Javascript

Ternary Operators are basically replacement for if-else condition. Below is the example for java: if(condition == true) {     System.out.println("Condition is true"); } else {    System.out.println("Condition is false"); } The above example can be replaced by a ternary operator as : (condition == true)?System.out.println("Condition is true"):System.out.println("Condition is false"); The syntax remains almost same for javascript : if(condition == true) {     alert("Condition is true"); } else {    alert("Condition is false"); } (condition == true)?alert("Condition is true"):alert("Condition is false"); Ternary Operators reduces the readability of the code little bit but they give a better performance. If you are using if-else condition and there are millions of records to be processed then go for ternary operator.

Mark more than 100 mails as read in less than 10sec

I was going through my inbox and I realized I have more than 1000 emails that were unread, actually i don't need them either so I starting searching for a way for marking all these email as read rather than selecting them and marking as read. Below are my findings for the same : With this tip you can mark all of your emails as read. Step 1 : Open your inbox and select some email. Step 2 : Click on 'More' button which will show more options in that select "Filter messages like these". Step 3 : Clear all the fields and just put 'DOCFF55' in "Doesn't have:" text box. Step 4 : Click on "Next Step" Step 5 : Select "Mark as read" Step 6 : Check the check box next to "Create Filter" button. Step 7 : Click "Create Filter" Done !! You can also refer to the youtube video where I got the solution :) http://www.youtube.com/watch?v=zxzTFADzk2c