<?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-7035860407900002000</id><updated>2012-02-21T15:59:01.140-08:00</updated><category term='apache'/><category term='scheme'/><category term='android'/><category term='emacs'/><category term='sql'/><category term='java'/><category term='drupal'/><category term='mysqldump'/><category term='sicp'/><category term='cyanogenmod'/><category term='vim'/><category term='eclipse'/><category term='mod'/><category term='ubuntu'/><category term='nook'/><title type='text'>Denver Droid</title><subtitle type='html'>Musings on Drupal, Emacs, Linux and the occasional robot.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-6243316747405441093</id><published>2012-02-21T15:58:00.001-08:00</published><updated>2012-02-21T15:59:01.158-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sql'/><category scheme='http://www.blogger.com/atom/ns#' term='vim'/><category scheme='http://www.blogger.com/atom/ns#' term='mysqldump'/><title type='text'>Vim Tip: yanking or deleting a big chunk of text</title><content type='html'>I have a large mysqldump backup file of all databases on a server but I need a sql backup for a single database. So I wanted to break up the dump file into smaller pieces.  This is one solution I came up with using vim. 

&lt;p&gt;
1. I opened the dump file and a newly created file for the single database:

&lt;pre &gt;
vim db-dump.sql newdumpfile.sql
&lt;/pre&gt;

&lt;p&gt;
2. I searched for the start of the database section by searching for:
&lt;pre&gt;
/USE `databasename`
&lt;/pre&gt;
where "databasename" is the specific database I want to grab.

&lt;p&gt;
3. Once I was at the correct spot in the database dump I noticed that each individual database section starts with a comment:
&lt;pre&gt;
---
--- Current Database: `databasename`
--- 
&lt;/pre&gt;
Once again, "databasename" is a specific database name.

&lt;p&gt;
4. So I yanked all lines until the next database section with the following vim command:
&lt;pre&gt;
y/Current Database/
&lt;/pre&gt;

This tells vim to yank all lines until it reaches the next match for the regular expression "Current Database".  Vim will report how many lines have been yanked.

&lt;p&gt;
5. Next, switch to the new file and paste the lines that were yanked.
&lt;pre&gt;
:bn
p
&lt;/pre&gt;

The vim command :bn, means switch to the next buffer.  You could also run the command ":e newdumpfile.sql" to create and edit a new sql file.  The next vim command "p" is the paste command, it pastes into the current buffer the last yanked hunk of text. In this case it would be the lines you just yanked, the single database dump.
&lt;p&gt;
6. Finally save the changes to the new file with :wq
&lt;p&gt;
7. If you'd like to reload the database into mysql use the following:
&lt;pre&gt;
mysql -p &amp;lt; newdumpfile.sql
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-6243316747405441093?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/6243316747405441093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2012/02/vim-tip-yanking-or-deleting-big-chunk.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/6243316747405441093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/6243316747405441093'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2012/02/vim-tip-yanking-or-deleting-big-chunk.html' title='Vim Tip: yanking or deleting a big chunk of text'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-6430511721541717440</id><published>2011-07-09T16:15:00.000-07:00</published><updated>2011-07-09T20:50:23.053-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='emacs'/><title type='text'>Cool Things to do in Emacs' Dired Mode</title><content type='html'>&lt;div id="outline-container-1_1" class="outline-3"&gt;
&lt;p /&gt;

&lt;div id="outline-container-1_1_1" class="outline-4"&gt;
&lt;h2 id="sec-1_1_1"&gt;Delete some files in the &lt;i&gt;Downloads&lt;/i&gt; folder &lt;/h2&gt;
&lt;div class="outline-text-4" id="text-1_1_1"&gt;

&lt;p&gt;My Downloads folder is always out of control. There are always a
ton of pdf files that I opened once in a browser but don't need to
save. It's a pain to open a GUI file navigator, like Nautilus, and
double click on each pdf file to view it and see if it should be
tossed. However with Emacs, trimming my Downloads directory of old
files is quick and easy.  &lt;/p&gt; &lt;/div&gt;

&lt;/div&gt;
&lt;p /&gt;
&lt;div id="outline-container-1_1_2" class="outline-4"&gt;
&lt;h2 id="sec-1_1_2"&gt;Viewing Pdfs in Emacs &lt;/h2&gt;
&lt;div class="outline-text-4" id="text-1_1_2"&gt;

&lt;p&gt;If you see a pdf with an uninformative name like 2010-09.pdf just
hit &amp;lt;&lt;b&gt;enter&lt;/b&gt;&amp;gt; when the cursor is on the file name, (when
the file name is at point). Emacs will open the pdf in a new
buffer. Once you have viewed the pdf and have decided its face you can
quickly kill the pdf buffer with '&lt;b&gt;k&lt;/b&gt;' and you'll be returned to
the directory. Now, if the pdf is unimportant, queue it to be deleted
with '&lt;b&gt;d&lt;/b&gt;'. If you want to keep the file, but give it a better
name, type 'R' to rename it. 

To unqueue a file for deletion, use '&lt;b&gt;u&lt;/b&gt;'. And finally to
delete all the files currently queued for deletion, type 'x'.  &lt;/p&gt; &lt;/div&gt;

&lt;/div&gt;
&lt;p /&gt;
&lt;a href="http://www.flickr.com/photos/redbike/5919681539/" title="Dired mode emacs by denverfiddler, on Flickr"&gt;&lt;img src="http://farm7.static.flickr.com/6144/5919681539_d0ff5a1193.jpg" width="500" height="313" alt="Dired mode emacs"&gt;&lt;/a&gt;
&lt;p /&gt;


&lt;div id="outline-container-1_1_3" class="outline-4"&gt;
&lt;h2 id="sec-1_1_3"&gt;Delete old Emacs backup files &lt;/h2&gt;
&lt;div class="outline-text-4" id="text-1_1_3"&gt;

&lt;p&gt;If you have a lot of backup files that emacs created with ~ appended to
the file name, you can quickly queue them all for deletion by typing '&lt;b&gt;~&lt;/b&gt;'.
&lt;/p&gt;

&lt;h2&gt;Here's the List of Directory Organizing Commands&lt;/h2&gt;
&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;
&lt;caption&gt;&lt;/caption&gt;
&lt;colgroup&gt;&lt;col class="left" /&gt;&lt;col class="left" /&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th scope="col" class="left"&gt;key combo&lt;/th&gt;&lt;th scope="col" class="left"&gt;command&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td class="left"&gt;&amp;lt;enter&amp;gt;&lt;/td&gt;&lt;td class="left"&gt;open file at point&lt;/td&gt;&lt;/tr&gt;

&lt;tr&gt;&lt;td class="left"&gt;d&lt;/td&gt;&lt;td class="left"&gt;Queue File For Deletion&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;u&lt;/td&gt;&lt;td class="left"&gt;Unqueue File&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;~&lt;/td&gt;&lt;td class="left"&gt;Queue Backup Files for Del&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;x&lt;/td&gt;&lt;td class="left"&gt;eXecute Queued Delete Jobs&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;R&lt;/td&gt;&lt;td class="left"&gt;Rename File&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;k&lt;/td&gt;&lt;td class="left"&gt;Kill PDF Buffer&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;


&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;



&lt;p /&gt;
&lt;div id="outline-container-1_3" class="outline-3"&gt;
&lt;h2 id="sec-1_3"&gt;Edit Zip'd or Tar-gz'd archives in place &lt;/h2&gt;
&lt;div class="outline-text-3" id="text-1_3"&gt;

&lt;p&gt;If you need to edit a file inside a zip or tar archive, simply open
the archive by hitting &amp;lt;enter&amp;gt; on the name in Dired mode, then
click on the file. Edit the file and save it with '&lt;b&gt;C-x C-s&lt;/b&gt;',
and then do another &lt;b&gt;C-x C-s&lt;/b&gt; inside the zip buffer to save the
archive with the file changes. The archive will be compressed again
with your changes.  &lt;/p&gt; &lt;/div&gt;

&lt;/div&gt;
&lt;p /&gt;
&lt;div id="outline-container-1_4" class="outline-3"&gt;
&lt;h2 id="sec-1_4"&gt;OMG!: Change File Owner, Group, Mode &lt;/h2&gt;
&lt;div class="outline-text-3" id="text-1_4"&gt;

&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;
&lt;caption&gt;&lt;/caption&gt;
&lt;colgroup&gt;&lt;col class="left" /&gt;&lt;col class="left" /&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th scope="col" class="left"&gt;key combo&lt;/th&gt;&lt;th scope="col" class="left"&gt;command&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td class="left"&gt;O&lt;/td&gt;&lt;td class="left"&gt;change owner&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;M&lt;/td&gt;&lt;td class="left"&gt;change mode&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;G&lt;/td&gt;&lt;td class="left"&gt;change group&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;Z&lt;/td&gt;&lt;td class="left"&gt;compress file&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;



&lt;/div&gt;

&lt;/div&gt;
&lt;p /&gt;
&lt;p /&gt;
&lt;div id="outline-container-1_5" class="outline-3"&gt;
&lt;h1 id="sec-1_5"&gt;Encrypt, Decrypt Files &lt;/h1&gt;
&lt;div class="outline-text-3" id="text-1_5"&gt;

&lt;p&gt;Use '&lt;b&gt;:e&lt;/b&gt;' to encrypt the file at point. Emacs will ask who you want to
encrypt the file for (ie whose public key to use to encrypt the file.)
You can also encrypt the file symmetrically with a password. Once the
file is encrypted, there will be two files in the directory: the
original file and the encrypted file with '.gpg' added to the file
name. 
&lt;/p&gt;

