Thu, 27 Oct 2005css 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)
Tue, 25 Oct 2005xmlrpc 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)
Sun, 23 Oct 2005python, 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)
Wed, 19 Oct 2005Poor 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)
Sat, 08 Oct 2005xmlfo, 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)
|
Search this siteNavigationMetadataHome About Resume My Code (SVN)ArticlesARP Security Dynamic DNS with DHCP OpenLDAP+Kerberos+SASL PPP over SSH SSH Security: /bin/false Week of Unix Tools Work EfficiencyProjectsfex firefox tabsearch firefox urledit grok keynav liboverride newpsm (FreeBSD) nis2ldap pam_captcha poor man's backup Solaris audio utility xboxproxy xdotool xmlpresenter xpathtool misc scriptsPresentationsYahoo! Hack Day '08 Yahoo! Hack Day '06 Unix Essentials Vi/Vim Essentials SSH Tunneling (Video)Tag CloudCalendar
FriendsBarCamp Kent Brewster Tantek Çelik John Resig Wesley Shields Tyler ShieldsTechnorati |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||