Great articles by Matt Pietrek that discuss the PE format in-depth:
Tuesday, April 29, 2008
Bash 'for' loop examples
I can never remember the syntax for bash for loops:
#!/bin/bash
for i in $( ls ); do
echo item: $i
done
#!/bin/bash
for i in `seq 1 10`; do
echo $i
done
#!/bin/bash
for ((i=100;i<=115;i+=1)); do
echo $i
sleep 1
echo $i > /dev/ttyS1
done
PenguinTV broken on Gutsy
I have been using PenguinTV to download the radio shows I subscribe to. The interface is OK, except:
- The multiple download feature is broken. You can't select muliple files and get it to download. Sucky!
- It is totally broken on Ubuntu Gutsy (segfaults). The workaround is:
export LD_LIBRARY_PATH=/usr/lib/firefox
export MOZILLA_FIVE_HOME=/usr/lib/firefox
PenguinTV
Monday, April 28, 2008
HOWTO write a firefox plugin
I'm in the process of writing my first firefox plugin and have recorded my experiences here. The HOWTOs and links I used were:
The most important firefox extensions are:
To create the xpi file for publishing you need to change your chrome.manifest to point to the jar file (I keep another chrome.manifest for packaging in the repository so I can just copy it over). The ordinary manifest looks like this:
I use these commands to create the jar and xpi:
- http://www.rietta.com/firefox/Tutorial/overview.html
- Chrome spec
- I found this hilarious:
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- Good links from this blog
- HOWTO set up a development environment
- How to debug extensions, and some essential development extensions
- XUL Tutorials
- More XUL Tutorials
- Adding XUL elements (e.g. menus) dynamically
- XUL Reference
- Working with the tabbed browser
- Storing session information per tab
- Firefox extension preferences
- XMLHttpRequest
- Parsing XML
- Publishing the extension on addons.mozilla.org
The most important firefox extensions are:
- Console2
- Extension developer's extension. The 'reload all chrome' is useful for stuff that is otherwise cached.
To create the xpi file for publishing you need to change your chrome.manifest to point to the jar file (I keep another chrome.manifest for packaging in the repository so I can just copy it over). The ordinary manifest looks like this:
and the packaging one looks like this:
content myextensionname chrome/content/
skin myextensionname classic chrome/skin/
overlay chrome://browser/content/browser.xul chrome://myextensionname/content/browser_overlay.xul
locale myextensionname en chrome/locale/en/myextensionname/
content myextensionname jar:chrome/myextensionname.jar!/content/
skin myextensionname classic jar:chrome/myextensionname.jar!/skin/
overlay chrome://browser/content/browser.xul chrome://myextensionname/content/browser_overlay.xul
locale myextensionname en jar:chrome/myextensionname.jar!/locale/en/myextensionname/
I use these commands to create the jar and xpi:
cd chrome
zip -r myext.jar * -x \*.svn\*
cd ..
zip myext.xpi install.rdf chrome.manifest chrome/myext.jar
Monday, April 7, 2008
Python memcached
Installing the python bindings for the C libmemcached:
- Patch libmemcache
- Compile and install libmemcache
- sudo apt-get install python-dev
- sudo python setup.py install
- Download the actual memcached, compile and install
- Use it (StringClient for strings, Client uses pickle for other types):
It's been a while since I used patch, so I thought I'd record the command I used. This was a multifile patch, and it applies the patches to all the right files. How cool is that! The -p1 prunes off one slash of the path since my directory was different to the guys who made the patch.
patch -b -p1 -i libmemcache-1.4.0.rc2.patch
import cmemcache
a=cmemcache.StringClient(["127.0.0.1:11211"])
a.set('key', 'value')
a.get('key')
Subscribe to:
Posts (Atom)