Tuesday, July 6, 2010

Install Subversion with web access on Ubuntu Linux

Subversion control is an open source version control system. Using Subversion you can record your projects history, here you can manage your project and save change with a version number.

Installation.
To access the subversion repository from HTTP protocol, you must install and configure webserver. in this section we are using Apache2 as Server.

To install subversion run these code:

> sudo apt-get install subversion libapache2-svn



We are going to create svn repository on /home/svn

> mkdir /home/svn
> cd /home/svn
> mkdir repo


Well, let's begin to create repository here:

> svnadmin create /home/svn/repo



Will create a group name is "subversion" and replace USERNAME with actually username

> sudo addgroup subversion
> sudo usermod -a -G subversion USERNAME
> sudo usermod -a -G subversion www-data
  


Set file permissions:

> sudo chown -R www-data:subversion /home/svn/repo
> sudo chmod -R g+rws /home/svn/repo


Now, we are going to configure Vhost with svn access.. if you want to see Example subversion configuration apache2. run these code:

> sudo gedit /etc/apache2/mods-enabled/dav_svn.conf


That's an example file configuration to svn access on HTTP protocol.
in this case i want to show you how the svn repository can access per website url, you must configure it at /etc/apache2/sites-available/your_site.conf and paste code below:


  <location svn="">
     DAV svn
     SVNPath /home/svn/repos
     AuthType Basic
     AuthName "Subversion Repository"
     AuthUserFile /etc/subversion/passwd
     Require valid-user
  </location> 



Ok, a little remaining setup now!
you must create /etc/subversion/passwd file. This file contains user authentication access.
-c using for replacing existing user

> sudo htpasswd -c /etc/subversion/passwd USERNAME
> New password: 
> Re-type new password: 



Restart your server:

> sudo /etc/init.d/apache2 restart


If you are uncertain whether the passwd file exists, you can check this with run this command:

> cat /etc/subversion/passwd



Now, to access the repository you can run the following command:

> svn co http://hostname/svn/repo myproject --username user_name

Configure passenger on SUSE 11.1 Linux

Intall require package, following:

> yast2 -i gcc gcc-c++ make automake git ruby ruby-devel rubygems mysql mysql-client libmysqlclient15 libmysqlclient-devel ruby-mysql zlib gzip unzip memcached ImageMagick ImageMagick-devel ruby-RMagick ruby-RMagick-doc libxml2 libxml2-devel libxslt libxslt-devel yaz libyaz-devel idzebra idzebra-devel curl libcurl-devel libreadline5 readline-devel apache2 apache2-devel 

> yast2 -i wv wv-devel poppler-tools libpoppler4 poppler-data lynx


> yast2 -i libexif exiftool


Install passenger (follow the wizard intructions).

> passenger-install-apache2-module


Put these lines to end of file in httpd.conf, edit the file at /etc/apache2/httpd.conf

LoadModule passenger_module /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.9/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/lib/ruby/gems/1.8/gems/passenger-2.2.9
PassengerRuby /usr/local/bin/ruby


Add a Vhost and locate them to your doc apps

> vi /etc/apache/vhosts.d/filename.conf (will create new file, if not exist)

add these line

<VirtualHost *:80> 
  ServerName www.yourdomain.com
  ServerAlias your_alias_name.com
  DocumentRoot /app_path/public
  RailsEnv production
  <Directory /app_path/public>
    Options Indexes FollowSymLinks
    Options -MultiViews
    AllowOverride None
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>


well, now we just to restart the apache server.

> /etc/init.d/apache2 restart

Monday, July 5, 2010

irb with hirb


+----+---------------+-------------+-------------------------+-------------------------+
| id | name          | description | created_at              | updated_at              |
+----+---------------+-------------+-------------------------+-------------------------+
| 1  | Sports        | lorem ipsum | 2010-07-01 09:05:26 UTC | 2010-07-01 09:05:26 UTC |
| 2  | Fun           | lorem ipsum | 2010-07-01 09:05:26 UTC | 2010-07-01 09:05:26 UTC |
| 3  | Politics      | lorem ipsum | 2010-07-01 09:05:26 UTC | 2010-07-01 09:05:26 UTC |
| 4  | Lifestyle     | lorem ipsum | 2010-07-01 09:05:26 UTC | 2010-07-01 09:05:26 UTC |
| 5  | Entertainment | lorem ipsum | 2010-07-01 09:05:26 UTC | 2010-07-01 09:05:26 UTC |
+----+---------------+-------------+-------------------------+-------------------------+


How to print structure table to screen of terminal, it's possible with hirb gem
sample intruction here:

> sudo gem install hirb

require your own the hirb gem.


> nano ~/.irbrc


include this script.

require 'rubygems'
require 'hirb'
Hirb.enable

Now, you can enjoy to test

> script/console
> Model.all

hope helpful

Saturday, June 19, 2010

tar command basic operations

The tar (tape archive) is used to stores and extracts files from archive (no compress). It's very easy how doing to create and extract files with tar command.

Create a tar.gz archive file use the c option, if more than one files

> tar czvf archive_name.tar.gz file1 file2 file3


Create a tar.gz archive file in one folder

> tar czvf archive_name.tar.gz folder_name/*


Extract a tar.gz archive use x option

> tar xzvf file_name.tar.gz

How to install Balsamiq Mockup on Ubuntu 9.10 ?





First, lets look at what is the Balsamiq Mockup?. Balasamiq Mockups is an tool for Desktop, Web and Mobile app designer which needed for making new sketch, you can drawing the layout component on page site, there you can find kind of components as you need. Lets begin to install, i won't talk to much here.. for more you can see at this http://www.balsamiq.com

You can directly the installation just access this link http://www.balsamiq.com/products/mockups/download and click at "Install Mockups" button. follow the next instructions and wait a few minutes to complete the installation.

Export or Import database to sql file with command line

How to quickly export/import sql file?, you can do that and use some tools here but i want to share about new experience, on this case i used the mysql commands. follow these steps:


1. Export database to sql file (create mysql dump file)
The easiest way to export use syntax command like this:

> mysqldump -u username -p database_name  > export_filename.sql




2. Import mysql dump file to database.
Make sure you have make the database name firstly, next you can use these command:

> mysql -u username -p database_name < export_filename.sql


hope helpful :)

Saturday, June 5, 2010