&lt;/div&gt;
&lt;p /&gt;
&lt;div id="outline-container-1_5_1" class="outline-4"&gt;
&lt;h2 id="sec-1_5_1"&gt;Decrypt &lt;/h2&gt;
&lt;div class="outline-text-4" id="text-1_5_1"&gt;

&lt;p&gt;To open the symmetrically encrypted file, click on its name and you
will be prompted for a password. You can also type '&lt;b&gt;:d&lt;/b&gt;' when
the filename is at point.
&lt;/p&gt;
&lt;/div&gt;

 &lt;/div&gt;

&lt;div id="outline-container-1_5_2" class="outline-4"&gt;
&lt;h2 id="sec-1_5_2"&gt;EasyPG Assistant Docs &lt;/h2&gt;
&lt;div class="outline-text-4" id="text-1_5_2"&gt;

&lt;p&gt;The program that is used to encrypt the file's is EasyPG Assistant.
&lt;a href="http://www.gnu.org/software/emacs/manual/html_mono/epa.html"&gt;EasyPG Assistant Manual&lt;/a&gt;
&lt;/p&gt;


&lt;/div&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;p /&gt;
&lt;div id="outline-container-1_7" class="outline-3"&gt;
&lt;h2 id="sec-1_7"&gt;Get More Help &lt;/h2&gt;
&lt;div class="outline-text-3" id="text-1_7"&gt;

&lt;p&gt;Type 'C-hm' (describe mode) while in dired-mode, to pop open a help
buffer, with a description of dired mode and a list of commands.
&lt;/p&gt;
&lt;/div&gt;

&lt;/div&gt;
&lt;p /&gt;
&lt;div id="outline-container-1_8" class="outline-3"&gt;
&lt;h2 id="sec-1_8"&gt;All Key Combinations named in post &lt;/h2&gt;
&lt;div class="outline-text-3" id="text-1_8"&gt;


&lt;table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides"&gt;
&lt;caption&gt;&lt;/caption&gt;
&lt;colgroup&gt;&lt;col class="left" /&gt;&lt;col class="left" /&gt;
&lt;/colgroup&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th scope="col" class="left"&gt;key combo&lt;/th&gt;&lt;th scope="col" class="left"&gt;command&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td class="left"&gt;d&lt;/td&gt;&lt;td class="left"&gt;mark file for deletion&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;u&lt;/td&gt;&lt;td class="left"&gt;unmark file&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;x&lt;/td&gt;&lt;td class="left"&gt;eXecute queued deletions&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;R&lt;/td&gt;&lt;td class="left"&gt;rename/move file&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;O&lt;/td&gt;&lt;td class="left"&gt;change owner&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;M&lt;/td&gt;&lt;td class="left"&gt;change mode&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;G&lt;/td&gt;&lt;td class="left"&gt;change group&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;Z&lt;/td&gt;&lt;td class="left"&gt;compress file&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;y&lt;/td&gt;&lt;td class="left"&gt;show only certain file type&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;w&lt;/td&gt;&lt;td class="left"&gt;copy file name&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;RET&lt;/td&gt;&lt;td class="left"&gt;open file at point&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;k&lt;/td&gt;&lt;td class="left"&gt;if in pdf buffer, kill&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;C-x C-s&lt;/td&gt;&lt;td class="left"&gt;Save file or  archive&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;i&lt;/td&gt;&lt;td class="left"&gt;insert sub-directory&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class="left"&gt;~&lt;/td&gt;&lt;td class="left"&gt;mark all backup files for deletion&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;a href=http://denverdroid.blogspot.com/2011/07/cool-things-to-do-in-emacs-dired-mode.html&gt;Cool Things to do in Emacs' Dired Mode&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-6430511721541717440?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/6430511721541717440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2011/07/cool-things-to-do-in-emacs-dired-mode.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/6430511721541717440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/6430511721541717440'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2011/07/cool-things-to-do-in-emacs-dired-mode.html' title='Cool Things to do in Emacs&apos; Dired Mode'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm7.static.flickr.com/6144/5919681539_d0ff5a1193_t.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-853670455354691780</id><published>2011-05-19T15:08:00.000-07:00</published><updated>2011-05-31T13:30:57.342-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='emacs'/><title type='text'>Zombies, Emacs and Orgmode</title><content type='html'>&lt;a href="http://www.flickr.com/photos/redbike/5738522164/" title="Zombie Graph with Emacs and Graphviz by denverfiddler, on Flickr"&gt;&lt;img src="http://farm3.static.flickr.com/2741/5738522164_058b838336.jpg" width="500" height="339" alt="Zombie Graph with Emacs and Graphviz"&gt;&lt;/a&gt;

&lt;a href="http://www.flickr.com/photos/redbike/5738238466/" title="Zombie Apocalypse Digraph by denverfiddler, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3280/5738238466_8320bfd478_o.png" width="293" height="379" alt="Zombie Apocalypse Digraph"&gt;&lt;/a&gt;
&lt;p&gt;
I was playing around with &lt;a href="http://www.graphviz.org/Gallery.php"&gt;Graphviz&lt;/a&gt; inside &lt;a href="http://orgmode.org/"&gt;orgmode&lt;/a&gt; inside Emacs.

Come the Zombie Apocalypse I'll be prepared, thanks to Emacs and Orgmode.

Here's the Graphviz src:

&lt;code&gt;&lt;pre&gt;
digraph D {
  size="8,6"
  node [shape = polygon,
        sides = 4,
        distortion = "0.0",
        orientation = "0.0",
        skew = "0.0",
        color = "#aaaaaa",
        style = filled,
        fontname = "Helvetica-Outline" ];
  apocalypse [sides=9 skew=".32" color="purple"]
  apocalypse -&gt; zombie
  apocalypse -&gt; zombies
  shovel [skew=".56" color="#aa2222"]
  subgraph singular {
    label="one"
    color=purple
    zombie -&gt; shovel [color="#440000"]
    shovel -&gt; run
  }
  run [sides=9, color=salmon2];
  subgraph plural {
    label="many"
    color=red
    zombies -&gt; run [color="#00a4d4"]
  }
}
&lt;/pre&gt;&lt;/code&gt;

save this file as zombies.gv, then run: graphviz zombies.gv.
&lt;br /&gt;
If you are interested in graphviz, you can click on any graph in &lt;a href="http://www.graphviz.org/Gallery.php"&gt;this gallery&lt;/a&gt; and see the graphviz source for the graph.

&lt;p&gt;

I wrote the graph source first in Emacs in Orgmode 7.5.  Here's the src for experimenting with graphs in orgmode using the new &lt;a href="http://j.mp/l6chaqorgmode.org/worg/org-contrib/babel/"&gt;org-babel&lt;/a&gt;, which lets you evaluate code in special code sections right inside of Emacs:
&lt;code&gt;&lt;pre&gt;
#+begin_src dot :file digraph2.png :cmdline -Kdot -Tpng  
digraph D {
  size="8,6"
 node [ shape = polygon,
  sides = 4,
  distortion = "0.0",
  orientation = "0.0",
  skew = "0.0",
  color = "#aaaaaa",
  style = filled,
  fontname = "Helvetica-Outline" ];
  apocalypse [sides=9 skew=".32" color="purple"]
  apocalypse -&gt; zombie
  apocalypse -&gt; zombies
  shovel [skew=".56" color="#aa2222"]
  subgraph singular {
    label="one"
    color=purple
    zombie -&gt; shovel [color="#440000"]
    shovel -&gt; run
  }
  run [sides=9, color=salmon2];
  subgraph plural {
    label="many"
    color=red
    zombies -&gt; run [color="#00a4d4"]
  }
}
#+end_src
&lt;/pre&gt;&lt;/code&gt;

Then inside the buffer you can evaluate the code with "C-c C-c", and you can see the results of evaluating the code with "C-c C-o".

This is made possible by Org-babel, a cool tool that allows you to run scripts from different languages in a single Org-mode buffer.  Not only that but you can pipe output from one code block to another code block written in a different language.  I will have more blog posts about this in the future.  Org-babel is a part of Org-mode since Org-mode 7.x or so.  Exciting stuff!
&lt;p /&gt;
&lt;h3&gt;Further Reading&lt;/h3&gt;
&lt;br /&gt;
&lt;a href="http://j.mp/l6chaqorgmode.org/worg/org-contrib/babel/"&gt;Org-babel Documentation&lt;/a&gt;&lt;br&gt;
&lt;a href="http://www.graphviz.org/"&gt;Graphviz&lt;/a&gt;

&lt;hr /&gt;

Edited with the emacs-chrome plugin&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-853670455354691780?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/853670455354691780/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2011/05/zombies-emacs-and-orgmode.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/853670455354691780'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/853670455354691780'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2011/05/zombies-emacs-and-orgmode.html' title='Zombies, Emacs and Orgmode'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm3.static.flickr.com/2741/5738522164_058b838336_t.jpg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-4826729745578318532</id><published>2011-05-03T10:36:00.000-07:00</published><updated>2011-05-03T10:46:43.275-07:00</updated><title type='text'>Updated the Scuttle Plugin to work with Firefox 4</title><content type='html'>&lt;div id="post"&gt; 
    &lt;p&gt;I updated the Scuttle firefox plugin to work with Firefox 4.  This was the one utility that was holding me back from upgrading to Firefox 4.  I created a &lt;a href="https://github.com/underhilllabs/Scuttle-Plugin-Firefox-4"&gt;github repository.&lt;/a&gt; for the project.  Feel free to fork the project.  Its a good simple plugin if you&amp;#8217;d like to learn how to write one.&lt;/p&gt; 

