<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-13437608</id><updated>2012-02-16T06:48:38.584-08:00</updated><category term='mysql putty firewall port forward'/><category term='parallel sort in linux'/><title type='text'>Some Ideas</title><subtitle type='html'>Multi-core workouts.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>49</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-13437608.post-5088221266911043445</id><published>2011-11-23T12:05:00.001-08:00</published><updated>2011-11-23T12:20:21.153-08:00</updated><title type='text'></title><content type='html'>&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;ngrep2curl - How to replay a browser web request&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Many times, I found myself downloading a file twice because Cookies or some other required browser headers prevent curl from doing a direct download from the command line.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;To simplify this process, I wrote a script that:&lt;/span&gt;&lt;br /&gt;1) Listens on port 80 to grab the http headers for a download on a browser&lt;br /&gt;2) Generates a curl command using the captured headers.&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Old workflow (file transfered twice):&lt;/span&gt;&lt;br /&gt;Web Browser -&amp;gt; browse to file -&amp;gt; download to local machine&lt;br /&gt;sftp to remote server&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;New workflow (file transfered just once):&lt;/span&gt;&lt;br /&gt;run ngrep2curl on local machine&lt;br /&gt;Web Browser -&amp;gt; browse to file -&amp;gt; download just the beginning of the file -&amp;gt; cancel download&lt;br /&gt;run the generated curl command on remote server&lt;br /&gt;&lt;br /&gt;#!/bin/sh&lt;br /&gt;ngrep port 80 -Wbyline |grep -vE '^#|^T '|head -20|sed 's/\.$//'|awk '/GET/{url=$2} /Host:/{host=$2} /User-Agent:/{gsub("User-Agent: ","");ua=$0} /Cookie:/{gsub("Cookie: ","");cookie=$0} /Referer:/{gsub("Referer: ","");ref=$0} /Accept:/{accept=$0} END{print "curl -L","\x27"host url"\x27","-A","\""ua"\"","-b\""cookie"\"","-e \x27"ref"\x27","-H","\x27"accept"\x27"}'&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-5088221266911043445?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/5088221266911043445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=5088221266911043445' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/5088221266911043445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/5088221266911043445'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2011/11/ngrep2curl-how-to-replay-browser-web.html' title=''/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-739541759618581591</id><published>2011-09-26T21:45:00.000-07:00</published><updated>2011-09-26T21:52:04.235-07:00</updated><title type='text'>High Performance Text Processing -Taco Bell style</title><content type='html'>Following the &lt;a href="http://teddziuba.com/2010/10/taco-bell-programming.html"&gt;Taco Bell programming&lt;/a&gt; methodology, we will process a huge amount of data using only a few simple ingredients (i.e. unix command line tools).&lt;br /&gt;&lt;br /&gt;Most people won't think twice about writing thousands of lines of code to accomplish what a line or two of bash script will handle.&lt;br /&gt;&lt;br /&gt;Some anti-pattterns to avoid come to mind:&lt;br /&gt;NIH (Not Invented Here)&lt;br /&gt;Golden Hammer (Treat every new problem like it's a nail.)&lt;br /&gt;Re-inventing the wheel&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Text processing is composed of four primary activities. Filtering, Transforming,&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Sorting and Joining&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;To achieve the fastest processing speed, you should try grouping all of your filtering, transforming and joining tasks together in one pipeline.&lt;br /&gt;&lt;br /&gt;Stream processing tasks (filtering, transforming, joining) are limited by disk io only so take advantage of your disk scan and apply all operations as co-routines at the time you read the file.&lt;br /&gt;&lt;br /&gt;Lets say I need to apply 5 regular expressions to a file:&lt;br /&gt;&lt;br /&gt;Example (as co-routines- equally fast ways):&lt;br /&gt;&lt;br /&gt;time cat bigfile \&lt;br /&gt;|grep -vE "[^a-z0-9 ][^a-z0-9 ]|[^a-z0-9] [^a-z0-9]|&lt;secret&gt;|\. |[a-z]' " \&lt;/secret&gt;&lt;br /&gt;&lt;secret&gt;&amp;gt; bigfile.clean&lt;/secret&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;OR&lt;/div&gt;&lt;br /&gt;time cat bigfile \&lt;br /&gt;|grep -v '[^a-z0-9 ][^a-z0-9 ]' \&lt;br /&gt;|grep -v '[^a-z0-9] [^a-z0-9]' \&lt;br /&gt;|grep -v '&lt;secret&gt;' \&lt;/secret&gt;&lt;br /&gt;&lt;secret&gt;|grep -v '\. ' \&lt;/secret&gt;&lt;br /&gt;&lt;secret&gt;|grep -v "[a-z]' " \&lt;/secret&gt;&lt;br /&gt;&lt;secret&gt;&amp;gt; bigfile.clean&lt;/secret&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Another example (same thing- but 5 times slower):&lt;br /&gt;time cat bigfile|grep -v '[^a-z0-9 ][^a-z0-9 ]'&amp;gt;tmpfile1&lt;br /&gt;time cat tmpfile1|grep -v '[^a-z0-9] [^a-z0-9]'&amp;gt;tmpfile2&lt;br /&gt;time cat&amp;nbsp;tmpfile2|grep -v '&lt;secret&gt;'&amp;nbsp;&amp;gt;tmpfile3&lt;/secret&gt;&lt;br /&gt;time cat&amp;nbsp;tmpfile3|grep -v '\. '&amp;gt;tmpfile4&lt;br /&gt;time cat&amp;nbsp;tmpfile4|grep -v "[a-z]' " &amp;gt;bigfile.clean&lt;br /&gt;&lt;br /&gt;Using temp files here causes the equivalent of 5 full text scans on the data when you should really only be reading the data once.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-739541759618581591?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/739541759618581591/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=739541759618581591' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/739541759618581591'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/739541759618581591'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2011/09/high-performance-text-processing-taco.html' title='High Performance Text Processing -Taco Bell style'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-7714111767254122331</id><published>2011-09-16T09:11:00.000-07:00</published><updated>2011-09-16T09:13:18.747-07:00</updated><title type='text'>Word.</title><content type='html'>&lt;object height="390" width="640"&gt;&lt;param name="movie" value="http://www.youtube.com/v/ZOJrjNR7ZZM&amp;amp;hl=en_US&amp;amp;feature=player_embedded&amp;amp;version=3"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/ZOJrjNR7ZZM&amp;amp;hl=en_US&amp;amp;feature=player_embedded&amp;amp;version=3" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="390"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-7714111767254122331?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/7714111767254122331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=7714111767254122331' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/7714111767254122331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/7714111767254122331'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2011/09/text-processing.html' title='Word.'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-957198653497081280</id><published>2011-09-07T08:14:00.000-07:00</published><updated>2011-09-16T09:22:11.372-07:00</updated><title type='text'>Select 'Text Processing' from UNIX like 'a BOSS'</title><content type='html'>&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;1) Learn the commands, avoid re-inventing wheels&lt;/span&gt;&lt;br /&gt;&lt;b&gt;Bootstrap method:&lt;/b&gt;&lt;br /&gt;First, read every man page and understand that each command can be fed into any other command. There are around 2000 commands on a typical UNIX box but you only need to know a few hundred of these. If you have a specific task you can usually figure out which commands to use with the "apropos" command&lt;br /&gt;&lt;br /&gt;Read the entire man page for important commands but just skim the top description for the others (Like encryption or security programs)&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;b&gt;Here's how to get a list of commands available on your system (logged as root):&lt;/b&gt;&lt;br /&gt;(The script command will screen capture into a file named typescript)&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;i&gt;Press the tab key twice to see available commands-&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;b&gt;#script&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;b&gt;-tab- -tab-&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;Display all 2612 possibilities? (y or n)&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;b&gt;y&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;! &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;icc2ps &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ppmtobmp&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;./ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; icclink &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ppmtoeyuv&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;411toppm &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; icctrans &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ppmtogif&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;7za &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iceauth &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ppmtoicr&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;icnctrl &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ppmtoilbm&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;Kobil_mIDentity_switch &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; icontopbm &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ppmtojpeg&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;MAKEDEV &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;iconv &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ppmtoleaf&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;--More--&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;b&gt;&lt;space&gt;&lt;/space&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;...&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;b&gt;#ctl-d&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;b&gt;# exit&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;i&gt;Script done, file is typescript&lt;/i&gt;&lt;br /&gt;&lt;div style="font-size: x-large;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;b&gt;Now that you have captured all the commands available on your system, process that file to extract commands with man pages.&lt;/b&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;i&gt;Get rid of dos newlines&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;#unix2dos typescript&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;i&gt;Manually cleanup "--More--" if needed using emacs or vi editor.&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;#emacs typescript&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;i&gt;Loop over the commands and keep only commands with a man page&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;# (for k in `cat typescript`; do echo -n "$k="; man $k|wc -l ; echo; done 2&amp;gt;/dev/null)|sort|grep '=[1-9]' &amp;gt;command.list&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;i&gt;Look over the list&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;awk=1612&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;badblocks=119&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;baobab=28&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;base64=60&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;basename=52&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;bash=4910&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;batch=177&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;bc=794&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;bccmd=116&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;bdftopcf=71&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;2) Start "Reading The Fine Manpages"&lt;/span&gt;&lt;br /&gt;&lt;div style="font-size: x-large;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;# man man&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;man(1) Manual pager utils man(1)&lt;br /&gt;NAME&lt;br /&gt;man - an interface to the on-line reference manuals&lt;br /&gt;SYNOPSIS&lt;br /&gt;man [-c|-w|-tZHT device] [-adhu7V] [-m system[,...]] [-L&amp;nbsp;locale] [-p string] [-M path] [-P pager] [-r prompt] [-S&amp;nbsp;list] [-e extension] [[section] page ...] ...&lt;br /&gt;man -l [-7] [-tZHT device] [-p string] [-P pager] [-r&amp;nbsp;prompt] file ...&lt;br /&gt;man -k [apropos options] regexp ...&lt;br /&gt;man -f [whatis options] page ...&lt;br /&gt;DESCRIPTION&lt;br /&gt;man is the system’s manual pager. Each page argument given&amp;nbsp;to man is normally the name of a program, utility or function. The manual page associated with each of these arguments is then found and displayed. A section, if provided,&amp;nbsp;will direct man to look only in that section of the manual. The default action is to search in all of the available sections, following a pre-defined order and to show&amp;nbsp;only the first page found, even if page exists in several&amp;nbsp;sections.&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Commands:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;ENTER – scroll down&lt;br /&gt;”b” – take you back&lt;br /&gt;”/ keyword” – search the man page for a word&lt;br /&gt;asumming more as page reader&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Finding Commands:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;# apropos CPU&lt;br /&gt;top (1) - display top CPU processes&lt;br /&gt;# whatis apropos&lt;br /&gt;apropos (1) - search the manual page names and descriptions&lt;br /&gt;NOTE: apropos is man -k (for ”keyword search”) and whatis is man -f&lt;br /&gt;(for ”fullword search”)&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;3) Study and practice combining these key text processing tools:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;I can't even tell you how important this is.&lt;/span&gt;&lt;br /&gt;AWK, SED, TR, GREP, SORT, UNIQ, CUT,PASTE,JOIN, HEAD, TAIL, CAT, TAC&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;4) Learn how to manage running processes&lt;/span&gt;&lt;br /&gt;PS, TOP, FG, BG, KILL, vmstat, iostat, netstat, lsof, fuser, strace&lt;br /&gt;ctrl-d&lt;br /&gt;ctrl-c&lt;br /&gt;ctrl-z&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;5) Learn the BASH shell&lt;/span&gt;&lt;br /&gt;UNIX pipes combine and process streams:&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;span class="Apple-style-span" style="background-color: white; font-family: sans-serif; font-size: 13px; line-height: 19px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;table class="wikitable" style="background-attachment: initial; background-clip: initial; background-color: #f9f9f9; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-collapse: collapse; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; color: black; font-size: 13px; margin-bottom: 1em; margin-left: 0px; margin-right: 1em; margin-top: 1em;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;th style="background-attachment: initial; background-clip: initial; background-color: #f2f2f2; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;"&gt;Integer value&lt;/th&gt;&lt;th style="background-attachment: initial; background-clip: initial; background-color: #f2f2f2; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em; text-align: center;"&gt;Name&lt;/th&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;"&gt;0&lt;/td&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;"&gt;Standard Input (&lt;b style="background-color: #ffff66; color: black;"&gt;stdin&lt;/b&gt;)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;"&gt;1&lt;/td&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;"&gt;Standard Output (stdout)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;"&gt;2&lt;/td&gt;&lt;td style="border-bottom-color: rgb(170, 170, 170); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(170, 170, 170); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(170, 170, 170); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(170, 170, 170); border-top-style: solid; border-top-width: 1px; padding-bottom: 0.2em; padding-left: 0.2em; padding-right: 0.2em; padding-top: 0.2em;"&gt;Standard Error (stderr)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;6) Keep going&lt;/span&gt;&lt;br /&gt;Check out history, wget, curl, xml2, xmlformat and GNU parallel.. tons more....&lt;br /&gt;&lt;div&gt;(You'll be glad you did)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-957198653497081280?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/957198653497081280/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=957198653497081280' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/957198653497081280'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/957198653497081280'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2011/09/program-unix-like-boss-in-6-steps.html' title='Select &apos;Text Processing&apos; from UNIX like &apos;a BOSS&apos;'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-7347699516663681627</id><published>2011-09-02T12:56:00.000-07:00</published><updated>2011-09-02T13:55:37.050-07:00</updated><title type='text'>NCD for news article data mining</title><content type='html'>The Normalized Compression Distance (NCD) is a powerful formula that can be used to discover hidden relationships in almost any data.&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, 'sans serif'; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="background-color: white; font-size: 13px;"&gt;&lt;img src="http://www.complearn.org/images/ncd.gif" /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, 'sans serif'; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="background-color: white; font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, 'sans serif'; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="background-color: white; font-size: 13px;"&gt;C=compressor program like Zip&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, 'sans serif'; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="background-color: white; font-size: 13px;"&gt;x and y are the 2 strings you want to compare&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, 'sans serif'; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="background-color: white; font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, 'sans serif'; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="background-color: white; font-size: 13px;"&gt;I works by simply compressing three things. The first text string C(x), the second C(y) and then the concatenation both strings together c(xy).&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, 'sans serif'; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="background-color: white; font-size: 13px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, 'sans serif'; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="background-color: white; font-size: 13px;"&gt;Apply the formula and you get a distance score between the 2 strings from 0 to 1 (plus a slight error amount). 0 means the articles are identical, and 1 means they are absolutely dissimilar.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, 'sans serif'; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="background-color: white; font-family: verdana, arial, 'sans serif'; font-size: 13px;"&gt;NCD was discovered by&amp;nbsp;Rudi Cilibrasi and Paul Vitanyi as described in thier 2005 paper "Clustering by Compression"&lt;/span&gt;&lt;br /&gt;&lt;a href="http://arxiv.org/PS_cache/cs/pdf/0312/0312044v2.pdf"&gt;http://arxiv.org/PS_cache/cs/pdf/0312/0312044v2.pdf&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, 'sans serif'; font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: verdana, arial, 'sans serif'; font-size: x-small;"&gt;&lt;span class="Apple-style-span" style="background-color: white; font-size: 13px;"&gt;Consider the following article:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="color: #525252; font-family: Verdana, Helvetica, sans-serif; font-size: 11px; font-weight: normal;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;h1 style="border-bottom-color: rgb(204, 204, 204); border-bottom-style: none; border-bottom-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 0px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 0px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 0px; color: black; font-family: Arial, Helvetica, sans-serif; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-width: 500px;"&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;What If He Had Gone on Vacation-&lt;/span&gt;&lt;/h1&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; font-size: xx-small; font-weight: bold;"&gt;Jack Kilby describes how he developed the world's first integrated circuits.&lt;/span&gt;&lt;br /&gt;&lt;div style="margin-bottom: 1em; margin-top: 1em; max-width: 500px;"&gt;&lt;span class="Apple-style-span" style="color: #525252;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 1.3em; margin-bottom: 1em; margin-top: 1em; max-width: 500px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;"After several interviews, I was hired by Willis Adcock of Texas Instruments. My duties were not precisely defined, but it was understood that I would work in the general area of microminiaturization. Soon after starting at TI in May 1958, I realized that since the company made transistors, resistors, and capacitors, a repackaging effort might provide an effective alternative to the Micro-Module. I therefore designed an IF amplifier using components in a tubular format and built a prototype. We also performed a detailed cost analysis, which was completed just a few days before the plant shut down for a mass vacation.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 1.3em; margin-bottom: 1em; margin-top: 1em; max-width: 500px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;"As a new employee, I had no vacation time coming and was left alone to ponder the results of the IF amplifier exercise. The cost analysis gave me my first insight into the cost structure of a semiconductor house. The numbers were high — very high — and I felt it likely that I would be assigned to work on a proposal for the Micro-Module program when vacation was over unless I came up with a good idea very quickly. In my discouraged mood, I began to feel that the only thing a semiconductor house could make in a cost-effective way was a semiconductor. Further thought led me to the conclusion that semiconductors were all that were really required — that resistors and capacitors, in particular, could be made from the same material as the active devices.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 1.3em; margin-bottom: 1em; margin-top: 1em; max-width: 500px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;"I also realized that, since all of the components could be made of a single material, they could also be made in situ, interconnected to form a complete circuit. I then quickly sketched a proposed design for a flip-flop using these components. Resistors were provided by bulk effect in the silicon, and capacitors by p-n junctions.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 1.3em; margin-bottom: 1em; margin-top: 1em; max-width: 500px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;"These sketches were quickly completed, and I showed them to Adcock upon his return from vacation. He was enthused but skeptical and asked for some proof that circuits made entirely of semiconductors would work. I therefore built up a circuit using discrete silicon elements. Packaged grown-junction transistors were used. Resistors were formed by cutting small bars of silicon and etching to value. Capacitors were cut from diffused silicon&amp;nbsp;&lt;nobr&gt;power transistor&lt;/nobr&gt;&amp;nbsp;wafers, metallized on both sides. This unit was assembled and demonstrated to Adcock on August 28, 1958.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 1.3em; margin-bottom: 1em; margin-top: 1em; max-width: 500px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;"Although this test showed that circuits could be built with all semiconductor elements, it was not integrated. I immediately attempted to build an integrated structure as initially planned. I obtained several wafers, diffused and with contacts in place. By choosing the circuit, I was able to lay out two structures that would use the existing contacts on the wafers. The first circuit attempted was a phase-shift oscillator, a favorite demonstration vehicle for linear circuits at that time.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 1.3em; margin-bottom: 1em; margin-top: 1em; max-width: 500px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;"On September 12, 1958, the first three oscillators of this type were completed. When power was applied, the first unit oscillated at about 1.3 megacycles.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 1.3em; margin-bottom: 1em; margin-top: 1em; max-width: 500px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;"The concept was publicly announced at a press conference in New York on March 6, 1959. Mark Shepherd said, "I consider this to be the most significant development by Texas Instruments since we divulged the commercial availability of the silicon transistor." Pat Haggerty predicted the circuits first would be applied to the further miniaturization of electronic computers, missiles, and space vehicles and said that any&lt;nobr&gt;application&lt;/nobr&gt;&amp;nbsp;to consumer goods such as radio and television receivers would be several years away."&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="line-height: 1.3em; margin-bottom: 1em; margin-top: 1em; max-width: 500px;"&gt;&lt;span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"&gt;&lt;span class="Apple-style-span" style="font-size: xx-small;"&gt;A&amp;nbsp;&lt;nobr&gt;television program&lt;/nobr&gt;&amp;nbsp;in 1997 said about the integrated circuit and Jack Kilby, "One invention we can say is one of the most significant in history -- the microchip, which has made possible endless numbers of other inventions. For the past 40 years, Kilby has watched his invention change the world. Jack Kilby — one of the few people who can look around the globe and say to himself 'I changed how the world functions.'"&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: 11px;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;Can NCD work as a relationship classifier in news articles?&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;First, I ran a part of speech tagger on the article text and then looked-up all entities (proper nouns) in Wikipedia. The Wikipedia articles were then used to build a related word-list for each entity. Next I compute the normalized compression distance (NCD) pair-wise for each entity to get a distance matrix. Cluster the matrix and a nice binary graph appears using&amp;nbsp;&lt;a href="http://www.graphviz.org/"&gt;dot&lt;/a&gt;&amp;nbsp;and the relationships begin to appear.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;From the 50 entities mapped below, a few relations are apparent. (Probably should have just picked the top 25 entities though, because the clustering works better with fewer items.)&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;A) Mark Shepherd and Willis Adcock are related through Jack Kilby&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;B) The integrated circuit, transistor, capacitor and resistor are related by silicon.&amp;nbsp;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;C) Concepts and ideas are related through thought.&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-fio4ByryeWs/TmEkebNr80I/AAAAAAAAAE8/PYOwFbCh8sk/s1600/related_concepts.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="367" src="http://3.bp.blogspot.com/-fio4ByryeWs/TmEkebNr80I/AAAAAAAAAE8/PYOwFbCh8sk/s640/related_concepts.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://dads2.sitepager.com/v1/images/young_frankenstein.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://dads2.sitepager.com/v1/images/young_frankenstein.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-7347699516663681627?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/7347699516663681627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=7347699516663681627' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/7347699516663681627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/7347699516663681627'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2011/09/ncd-for-news-article-data-mining.html' title='NCD for news article data mining'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-fio4ByryeWs/TmEkebNr80I/AAAAAAAAAE8/PYOwFbCh8sk/s72-c/related_concepts.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-2842515514219762313</id><published>2011-08-15T08:33:00.000-07:00</published><updated>2011-08-15T10:50:52.406-07:00</updated><title type='text'>Move your web content to Rackspace Cloudfiles</title><content type='html'>&lt;br /&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;I 'm gonna make this quick&lt;/span&gt;&lt;/b&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;div&gt;&lt;div&gt;To start hosting your web content on Rackspace Cloudfiles, you need to complete the following tasks:&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Login to the cloudfiles management console: &lt;a href="http://manage.rackspacecloud.com/"&gt;http://manage.rackspacecloud.com&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;img src="http://1.bp.blogspot.com/-x3Mv-33CoFI/TklJYVn02JI/AAAAAAAAAEE/Ua_wy13vPpI/s400/cloudfiles.PNG" border="0" alt="" id="BLOGGER_PHOTO_ID_5641120690728130706" style="cursor: pointer; width: 400px; height: 117px; " /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Create Cloudfile containers to hold your web content ( plan on storing up to 10K items per container so you can use cloudfuse to mount your containers to the filesystem). You need to come up with an organizational structure that makes sense for your site. For example, you could use a container for your audio named c_audio and c_pics for pictures. If you know you will have over 10K files you should try to break them up like  this: c-pics000,c-pics001, c-pics002, ...                                &lt;/li&gt;&lt;li&gt;Click "Publish to CDN" - This will give you your CDN URL.&lt;b&gt;&lt;img src="http://3.bp.blogspot.com/-6SzzmaxrcS0/TklQu52ANeI/AAAAAAAAAEc/jUPnGZ9Euj4/s400/cloudfiles-publish.png" border="0" alt="" id="BLOGGER_PHOTO_ID_5641128774989788642" style="cursor: pointer; width: 400px; height: 143px; " /&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Add cname entries into your DNS to create a predictable name for your containers.&lt;b&gt;&lt;span class="Apple-style-span" style="font-weight: normal; "&gt;&lt;b&gt;&lt;img src="http://2.bp.blogspot.com/-rsmENDTVdc8/TklSQAoaoBI/AAAAAAAAAEk/oBjUVrPkaiw/s400/cloudfiles-cname.PNG" border="0" alt="" id="BLOGGER_PHOTO_ID_5641130443259158546" style="cursor: pointer; width: 400px; height: 329px; " /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/b&gt;&lt;/li&gt;&lt;li&gt;Write a PHP script to query your database and copy all content listed in your database into the cloud. Then save the new cloud location for the content back to your database. For example, if you use auto-increment and have 30 thousand files you can put the first 10k into c-pics000 container, second 10K into c-pics001 container and so on.&lt;/li&gt;&lt;li&gt;For user contributed content- update your website file upload script to save the content to the cloud instead of the filesystem and save the new content location in the database. For images you may want to create the different sizes you will need before uploading to the cloud. Example: me.jpg and me_thumb.jpg&lt;/li&gt;&lt;li&gt;Connect your Cloudfile containers to your filesystem with cloudfuse.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;Add the following entry to /etc/fstab:&lt;/div&gt;&lt;span class="Apple-style-span" &gt;cloudfuse /mnt/cloud fuse defaults,allow_other,username=&lt;i&gt;your_username&lt;/i&gt;,api_key=&lt;i&gt;your_api_key&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;Then mount /mnt/cloud and you will see all your containers as directories. This is a great way to see what you have using ls and also to make backups of your cloudfiles to another hard-drive on your server.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt;&lt;b&gt;You're done!&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" &gt; &lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-2842515514219762313?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/2842515514219762313/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=2842515514219762313' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/2842515514219762313'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/2842515514219762313'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2011/08/move-your-web-content-to-rackspace.html' title='Move your web content to Rackspace Cloudfiles'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-x3Mv-33CoFI/TklJYVn02JI/AAAAAAAAAEE/Ua_wy13vPpI/s72-c/cloudfiles.PNG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-1380053145607496418</id><published>2011-08-15T04:22:00.000-07:00</published><updated>2011-08-15T08:28:53.042-07:00</updated><title type='text'>Linux virtualization with chroot</title><content type='html'>&lt;a href="http://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Transistor_Count_and_Moore%27s_Law_-_2011.svg/500px-Transistor_Count_and_Moore%27s_Law_-_2011.svg.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"&gt;&lt;img style="cursor:pointer; cursor:hand;width: 500px; height: 449px;" src="http://upload.wikimedia.org/wikipedia/commons/thumb/0/00/Transistor_Count_and_Moore%27s_Law_-_2011.svg/500px-Transistor_Count_and_Moore%27s_Law_-_2011.svg.png" border="0" alt="" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;Big savings with virtualization (&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;Exponential?)&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;According to &lt;a href="http://en.wikipedia.org/wiki/Moore's_law"&gt;Moore's Law&lt;/a&gt; we get better, and generally cheaper servers every year.  In the data center, we can take advantage of this by leasing servers instead of buying- if we are using Linux virtualization.&lt;br /&gt;&lt;br /&gt;There are many virtualization containers that work perfectly well for Linux. The three I have used most over the years are Xen, VMware and Oracle VM VirtualBox. Each has it's own quirks you need to learn and requires a software install to use. The one disadvantage they all share though, is that they add complexity and there is a cost to switching containers. For a pure linux shop there is a simpler way to virtualize without adding software.&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;Good old chroot will do the trick&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;As long as the host and the virtualized OS will run on the same kernel, you don't need any special software to virtualize in Linux. Using chroot, you can build an OS inside an OS. I currently run CentOS as the host OS and Gentoo for my virtualized instances.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Here is how I set it up:&lt;br /&gt;# cat /etc/redhat-release&lt;br /&gt;CentOS release 5.5 (Final)&lt;br /&gt;&lt;br /&gt;#mkdir /mnt/gentoo&lt;br /&gt;#cd /mnt/gentoo&lt;br /&gt;&lt;br /&gt;First: Download a tar ball of a running Gentoo OS and unpack it&lt;br /&gt;#wget http://distro.ibiblio.org/pub/linux/distributions/gentoo/releases/amd64/autobuilds/current-install-amd64-minimal/stage3-amd64-20110811.tar.bz2&lt;br /&gt;&lt;br /&gt;#bunzip2 stage3-amd64-20110811.tar.bz2&lt;br /&gt;#tar xvf stage3-amd64-20110811.tar&lt;br /&gt;&lt;br /&gt;Next: Setup networking and devices, copy these 3 lines into the /etc/rc.local of your host OS (CentOS in my case)&lt;br /&gt;mount -t proc none /mnt/gentoo/proc&lt;br /&gt;cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf&lt;br /&gt;chroot /mnt/gentoo su -c '/etc/init.d/start_gentoo.sh' -&lt;br /&gt;&lt;br /&gt;Last: add a shell script into your virtualized OS (/mnt/gentoo) to start your webservers, databases and any other programs you need to run on a reboot.&lt;br /&gt;&lt;br /&gt;To login to your new virtualized server&lt;br /&gt;#chroot /mnt/gentoo&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span"&gt;Come back in 1 year&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;To copy it to a new leased machine in a year once prices have dropped and CPU cores have doubled:&lt;br /&gt;Stop the running programs (whatever you put into start_gentoo.sh) so that you don't copy things like your database tables during a write.&lt;br /&gt;#tar cvfz /mnt/gentoo/gentoo.20110815.tar.gz /mnt/gentoo&lt;br /&gt;&lt;br /&gt;You can now ftp this to your new server, make a new /mnt/gentoo directory, untar the tar ball, setup your start script and /etc/rc.local and you are up and running on your new, faster machine.&lt;br /&gt;#chroot /mnt/gentoo&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;span class="Apple-style-span" &gt;Improving a good thing&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;So that's it! I have had this setup up and working for the past 5 years and every year I change to new servers it gets easier (Hint- if you use the cloud to host your web content, upgrading to new servers gets even easier- see my next post on this topic). &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now I am planning to switch my setup from Gentoo to Ubuntu because Ubuntu has better support in the community. I will write that up once I get it working (I started using Ubuntu initially because it is a source distribution, and  due to that, there are tar balls that unpack and work easily in chroot). If anyone has tips on how to get Ubuntu running in a chroot environment, please leave a comment.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-1380053145607496418?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/1380053145607496418/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=1380053145607496418' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/1380053145607496418'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/1380053145607496418'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2011/08/linux-virtualization-with-chroot.html' title='Linux virtualization with chroot'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-8713862276049264196</id><published>2009-02-05T05:57:00.000-08:00</published><updated>2009-02-12T06:37:08.240-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='parallel sort in linux'/><title type='text'>HOWTO - Simple Parallel Sort in Linux</title><content type='html'>&lt;span style="font-size:120%;"&gt;&lt;b&gt;More data than memory&lt;/b&gt;&lt;/span&gt;&lt;br&gt;&lt;br /&gt;I had duplicate records in a MySQL table with 180 million rows and a varchar index. One requirement I had in de-duping the records was that I needed to keep the row with the highest value in a certain column. This is a VERY common scenario for developers and DBAs but there seems to be no good way to do this in MySQL or Postgreql. A simple "group by order by" does not work in MySQL (5.0.22) for example because it does not know how to presort rows in a group by.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;This means that if you want to show the top seller for each day by using a "group by" it will actually pick the first row it finds instead of sorting first to give you the top seller for the day.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;I read tons of posts and tried several ways to dedupe the table. Basically everything works and everyone has great advice and tips. &lt;strong&gt;But try de-duping a hundred million records that don't fit into memory with whatever query you want on a database, it's just too slow&lt;/strong&gt;.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:120%;"&gt;&lt;b&gt;Trying MySQL&lt;/b&gt;&lt;/span&gt;&lt;br&gt;&lt;br /&gt;Since "group by" would not work without an inner query, my idea was to copy the table structure, add a unique key constraint to the primary key on the new table and then "insert ignore" (ordering by my value to get the highest in first) from old table to new. This would leave me with the new table correctly deduped and I would avoid an expensive subquery. I ran this query for 1 week though and it was still killing the server and not even half finished. (I was not batching these inserts so that is something to try next time.)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:120%;"&gt;&lt;b&gt;Try Postgres&lt;/b&gt;&lt;/span&gt;&lt;br&gt;&lt;br /&gt;I tried postgresql at this point thinking I could take advantage of the DISTINCT ON(field) construct that they have. This seemed like a good way to de-dupe the records so I loaded the data. After getting the data in though, I discovered that building the indexes to just get started was actully slower than in my sql... (I'm not saying postgresql in general is slower than MySQL, it could be faster but it was not going to save the day here)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:120%;"&gt;&lt;b&gt;On to Linux - The Sort Command&lt;/b&gt;&lt;/span&gt;&lt;br&gt;&lt;br /&gt;I decided to try presorting and deduping the records in Linux PRIOR to loading in the database.&lt;br /&gt;&lt;br /&gt;Hardware: 2 Dual-Core AMD Opteron(tm) Processor 2214 HE&lt;br /&gt;OS: 2.6.18-92.1.22.el5 #1 SMP x86_64 GNU/Linux&lt;br /&gt;&lt;br /&gt;I have 2 servers like this. Each has 4 cores and 2G ram to work with.&lt;br /&gt;&lt;br /&gt;First thing to do is clean up the data and remove any junk rows before starting the sort. You want the file small enough to fit into memory if possible.&lt;br /&gt;&lt;br /&gt;step1: left pad any numbers so they sort correctly (integers need 10 places)&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;awk -F',' '{printf "%s,%s,%10d\n",$3,$4,$5}' file.csv &gt;file.padded.csv&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;step2: remove non-alphanumeric and junk rows (whatever you can do to get the filesize down)&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;grep -v '[^a-Z,0-9 ]' file.padded.csv | grep -vE '^junk,|,junk,|^foo,|,foo,' &gt;file.padded.clean.nojunk.csv &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;step3: sort the rows and keep only uniques (I used reverse sort to keep the max value rows)&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sort -fru -S1800M file.padded.clean.nojunk.csv &gt; file.padded.clean.nojunk.sorted.csv&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The Job completed in 12 hours on one server. Blowing away the performance of the databases.&lt;br /&gt;But it could be faster.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:120%;"&gt;&lt;b&gt;Linux sorting in parallel (Distributed, Muti-Core)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;With 2 servers and 4 cores available to each, it doesn't make sense to run a large sort on only one.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Split the file to be sorted into 4:&lt;/strong&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;wc -l file.padded.clean.nojunk.csv &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;140000000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;split -l 35000000 file.padded.clean.nojunk.csv &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;files:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;xaa&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;xab&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;xac&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;xad&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Copy 2 files to the second machine for processing then begin sorting: (4 parallel sorts)&lt;/strong&gt;&lt;br /&gt;Machine#1&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;nohup sort -fr -S900M xaa &gt; xaa.sorted&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;nohup sort -fr -S900M xab &gt; xab.sorted&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Machine#2&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;nohup sort -fr -S900M xac &gt; xac.sorted &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;nohup sort -fr -S900M xad &gt; xad.sorted &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;4 Hours later - merge the 2 sort results in parallel (merges are very fast anyway)&lt;/strong&gt;&lt;br /&gt;Machine#1&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;nohup sort -frmu xaa.sorted xab.sorted &gt; xa.ab.sorted&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Machine#2&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;nohup sort -frmu xac.sorted xad.sorted &gt; xa.cd.sorted&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;4 Minutes later - copy the result from server2 to server1 and complete the merge.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Machine#1&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;nohup sort -frmu xa.ab.sorted xa.cd.sorted &gt; file.padded.clean.nojunk.sorted.csv&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:120%;"&gt;&lt;b&gt;All Done&lt;/b&gt;&lt;/span&gt;&lt;br&gt;&lt;br /&gt;Took just a little over 4 hours this way and with more machines you could get the sort time down to minutes. You are mainly limited by disk write speeds as long as you have gigabit ethernet between servers.&lt;br /&gt;&lt;br /&gt;Time everything and make sure to experiment with memory allocation. I noticed that sort merges were much slower when I allocated a lot of extra memory for them.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Follow-up notes:&lt;/span&gt;&lt;br /&gt;&lt;br&gt;&lt;br /&gt;The main takeaway from this is to process the data until you can fit it into memory. Splitting the data on a Multi-Core server into subsets will allow you to process data in parallel.&lt;br /&gt;&lt;br&gt;&lt;br&gt; &lt;br /&gt;&lt;br /&gt;For a speed boost change your locale from en_US.UTF-8 to C with export LC_ALL=C&lt;br /&gt;Thanks to Tapajyoti Das for this tip. http://tdas.wordpress.com/2008/02/03/speed-up-grep/&lt;br /&gt;(this also will change the way results are filtered, for example a-Z will match only simple ascii and no accented characters under Locale C- this is often what you want)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-8713862276049264196?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/8713862276049264196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=8713862276049264196' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/8713862276049264196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/8713862276049264196'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2009/02/howto-simple-parallel-sort-in-linux.html' title='HOWTO - Simple Parallel Sort in Linux'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-784280079168553516</id><published>2008-12-03T11:27:00.000-08:00</published><updated>2009-02-05T05:55:59.590-08:00</updated><title type='text'>Absolute Best Way to Embed Flash in HTML</title><content type='html'>&lt;span style="color:#ff0000;"&gt;*update- doesn't seem to work with Google browser... not sure about safari. i'll update if i get a fix&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is the best way to embed flash into a webpage without javascript. It is a Markup Only solution and because it does not use the embed tag, it will validate.&lt;br /&gt;&lt;br /&gt;The HTML object method (nested objects + IE conditional comments):&lt;br /&gt;&lt;span style="font-size:10;"&gt;&lt;br /&gt;&amp;lt;object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="smix" codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab" height="30" width="100"&amp;gt;&lt;br /&gt;&amp;lt;param name="movie" value="file.swf"&amp;gt;&lt;br /&gt;&amp;lt;param name="wmode" value="transparent"&amp;gt;&lt;br /&gt;&amp;lt;param name="allowScriptAccess" value="sameDomain"&amp;gt;&lt;br /&gt;&amp;lt;!--[if !IE]&amp;gt;--&amp;gt;&lt;br /&gt;&amp;lt;object name="smix" type="application/x-shockwave-flash" data="file.swf" height="30" width="100"&amp;gt;&lt;br /&gt;&amp;lt;param name="wmode" value="transparent"&amp;gt;&lt;br /&gt;&amp;lt;param name="allowScriptAccess" value="sameDomain"&amp;gt;&lt;br /&gt;&amp;lt;/object&amp;gt;&lt;br /&gt;&amp;lt;!--&amp;lt;![endif]--&amp;gt;&lt;br /&gt;&amp;lt;/object&amp;gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is a compatability chart for this method from the &lt;a href="http://www.bobbyvandersluis.com/flashembed/testsuite/"&gt;flash test suite&lt;/a&gt; by Bobby van der Sluis.&lt;br /&gt;&lt;br /&gt;&lt;table&gt;&lt;tbody style="FONT-SIZE: 9px"&gt;&lt;tr&gt;&lt;td&gt;Browser&lt;/td&gt;&lt;td&gt;IE 5, 5.5, 6&lt;/td&gt;&lt;td&gt;IE 7, 8b2&lt;/td&gt;&lt;td&gt;FF 1*, 2*, 3*Moz 1.7*&lt;/td&gt;&lt;td&gt;Saf 1.3, 2, 3*Chrome 0.2&lt;/td&gt;&lt;td&gt;Opera 9*, 9.5*&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Basic&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Streaming&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Params&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Communication&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;yes&lt;/td&gt;&lt;td&gt;no fscommand&lt;/td&gt;&lt;td&gt;no fscommand&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Since I require javascript communication, I was a little worried about Safari support but then realized that I use ExternalInterface instead of the old flash way to communicate with javascript called fscommand.&lt;br /&gt;&lt;br /&gt;Flash 8 uses ExternalInterface to do javascript communication without using SWLiveConnect. This was a always a problem with Safari using the Object code above but no more with Flash 8 and up.&lt;br /&gt;&lt;br /&gt;Recommendations to use SWFObject are all over the forums and is well promoted but it is too much overhead for my taste. Just remember that IE7 and under will require an extra click from the users unless you use one of the javascript methods. This is due to the stupid Ebola patent that claimed rights to HTML embed technology.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-784280079168553516?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/784280079168553516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=784280079168553516' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/784280079168553516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/784280079168553516'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2008/12/absolute-best-way-to-embed-flash-in.html' title='Absolute Best Way to Embed Flash in HTML'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-6122540685840716751</id><published>2008-04-09T09:06:00.001-07:00</published><updated>2008-04-17T05:34:27.653-07:00</updated><title type='text'>ImageMagick - How to shrink images in batch mode</title><content type='html'>find . -size +1000k -name \*.png awk '{print $1,$1}' | xargs -n2 convert -scale 1024x\&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-6122540685840716751?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/6122540685840716751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=6122540685840716751' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/6122540685840716751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/6122540685840716751'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2008/04/imagemagick-how-to-shrink-images-in.html' title='ImageMagick - How to shrink images in batch mode'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-6884263563289760469</id><published>2008-02-01T19:53:00.000-08:00</published><updated>2008-03-11T06:37:20.338-07:00</updated><title type='text'>Setup a Future Rescue with the 'at' Comand</title><content type='html'>With a leased server, you never want to lock yourself out of your box. If you do get locked out, KVM style console access can save you but it's not cheap. It usually costs $30 per use. And that's if your ISP even supports it.&lt;br /&gt;&lt;br /&gt;There are 3 risky things that can get you locked out of your server.&lt;br /&gt;1) service iptables restart&lt;br /&gt;2) service network restart&lt;br /&gt;3) changing etc files like /etc/sudoers ... and then rebooting&lt;br /&gt;&lt;br /&gt;For me, iptables is the riskiest to edit because one bad rule can lock you out of ssh on port 22.&lt;br /&gt;&lt;br /&gt;To protect yourself, use 'at' to revert the file change 5 minutes in the future:&lt;br /&gt;echo 'mv ifcfg-eth0.save ifcfg-eth0' at now + 5 minute&lt;br /&gt;&lt;br /&gt;*this will work even if you are kicked out (as long as the server is running).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--update-- here is another way to prevent getting locked out by iptables during testing:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;*/10 * * * * iptables -P INPUT ACCEPT; iptables -P OUTPUT ACCEPT; iptables -P FORWARD ACCEPT; /sbin/iptables -F &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;This will flush all the rules every 10 minutes, just in case you lock yourself out. When you're happy with the results of your work, remove the line from your crontab, and you're in business.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-6884263563289760469?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/6884263563289760469/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=6884263563289760469' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/6884263563289760469'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/6884263563289760469'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2008/02/setup-future-rescue-with-at-comand.html' title='Setup a Future Rescue with the &apos;at&apos; Comand'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-4215424363587849639</id><published>2007-05-05T18:25:00.000-07:00</published><updated>2007-05-06T19:53:07.687-07:00</updated><title type='text'>Consolidate your web architecture -w- vmware</title><content type='html'>&lt;strong&gt;Good and Cheap Hardware&lt;/strong&gt;&lt;br /&gt;CPU: AMD64 Dual Core Processor 4400+&lt;br /&gt;Clock: 2.2 GHz&lt;br /&gt;Ram: 1 Gig&lt;br /&gt;&lt;br /&gt;1) Select a CentOS 4.4 install (With 5 usable ip addresses)&lt;br /&gt;2) Install vmware server (See last weeks post)&lt;br /&gt;3) Download CentOS 5 virtual appliance and cp into /vm directory&lt;br /&gt;&lt;a href="http://www.vmware.com/vmtn/appliances/directory/820"&gt;http://www.vmware.com/vmtn/appliances/directory/820&lt;/a&gt;&lt;br /&gt;4) Download MySQL Appliance and cp into /vm directory&lt;br /&gt;5) Download memcached Appliance and cp into /vm directory&lt;br /&gt;&lt;br /&gt;6) Edit /etc/sysconfig/network-scripts/ifcfg-eth0-range0 to free up 3 ip addresses&lt;br /&gt;## START&lt;br /&gt;#IPADDR_START=72.xxx.xxx.19&lt;br /&gt;IPADDR_START=72.xxx.xxx.22&lt;br /&gt;IPADDR_END=72.xxx.xxx.22&lt;br /&gt;CLONENUM_START=0&lt;br /&gt;##END&lt;br /&gt;&lt;br /&gt;7) service network restart&lt;br /&gt;New ifconfig wil show IP's up on eth0 and and one ethernet alias eth0:0&lt;br /&gt;&lt;br /&gt;8) run vmware_config.pl&lt;br /&gt;for networking, select vmnet0 to bridge on eth0&lt;br /&gt;set vmware default appliance directory to /vm&lt;br /&gt;&lt;br /&gt;9) From a pc start vmware client and connect to the remote server.&lt;br /&gt;10) "Open existing virtual machine" and browse to each appliance to install.&lt;br /&gt;11) Start up both vm appliances and setup networking.&lt;br /&gt;ifconfig eth0 72.xxx.xxx.19&lt;br /&gt;route add default gw [use the same gateway that is used on the host server]&lt;br /&gt;make changes permanent&lt;br /&gt;&lt;br /&gt;/etc/sysconfig/network-scripts/ifcfg-eth0&lt;br /&gt;DEVICE=eth0&lt;br /&gt;BOOTPROTO=static&lt;br /&gt;HWADDR=00:0c:22:32:s0:d4&lt;br /&gt;IPADDR=72.xxx.xxx.19&lt;br /&gt;NETMASK=255.255.55.248&lt;br /&gt;ONBOOT=yes&lt;br /&gt;&lt;br /&gt;&lt;code&gt;# vi /etc/sysconfig/network&lt;/code&gt;&lt;br /&gt;Append/modify configuration as follows:&lt;br /&gt;&lt;code&gt;NETWORKING=yes&lt;br /&gt;HOSTNAME=www1.fubar.com&lt;br /&gt;GATEWAY=72.xxx.xxx.xxx&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Set the correct DNS server defined in /etc/resolv.conf file:&lt;br /&gt;&lt;code&gt;# vi /etc/resolv.conf&lt;/code&gt;&lt;br /&gt;&lt;code&gt;nameserver 72.yyy.yyy.yyy&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;service network restart&lt;br /&gt;ping google.com&lt;br /&gt;&lt;br /&gt;12) Assign DNS names to the new servers&lt;br /&gt;&lt;br /&gt;13) Install vmware tools. This is not required if you will usually login to the server via ssh.&lt;br /&gt;&lt;a href="http://www.thoughtpolice.co.uk/vmware/howto/centos-5-vmware-tools-install.html"&gt;http://www.thoughtpolice.co.uk/vmware/howto/centos-5-vmware-tools-install.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-4215424363587849639?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/4215424363587849639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=4215424363587849639' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/4215424363587849639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/4215424363587849639'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2007/05/consolidate-your-web-architecture-w.html' title='Consolidate your web architecture -w- vmware'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-8185028995871998911</id><published>2007-04-29T13:57:00.000-07:00</published><updated>2007-05-05T18:43:55.767-07:00</updated><title type='text'>Install Vmware on 64 bit CENTOS 4.4</title><content type='html'>Here are detailed instructions on how to successfully install vmware on a 64 bit server running CENT0S 4.4&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="COLOR: rgb(51,51,153);font-family:arial;" &gt;The server:&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153);font-family:arial;" &gt;OS: CentOS 5 x86_64&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153);font-family:arial;" &gt;Hardware: AMD 64 Athlon 4400 DC/1024MB/160GB SATA&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153);font-family:arial;" &gt;# uname -a&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153);font-family:arial;" &gt;Linux xx.xx.xx.xx 2.6.9-42.0.10.ELsmp #1 SMP Tue Feb 27 09:40:21 EST 2007 x86_64 x86_64 x86_64 GNU/Linux&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153);font-family:arial;" &gt;# arch -a&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153);font-family:arial;" &gt;x86_64&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153);font-family:arial;" &gt;#cat /etc/redhat-release&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153);font-family:arial;" &gt;CentOS release 5 (Final) *&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153);font-family:arial;" &gt;[Thanks to my &lt;a href="http://www.layeredtech.com/"&gt;hosting provider&lt;/a&gt; LayeredTech. They Rock!]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;First, download and install the latest &lt;a href="http://register.vmware.com/content/download.html"&gt;VMware Server&lt;/a&gt;. Since there are no x64 rpm files I used the x86. I hope it will efficiently using this CPU.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="COLOR: rgb(51,51,153);font-size:78%;" &gt;sh-3.00# rpm -ivh VMware-server-1.0.3-44356.i386.rpm&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153);font-size:78%;" &gt;sh-3.00#&lt;/span&gt;&lt;span style="COLOR: rgb(51,51,153);font-size:78%;" &gt; vmware-config.pl&lt;br /&gt;The correct version of one or more libraries needed to run VMware Server may be&lt;br /&gt;missing. This is the output of ldd /usr/bin/vmware:&lt;br /&gt;linux-gate.so.1 =&gt; (0xffffe000)&lt;br /&gt;libm.so.6 =&gt; /lib/tls/libm.so.6 (0xf7fd0000)&lt;br /&gt;libdl.so.2 =&gt; /lib/libdl.so.2 (0xf7fcc000)&lt;br /&gt;libpthread.so.0 =&gt; /lib/tls/libpthread.so.0 (0xf7fba000)&lt;br /&gt;libX11.so.6 =&gt; not found&lt;br /&gt;libXtst.so.6 =&gt; not found&lt;br /&gt;libXext.so.6 =&gt; not found&lt;br /&gt;libXt.so.6 =&gt; not found&lt;br /&gt;libICE.so.6 =&gt; not found&lt;br /&gt;libSM.so.6 =&gt; not found&lt;br /&gt;libXrender.so.1 =&gt; not found&lt;br /&gt;libz.so.1 =&gt; not found&lt;br /&gt;libc.so.6 =&gt; /lib/tls/libc.so.6 (0x001e6000)&lt;br /&gt;/lib/ld-linux.so.2 (0x001cd000)&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153);font-size:78%;" &gt;This program cannot tell for sure, but you may need to upgrade libc5 to glibc&lt;br /&gt;before you can run VMware Server.&lt;br /&gt;&lt;br /&gt;Hit enter to continue.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is the first hint of trouble. Next after a few more prompts you will see an error message about a missing X library file.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;/usr/lib/vmware/bin/vmware-vmx: error while loading shared libraries: libX11.so. 6: cannot open shared object file: No such file or directory&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;Please enter your 20-character serial number.&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;This is because vmware server is compiled against X libraries on the x86 architecture. To me this is an odd dependency because most servers do not run Xwindows. Personally, I never use Xwindows on servers, but to get past the vmware-config.pl installation you must install the xorg-x11-libs for x86 platform (even if you are on a x64).&lt;br /&gt;&lt;br /&gt;Here is how it went:&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;rpm -ivh xorg-x11-libs-6.8.2-1.EL.13.37.7.i386.rpm&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;error: Failed dependencies:&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;libGL.so.1 is needed by xorg-x11-libs-6.8.2-1.EL.13.37.7.i386&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;libexpat.so.0 is needed by xorg-x11-libs-6.8.2-1.EL.13.37.7.i386&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;libfontconfig.so.1 is needed by xorg-x11-libs-6.8.2-1.EL.13.37.7.i386&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;libfreetype.so.6 is needed by xorg-x11-libs-6.8.2-1.EL.13.37.7.i386&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;libz.so.1 is needed by xorg-x11-libs-6.8.2-1.EL.13.37.7.i386&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;OK, so first I need to download the libraries that are needed.&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153);font-size:78%;" &gt;wget ftp://ftp.nluug.nl/pub/os/Linux/distr/smeserver/releases/testing/7.2/smeos/i386/CentOS/RPMS/xorg-x11-libs-6.8.2-1.EL.13.37.7.i386.rpm&lt;br /&gt;wget ftp://ftp.nluug.nl/pub/os/Linux/distr/smeserver/releases/7.1/smeos/i386/CentOS/RPMS/zlib-1.2.1.2-1.2.i386.rpm&lt;br /&gt;wget ftp://ftp.nluug.nl/pub/metalab/distributions/smeserver/releases/7.1/smeos/i386/CentOS/RPMS/expat-1.95.7-4.i386.rpm&lt;br /&gt;wget ftp://ftp.nluug.nl/pub/ibiblio/distributions/smeserver/releases/7.1/smeos/i386/CentOS/RPMS/fontconfig-2.2.3-7.centos4.i386.rpm&lt;br /&gt;wget ftp://ftp.nluug.nl/pub/os/Linux/distr/CentOS/4.4/updates/i386/RPMS/freetype-devel-2.1.9-5.el4.i386.rpm&lt;br /&gt;wget ftp://ftp.nluug.nl/pub/sunsite/distributions/smeserver/releases/testing/7.2/smeos/i386/CentOS/RPMS/xorg-x11-Mesa-libGL-6.8.2-1.EL.13.37.7.i386.rpm&lt;br /&gt;wget ftp://ftp.nluug.nl/pub/os/Linux/distr/CentOS/4.4/updates/x86_64/RPMS/freetype-2.1.9-5.el4.i386.rpm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;rpm -ivh xorg-x11-libs-6.8.2-1.EL.13.37.7.i386.rpm xorg-x11-Mesa-libGL-6.8.2-1.EL.13.37.7.i386.rpm expat-1.95.7-4.i386.rpm fontconfig-2.2.3-7.centos4.i386.rpm freetype-devel-2.1.9-5.el4.i386.rpm zlib-1.2.1.2-1.2.i386.rpm freetype-2.1.9-5.el4.i386.rpm&lt;br /&gt;Preparing... ########################################### [100%]&lt;br /&gt;1:zlib ########################################### [ 14%]&lt;br /&gt;2:freetype ########################################### [ 29%]&lt;br /&gt;3:expat ########################################### [ 43%]&lt;br /&gt;4:fontconfig ########################################### [ 57%]&lt;br /&gt;5:freetype-devel ########################################### [ 71%]&lt;br /&gt;6:xorg-x11-Mesa-libGL ########################################### [ 86%]&lt;br /&gt;7:xorg-x11-libs ########################################### [100%]&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;OK, so now I got xorg-x11 library installed I can retry the vmware-config.pl script.&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;Please enter your 20-character serial number.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;Type XXXXX-XXXXX-XXXXX-XXXXX or 'Enter' to cancel: &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;Starting VMware services:&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;Virtual machine monitor [ OK ]&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;Virtual ethernet [ OK ]&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;Bridged networking on /dev/vmnet0 [ OK ]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;The configuration of VMware Server 1.0.3 build-44356 for Linux for this running&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: rgb(51,51,153)"&gt;kernel completed successfully.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Success!!&lt;br /&gt;&lt;br /&gt;Thanks to&lt;span style="font-size:100%;"&gt; Karanbir Singh for his blog post on installing vmware on CENTOS 4.4.&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.karan.org/blog/index.php/2006/05/01/vmware_server_on_x86_64_centos4_redhat_e"&gt;vmware_server_on_x86_64_centos4_redhat_e&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-8185028995871998911?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/8185028995871998911/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=8185028995871998911' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/8185028995871998911'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/8185028995871998911'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2007/04/install-vmware-on-64-bit-centos-5.html' title='Install Vmware on 64 bit CENTOS 4.4'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-6248767553896106325</id><published>2007-04-20T13:04:00.000-07:00</published><updated>2007-04-20T13:22:25.422-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql putty firewall port forward'/><title type='text'>Easiest possible way to port forward</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_JHUjT5nKg6c/Rikg9o9zpsI/AAAAAAAAAAM/Tj_r32dkO5o/s1600-h/putty_port_forward.PNG"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_JHUjT5nKg6c/Rikg9o9zpsI/AAAAAAAAAAM/Tj_r32dkO5o/s320/putty_port_forward.PNG" border="0" alt=""id="BLOGGER_PHOTO_ID_5055608300040857282" /&gt;&lt;/a&gt;&lt;br /&gt;Say you have a mysql server that you do not want to make public. Port 3306 is blocked by your firewall but port 22 is open for ssh.&lt;br /&gt;&lt;br /&gt;Just connect tp your mysql server from putty on port 22 and modify one setting.&lt;br /&gt;Connection-&gt;SSH-&gt;Tunnels add "L3306 127.0.0.1:3306" &lt;br /&gt;&lt;br /&gt;After you make this change you can Click on Session and save your changes.&lt;br /&gt;&lt;br /&gt;Once you connect through putty, you will be able to access the remote mysql server by localhost:3306.&lt;br /&gt;&lt;br /&gt;Warning: Don't forget that this port is local now! If you forget that port 3306 is forwarded, you may wonder why you have a mysql server running on your machine. &lt;br /&gt;If you decide later to install mysql on your local machine you should delete the port forward from the putty config to avoid unintentional changes your remote server.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-6248767553896106325?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/6248767553896106325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=6248767553896106325' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/6248767553896106325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/6248767553896106325'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2007/04/easiest-possible-way-to-port-forward.html' title='Easiest possible way to port forward'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_JHUjT5nKg6c/Rikg9o9zpsI/AAAAAAAAAAM/Tj_r32dkO5o/s72-c/putty_port_forward.PNG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-115601586092210500</id><published>2006-08-19T12:07:00.000-07:00</published><updated>2006-08-19T12:31:00.970-07:00</updated><title type='text'>Awking Mysql</title><content type='html'>How do you perform awk type functions in Mysql? &lt;br /&gt;&lt;br /&gt;Say you have a list of urls and you want to find the most common domain names hosting gif files.&lt;br /&gt;&lt;br /&gt;http://www.fileden.com/123/foo.gif&lt;br /&gt;http://h1.ripway.com/11.gif&lt;br /&gt;http://www.hostmyfile.info/22/web.gif&lt;br /&gt;http://www.fileden.com/24/fun.gif&lt;br /&gt;&lt;br /&gt;If this list is in a file you can use standard linux commands to find the most common domains.&lt;br /&gt;&lt;br /&gt;grep '\.mp3' my_pictures |awk -F'/' '{print $3}' |sort |uniq -c|sort -nr&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If the list is in a mysql database you can use locate() and substring() to accomplish the same thing!&lt;br /&gt;&lt;br /&gt;SELECT count(*) as count, substring(url,1,locate('/',url,9)) as f FROM `my_pictures` WHERE url IS NOT NULL and url !='' and filename like '%.mp3' group by f order by count desc&lt;br /&gt;&lt;br /&gt;Happy Awking!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-115601586092210500?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/115601586092210500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=115601586092210500' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/115601586092210500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/115601586092210500'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2006/08/awking-mysql.html' title='Awking Mysql'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-115265368664134496</id><published>2006-07-11T14:27:00.000-07:00</published><updated>2006-07-11T14:34:46.713-07:00</updated><title type='text'>phpMyAdmin #1045 - Access denied for user 'root'@'localhost' (using password: NO)</title><content type='html'>&lt;h1&gt;When installing phpMyAdmin the most common error is not being able to connect to the database after installation.&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;#1045 - Access denied for user 'root'@'localhost' (using password: NO)&lt;br /&gt;&lt;br /&gt;Here is the solution:&lt;br /&gt;Make sure your config file in the phpMyAdmin directory is named "config.inc.php"!&lt;br /&gt;&lt;br /&gt;In the installation instuctions it says to copy config.default.php into the phpMyAdmin directory and then customize it (usually the only change needed is to change the 'auth_type' is changed from 'config' to 'http'). Make sure to rename &lt;b&gt;config.default.php&lt;/b&gt; to &lt;b&gt;config.inc.php&lt;/b&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-115265368664134496?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/115265368664134496/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=115265368664134496' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/115265368664134496'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/115265368664134496'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2006/07/phpmyadmin-1045-access-denied-for-user.html' title='phpMyAdmin #1045 - Access denied for user &apos;root&apos;@&apos;localhost&apos; (using password: NO)'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-115202374653319863</id><published>2006-07-04T07:31:00.000-07:00</published><updated>2006-07-05T05:07:43.566-07:00</updated><title type='text'>Get the Latidude and  Longitude from an IP</title><content type='html'>ip2location shell script&lt;br /&gt;&lt;br /&gt;for k in `cat ip_list`; &lt;br /&gt;do &lt;br /&gt;  id=`echo $k|awk -F_ '{print $1}'`; &lt;br /&gt;  ip_num=`echo $k|awk -F_ '{print $2}'|awk -F. '{ printf "%10d\n",$1 * 16777216 + $2 * 65536 + $3 * 256 + $4 }'`; &lt;br /&gt;  echo id=$id; &lt;br /&gt;  echo ip_num=$ip_num; &lt;br /&gt;  echo "SELECT ip_latitude,ip_longitude,ip_city FROM ip2location WHERE (ip_from &lt;= $ip_num) AND (ip_to &gt;= $ip_num) LIMIT 1"|mysql -u doug crostel_store; &lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;UPDATE my_space_users u,&lt;br /&gt;ip2location i SET u.user_location = i.ip_city WHERE (&lt;br /&gt;&lt;br /&gt;ip_from &lt;=1091213045&lt;br /&gt;) AND (&lt;br /&gt;ip_to &gt;=1091213045&lt;br /&gt;) LIMIT 2&lt;br /&gt;&lt;br /&gt;mysql&gt; update my_space_users u, ip2location l set u.ip_country=l.country_short, u.ip_region=l.ip_region, u.ip_city=l.ip_city, u.ip_latitude=l.ip_latitude, u.ip_longitude=l.ip_longitude, u.ip_isp=l.ip_isp, u.ip_domain=l.ip_domain WHERE (l.ip_from &lt;= u.reg_ip_num) AND (l.ip_to &gt;= u.reg_ip_num);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-115202374653319863?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/115202374653319863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=115202374653319863' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/115202374653319863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/115202374653319863'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2006/07/get-latidude-and-longitude-from-ip.html' title='Get the Latidude and  Longitude from an IP'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-114496019665293519</id><published>2006-04-13T09:34:00.000-07:00</published><updated>2011-08-16T05:53:47.472-07:00</updated><title type='text'>Using Wikipedia as a natural language corpus</title><content type='html'>1) download the english yahoo abstracts from&lt;br /&gt;&lt;br /&gt;&lt;div&gt;http://en.wikipedia.org/wiki/Sort-Merge_Join&lt;/div&gt;&lt;div&gt;&lt;br /&gt;wiki.txt&lt;br /&gt;Anarchism is derived from the Greek Î±Î½Î±ÏÏÎ¯Î± ("without archons (ruler, chief, king)"). Anarchism as a political philosophy, is the belief that rulers, governments, and hierarchal social relationships are unnecessary and should be abolished, although there are differing interpretations of what this means.&lt;br /&gt;|&lt;br /&gt;Albedo is the measure of reflectivity of a surface or body. It is the ratio of electromagnetic radiation (EM radiation) reflected to the amount incident upon it.&lt;br /&gt;Abu Dhabi (Arabic: Ø£Ø¨Ù Ø¸Ø¨Ù Ê¼AbÅ« áºaby) is the largest of the seven emirates that comprise the United Arab Emirates and was also the largest of the former Trucial States. Abu Dhabi is also a city of the same name within the Emirate that is the capital of the country, in north central UAE.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;wiki.txt1&lt;br /&gt;Anarchism&lt;br /&gt;is&lt;br /&gt;derived&lt;br /&gt;from&lt;br /&gt;the&lt;br /&gt;&lt;br /&gt;wiki.txt2&lt;br /&gt;is&lt;br /&gt;derived&lt;br /&gt;from&lt;br /&gt;the&lt;br /&gt;Greek&lt;br /&gt;&lt;br /&gt;wiki.txt12&lt;br /&gt;Anarchism       is&lt;br /&gt;is      derived&lt;br /&gt;derived from&lt;br /&gt;from    the&lt;br /&gt;the     Greek&lt;br /&gt;&lt;br /&gt;wiki.txt.sorted&lt;br /&gt;wiki.txt.sorted.1&lt;br /&gt;wiki.txt.sorted.nonums&lt;br /&gt;wiki.txt.sorted.nonums1&lt;br /&gt;wiki.txt.sorted.nonums1.uniq&lt;br /&gt;wiki.txt.sorted.nonums1.uniq.2words&lt;br /&gt;&lt;br /&gt;export LC_ALL=C&lt;br /&gt;&lt;br /&gt;cat&lt;br /&gt;wordnet.index&lt;br /&gt;wordnet.index.sorted&lt;br /&gt;wordnet.index.sorted.uniq&lt;br /&gt;wiki.txt.sorted.nonums1.uniq.2words.cols&lt;br /&gt;wiki.txt.sorted.nonums1.uniq.2words.cols.LC_ALL&lt;br /&gt;wordnet.index.sorted.uniq.LC_ALL&lt;br /&gt;wiki-wordnet.join&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for k in `cat wordnet.index.sorted.uniq.LC_ALL`; do look $k wiki.txt.sorted.nonums1.uniq.2words.cols.LC_ALL; done &amp;gt;/tar-backups/wiki-wordnet.join&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3 word n-grams&lt;br /&gt;grep -v '[^[:print:]]' wiki.txt1 &amp;gt;wiki1.txt&lt;br /&gt;tail +2 wiki1.txt &amp;gt;wiki2.txt&lt;br /&gt;tail +2 wiki2.txt &amp;gt;wiki3.txt&lt;br /&gt;&lt;br /&gt;grep "[[:print:]]\+\t[[:print:]]\+\t[[:print:]]" wiki123.txt &amp;gt;wiki123.txt3&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;find the most used 3 word phrases in a text file&lt;br /&gt;sort rewrite123.txt3 &amp;gt;rewrite123.txt3&lt;br /&gt;grep ".\+\t.\+\t.\+" rewrite123.txt &amp;gt;rewrite123.txt3&lt;br /&gt;sort rewrite123.txt3 &amp;gt;rewrite123.txt3.sorted&lt;br /&gt;uniq -dc rewrite123.txt3.sorted &amp;gt;rewrite123.txt3.sorted.uniqd&lt;br /&gt;sort -nr rewrite123.txt3.sorted.uniqd &amp;gt;rewrite123.txt3.sorted.uniqd.sorted&lt;br /&gt;more rewrite123.txt3.sorted.uniqd.sorted&lt;br /&gt;&lt;br /&gt;    3 be traveling with&lt;br /&gt;    2 you want to&lt;br /&gt;    2 want to have&lt;br /&gt;    2 student group bookings.&lt;br /&gt;    2 part of their&lt;br /&gt;    2 on the other&lt;br /&gt;    2 notarized letter of&lt;br /&gt;    2 made with tap&lt;br /&gt;    2 entertainment , activities&lt;br /&gt;    2 and want to&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-114496019665293519?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/114496019665293519/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=114496019665293519' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/114496019665293519'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/114496019665293519'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2006/04/using-wikipedia-as-natural-language.html' title='Using Wikipedia as a natural language corpus'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-114272340079020244</id><published>2006-03-18T15:10:00.000-08:00</published><updated>2006-03-18T15:10:06.306-08:00</updated><title type='text'>Plot a wav file - wav2png</title><content type='html'>#!/bin/sh&lt;br /&gt;#usage: wav2png.sh file.wav&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;BASE=${1%.wav}&lt;br /&gt;PNG=$BASE.png&lt;br /&gt;WAV=$BASE.wav&lt;br /&gt;DAT=$BASE.dat&lt;br /&gt;&lt;br /&gt;#echo $BASE,$PNG,$WAV,$DAT&lt;br /&gt;sox $WAV $DAT&lt;br /&gt;grep -v '^;' $DAT &gt;$DAT.clean&lt;br /&gt;FREQ=`head -1 $DAT|tr -d ';'`&lt;br /&gt;&lt;br /&gt;echo -e "set terminal png;set title '$FREQ';set output '$PNG'; plot '$DAT.clean'" |gnuplot&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-114272340079020244?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/114272340079020244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=114272340079020244' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/114272340079020244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/114272340079020244'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2006/03/plot-wav-file-wav2png.html' title='Plot a wav file - wav2png'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-114271547396914196</id><published>2006-03-18T12:57:00.000-08:00</published><updated>2006-03-18T12:57:58.613-08:00</updated><title type='text'>Split a midi file into separate tracks</title><content type='html'>Get the program:&lt;br /&gt;&lt;br /&gt;wget http://interglacial.com/~sburke/pub/midi_splitter.pl&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;perl midi_splitter.pl /tmp/vanilla.mid&lt;br /&gt;file vanilla*.mid&lt;br /&gt;midi2abc vanilla.mid&lt;br /&gt;midi2abc vanilla_t01_c00.mid &gt;vanilla_t01.abc&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-114271547396914196?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/114271547396914196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=114271547396914196' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/114271547396914196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/114271547396914196'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2006/03/split-midi-file-into-separate-tracks.html' title='Split a midi file into separate tracks'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-114252138362370108</id><published>2006-03-16T07:03:00.000-08:00</published><updated>2006-03-16T07:12:55.090-08:00</updated><title type='text'>Access internet hotspots in client mode with WRT54G</title><content type='html'>Linksys WRT54G (below version 5 because linksys later switched to vmware)&lt;br /&gt;&lt;br /&gt;Load the sveasoft firmware. (I am using Alchemy-pre5.3 v2.04.4.8sv)&lt;br /&gt;&lt;br /&gt;Put it in client mode with loopback off.&lt;br /&gt;&lt;br /&gt;Here is a good tutorial:&lt;br /&gt;http://www.engadget.com/2005/05/24/how-to-connect-your-linksys-wrt54g-network-to-the-internet/&lt;br /&gt;&lt;br /&gt;ssh into the router and type:&lt;br /&gt;~ # wl scan&lt;br /&gt;~ # wl scanresults|tr -d '\n' |sed 's/noise/\n/g' |tr ']' '\n'|grep ^SSID|awk '{print $(NF-1),$2}' |sed 's/Mode://'|sort -n&lt;br /&gt;-96 "zeus"&lt;br /&gt;-94 "LF-X1U.00014A10A7C8"&lt;br /&gt;-94 "wireless"&lt;br /&gt;-89 "Doug"&lt;br /&gt;-88 "GHOST"&lt;br /&gt;-86 "COR-MDA-LAN"&lt;br /&gt;-86 "linksys"&lt;br /&gt;-86 "linksys"&lt;br /&gt;-83 "default"&lt;br /&gt;-83 "hpsetup"&lt;br /&gt;-83 "linksys"&lt;br /&gt;-78 "hpsetup"&lt;br /&gt;-78 "linksys"&lt;br /&gt;-74 "hirsh&lt;br /&gt;-51 "link"&lt;br /&gt;&lt;br /&gt;You will get a sorted list of the most powerfull access points in range.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-114252138362370108?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/114252138362370108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=114252138362370108' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/114252138362370108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/114252138362370108'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2006/03/access-internet-hotspots-in-client.html' title='Access internet hotspots in client mode with WRT54G'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-114116397706712746</id><published>2006-02-28T13:59:00.000-08:00</published><updated>2006-02-28T13:59:39.286-08:00</updated><title type='text'>Split a polyphonic midi file into monophonic tracks</title><content type='html'>&lt;span style="text-decoration: underline;"&gt;&lt;br /&gt;perl midi_splitter.pl /tmp/vanilla.mid&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-114116397706712746?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/114116397706712746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=114116397706712746' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/114116397706712746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/114116397706712746'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2006/02/split-polyphonic-midi-file-into.html' title='Split a polyphonic midi file into monophonic tracks'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-113328995616788348</id><published>2005-11-29T10:40:00.000-08:00</published><updated>2005-12-30T19:26:41.126-08:00</updated><title type='text'>Music secrets revealed</title><content type='html'>&lt;span class="headline"&gt;&lt;/span&gt;&lt;a href="http://www.oreillynet.com/pub/au/1841"&gt;&lt;/a&gt;&lt;br /&gt;"             Using &lt;a href="http://sox.sourceforge.net/"&gt;Sox&lt;/a&gt;, &lt;a href="http://lame.sourceforge.net/"&gt;LAME&lt;/a&gt;, &lt;a href="http://flac.sourceforge.net/"&gt;FLAC&lt;/a&gt;, and &lt;a href="http://www.underbit.com/products/mad/"&gt;madplay&lt;/a&gt; - I put together this "dictionary" of shell commands that can be run to convert audio from one format to other, including dialup-modem-streamable lofi mono MP3 files, and including shorter clips of music."&lt;br /&gt;&lt;br /&gt;-Derek Silvers is the founder and sole programmer of  http://cdbaby.com&lt;br /&gt;&lt;br /&gt;Well done!&lt;br /&gt;&lt;br /&gt;See the article here:&lt;br /&gt;&lt;a href="http://www.oreillynet.com/pub/wlg/5894"&gt;www.oreillynet.com/pub/wlg/5894&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here are a few other usefull linux audio commands:&lt;br /&gt;&lt;br /&gt;mp3info /tmp/07_The_Worst_Hangover_Ever.mp3&lt;br /&gt;48 kbit/s j-stereo (2m 57s)&lt;br /&gt;&lt;br /&gt;sox /tmp/orig.07_The_Worst_Hangover_Ever.wav -e stat&lt;br /&gt;Samples read:          15695872&lt;br /&gt;Length (seconds):    177.957732&lt;br /&gt;Scaled by:         2147483647.0&lt;br /&gt;Maximum amplitude:     0.999969&lt;br /&gt;Minimum amplitude:    -1.000000&lt;br /&gt;Midline amplitude:    -0.000015&lt;br /&gt;Mean    norm:          0.237282&lt;br /&gt;Mean    amplitude:    -0.000037&lt;br /&gt;RMS     amplitude:     0.312397&lt;br /&gt;Maximum delta:         1.965851&lt;br /&gt;Minimum delta:         0.000000&lt;br /&gt;Mean    delta:         0.163578&lt;br /&gt;RMS     delta:         0.230147&lt;br /&gt;Rough   frequency:         5170&lt;br /&gt;Volume adjustment:        1.000&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-113328995616788348?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/113328995616788348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=113328995616788348' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/113328995616788348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/113328995616788348'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/11/music-secrets-revealed.html' title='Music secrets revealed'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-113267814748006923</id><published>2005-11-22T08:40:00.000-08:00</published><updated>2005-11-22T08:49:07.503-08:00</updated><title type='text'>Using pdftk to process pdf files</title><content type='html'>pdftk multimodal.pdf dump_data output report.txt; cat report.txt&lt;br /&gt;&lt;br /&gt;pdftk multimodal.pdf dump_data_fields output report.txt; cat report.txt&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-113267814748006923?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/113267814748006923/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=113267814748006923' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/113267814748006923'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/113267814748006923'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/11/using-pdftk-to-process-pdf-files.html' title='Using pdftk to process pdf files'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-112961456303834194</id><published>2005-10-17T22:45:00.000-07:00</published><updated>2007-05-05T18:28:12.668-07:00</updated><title type='text'>Yahoo hosting MySQL tricks</title><content type='html'>To load a csv file into a MySQL database.&lt;br /&gt;&lt;br /&gt;1) FTP the csv file to /tmp/afile.csv directory on your yahoo server.&lt;br /&gt;&lt;br /&gt;2)From yourdomain.com/phpMySql run this sql:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;LOAD DATA LOCAL INFILE '/tmp/afile.csv' REPLACE INTO TABLE `carrier`&lt;br /&gt;FIELDS TERMINATED BY ''&lt;br /&gt;OPTIONALLY ENCLOSED BY '"'&lt;br /&gt;ESCAPED BY '\\'&lt;br /&gt;LINES TERMINATED BY '\n';&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is another example:&lt;br /&gt;&lt;br /&gt;LOAD DATA LOCAL INFILE "/tmp/IP.CSV" INTO TABLE iploc FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\r\n'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-112961456303834194?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112961456303834194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112961456303834194'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/10/yahoo-hosting-mysql-tricks.html' title='Yahoo hosting MySQL tricks'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-112865403794131706</id><published>2005-10-06T19:59:00.000-07:00</published><updated>2007-05-05T18:29:22.495-07:00</updated><title type='text'>Lame is sweet</title><content type='html'>Lame is a pretty cool linux program you can use to batch process MP3 files:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;lame --resample 22.05 --scale 10 -b 48 -a HowBizarre.wav -o HowBizarreLoud.mp3&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;while i'm at it; here is the whole script&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;#!/bin/bash&lt;br /&gt;for k in *&lt;br /&gt;do&lt;br /&gt;lame --resample 22.05 --scale 10 -b 48 -a $k -o ${k%.wav}.mp3&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-112865403794131706?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112865403794131706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112865403794131706'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/10/lame-is-sweet.html' title='Lame is sweet'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-112801049495685765</id><published>2005-09-29T09:08:00.000-07:00</published><updated>2005-09-29T09:14:54.960-07:00</updated><title type='text'>Garbled man pages in Linux?</title><content type='html'>I use the putty windows client to connect to my linux boxes and always run into this problem:&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&gt;man sort&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;NAME&lt;br /&gt;       sort â sort lines of text files&lt;br /&gt;SYNOPSIS&lt;br /&gt;       sort [OPTION]... [FILE]...&lt;br /&gt;DESCRIPTION&lt;br /&gt;       Write sorted concatenation of all FILE(s) to standard output.&lt;br /&gt;       Ordering options:&lt;br /&gt;&lt;br /&gt;       Mandatory  arguments  to  long  options are mandatory for short options&lt;br /&gt;       too.&lt;br /&gt;       âb, ââignoreâleadingâblanks ignore leading blanks&lt;br /&gt;       âd, ââdictionaryâorder&lt;br /&gt;              consider only blanks and alphanumeric characters&lt;br /&gt;       âf, ââignoreâcase&lt;br /&gt;              fold lower case to upper case characters&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:100%;"&gt;Luckily there is an easy fix:&lt;br /&gt;&lt;br /&gt;export  LANG="en_US"&lt;br /&gt;&lt;br /&gt;I don't know why Fedora sets the LANG variable to something that breaks your terminal.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-112801049495685765?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/112801049495685765/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=112801049495685765' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112801049495685765'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112801049495685765'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/09/garbled-man-pages-in-linux.html' title='Garbled man pages in Linux?'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-112302636679061816</id><published>2005-08-02T15:05:00.000-07:00</published><updated>2007-05-05T18:29:44.602-07:00</updated><title type='text'>SMS service centers</title><content type='html'>t-mobile 12063130004&lt;br /&gt;cingular 13123149810&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-112302636679061816?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112302636679061816'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112302636679061816'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/08/sms-service-centers.html' title='SMS service centers'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-112299015189399736</id><published>2005-08-02T06:42:00.000-07:00</published><updated>2005-08-02T06:51:42.240-07:00</updated><title type='text'>Fix a hosed Linux terminal</title><content type='html'>Are you seeing this:&lt;br /&gt;[⎼⎺⎺├@▒1▒ ·]#&lt;br /&gt;[⎼⎺⎺├@▒1▒ ·]# ⎽├├≤ ␋␌▒␌⎺┼&lt;br /&gt;&lt;br /&gt;Instead of this?&lt;br /&gt;[root@a1a ~]#&lt;br /&gt;[root@a1a ~]# ls&lt;br /&gt;&lt;br /&gt;Your screen can get hosed if you cat a binary file or for some reason your screen recieved a ^n character. This trash on your screen is called graphics mode. You can fix it by typing:&lt;br /&gt;&lt;br /&gt;echo  ^O&lt;br /&gt;&lt;br /&gt;-while you are typing, it will look like garbage on the screen. Don't worry.&lt;br /&gt;-to print a control O you can type: echo ctl-v ctl-o&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.linuxgazette.com/node/8380"&gt;More 2 Cent Tips... | Linux Gazette&lt;/a&gt;: "To force it back you need to have a shell or other program to send the&lt;br /&gt;^o to the stricken display. I often switch to another virtual terminal&lt;br /&gt;and do an 'echo -e '\017' &gt;/dev/tty2'"&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-112299015189399736?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/112299015189399736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=112299015189399736' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112299015189399736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112299015189399736'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/08/fix-hosed-linux-terminal.html' title='Fix a hosed Linux terminal'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-112059053696322959</id><published>2005-07-05T12:07:00.000-07:00</published><updated>2005-07-05T12:08:56.966-07:00</updated><title type='text'>GPRS and WAP settings</title><content type='html'>Here is a good link to get worldwide wap settings for pre-paid and contract GSM phones.&lt;br /&gt;&lt;br /&gt;http://www.taniwha.org.uk/gprs.html&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-112059053696322959?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/112059053696322959/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=112059053696322959' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112059053696322959'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112059053696322959'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/07/gprs-and-wap-settings.html' title='GPRS and WAP settings'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-112014860039490728</id><published>2005-06-30T09:21:00.000-07:00</published><updated>2005-07-14T09:23:05.306-07:00</updated><title type='text'>Send an email to any phone</title><content type='html'>&lt;a href="http://www.avtech.com/Support/Email/Email_A.htm"&gt;Here&lt;/a&gt; is a list of email addresses for all cellphones alphabetized by carrier.&lt;br /&gt;http://www.avtech.com/Support/Email/Email_A.htm&lt;span class="down" style="display: block;" id="formatbar_CreateLink" title="Link" onmouseover="ButtonHoverOn(this);" onmouseout="ButtonHoverOff(this);" onmouseup="" onmousedown="CheckFormatting(event);FormatbarButton('richeditorframe', this, 8);ButtonMouseDown(this);"&gt;&lt;img src="img/gl.link.gif" alt="Link" border="0" /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-112014860039490728?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/112014860039490728/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=112014860039490728' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112014860039490728'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/112014860039490728'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/send-email-to-any-phone.html' title='Send an email to any phone'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111988696348484055</id><published>2005-06-27T08:33:00.000-07:00</published><updated>2005-06-27T08:42:43.486-07:00</updated><title type='text'>Nokia secret codes</title><content type='html'>&lt;span style="font-size:85%;color:#000000;"&gt;             * # 06 #    = show the serial number  IMEI    -&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;color:#000000;"&gt;             *#92702689# (= *#war0anty#)   = show warranty information&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111988696348484055?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111988696348484055/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111988696348484055' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111988696348484055'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111988696348484055'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/nokia-secret-codes.html' title='Nokia secret codes'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111988372772891225</id><published>2005-06-27T06:13:00.000-07:00</published><updated>2005-06-27T07:48:47.760-07:00</updated><title type='text'>Nokia Ringtone Capabilities</title><content type='html'>1100 mono -sms delivery&lt;br /&gt;v120t manual&lt;br /&gt;5165 mono - sms delivery&lt;br /&gt;5125 mono - sms delivery&lt;br /&gt;2600 - cingular email&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111988372772891225?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111988372772891225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111988372772891225' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111988372772891225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111988372772891225'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/nokia-ringtone-capabilities.html' title='Nokia Ringtone Capabilities'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111981634592765302</id><published>2005-06-26T12:56:00.000-07:00</published><updated>2005-06-26T13:44:18.076-07:00</updated><title type='text'>SI WAP PUSH Calculator</title><content type='html'>&lt;span style="font-family:courier new;"&gt;echo -n 0051000B919145557705F400F5AA560605040B8423F0DC0601AE&lt;br /&gt;02056A0045C60C033230322e392e39382e35343a383038302f4347536572&lt;br /&gt;7665722f73657276652e6a73703f69643d31323334353600010349742773&lt;br /&gt;206120424f595c215c215c21000101 |&lt;br /&gt;awk -v FIELDWIDTHS="10 12 6 2 38 90 6 32 6" '{printf "%s,%s,%s,%s,%s,%s,",$1,$2,$3,$4,$5,$6; system("echo "$6" |xxd -r -p"); printf ",%s,%s,",$7,$8; system("echo "$8" |xxd -r -p"); printf ",%s,",$9}' |tr ',' '\n'&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;br /&gt;0051000B91                             #top header&lt;br /&gt;9145557705F4                           #11 digit number&lt;br /&gt;00F5AA&lt;br /&gt;56                                     #bytes in payload&lt;br /&gt;0605040B8423F0DC0601AE02056A0045C60C03                                                     #payload header&lt;br /&gt;3230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536&lt;br /&gt;202.9.98.54:8080/CGServer/serve.jsp?id=123456 000103                             &lt;br /&gt;49742773206120424F595C215C215C21       #message in HEX&lt;br /&gt;It's a BOY\!\!\!&lt;br /&gt;000101                                 #footer&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111981634592765302?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111981634592765302/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111981634592765302' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111981634592765302'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111981634592765302'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/si-wap-push-calculator.html' title='SI WAP PUSH Calculator'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111974151944798745</id><published>2005-06-25T15:59:00.000-07:00</published><updated>2005-06-25T16:25:00.210-07:00</updated><title type='text'>Comparing numerical data with sed and diff</title><content type='html'>&lt;span style="font-family:courier new;"&gt;A common situation that occures when working with  Hex  data is &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;you will have a piece of data that works and one that doesn't. The idea &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;is to compare the 2 HEX strings without pulling your hair out.&lt;br /&gt;&lt;br /&gt;Here is a quick way to compare 2 HEX data strings.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;"works_good"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;0051000B919145557705F400F5AA44605040B8423F0DC0601AE02056A&lt;br /&gt;0045C60C0&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;336362e3137362e3231322e3137342f62622f7377696e672&lt;br /&gt;e676966000103497427732061204&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;24f59202120212021000101&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;"works_bad"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;0051000B919145557705F400F5AA440605040B8423F0DC0601AE02056&lt;br /&gt;A0045C60C0336&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;362e3137362e3231322e3137342f62622f7377696e67&lt;br /&gt;2e67696600010349742773206120626f7&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;95c215c215c21000101&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Rather than checking the data with a pencil one byte at a time, we can use sed to break up the data into chunks of 10 and then the diff command to show where the first difference is.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;echo 0051000B919145557705F400F5AA44605040B8423F0DC0601AE02056A&lt;br /&gt;0045C60C0&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;336362e3137362e3231322e3137342f62622f7377696e672e6769&lt;br /&gt;66000103497427732061204&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;24f59202120212021000101 |sed 's/........../&amp;\n/g'&gt;works_bad&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;echo 0051000B919145557705F400F5AA440605040B8423F0DC0601AE02056A&lt;br /&gt;0045C60C0336&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;362e3137362e3231322e3137342f62622f7377696e672e67696&lt;br /&gt;600010349742773206120626f7&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;95c215c215c21000101|sed 's/........../&amp;amp;\n/g'&gt;works_good&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;span style=";font-family:courier new;font-size:100%;"  &gt;[root@a1a ~]# diff --side-by-side a b |grep --color -C500  '|'&lt;br /&gt;&lt;br /&gt;&lt;/span&gt; &lt;span style="font-size:78%;"&gt;&lt;span style="font-family:courier new;"&gt;0051000B91                                                      0051000B91&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;9145557705                                                      9145557705&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;F400F5AA44                                                      F400F5AA44&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;605040B842                                                    &lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(204, 0, 0);font-family:courier new;" &gt;|&lt;/span&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt; 0605040B84&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;3F0DC0601A                                                    | 23F0DC0601&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;E02056A004                                                    | AE02056A00&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;5C60C03363                                                    | 45C60C0336&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;62e3137362                                                    | 362e313736&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;e3231322e3                                                    | 2e3231322e&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;137342f626                                                    | 3137342f62&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;22f7377696                                                    | 622f737769&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;e672e67696                                                    | 6e672e6769&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;6000103497                                                    | 6600010349&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;4277320612                                                    | 7427732061&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;0424f59202                                                    | 20626f795c&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;1202120210                                                    | 215c215c21&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(204, 0, 0);font-family:courier new;" &gt;00101                                                         | 000101&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;We can easily see that 'works_bad' is missing a 0 in position 40.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111974151944798745?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111974151944798745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111974151944798745' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111974151944798745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111974151944798745'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/comparing-numerical-data-with-sed-and.html' title='Comparing numerical data with sed and diff'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111965151495070733</id><published>2005-06-24T15:07:00.000-07:00</published><updated>2005-06-26T13:21:49.713-07:00</updated><title type='text'>Linux Hexadecimal HOWTO</title><content type='html'>&lt;h3 style="font-weight: normal;" class="post-title"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h3&gt; &lt;h3 style="font-weight: normal; color: rgb(0, 0, 0);" class="post-title"&gt;&lt;span style="font-size:100%;"&gt;There are 4 things you need to do with HEX values in LINUX&lt;/span&gt;&lt;/h3&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;For the impatient:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;1) Convert Hex to Decimal&lt;/span&gt;&lt;ol&gt; &lt;/ol&gt; &lt;ul&gt;   &lt;li&gt; echo 68 65 6c 6c 6f 20 77 6f 72 6c 64 |tr '[a-z]' '[A-z]' |sed 's/ / p /g' |sed 's/$/ p/'|awk '{print "16i "$0}'|dc |tr '\n' ' '&lt;br /&gt;&lt;/li&gt; &lt;/ul&gt;           &lt;span style="font-weight: bold;font-size:85%;" &gt; 104 101 108 108 111 32 119 111 114 108 100&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;4) Convert Hex to ASCII&lt;/span&gt;&lt;br /&gt;&lt;ul&gt; &lt;li&gt;echo 68656c6c6f20776f726c64 |sed 's/../&amp; /g' |tr '[a-z]' '[A-z]' |sed 's/ / p /g' |sed 's/$/ p/'|awk '{print "16i "$0}'|dc |tr ' ' '\n' |awk '{printf("%c",$0)}'&lt;/li&gt;&lt;li&gt;Even Better -&lt;br /&gt;  &lt;/li&gt;   &lt;li&gt;echo 68656c6c6f20776f726c64 | xxd -r -p&lt;br /&gt;  &lt;/li&gt;  &lt;/ul&gt;  &lt;span style="font-weight: bold;font-size:85%;" &gt;             hello world&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:130%;"&gt;2)Convert Decimal to Hex&lt;/span&gt;&lt;ul&gt; &lt;/ul&gt;    &lt;ul&gt;   &lt;li&gt;echo 87 87|tr ' ' '\n'|awk '{printf "%x ",$1}'   &lt;/li&gt; &lt;/ul&gt;           &lt;span style="font-weight: bold;font-size:85%;" &gt;57 57&lt;/span&gt;&lt;ul&gt; &lt;/ul&gt;   &lt;span style="font-size:130%;"&gt;3) Convert ASCII to HEX&lt;/span&gt;&lt;br /&gt;&lt;ol&gt; &lt;/ol&gt;    &lt;ul&gt;   &lt;li&gt;echo -n hello world |od -tx1 |cut -c8-|tr -d ' \n'&lt;/li&gt; &lt;/ul&gt; &lt;span style="font-weight: bold;"&gt;          68656c6c6f20776f726c64&lt;/span&gt;&lt;br /&gt;&lt;ul&gt; &lt;/ul&gt;&lt;br /&gt;More Examples:&lt;br /&gt;&lt;ul&gt; &lt;/ul&gt;&lt;br /&gt;If it wasn't so simple, you could put it in a script and call it ascii2hex.sh.&lt;br /&gt;&lt;br /&gt;                      This command is usefull to encode ascii text into 8 bit Hex (UCS2)&lt;br /&gt;for sending  the payload  of a  PDU  sms  message.&lt;br /&gt;&lt;br /&gt;If it wasn't so simple, you could put it in a script and call it ascii2hex.sh.&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;span style="font-family:times new roman;"&gt; echo -n "202.9.98.54:8080/CGServer/serve.jsp?id=123456" |od -tx1&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;0000000 32 30 32 2e 39 2e 39 38 2e 35 34 3a 38 30 38 30&lt;br /&gt;0000020 2f 43 47 53 65 72 76 65 72 2f 73 65 72 76 65 2e&lt;br /&gt;0000040 6a 73 70 3f 69 64 3d 31 32 33 34 35 36&lt;br /&gt;0000055&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Just ignore the first column or cut it out and remove the non-text characters with "| cut -c 8- |tr -d ' \n' "&lt;br /&gt;&lt;span style="font-size:78%;"&gt;3230322e392e39382e35343a383038302f43475365727665722f73657276652e6a73703f69643d313233343536&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Here is a standard 8 bit &lt;a href="http://www.lookuptables.com/"&gt;ascii chart&lt;/a&gt; to verify the results.&lt;br /&gt;&lt;br /&gt;x="C0 AA BB CC"&lt;br /&gt;&lt;br /&gt;echo "16i C0 p AA p BB p CC p" | dc&lt;br /&gt;192&lt;br /&gt;170&lt;br /&gt;187&lt;br /&gt;204&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;OR&lt;br /&gt;&lt;br /&gt;echo -e "16i\t$x"|sed 's/ / p /g' |sed 's/$/ p/'|dc&lt;br /&gt;192&lt;br /&gt;170&lt;br /&gt;187&lt;br /&gt;204&lt;br /&gt;&lt;br /&gt;_____________&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;Single number conversion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Hex to Integer&lt;br /&gt;&lt;/span&gt;echo 16i 57 p |dc&lt;br /&gt;87&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Integer to Hex&lt;br /&gt;echo 87 16 o p |dc&lt;br /&gt;&lt;br /&gt;57&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111965151495070733?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111965151495070733/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111965151495070733' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111965151495070733'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111965151495070733'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/linux-hexadecimal-howto.html' title='Linux Hexadecimal HOWTO'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111964705955335827</id><published>2005-06-24T14:00:00.000-07:00</published><updated>2005-06-24T22:38:41.103-07:00</updated><title type='text'>SI WAP PUSH for Linux Hackers</title><content type='html'>&lt;span style="font-size:78%;"&gt;&lt;span style="font-size:85%;"&gt;#send a wap push - si&lt;br /&gt;echo -ne "at+cmgs=101\r" &gt;/dev/modem;sleep 1;echo -ne "0051000B919145557705F400F5AA570605040B8423F0DC0601AE02056A0045C60C033230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536000103616D757A6F2E636F6D2043472030303031000101^Z" &gt;/dev/modem&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="mainfont"&gt; 00      default SMSC&lt;br /&gt;51 &lt;br /&gt;00       message ID 00 means let phone set&lt;br /&gt;0B       length of destination mobile number = 11&lt;br /&gt;91       the international + sign&lt;br /&gt;0621723364F4       the phone number 60 12 27 33 46 4&lt;br /&gt;00       protocol identifier&lt;br /&gt;F5   &lt;br /&gt;AA       validity period 4 days&lt;br /&gt;&lt;br /&gt;57       length of content&lt;br /&gt;&lt;/span&gt;&lt;span class="mainfont"&gt; 06&lt;br /&gt;05&lt;br /&gt;04&lt;br /&gt;0B84  dest port no&lt;br /&gt;23F0 origin port no&lt;br /&gt;DC Transaction ID (Push ID)&lt;br /&gt;06 PDU type (Push PDU)&lt;br /&gt;01 Header Length (just leave it at 01)&lt;br /&gt;AE Content Type=application/vnd.wap.sic (0x80 | 0x2E)&lt;br /&gt;02 &lt;version&gt;&lt;br /&gt;05 &lt;si&gt;&lt;br /&gt;6A &lt;charset&gt;&lt;br /&gt;00 &lt;string&gt;&lt;br /&gt;45 &lt;si&gt;&lt;br /&gt;C6 &lt;indication&gt;&lt;br /&gt;0C http://&lt;br /&gt;03 (next is an ASCII string for the URL, terminate with 00)&lt;br /&gt;&lt;br /&gt;3230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536&lt;br /&gt;which means = 202.9.98.54:8080/CGServer/serve.jsp?id=123456&lt;br /&gt;&lt;br /&gt;00 terminate string with 00&lt;br /&gt;01 &lt;indication&gt;&lt;br /&gt;03 (next is an ASCII string  for title, terminate with 00)&lt;br /&gt;&lt;br /&gt;616D757A6F2E636F6D2043472030303031&lt;br /&gt;which means = amuzo.com CG 0001&lt;br /&gt;&lt;br /&gt;00 terminate string with 00&lt;br /&gt;01 &lt;indication&gt;&lt;br /&gt;01&lt;br /&gt;&lt;br /&gt;Calculate the size of the payload message in Hex : (goes after AA)&lt;br /&gt;&lt;br /&gt;This works:&lt;br /&gt;&lt;br /&gt;echo -n "06 05 04 0B 84 23 F0 DC 06 01 AE 02 05 6A 00 45 C6 0C 03 32 30 32 2E 39 2E 39 38 2E 35 34 3A 38 30 38 30 2F 43 47 53 65 72 76 65 72 2F 73 65 72 76 65 2E 6A 73 70 3F 69 64 3D 31 32 33 34 35 36 00 01 03 61 6D 75 7A 6F 2E 63 00 01 01" |tr '[a-z]' '[A-z]' |sed 's/ / p /g' |sed 's/$/ p/'|awk '{print "16i "$0}'|dc |tr ' ' '\n' |awk '{printf("%c",$0)}'|wc -c |tr ' ' '\n'|awk '{printf "%x ",$1}'&lt;br /&gt;4d&lt;br /&gt;&lt;br /&gt;And this is an easier way:&lt;br /&gt;&lt;br /&gt;echo -n 0605040B8423F0DC0601AE02056A0045C60C033230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536000103616D757A6F2E63000101 |wc -c |awk '{print $1" * .5"}'|bc |awk -F. '{printf "%x\n",$1}'&lt;br /&gt;4d&lt;br /&gt;&lt;br /&gt;Here is how to calculate the overall message length: (headers + payload)&lt;br /&gt;echo -ne "51000B919145557705F400F5AA570605040B8423F0DC0601AE02056A0045C60C033230322E392E39382E35343A383038302F43475365727665722F73657276652E6A73703F69643D313233343536000103616D757A6F2E636F6D2043472030303031000101" |wc -c |awk '{print $1" * .5 "}'|bc |awk -F. '{print $1}'&lt;br /&gt;101&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;si&gt;&lt;/si&gt;&lt;/indication&gt;&lt;/indication&gt;&lt;/indication&gt;&lt;/si&gt;&lt;/string&gt;&lt;/charset&gt;&lt;/si&gt;&lt;/version&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111964705955335827?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111964705955335827/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111964705955335827' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111964705955335827'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111964705955335827'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/si-wap-push-for-linux-hackers.html' title='SI WAP PUSH for Linux Hackers'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111960052257397839</id><published>2005-06-24T01:07:00.000-07:00</published><updated>2005-06-30T00:18:35.350-07:00</updated><title type='text'>Important AT error messages</title><content type='html'>&lt;span style="font-family:Verdana,Arial,Helvetica;font-size:85%;"&gt;You can find a list of CMS error codes here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.nowsms.com/discus/messages/1/829.html" target="_blank"&gt;http://www.nowsms.com/discus/messages/1/829.html&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Arial;font-size:85%;"  &gt;&lt;br /&gt;CMS Errors: &lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Arial;font-size:85%;"  &gt;300: ME Failure;&lt;br /&gt;302: Operation not allowed;&lt;br /&gt;303: Operation not supported;&lt;br /&gt;304: Invalid PDU mode parameter;&lt;br /&gt;305: Invalid text mode parameter;&lt;br /&gt;320: memory failure;&lt;br /&gt;321: invalid memory index;&lt;br /&gt;322: memory full;&lt;br /&gt;330: SCA unknown;&lt;br /&gt;500: Unknown error;&lt;br /&gt;&lt;br /&gt;message center number - cingular - +1404727259060&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111960052257397839?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111960052257397839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111960052257397839' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111960052257397839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111960052257397839'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/important-at-error-messages.html' title='Important AT error messages'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111959660122723886</id><published>2005-06-23T23:44:00.000-07:00</published><updated>2006-01-02T15:47:24.933-08:00</updated><title type='text'>AT Commands - Part 2</title><content type='html'>ln -s /dev/rfcomm1 /dev/modem&lt;br /&gt;&lt;br /&gt;rfcomm&lt;br /&gt;&lt;span style="font-size:78%;"&gt;rfcomm1: 00:60:57:4D:D3:32 channel 1 closed&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;stty -a &lt; /dev/modem &lt;span style="font-size:78%;"&gt;speed 9600 baud; rows 0; columns 0; line = 0;&lt;br /&gt;intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = &lt;undef&gt;;&lt;br /&gt;eol2 = &lt;undef&gt;; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;&lt;br /&gt;lnext = ^V; flush = ^O; min = 1; time = 0;&lt;br /&gt;-parenb -parodd cs8 hupcl -cstopb cread clocal -crtscts&lt;br /&gt;ignbrk brkint ignpar -parmrk -inpck istrip -inlcr -igncr icrnl ixon -ixoff&lt;br /&gt;-iuclc -ixany -imaxbel&lt;br /&gt;opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0&lt;br /&gt;isig icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt&lt;br /&gt;echoctl echoke&lt;/undef&gt;&lt;/undef&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;ln -s /dev/ttyACM0 /dev/modem  #motorola v188 usb&lt;br /&gt;&lt;br /&gt;cat /dev/modem &amp;  &lt;br /&gt;echo &gt; /dev/modem  #for some reason the first echo gets ignored so we send a dummy&lt;br /&gt;echo -ne "at+cmgf=1\r" &gt;/dev/modem&lt;br /&gt;echo -ne 'at+cmgl="ALL"\r' &gt;/dev/modem   #get messages in ASCII&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;&lt;br /&gt;+CMGL: 4,"STO UNSENT","+9545577504",,&lt;br /&gt;&lt;br /&gt;How are you?&lt;br /&gt;&lt;br /&gt;OK&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;If you are operating in Text mode AT+CMGF=1 then the command is&lt;br /&gt;AT+&lt;b style="color: black; background-color: rgb(255, 255, 102);"&gt;CMGL&lt;/b&gt;="ALL"&lt;br /&gt;&lt;br /&gt;This will list all the SMS in the SIM&lt;br /&gt;&lt;br /&gt;If you are in PDU mode then you should use&lt;br /&gt;&lt;br /&gt;AT+&lt;b style="color: black; background-color: rgb(255, 255, 102);"&gt;CMGL&lt;/b&gt;=4 &lt;br /&gt;&lt;br /&gt;&gt;&gt;3) &lt;b style="color: black; background-color: rgb(160, 255, 255);"&gt;Delete&lt;/b&gt; messages from sim&lt;br /&gt;&lt;br /&gt;AT+CMGD=&lt;id&gt; is the command to &lt;b style="color: black; background-color: rgb(160, 255, 255);"&gt;delete&lt;/b&gt; the message at position &lt;id&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;echo -ne "at+cmgf=0\r" &gt;/dev/modem   #read messages in binary&lt;br /&gt;echo -ne 'at+cmgl=4\r' &gt;/dev/modem     #ALL does not work in binary mode&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;+CMGL: 4,2,,24&lt;br /&gt;&lt;br /&gt;07913121139418F011000A9159547557400000AA0CC8F71D14969741F977FD07&lt;br /&gt;&lt;br /&gt;#hello word in 7 bin binary&lt;br /&gt;&lt;span style="font-size:85%;"&gt;echo -ne "at+cmgs=23\r" &gt;/dev/modem;sleep 1&lt;br /&gt;echo -ne "07913121139418F011000A9159346367820000AA0BE8329BFD06DDDF723619^Z" &gt;/dev/modem&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;+CMGS: 59&lt;br /&gt;&lt;br /&gt;OK&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;#10 digit number beginning with area code "hello world"&lt;br /&gt;echo -ne "at+cmgs=23\r" &gt;/dev/modem;sleep 1;echo -ne "0011000A9159346367820000AA0BE8329BFD06DDDF723619^Z" &gt;/dev/modem&lt;br /&gt;&lt;br /&gt;#11 digit number including country code&lt;br /&gt;echo -ne "at+cmgs=24\r" &gt;/dev/modem;sleep 1;echo -ne   "0011000B919145337626F80000AA0BE8329BFD06DDDF723619^Z" &gt;/dev/modem&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);font-size:85%;" &gt;[root@a1a ~]# echo -ne "at+cmgf=0\r" &gt;/dev/ttyACM0&lt;br /&gt;[root@a1a ~]# at+cmgf=0&lt;br /&gt;OK&lt;br /&gt;&lt;br /&gt;[root@a1a ~]# echo -ne "at+cmgs=24\r" &gt;/dev/ttyACM0&lt;br /&gt;[root@a1a ~]# at+cmgs=24&lt;br /&gt;&gt;&lt;br /&gt;[root@a1a ~]# echo -ne "0011000B919145337626F80000AA0BE8329BFD06DDDF723619^Z" &gt;/dev/ttyACM0[root@a1a ~]# 0011000B919145337626F80000AA0BE8329BFD06DDDF723619&lt;br /&gt;+CMGS: 3&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0); font-weight: bold;font-size:85%;" &gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-weight: bold; color: rgb(0, 102, 0);font-size:85%;" &gt;send a binary message to 9546638946 "hello world" (please change number before trying this)&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;echo -ne "at+cmgf=0\r" &gt;/dev/ttyS0&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;echo -ne "at+cmgs=24\r" &gt;/dev/ttyS0; sleep 1;&lt;br /&gt;echo -ne "0011000B919145668349F60000AA0BE8329BFD06DDDF723619^Z" &gt;/dev/ttyS0&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;echo -ne "at+cmgs=15\r" &gt;/dev/modem;sleep 1;echo -ne "0011000B919145337626F80004AA0122^Z" &gt;/dev/modem #send ok but phone gets a "message could not be displayed"&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="mainfont"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111959660122723886?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111959660122723886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111959660122723886' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111959660122723886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111959660122723886'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/at-commands-part-2.html' title='AT Commands - Part 2'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111902245855790978</id><published>2005-06-17T08:07:00.000-07:00</published><updated>2005-06-17T08:34:18.560-07:00</updated><title type='text'>Cellphone forum links</title><content type='html'>&lt;a href="http://forums.wirelessadvisor.com"&gt;forums.wirelessadvisor.com&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111902245855790978?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111902245855790978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111902245855790978' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111902245855790978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111902245855790978'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/cellphone-forum-links.html' title='Cellphone forum links'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111886725505945326</id><published>2005-06-15T13:15:00.000-07:00</published><updated>2007-05-05T18:30:28.868-07:00</updated><title type='text'>Phone Museum</title><content type='html'>Here are the phones I own:&lt;br /&gt;&lt;br /&gt;NOKIA&lt;br /&gt;3390b- GSM 14.99 (t-mobile) + 10 s/h =$24.99 - OR-andale = $20 , 572 offered, 291 sold - found a lot of 45 used for $900= $20 each&lt;br /&gt;&lt;a href="http://www.forum.nokia.com/main/0,,018-2037,00.html?model=3650"&gt;3650&lt;/a&gt;- GSM -&lt;br /&gt;&lt;a href="http://www.forum.nokia.com/main/0,,018-1341,00.html?model=6010"&gt;6010&lt;/a&gt;- GSM (supposedly datacable DKU-5)&lt;br /&gt;&lt;a href="http://www.forum.nokia.com/main/0,,018-2043,00.html?model=3120"&gt;3120&lt;/a&gt;b - GSM -(data cable, DKU-5 $20)&lt;br /&gt;&lt;a href="http://www.forum.nokia.com/main/0,,018-2053,00.html?model=3595"&gt;3595&lt;/a&gt;- GSM (data cable 3950 - $6.99)&lt;br /&gt;6340i - GSM 850 1900 ALL TDMA frequencies and Analog, WAP 1.2.1, wireless modem 9.6 kbps,infrared, Nokia 6340 PC : 10 new for $400 on ebay=$40&lt;br /&gt;5165p - tdma&lt;br /&gt;5165p - tdma&lt;br /&gt;&lt;br /&gt;MOTOROLA&lt;br /&gt;v120T- tdma&lt;br /&gt;v171 - gsm TF - EMS version 5.0&lt;br /&gt;&lt;br /&gt;SAMSUNG&lt;br /&gt;samsung &lt;span style="COLOR: rgb(0,0,0);font-family:Verdana;font-size:85%;"  &gt;SPHA740&lt;/span&gt; - sprint - bob&lt;br /&gt;&lt;br /&gt;SONY ERICSSON&lt;br /&gt;T68 gsm-&lt;a href="http://www.esato.com/phones/index.php/phone=13"&gt;features&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;SEIMENS&lt;br /&gt;CF62 - t-mobile prepaid&lt;br /&gt;&lt;br /&gt;Phones I would like to buy:&lt;br /&gt;3395- wap 1.1 19.99 + 12.50 s/h = $32.49&lt;br /&gt;motorola c155 -TF- EMS version 5.0&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111886725505945326?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111886725505945326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111886725505945326'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/phone-museum.html' title='Phone Museum'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111884311695887577</id><published>2005-06-15T06:14:00.000-07:00</published><updated>2005-06-24T16:58:17.516-07:00</updated><title type='text'>A Simple ASCII to Hex Convertor</title><content type='html'>This command is usefull to encode ascii text into 8 bit Hex (UCS2)&lt;br /&gt;for sending  the payload  of a  PDU  sms  message.&lt;br /&gt;&lt;br /&gt;If it wasn't so simple, you could put it in a script and call it ascii2hex.sh.&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:times new roman;font-size:100%;"  &gt;&lt;span style="font-family:times new roman;"&gt; echo -n "202.9.98.54:8080/CGServer/serve.jsp?id=123456" |od -tx1&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size:78%;"&gt;0000000 32 30 32 2e 39 2e 39 38 2e 35 34 3a 38 30 38 30&lt;br /&gt;0000020 2f 43 47 53 65 72 76 65 72 2f 73 65 72 76 65 2e&lt;br /&gt;0000040 6a 73 70 3f 69 64 3d 31 32 33 34 35 36&lt;br /&gt;0000055&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Just ignore the first column or cut it out and remove the non-text characters with "| cut -c 8- |tr -d ' \n' "&lt;br /&gt;&lt;span style="font-size:78%;"&gt;3230322e392e39382e35343a383038302f43475365727665722f73657276652e6a73703f69643d313233343536&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;HEX to ASCII&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;"&gt;&lt;br /&gt;echo 31 32 33 34 35 36 |sed 's/ / p /g' |sed 's/$/ p/'|awk '{print "16i "$0}'|dc |tr ' ' '\n'  |awk '{printf("%c\n",$0)}'&lt;br /&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;6&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Here is a standard 8 bit &lt;a href="http://www.lookuptables.com/"&gt;ascii chart&lt;/a&gt; to verify the results.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111884311695887577?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111884311695887577/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111884311695887577' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111884311695887577'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111884311695887577'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/simple-ascii-to-hex-convertor.html' title='A Simple ASCII to Hex Convertor'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111878774864425421</id><published>2005-06-14T15:06:00.000-07:00</published><updated>2005-06-16T20:43:26.530-07:00</updated><title type='text'>HOWTO - Setup a Serial Connection to a Bluetooth Phone</title><content type='html'>I am running Fedora Core 3 - FC3 with a kensington usb bluetooth adapter. FC3 comes with the bluez software so I didn't need to install anything for bluetooth to work.&lt;br /&gt;&lt;br /&gt;0) # service bluetooth status;  service bluetooth stop; service bluetooth start; service bluetooth status&lt;br /&gt;1) unplug the usb bluetooth adapter then plug it back in&lt;br /&gt;2) # hcifconfig hci0 down&lt;br /&gt;3) # hcifconfig hci0 up&lt;br /&gt;4) # hcifconfig -a&lt;br /&gt;&lt;br /&gt;hci0:   Type: USB&lt;br /&gt;    BD Address: 00:0C:55:F8:5E:73 ACL MTU: 377:10  SCO MTU: 16:0&lt;br /&gt;    UP RUNNING PSCAN ISCAN&lt;br /&gt;    RX bytes:378 acl:0 sco:0 events:16 errors:0&lt;br /&gt;    TX bytes:325 acl:0 sco:0 commands:17 errors:0&lt;br /&gt;    Features: 0xff 0xfe 0x0d 0x38 0x08 0x08 0x00 0x00&lt;br /&gt;    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3&lt;br /&gt;    Link policy: RSWITCH HOLD SNIFF PARK&lt;br /&gt;    Link mode: SLAVE ACCEPT&lt;br /&gt;    Name: 'a1a-0'&lt;br /&gt;    Class: 0x120104&lt;br /&gt;    Service Classes: Networking, Object Transfer&lt;br /&gt;    Device Class: Computer, Desktop workstation&lt;br /&gt;    HCI Ver: 1.2 (0x2) HCI Rev: 0x0 LMP Ver: 1.2 (0x2) LMP Subver: 0x6965&lt;br /&gt;    Manufacturer: Broadcom Corporation (15)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5) #hcitool scan&lt;br /&gt;Scanning ...&lt;br /&gt;    99:66:55:44:D1:35       Nokia3650&lt;br /&gt;&lt;br /&gt;6) rfcomm bind /dev/rfcomm1  99:66:55:44:D1:35 1&lt;br /&gt;7) You should now be able to use the serial connection to communicate with your bluetooth phone.&lt;br /&gt;&lt;br /&gt;If you get the following error:&lt;br /&gt;&lt;br /&gt;# cat /dev/rfcomm1&lt;br /&gt;cat: /dev/rfcomm1: Connection refused&lt;br /&gt;&lt;br /&gt;1) Then turn the phone off and back on.&lt;br /&gt;2) hcitool scan&lt;br /&gt;Scanning ...&lt;br /&gt;    99:66:55:44:D1:35       Nokia3650&lt;br /&gt;3)cat /dev/rfcomm1&lt;br /&gt;Waiting with no error&lt;br /&gt;&lt;br /&gt;This usually fixes the problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111878774864425421?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111878774864425421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111878774864425421' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111878774864425421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111878774864425421'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/howto-setup-serial-connection-to.html' title='HOWTO - Setup a Serial Connection to a Bluetooth Phone'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111843506969922345</id><published>2005-06-10T13:18:00.000-07:00</published><updated>2005-07-01T08:24:34.896-07:00</updated><title type='text'>Using the Nokia 3650 for internet access -Linux FC3</title><content type='html'>Carrier: Cingular&lt;br /&gt;Plan: $19.99 monthly internet&lt;br /&gt;Phone: Nokia 3650&lt;br /&gt;OS: Fedora Core 3 - FC3&lt;br /&gt;Bluetooth device: Kensington USB adapter&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The output from a successfull GPRS ppp connection:&lt;br /&gt;&lt;br /&gt;[root@a1a peers]# pppd call gprs&lt;br /&gt;--&gt; WvDial: Internet dialer version 1.54.0&lt;br /&gt;--&gt; Initializing modem.&lt;br /&gt;--&gt; Sending: ATH&lt;br /&gt;NO CARRIER&lt;br /&gt;ATH&lt;br /&gt;OK&lt;br /&gt;--&gt; Sending: ATE1&lt;br /&gt;ATE1&lt;br /&gt;OK&lt;br /&gt;--&gt; Sending: AT+CGDCONT=1,"IP","isp.cingular","",0&lt;br /&gt;AT+CGDCONT=1,"IP","isp.cingular","",0&lt;br /&gt;OK&lt;br /&gt;--&gt; Modem initialized.&lt;br /&gt;--&gt; Sending: ATD*99#&lt;br /&gt;--&gt; Waiting for carrier.&lt;br /&gt;ATD*99#&lt;br /&gt;CONNECT&lt;br /&gt;~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&amp;} }*} } g}%~&lt;br /&gt;--&gt; Carrier detected.  Waiting for prompt.&lt;br /&gt;~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&amp;amp;} }*} } g}%~&lt;br /&gt;--&gt; PPP negotiation detected.&lt;br /&gt;Serial connection established.&lt;br /&gt;using channel 6&lt;br /&gt;Using interface ppp0&lt;br /&gt;Connect: ppp0 &lt;--&gt; /dev/modem&lt;br /&gt;sent [LCP ConfReq id=0x1 &lt;asyncmap&gt; &lt;magic&gt;]&lt;br /&gt;rcvd [LCP ConfRej id=0x1 &lt;magic&gt;]&lt;br /&gt;sent [LCP ConfReq id=0x2 &lt;asyncmap&gt;]&lt;br /&gt;rcvd [LCP ConfAck id=0x2 &lt;asyncmap&gt;]&lt;br /&gt;rcvd [LCP ConfReq id=0x0 &lt;auth&gt; &lt;mru&gt; &lt;asyncmap&gt;]&lt;br /&gt;sent [LCP ConfAck id=0x0 &lt;auth&gt; &lt;mru&gt; &lt;asyncmap&gt;]&lt;br /&gt;sent [PAP AuthReq id=0x1 user="ISPDA@CINGULARGPRS.COM" password="CINGULAR1"]&lt;br /&gt;rcvd [PAP AuthAck id=0x1 ""]&lt;br /&gt;PAP authentication succeeded&lt;br /&gt;sent [CCP ConfReq id=0x1 &lt;deflate&gt; &lt;deflate old=""&gt;]&lt;br /&gt;sent [IPCP ConfReq id=0x1 &lt;addr&gt; &lt;ms-dns1&gt; &lt;ms-dns3&gt;]&lt;br /&gt;rcvd [IPCP ConfReq id=0x0 &lt;addr&gt;]&lt;br /&gt;sent [IPCP ConfNak id=0x0 &lt;addr&gt;]&lt;br /&gt;rcvd [LCP ProtRej id=0x0 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]&lt;br /&gt;rcvd [IPCP ConfNak id=0x1 &lt;addr&gt; &lt;ms-dns1&gt; &lt;ms-dns3&gt;]&lt;br /&gt;sent [IPCP ConfReq id=0x2 &lt;addr&gt; &lt;ms-dns1&gt; &lt;ms-dns3&gt;]&lt;br /&gt;rcvd [IPCP ConfReq id=0x1 &lt;addr&gt;]&lt;br /&gt;sent [IPCP ConfAck id=0x1 &lt;addr&gt;]&lt;br /&gt;rcvd [IPCP ConfAck id=0x2 &lt;addr&gt; &lt;ms-dns1&gt; &lt;ms-dns3&gt;]&lt;br /&gt;not replacing existing default route to eth0 [192.168.1.1]&lt;br /&gt;local  IP address 166.138.237.249&lt;br /&gt;remote IP address 10.0.0.1&lt;br /&gt;primary   DNS address 66.209.10.201&lt;br /&gt;secondary DNS address 66.209.10.202&lt;br /&gt;Script /etc/ppp/ip-up started (pid 5672)&lt;br /&gt;Script /etc/ppp/ip-up finished (pid 5672), status = 0x0&lt;br /&gt;Terminating on signal 2.&lt;br /&gt;Script /etc/ppp/ip-down started (pid 5797)&lt;br /&gt;sent [LCP TermReq id=0x3 "User request"]&lt;br /&gt;rcvd [LCP TermAck id=0x3]&lt;br /&gt;Connection terminated.&lt;br /&gt;Connect time 31.6 minutes.&lt;br /&gt;Sent 62981 bytes, received 152749 bytes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now from another xterminal you can rin ifconfig and look for the new interface - ppp0&lt;br /&gt;ppp0      Link encap:Point-to-Point Protocol&lt;br /&gt;         inet addr:166.138.195.72  P-t-P:10.0.0.1  Mask:255.255.255.255&lt;br /&gt;         UP POINTOPOINT RUNNING NOARP MULTICAST  MTU:1500  Metric:1&lt;br /&gt;         RX packets:4 errors:0 dropped:0 overruns:0 frame:0&lt;br /&gt;         TX packets:6 errors:0 dropped:0 overruns:0 carrier:0&lt;br /&gt;         collisions:0 txqueuelen:3&lt;br /&gt;         RX bytes:64 (64.0 b)  TX bytes:116 (116.0 b)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;After this connection was made there are 2 options:&lt;br /&gt;1) replace my default gateway with 10.0.0.1.&lt;br /&gt;  route del default gw 192.168.1.1; route add default gw 10.0.0.1&lt;br /&gt;or&lt;br /&gt;2) add a route to get to the cingular gateway for my phone (ip 66.209.11.61 -taken from my phone settings)&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;  route add -net 66.209.11.0 netmask 255.255.255.0 dev ppp0&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Destination     Gateway         Genmask         Flags Metric Ref    Use Iface&lt;br /&gt;10.0.0.1        *               255.255.255.255 UH    0      0        0 ppp0&lt;br /&gt;&lt;span style="color: rgb(255, 153, 0);"&gt;66.209.11.0     *               255.255.255.0   U     0      0        0 ppp0&lt;/span&gt;&lt;br /&gt;192.168.1.0     *               255.255.255.0   U     0      0        0 eth0&lt;br /&gt;default         192.168.1.1     0.0.0.0         UG    0      0        0 eth0&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;tested by:&lt;br /&gt;ping 66.209.11.61&lt;br /&gt;and&lt;br /&gt;browsing to 64.233.161.99  (this is www.1.google.com)&lt;br /&gt;&lt;br /&gt;Works OK except for DNS.&lt;/ms-dns3&gt;&lt;/ms-dns1&gt;&lt;/addr&gt;&lt;/addr&gt;&lt;/addr&gt;&lt;/ms-dns3&gt;&lt;/ms-dns1&gt;&lt;/addr&gt;&lt;/ms-dns3&gt;&lt;/ms-dns1&gt;&lt;/addr&gt;&lt;/addr&gt;&lt;/addr&gt;&lt;/ms-dns3&gt;&lt;/ms-dns1&gt;&lt;/addr&gt;&lt;/deflate&gt;&lt;/deflate&gt;&lt;/asyncmap&gt;&lt;/mru&gt;&lt;/auth&gt;&lt;/asyncmap&gt;&lt;/mru&gt;&lt;/auth&gt;&lt;/asyncmap&gt;&lt;/asyncmap&gt;&lt;/magic&gt;&lt;/magic&gt;&lt;/asyncmap&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111843506969922345?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111843506969922345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111843506969922345' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111843506969922345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111843506969922345'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/using-nokia-3650-for-internet-access_10.html' title='Using the Nokia 3650 for internet access -Linux FC3'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111842345263793315</id><published>2005-06-10T10:09:00.000-07:00</published><updated>2005-06-24T08:17:15.223-07:00</updated><title type='text'>My Favorite Nokia AT commands</title><content type='html'>#/bin/sh&lt;br /&gt;#make the rfcomm device files&lt;br /&gt;c=0;&lt;br /&gt;while [ $c -lt 256 ]; do&lt;br /&gt;echo c=$c&lt;br /&gt;if  [ ! -c /dev/rfcomm$c ]; then&lt;br /&gt;mknod -m 666 /dev/rfcomm$c c 216 $c&lt;br /&gt;fi&lt;br /&gt;c=`expr $c + 1 `&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;service bluetooth status&lt;br /&gt;service bluetooth start&lt;br /&gt;service bluetooth status&lt;br /&gt;hciconfig hci0 down &amp;&amp;amp; hciconfig hci0 up&lt;br /&gt;rfcomm bind 1 00:60:57:4D:D3:32 1&lt;br /&gt;rfcomm show&lt;br /&gt;rfcomm1: 00:60:57:4D:D3:32 channel 1 closed&lt;br /&gt;rfcomm release 1&lt;br /&gt;rfcomm bind 1 00:60:57:4D:D3:32 1&lt;br /&gt;rfcomm show&lt;br /&gt;rfcomm1: 00:60:57:4D:D3:32 channel 1 clean&lt;br /&gt;&lt;br /&gt;[root@a1a peers]# hcitool scan&lt;br /&gt;Scanning ...&lt;br /&gt;     00:60:57:4D:D3:32       Nokia3650&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;hcitool rssi 00:60:57:4D:D3:32; echo -e "at+csq\r" &gt;/dev/modem&lt;br /&gt;RSSI return value: 0&lt;br /&gt;echo -e 'AT+CSCA?\r' &gt;/dev/modem  #to get the message center number from the phone&lt;br /&gt;AT+CMGF=?&lt;br /&gt;echo -e 'at+cmgs="9543367628"\r' &gt;/dev/modem; echo -e 'Hi Bonita^Z' &gt;/dev/modem&lt;br /&gt;echo -e 'at+cmgl="ALL"\r' &gt;/dev/modem&lt;br /&gt;echo -e 'at+cbc\r' &gt;/dev/modem   #check battery&lt;br /&gt;&lt;span style="font-size:78%;"&gt;at+cbc&lt;br /&gt;&lt;br /&gt;+CBC: 0,45&lt;br /&gt;&lt;br /&gt;OK&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111842345263793315?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111842345263793315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111842345263793315'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/my-favorite-nokia-at-commands.html' title='My Favorite Nokia AT commands'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111838226354060917</id><published>2005-06-09T22:43:00.000-07:00</published><updated>2005-06-12T12:33:24.026-07:00</updated><title type='text'></title><content type='html'>&lt;a href="http://nds1.nokia.com/phones/files/guides/Nokia_AThelp.pdf"&gt;Nokia AT GPRS command set&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111838226354060917?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111838226354060917/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111838226354060917' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111838226354060917'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111838226354060917'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/nokia-at-gprs-command-set.html' title=''/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111834295334631750</id><published>2005-06-09T11:44:00.000-07:00</published><updated>2005-06-09T12:01:38.213-07:00</updated><title type='text'>Bluetooth GPS ????</title><content type='html'>In this Thesis,  Bluetooth is promoted as a technogy to enable location&lt;br /&gt;aware services. The authors discuss the problems of trying to use RSSI&lt;br /&gt;radio signal strength to triangulate position. They built a test system with&lt;br /&gt;30 DLINK DBT-120 USB Bluetooth adapters costing $30 each and&lt;br /&gt;using USB hubs with an external power supply. The USB hubs allow the&lt;br /&gt;Bluetooth adapters to be initialized on a laptop and then disconnected from&lt;br /&gt;the computer once initialized. As long as the power supply is not interrupted,&lt;br /&gt;the beacons will continue to broadcast.&lt;br /&gt;&lt;br /&gt;&lt;span style=""&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;http://people.csail.mit.edu/albert/ pubs/ashuang-sm-thesis-2&lt;b&gt;0&lt;/b&gt;&lt;b&gt;0&lt;/b&gt;5.pdf&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111834295334631750?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111834295334631750/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111834295334631750' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111834295334631750'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111834295334631750'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/bluetooth-gps.html' title='Bluetooth GPS ????'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111827792100315473</id><published>2005-06-08T15:30:00.000-07:00</published><updated>2005-06-10T13:18:16.106-07:00</updated><title type='text'>Using the Nokia 3650 for internet access -Windows XP</title><content type='html'>I bought the Nokia 3650 to use as a backup internet connection for emergencies or when I'm on the road. After a day of hassling with it I finally got it setup and working in Windows XP with my Kensington bluetooth usb adaptor.&lt;br /&gt;&lt;br /&gt;There is a lot of information on the web about connecting this phone to the internet with a cingular sim card.&lt;br /&gt;&lt;br /&gt;I saw that there are basically 4 steps:&lt;br /&gt;1) Download and install the &lt;a href="http://www.nokiausa.com/support/software/legal_agreement/1,1827,3650%7C%7EUEMgU3VpdGU=,00.html"&gt;Nokia 3650 PC Suite&lt;/a&gt; and the nokia drivers "&lt;a href="http://www.nokiausa.com/support/software/legal_agreement/1,1827,3650%7C%7ETW9kZW0gU2V0dXA=,00.html"&gt;Nokia 3650 Modem Setup   &lt;/a&gt;             " http://www.nokiausa.com/support/phones/software/1,3048,3650,00.html&lt;br /&gt;&lt;br /&gt;2) Turn on bluetooth in the phone and pair the connection to the computer.&lt;br /&gt;3) Create a new dialup connection&lt;br /&gt;4) Enter the username, password and number to dial&lt;br /&gt;5) Connect&lt;br /&gt;&lt;br /&gt;On step 5 I could not get past this error message when trying to connect:&lt;br /&gt;&lt;br /&gt;"Error with PPP connection: 734"&lt;br /&gt;"Error 734: The PPP link control protocol was terminated."&lt;br /&gt;&lt;br /&gt;As a test, I downloaded and ran the Cingular connection manager,&lt;br /&gt;CingularSetup_4_2_7_1.exe  -&gt; http://www.cingular.com/media/downloads&lt;br /&gt;&lt;br /&gt;But I was getting the same error using both applications. I decided to call Cingular. It turns out that I was not provisioned to use GPRS modem because I was on the 2.99 internet express plan. They said I needed the 19.99 internet connection plan so I signed up for that and they gave me a user/pass to connect.&lt;br /&gt;&lt;br /&gt;Dialup Connection Information:&lt;br /&gt;User Name: ISPDA@CINGULARGPRS.COM&lt;br /&gt;Password:    CINGULAR1&lt;br /&gt;Dial:             *99#&lt;br /&gt;&lt;br /&gt;I have seen a lot of comments on the internet saying you can leave the username and password blank, or put in random text but this did not work for me. Without the correct username and password I get the error message:&lt;br /&gt;&lt;br /&gt;"Error 734: The PPP link control protocol was terminated."&lt;br /&gt;&lt;br /&gt;They changed the number to dial to  *99***1#   but I also tested  *99# for the number and it worked just as well.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111827792100315473?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111827792100315473/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111827792100315473' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111827792100315473'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111827792100315473'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/using-nokia-3650-for-internet-access.html' title='Using the Nokia 3650 for internet access -Windows XP'/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-13437608.post-111798874237564749</id><published>2005-06-05T08:55:00.000-07:00</published><updated>2009-03-23T06:02:06.702-07:00</updated><title type='text'></title><content type='html'>&lt;p class="MsoNormal" style="FONT-WEIGHT: bold"&gt;&lt;span style="font-size:180%;"&gt;XFS undelete HOWTO:&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;How to undelete a file in a linux XFS filesystem:&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="FONT-STYLE: italic; TEXT-ALIGN: center"&gt;"I moved to the next possibility and clicked ‘undeploy’.&lt;br /&gt;Suddenly- all my application and&lt;br /&gt;data files were deleted by tomcat."&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;&lt;br /&gt;Background (How I accidently deleted all my data):&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;At the end of a 4 week project to make a shipping portal website, I decided to try out the Jakarta-Tomcat web admin interface to start and stop the application instead of sticking to the command line startup and shutdown scripts that I am familiar with.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;I logged into the admin console (jakarta-tomcat-5.5.9) and proceeded to restart the application by clicking ‘start’ and then ‘stop’. This did not show the changes I was expecting so I needed to try something else. With each button click, a generic window pops up to say “Are you sure?” Am I sure about what? I wondered. I moved to the next possibility and clicked ‘undeploy’. Suddenly- all my application and data files were deleted by tomcat. &lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;em&gt;Reminder- to tomcat, undeploy means you want all your code and project files deleted. &lt;/em&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;I ran df –k praying that this filesystem was your friendly ext3 but instead it read xfs. Dread.&lt;/p&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;Linux &lt;b&gt;&lt;span style="BACKGROUND: rgb(255,255,102) 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initialcolor:black;" &gt;XFS&lt;/span&gt;&lt;/b&gt; FAQ&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;Q: Does the filesystem have a &lt;b&gt;&lt;span style="BACKGROUND: rgb(160,255,255) 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initialcolor:black;" &gt;undelete&lt;/span&gt;&lt;/b&gt; function?&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;i&gt;There is no &lt;b&gt;&lt;span style="BACKGROUND: rgb(160,255,255) 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initialcolor:black;" &gt;undelete&lt;/span&gt;&lt;/b&gt; in &lt;b&gt;&lt;span style="BACKGROUND: rgb(255,255,102) 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initialcolor:black;" &gt;XFS&lt;/span&gt;&lt;/b&gt;, in fact once you delete something, the&lt;br /&gt;&lt;/i&gt;&lt;i&gt;chances are the space it used to occupy is the first thing reused.&lt;br /&gt;&lt;/i&gt;&lt;b&gt;&lt;i&gt;&lt;span style="BACKGROUND: rgb(160,255,255) 0% 50%; -moz-background-clip: initial; -moz-background-origin: initial; -moz-background-inline-policy: initialcolor:black;" &gt;Undelete&lt;/span&gt;&lt;/i&gt;&lt;/b&gt;&lt;i&gt; is really something you have to design in from the start.&lt;br /&gt;&lt;/i&gt;&lt;i&gt;Getting anything back after a accidental rm -rf is near to impossible.&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;&lt;/pre&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;This called for extreme measures. I had to bring the files back.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="FONT-WEIGHT: bold;font-size:130%;" &gt;&lt;br /&gt;The Undelete:&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;They say it is near to imposible to recover files in XFS but &lt;strong&gt;I did it, and here’s how&lt;/strong&gt;:&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="FONT-WEIGHT: bold"&gt;df –k /usr/local/jakarta-tomcat/webapps&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:0;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;Filesystem 1K-blocks Used Available Use% Mounted on&lt;br /&gt;/dev/hda7 26245376 13740048 12505328 53% /usr/local&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;I knew that it was important not to disturb the file system where the files had been deleted, but I had production data on part of that disk so I could not unmount it. Also, I did not have 26 Gig’s of free space on the machine to make a safe copy. This meant that I had to work fast and avoid all file creation on the hda7 filesystem.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;I used the time command on every search I ran because when grepping 26 Gig files it is very important to manage the amout of time spent searching for data.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;First I ran some tests on 1 Gig of raw XFS data to find the fastest way to search for strings. I searched for '$WGET' because it was a variable i remembered that was in the lost file.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="font-family:courier new;"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;&lt;br /&gt;&lt;br /&gt;time&lt;/span&gt;&lt;span style="FONT-WEIGHT: bold"&gt; &lt;/span&gt;&lt;span style="FONT-WEIGHT: bold"&gt;dd if=/dev/hda7 bs=1024&lt;/span&gt;&lt;span style="FONT-WEIGHT: bold"&gt; &lt;/span&gt;&lt;span style="FONT-WEIGHT: bold"&gt;count=1000000 | strings | cut -c0-50 | grep &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;'$WGET'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;$WGET --post-data="prefix1=$PREFIX&amp;amp;number1=$NUMBER&lt;br /&gt;$WGET --post-data="prefix1=$PREFIX&amp;amp;number1=$NUMBER&lt;br /&gt;1000000+0 records in&lt;br /&gt;1000000+0 records out&lt;br /&gt;real 4m35.243s&lt;br /&gt;user 1m24.390s&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sys&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;0m20.810s&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 1pt; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: 1pt solid; FONT-FAMILY: courier new"&gt;&lt;p class="MsoNormal" style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: medium none; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 0in; BORDER-BOTTOM: medium none"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;/div&gt;&lt;p class="MsoNormal"  style="font-family:courier new;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;Now the better way.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="font-family:courier new;"&gt;&lt;span style="font-size:78%;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="FONT-WEIGHT: bold"&gt;&lt;br /&gt;&lt;br /&gt;time&lt;/span&gt;&lt;span style="FONT-WEIGHT: bold"&gt; &lt;/span&gt;&lt;span style="FONT-WEIGHT: bold"&gt;dd if=/dev/hda7 bs=1024&lt;/span&gt;&lt;span style="FONT-WEIGHT: bold"&gt; &lt;/span&gt;&lt;span style="FONT-WEIGHT: bold"&gt;count=1000000 |  grep -a '$WGET' | strings&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;span style="font-family:courier new;"&gt;1000000+0 records in&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;1000000+0 records out&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;$WGET --post-data="prefix1=$PREFIX&amp;amp;number1=$NUMBER&amp;amp;DoIt=Do+it"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;$WGET --post-data="prefix1=$PREFIX&amp;amp;number1=$NUMBER&amp;amp;DoIt=Do+it"&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;real&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;0m55.836s&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;user&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;0m4.350s&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;sys&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; &lt;/span&gt;&lt;span style="font-family:courier new;"&gt;0m18.310s&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;Both command statements searched 1 million records of data (1,000,000 x 1024=1Gig) but moving the strings command to after the grep and taking out the cut is 500% faster. This is important because I need to search 26 times this amount of data.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;Now I began the search using a unique keyword that I knew was present in the deleted file.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="FONT-WEIGHT: bold"&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;time grep -a –B100 –A100 "$WGET" /dev/hda7 | strings&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:85%;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;span style="font-size:78%;"&gt;[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m&lt;br /&gt;#6t1~&lt;br /&gt;fo&lt; x=")&amp;amp;" i="n?&amp;amp;s%p1%d%;m"&gt;&lt;span style="font-size:78%;"&gt;[99H&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="COLOR: rgb(255,204,0)"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="COLOR: rgb(255,204,0)"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="COLOR: rgb(0,0,153)"&gt;#!/bin/sh&lt;br /&gt;#045 24630815&lt;br /&gt;usage () {&lt;br /&gt;echo "Usage:"&lt;br /&gt;echo&lt;br /&gt;echo '-p 3 digit prefix'&lt;br /&gt;…&lt;br /&gt;…&lt;br /&gt;…&lt;br /&gt;my_count=100&lt;br /&gt;WGET='wget -q --user-agent="Internet Explorer 5.5" --wait=1 --timeout=10 --tries=2 -O -'&lt;br /&gt;#begin the web get&lt;/p&gt;&lt;p class="MsoNormal" style="COLOR: rgb(0,0,153)"&gt;$WGET --post-data="prefix1=$PREFIX&amp;amp;number1=$NUMBER&amp;amp;DoIt=Do+it" http://www.demo.com/Ingles.jsp grep -A60 "Details" grep -E "::' sed 's:::' sed 's:::g'tr '&lt;' ',' sed&lt;span style="font-size:0;"&gt; &lt;/span&gt;'s/&gt;/,_/g' awk -F, '{print $3}' grep -v _Time tr -d '_' paste -d= 5.template -&lt;/p&gt;&lt;p class="MsoNormal" style="COLOR: rgb(0,0,153)"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="COLOR: rgb(0,0,153)"&gt;#script done&lt;/p&gt;&lt;p class="MsoNormal" style="FONT-FAMILY: courier new"&gt;&lt;span style="font-size:78%;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"  style="font-family:courier new;"&gt;&lt;span style="font-size:78%;"&gt;#6t1~&lt;br /&gt;fo&lt; ~b~Ht s3Q+ k&amp;amp;s@ vAJ,%&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" face="courier new"&gt;&lt;span style="font-size:78%;"&gt; real 19m57.031s user 0m35.090s sys 4m19.860s&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;As you can see, in 20 minutes I found my deleted file stashed in 26 Gigs of binary junk!&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;It was not practical to attempt recovery of all my files this way so I just recovered the most valuable programs. Other jsp’s&lt;span style="font-size:0;"&gt; &lt;/span&gt;I rewrote based on html I was able to recover from the browser cache of another computer and the most recent backups I had.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13437608-111798874237564749?l=linuxwebdev.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://linuxwebdev.blogspot.com/feeds/111798874237564749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=13437608&amp;postID=111798874237564749' title='13 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111798874237564749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/13437608/posts/default/111798874237564749'/><link rel='alternate' type='text/html' href='http://linuxwebdev.blogspot.com/2005/06/xfs-undelete-howto-how-to-undelete.html' title=''/><author><name>Doug Watson</name><uri>http://www.blogger.com/profile/16693919504413563620</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='25' src='http://4.bp.blogspot.com/-IycC-wjM-1U/TmEvpH0o08I/AAAAAAAAAFE/QEVaoNWnxc0/s220/me.jpg'/></author><thr:total>13</thr:total></entry></feed>
