Thursday, September 17, 2009

Tuesday, September 15, 2009

Kemmanagundi Day 2

We couldnt do much, as priority was Lakshya feeling comfortable.

View from our room

I Love this kind of cloudy hills. Its soo relaxing to even breath the air. Mind was all in poetry and thinking best.

Just Another view - Morning at 8 AM. Tea and News paper - alas! I was missing the news paper.

Way to canteen.


enchanting nature.




Pictures from Kemmanagundi Trip (on our way)

It was 2 days of Green for eyes and heart.
Kemmannagundi was marvelous.

On The Road With lakshya


With His Mother, Lakshya, Behind My trustworthy Esteem.


ON Way A village and the children there, who had fun watching Lakshya having his breakfast.

Esteem - my road pride - bares all and no grudges so far.


Lakshya All in smiles, happy to travel.












Tuesday, September 8, 2009

Copying Files across networks - in optimized way.

scenario :
what - a bunch of files in a dir tree
how much - size is above gb
where - across continent

if we have a reliable connection best is to use ssh copy - yes we will tar gunzip on the source and untar/unzip on destination -

#>tar czf - [dir0] [dir1] ...  | ssh <destination> 'tar xzf -'

if we have a reliable high speed connection probably zipping wouldnt save that much time

#> tar cf - [dir0] [dir1] ...  | ssh <destination> 'tar xf -'

OK now comes unreliable connection  :)
we can zip and send it through rsync - which incase connection broken retries only the pieces which were not transfered. Remember a zip file if changed will be transferred again. hence in case source is going to change frequently and there is requirement to sync both ends over unreliable slow speeds best would be to do a rsync of dir as it is

#>rsync -a [dir0] [dir1] ...  destination:[path]


wget optimization

Many a time we want to download something and do something ie unzip untar etc. generally we are not interested in the original download.

wget -q -O - <URL> | <do whatever is necessary>

ie untarring example
wget -q -O - "http://localhost/docs/somedoc.tar.gz" | tar xzf -



Saturday, September 5, 2009

Mac Ports Apacha - Perl CGI

After getting macbook, it has been a learning experience. So far, its been very good.
Documenting here is how I got my environment setup for MAMP (MAC,APACHE,Mysql,Perl/PHP)

first things first.. (before we begin)
setting your mac with basic structure:
http://developer.apple.com/technology/Xcode.html
Download the latest xcode and install that.

Get the Mac Ports
http://www.macports.org/install.php
install that.

we have setup the basic infrastructure. If you have worked with ubuntu apt-get, or gentoo emerge, then mac port is quite a similar tool.
run the following
#>sudo port selfupdate
#>sudo port update outdated
#>sudo port install apache2 mysql5 mysql5-server php5 perl5.8 p5-dbd-mysql

the above installs all that we require.

now remember to change the path on your .profile/.bashrc etc (whatever shell you are running) so as to pick the binaries from mac ports path.

export PATH=/opt/local/bin:/opt/local/sbin:$PATH

Noticed! that $PATH is at the end, because perl, apache etc are there on mac and we dont want them :)

---

configuring apache
we want the apache to be run as nobody - hence change the permissions whereever necessary.
this is what I have done:
sudo chown -R nobody:nobody /opt/local/apache2/cgi-bin/
sudo chown -R nobody:nobody /opt/local/apache2/htdocs/
sudo chown -R nobody:nobody /opt/local/apache2/logs


apache configs:
edit /opt/local/apache2/conf/httpd.conf
for correct ServerAdmin and ServerName
uncomment Include conf/extra/httpd-vhosts.conf ( right at the bottom)

edit Include conf/extra/httpd-vhosts.conf ( which is our own virtual Host config )

--
<VirtualHost *:80>
    ServerAdmin sanjayu@queenself-lm
    DocumentRoot "/Users/apache2/htdocs"
    ServerName queenself-lm
    ServerAlias    queenself-lm
    ErrorLog "logs/queenself-lm-error_log"
    CustomLog "logs/queenself-lm-access_log" common
    ScriptAlias /cgi-bin/ /Users/apache2/htdocs/cgi-bin/

    <Directory /Users/apache2/htdocs>
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
      
    <Directory /Users/apache2/htdocs/cgi-bin>
         AddHandler cgi-script .cgi .pl
         Options +ExecCGI
         AllowOverride None
         Order allow,deny
         Allow from all   
   </Directory>

</VirtualHost>
--

List directories via 'ls -d' - surprised me

List directories via 'ls -d' - surprised me This was one of those feelings where I was left surprised with the humble linux comm...