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.