&lt;p&gt;The original scuttle firefox plugin hasn&amp;#8217;t been upgraded since 2007. The version in   This updated version is compatible with Firefox 4.  You can view the source or fork the project at &lt;a href="https://github.com/underhilllabs/Scuttle-Plugin-Firefox-4"&gt;my github repository.&lt;/a&gt; or you can download the plugin directly: &lt;a href="https://github.com/downloads/underhilllabs/Scuttle-Plugin-Firefox-4/scuttle-0.4.2-firefox+fl.xpi"&gt;scuttle-0.4.2-firefox+fl.xpi&lt;/a&gt;&lt;/p&gt; 

&lt;p&gt;Scuttle is an open source &lt;a href="http://scuttle.org"&gt;Website Bookmarking System.&lt;/a&gt; I switched to it for my bookmarking needs after Yahoo! announced they were shutting down delicious.com.  The cool thing about Scuttle is that its open source, (its written in PHP.) so you can download the source and run it on your own web server and if there's a new feature you want for your social bookmarking you can write it, also since it runs on your own server, you can be sure that the service will never end (just make regular backups.) The bad news is that you need to have a web server to run it.  If you are just interested in an alternative to delicious you can try &lt;a href="http://pinboard.in"&gt;pinboard.in&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Also the credit goes to Marcus Campbell, original developer of scuttle and the scuttle plugin and also to &lt;a href="http://akeller.eu/en/firefox-3-und-das-scuttle-add-on/"&gt;Andreas Keller&lt;/a&gt; for originally updating the scuttle plugin for Firefox 3.&lt;/p&gt; 
  &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-4826729745578318532?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/4826729745578318532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2011/05/updated-scuttle-plugin-to-work-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/4826729745578318532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/4826729745578318532'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2011/05/updated-scuttle-plugin-to-work-with.html' title='Updated the Scuttle Plugin to work with Firefox 4'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-7418150861138971600</id><published>2011-02-26T10:06:00.000-08:00</published><updated>2011-02-26T12:08:34.568-08:00</updated><title type='text'>Updating Drupal Sites with Patches and Drush</title><content type='html'>I found a couple of drupal sites on a web server that were badly in need of security updates.  They are no longer being maintained by a developer but they are still in use by a user community so I didn't like the idea of taking them down just because they are a security vulnerability, as they still have a great deal of value for people who use them.  So I decided to update them with the patches that are available at &lt;a href="http://fuerstnet.de/en/drupal-upgrade-easier"&gt;fuerstnet&lt;/a&gt;.  
&lt;p&gt;
If you follow the link above to fuerstnet, the site provides patches from all of the minor versions of drupal up to the most recent security level.  So, if you check your drupal site's status at "admin/reports/status" (in drupal 6).  And you see that you're drupal version is currently drupal 6.14. (That's 4 security releases out of date!)  Then you can go to fuerstnet and download the drupal-6.14-to-6.18.patch security fixes only patch, or you can download the 6.14-to-to-6.20.patch (which includes bug fixes + security fixes.).
&lt;p&gt;
The first thing you need to do is make sure you have a current back-up of the database and the drupal file system.&lt;p&gt;
1. Quick back-up of the file system:&lt;br&gt;
&lt;b&gt;cp -R DRUPAL_ROOT DRUPAL_ROOT-bk&lt;/b&gt;&lt;br&gt;
2. Copy of database:&lt;br&gt;
&lt;b&gt;mysqldump -uDB-USER -p DB-NAME &gt; ~/DRUPAL-SITE-NAME.db-backup-DATE.sql&lt;/b&gt;&lt;p&gt;
or you can do the database back-up with drush:&lt;br&gt;
&lt;b&gt;drush sql-dump --result-file=~/DRUPAL-SITE-NAME.db_backup-DATE.sql &lt;/b&gt;&lt;br&gt;
Of course, you need to replace all of the ALL_CAPS names up above with the names that correspond with your site.  Now on to the update procedure:
&lt;p&gt;
The procedure, as outlined at fuerstnet, is:&lt;br&gt;
1. copy the patch into you're drupal root directory.&lt;br&gt;
2. put your site into maintenance mode. "admin/settings/site-maintenance" (in drupal 6)&lt;br&gt;
3. cd into the DRUPAL_ROOT directory.&lt;br&gt;
4. patch -p1 --dry-run &lt; DRUPALPATCH  &lt;br&gt;
(replace DRUPALPATCH with the name of your patch, ie drupal-6.14-to-6.20.patch)
if you do not see any errors in the output of the patch command, then you can run the command again for real.&lt;br&gt;
5. patch -p1 &lt; DRUPALPATCH  &lt;br&gt;
Next you have to run update.php, which if you have drush you can run like so:&lt;br&gt;
6. drush updatedb&lt;br&gt;
or you can visit http://YOUR-DRUPAL-SITE/update.php&lt;br&gt;
7. next: test your site, update any modules that need updating and then don't forget to pull your site out of maintenance mode.
&lt;p&gt;
Another possibility is to run the upgrades in drush with the shell command:&lt;br&gt;
&gt; &lt;b&gt;drush pm-update --security-only&lt;/b&gt;
&lt;p&gt;
This command will update your site with any available security updates.  It will first show you a list of updates that are available and ask if you if you want to proceed.  You must answer y or n.  This command is great, because you can run it in the root directory of any of your drupal sites and it will show you which updates are available.  Also if you have site-aliases set up, you can run it against all of your aliases one at a time and you don't have to leave the comfort of your /home directory! 
&lt;p&gt;
&gt; &lt;b&gt;drush @dev pm-update --security-only&lt;/b&gt;&lt;br&gt;
(where @dev is an alias name for one of your sites.)
&lt;p&gt;
Of course you can run the update command without the --security-only and it will offer to update all of your modules, themes and core drupal files.  
&lt;p&gt;
[However I ran into trouble with this approach as it updated the themes as well on one of the sites I was updating and the original site developer had customized the theme instead of creating a new them and customizing that!  So I restore the theme from backup.  Of course when drush updates modules and themes it backs up the old ones in a directory outside the drupal directory, so if there is a mishap, such as overwriting a customized theme, you can restore and clear cache to restore the old theme.  Although there is that safety net, I still now prefer to update security-fixes only at first, and then run non-security modules fixes one at a time and run the theme fixes manually.  Schwew, big aside.]
&lt;p&gt;
After running the &lt;b&gt;drush pm-update&lt;/b&gt;, which can be shortened to &lt;b&gt;drush up&lt;/b&gt;,
I like to run a quick:&lt;br&gt;
&gt; &lt;b&gt;drush updatedb&lt;/b&gt; &lt;br&gt;
to make sure the database has been updated properly, and:&lt;br&gt;
&gt; &lt;b&gt;drush cc all&lt;/b&gt;&lt;br&gt;
to make sure the caches are cleared.
&lt;p&gt;
And once you have all of your sites aliased, it is simple to ssh into your web server and run the &lt;b&gt;drush up --security-only&lt;/b&gt; command once a week to check that all of your sites are up to date with the security fixes.
&lt;p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-7418150861138971600?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/7418150861138971600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2011/02/updating-drupal-sites-with-patches-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/7418150861138971600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/7418150861138971600'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2011/02/updating-drupal-sites-with-patches-and.html' title='Updating Drupal Sites with Patches and Drush'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-1347604681223856760</id><published>2011-01-03T15:27:00.001-08:00</published><updated>2011-01-04T12:21:59.923-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='sicp'/><category scheme='http://www.blogger.com/atom/ns#' term='emacs'/><category scheme='http://www.blogger.com/atom/ns#' term='scheme'/><title type='text'>Emacs Window Commands</title><content type='html'>I recently bought a new large monitor, which opened the possibility of using Emacs with multiple, side-by-side windows.  Which is brilliant by the way!  Since I plugged it in, I've been "C-x 3"-ing like a madman.  My new favorite way to learn programming is having an info file open in the left window and in the right window having a scheme (or python) prompt open.  That is what I am doing now working on the Structure and Interpretation of Computer Programs.  Luckily there was an &lt;a href="http://www.neilvandyke.org/sicp-texi/"&gt;info file available&lt;/a&gt;.  
I'm trying to think of a simple way to translate my programming epubs or pdfs into info files.
&lt;p&gt;
&lt;a href="http://www.flickr.com/photos/redbike/5324820738/" title="SICP with Emacs by denverfiddler, on Flickr"&gt;&lt;img src="http://farm6.static.flickr.com/5043/5324820738_4a77355d01.jpg" width="500" height="267" alt="SICP with Emacs" /&gt;&lt;/a&gt;

&lt;p&gt;
Anyways on to todays topic.  Emacs window commands!  
&lt;p&gt;

The first thing to keep in mind, is the difference between windows and  frames in emacs.  To emacs: a window is any portal to a buffer.  if you type in "C-x 2" in emacs and your view splits in half.  These two  portals are known as windows.  What we usually call a new window, is known as a frame to emacs.  So when you type in Ctrl-n in your browser and a new window pops open, in Emacsia, this is known as a new frame.
&lt;p&gt;

&lt;h3&gt;Open another window:&lt;/h3&gt;
&lt;p&gt;
&lt;b&gt;C-x 2&lt;/b&gt;        open another vertical window.&lt;br&gt;
&lt;b&gt;C-x 3&lt;/b&gt;        open another horizontal window.&lt;br&gt;
&lt;b&gt;C-x 4 b &lt;/b&gt;     open a buffer in the other window&lt;br&gt;
&lt;b&gt;C-x 4 f&lt;/b&gt;      open a new file in the other window.&lt;br&gt;
&lt;b&gt;C-x 1&lt;/b&gt;        close all other windows, leave current window open. &lt;br&gt;
&lt;b&gt;C-x 0&lt;/b&gt;        close current window, switch to other window.&lt;br&gt;
&lt;b&gt;C-x o&lt;/b&gt;        move to other window&lt;br&gt;
&lt;p&gt;

&lt;h3&gt;Positioning windows:&lt;/h3&gt;
&lt;p&gt;
&lt;b&gt;C-x +&lt;/b&gt;      balance windows. This balances the size of all open windows.&lt;br&gt;
&lt;b&gt;C-x {&lt;/b&gt;     widen current window.&lt;br&gt;
&lt;b&gt;C-x }&lt;/b&gt;     narrow current window.&lt;br&gt;
&lt;b&gt;C-u C-x {&lt;/b&gt;   widen current window by 4 columns.&lt;br&gt;
&lt;b&gt;C-u C-x }&lt;/b&gt;   narrow current window by 4 columns.&lt;br&gt;
&lt;p&gt;
&lt;h3&gt;Scroll other window:&lt;/h3&gt;
&lt;p&gt;
&lt;b&gt;M-C-v&lt;/b&gt;     scroll other window&lt;br&gt;

&lt;p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-1347604681223856760?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/1347604681223856760/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2011/01/emacs-window-commands.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/1347604681223856760'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/1347604681223856760'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2011/01/emacs-window-commands.html' title='Emacs Window Commands'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm6.static.flickr.com/5043/5324820738_4a77355d01_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-8672382218947955063</id><published>2010-12-28T08:35:00.003-08:00</published><updated>2011-01-04T12:22:19.700-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='emacs'/><title type='text'>This Week's Emacs Commands</title><content type='html'>If you've ever played keywiz on Emacs: "M-x keywiz", you were probably eating humble-hacker-pie by the end of the game.  (For the uninitiated, keywiz is a game in emacs that's asks 10 random questions about key-bindings for some times obscure emacs commands.)  So far my top score is 4 (out of 10).&lt;br /&gt;
&lt;br /&gt;
So what is a novice to do? I've decided to write commands I want to learn on sticky notes on my monitor until I memorize them.&lt;br /&gt;
&lt;br /&gt;
So, without further ado, here's this weeks list of new commands:&lt;br /&gt;
&lt;br /&gt;
M-g g&lt;br /&gt;
goto line.  This command will ask for a line number and take you there in the current file.&lt;br /&gt;
&lt;br /&gt;
C-x v=&lt;br /&gt;
vc-diff.  This command will show a diff between current file and HEAD in whatever Version Control System you are using.&lt;br /&gt;
&lt;br /&gt;
C-x vv&lt;br /&gt;
vc-next-action.  This command will perform the next appropriate VCS command, such as add current file to staging, or commit.&lt;br /&gt;
&lt;br /&gt;
C-M-\&lt;br /&gt;
indent-region.  If there is a defined region, this command will indent it.&lt;br /&gt;
&lt;br /&gt;
C-M-;
comment-region.  If there is a defined region, this command will comment the region out.   (or uncomment a commented out region.)&lt;br /&gt;
&lt;br /&gt;
A note: to define a region.  Do a C-[spc] at the beginning of the region and then move to the end of the region however you'd like (arrow keys, C-n, C-f, C-v).  If you can't see the regions add the following to your .emacs file: (transient-mark-mode 1).&lt;br /&gt;
&lt;br /&gt;
Second note, in the above key combination, capital C, means hold the Ctrl key, capital M, means hold the Alt key.  If there are dashes between letters: type them together (or with C or M hold the Ctrl or Alt key while typing the other key.  So with M-g g: Hold Alt while typing g, let go and then type g again.)

