Wednesday, June 20, 2012

ODBC/DSN Adventures


I was having issues with the ODBC connections of a legacy classic asp project i was working on.


I received the error "the specified dsn contains an architecture mismatch between the driver and application".


Unfortunately the previous "developers" (i use this term loosely)  decided to use DSN connections instead of a real connection string like:
(oConn.Open = "Provider=SQLOLEDB; Data Source=SERVER; Initial Catalog=CAT; User Id=sa; Password=*************").


Because I am running a Win7 x64 machine i needed to use the x32 odbc driver and not the x64 one.  If you type ODBC into the start menu you get the x64 version whereas if you type c:\windows\sysWOW64\odbcad32.exe it will open the x32 version.  This also help when connecting a mysql server through ODBC to excel.

Monday, June 18, 2012

Understanding Malware

This is one of the best video's i have ever seen regarding windows internal processing and how to identify and kill malware. http://channel9.msdn.com/Events/TechEd/NorthAmerica/2012/SIA302

Monday, June 11, 2012

The Seven Databases song

Being a CouchDB and Relational Database user, i found this to be very funny:


Monday, June 4, 2012

Installing Couchdb 1.2 on Ubuntu 12.04 server

Helpful links: http://cvee.github.com/blog/2011/11/28/configuring-couchdb-on-ubuntu/

1) install git
apt-get install git

2) make directory for source
mkdir /data/couchdb_source

3) put source files into directory
cd /data/couchdb_source
git clone http://git-wip-us.apache.org/repos/asf/couchdb.git

4) change branch to version you need. We will be checking out 1.2.0
cd /data/couchdb_source/couchdb
git checkout 1.2.0
5) Install dependencies needed to build couchdb
sudo apt-get -y install build-essential autoconf automake libtool erlang libicu-dev libmozjs-dev libcurl4-openssl-dev
6) Build the configure and make files
./bootstrap
./configure --prefix=/data/couchdb
make && sudo make install
7) Create a user account dedicated for CouchDB and update permissions
sudo adduser --system --home /data/couchdb/var/lib/couchdb --no-create-home --shell /bin/bash --group --gecos "CouchDB Administrator" couchdb
sudo chown -R couchdb:couchdb /data/couchdb
sudo chmod 0770 -R /data/couchdb
8) Update Admin pass
/data/couchdb/etc/couchdb/local.ini
Change:
[admins]
root = [PASS]
9) Make it so couchdb will startup automatically
sudo cp /data/couchdb/etc/init.d/couchdb /etc/init.d
sudo update-rc.d couchdb defaults
10) Update Couchdb Config settings
nano /data/couchdb/etc/couchdb/default.ini
a) set delayed_commits - false
b) set reduce_limit - false

 11) Open firewall
iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 5984 -j ACCEPT
iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport 6984 -j ACCEPT

12) Start Couchdb
service couchdb start

Tuesday, June 15, 2010

Redmine Setup using Turnkey Linux

Redmine Install Process

-- Download and install turnkey linux's redmine appliance
http://www.turnkeylinux.org/redmine

-- install updates and required packages
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install aptitude
sudo aptitude install libapache2-svn libapache-dbi-perl libapache2-mod-perl2 libdbd-mysql-perl libdigest-sha1-perl

-- enable required packages in apache 2
sudo a2enmod dav
sudo a2enmod dav_svn
sudo a2enmod perl

-- copy Redmine.pm file to apache perl lib files
sudo cp /var/www/railsapp/extra/svn/Redmine.pm /usr/lib/perl5/Apache/Redmine.pm

-- create redmine config file for apache
sudo nano /etc/apache2/conf.d/redmine

# /svn location for users
PerlLoadModule Apache::Redmine

DAV svn
SVNParentPath "/srv/repos/svn"

AuthType Basic
AuthName redmine
Require valid-user

PerlAccessHandler Apache::Authn::Redmine::access_handler
PerlAuthenHandler Apache::Authn::Redmine::authen_handler

## for mysql
RedmineDSN "DBI:mysql:database=railsapp_production;host=localhost"


RedmineDbUser "root"
RedmineDbPass "*********"
Allow from all


-- Restart apache
sudo apache2ctl restart

-- setup permissions
sudo chown root:www-data /srv/repos/svn

-- update crontab
sudo crontab -e

*/2 * * * * ruby /var/www/railsapp/extra/svn/reposman.rb --redmine localhost --svn-dir /srv/repos/svn --owner www-data --url file:///srv/repos/svn/ >> /var/log/reposman.log

-- Turn on WS for repo
Navigate your web browser to the box
Go to « Administration -> Settings -> Repository » and check Enable WS for repository management.

