piyo's computer tips
Wrestling with PostgreSQL 8.0, part 2
Cygwin, PostgreSQL, WindowsAfter a good night's sleep, I attack the problem again.
I tried installing 8.0.2Win and 8.0.0beta3cyg but creating the database on 8.0.2Win after pg_dumpall with either of the two versions resulted in EUC corruption. So I reverted Cygwin's standard PostgreSQL to 7.4.5.
I investigated the PGCLIENTENCODING (set to SJIS), and tried another html dump using 7.4.5Cyg. And what do you know, encoding is maintained in SJIS. UNICODE (utf8) is a bust, though.
I investigated the PGCLIENTENCODING (set to SJIS), and tried another html dump using 8.0.2Win server, and it works. It works?!?!
Wrestling with PostgreSQL 8.0
PostgreSQL, Windows, CygwinSo I tried upgrading my toy database with 1M of real data from PostgreSQL 7.1.3 Cygwin to 8.0 Windows Native and it didn't work very well.
Here are the commands I tried and when:
Backing up my database: Okay so I'm running 7.1.3+Cygwin which I custom compiled (ah is that my error?) and all of the databases are owned by "Administrator" with encoding EUC_JP, but I installed 7.4.5+Cygwin so that I have access to the psql and pg_dumpall commands. So after trying a lot of commands, I got this one to work:
pg_dumpall -h localhost -p 5432 --inserts --column-inserts -v > psql-dumpall-`sdate`
Next I go to my Windows machine where I installed PostgreSQL 8.0.2. I created the Windows user postgres, and then I proceeded to make mistakes, which ultimately led me to creating the database cluster from scratch. Oh yes, the aforementioned "Administrator" on the 7.1.3+Cygwin came back to bite me. So I had to recreate the database cluster like so:
net stop "PostgreSQL Database Server 8.0"
rmdir d:\Progra~1\PostgreSQL\8.0\data
runas /user:localhost\postgres "d:\progra~1\postgresql\8.0\bin\initdb -E eucjp --locale=Japanese -U Administrator -D d:\Progra~1\PostgreSQL\8.0\data"
net start "PostgreSQL Database Server 8.0"
Now I could try restoring my junk here:
psql.exe -d template1 -f psql-dumpall-`sdate`
And whoa, it works almost without errors. But there are some errors:
INSERT 17345 1
INSERT 17347 1
INSERT 17349 1
psql:psql-dumpall-`sdate`:2805: ERROR: invalid byte sequence for encoding "EUC_JP": 0xdf6e
INSERT 17350 1
INSERT 17352 1
Then I try checking out the Japanese to see if it is maintained.
psql-8.0.2 gamelog -H -c "select * from entries;" > 802.html
psql-7.4.5 gamelog -H -c "select * from entries;" > 745.html
But alas the date is corrupted in the 802.html. The 745.html looks okay, though, why?
I'm tired of this. I will get back to it later.
Subversion mode for Emacs
Subversion, EmacsI use the psvn module for using Subversion with Emacs. But this module is not easily installable. What's a fast way of installing it?
wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/psvn/psvn.el
sudo rm /usr/share/emacs/site-lisp/psvn.elc # gentoo
sudo cp psvn.el /usr/share/emacs/site-lisp/ # gentoo
http://svn.collab.net/viewcvs/svn/trunk/contrib/client-side/psvn/psvn.el
Using NTP and SNTP at work?
NTP, timekeepingIt looks like the NTP daemon on the Linux server that gets SNTP information from my Internet connected Windows desktop (using NetTime) does not synchronize with the official NTP time. Therefore I cannot get this Linux server to calculate its drift in software. So I settle for just syncing with ntpdate. My tolerance for NTP accuracy is that much.
Actually I take the /etc/init.d/ntpdate script from debian as my template. Then I set the crontab for root to this:
*/59 8-17 * * 1-5 /etc/init.d/ntpdate restart
Windows network service proxy server Delegate
Proxy, SVN, Delegate, Windows
I've known about
Delegate for some time now but I've never actually used it daily. Now I have a reason to at work because I no longer have my own private network. Here's some tips:
Regular HTTP proxy:
delegated -P8118 SERVER=http PROXY="myproxy:8118:*" HTTPCONF="methods:*"
Subversion proxy:
delegated -P8119 SERVER=tcprelay://mysvnserver:80
Network configuration in Gentoo
GentooI've been using debian for a lot longer than I want to admit, long enough to get confused about how to set networking in Gentoo.
Gentoo stores the networking stuff in
/etc/conf.d/net. You create a startup script for each interface in
/etc/init.d/net.eth*. And then you associate it with your default run level with the command
rc-update -a net.eth1 default
.
Macromedia Flash audio to MP3
Audio, ConversionTurn amazing audio embedded in Macromedia Flash presentations into mp3s.
$ sudo emerge media-gfx/swftools
# non gentoo users:
http://www.quiss.org/swftools/$ wget http://www.hitachigst.com/hdd/research/images/pr%2 0images/Get_Perpendicular.swf
$ swfextract --mp3 Get_Perpendicular.swf
$ xmms output.mp3
Using Samba in Knoppix in 1 minute
Samba, Windows, LinuxCopying the files off a non-bootable computer, quick and dirty... Well at least there is Knoppix.
- I used Knoppix 3.4 Japanese.
- Start by using the boot menu with "knoppix 2 lang=jp" (but it still didn't set the Japanese keyboard).
- Set a password for your root.
passwd - Set a password for your root in Samba.
smbpassword - Mount the ntfs partition as read only and proper encoding:
mount -t ntfs /dev/hda2 /mnt/hda2 -oro,iocharset=utf8 - Setup the smb.conf:
mv /etc/samba/smb.conf{,.old}
cp -aL /etc/samba/smb.conf{.old,}
;; modify "invalid users = "
;; modify "user charset = utf8"
;; modify "display charset = utf8"
;; modify "dos charset = utf8"
;; add "[share1]" section
;; add the line "browsable = yes"
;; add the line "writable = no"
;; add the line "locking = yes"
;; add the line "path = /mnt/hda2"
;; add the line "public = yes"
(alternatively you may want to set these:
coding system = EUC
dos charset = CP932
unix charset = EUC-JP
display charset = EUC-JP
if mounted with iocharset=euc-jp) - Set up your IP address:
ipconfig eth0 192.168.0.49 netmask 255.255.0.0 - Fire up the Samba server:
/etc/init.d/samba restart
del.icio.us again
Web, BookmarksI tried the other "social bookmark" services like De.lirio.us, Simpy (
a list here at this convenient page), but del.icio.us just wins on easy-of-use and convenience. Plus it works with Japanese.
More tips?
- Multi-post to other services with Site Submission MultiTool.
- Sliepnir 1.66 works well with bookmarklets, so it works well with del.icio.us.
- Backup your bookmarks using this url http://del.icio.us/api/posts/all
- Use the new interface. http://del.icio.us/new/
- Customize your new interface right tags barin with tag bundles. Make a "-quick-" bundle for your -toread, daily, personal, and news topics and will always appear at the top. Group your tags by theme like "Entertainment" or "Reference", etc.
- Quick "-toread" bookmarklet.
- Make sure all the bookmarklets you use have "EncodeURIComponent" instead of "escape" so that it works with Japanese (and other languages?)