&lt;br /&gt;
&lt;br /&gt;
Now off to work on a new version of keywiz, perhaps keywiz-jr!&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/7035860407900002000-8672382218947955063?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/8672382218947955063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2010/12/this-weeks-emacs-commands.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/8672382218947955063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/8672382218947955063'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2010/12/this-weeks-emacs-commands.html' title='This Week&apos;s Emacs Commands'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-3111640889030134069</id><published>2010-12-21T20:17:00.000-08:00</published><updated>2011-05-24T12:06:24.476-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='emacs'/><title type='text'>Using Gnu Screen</title><content type='html'>I've been a long time user of Linux and the command line, but not until recently have I used the amazing program: &lt;b&gt;screen&lt;/b&gt;.  Screen is a terminal multiplexor.  This means you can have multiple sessions open at the same time (even over a single ssh connection) and flip back and forth between them.  
&lt;br /&gt;
Prior to discovering screen I'd often be ssh'd into a remote server editing a file when the ssh session would time out or drop and I'd have to quickly open up a new terminal and start editing the file again.  Now while using screen, the screen session itself is independent of the ssh session.  So if my ssh connection flakes out, I start up a new terminal, ssh into the server, "reattach" the previous screen session to this new terminal and all of my work: my emacs window, my bash jobs, etc are still running in the screen session!  
&lt;br /&gt;
&lt;h2&gt;How to start screen&lt;/h2&gt;

&lt;code&gt;bart@home: $ &lt;b&gt;ssh boris@remote-server-in-distant-vladivostok &lt;/b&gt;&lt;br /&gt;
boris@distant-vlad: $ &lt;b&gt;screen&lt;/b&gt;&lt;/code&gt;

&lt;p /&gt;
If you already have a screen session running on the remote server you can reattach with:&lt;br /&gt;
&lt;code&gt;boris@distant-vlad: $ &lt;b&gt;screen -r&lt;/b&gt;&lt;/code&gt;

&lt;p /&gt;
I like to use the options: -raAd, mostly because it looks raad.&lt;br /&gt;
&lt;code&gt;boris@distant-vlad: $ &lt;b&gt;screen -raAd&lt;/b&gt;&lt;/code&gt;

&lt;p /&gt;
&lt;b&gt;r&lt;/b&gt;: means reattach previous session&lt;br /&gt;
&lt;b&gt;a&lt;/b&gt;: include all capabilities (with some minor exceptions) in each window's termcap&lt;br /&gt;
&lt;b&gt;A&lt;/b&gt;: Adapt the sizes of all windows to the size of the current terminal&lt;br /&gt;
&lt;b&gt;d&lt;/b&gt;: Forceably detach any sessions that are still holding on to this (your workstation at work for instance).&lt;br /&gt;

&lt;p /&gt;
&lt;h2&gt;Create new sessions&lt;/h2&gt;
Once inside screen to start a new session use the keyboard combination: &lt;b&gt;C-a c&lt;/b&gt;. That is, "Ctrl-a c".  (the mnemonic is &lt;b&gt;c&lt;/b&gt; for "create window")  This will create a new window move you to it.  To move back to the previous window, do a &lt;b&gt;C-a C-a&lt;/b&gt;.    You can also use the keyboard combos &lt;b&gt;C-a n&lt;/b&gt; and &lt;b&gt;C-a p&lt;/b&gt; to move to the Next and Previous windows.  Or you can move to a window directly using its number with &lt;b&gt;C-a 3&lt;/b&gt; (or whatever number it is.)

&lt;p /&gt;
&lt;h2&gt;customizing screen with .screenrc&lt;/h2&gt;
If you are an emacs user or if you use the emacs shortcuts on the command line, than you know that C-a is already used as the command to bring the cursor to the beginning of the line.  So what to do?  You can change the default keyboard bindings in the .screenrc configuration file in your home directory.  If it doesn't already exist, create it and add the following line:&lt;br /&gt;
&lt;code&gt;escape ^Bb&lt;/code&gt;

&lt;p /&gt;
or whatever you want to use as the control sequence.  This will change the control sequence from &lt;b&gt;C-a&lt;/b&gt; to &lt;b&gt;C-b&lt;/b&gt;, other people use other keys, some use the backslash "\" instead.  So now if you have changed to C-b, then to toggle between windows use:&lt;br /&gt;
&lt;b&gt;C-b C-b&lt;/b&gt; and so on...

&lt;p /&gt;
Another good thing to add to the screenrc is code for a modeline, so you can see the available windows:&lt;br /&gt;
&lt;code&gt;caption string "%?%F%{= Bk}%? %C%A %D %d-%m-%Y %{= kB} %t%= %?%F%{= Bk}%:%{= wk}%? %n "    &lt;br /&gt;                                                                   
hardstatus alwayslastline &lt;br /&gt;                                                                                                                                    
hardstatus string '%{= kG}[ %{G}%H %{g}][%= %{= kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %d/%m %{W}%c %{g}]' &lt;code&gt;&lt;br /&gt;

&lt;p /&gt;
This code will add a modeline to the bottom of the terminal that tells you which window you are in and also the numbers or names of the sessions.&lt;br /&gt;

&lt;h2&gt;Irssi is Screen's BFF&lt;/h2&gt;
Best of all you can keep a session of Irssi (an irc client) running at all times in a screen session and always be up to date with your favorite IRC channels.

&lt;p /&gt;
&lt;h2&gt;Additional Screen resources&lt;/h2&gt; 

