Tuesday, August 28, 2012

Monitor cURL traffic in fiddler

If you want to view your curl request-response in fiddler, you need to tell curl to use fiddler proxy.
You can do that by passing -x parameter.
e.g.
curl -x 127.0.0.1:8888 http://www.priyankgandhi.com

If your url is https, then you will need to pass -k parameter. This will disable curl's ssl verification.
curl -k -x 127.0.0.1:8888 https://www.google.com

Tuesday, August 21, 2012

PostgreSQL: login without entering password

If you want to connect to your postgre database without entering password every time, you can achieve that by creating PGPASS file in your home directory.
e.g. Create a file called .pgpass in your home directory. Add and entry in this format.

hostname:port:database:username:password

priyank@localhost:~$ vi .pgpass
192.168.1.101:5432:restaurant:priyank:passwordispassword

Here is a documentation from postgresql site.
http://www.postgresql.org/docs/9.1/static/libpq-pgpass.html

Friday, August 10, 2012

MYSQL: Connect to mysql using command

How to connect to mysql using a command - from terminal

mysql -u <user> -p -h <host ip> -P <port> <dbname>

Example:

mysql -u root -p -h priyankgandhi.com -P 3306 testdb

Tuesday, May 1, 2012

XAMPP: How to change default language for phpmyadmin

Today I installed XAMPP. After installing, First thing I wanted to do was change mysql password. After searching on xampp site, I found out I can change mysql password using phpMyAdmin. (Ref: link) When I went to phpMyAdmin, everything was in German. After some search, I found out that you have to add two lines in config file.
C:\xampp\phpMyAdmin\config.inc.php
In this file add following line.
$cfg['DefaultLang'] = 'en-utf-8';
After this just reload phpmyadmin page.

Thursday, February 9, 2012

Cygwin: rebaseall utility

You may sometimes see cygwin error like this.
bash 4944 exception::handle: Exception: STATUS_ACCESS_VIOLATION
emap to same address as parent

Short answer

To fix these errors, run these commands from your MS-DOS command prompt.
cd \cygwin\bin
ash
PATH=. rebaseall -v

More Details

Rebaseall utility
Rebaseall utility should be available under /cygwin/bin/ directory.
To check if rebaseall is available or not. If it is available it will print something like this.
priyank@~:>which rebaseall
/usr/bin/rebaseall

Only ash process is allowed to run rebaseall. Means you cannot run rebaseall directly from cygwin.
Open MS-DOS command prompt and follow these steps to to run rebaseall.
cd \cygwin\bin
ash
PATH=. rebaseall -v

Thursday, December 29, 2011

JAVA: SAXParseException - entiry must end with ';' delimiter

Exception: org.xml.sax.SAXParseException: The reference to entity “T” must end with the ';' delimiter

The problem is with an XML which you are trying to parse. Your xml contains special character "&". It should be replaced with "&"

Thursday, September 22, 2011

How to generate ssh public/private key (using command)
Use following command:
ssh-keygen -t rsa

where
-t: specifies type of key to create
rsa: is a type to create You can to check more options by using man command.
man ssh-keygen