tag:blogger.com,1999:blog-7220299351398809702024-03-12T17:52:27.740-07:00Crash Crash Till You BuildAnswer to life, the universe and everythingVenkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.comBlogger37125tag:blogger.com,1999:blog-722029935139880970.post-13355656488733737282012-11-22T02:38:00.002-08:002012-11-22T02:38:28.781-08:00ActiveMQ: QueueSize vs InFlightCount<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2.bp.blogspot.com/-XOO_MvuMfro/UK4AmPAk6eI/AAAAAAAAC9s/h6Ys-ugOpYM/s1600/queuesize-inflightcount.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="131" src="http://2.bp.blogspot.com/-XOO_MvuMfro/UK4AmPAk6eI/AAAAAAAAC9s/h6Ys-ugOpYM/s320/queuesize-inflightcount.png" width="320" /></a></div>
<br />
<div>
<br /></div>
</div>
Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-78453851992775348922012-11-02T00:11:00.002-07:002012-11-02T00:11:42.070-07:00Project Sparta #1 - tame the yellow elephant<div dir="ltr" style="text-align: left;" trbidi="on">
Mission #1. set up multi-node setup for hadoop 0.20, hadoop 0.23<br />
- document installation steps<br />
- set up basic accounts, queues<br />
- set up some authorization scheme<br />
- play around with operational stuff - define, allocate and monitor quotas<br />
<br />
<br />
Hardware:<br />
<br />
0.20:<br />
athena-nn, athena-jt, athena-s[1-3]<br />
<br />
<br />
0.23:<br />
zeus-nn, zeus-jt, zeus-s[1-3]</div>
Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-50756196453225411772011-02-06T04:20:00.000-08:002011-02-06T04:33:26.479-08:00Re-enable "remember passwords" on Chrome (Mac)This is pretty stupid of Chrome, given the fact that it has done everything else so smartly. Most of us have the habit of letting our browser save our mail and fb passwords; and when a friend or someone else logs in to his account using this browser, and the browser asks to save his password, we promptly click "not now" button that Firefox gives. But on chrome, the buttons are "save password" and "never for this site", and if you click the other button, your own saved passwords are also lost.<div><br /></div><div>Hmm.. now what, go to the password manager and remove that exception, right? On Windows, yes; on Mac no. Go to the wrench icon, preferences; select the center tab, click "show saved passwords". This opens up the "Keychain Access" tool on Mac. And guess what, it does not have the exception list there.</div><div><br /></div><div>Solution:</div><div>1. Close Chrome</div><div>2. Goto to ~/Library/Application Support/Google/Chrome/Default</div><div>3. sqlite3 Login\ Data "select origin_url, blacklisted_by_user from logins"</div><div><br /></div><div>You'll see that for the site for which you clicked "never for this site", the blacklisted_by_user value is 1. Just reset those values to 0</div><div><br /></div><div>4. sqlite3 Login\ Data "update logins set blacklisted_by_user=1 where origin_url like '%google%'"</div><div><br /></div><div>Now start your chrome, and save your passwords again.<span class="Apple-tab-span" style="white-space:pre"> </span></div>Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-84529248085922906542010-12-14T01:05:00.000-08:002010-12-14T01:14:52.366-08:00mysql client out of memory<pre id="comment_text_0">Error:<span class="quote0"><br />Out of memory (Needed 1453192 bytes)<br />DBD::mysql::st execute failed: MySQL client ran out of memory at file<br /><br />Solution:<br />Set this flag in the DB handle -<br /></span><span class="quote0">$rdbh->{'mysql_use_result'} = 1;<br /><br /></span><span class="quote0">It forces the API to use mysql mysql_use_result() instead mysql_store_result().<br />Basically, instead of buffering all the matches, it returns line by line.<br />Note that this is the same as --quick option available in the mysql client.<br /><br />This causes the mysql query thread state to change to "writing to net";<br />mysql> show processlist\G<br />...<br />State: writing to net<br />...<br /><br /><br /><br /></span><br /><span class="quote0"><br /></span><br /><span class="quote0"><br /></span></pre>Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-5481204566104363982010-12-14T00:39:00.000-08:002010-12-14T01:04:27.331-08:00apache jammed with lots of 408s<strong>408 - Request Timeout</strong><br />A 408 status code means that the client did not produce a request quickly enough. A server is set to only wait a certain amount of time for responses from clients, and a 408 status code indicates that time has passed<br /><br />http://www.addedbytes.com/articles/http-status-codes-explained/<br /><br />Solution:<br />ReadTimeOut 10 (default is 120 seconds)Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-5247763463243619922010-09-19T02:16:00.000-07:002010-09-19T02:32:08.950-07:00chapter3: system access<span style="font-weight: bold;">passwordless ssh setup</span><br />- ssh-keygen<br />- ssh-copy-id<br />- ssh-agent, ssh-add<br /><br /><span style="font-weight: bold;">sudo access</span><br />- format: user/alias machines=(runas) commands<br /><br /><span style="font-weight: bold;">syslog</span><br />- options: /etc/sysconfig/syslog<br />- for remote logging, add '-r' i.e. SYSLOGD_OPTIONS="-m 0 -r"<br /><br /><span style="font-weight: bold;">syslog.conf</span><br />- format: facility.priority location<br />- facility = kern, mail, user etc<br />- priority = crit, warn<br />- location = /var/log/messages, @192.168.0.3<br /><br /><span style="font-weight: bold;">cron</span><br />- format<br />- cron.allow supersedes cron.deny<br />- anacron<br /><br /><span style="font-weight: bold;">printers</span><br />- commands: lpadmin, lpq, lp<br />- conf files: /etc/cups/cupsd.conf /etc/cups/printers.conf<br />- use system-config-printer to make a default, text only printer<br /><br />ntp<br />- commands: ntpq -p -nVenkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-52956400859777610062010-08-12T08:00:00.000-07:002010-09-07T06:12:58.922-07:00Chapter2 - rpm and yumCommands to be aware of:<br /><br /><span style="font-weight: bold;">yum</span><br /><ul><li>yum list [all|installed|available|updates] [regex]<br /></li><li>yum info pkgname</li><li>yum provides filename (lists the rpms that contain that file. 'yum provides filename | grep installed -B3' is more useful)</li><li>yum install pkgname | yum localinstall pkgname.rpm | yum groupinstall group</li><li>yum search</li></ul><span style="font-weight: bold;">createrepo</span><br /><ul><li>createrepo -v /dir<br /></li><li>createrepo -v --update /dir</li><li>Creates the following files in /dir/repodata/<ul><li>repomd.xml - md5 checksum of other files. client cache is updated when this file changes</li><li>primary.xml.gz - list of all rpms, and files provided by rpms</li><li>filelists.xml.gz - list of all files provided by rpms, used by 'yum provides'</li><li>other.xml.gz - other meta info of packages</li></ul></li></ul><span style="font-weight: bold;">rpm</span><br /><ul><li><span style="font-weight: bold;">install-upgrade-remove</span><br /></li><li>rpm -ivh pkg.rpm: installs. -v verbose, -h prints hash progress bar</li><li>rpm -Uvh pkg.rpm: upgrades pkg.rpm if it exists, installs if it doesn't exist</li><li>rpm -Fvh pkg.rpm: upgrades pkg.rpm if it exists, skips if it doesn't exist</li><li>rpm -i --replacepkgs: install same package again</li><li>rpm -i --oldpackage: downgrade package</li><li>rpm -e pkg: removes pkg</li></ul><ul><li><span style="font-weight: bold;">query</span><br /></li><li>rpm -qa: list all packages</li><li>rpm -ql pkg: list all files of installed pkg</li><li>rpm -qc pkg: list all config files of installed pkg</li><li>rpm -qd pkg: list all doc files of installed pkg</li><li>rpm -qi pkg: pkg info<br /></li><li>rpm -qf filename: name the package that installed this file</li><li>rpm -q --changelog pkg: print changelog</li><li>rpm -q --scripts pkg: print pre and post scripts</li><li>rpm -qa --last: print installation time<br /></li><li>rpm -qap pkg.rpm: list all files of pkg.rpm</li><li>rpm -qcp | -qdp pkg.rpm</li></ul><ul><li><span style="font-weight: bold;">verify</span></li><li><span>rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release</span><span style="font-weight: bold;"><br /></span></li><li>rpm -V pkg: verifies package (of any modifications to its files)</li><li>rpm -Va : verify all pkg</li><li>rpm -Vp pkg.rpm<br /></li><li>rpm --checksig pkg.rpm</li></ul>Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-42481594743507110772010-08-11T06:51:00.000-07:002010-09-07T06:12:31.930-07:00Chapter1 - Installation and Virtualization<span style="font-weight: bold;">Installation:</span><br /><ul><li>In the training rooms, they set up a DHCP server, that also hosts a kickstart file</li><li>For practice, I've installed RHEL 5.4 on my desktop using the regular DVD boot</li><li>The kickstart file for this install is stored in /root/anaconda-ks.cfg</li><li>A kickstart file contains 3 sections:<ul><li>Commands: The response for all questions asked in the installation</li><li>Packages: List of pkgs to be installed</li><li>Scripts: pre and post scripts to be run before and after the installation</li></ul></li></ul><span style="font-weight: bold;">Virtualization:</span><br />Install Xen hypervisor:<br /><span style="color: rgb(153, 51, 0);font-size:85%;" >$ yum -y install kernel-xen xen virt-manager<br />Reboot, select the Xen kernel in Grub menu</span><br /><br />Start services:<br /><span style="font-size:85%;"><span style="color: rgb(153, 51, 0);">$ service xend start</span><br /><span style="color: rgb(153, 51, 0);">$ service libvirtd start</span></span><br /><br />Make sure the services start on boot:<br /><span style="color: rgb(153, 51, 0);font-size:85%;" >$ chkconfig xend on<br />$ chkconfig libvirtd on</span><br /><br />Create LV for VM:<br /><span style="font-size:85%;"><span style="color: rgb(153, 51, 0);">$ lvcreate -L 10G -n vserver sys</span><br /><span style="color: rgb(153, 51, 0);">$ virt-install --paravirt --ram 1024 --disk vol=/dev/sys/vserver --location /mnt/iso<br />OR<br /></span></span><span style="font-size:85%;"><span style="color: rgb(153, 51, 0);">$ virt-install --paravirt --ram 1024 --disk vol=/dev/sys/vserver --location ftp://ftplocation/image -x ks=kickstart_file<br /><br /></span></span>Graphical tool - virt-manager<br /><span style="font-size:85%;"><span style="color: rgb(153, 51, 0);">$ yum - y install virt-manager</span></span><br /><span style="font-size:85%;"><span style="color: rgb(153, 51, 0);"><br /></span></span>Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-51171330183648564872010-08-11T04:05:00.000-07:002010-08-12T10:12:02.458-07:00Create Yum repository from ISO fileThe Linux flavor used here is RHEL5.<br /><br />1. Mount the ISO image to /mnt/iso/<br /><span style="color: rgb(255, 153, 0);font-size:85%;" ><span style="color: rgb(153, 51, 0);">$ mkdir /mnt/iso</span><br /><span style="color: rgb(153, 51, 0);">$ mount -o ro,loop /path/to/rhel-server-5.4-x86_64-dvd.iso /mnt/iso</span></span><br /><br />or add this line to /etc/fstab<br /><span style="color: rgb(153, 51, 0);font-size:85%;" >/path/to/rhel-server-5.4-x86_64-dvd.iso /mnt/iso iso9660 ro,loop 0 0<br />$ mount -a</span><br /><br />2. Bootstrap - install createrepo<br /><span style="color: rgb(153, 51, 0);font-size:85%;" >$ cd /mnt/iso/Server (it may be in some other folder)<br />$ rpm -Uvh createrepo*</span><br /><br />3. Trouble with creating a repo of this mounted directory:<br /><span style="font-size:85%;"><span style="color: rgb(153, 51, 0);">$ createrepo /mnt/iso/</span><br /><span style="color: rgb(153, 51, 0);">Directory /mnt/iso/. must be writable.</span></span><br /><br />4. Solution: Create another directory. Add a symlink to the mounted directories that contains the RPMs. Convert this new directory as the repo<br /><span style="font-size:85%;"><span style="color: rgb(153, 51, 0);">$ mkdir /var/repo</span><br /><span style="color: rgb(153, 51, 0);">$ ln -s /mnt/iso/Server /var/repo/rpms<br /></span></span><span style="font-size:85%;"><span style="color: rgb(153, 51, 0);">$ ln -s /mnt/iso/VT /var/repo/rpms-vt</span></span><br /><span style="font-size:85%;"><span style="color: rgb(153, 51, 0);"><br /></span><span style="color: rgb(153, 51, 0);">$ createrepo /var/repo</span></span><br /><span style="font-size:85%;"><span style="color: rgb(153, 51, 0);">3040/3040 - rpms/zsh-html-4.2.6-3.el5.x86_64.rpm </span><br /><span style="color: rgb(153, 51, 0);">Saving Primary metadata</span><br /><span style="color: rgb(153, 51, 0);">Saving file lists metadata</span><br /><span style="color: rgb(153, 51, 0);">Saving other metadata</span></span><br /><br />5. Create repo conf file<br /><span style="font-size:85%;"><span style="color: rgb(153, 51, 0);">$ vi /etc/yum.repos.d/myrepo.repo</span><br /><span style="color: rgb(153, 51, 0);">[rhel-myrepo]</span><br /><span style="color: rgb(153, 51, 0);">name=myrepo</span><br /><span style="color: rgb(153, 51, 0);">baseurl=file:///var/myrepo</span><br /><span style="color: rgb(153, 51, 0);">enabled=1</span><br /><span style="color: rgb(153, 51, 0);">gpgcheck=0</span></span><br /><br />6. Test the new repo<br /><span style="color: rgb(153, 51, 0);font-size:85%;" >$ yum list installed</span>Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com1tag:blogger.com,1999:blog-722029935139880970.post-25463424409534795362010-04-13T08:40:00.000-07:002010-06-08T02:49:46.053-07:00Setting up serial console<h2><a name="SECTION02152000000000000000"> </a></h2><h2><a name="SECTION02152000000000000000"></a></h2><h2><a name="SECTION02152000000000000000"></a></h2><h2><a name="SECTION02152000000000000000"></a></h2><p>[ From: <a href="http://tx.downloads.xensource.com/downloads/docs/user/">http://tx.downloads.xensource.com/downloads/docs/user/</a> ]<br /></p> <h2><a name="SECTION02152000000000000000">2.5.2 Serial Console (optional)</a> </h2> <p>Serial console access allows you to manage, monitor, and interact with your system over a serial console. This can allow access from another nearby system via a null-modem (``LapLink'') cable or remotely via a serial concentrator. </p><p> You system's BIOS, bootloader (GRUB), Xen, Linux, and login access must each be individually configured for serial console access. It is <i>not</i> strictly necessary to have each component fully functional, but it can be quite useful. </p><p> For general information on serial console configuration under Linux, refer to the ``Remote Serial Console HOWTO'' at The Linux Documentation Project: <tt><a name="tex2html5" href="http://www.tldp.org/">http://www.tldp.org</a></tt> </p><p> </p><h3><a name="SECTION02152100000000000000"> 2.5.2.1 Serial Console BIOS configuration</a> </h3> <p> Enabling system serial console output neither enables nor disables serial capabilities in GRUB, Xen, or Linux, but may make remote management of your system more convenient by displaying POST and other boot messages over serial port and allowing remote BIOS configuration. </p><p> Refer to your hardware vendor's documentation for capabilities and procedures to enable BIOS serial redirection. </p><p> </p><h3><a name="SECTION02152200000000000000"> 2.5.2.2 Serial Console GRUB configuration</a> </h3> <p> Enabling GRUB serial console output neither enables nor disables Xen or Linux serial capabilities, but may made remote management of your system more convenient by displaying GRUB prompts, menus, and actions over serial port and allowing remote GRUB management. </p><p> Adding the following two lines to your GRUB configuration file, typically either <tt>/boot/grub/menu.lst</tt> or <tt>/boot/grub/grub.conf</tt> depending on your distro, will enable GRUB serial output. </p><p> </p><blockquote> </blockquote><pre>serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1<br />terminal --timeout=10 serial console<br /></pre><blockquote> </blockquote> <p> Note that when both the serial port and the local monitor and keyboard are enabled, the text ``<i>Press any key to continue</i>'' will appear at both. Pressing a key on one device will cause GRUB to display to that device. The other device will see no output. If no key is pressed before the timeout period expires, the system will boot to the default GRUB boot entry. </p><p> Please refer to the GRUB documentation for further information. </p><p> </p><h3><a name="SECTION02152300000000000000"> 2.5.2.3 Serial Console Xen configuration</a> </h3> <p> Enabling Xen serial console output neither enables nor disables Linux kernel output or logging in to Linux over serial port. It does however allow you to monitor and log the Xen boot process via serial console and can be very useful in debugging. </p><p> In order to configure Xen serial console output, it is necessary to add a boot option to your GRUB config; e.g. replace the previous example kernel line with: </p><blockquote> </blockquote><pre> kernel /boot/xen.gz dom0_mem=131072 com1=115200,8n1<br /></pre><blockquote> </blockquote> <p> This configures Xen to output on COM1 at 115,200 baud, 8 data bits, 1 stop bit and no parity. Modify these parameters for your environment. </p><p> One can also configure XenLinux to share the serial console; to achieve this append ``<tt>console=ttyS0</tt>'' to your module line. </p><p> </p><h3><a name="SECTION02152400000000000000"> 2.5.2.4 Serial Console Linux configuration</a> </h3> <p> Enabling Linux serial console output at boot neither enables nor disables logging in to Linux over serial port. It does however allow you to monitor and log the Linux boot process via serial console and can be very useful in debugging. </p><p> To enable Linux output at boot time, add the parameter <tt>console=ttyS0</tt> (or ttyS1, ttyS2, etc.) to your kernel GRUB line. Under Xen, this might be: </p><blockquote> </blockquote><pre> module /vmlinuz-2.6-xen0 ro root=/dev/VolGroup00/LogVol00 \<br />console=ttyS0, 115200<br /></pre><blockquote> </blockquote> to enable output over ttyS0 at 115200 baud. <p> </p><h3><a name="SECTION02152500000000000000"> 2.5.2.5 Serial Console Login configuration</a> </h3> <p> Logging in to Linux via serial console, under Xen or otherwise, requires specifying a login prompt be started on the serial port. To permit root logins over serial console, the serial port must be added to <tt>/etc/securetty</tt>. </p><p> To automatically start a login prompt over the serial port, add the line: </p><blockquote> <span style=""><tt>c:2345:respawn:/sbin/mingetty ttyS0</tt></span> </blockquote> to <tt>/etc/inittab</tt>. Run <tt>init q</tt> to force a reload of your inttab and start getty. <p> To enable root logins, add <tt>ttyS0</tt> to <tt>/etc/securetty</tt> if not already present. </p><p> Your distribution may use an alternate getty; options include getty, mgetty and agetty. Consult your distribution's documentation for further information. </p>Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-42146235550551159902010-04-08T02:22:00.000-07:002010-04-08T02:24:54.766-07:00How to delete a file with name beginning with hyphen?$ rm -f -----BEGIN<br />rm: unrecognized option `-----BEGIN'<br />Try `rm --help' for more information.<br /><br />Methods:<br />1. rm -f ./----BEGIN<br /><br />2. rm -f /home/viyer/----BEGIN<br /><br />3. rm -- ----BEGIN<br /><br />Ref: <a href="http://unstableme.blogspot.com/2010/01/unix-delete-file-with-hyphen-at.html">http://unstableme.blogspot.com/2010/01/unix-delete-file-with-hyphen-at.html</a>Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-51875034432007032142009-01-23T20:58:00.000-08:002009-01-23T21:17:06.490-08:00Ubuntu: How to create a bootable USB drive from ISO fileI no longer trust CDs, it's time we phase out CDs and put it in the category we created for floppies.<br /><br />So, if you have a Ubuntu iso file (if not, get it from <a href="http://www.ubuntu.com/getubuntu/download">here</a>) how do you get it installed using your flash drive?<br /><br />Step 1: Get <a href="http://en.wikipedia.org/wiki/UNetbootin">UNetBootin</a><br /><ul><li>add the following lines in /etc/apt/sources.list <blockquote>http://ppa.launchpad.net/gezakovacs/ubuntu hardy main<br />deb-src http://ppa.launchpad.net/gezakovacs/ubuntu hardy main</blockquote></li><li>sudo apt-get update</li><li>sudo apt-get install unetbootin</li><li>if you run into dependency issues, run 'sudo apt-get -f install'</li></ul><ul><li>if you are installing from windows/mac, download the corresponding version of unetbootin from <a href="http://unetbootin.sourceforge.net/">here</a>.</li></ul>Step 2: Launch UNetBootin<br /><ul><li>click on the Diskimage radio button, and add path to the iso file</li><li>select Type as 'USB Drive' from the drop down menu, and add the Drive letter in the next drop down.</li><li>for linux users, you have to check the 'Show all drives' checkbox and select the appropriate one (do a 'mount -l' to confirm)</li><li>it will now extract the files to the USB and make necessary configurations to make it bootable</li><li>select 'reboot now' option to install on the same machine, or unplug the USB and boot with it on another machine<br /></li></ul>Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-21366370792253406602008-09-19T04:34:00.000-07:002008-09-19T04:39:50.403-07:00Ubuntu: Sound stops working until rebootI've often faced this problem that the sound suddenly stops working, and after a reboot things are fine as before. By sound I mean Audacious, that's what I normally use.<br /><br />It was irritating to reboot just to get my headphones working!!<br /><br />The error it reports is: "Cannot connect to output".<br />The output drop-down field in Preferences->Audio shows '"Pulseaudio Output Plugin" and changing it to "Alsa output" solved the problem.<br /><br />But why it changed? What was the default output before?<br />Does it happen with other players? other flavors of linux?<br /><br />I'll update this as and when I get the answers :PVenkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-24204171377336698172008-08-17T23:30:00.000-07:002008-08-17T23:36:04.643-07:00Ubuntu@Laptop: turning off internal speakers on connecting headphonesIn most cases, Ubuntu has already configured everything.. just one check-box needs to be checked.<br /><br />Open System->Preferences->Volume Control<br /><br />There should be a tab named "Switches". <br />(If its not present, Goto Edit->Preferences and check "Headphone jack sense")<br /><br />Goto the "Switches" Tab, and check the box in front of "Headphone Jack sense".<br />Thats it!!<br /><br />If by default the options mentioned here are not there, then look for answers in the ubuntu forums.Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-18499178236866368202008-08-13T06:14:00.000-07:002008-08-13T06:16:06.435-07:00Excellent introductary presentation on algorithms<div style="width:425px;text-align:left" id="__ss_32770"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/rvenkatesh25/introduction-to-algorithms?src=embed" title="Introduction to Algorithms">Introduction to Algorithms</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slideshare.net/swf/ssplayer2.swf?doc=introduction-to-algorithms-13144&stripped_title=introduction-to-algorithms" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=introduction-to-algorithms-13144&stripped_title=introduction-to-algorithms" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View SlideShare <a style="text-decoration:underline;" href="http://www.slideshare.net/rvenkatesh25/introduction-to-algorithms?src=embed" title="View Introduction to Algorithms on SlideShare">presentation</a> (tags: <a style="text-decoration:underline;" href="http://slideshare.net/tag/algorithms">algorithms</a> <a style="text-decoration:underline;" href="http://slideshare.net/tag/emergent">emergent</a> <a style="text-decoration:underline;" href="http://slideshare.net/tag/technologies">technologies</a>)</div></div>Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-30189533178228073682008-08-13T04:38:00.000-07:002008-08-17T23:37:03.034-07:00Ubuntu@Laptop: Wireless Button LED does not workI have a HP Compaq nc6220 laptop (really a dabba!!)<br /><br />I installed ubuntu 8.04 on it, and since there's a rule that not everything should be working - my wireless button was dysfunctional!<br /><br />Doing a 'sudo lshw -C network' after pressing the wireless button showed that the button is actually toggling the radio, its just not making the LED glow.<br /><br />i.e. after pressing it once, the command output will have the string -<br />wireless=radio off<br /><br />and after pressing it again, it will contain -<br />wireless=unassociated<br /><br />Solution -<br />Find the driver module for the wireless card, in my case it was ipw2200.<br /><br />Remove the module:<br />sudo modprobe -r ipw2200<br /><br />And insert it again with the led option:<br />sudo modprobe ipw2200 led=1<br /><br />This makes the LED blink when the radio is turned on.<br /><br />Note: This setting is lost on reboot, so add these two commands in /etc/rc.localVenkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-57088552615584691472008-08-13T04:34:00.000-07:002008-08-13T04:38:04.244-07:00Display acronyms de-mystifiedNormal Screen (<a href="http://lipas.uwasa.fi/%7Ef76998/video/conversion/">Aspect Ratio</a> 4:3)<br /> <ul><li><b>VGA</b> - 640 X 480</li><li><b>SVGA</b> - 800 X 600</li><li><b>XGA</b> - 1024 X 768</li><li><b>QVGA</b> - 1280 X 960</li><li><b>SXGA+</b> - 1400 X 1050</li><li><b>UXGA</b> - 1600 X 1200</li><li><b>QXGA</b> - 2048 X 1536</li><li><b>QSXGA+</b> - 2800 X 2100</li><li><b>QUXGA</b> - 3200 X 2400</li><li><b>HUXGA</b> - 6400 X 4800</li></ul>Wide Screen (Aspect Ratio 5:4 or 16:9)<br /><ul><li><b>WXGA</b> - 1280 X 800</li><li><b>WXGA+</b> - 1440 X 900</li><li><b>SXGA</b> - 1280 X 1024</li><li><b>WSXGA+</b> - 1680 X 1050</li><li><b>WUXGA</b> - 1920 X 1200</li><li><b>QSXGA</b> - 2560 X 2048</li><li><b>HSXGA</b> - 5120 X 4096</li></ul>Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-12646773380524325852008-05-17T06:40:00.000-07:002008-05-17T07:12:57.290-07:00ssh2 library for phpMost extensions for php (PEAR or PECL packages) are generally available through yum and apt-get on red-hat and debian distros respectively.<br /><br />Extensions installed: snmp, curl, mysql, mysqli, pdo, pdo-mysql<br /><br />On Ubuntu 7.10, apt-get of any of these php extensions does the following:<br /><br />1. Copies the name.so (e.g. snmp.so) file in /usr/lib/php5/20060613/ directory.<br /><br />(No idea why is the directory name a date, instead of 'ext' as mentioned in several forums. Anyways, in /usr/bin/php-config5, you can find the line:<br />entension_dir=/usr/lib/php5/20060613/)<br /><br />2. In /etc/php5/conf.d, creates a file name.ini (e.g. snmp.ini), with a single line: extension=snmp.so<br /><br />The php ssh2 library was not found using apt-get. The following steps were followed in install it. (assuming that openssl, pear, pecl are already installed)<br /><br />(prerequisite: install the libssh2 library)<br />1. wget http://surfnet.dl.sourceforge.net/<br /> sourceforge/libssh2/libssh2-0.14.tar.gz<br />2. tar -zxvf libssh2-0.14.tar.gz<br />3. cd libssh2-0.14/<br />4. ./configure<br />5. sudo make all install<br /><br />(now, php ssh2)<br />6. sudo pecl install -f ssh2 - this created ssh2.so in /usr/lib/php5/20060613/<br />7. created a file /etc/php5/conf.d/ssh2.ini with a line: extension=ssh2.so<br /><br />Most of the instructions were followed from <a href="http://kevin.vanzonneveld.net/techblog/article/make_ssh_connections_with_php/">this page</a>. PHP's own <a href="http://in2.php.net/manual/en/book.ssh2.php">documentation page for ssh2</a> couldn't help much, but the rest of the documentation can be found there.Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-40744354434565892632008-05-15T01:46:00.000-07:002008-05-15T01:53:30.961-07:00Sudo access for apache user<p style="margin-bottom: 0cm;">Web-based admin interfaces, like a network management web console, often require to execute certain commands with elevated previleges. Adding an entry in the sudoers file is one straight forward way to do this.</p><p style="margin-bottom: 0cm;"><br /></p><p style="margin-bottom: 0cm;">The apache user on debian is 'www-data' and on fedora it is 'apache'. Let apache_user denote the web server user, irrespective of the distro.</p><p style="margin-bottom: 0cm;"><br /></p> <p style="margin-bottom: 0cm;">In /etc/sudoers, we need to add:<br />%apache_user ALL=NOPASSWD: ALL</p><p style="margin-bottom: 0cm;"><br /></p> <p style="margin-bottom: 0cm;">This seems very naive from security perspective.Apache has a feature <a href="http://httpd.apache.org/docs/1.3/suexec.html">suEXEC</a> for such purposes. But -</p> <ul><li>It does not support if the target user is root (work around – let the target user be userx, such that userx is configured to have admin previleges)</li><li>It requries re-compiling the apache server, and a very careful and complex configuration. Not really suitable for people who use off-the-shelf apache, with default configurations, like me :)</li></ul> <p style="margin-bottom: 0cm;">We can modify the line in 'sudoers' file to enhance security a little bit. Instead of sudo access to all commands, we can restrict the sudo access for very few number of commands.</p><p style="margin-bottom: 0cm;"><br /></p> <p style="margin-bottom: 0cm;">%apache_user ALL=NOPASSWD: /bin/ls, /bin/cat</p><p style="margin-bottom: 0cm;"><br /></p> <p style="margin-bottom: 0cm;">In my project – php based wireless-mesh network management suite – I've used this :-</p><p style="margin-bottom: 0cm;"><br /></p> <p style="margin-bottom: 0cm;">%apache_user ALL=NOPASSWD: /usr/bin/php -f /path/to/my/script/daemon.php *</p><p style="margin-bottom: 0cm;"><br /></p> <p style="margin-bottom: 0cm;">where, daemon.php handles all the tasks requiring admin previleges. The '*' at the end of the line is used to pass command line arguments to the daemon. This type of usage of the sudoers file gives enough security for most practical purposes. After all, I'm not managing a bank here!</p> <p style="margin-bottom: 0cm;"><br /></p><p style="margin-bottom: 0cm;">Links: <a href="http://www.kclug.org/pipermail/kclug/2007-March/030735.html">Useful thread on apache forum</a><br /></p> <p style="margin-bottom: 0cm;"><br /></p>Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-18004043355675649262008-05-13T07:23:00.000-07:002008-05-13T09:22:18.927-07:00Uploading files to blogsBlogger does not have any direct feature to upload and share files (other than images). For PDF and PPT files I would recommend using <a href="http://www.slideshare.net/">slideshare</a>.<br /><br />For other files, you need to use an online storage service which allows access through blogs.<br /><br />In the <a href="http://cctyb.blogspot.com/2008/05/mrtg-rrd-log-querying-tool_13.html">previous post</a>, I've used the service of <a href="http://www.box.net/">Box.net</a>.<br />Create an account, upload files. Go to the services tab, and add export to blogs service. Currently it supports WordPress, Blogger and LiveJournal. Then right click on the uploaded file, you'll find an option to export the file to these sites.<br /><br />In case of Blogger, just enter your blogger username and password, and the name of the post. In case you have multiple blogs, it itself decides which blog to post to.<br /><br />Note: Even if there exists a post with the name you entered there, Box.net will create a new post with the name provided. So you should start by uploading and exporting files for your post, and edit that post to add your contents.Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com1tag:blogger.com,1999:blog-722029935139880970.post-47739463420693607672008-05-13T06:32:00.001-07:002008-05-16T07:25:04.806-07:00MRTG RRD Log Querying Tool<div xmlns="http://www.w3.org/1999/xhtml"><p><span>There are a lot of free MRTG front-end tools available on the web, but most of them are for the traditional MRTG logs and not for the rrd (round-robin database) log format. Though not as straight forward as sql, some complex queries can nevertheless be issued on the rrd log files using rrdtool.</span></p><p>This tool is a php-based rrd log querying tool developed as a part of my M.Tech thesis.<span style="font-weight: bold;"><br /></span></p><p><span style="font-weight: bold;">Requirements</span></p><ol><li>A functional web server, preferably <a href="http://httpd.apache.org/">apache</a></li><li><a href="http://oss.oetiker.ch/mrtg/">MRTG</a> and <a href="http://oss.oetiker.ch/rrdtool/">RRDTOOL</a> should be installed on the system.</li><li>In the mrtg configuration file, add LogFormat: rrdtool</li><li>Enable <a href="http://www.sudo.ws/sudo/man/sudoers.html">passwordless sudo access</a> for apache user (DEBIAN:www-data or REDHAT:apache) if you wish to add interfaces to the mrtg config through the web interface. (Read this <a href="http://cctyb.blogspot.com/2008/05/sudo-access-for-apache-user.html">post</a> for the right way to do this step)<br /></li></ol><p><span style="font-weight: bold;">Installation</span><br /></p><ol><li>In the queryMrtg.php:</li><ul><li>Set $mrtgdir to the location where mrtg is configured to store its rrd logs, e.g. /var/www/mrtg</li><li>Set $mrtgcfg to the absolute path of the mrtg configuration file, e.g. /etc/mrtg.cfg</li><li>Set $rrdcommand to the rrdtool binary, e.g. /usr/bin/rrdtool</li><li>Set $cfgmaker to the cfgmaker binary, e.g. /usr/bin/cfgmaker</li><li>Set $imgdir to the directory where images will be stored. Create this as a sub-directory of the exported directory in apache (e.g. /var/www/html/images). Add the path relative to the exported directory i.e. if /var/www/html is exported in httpd.conf, then simply write 'images'.</li><li>In the $interfaces array, add all the interfaces that you wish to monitor and query.</li></ul><li>Copy queryMrtg.php to the web-exported directory. e.g. /var/www/html/queryMrtg.php<br /></li></ol><p><br /><span style="font-weight: bold;">Usage</span><br /></p><ol><li>On your browser, type - http://localhost/queryMrtg.php</li><li>First time usage - Just click 'Submit'. It would report that MRTG configuration has not been added for the specified interface, and will show a button to add it. Just click!</li><li>Once you have added interfaces to MRTG configuration, just play around with queries.</li></ol><span style="font-weight: bold;">Contact<br /></span>mailto: <a href="mailto:venkatesh@iitg.ernet.in">venkatesh@iitg.ernet.in</a> OR <a href="mailto:rvenkatesh25@users.sourceforge.net">rvenkatesh25@users.sourceforge.net</a><br /><br /><span style="font-weight: bold;">Screen Shots</span><br /><p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_708_w3vf51k/SCmgUAqNZhI/AAAAAAAAAJA/BYr_XoC4Xy8/s1600-h/bydate.png"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="http://1.bp.blogspot.com/_708_w3vf51k/SCmgUAqNZhI/AAAAAAAAAJA/BYr_XoC4Xy8/s200/bydate.png" alt="" id="BLOGGER_PHOTO_ID_5199863510410814994" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_708_w3vf51k/SCmhbAqNZiI/AAAAAAAAAJI/be0cE_m-3ns/s1600-h/bytraffic.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_708_w3vf51k/SCmhbAqNZiI/AAAAAAAAAJI/be0cE_m-3ns/s200/bytraffic.png" alt="" id="BLOGGER_PHOTO_ID_5199864730181527074" border="0" /></a></p><br /><span style="font-weight: bold;">Download</span><br /><p><a target="_blank" href="http://www.box.net/index.php?rm=box_download_shared_file&blog&file_id=f_158104597&shared_name=iu4jtkpskk">querymrtg.tar.gz</a></p></div>Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-39208041701459360582008-05-13T02:31:00.001-07:002008-05-30T02:56:49.513-07:00Downloading mp3 from Internet - the google wayFor music, google -<br /><br />intitle:"index of" (mp3|mp4|wav) name.of.file -html -htm -asp -jsp -cf -php<br /><br />Explanation: you are searching for directory listings only. All web pages (html, php etc) are filtered out. Apache's directory listings have "Index of" in the title.Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-27700456962859431082008-05-13T02:30:00.000-07:002008-05-13T04:25:59.380-07:00vimrcThis is the vimrc I use:<br /><br /><blockquote><span style="color:#003366;">" Set syntax on<br />syntax on<br /><br />" Indent automatically depending on filetype<br />filetype indent on<br />set autoindent<br /><br />" Case insensitive search<br />set ic<br /><br />" Higlhight search<br />set hls<br /><br />" Incremental search<br />set incsearch<br /><br />" Wrap text instead of being on one line<br />set lbr<br /><br />" Change colorscheme from default to delek<br />colorscheme delek<br /><br />" statusline shown in blue<br />highlight StatusLine ctermfg=darkblue ctermbg=white<br /><br />" Show ruler<br />set ruler<br /><br />" Set the shell to use<br />set shell=bash<br /><br />" Show brace matching as you edit<br />set showmatch<br /><br />" Show working mode<br />set showmode<br /><br />" Show the command<br />set showcmd<br /><br />" Display a status bar<br />set laststatus=2<br /><br />" Number of screen lines to use for the command-line<br />set cmdheight=1<br /><br />" Shift width when you press <<>> to indent a line.<br />set shiftwidth=3<br /><br />" Set Shift rounding off<br />set shiftround<br /><br />" Patten matching<br />set magic<br /><br />" Switch buffer to edit a new file, and use open file if it already open<br />set switchbuf=useopen,split<br /><br />" Changes how backspace works.<br />set bs=2<br /><br />" Expand Tab<br />set expandtab<br /><br />" Number of spaces for a tab<br />set tabstop=8<br /><br />" lines longer than the width of the window will not wrap<br />set wrap<br /><br />" Searches does not wrap around the end of the file<br />set nowrapscan<br /><br />"Not always equal<br />set noequalalways<br /><br />"F2 to Save file<br />map <f2> :w<cr><br />map B :w<cr><br /><br />map! <f2> <esc>:w<cr><esc>a<br />map! B <esc>:w<cr><esc>a<br /><br />"F6 to switch window<br />map <f6> <c-w>w<c-g><br /><br />"Ctrl-Shift-F6 to show only curent file for editing in many windows<br />map <c-s-f6> :only!<cr><br /><br />"- to decrease the current window height<br />map - <c-w>-<br /><br />"= to increase the current window height<br />map = <c-w>+<br /><br />"_ to decrease the current window width<br />map _ <c-w><<br /><br />"+ to increase the current window width<br />map + <c-w>><br /><br />"Alt-Up to go to upper window<br />map <m-up> <c-w>k<br /><br />"Alt-Down to go to the lower window<br />map <m-down> <c-w>j<br /><br />"Alt-Left to go to the left window<br />map <m-left> <c-w>h<br /><br />"Alt-Down to go to the right window<br />map <m-right> <c-w>l<br /><br /></span></blockquote>Acknowledgments to my friend and mentor Shriram V. This vimrc is the set of those lines which I understood from his highly sophisticated version :)Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-67142440160841968492008-05-13T02:29:00.002-07:002008-05-13T02:30:26.958-07:00SSH too slow?Does it take too long for ssh to ask for password after you've entered ssh user@host?<br /><br />Edit /etc/ssh/sshd_config<br /><br />Uncomment this line if present, add it otherwise -<br />UseDNS no<br /><br />restart sshd<br />/etc/init.d/ssh restart<br /><br />Done!Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0tag:blogger.com,1999:blog-722029935139880970.post-32053529350151965722008-05-13T02:29:00.001-07:002008-05-13T02:29:26.926-07:00Some essential packages for ubuntuTo mount and read/write ntfs partitions => ntfs-3g<br /><br />Installed gparted. To enable create/resize ntfs partitions => ntfsprogs<br /><br />To enable mp3 support for rythmbox and other gstreamer based players => gstreamerX.YZ-fluendo-mp3<br />(e.g. gstreamer0.10-fluendo-mp3 or gstreamer0.8-fluendo-mp3)<br /><br />To install flash player in 64-bit browsers => nspluginwrapper and flashplayer-nonfree (for Ubuntu Gutsy onwards. Others refer <a class="snap_shots" href="http://ubuntuforums.org/showthread.php?t=476924">here</a>)Venkateshhttp://www.blogger.com/profile/09993634928589406298noreply@blogger.com0