photo
Jordan Sissel
geek

Thu, 27 Oct 2005

css selectors and html tables

CSS is fun. It has a concept of "selectors." Selectors are ways of specifying what elements in your document have styles applied to them. If you want to know more about selectors, css.maxdesign.com.au has an exellent article on css selectors.

Comments: 0 (view comments)
Tags:
Permalink: /web/194
posted at: 00:11

Tue, 25 Oct 2005

xmlrpc javascript library and pimp rewrite

Yet Another Rewrite of Pimp, my music jukebox software, has commenced. This time, I'm writing it in Python. This was the best excuse I could find to learn python. I've tinkered with it before but never written an application in it.

Anyway, the interface has moved from telnet-based to web-based and uses XMLHTTPRequest (AJAX) to perform XMLRPC calls on the purely-python webserver. Python provides a wonderful standard module called 'xmlrpclib' to marshall/unmarshall XMLRPC requests and responses to/from python and XML. JavaScript, howver, lacks these marshalling features.

Some quick googling found jsolait and vcXMLRPC. Both of these are huge frameworks and are well beyond my particular needs. BOTH of them have "the suck" and fail to cleanly load into Firefox without warnings. Bah! Back at square-one. I'm left without a way to marshall xmlrpc requests and responses between javascript and xml

I spent some time learning about XMLRPC. Turns out it's a very very simple xml-based protocol for calling methods and getting results. JavaScript has DOM already so parsing XMLRPC messages is very easy.

Take a look at the 'rpcparam2hash' and 'hash2rpcparam' functions in pimp.js and see how I convert between JavaScript hashes (dictionaries) and XMLRPC messages. If I get bored I may create my own xmlrpc library specifically for making xmlrpc calls with javascript. If you want this to get done, please let me know and give me encouragement ;)

Comments: 1 (view comments)
Tags: , , , ,
Permalink: /geekery/193
posted at: 02:51

Sun, 23 Oct 2005

python, unicode, and pysqlite2

I have filenames I'm putting into an sqlite database. These filenames are ASCII encoded and may have upper-range characters in them. The problem, in python, is that the default encoding is UTF-8 and these ASCII upper-range characters, for whatever reason, cannot be converted. pysqlite2 provides a mechanism for fixing this problem with adapters and converters.

If you get this error:

UnicodeDecodeError: 'utf8' codec can't decode bytes in position [whatever]
Here's how I fix it (this may not be the proper solution):
from pysqlite2 import dbapi2 as sqlite

# ... several lines of code later ...

def decode_string(val):
	return val

def adapt_string(val):
	return unicode(val).encode("US-ASCII")

# ... somewhere ...

sqlite.register_adapter(str, adapt_string)
sqlite.register_converter('VARCHAR', decode_string)
I'm not certain the converter/decode is necessary, however the encoding is absolutely necessary.

Comments: 0 (view comments)
Tags: ,
Permalink: /geekery/192
posted at: 02:40

Wed, 19 Oct 2005

Poor Man's Backup: rsync + management

I got bored and made some useful adaptations on a backup script I wrote for class. It turned into a simple backup/recovery script that supports multiple host backups and very easy recovery.

Read more about the project on the project page: projects/pmbackup

There are a few caveats of the way I currently do it. The first, being, that file ownership is not preserved. This is only an option if rsync is being run as root on the backup server while doing backups, or as root on the client when doing recovery. I'm going to setup a "backup jail" on my machine with only rsync and sshd in it so I can have an ssh key let me login to that jail as root so backups can preserve file ownerships.
There may be a better way to do this, but jailing seems the simplest and most secure.

Comments: 0 (view comments)
Tags: ,
Permalink: /productivity/191
posted at: 01:40

Sat, 08 Oct 2005

xmlfo, round 1.

Start with: sitebook.xml
End with: sitebook.pdf

This uses an xsl template to generate an xmlfo document. Then it uses fop (an apache project) to turn the xmlfo into a pdf.

Comments: 0 (view comments)
Tags: ,
Permalink: /geekery/190
posted at: 21:44

Search this site

Navigation

Metadata

Home About Resume My Code (SVN)

Articles

ARP Security Dynamic DNS with DHCP OpenLDAP+Kerberos+SASL PPP over SSH SSH Security: /bin/false Week of Unix Tools Work Efficiency

Projects

fex firefox tabsearch firefox urledit grok keynav liboverride newpsm (FreeBSD) nis2ldap pam_captcha poor man's backup Solaris audio utility xboxproxy xdotool xmlpresenter xpathtool misc scripts

Presentations

Yahoo! Hack Day '08 Yahoo! Hack Day '06 Unix Essentials Vi/Vim Essentials SSH Tunneling (Video)

Tag Cloud

Calendar

< October 2005 >
SuMoTuWeThFrSa
       1
2 3 4 5 6 7 8
9101112131415
16171819202122
23242526272829
3031     

Friends

BarCamp Kent Brewster Tantek Çelik John Resig Wesley Shields Tyler Shields

Technorati