&lt;a href="http://aperiodic.net/screen/quick_reference"&gt;Screen Quick Reference&lt;/a&gt;&lt;br /&gt; 
&lt;a href="http://www.ibm.com/developerworks/aix/library/au-gnu_screen/index.html?ca=dgr-lnxw07GNU-Screen&amp;S_TACT=105AGX59&amp;S_CMP=grsitelnxw07"&gt;Stayin' Alive with Screen&lt;/a&gt;&lt;br /&gt; 
&lt;a href="http://www.linuxjournal.com/article/6340"&gt;Power Sessions with Screen&lt;/a&gt;&lt;br /&gt; 
&lt;a href="http://quadpoint.org/articles/irssi"&gt;Guide to Using Irssi with Screen&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-3111640889030134069?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/3111640889030134069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2010/12/using-gnu-screen_21.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/3111640889030134069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/3111640889030134069'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2010/12/using-gnu-screen_21.html' title='Using Gnu Screen'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-2092323799751063501</id><published>2010-07-29T10:11:00.001-07:00</published><updated>2010-07-29T10:38:22.693-07:00</updated><title type='text'>Setting Up a Web Enabled Lending Library</title><content type='html'>&lt;div id="content"&gt;&lt;div id="outline-container-1" class="outline-2"&gt;&lt;h3 id="sec-1"&gt;Setting Up a Web Enabled Lending Library &lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div id="outline-container-1.1" class="outline-3"&gt;&lt;div class="outline-text-3" id="text-1.1"&gt;&lt;br /&gt;
&lt;p&gt;I started cataloging books for a small community center's lending&lt;br /&gt;
library at librarything.com.  Librarything.com is a great web site&lt;br /&gt;
that I highly recommend.  If most of your books have ISBNs and you can&lt;br /&gt;
borrow someone's barcode scanner, cataloging books at Librarything is&lt;br /&gt;
a snap: on the "add books page" you scan a books ISBN and all of its&lt;br /&gt;
information (Title, Author, book cover) will be added by Librarything&lt;br /&gt;
for you.  Of course if you don't have a bar code scanner or there is&lt;br /&gt;
no ISBN, you simply type in part of the title or author and select the&lt;br /&gt;
book from a list of possible matches, this is a bit slower, but&lt;br /&gt;
perfectly adequate if you are inputting a smaller library.  &lt;br /&gt;
&lt;/p&gt;&lt;p&gt;Once all of the books are added, the social networking goodness&lt;br /&gt;
begins!  You're library has its own mini-site at Librarything, with a&lt;br /&gt;
publicly available catalog: &lt;a href="http://librarything.com/catalog/buildupbooks"&gt;Build Up Books catalog&lt;/a&gt; and profile:&lt;br /&gt;
&lt;a href="http://librarything.com/profile/buildupbooks"&gt;Build Up Books profile&lt;/a&gt;. So for a community center, you can send out the URL, and anyone can search the catalog for books they find of interest.  &lt;br /&gt;
&lt;/p&gt;&lt;p&gt;The one problem with this system, is there isn't a robust system for&lt;br /&gt;
checking out books.  Some libraries have adapted an informal system of&lt;br /&gt;
tagging books as "checked out" and in the private comments (only&lt;br /&gt;
visible to the administrator) added the borrowers contact&lt;br /&gt;
information.  This is somewhat acceptable, but first: you would have&lt;br /&gt;
to give any volunteers access to all of your Librarything account's&lt;br /&gt;
permissions (you get all or nothing as far admin rights goes on&lt;br /&gt;
Librarything).  Second there is no way to tell when the book was&lt;br /&gt;
checked out, when it is due back, and also no way to sort by which&lt;br /&gt;
books are currently overdue.  So I thought I would look into importing&lt;br /&gt;
the library, once cataloged, into a drupal web site.  &lt;br /&gt;
&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div id="outline-container-1.2" class="outline-3"&gt;&lt;h3 id="sec-1.2"&gt;Exporting Library from Librarything &lt;/h3&gt;&lt;div class="outline-text-3" id="text-1.2"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Librarything has excellent importing and exporting facilities.  To&lt;br /&gt;
export, sign in to your account and then go to&lt;br /&gt;
&lt;a href="http://librarything.com/more/import"&gt;http://librarything.com/more/import&lt;/a&gt;.  On that page there are links for&lt;br /&gt;
downloading your catalog as either a comma separated csv file or a tab&lt;br /&gt;
delimited text file. &lt;br /&gt;
&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div id="outline-container-1.3" class="outline-3"&gt;&lt;h3 id="sec-1.3"&gt;Downloading User Uploaded Book Covers &lt;/h3&gt;&lt;div class="outline-text-3" id="text-1.3"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;Librarything has over 1,000,000 user uploaded book covers, and it&lt;br /&gt;
makes them available for free.  You need to a developer's key to&lt;br /&gt;
access them and there are some restrictions: you can only download&lt;br /&gt;
1000 per day and one per second. So with these understandable&lt;br /&gt;
restrictions, I decided it would be best to download the book covers&lt;br /&gt;
and store them locally.  So yesterday I wrote a python script to&lt;br /&gt;
download all of the book covers for our library.&lt;br /&gt;
&lt;/p&gt;&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div id="outline-container-1.4" class="outline-3"&gt;&lt;h3 id="sec-1.4"&gt;The Python Script &lt;/h3&gt;&lt;div class="outline-text-3" id="text-1.4"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;I will add a link at the bottom to the script on my&lt;br /&gt;
&lt;a href="http://github.com/underhilllabs"&gt;Github Repository&lt;/a&gt;.  So the script I wrote searches through a&lt;br /&gt;
librarything csv file, finds all of the ISBNs and downloads the book&lt;br /&gt;
covers from &lt;a href="http://librarything.com"&gt;Librarything&lt;/a&gt;.  &lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="src src-python"&gt;import re, urllib, csv,time

CSV_FILE ='~/Downloads/LibraryThing_export.csv'
IMG_DIR ='~/img/'
DEV_KEY = 'YOUR_LIBRARYTHING_DEV_KEY'
IMG_URL = "http://covers.librarything.com/devkey/" + DEV_KEY + "/large/isbn/"
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;I use 4 python libraries.  &lt;br /&gt;
&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Re: for regular expressions to search for isbns.&lt;/li&gt;
&lt;li&gt;urllib: for downloading the Book Cover from Librarything&lt;/li&gt;
&lt;li&gt;csv: for creating a map data structure from a parsed csv file.&lt;/li&gt;
&lt;li&gt;time: for limiting the downloads to one per second.&lt;/li&gt;
&lt;/ul&gt;&lt;br /&gt;
&lt;p&gt;Also I add a couple of variables.  The important one to change is&lt;br /&gt;
DEV_KEY which contains your librarything developers key.  Also make&lt;br /&gt;
sure the CSV_FILE points at your downloaded CSV_FILE and the IMG_DIR&lt;br /&gt;
exists.  Finally IMG_URL points to the web service on librarything&lt;br /&gt;
where you can download user submitted book covers, all you need to do&lt;br /&gt;
is slap an ISBN on the end of that URL and the URL will return either&lt;br /&gt;
a book cover, or a clear 1x1 gif if they do not have that cover.  &lt;br /&gt;
&lt;/p&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;pre class="src src-python"&gt;# read in the Librarything Export File
lt_dict = csv.DictReader(open(CSV_FILE))
#loop through the rows of the dictionary
for row in lt_dict:
    # grab the ISBN dictionary field
    mystr = row["'ISBN'"]
    # search for a matching ISBN
    mymatch = re.match(r"\[(\d+)\]",mystr)
    # if no match, print the title to STDOUT
    if mymatch is None:
        print "blank isbn for: %s" % row["'TITLE'"]
    else:
        # grab the matching string, this is our ISBN!
        isbn = mymatch.group(1)
        # build the web service request URL
        myurl = IMG_URL + isbn
        # where we will store the downloaded Book cover image
        myfile = "%slarge_%s" % (IMG_DIR,isbn)
        # urlretrieve downloads the image and stores it locally
        urllib.urlretrieve(myurl,myfile)
        print "myurl: %s, myfile: %s" % (myurl,myfile)
        # sleep for 2 seconds
        time.sleep(2)
&lt;/pre&gt;&lt;/code&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;p&gt;The hard work is done by &lt;a href="http://docs.python.org/library/csv.html#csv.DictReader"&gt;csv.DictReader&lt;/a&gt; and &lt;a href="http://docs.python.org/release/2.5.2/lib/module-urllib.html"&gt;urllib.urlretrieve&lt;/a&gt;.&lt;br /&gt;
DictReader takes a csv file, parses the first line of the file for&lt;br /&gt;
field names and creates a dictionary data type, so you can loop&lt;br /&gt;
through the rows and have access to the fields by name.  Urlretrieve,&lt;br /&gt;
takes a URL and an optional file name and it grabs the file at the URL&lt;br /&gt;
and stores it locally as the filename you provided.  &lt;br /&gt;
&lt;/p&gt;&lt;p&gt;In a later blog post I will describe the Drupal end of this project:&lt;br /&gt;
creating a book CCK content type, importing data into Drupal custom&lt;br /&gt;
content types, and setting up the check out process.&lt;br /&gt;
&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-2092323799751063501?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/2092323799751063501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2010/07/up-home-setting-up-lending-library-with.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/2092323799751063501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/2092323799751063501'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2010/07/up-home-setting-up-lending-library-with.html' title='Setting Up a Web Enabled Lending Library'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-5212169985789570108</id><published>2010-05-13T19:02:00.000-07:00</published><updated>2010-05-21T18:25:21.557-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='nook'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Nook 1.2 emulator</title><content type='html'>&lt;a href="http://www.flickr.com/photos/redbike/4604957189/" title="Nook 1.2 loaded up as an emulator by denverfiddler, on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3355/4604957189_017973962a.jpg" width="298" height="500" alt="Nook 1.2 loaded up as an emulator" /&gt;&lt;/a&gt;

I was able to build an emulator for Nook version 1.2.  See my &lt;a href=http://denverdroid.blogspot.com/2010/05/how-to-build-nook-emulator.html&gt;previous post&lt;/a&gt; for the prerequisites.  Basically you need some utilities installed: smali, baksmali, unyaffs, and mkyaffs2image.  You also need the Android SDK installed on your computer.


Here are the steps:
1: download the &lt;a href=http://www.multiupload.com/U0Y5IVLL7D&gt;nook 1.2 soft-root image&lt;/a&gt; from &lt;a href=http://nookdevs.com&gt;nookdevs&lt;/a&gt;.  For the rest of this post I assume you have copied it into the directory ~/nook_dev/ and we will be working on it from there. 

