How to Setup EC2 API Command line Tools on Windows PC
March 9, 2010
Download API Tools from http://developer.amazonwebservices.com/connect/entry.jspa?externalID=351&categoryID=88
Extract the zip file to C:\ folder (to avoid paths with quotes issues in windows). I also renamed the folder to “ec2-api-tools”
Set Java Home Environment Variable. Usually this looks like “C:\Program Files\Java\jrexxx”. Find out exact path on your computer
From Command Prompt
> cd C:\ec2-api-tools
> set JAVA_HOME=”C:\Program Files\Java\jre6″
Set EC2_HOME variable
> set EC2_HOME=C:\ec2-api-tools
Now Get Private key and Certificate Files and keep in C:\ec2-api-tools\keys\ folder for convenience.
Now you can test api-tools
> C:\ec2-api-tools\bin>ec2-describe-availability-zones -K C:\ec2-api-tools\keys\pk-xxx.pem -C C:\ec2-api-tools\keys\cert-xxx.pem
How to debug MySQL Connector Library in Visual Studio
December 25, 2009
In text:
1. Download “mysql-connector-net-6.2.2-src.zip” from http://dev.mysql.com/downloads/connector/net/ and extract the zip file. Note that we need ‘src’ version of library if we want to debug in visual studio.
2. Open your Visual Studio Solution and add ”Mysql.data.csproj” located at “MySql.Data\Provider\” inside the extracted archive.
3. Add this project’s reference to your project (mysql.data).
4. Now you can debug into mysql.data methods.
Quick How To: Record SQL Results to Text File in PostgreSQL
December 2, 2009
Once you connected using psql,
# \o /tmp/myrecord.txt
Then run any SQL queries you want. They wont be visible on screen But will be recored to /tmp/myrecord.txt
# SELECT * FROM my_super_dummy_table;
#\q
How To: Rails with SQL Server 2008
November 1, 2009
Most common database used with Rails is mySQL but if you ever need to use SQL Server, here is a quick how to.
I am using Windows Vista, SQL Server 2008, Rails 2.2.
1) Install activerecord-sqlserver-adapter gem
> gem install activerecord-sqlserver-adapter
2) Create a new Login for this new database (say testuser) using SQL Server Management Studio
3) Create a new database in SQL Server 2008 for your project (say testproject) and choose testuser as Owner
4) Create a new ODBC DNS
Control Panel -> Administrative Tools -> Data Sources (ODBC)
Add a new ‘User DSN’, choose SQL Server, give a name for DSN (say testprojectconn) then configure SQL Server authentication.
5) Now create your rails application as usual. Configure db connection using database.yml as follows
adapter: sqlserver
mode: odbc
dsn: testprojectconn
host: localhost
username: testuser
password: testpass
encoding: utf8
Thats it!
How to setup a Cisco VPN Client on CentOS 5.3
October 25, 2009
This blog post deals with VPNC (http://www.unix-ag.uni-kl.de/~massar/vpnc/) : an alternative to Cisco’s linux version client. If you happy with cisco’s client and were able to install it successfully then you can skip the rest of the blog.
Most of the information can be found at original sources http://wiki.centos.org/AdditionalResources/Repositories/RPMForge and http://wiki.centos.org/HowTos/vpnc
Only issue you might face is installing yum prorities using yum. That is broken in CentOS 5.3 (atleast til I tried). So here are the steps involved.
1) Install Yum Prorities
Install prorities using rpm instead of yum.
wget http://mirror.centos.org/centos-5/5.3/os/i386/CentOS/yum-priorities-1.1.16-13.el5.centos.noarch.rpmrpm -ivh yum-priorities-1.1.16-13.el5.centos.noarch.rpm
2) Check if plugin is enabled (see http://wiki.centos.org/AdditionalResources/Repositories/RPMForge for details)
nano /etc/yum/pluginconf.d/priorities.conf
3) Update Proirities for repo files
nano /etc/yum.repos.d/CentOS-Base.repo
4) Install rpm forge
wget http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm rpm –import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt rpm -K rpmforge-release-0.3.6-1.el5.rf.x86_64.rpmrpm -i rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
5) Update prority for rpmforge repo file
nano /etc/yum.repos.d/rpmforge.repo6) Update yum to start using priorirites and rpmforge as source.
yum check-update7) install VPNC
yum -y install vpncNow vpnc is installed. Follow http://wiki.centos.org/HowTos/vpnc to know how to use it.
How to Quickly Visualize/Analyze a MySQL Database?
October 25, 2009
Once in a while we been in situations where you need to quickly understand/analyze a database given to you by others. We can go through each table and try to understand but it is usually lot simpler if you can visualize all the tables involved and relationships between those. Enter SchemaSpy: a free tool to do that. For sake of specifics, say the database given is MySQL and your pc is running some version of Windows.
A. Download and Install Pre-requsites (if you dont have already)
- Graphviz (http://www.graphviz.org/Download_windows.php)
- use MSI installer (see warnings specific to vista on the download page)
- Java (http://www.java.com/en/download/index.jsp)
- Download and install Java as usual.
- JDBC driver for mySQL ( http://dev.mysql.com/downloads/connector/j/5.1.html)
- Download driver and extract to a known location (say C:\mydblayout)
B. Download latest SchemaSpy Jar File from http://sourceforge.net/projects/schemaspy/files/ (In my case it is schemaSpy_4.1.1.jar) to a known location (using same C:\mydblayout)
Now run the schemaspy to generate report (html format) for database ”mytestdb” which is sitting at a local mySQL server.
C:\mydblayout>java -jar schemaSpy_4.1.1.jar -t mysql -dp mysql-connector-java-5.1.10\mysql-connector-java-5.1.10\mysql-connector-java-5.1.10-bin.jar -db mysql -host localhost -u root -p mysecretpass -o mytestdb_reportSee how -dp flag is used to point to jdbc driver. The above command creates a folder called “mytestdb_report” with all the nice html files. Just open the “index.html” file.
For example output see http://schemaspy.sourceforge.net/unifieddb/characters/index.html
For more details, look at web page of this wonderful SchemaSpy (http://schemaspy.sourceforge.net/) written by John Currier.
Having trouble debugging VS 2003/2005 Projects after upgrading to IE 8 ?
September 11, 2009
Close all IE8 windows…
if you have any IE window open, then VS cant start debugger….
Its not a problem with VS2008 onwards.
Security Hole in IPhone with AT&T
September 5, 2009
To be more precise, the security hole is with the network (AT&T network) IPhone uses. I noticed this problem while working on a Voice-enabled application using Asterisk and surprised to see that my voicemail is wideopen to public. Then later found out that this has been reported earlier by various folks (here and here) but seems like it is not fixed yet. So if you own an IPhone (or any other phone for that matter) with AT&T network, please keep reading and I show you how to fix the problem yourself.
So what is the problem?
Others can listen to your voice mail, change your personal greeting and other settings. AT&T voicemail identifies user based on incoming caller ID, so if callerID matches the phone # you are calling from, it assumes that you are calling yourself to check voice mail then it simply goes to voice mail (if you don’t have password set).
Am I protected or Not?
Call yourself with your phone (by dialing 1 or dialing your number). If you are prompted for a password, then you are fine. If it takes your directly to voice mail menu, then you are NOT secured. See how to set password below.
How to protect my voice mail?
Dial 1 to call Voicemail from your phone
Press * to get to the voicemail Main Menu
- Press 4 for Personal Options
- Press 2 for Administrative Options
- Press 1 for Passwords
- Press 2 to turn password on
- Select any random 4– to 14–digit password
Why I am blogging this?
I don’t know if new AT&T users may be forced to set password or not, but when I got my phone couple of years back and my voicemail was setup without password. It ended up that most of my friends with IPhone also don’t have password setup for voicemail because simply they are not aware of the security hole. With easy access to Open source PBX like Asterisk or spoofing calling cards, its not hard to exploit this security hole. So if this blog helps people to realize how important is to set password, then my job is done.
Disclaimer
The opinions expressed in this blog post are my own and not of any company. The usual standard disclaimer applies, especially the fact that I am not liable for any damages caused by direct or indirect use of the information. I bear NO responsibility for content or misuse of this information or any derivatives thereof. This post is NO WAY intended to blame anyone, especially AT&T. They may have already posted about this issue somewhere on their website.
Nice and easy tool tip
July 16, 2009
I found this snippet of code from somewhere on internet which is simple yet elegant. Idea here is pretty simple: hide tooltip originally using CSS display property and show it when mouse hover over it.
Usage :
<a class=’tooltip’ href=’#'>link text goes here <span> tool tip text goes here….</span></a>
CSS needed:
<style type=”text/css”>
a:hover {background:#ffffff; text-decoration:none;}
a.tooltip span {display:none; padding:2px 3px; margin-left:8px; width:130px;}
a.tooltip:hover span{display:inline; position:absolute; background:#ffffff; border:1px solid #cccccc; color:#6c6c6c;}
</style>
Interesting comments found on other technical blogs
February 22, 2009
“If it is fast and ugly, they will use it and curse you; if it is slow, they will not use it.”- David Cheriton, The Art of Computer Systems Performance Analysis (From http://www.kriskrause.com/2009/04/mysql-connector-net-mysqlbulkloader.html)
Weighing cost versus reliability is always a difficult choice in systems administration. (From http://www.linuxhomenetworking.com/wiki/index.php)
I have noticed that people who hate George Bush also hate internet explorer and Windows in general. You people are mentally ill, sorry to say. (From http://sql-info.de/en/mysql/gotchas.html#1_5 )