-- create svn project in redmine
Go to « Administration -> project » New Project

-- connect project to svn
Go to « Projects -> [Project Name] -> settings -> Repository » and set the following settings
SMC: Subversion
url: file:///srv/repos/svn/[Project Name]
login: [Redmine admin account from DB]
password: [Redmine Password]

-- add users to redmine
Go to « Administration -> Users » add New user and assign them to a project

-- connect eclipe to svn
install svn plugin
add svn locaiton: http://[Server URL]/svn/[project name]

-- create backup script in linux
sudo nano /root/backup.sh

#!/bin/sh

rm /root/redmineBackup.sql.gz
rm /root/redmine_vtd2.svn.gz

# SQL Backup
mysqldump -uroot -p************ railsapp_production | gzip > /root/redmineBackup.sql.gz

# File Backup
svnadmin dump /srv/repos/svn/vtd2/ | gzip > /root/redmine_vtd2.svn.gz

# move redmine files and database to file server for
# offsite backup



ftp -in < open [FTP]
user [USER] [PASS]
bin
put /root/redmineBackup.sql.gz /redmineBackup.sql.gz
put /root/redmine_vtd2.svn.gz /redmine_vtd2.svn.gz
close
bye
EOF

-- Add backup to contab
sudo nano /etc/crontab

# Custom backup
0 22 * * * root sh /root/backup.sh

Thursday, June 10, 2010

How to install Redmine on Ubuntu 10.04

This was a huge struggle for me until i found the following blog:

Here is what i did to make this work plus some of my edits as i ran into a couple problems:


Introduciton

Redmine is an open source, web-based project management and bug-tracking tool. It includes calendar and gantt charts to aid visual representation of projects and their deadlines. It supports multiple projects. Redmine is free and open source software which provides integrated project management features, issue tracking, and support for multiple version control options.

The design of Redmine is significantly influenced by Trac, a software package with some similar features.

Redmine is written using the Ruby on Rails framework. It is cross-platform and cross-database.

Installation Steps
The following are my steps to install it on the new Ubuntu 10.04 system:
1) install mysql server & phpmyadmin tool
$ sudo apt-get install mysql-server phpmyadmin
You can just set all initial passwords to 'admin'. When finished, you can use http://localhost/phpmyadmin to manage your databases.

2) change mysql database directory (optional, I just want to store it in the /srv directory)
$ mysqladmin -u root -p shutdown
$ sudo mv /var/lib/mysql /srv/
$ sudo nano /etc/mysql/my.cnf (change datadir value from "/var/lib/mysql" to "/srv/mysql")
$ sudo nano /etc/apparmor.d/usr.sbin.mysqld (replace all "/var/lib/mysql" to "/srv/mysql")
$ sudo /etc/init.d/mysql restart (FIXME: doesn't work, I just reboot the system instead)

3) install redmine & redmine-mysql
$ sudo apt-get install redmine redmine-mysql

4) install rails...
$ sudo apt-get install mongrel ruby1.8-dev

5) change redmine files default directory (optional, I prefer to store them in the /srv directory)
$ sudo mv /var/lib/redmine /srv/
$ sudo nano /usr/share/redmine/config/ennanoronment.rb (replace all "/var/lib" to "/srv")

6) test redmine
$ cd /usr/share/redmine
$ sudo mkdir /usr/share/redmine/log
$ sudo ruby /usr/share/redmine/scripts/server -e production
(now in PC web-browser, you can use http://localhost:3000 to do the test)

7) configure apache to run redmine
$ sudo apt-get install libapache2-mod-passenger (seems it has been already installed)
$ sudo ln -s /usr/share/redmine/public /var/www/redmine
$ sudo a2enmod passanger (seems already been enabled too)
$ sudo nano /etc/apache2/sites-available/default

Add the following lines:
+ RailsEnv production
+ RailsBaseURI /redmine

Should look like this (replace all the [ and ] with < and >):

[VirtualHost *:80]
RailsEnv production
RailsBaseURI /redmine

DocumentRoot /var/www
[Directory /]
Options FollowSymLinks
AllowOverride None
[/Directory]
[Directory /var/www/]
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
[/Directory]

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
[Directory "/usr/lib/cgi-bin"]
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
[/Directory]

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
[Directory "/usr/share/doc/"]
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
[/Directory]

[/VirtualHost]

$ sudo chown www-data /usr/share/redmine/config/ennanoronment.rb
$ sudo /etc/init.d/apache2 reload

Thats it...

Phoenix

I am resurrecting this tech blog for notes related to Azure Logic Apps with SAP.