&lt;span style="font-weight:bold;"&gt;2. extract the bravo_update.dat&lt;/span&gt;, cd into it and extract root.tgz
&lt;pre&gt;
mv bravo_update.dat bravo_update-1.2.tar.gz
tar xvzf bravo_update-1.2.tar.gz
&lt;/pre&gt;

&lt;span style="font-weight:bold;"&gt;3. extract root.tgz&lt;/span&gt;
&lt;pre&gt;
cd Firmware_Update
tar xvzf root.tgz
cd root
&lt;/pre&gt;

&lt;span style="font-weight:bold;"&gt;4. cd into system/framework and unjar services.jar &lt;/span&gt;
&lt;pre&gt;
cd system/framework/
jar xvf services.jar
&lt;/pre&gt;

5. disassemble the classes.dex file inside services.jar
&lt;pre&gt;baksmali classes.dex&lt;/pre&gt;

6. vi out/com/android/server/ServerThread.smali
search for a line that contains 
&lt;pre&gt;
if-lt v0, v1, :cond_309
&lt;/pre&gt;
delete that line.


7. reassemble out/ directory
&lt;pre&gt;
smali out/
&lt;/pre&gt;


8. copy the new out.dex over the old classes.dex and re-jar services.jar
&lt;pre&gt;
mv out.dex classes.dex
jar cvf services.jar classes.dex
&lt;/pre&gt;

&lt;h4&gt;Now we are going to build an android AVD, so we can extract a single file to use back in this system.&lt;/h4&gt;
&lt;span style="font-weight:bold;"&gt;9. if your android SDK tools are in your path Run&lt;/span&gt;,
&lt;pre&gt;android&lt;/pre&gt;
else find the android command and run it, or run it from eclipse.

This starts the Android SDK and AVD Manager.  To create a new AVD, click New...
Name: nook
Target: Android 1.5
Size: &lt;leave empty&gt;
Skin: click Resolution, and fill in 488 x 944
click "Create AVD".
Then click "Details" to see where it was created.  It should be at ~/.android/avd/nook.avd

&lt;span style="font-weight:bold;"&gt;10. unyaffs the system.img and grab a file&lt;/span&gt;
&lt;pre&gt;
cd ~/nook_dev/
mkdir sys_img
cd sys_img
cp ~/android-sdk-linux_86/platforms/android-3/images/system.img .
unyaffs system.img
cp lib/libaudioflinger.so ~/nook_dev/Firmware_Update/Firmware_Update/system/lib/libaudioflinger.so
&lt;/pre&gt;

&lt;span style="font-weight:bold;"&gt;11. re-create the system.img with the new audio file.&lt;/span&gt;
&lt;pre&gt;
cd ~/nook_dev/Firmware_Update/Firmware_Update/
mkyaffs2image ./system/ system.img
&lt;/pre&gt; this creates a new system.img

&lt;span style="font-weight:bold;"&gt;12. Sketchy step where you overwrite the good Android 1.5 platform system.img in your Android SDK with this new one.&lt;/span&gt;
&lt;pre&gt;
mv ~/android-sdk-linux_86/platforms/android-3/images/system.img ~/android-sdk-linux_86/platforms/android-3/images/good.img 
cp ~/nook_dev/Firmware_Update/Firmware_Update/system.img ~/android-sdk-linux_86/platforms/android-3/images/system.img 
&lt;/pre&gt;
&lt;span style="font-weight:bold;"&gt;Remember to change this back later if you want to do non-nook related Android Development.&lt;/span&gt;

