piyo's computer tips
2005/04/30
Wrestling with PostgreSQL 8.0, part 2
Cygwin, PostgreSQL, Windows

After 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, Cygwin

So 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.
 
2005/04/24
Subversion mode for Emacs
Subversion, Emacs

I 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
 
2005/04/22
Using NTP and SNTP at work?
NTP, timekeeping

It 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
 
2005/04/21
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
 
2005/04/10
Network configuration in Gentoo
Gentoo

I'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, Conversion

Turn 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
 
2005/04/04
Using Samba in Knoppix in 1 minute
Samba, Windows, Linux

Copying the files off a non-bootable computer, quick and dirty... Well at least there is Knoppix.

  1. I used Knoppix 3.4 Japanese.
  2. Start by using the boot menu with "knoppix 2 lang=jp" (but it still didn't set the Japanese keyboard).
  3. Set a password for your root.
    passwd
  4. Set a password for your root in Samba.
    smbpassword
  5. Mount the ntfs partition as read only and proper encoding:
    mount -t ntfs /dev/hda2 /mnt/hda2 -oro,iocharset=utf8
  6. 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)
  7. Set up your IP address:
    ipconfig eth0 192.168.0.49 netmask 255.255.0.0
  8. Fire up the Samba server:
    /etc/init.d/samba restart
 
2005/04/01
del.icio.us again
Web, Bookmarks

I 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?

 
How I keep remembering new ways of using computers. My (computer-centric) new-optimization learning blog.

Name:
Location: Kobe, Hyogo, Japan
September 2003 / October 2003 / December 2003 / March 2004 / April 2004 / May 2004 / June 2004 / July 2004 / August 2004 / September 2004 / February 2005 / March 2005 / April 2005 / May 2005 / June 2005 / July 2005 / August 2005 / September 2005 / December 2005 / January 2006 / February 2006 / March 2006 / April 2006 /


Powered by Blogger