9th
DEC

"erl -man io" doesn’t work?

Posted by Keith under Erlang, Tips, Unix/Linux

While I was playing around with erlang, I found my installation of erlang’s man page does not work:

$ erl -man io
No manual entry for io

I have compiled and installed (with configure’s prefix option) in /opt/erlang on Solaris 9, put the man page files just in /opt/erlang/man.  Clearly this doesn’t work.  So I did some tracking with:

$ truss -o /tmp/output.txt erl -man io 

(truss is like strace for Solaris; "strace" on Solaris is completely different thing.)

And found that the "/man" directory should live in /opt/erlang/lib/erlang/man.

"erl -man io" works now.  It’s in MANPATH and Windex is created — so just "man io" would work just fine, but I just wanted to fix it anyway.

8th
DEC

Windows remote task list

Posted by Keith under Tips, Windows

Just a note for myself.  I had to list processes of an XP box, remotely from Vista.  This can be done by issuing following command:

tasklist.exe /s [computer name] /u [user name] /p [password]

At first try, I got an error message, “ERROR: Logon failure: unknown user name or bad password.”  I had to change network securtiy on XP machine:

Administrative Tools -> Local Security Settings -> Local Policies -> Security Options -> Network Access:Sharing and security model for local accounts”.  Set this to “Classic - local users and authenticate as themselves”.

6th
NOV

Posting source code in Wordpress

Posted by Keith under Tips

http://faq.wordpress.com/2007/09/03/how-do-i-post-source-code/

[sourcecode language=’css’]
[ sourcecode language=’css’ ] .. [ /sourcecode ]
language= cpp, csharp, css, delphi, html, java, jscript, php, python, ruby, sql, vb, xml
[/sourcecode]

2nd
SEP

Editing large text files

Posted by Keith under Tips

Ok, straight to the point: there is NO editor that can handle huge text file, size of giga bytes.  I have this SQL file, 10+ GB, and no editor can handle it.

One commercial software I found is: http://www.textmaster.ca/

It claims it can handle 300GB file.  It’s nice, but I don’t do this too often, so sorry, I don’t want to purchase one.  One easy way to go around the problem is, of course, splitting the file into multiple files and edit each, and later join the files together.

Split:
[sourcecode language=’css’]
split -b 50m example.sql example_
[/sourcecode]
Join:
[sourcecode language=’css’]
cat example_[aa-bb] > example.sql
[/sourcecode]
This will do.

2nd

Back up using DOS batch

Posted by Keith under Tips

Almost always I make backups of important files, but I still lose up-to-date files.  So automating/scheduling backup is needed.

I do:

  • Files are backed up continously using Mozy.
  • Image of C drive is created daily onto another HDD.
  • Some important files are backed up using SyncBack to another computer.
  • For MySQL, I use MySQL Administrator to schedule back up.

Fo sync back, it is easier if a directory is ZIPed up.  So here is a simple batch file:

[sourcecode language=’css’]

@echo off
REM =============
REM back up daily
REM Run by WinXP scheduler
REM =============

REM === Get current date
FOR /F “TOKENS=1* DELIMS= ” %%A IN (’DATE/T’) DO SET CDATE=%%B
FOR /F “TOKENS=1,2 eol=/ DELIMS=/ ” %%A IN (’DATE/T’) DO SET mm=%%B
FOR /F “TOKENS=1,2 DELIMS=/ eol=/” %%A IN (’echo %CDATE%’) DO SET dd=%%B
FOR /F “TOKENS=2,3 DELIMS=/ ” %%A IN (’echo %CDATE%’) DO SET yyyy=%%B
SET date=%yyyy%%mm%%dd%

REM KK-20080829: backing up Palm
zip -r “C:\BACKUP\palm\kkim_%date%.zip” “C:\Program Files\palmOne\kkim”

[/sourcecode]

I got this “date” batch script from the net.  Sorry, don’t remember where I got it.  This works very well, and kudos to who wrote it.

I have cygwin installed and c:\cygwin\bin is in my PATH, thus the ‘zip’ executable is used in the batch file.  And Windows scheduler is used here.  And, SyncBack will pick up the file and put it onto another computer.  Or, the ZIP file can be created on another HDD.