&lt;span style="font-weight:bold;"&gt;13. run the emulator!&lt;/span&gt;
&lt;pre&gt;
emulator @nook -shell -show-kernel -verbose
&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-5212169985789570108?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/5212169985789570108/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2010/05/nook-12-emulator.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/5212169985789570108'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/5212169985789570108'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2010/05/nook-12-emulator.html' title='Nook 1.2 emulator'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm4.static.flickr.com/3355/4604957189_017973962a_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-4470985898072103988</id><published>2010-05-08T10:23:00.001-07:00</published><updated>2010-05-24T19:53:31.171-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='java'/><category scheme='http://www.blogger.com/atom/ns#' term='nook'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>How to Build a Nook emulator</title><content type='html'>This post will walk you through building an Android Emulator for the Nook step-by-step in Eclipse and via the command-line.   These instructions are based on the &lt;a href=http://nookdevs.com/Emulator&gt;original instructions&lt;/a&gt; located at the &lt;a href=http://nookdevs.com/&gt;nookdevs website&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Pre-requisites:  &lt;/h3&gt;&lt;br /&gt;
1. You need to have Eclipse running with the Android SDK.  More information on that can be &lt;a href=http://developer.android.com/sdk/installing.html&gt;found here&lt;/a&gt;.&lt;br /&gt;
2. I'm assuming you are developing in a Linux-ish environment. I'm using the amazing &lt;a href=http://ubuntu.com&gt;Ubuntu Lucid Lynx&lt;/a&gt;.&lt;br /&gt;
3. download and set up the following tools: &lt;a href=http://code.google.com/p/smali/downloads/list&gt;smali&lt;/a&gt;, &lt;a href=http://code.google.com/p/smali/downloads/list&gt;baksmali&lt;/a&gt;, &lt;a href=http://code.google.com/p/unyaffs/downloads/list&gt;unyaffs&lt;/a&gt;, &lt;a href=http://code.google.com/p/fatplus/downloads/list&gt;yaffs2image&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;How I Set Up the command-line tools:&lt;/h3&gt;&lt;br /&gt;
&lt;b&gt;smali and baksmali&lt;/b&gt;. Description from the developer's site: &lt;br /&gt;
"smali/baksmali is an assembler/disassembler for the dex format used by dalvik, Android's Java VM implementation". &lt;br /&gt;
1.  Download them into your ~/bin/ directory.  &lt;br /&gt;
2. "chmod +x" the wrapper scripts (smali and baksmali) &lt;br /&gt;
3. rename the jar files: smali.jar and baksmali.jar.&lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;cd ~/bin/
wget http://smali.googlecode.com/files/smali-1.2.2.jar
wget http://smali.googlecode.com/files/baksmali-1.2.2.jar
wget http://smali.googlecode.com/files/baksmali
wget http://smali.googlecode.com/files/smali
mv baksmali-1.2.2.jar baksmali.jar
mv smali-1.2.2.jar smali.jar
chmod +x smali
chmod +x baksmali
&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;unyaffs&lt;/b&gt; description: Unyaffs is a program to extract files from a yaffs file system image.    &lt;br /&gt;
1. download &lt;a href=http://code.google.com/p/unyaffs/downloads/list&gt;unyaffs&lt;/a&gt; into your&lt;br /&gt;
~/bin; chmod +x unyaffs;   &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;mkyaffs2image&lt;/b&gt;: &lt;br /&gt;
1. download &lt;a href=http://code.google.com/p/fatplus/downloads/list&gt;mkyaffs2image&lt;/a&gt;.  I downloaded the yaffs2-binary.tar, untarred it and copied yaffs2/utils/mkyaffs2image to my ~/bin/ and chmod +x it.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Okay we have the tools and our environment is ready!&lt;/h3&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;1.&lt;/span&gt; I'm assuming you already have Eclipse set up and running with the Android Development Kit.  Nook runs on the cupcake 1.5 platform of Android.  So first we have to make sure that the Android 1.5 Platform is installed.  Assuming you downloaded the Android SDK into your home directory, run:&lt;br /&gt;
&lt;pre&gt;$ ~/android-sdk-linux_86/tools/android&lt;/pre&gt;&lt;br /&gt;
This will start the Android SDK and AVD Manager.  Click on Installed Packages and look for SDK Platform 1.5.  If you do not see it, click on Available Packages and download and install it.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;2. Grab the original 1.0.0 image from&lt;/span&gt; bn.com (mirrored here: &lt;a href=http://www.multiupload.com/YWHOXQKYVS&gt;multiupload&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;3.Run&lt;/span&gt; &lt;pre&gt;$ dd if=signed_bravo_update.1.0.0.dat of=signed-bravo-update.1.0.0.tar.gz bs=1 skip=152&lt;/pre&gt;&lt;br /&gt;
This takes a while.  You now have signed-bravo-update.1.0.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;4.Uncompress the new file: signed-bravo-update.1.0.0.tar.gz   &lt;/span&gt;&lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;$ tar xzvf signed-bravo-update.1.0.0.tar.gz&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
Now you have the uncompressed folder Firmware_Update, &lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;$ cd Firmware_Update&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;5. Rename bravo_update.dat to bravo_update.tar.gz and extract it. &lt;/span&gt;&lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;
$ mv bravo_update.dat bravo_update.tar.gz
$ tar xvzf bravo_update.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
This uncompresses another Firmware_Update folder, cd in to it.&lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;$ cd Firmware_Update&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
if you pwd, you'll be in Firmware_Update/Firmware_Update&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;6. Extract root.tgz&lt;/span&gt;&lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;
$ tar xvzf root.tgz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
this uncompresses a lot of stuff. All of the Android system image actually.  Later we will re-compress the system folder to create the system.img&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;7. Extract system/framework/services.jar &lt;/span&gt;with your favorite unzip utility. &lt;br /&gt;
I did this from the GUI, right click on file and select "Extract here". &lt;br /&gt;
$ cd services&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;8. disassemble the file classes.dex with baksmai&lt;/span&gt;&lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;$ baksmali classes.dex&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;This create out/&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;9. vi out/com/android/server/ServerThread.smali&lt;/span&gt;&lt;br /&gt;
delete the line &lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;if-lt v0, v1, :cond_483&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
(for the vi-newbies, you can search in vi by typing a forward slash and typing in a phrase like "if\-lt", then type dd, to delete the line, and ":wq" to write the file and quit)&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;10. reassemble the file with &lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;$ smali out&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;11. Replace the old classes.dex with this re-assembled file:&lt;/span&gt;&lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;mv out.dex classes.dex&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;12. delete the old out/ directory and re-jar the contents of the services folder&lt;/span&gt;, but the not the services folder itself.&lt;br /&gt;
(I moved the META-INF folder and classes.dex out of the services directory and into the parent framework directory. Removed the empty services directory. Right clicked the classes.dex and selected "compress", and selected as name "services" and type as "jar" file, then I dragged the META-INF file onto the new services.jar. Yes, I know there is a better way, but I'm kind of new to jar files...)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;h4&gt;Now we are going to build an android AVD, so we can extract a single file to use back in this system.&lt;/h4&gt;&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;13. if your android SDK tools are in your path Run&lt;/span&gt;,&lt;br /&gt;
&lt;pre&gt;android&lt;/pre&gt;&lt;br /&gt;
else find the android command and run it, or run it from eclipse.&lt;br /&gt;
&lt;br /&gt;
This starts the Android SDK and AVD Manager.  To create a new AVD, click New...&lt;br /&gt;
Name: nook&lt;br /&gt;
Target: Android 1.5&lt;br /&gt;
Size: &lt;leave empty&gt;&lt;br /&gt;
Skin: click Resolution, and fill in 488 x 944&lt;br /&gt;
click "Create AVD".&lt;br /&gt;
Then click "Details" to see where it was created.  It should be at ~/.android/avd/nook.avd&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;14. unyaffs the system.img and grab a file&lt;/span&gt;&lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;
cd ~/nook_dev/
mkdir sys_img
cd sys_img
cp ~/android-sdk-linux_86/platforms/android-3/images/system.img .
unyaffs system.img
cp lib/libaudioflinger.so ~/nook_dev/Firmware_Update/Firmware_Update/system/lib/libaudioflinger.so
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;15. re-create the system.img with the new audio file.&lt;/span&gt;&lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;
cd ~/nook_dev/Firmware_Update/Firmware_Update/
mkyaffs2image ./system/ system.img
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;this creates a new system.img&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;16. Sketchy step where you overwrite the good Android 1.5 platform system.img in your Android SDK with this new one.&lt;/span&gt;&lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;
mv ~/android-sdk-linux_86/platforms/android-3/images/system.img ~/android-sdk-linux_86/platforms/android-3/images/good.img 
cp ~/nook_dev/Firmware_Update/Firmware_Update/system.img ~/android-sdk-linux_86/platforms/android-3/images/system.img 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;Remember to change this back later if you want to do non-nook related Android Development.&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight:bold;"&gt;17. run the emulator!&lt;/span&gt;&lt;br /&gt;
&lt;div id="code-div"&gt;&lt;pre&gt;&lt;code&gt;
emulator @nook -shell -show-kernel -verbose
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.flickr.com/photos/redbike/4604815190/" title="Nook Emulator screenshot by denverfiddler, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4049/4604815190_698482e4b6.jpg" width="500" height="380" alt="Nook Emulator screenshot" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-4470985898072103988?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/4470985898072103988/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2010/05/how-to-build-nook-emulator.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/4470985898072103988'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/4470985898072103988'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2010/05/how-to-build-nook-emulator.html' title='How to Build a Nook emulator'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm5.static.flickr.com/4049/4604815190_698482e4b6_t.jpg' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-665138841129548859</id><published>2010-05-04T09:26:00.001-07:00</published><updated>2010-05-04T11:03:54.706-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='eclipse'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>Moving with Eclipse to a new workstation</title><content type='html'>The hard drive on my laptop started clicking quite ominously, so I figured it was time to order a new hard drive.  I backed up my photos to the cloud (Flickr and Picasa) and backed up all my music and docs to Dropbox and Google Docs and waited for the new hard drive to arrive.  Files are files: you just need to keep a regular backup; and email already lives in the cloud.  That leaves my development environment.  

Here are the steps I've followed to move my development set up to a new computer.

1. open up Synaptic and download Eclipse.  There are several Eclipse packages available.  I selected the big Eclipse package which includes the JDT (Java Developer Tools) and PDE (plug-in development tools).  I've had trouble before when I selected one of the smaller eclipse packages and tried to add the plug-ins I needed separately.

2. Download or copy over the &lt;a href=http://developer.android.com/sdk/index.html&gt;Android SDK&lt;/a&gt;.  

3. Put the Android SDK tools directory in my PATH in .bashrc
  b. then type 'bash', so the new .bashrc takes effect.
  c. type 'adb', to make sure the android SDK tools are in my PATH.

4. open up Eclipse and go to Help-&gt;Install New Software... click "add" to add a new tools depository, and add the android  developer tools repository: https://dl-ssl.google.com/android/eclipse/.  
  b. once the new depository is loaded, select the Android Developer Tools and Android DDMS and wait for Eclipse to download and install them.

5. moved my private signing key over.

6. moved over my projects and imported them through File-&gt;Import... -&gt;Existing Projects into Workspace.
  b. if you get any errors, try right clicking on the project and select Android Tools-&gt;Fix Project Properties

7. Export an app and sign it with the key you moved over.  (this is the scary part, if you lose the signing key you used to originally sign your app, you will not be able to provide any more updates to your app in the Android Market!)
  a. File-&gt;Export ... Android-&gt;Export Android Application --&gt; select the project you want to Export --&gt; Use existing keystore, (click location to locate it.) type in your password....

8. Plug your dev phone into your workstation and install the app.
  a. adb install -r /path/to/YourApp.apk

Whoo Hoo!  The development environment (for android at least) is all moved over.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-665138841129548859?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/665138841129548859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2010/05/moving-with-eclipse-to-new-workstation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/665138841129548859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/665138841129548859'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2010/05/moving-with-eclipse-to-new-workstation.html' title='Moving with Eclipse to a new workstation'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-4136596181908659026</id><published>2010-04-29T14:29:00.000-07:00</published><updated>2010-04-29T15:22:55.148-07:00</updated><title type='text'>Phone update update: Wow, that was fast</title><content type='html'>I just updated my G1/dream to CyanogenMod-4.2.15.1 with danger spl.  The actual flashing of the 3 different roms (danger-spl, defanged base, cm-4.2.15.1) part only took about 20 minutes.  This was after I had already downloaded all of the necessary files, copied them to the SD card and verified my radio version (Settings-&gt;About phone-&gt;Baseband version).

The first time you root your phone it will take a bit longer than this.  One of the reasons it is much faster after the first time, is because during the initial rooting process, you load a "recovery utility" that you will use later.  

Now to wait for CyanogenMod-5.0.7 to drop.

&lt;span style="font-weight:bold;"&gt;
So how do I know if the Danger SPL is loaded?  (&lt;a href=http://forum.cyanogenmod.com/index.php?/topic/2614-all-discussion-of-upcoming-cm-507-ds/page__view__findpost__p__25763&gt;via this  cyanogenmod forum post&lt;/a&gt;)&lt;/span&gt;
1. Turn off phone.
2. Hold the camera button on the side and press the red power button.  If you are using Danger SPL, you'll see a white screen with 3 androids riding skateboards. At the top of the screen you'll see the text:
HBOOT-1.33.2005

like this:
&lt;a href="http://www.flickr.com/photos/redbike/4563683265/" title="G1/dream android phone: danger spl screen by denverfiddler, on Flickr"&gt;&lt;img src="http://farm5.static.flickr.com/4040/4563683265_a40e478173.jpg" width="375" height="500" alt="G1/dream android phone: danger spl screen" /&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-4136596181908659026?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/4136596181908659026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2010/04/phone-update-update-wow-that-was-fast.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/4136596181908659026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/4136596181908659026'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2010/04/phone-update-update-wow-that-was-fast.html' title='Phone update update: Wow, that was fast'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://farm5.static.flickr.com/4040/4563683265_a40e478173_t.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-2782852645779220755</id><published>2010-04-29T13:51:00.000-07:00</published><updated>2010-04-29T14:41:57.139-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='cyanogenmod'/><category scheme='http://www.blogger.com/atom/ns#' term='android'/><category scheme='http://www.blogger.com/atom/ns#' term='mod'/><title type='text'>Updating my android g1 phone to cyanogen 4.2.15.1 with Danger SPL</title><content type='html'>Tonight &lt;a href=http://twitter.com/cyanogen&gt;cyanogen&lt;/a&gt; is releasing 5.0.7 of the cyanogenmod.  This is a modified ROM for android phones, that will finally allow g1 phone users like myself to run most of the latest android apps on our phones.  It will add most of the Android Eclair functionality to older android phones, except for Live Wallpapers, but I didn't really see myself using any live wallpapers anyway.

The one catch is that the new ROM is too big to fit inside the G1's tiny internal memory.  The G1 has 64 MB of room for ROMs, and according to Cyanogen no matter how he tried to squeeze the ROM 64 MB was still 4 MB too small.  So in order to load the new ROM with the eclair goodies, you need to use an SPL (second program loader), to load the ROM.   &lt;a href=http://forum.cyanogenmod.com/index.php?/topic/2646-how-to-danger-spl/&gt;More info on the Danger SPL&lt;/a&gt;. 

So in anticipation of tonight's release, I am installing the Danger SPL on my phone.   The &lt;a href=http://forum.cyanogenmod.com/index.php?/topic/2646-how-to-danger-spl/&gt;danger spl how to at cyanogenmod.com&lt;/a&gt; says that the pre-requisites are a rooted G1/Dream phone (check) and a compatible radio, with links to the radio images.  So I downloaded the radios, but nowhere in the rest of the article did it mention what to do with the radio images.  I was worried, but then I realized you just need to have one of the radios currently on your phone or you need to install one of the images I downloaded.  After searching the interweb for how to check which radio is installed on your phone, I found &lt;a href=http://androidandme.com/2009/05/beginners/guides/beginners-guide-for-rooting-your-android-g1-to-install-cupcake/&gt;this article&lt;/a&gt;, which says look in your phone under: Settings-&gt;About Phone-&gt;Baseband version, the last part of the number is your radio version.  In my case its 2.22.19.26I, which is compatible!

So on to updating the ROM!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-2782852645779220755?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/2782852645779220755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2010/04/updating-my-android-g1-phone-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/2782852645779220755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/2782852645779220755'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2010/04/updating-my-android-g1-phone-to.html' title='Updating my android g1 phone to cyanogen 4.2.15.1 with Danger SPL'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-7336282106313341755</id><published>2010-04-26T15:37:00.000-07:00</published><updated>2010-04-26T15:39:15.069-07:00</updated><title type='text'>Drupal 7: What you need to know</title><content type='html'>This is the video that inspired me to download and test Drupal 7.  Good, informative video!

&lt;embed type="application/x-shockwave-flash" width="640"  height="504"  allowfullscreen="true"  allowscriptaccess="always"  src="http://www.archive.org/flow/flowplayer.commercial-3.0.5.swf"  w3c="true"  flashvars='config={"key":"#$b6eb72a0f2f1e29f3d4","playlist":[{"url":"http://www.archive.org/download/Drupal7WhatYouNeedToKnow/format=Thumbnail?.jpg","autoPlay":true,"scaling":"fit"},{"url":"http://www.archive.org/download/Drupal7WhatYouNeedToKnow/mon_1500_308_1_512kb.mp4","autoPlay":false,"accelerated":true,"scaling":"fit","provider":"h264streaming"}],"clip":{"autoPlay":false,"accelerated":true,"scaling":"fit","provider":"h264streaming"},"canvas":{"backgroundColor":"0x000000","backgroundGradient":"none"},"plugins":{"audio":{"url":"http://www.archive.org/flow/flowplayer.audio-3.0.3-dev.swf"},"controls":{"playlist":false,"fullscreen":true,"gloss":"high","backgroundColor":"0x000000","backgroundGradient":"medium","sliderColor":"0x777777","progressColor":"0x777777","timeColor":"0xeeeeee","durationColor":"0x01DAFF","buttonColor":"0x333333","buttonOverColor":"0x505050"},"h264streaming":{"url":"http://www.archive.org/flow/flowplayer.h264streaming-3.0.5.swf"}},"contextMenu":[{"View+Drupal7WhatYouNeedToKnow+at+archive.org":"function()"},"-","Flowplayer 3.0.5"]}'&gt; &lt;/embed&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-7336282106313341755?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/7336282106313341755/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2010/04/drupal-7-what-you-need-to-know.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/7336282106313341755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/7336282106313341755'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2010/04/drupal-7-what-you-need-to-know.html' title='Drupal 7: What you need to know'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-6316728779454722136</id><published>2010-04-26T14:49:00.000-07:00</published><updated>2010-04-26T15:34:46.617-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='drupal'/><category scheme='http://www.blogger.com/atom/ns#' term='apache'/><title type='text'>Test several websites on your computer at once</title><content type='html'>After watching several videos from last week's DrupalCon I had an itch to try out Drupal 7 for myself.  The problem was I already had a site I was testing on my laptop.  I could've downloaded it to my test server, but I've been testing alot lately at coffee shops with spotty wifi, so I decided I'd add some entries to my hosts file instead and write up a quick How-to.  

(pre-requisites: You must have apache, php and mysql already running on your workstation.  On ubuntu this is as simple as opening synaptic and searching for each of these packages and installing them: apache2, php5, mysql.)

&lt;h3&gt;Multiple development websites in 3 steps.&lt;/h3&gt;  

&lt;span style="font-weight:bold;"&gt;1. Edit your hosts file.&lt;/span&gt;  

On Linux this is located at /etc/hosts.  On Windows machines (XP, Vista, Windows 7) it is located at %SystemRoot%\system32\drivers\etc\hosts.  On Mac OS X, its located in: /private/etc/hosts

add a new entry for each website you want to test (don't worry you can add more later):
127.0.0.1    d7
127.0.0.1    d6

in this case I added two entries: one to test drupal 6, and a second to test drupal 7.

To check that everything is working, open up a teriminal and ping d7 you should see something like this:
&lt;blockquote&gt;
&lt;pre&gt;
$ ping d7
PING d7 (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.044 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.047 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.051 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.055 ms
&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;span style="font-weight:bold;"&gt;2. Edit your Apache config file&lt;/span&gt;

Add a &amp;lt;VirtualHost&amp;gt; entry for each of the test sites:
&lt;blockquote&gt;
&lt;pre&gt;
&amp;lt;VirtualHost *:80&amp;gt;
    ServerName d7
    DocumentRoot /home/bart/Public/drupal-7.x-dev
&amp;lt;/VirtualHost&amp;gt;
&amp;lt;VirtualHost *:80&amp;gt;
    ServerName d6
    DocumentRoot /home/bart/Public/drupal-6.16
&amp;lt;/VirtualHost&amp;gt;
&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;span style="font-weight:bold;"&gt;3. restart apache&lt;/span&gt;

&lt;blockquote&gt;
$sudo apache2ctl restart
&lt;/blockquote&gt;

Now you're ready to test the websites by opening up the URLs: 
http://d7 and http://d6 in a browser.


As a bonus: go check out the &lt;a href=http://www.archive.org/search.php?query=drupalcon2010&gt;DrupalCon2010 screencasts at archive.org&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-6316728779454722136?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/6316728779454722136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2010/04/test-several-websites-on-your-computer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/6316728779454722136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/6316728779454722136'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2010/04/test-several-websites-on-your-computer.html' title='Test several websites on your computer at once'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7035860407900002000.post-5494733453019207090</id><published>2010-04-21T10:21:00.000-07:00</published><updated>2010-04-21T19:48:05.165-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='android'/><title type='text'>Non-destructibly upgrade your android app's database</title><content type='html'>So your android app is out in the wild with thousands of Happy Users and the Happy Users are begging and pleading for a new feature that requires a new field in your database.   However, the aforementioned Happy Users, would quickly turn to Unhappy Users if your next upgrade wiped their data when it restructured the app's database.

What to do?

Here's how I upgraded my app's Database schema, while preserving all of the user's data.

First of all, I use a DatabaseHelper class (that extends &lt;a href="http://developer.android.com/intl/zh-TW/reference/android/database/sqlite/SQLiteOpenHelper.html"&gt;SQLiteOpenHelper&lt;/a&gt;) that performs some of the basic database needs (create, upgrade).

The function we will concentrate on in this post is onUpgrade().  This function is called when the database version, represent with the constant DATABASE_VERSION is changed.  Most barebones implementation of this function call will simply drop the app's tables  and recreate them with a call to onCreate():

&lt;blockquote&gt;
&lt;span style="font-weight: bold;"&gt;
&lt;pre&gt;
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    ...
    db.execSQL("DROP TABLE IF EXISTS albums");
    onCreate(db);
}
&lt;/pre&gt;
&lt;/span&gt;
&lt;/blockquote&gt;

However, this approach will destroy all of your user's data, (ie the entire 2500+ CD collection they painstakingly entered with the soft keybard--if this were the case perhaps you should add a barcode scanner intent, alas, back to the story.) Which results in a Very Unhappy User (hereafter VUU).

The solution, is to check for the app's Database Version and make a call to our friend ALTER TABLE, like so.

&lt;blockquote&gt;
&lt;span style="font-weight: bold;"&gt;
&lt;pre&gt;
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
   if(oldVersion == 2) {
          db.execSQL("ALTER TABLE albums ADD COLUMN hip_again integer");
   } else {
         ...
        db.execSQL("DROP TABLE IF EXISTS albums");
        onCreate(db);
  }
&lt;/pre&gt;
&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;}&lt;/span&gt;
&lt;/blockquote&gt;

There! Now your user's can flag their old CD's with the shifting tides of what's hip.  Also note that should add the column in the onCreate method.  So that Happy Users of the Future (hereafter HUF), will also have the field available to them:

&lt;blockquote&gt;
&lt;span style="font-weight: bold;"&gt;
&lt;pre&gt;
private static final String DATABASE_CREATE =
          "create table albums (_id integer primary key autoincrement, "
          ...
          + "hip_again integer);";

@Override
public void onCreate(SQLiteDatabase db) {
                 db.execSQL(DATABASE_CREATE);
}
&lt;/pre&gt;
&lt;/span&gt;
&lt;/blockquote&gt;

One final thing is to increment the constant DATABASE_VERSION, so that android will call onUpgrade() the next time the app is started:
&lt;blockquote&gt;
&lt;span style="font-weight: bold;"&gt;
private static final int DATABASE_VERSION = 3;
&lt;/span&gt;
&lt;/blockquote&gt;


That's it.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7035860407900002000-5494733453019207090?l=denverdroid.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://denverdroid.blogspot.com/feeds/5494733453019207090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://denverdroid.blogspot.com/2010/04/how-to-non-destructibly-upgrade-your.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/5494733453019207090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7035860407900002000/posts/default/5494733453019207090'/><link rel='alternate' type='text/html' href='http://denverdroid.blogspot.com/2010/04/how-to-non-destructibly-upgrade-your.html' title='Non-destructibly upgrade your android app&apos;s database'/><author><name>Bart Lantz</name><uri>http://www.blogger.com/profile/04849091997558746294</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://farm1.static.flickr.com/130/330223208_508744ea49.jpg'/></author><thr:total>0</thr:total></entry></feed>
