Wednesday, October 7, 2009

Backup of mysql database

I usually need to backup my (mysql) database for transferring it from one pc to another or to transfer it to my partner working on the same project or to take a back up of the production database of my website. We could do it simply using a single command from the command prompt:

mysqldump [options] db_name [tables]

You could use this command as:
mysqldump -u root project_production > backup.sql
or
mysqldump project_production > backup.sql
(depending on the permissions)

This will generate a file backup.sql in your current directory which could be used to regenerate the database any time in future on the same or different pc.

Importing the data from the backup file is much more simpler. Just type on the command prompt:
mysql -u root project_development < backup.sql

This will copy all the data from the backup file to another database named project_development.

For more information, visit this site.

Thursday, September 10, 2009

Shuffle/Randomize Arrays (iPhone)

iPhone programming is a bit different task, you have to write a lot of code just for a small task. Have you ever need to randomize an array of items? It's a task that, for some reason, needs to be used a lot (at least for me). So, I am showing you a simple way to handle this task.

ShuffleArray.h

#import "UIKit/UIKit.h"

@interface NSArray(Shuffle)
-(NSArray *)shuffledArray;
@end

ShuffleArray.m

#import "ShuffleArray.h"

@implementation NSArray(Shuffle)
-(NSArray *)shuffledArray
{

NSMutableArray *array = [NSMutableArray arrayWithCapacity:[self count]];

NSMutableArray *copy = [self mutableCopy];
while ([copy count] > 0)
{
int index = arc4random() % [copy count];
id objectToMove = [copy objectAtIndex:index];
[array addObject:objectToMove];
[copy removeObjectAtIndex:index];
}

[copy release];
return array;
}
@end

Tuesday, July 28, 2009

ATTENSION!! All computer users..

For everyone who works daily on a computer. The mistakes daily mouse and keyboard usage will result in Carpal Tunnel Syndrome! Use the mouse and keyboard correctly. View below for the surgery of a patient suffering from Carpal Tunnel Syndrome followed by the 
RIGHT TECHNIQUES for usage....











Hand exercises for Carpal Tunnel Syndrome





Thursday, June 18, 2009

How to install ruby and related gems on Mac OS X (Leopard)

Ruby

Type these commands into Terminal:

curl -O ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz
tar xzvf ruby-1.8.7-p72.tar.gz
cd ruby-1.8.7-p72
./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1
make
sudo make install
cd ..


To verify that Ruby is installed and in your path, just type:

which ruby

You should see:

/usr/local/bin/ruby

RubyGems

After installing ruby, move on to ruby gems the same way:

curl -O http://rubyforge.iasi.roedu.net/files/rubygems/rubygems-1.3.1.tgz
tar xzvf rubygems-1.3.1.tgz
cd rubygems-1.3.1
sudo /usr/local/bin/ruby setup.rb
cd ..

Ruby on Rails and other gems

Now you are ready to install important gems:

sudo gem install rails

sudo gem install mysql

or do it in a single step like:

sudo gem install RedCloth termios rspec sake capistrano mongrel

Congratulations! You are done with the basic setup of ruby and rails.



Tuesday, April 28, 2009

Applications on AppStore

Some of the applications developed by me are available on the AppStore for download. I would like to give their details:

1) GK Quiz (iTunes_url => http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=307483809&mt=8)
Amazing quiz to test and enhance your knowledge. Give correct answers to asked questions and score more and more points. Referred as one of the best GK application for kids.

Features
Three different quiz modes:
- country/capital
- country/currency
- country/nickname

2) Slots & Archer (iTunes_url => http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=308648167&mt=8)
This is a great application providing you fun in two different modes. 

*Bow and Arrow
Have you ever played Bow and Arrow on your personal computer, then its time to bring it on your iPhone too. Test the sharpness of your vision and shoot the target right in its middle. A good way to test your archery skills.

*Super Slots
Do you love gambling? Then why should waste your money when you can convert your iphone into a slot machine and bet virtual money without any hesitation.


3) LoveBirds (iTunes_url => http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=308790906&mt=8)
This is a love matching tools which combines the compatibility test results from Chinese Astrology, Western Zodiac and Feng Shui Kua matches to deliver the most objective and accurate compatibility advice for people. The Love Bird Report(LBR) enables to tell people about their most compatible mates. This unique and revolutionary tool is great for people joining the dating services and looking for a long-lasting relationship.