Serial programming guide for POSIX oparating systems
Serial library for C++
pySerial
pySerial download
You need those extensions when you use pySerial on your Windows machine.
pywin32
Tuesday, December 5, 2006
Sunday, November 26, 2006
Thursday, November 23, 2006
Saturday, November 18, 2006
Thursday, November 9, 2006
Thursday, November 2, 2006
Serial Communications ( Linux, Mac, Windows )
Connect two computers( Linux( Intel ) and Windows XP )
Linux Serial Console HOWTO
When you login to the linux server, you can use HyperTerminal from your PC.
Connect Mac mini and the Laptop
Interfacing a Mac Serial Port to RS-232 Lab Equipment
- Laptop (Linux)
- Windows XP machine
Linux Serial Console HOWTO
When you login to the linux server, you can use HyperTerminal from your PC.
Connect Mac mini and the Laptop
- Null Modem cable
Interfacing a Mac Serial Port to RS-232 Lab Equipment
Tuesday, October 31, 2006
Friday, October 27, 2006
Tuesday, October 24, 2006
Monday, October 23, 2006
Sunday, October 22, 2006
Hash Tables2
The solution for implementing the HashTable class
See also
p143-145, B. Kernighan, D. Ritchie, The C Programming Language Second Edition, Prentice Hall.
See also
p143-145, B. Kernighan, D. Ritchie, The C Programming Language Second Edition, Prentice Hall.
Saturday, October 21, 2006
Tuesday, October 17, 2006
SSH on DSL ( Linux )
Right click on the desktop -> Choose System ->Daemons -> ssh -> start
on the server
then
Type
from client.
on the server
then
Type
% slogin 192.168.*.*
from client.
Monday, October 16, 2006
MenuTest3 ( Python )
Messy code here.
This is my first 'class' in Python.
The output is the same as MenuTest1 + MenuTest2.
%python test3.py ( input_file ) ( output_file )
(example)
%python test3.py test.csv test.h
This is my first 'class' in Python.
The output is the same as MenuTest1 + MenuTest2.
%python test3.py ( input_file ) ( output_file )
(example)
%python test3.py test.csv test.h
%cat test3.py
#! /usr/bin/env python
import re
import os, sys
input_file = sys.argv[ 1 ]
output_file = sys.argv[ 2 ]
class MenuConverter:
def setInputFile( self, fileName ):
self.readFrom = fileName
def setOutputFile( self, fileName ):
self.writeTo = fileName
def writeStrToFile( self, str ):
output = sys.stdout
output = open( self.writeTo, 'w' )
output.write( str )
def setMenuId( self ):
buf = ""
pre = """enum MenuId {"""
post = """TOTALIDS \n};\n\n"""
file = open( self.readFrom )
text = file.read()
buf = re.sub( "[^\w]+", ",\n\tmnu", text )
buf = pre + buf[ 1: ] + post
return buf
def setExeId( self ):
pre = """enum MenuExeId\n{\n\tmnux"""
post = """};\n\n"""
buf = ""
result = []
for line in open( self.readFrom ).readlines():
line = line.replace( '"', "" ).split( "," )
result = result + line[ -1: ]
buf = ''.join( result )
buf = pre + re.sub( "\n(?=.\w)", ",\n\tmnux", buf ) + post
return buf
x = MenuConverter()
x.setInputFile( input_file )
x.setOutputFile( output_file )
x.writeStrToFile( x.setMenuId() + x.setExeId() )
Sunday, October 15, 2006
MenuTest2 ( Python )
%cat test2.py
#! /usr/bin/env python
import re
pre = """enum MenuExeId\n{\n\tmnux"""
post = """};"""
buf = ""
result = []
for line in open( 'test.csv' ).readlines():
line = line.replace( '"', "" ).split( "," )
result = result + line[ -1: ]
buf = ''.join( result )
buf = pre + re.sub( "\n(?=.\w)", ",\n\tmnux", buf ) + post
print buf
%python test2.py
enum MenuExeId
{
mnuxStart
mnuxStop
mnuxReset
mnuxCounts
mnuxStorage
mnuxSettings
mnuxGPS
mnuxAccel
mnuxFilter
};
I used string -> list -> string this time.
MenuTest1 ( Python )
This topic is for my Embedded Systems course at school.
Synopsis:
Make a test code for getting the menu names from .csv file by using Python and save them for the definitions in .h.
1. Make a list by using spreadsheets such as Excel. In this case, I used NeoOffice.
2. Export the file as .csv.
Synopsis:
Make a test code for getting the menu names from .csv file by using Python and save them for the definitions in .h.
1. Make a list by using spreadsheets such as Excel. In this case, I used NeoOffice.
2. Export the file as .csv.
%cat test.csv
"Greet","Execute","Start"
,,"Stop",
,,"Reset"
,"Status","Counts"
,,"Storage"
,,"Settings"
,,"GPS"
,,"Accel"
,"Setup","Filter"
%cat test.py
#! /usr/bin/env python
import re
file = open('test.csv')
text = file.read()
buf = ""
top = """enum MenuId {\n"""
bottom = """TOTALIDS \n};"""
buf = re.sub( "[^\w]+", ",\n\tmnu", text )
buf = top + buf[ 1: ] + bottom
print buf
%python test.py
enum MenuId {
mnuGreet,
mnuExecute,
mnuStart,
mnuStop,
mnuReset,
mnuStatus,
mnuCounts,
mnuStorage,
mnuSettings,
mnuGPS,
mnuAccel,
mnuSetup,
mnuFilter,
mnuTOTALIDS
};
Monday, October 9, 2006
Sunday, October 8, 2006
Ubiquitous?
ubiquitous computing
- the current trend of using computer technology in every aspect of our lives
Today we speak of ubiquitous computing, meaning that computer technology is everywhere and affects almost every aspect of our lives.
( p618, J. Satzinger, R. Jackson, S. Burd, SYSTEMS ANALYSIS & DESIGN, Thompson course technology )
『明らかな誤用」認定されている"ubiquitous society"という表現は『デジタル音楽の行方』に登場する
Saturday, October 7, 2006
GCC on Damn Small Linux with my old laptop ( Linux )
Damn Small Linux
cfdisk
Install
I am using a pcmcia called "IO DATA ETXPCM", but my DSL does't configure this devise.
So,
1. Check the property of this devise by using cardctl command.
2. Add below in /etc/pcmcia/config
3. Commnet out all "manfid 0x0149, 0xc1ab" in /etc/pcmcia/config
4. Reboot.
http://vine.ic.sci.yamaguchi-u.ac.jp/8/msg00361.html
5. Install GCC
5.1. right click-Apps-Tools-MyDSL Extension Browser
5.2. click System button
5.3. choose gcc1.dsl.info and click download
5.4. gcc is downloaded and installed automatically
cfdisk
Install
I am using a pcmcia called "IO DATA ETXPCM", but my DSL does't configure this devise.
So,
1. Check the property of this devise by using cardctl command.
%cardctl ident
Socket 0:
product info: "IO DATA", "ETXPCM", "3.0", "AX88190"
manfid: 0x0149, 0xc1ab
function: 6 (network)
2. Add below in /etc/pcmcia/config
card "IO DATA EXT-PCM"
version "IO DATA", "ETXPCM", "*", "AX88190"
#manfid 0x0149, 0xc1ab
bind "axnet_cs"
3. Commnet out all "manfid 0x0149, 0xc1ab" in /etc/pcmcia/config
4. Reboot.
http://vine.ic.sci.yamaguchi-u.ac.jp/8/msg00361.html
5. Install GCC
5.1. right click-Apps-Tools-MyDSL Extension Browser
5.2. click System button
5.3. choose gcc1.dsl.info and click download
5.4. gcc is downloaded and installed automatically
Tuesday, October 3, 2006
Miller's Number
The rule of 7 +- 2 (also known as Miller's Number) derives from psychology research, which shows that the number of informaiton "chunks" that a person can remember and manipulate at one time varies between five and nine. A larger number of chunks causes information overload. Information chunks can be many things, including names, words in a list, digits, or components of a picture.
( p215, J. Satzinger, R. Jackson, S. Burd, Systems Analysis & Design in a changing world, Thompson )
Monday, October 2, 2006
Thursday, September 28, 2006
Tuesday, September 26, 2006
Monday, September 25, 2006
Thursday, September 21, 2006
J2SE 5.0
BlueJ & J2SE5.0 on Mac OS X
BlueJ
1. Get Java 5.
Downoad Java 5 for Tiger from Apple. Install it in the usual way.
2. Make Java 5 the default
The Java 5 installer adds a new utility to your system, called 'Java Preferences'. It is in /Applications/Utilities/Java/J2SE 5.0/Java Preferences.
Start this utility. In the section titled Java Application Runtime Settings, drag J2SE 5.0 to the top of the list of supported versions. Save, and you're done.
BlueJ now uses Java 5. You can, of course, reverse your choice in the same way.
BlueJ
Wednesday, September 20, 2006
find, awk ( Unix )
/*to know the names of all SUID and SGID files.*/
# find / \( -prem -004000 -o -perm -002000 \) -type f -print
(p79, Simson Garfinkel & Gene Spafford, Practical Unix Secutity, O'Reilly & Associates, Inc.)
/*scan disks for unauthorized device files.*/
# find / \( -type c -o -type b \) -exec ls -l {} \;
(p83,)
/*scan for accounts on the computer without passwords*/
# awk -F: 'length($2)<1 {print $1}' < /etc/passwd (/etc/shadow, /etc/secure/passwd)
(p90,)
awk
Monday, September 18, 2006
base64 ( Python )
### test.py ####
import sys, base64
base64.decode( open( sys.argv[ 1 ], 'rb' ), open( sys.argv[ 1 ] + '.jpg', 'wb' ))
#######
in tcsh
> foreach testfile ( * )
> python test.py $testfile
> end
import sys, base64
base64.decode( open( sys.argv[ 1 ], 'rb' ), open( sys.argv[ 1 ] + '.jpg', 'wb' ))
#######
in tcsh
> foreach testfile ( * )
> python test.py $testfile
> end
csplit ( Unix )
Split the text with "/9j/4"
(p 46, UNIX IN A NUTSHELL, O'REILLY)
csplit -f chap. FILENAME '/\/9j\/4/' '{20}'
-f prefix
/expr/ create file from the current line up to the line
containing the regular expression expr.
{n} Repeat argument n times.
(p 46, UNIX IN A NUTSHELL, O'REILLY)
Saturday, September 16, 2006
base64 ( Python )
A friend emailed me. jpg hadn't been decoded.
I used this code to decode the jpg.
##
import sys, base64
base64.decode(open(sys.argv[1],'rb'),open(sys.argv[2],'wb'))
##
ASPN
------=_NextPart_000_7706_6ba_7d30
Content-Type: image/jpeg; name="image.jpg";
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="image.jpg";
/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJ
ChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/
2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgo
KCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAFQAYsDASIAAhEBAxEB/8QA
HwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUF
BAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkK
FhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1
dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXG
x8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEB
AQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAEC
AxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRom
JygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOE
hYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU
1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD0XXBmN2UA
AVzljcb5CJDiukvle5h2Kjc9eKzLPRDMZXkby44xkmvRezTPNWpRupEQkKCx
PpVZow7Dy1570+fy/LZ4pMsDjbS2Su/LcE1jayDlsKLX9zjHPsKrPp8hBLKT
6Zrciwi4eobuUovyMK5G5c25py2RzU1k6qWC4GaiCmBicVsvc+ahjZOSetZ9
..........
I used this code to decode the jpg.
##
import sys, base64
base64.decode(open(sys.argv[1],'rb'),open(sys.argv[2],'wb'))
##
ASPN
Saturday, September 9, 2006
Monday, September 4, 2006
string in Python
for line in open('test.txt').readlines(): print line
for line in open('test.txt').xreadlines():print line
for line in open('test.txt'): print line
for char in open('test.txt').read(): print char
file = open('test.txt')
while 1:
char=file.read(1)
if not char:break
print char,
(p165, Learning Python 2nd edition, O'REILLY)
v3 ( Python )
This task is best handled by two nested loops, one on lines and another on the words in each line:
for line in open(thefilepath):
for word in line.split():
dosomethingwith(word)
p72, Python Cookbook 2nd edition, O'REILLY
#################
#!/usr/bin/env python
import os, sys
input_file = sys.stdin
output_file = sys.stdout
input_file = open( sys.argv[ 1 ] )
output_file = open( sys.argv[ 2 ], 'w' )
original = input_file.read()
str1="""#ifdef DEVELP /* Borland C v3.1 version */
unsigned char VoltTable[] = { \n"""
str2="""0 };\n#endif
#ifdef EMBED /* Dunfield assembler version */
void VoltTable(void) asm { \n"""
str3=""" }
#endif\n"""
def numGet( x ):
count = 0
str = original
s = ""
if x == 2:
s += " DB "
else:
s += "\t"
for ch in str:
if ch == '\r':
count += 1
if count % 16 != 0:
s += ','
else:
if x == 1:
s += ',\n\t'
elif x == 2:
s += '\n DB '
elif ch == '\n':
s += ''
else:
s += ch
if x == 2:
return s[ :-1 ]
else:
return s
result = ""
result = str1 + numGet( 1 ) + str2 + numGet( 2 ) + str3
output_file.write(result)
input_file.close()
output_file.close()
Sunday, September 3, 2006
v2 ( Python )
#!/usr/bin/env python
import os, sys
input_file = sys.stdin
output_file = sys.stdout
output_file = open( sys.argv[ 2 ], 'w' )
input_file = open( sys.argv[ 1 ] )
original = input_file.read()
str1="""#ifdef DEVELP /* Borland C v3.1 version */
unsigned char VoltTable[] = { \n"""
str2="""0 };\n#endif
#ifdef EMBED /* Dunfield assembler version */
void VoltTable(void) asm { \n"""
str3="""}
#endif\n"""
def test( x ):
count = 0
str = original
s = ""
if x == 2:
s += " DB "
else:
s += "\t"
for line in str:
for word in line:
if word == '\r':
count += 1
if count % 16 != 0:
s += ','
else:
if x == 1:
s += ',\n\t'
elif x == 2:
s += '\n DB '
elif word == '\n':
s += ''
else:
s += word
return s
result = ""
result = str1 + test( 1 ) + str2 + test( 2 ) + str3
output_file.write(result)
input_file.close()
output_file.close()
### output ####
#ifdef DEVELP /* Borland C v3.1 version */
unsigned char VoltTable[] = {
3,6,9,12,15,18,21,23,26,29,32,34,37,40,42,45,
47,50,52,55,57,59,62,64,66,68,71,73,75,77,79,81,
83,86,88,90,91,93,95,97,99,101,103,105,106,108,110,112,
113,115,117,118,120,121,123,125,126,128,129,131,132,133,135,136,
138,139,140,142,143,144,146,147,148,149,151,152,153,154,155,157,
158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,
174,175,176,177,178,179,180,181,181,182,183,184,185,185,186,187,
188,189,189,190,191,192,192,193,194,194,195,196,196,197,198,198,
199,200,200,201,201,202,203,203,204,204,205,205,206,206,207,208,
208,209,209,210,210,211,211,212,212,212,213,213,214,214,215,215,
216,216,216,217,217,218,218,218,219,219,220,220,220,221,221,221,
222,222,222,223,223,223,224,224,224,225,225,225,226,226,226,226,
227,227,227,228,228,228,228,229,229,229,229,230,230,230,230,231,
231,231,231,232,232,232,232,233,233,233,233,233,234,234,234,234,
234,235,235,235,235,235,235,236,236,236,236,236,236,237,237,237,
237,237,237,238,238,238,238,238,238,238,239,239,239,239,239,0 };
#endif
#ifdef EMBED /* Dunfield assembler version */
void VoltTable(void) asm {
DB 3,6,9,12,15,18,21,23,26,29,32,34,37,40,42,45
DB 47,50,52,55,57,59,62,64,66,68,71,73,75,77,79,81
DB 83,86,88,90,91,93,95,97,99,101,103,105,106,108,110,112
DB 113,115,117,118,120,121,123,125,126,128,129,131,132,133,135,136
DB 138,139,140,142,143,144,146,147,148,149,151,152,153,154,155,157
DB 158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173
DB 174,175,176,177,178,179,180,181,181,182,183,184,185,185,186,187
DB 188,189,189,190,191,192,192,193,194,194,195,196,196,197,198,198
DB 199,200,200,201,201,202,203,203,204,204,205,205,206,206,207,208
DB 208,209,209,210,210,211,211,212,212,212,213,213,214,214,215,215
DB 216,216,216,217,217,218,218,218,219,219,220,220,220,221,221,221
DB 222,222,222,223,223,223,224,224,224,225,225,225,226,226,226,226
DB 227,227,227,228,228,228,228,229,229,229,229,230,230,230,230,231
DB 231,231,231,232,232,232,232,233,233,233,233,233,234,234,234,234
DB 234,235,235,235,235,235,235,236,236,236,236,236,236,237,237,237
DB 237,237,237,238,238,238,238,238,238,238,239,239,239,239,239,}
#endif
Thursday, August 31, 2006
Python
Convert .csv file to .c in a certain format
$ python this.py RESOURCE.CVS DESTINATION.c
#!/usr/bin/python
import os, sys
input_file = sys.stdin
output_file = sys.stdout
input_file = open( sys.argv[ 1 ] )
output_file = open( sys.argv[ 2 ], 'w' )
str1="""#ifdef EMBED
code //Needs to be placed in code memory for 2051
#endif
unsigned char VoltTable[] = {\n """
str2=""" 0 };\n"""
line = input_file.read().split('\r\n')
line = ','.join(line)
output_file.write(str1)
output_file.write(line)
output_file.write(str2)
input_file.close()
output_file.close()
Output
#ifdef EMBED
code //Needs to be placed in code memory for 2051
#endif
unsigned char VoltTable[] = {
3,6,9,12,15,18,21,23,26,29,32,34,37,40,42,45,47,50,52,55,57,59,62,64,
66,68,71,73,75,77,79,81,83,86,88,90,91,93,95,97,99,101,103,105,106,
108,110,112,113,115,117,118,120,121,123,125,126,128,129,131,132,
133,135,136,138,139,140,142,143,144,146,147,148,149,151,152,153,
154,155,157,158,159,160,161,162,163,164,165,166,167,168,169,170,
171,172,173,174,175,176,177,178,179,180,181,181,182,183,184,185,
185,186,187,188,189,189,190,191,192,192,193,194,194,195,196,196,
197,198,198,199,200,200,201,201,202,203,203,204,204,205,205,206,
206,207,208,208,209,209,210,210,211,211,212,212,212,213,213,214,
214,215,215,216,216,216,217,217,218,218,218,219,219,220,220,220,
221,221,221,222,222,222,223,223,223,224,224,224,225,225,225,226,
226,226,226,227,227,227,228,228,228,228,229,229,229,229,230,230,
230,230,231,231,231,231,232,232,232,232,233,233,233,233,233,234,
234,234,234,234,235,235,235,235,235,235,236,236,236,236,236,236,
237,237,237,237,237,237,238,238,238,238,238,238,238,239,239,239,
239,239, 0 };
$ python this.py RESOURCE.CVS DESTINATION.c
#!/usr/bin/python
import os, sys
input_file = sys.stdin
output_file = sys.stdout
input_file = open( sys.argv[ 1 ] )
output_file = open( sys.argv[ 2 ], 'w' )
str1="""#ifdef EMBED
code //Needs to be placed in code memory for 2051
#endif
unsigned char VoltTable[] = {\n """
str2=""" 0 };\n"""
line = input_file.read().split('\r\n')
line = ','.join(line)
output_file.write(str1)
output_file.write(line)
output_file.write(str2)
input_file.close()
output_file.close()
Output
#ifdef EMBED
code //Needs to be placed in code memory for 2051
#endif
unsigned char VoltTable[] = {
3,6,9,12,15,18,21,23,26,29,32,34,37,40,42,45,47,50,52,55,57,59,62,64,
66,68,71,73,75,77,79,81,83,86,88,90,91,93,95,97,99,101,103,105,106,
108,110,112,113,115,117,118,120,121,123,125,126,128,129,131,132,
133,135,136,138,139,140,142,143,144,146,147,148,149,151,152,153,
154,155,157,158,159,160,161,162,163,164,165,166,167,168,169,170,
171,172,173,174,175,176,177,178,179,180,181,181,182,183,184,185,
185,186,187,188,189,189,190,191,192,192,193,194,194,195,196,196,
197,198,198,199,200,200,201,201,202,203,203,204,204,205,205,206,
206,207,208,208,209,209,210,210,211,211,212,212,212,213,213,214,
214,215,215,216,216,216,217,217,218,218,218,219,219,220,220,220,
221,221,221,222,222,222,223,223,223,224,224,224,225,225,225,226,
226,226,226,227,227,227,228,228,228,228,229,229,229,229,230,230,
230,230,231,231,231,231,232,232,232,232,233,233,233,233,233,234,
234,234,234,234,235,235,235,235,235,235,236,236,236,236,236,236,
237,237,237,237,237,237,238,238,238,238,238,238,238,239,239,239,
239,239, 0 };
Wednesday, August 23, 2006
itoa ( C )
void itoa( int n, char s[] )
{
int i, sign;
if ( ( sign = n ) < 0 )
n = -n;
i = 0;
do {
s[ i++ ] = n % 10 + '0';
} while ( n /= 10 ) > 0 );
if ( sign < 0 )
s[ i++ ] = '-';
s[ i ] = '\0';
reverse( s );
}
// P64, B. Kernighan, D. Ritchie, THE C PROGRAMMING LANGUAGE 2nd edition, Prentice Hall
reverse.c
Tuesday, July 4, 2006
Sunday, June 25, 2006
Friday, June 23, 2006
Friday, June 16, 2006
Monday, June 12, 2006
C++
First, I've put in enough pitfalls to make sure that only the most trivial projects will work first time. Take operator overloading. At the end of the project, almost every module has it, usually, because guys feel they really should do it, as it was in their training course. The same operator then means something totally different in every module. Try pulling that lot together, when you have a hundred or so modules. And as for data hiding. God, I sometimes can't help laughing when I hear about the problems companies have making their modules talk to each other. I think the word 'synergistic' was specially invented to twist the knife in a project manager's ribs.
最初に私は、小さなプロジェクトだけが動くような落とし穴を充分こしらえました。 オペレータオーバロードを例に取りましょう。 プロジェクトの終わりには、殆どのモジュールが使っているでしょう。 人々はたいてい、オペレータオーバロードを使うべきだと感じてるからです。 彼らが受けたトレーニングコースの例のようにね。 そうすると、同じオペレータなのに、違うモジュールでは全く異なる意味になります。 モジュールが100やそこらあるときに、全てを一つにまとめられますか。 データ隠蔽だってそうです。 あちこちの会社で、人々が彼らのモジュールをお互いにコミュニケートさせるときの問題を聞くと、私は笑いをこらえることができません。
「シナジェスティック」という言葉は、プロジェクトマネージャのあばら骨に刺さったナイフをひねるために特別に生まれた言葉です。
Bjarne Stroustrup Interview about C++より
Friday, June 9, 2006
Thursday, June 1, 2006
Friday, May 19, 2006
Saturday, April 29, 2006
DSL ( Linux )
Monkey and PHP on Damn Small Linux
GCC is not included in Damn Small Linux. You need it for compiling, "make" etc.
Install GCC
1. right click-Apps-Tools-MyDSL Extension Browser
2. click System button
3. choose gcc1.dsl.info and click download
4. gcc is downloaded and installed automatically
Enable apt-get
1. >sudo dpkg-restore
2. apt is enabled
Install re2c, bison, flex, libxml2
1. >apt-get install re2c
2. >apt-get install bison
3. >apt-get install flex
4. >apt-get install libxml2-dev
5. >apt-get install libxml2-util
-These are essential for installing PHP which I couldn't get.
Install PHP
1. download
2. >tar zxfv php-5.x.x.tar.gz
3. >cd php-5.x.x
4. >./configure --prefix=/home/my_home/php/
Failed.
Python and Apache on Damn Small Linux
Install python
1. >apt-get python
2. python is enabled
Install Apache
1. >wget http://apache.mirror99.com/httpd/httpd-2.2.0.tar.gz
2. >gunzip < httpd-2.2.0.tar.gz | tar xvf -
3. >cd httpd-2.2.0
4. >./configure -prefix=/usr/local/apache2 -enable-rewrite -enable-mods-shared=most
5. >make
6. >make install
http://blog.novembercamel.com/index.php?paged=2
http://www.troubleshooters.com/linux/distros/dsl/
http://www.damnsmalllinux.org/wiki/index.php/Main_Page
http://monkeyd.sourceforge.net/docs/monkey+php.en.html
http://www.linuxquestions.org/questions/showthread.php?t=247329
GCC is not included in Damn Small Linux. You need it for compiling, "make" etc.
Install GCC
1. right click-Apps-Tools-MyDSL Extension Browser
2. click System button
3. choose gcc1.dsl.info and click download
4. gcc is downloaded and installed automatically
Enable apt-get
1. >sudo dpkg-restore
2. apt is enabled
Install re2c, bison, flex, libxml2
1. >apt-get install re2c
2. >apt-get install bison
3. >apt-get install flex
4. >apt-get install libxml2-dev
5. >apt-get install libxml2-util
-These are essential for installing PHP which I couldn't get.
Install PHP
1. download
2. >tar zxfv php-5.x.x.tar.gz
3. >cd php-5.x.x
4. >./configure --prefix=/home/my_home/php/
Failed.
Python and Apache on Damn Small Linux
Install python
1. >apt-get python
2. python is enabled
Install Apache
1. >wget http://apache.mirror99.com/httpd/httpd-2.2.0.tar.gz
2. >gunzip < httpd-2.2.0.tar.gz | tar xvf -
3. >cd httpd-2.2.0
4. >./configure -prefix=/usr/local/apache2 -enable-rewrite -enable-mods-shared=most
5. >make
6. >make install
http://blog.novembercamel.com/index.php?paged=2
http://www.troubleshooters.com/linux/distros/dsl/
http://www.damnsmalllinux.org/wiki/index.php/Main_Page
http://monkeyd.sourceforge.net/docs/monkey+php.en.html
http://www.linuxquestions.org/questions/showthread.php?t=247329
Thursday, April 27, 2006
Wednesday, April 19, 2006
First they came...
Original
Als die Nazis die Kommunisten holten,
habe ich geschwiegen;
ich war ja kein Kommunist.
Als sie die Sozialdemokraten einsperrten,
habe ich geschwiegen;
ich war ja kein Sozialdemokrat.
Als sie die Gewerkschafter holten,
habe ich nicht protestiert;
ich war ja kein Gewerkschafter.
Als sie die Juden holten,
habe ich nicht protestiert;
ich war ja kein Jude.
Als sie mich holten,
gab es keinen mehr, der protestieren konnte.Translation
When they came for the communists,
I remained silent;
I was not a communist.
When they locked up the social democrats,
I remained silent;
I was not a social democrat.
When they came for the trade unionists,
I did not speak out;
I was not a trade unionist.
When they came for the Jews,
I did not speak out;
I was not a Jew.
When they came for me,
there was no one left to speak out.
Niemöller, M. (1946). WIKIPEDIA. Retrieved April 19, 2006, from: http://en.wikipedia.org/wiki/First_they_came...Martin Niemöller
Monday, April 10, 2006
Web server on Mac OS X
1 Mac OS X - System Preferences -> Sharing -> Service -> Personal web sharing
2 $ htpasswd -c /Users/USER NAME/webpasswords INITIAL USERNAME
( ex. $ htpasswd -c /Users/nikki/webpasswords nikki)
3 htpasswd -b /Users/USER NAME/webpasswords INITIAL USERNAME PASSWORD
4 in /etc/httpd/users/username.conf
<Directory "/Users/jray/Sites/">
AuthType Basic
AuthName "John's Development Site"
AuthUserFile /Users/jray/webpasswords
Require valid-user
Options Indexes MultiViews ExecCGI
AllowOverride None
Order allow,deny
Allow from all
<Directory>
5 $ sudo /usr/sbin/apachectl restart
Mac OS X Tiger unleashed, SAMS P.1174
2 $ htpasswd -c /Users/USER NAME/webpasswords INITIAL USERNAME
( ex. $ htpasswd -c /Users/nikki/webpasswords nikki)
3 htpasswd -b /Users/USER NAME/webpasswords INITIAL USERNAME PASSWORD
4 in /etc/httpd/users/username.conf
<Directory "/Users/jray/Sites/">
AuthType Basic
AuthName "John's Development Site"
AuthUserFile /Users/jray/webpasswords
Require valid-user
Options Indexes MultiViews ExecCGI
AllowOverride None
Order allow,deny
Allow from all
<Directory>
5 $ sudo /usr/sbin/apachectl restart
Mac OS X Tiger unleashed, SAMS P.1174
Wednesday, April 5, 2006
Isaac Newton
If I have ever made any valuable discoveries, it has been owing more to patient attention, than to any other talent.
( http://www.quotedb.com/quotes/3623 )
Bertrand Russell
When you meet with opposition, even if it should be from your partner or your children, endeavour to overcome it by argument and not by authority, for a victory dependent upon authority is unreal and illusory.
( http://www.lewrockwell.com/wall/wall12.html )
Thursday, March 30, 2006
E.W.Dijkstra
It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.
The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence.
In the good old days physicists repeated each other's experiments, just to be sure. Today they stick to FORTRAN, so that they can share each other's programs, bugs included.
Edsger W. Dijkstra,
http://www.cs.utexas.edu/~EWD/
http://www.cs.utexas.edu/users/EWD/transcriptions/EWD04xx/EWD498.html
http://de.wikipedia.org/wiki/Edsger_Wybe_Dijkstra
Wednesday, March 29, 2006
Tuesday, March 21, 2006
X on Mac OS X
Wednesday, March 1, 2006
PIL ( Python Imaging Library)
Python Imaging Library
The Python Imaging Library (PIL) adds image processing capabilities to your Python interpreter. This library supports many file formats, and provides powerful image processing and graphics capabilities.(http://www.pythonware.com/products/pil/index.htm)
Saturday, February 25, 2006
commentをゲットせよ
えーpythonで、フォルダ下のファイル名と各作成日を表示させるスクリプトを試しに書いたんですが、
どーしてもコメントを得る方法がわかりません。
import os
import time
def dump(st):
size, ctime , atime, mode, ino, dev, nlink, uid, gid, mtime = st
return size, time.ctime(ctime)
#input the directory here
directory = "/XXX/"
for file_1 in os.listdir(directory):
file = directory + file_1
st = os.stat(file)
#display the results
print file_1, str(dump(st))
上のコードで、os.statで得られる情報は、作成日などに限られます。
で今回ほしいコメントは、例えば、windowsでjpgファイルを
右クリック ー property ー summary tab - comment で得られるコメントになります。
つまり、各ファイルにコメントがついた写真満載のフォルダを整理するための、リスト作りのために書いてみたものなんですけど。
でpython libraryとか調べたけどお手上げですので誰か教えてくださる方、教えて君で申し訳ないですけど教えていただけたら大変うれしいです。
おそらくダータベース絡みのアプリケーションだとこんなの簡単にできる機能がついてるんだろうけど。
どーしてもコメントを得る方法がわかりません。
import os
import time
def dump(st):
size, ctime , atime, mode, ino, dev, nlink, uid, gid, mtime = st
return size, time.ctime(ctime)
#input the directory here
directory = "/XXX/"
for file_1 in os.listdir(directory):
file = directory + file_1
st = os.stat(file)
#display the results
print file_1, str(dump(st))
上のコードで、os.statで得られる情報は、作成日などに限られます。
で今回ほしいコメントは、例えば、windowsでjpgファイルを
右クリック ー property ー summary tab - comment で得られるコメントになります。
つまり、各ファイルにコメントがついた写真満載のフォルダを整理するための、リスト作りのために書いてみたものなんですけど。
でpython libraryとか調べたけどお手上げですので誰か教えてくださる方、教えて君で申し訳ないですけど教えていただけたら大変うれしいです。
おそらくダータベース絡みのアプリケーションだとこんなの簡単にできる機能がついてるんだろうけど。
Wednesday, February 1, 2006
ちっさいLinux
50MサイズのLiveCDLinux-Damn Small Linux(http://www.damnsmalllinux.org/)。
起動時にinstallと入れればHDにもインストール可。
起動時にinstallと入れればHDにもインストール可。
Tuesday, January 31, 2006
OpenBSDをQにインストール
OpenBSDのブートCDを作りエミュレータQ上にインストール後、パッケージをFTPを通してインストールする。
1 http://www.openbsd.org/faq/faq4.htmlを参考に好きなファイルをダウンロードする。
ここでは、ブートCDを作るので、cdemu38.iso(cd38.isoでは動作しなかった)をダウンロードする。好きなミラーサイトをhttp://www.openbsd.org/ftp.html#ftp のリストより選ぶ。選んだFTPサイトからファイルを選択。
例:3.8 - i386 - cdemu38.iso
2 ダウンロードしたファイルをcdに焼く。
3 Qを起動し、ウィンドウ上部のcreate new PC をクリック。
4 内容を設定。ブートはCDにしておく。http://www.kberg.ch/q/documentation/index.htmlを参考。
5 cdemu38.isoのはいったCDを入れ、Q上で作ったpropertyを起動させると、CDを読み込みインストールへと移行。
6 インストールはhttp://www.openbsd.org/faq/faq4.html#Install以降の長い手順をそのまま踏む。
やった方法がたまたまこれだっただけで、もっと違う楽な方法もあると思う。
1 http://www.openbsd.org/faq/faq4.htmlを参考に好きなファイルをダウンロードする。
ここでは、ブートCDを作るので、cdemu38.iso(cd38.isoでは動作しなかった)をダウンロードする。好きなミラーサイトをhttp://www.openbsd.org/ftp.html#ftp のリストより選ぶ。選んだFTPサイトからファイルを選択。
例:3.8 - i386 - cdemu38.iso
2 ダウンロードしたファイルをcdに焼く。
3 Qを起動し、ウィンドウ上部のcreate new PC をクリック。
4 内容を設定。ブートはCDにしておく。http://www.kberg.ch/q/documentation/index.htmlを参考。
5 cdemu38.isoのはいったCDを入れ、Q上で作ったpropertyを起動させると、CDを読み込みインストールへと移行。
6 インストールはhttp://www.openbsd.org/faq/faq4.html#Install以降の長い手順をそのまま踏む。
やった方法がたまたまこれだっただけで、もっと違う楽な方法もあると思う。
Monday, January 30, 2006
ブンガク
1月10日に、
訳というのはつまらない、といったようなことを書いた。
そこでの趣旨は、訳したあとの文というものは、原文の持つ味が抜けてしまうというところにあって、文体そのものの持つ力よりも、その文もしくは作品自体に力があれば訳したものでもかまわない。
個人的に、文体に力を入れた作家中上健次のファンであるので、彼の作品の魅力、言の葉、の力を訳すのは無理だろうなあ、と思ったのがそもそもの発端であって、いろんな優れた作家がどんどん訳されて評価されるのはいいことだと思う。
ただ日本の文学(昔のね)、というのはしっかりとしたストーリーラインがあって、読者を引き付け最後まで離さない、というより、微妙な味わい、機微雰囲気、といったところに重点が置かれている作品が多いかのように思える。読んだ限りではの話。
ここに日本の文学の強みであり、弱点がある。
すなわち坂口安吾が「戯作者論」(だったかな)で語った
「すべて何となく、雰囲気でわかったようなわかってないような気分になって結局は ’曰く言い難し’ で終わる」
彼は続けて
「センセイ方は面白くないのが文学だと勘違いしているのではないか。面白く書くのが当たり前だ。」
そんな彼は面白くないものもたくさん書いたが、落語を彷彿とさせるテンポのいい面白いものも書いた。
ペーパーバックではでてないけど。
訳、で危険なところは、作者の意図したところと、訳者とのそれが違ってしまう可能性もあるところではないか。
小林秀雄はランボーを訳したが、いろいろ間違いもあったようで。それを補って有り余る功績を残したんですけど。フランス語なんて読めないしな。あと堀内大学って人もいたな。
で結局なにが言いたかったかというと、うーん本はおもしろければなんだっていいんじゃない?ってことかな。
訳というのはつまらない、といったようなことを書いた。
そこでの趣旨は、訳したあとの文というものは、原文の持つ味が抜けてしまうというところにあって、文体そのものの持つ力よりも、その文もしくは作品自体に力があれば訳したものでもかまわない。
個人的に、文体に力を入れた作家中上健次のファンであるので、彼の作品の魅力、言の葉、の力を訳すのは無理だろうなあ、と思ったのがそもそもの発端であって、いろんな優れた作家がどんどん訳されて評価されるのはいいことだと思う。
ただ日本の文学(昔のね)、というのはしっかりとしたストーリーラインがあって、読者を引き付け最後まで離さない、というより、微妙な味わい、機微雰囲気、といったところに重点が置かれている作品が多いかのように思える。読んだ限りではの話。
ここに日本の文学の強みであり、弱点がある。
すなわち坂口安吾が「戯作者論」(だったかな)で語った
「すべて何となく、雰囲気でわかったようなわかってないような気分になって結局は ’曰く言い難し’ で終わる」
彼は続けて
「センセイ方は面白くないのが文学だと勘違いしているのではないか。面白く書くのが当たり前だ。」
そんな彼は面白くないものもたくさん書いたが、落語を彷彿とさせるテンポのいい面白いものも書いた。
ペーパーバックではでてないけど。
訳、で危険なところは、作者の意図したところと、訳者とのそれが違ってしまう可能性もあるところではないか。
小林秀雄はランボーを訳したが、いろいろ間違いもあったようで。それを補って有り余る功績を残したんですけど。フランス語なんて読めないしな。あと堀内大学って人もいたな。
で結局なにが言いたかったかというと、うーん本はおもしろければなんだっていいんじゃない?ってことかな。
Sunday, January 29, 2006
Q(マック用エミュレータ)
エミュレータとは、OS上で仮想CPUを再現するソフトウェア(でいいのか?)。
Qのほかqemuなどがある。
今回は、マックの上で、WindowsやLinuxなどを同時に動かしてみようということ。
マック上で動くフリーのエミュレータQをインストールする。
1 サイト http://www.kberg.ch/q/
2 Qをダウンロードする。(Latest Stable Build. QBuild) http://www.kberg.ch/q/index.php?sid=64621&c=23&p=23
3 インストール。すなわち、
ダウンロード後現れるウィンドウ内のQのロゴを、ApplicationsFolder にドラッグ安堵ドロップ。
ウィンドウが表示されない場合は, http://www.kberg.ch/q/documentation/index.html を参考。
4 使用時は、Applications Folder内のQをクリック、起動。
5 好みのOSをインストールする。
エミュレータ上ではx86でもPowerPcでも選択可能。
Qのほかqemuなどがある。
今回は、マックの上で、WindowsやLinuxなどを同時に動かしてみようということ。
マック上で動くフリーのエミュレータQをインストールする。
1 サイト http://www.kberg.ch/q/
2 Qをダウンロードする。(Latest Stable Build. QBuild) http://www.kberg.ch/q/index.php?sid=64621&c=23&p=23
3 インストール。すなわち、
ダウンロード後現れるウィンドウ内のQのロゴを、ApplicationsFolder にドラッグ安堵ドロップ。
ウィンドウが表示されない場合は, http://www.kberg.ch/q/documentation/index.html を参考。
4 使用時は、Applications Folder内のQをクリック、起動。
5 好みのOSをインストールする。
エミュレータ上ではx86でもPowerPcでも選択可能。
Thursday, January 26, 2006
Tuesday, January 24, 2006
Thursday, January 19, 2006
Wednesday, January 18, 2006
linux(PowerPC)
日経リナックス1月号に、mac miniとDebianのdual bootの仕方が載っていたのでインストール。
別に入れなくてもいいけど、面白そうだったので入れた。
ベースの部分はインストールできたけど、パッケージがうまくいかず、調べながら手動で何個かインストール。
GUIの部分がうまくいかなかったので、別にXを入れた。
ブラウザがLynxしかなかったので、mozillaをダウンロードしたが、インストールできない。
Xの画面も必要以上にでかく、モニターをはみ出してしまう。
ここまで半日がつぶれました。疲れた。
ところで日本の本屋さんはDebianとFedora Coreでいっぱいだったけど、日本語がそろってるのかな。
別に入れなくてもいいけど、面白そうだったので入れた。
ベースの部分はインストールできたけど、パッケージがうまくいかず、調べながら手動で何個かインストール。
GUIの部分がうまくいかなかったので、別にXを入れた。
ブラウザがLynxしかなかったので、mozillaをダウンロードしたが、インストールできない。
Xの画面も必要以上にでかく、モニターをはみ出してしまう。
ここまで半日がつぶれました。疲れた。
ところで日本の本屋さんはDebianとFedora Coreでいっぱいだったけど、日本語がそろってるのかな。
Sunday, January 15, 2006
一才を迎え
息子が1才に。
最近はほぼ紙おむつを使ってます。
その理由は。
1 日本帰国中に使っていた。あまりに寒いので、布だと乾かないし大変なので。
2 おむつ交換の頻度が一日2、3度に減った。紙でいいかな。
3 一番の理由。布おむつがひどく臭う。食べるものが変わってきたためか、強烈な臭さに天を仰いでしまう。
でも安物ではだめなのか、おしっこを吸収したあと、化合物みたいなものがおむつからにじみだして来るんだけど。
最近はほぼ紙おむつを使ってます。
その理由は。
1 日本帰国中に使っていた。あまりに寒いので、布だと乾かないし大変なので。
2 おむつ交換の頻度が一日2、3度に減った。紙でいいかな。
3 一番の理由。布おむつがひどく臭う。食べるものが変わってきたためか、強烈な臭さに天を仰いでしまう。
でも安物ではだめなのか、おしっこを吸収したあと、化合物みたいなものがおむつからにじみだして来るんだけど。
Wednesday, January 11, 2006
眠れない夜に
子供が夜中に起き、そのまま自分が眠れなくなってしまい、布団に横になっていると
やけに過去のことが思い出されてしまい、余計に眠れなくなってしまった。
今回帰国して思ったのは、だんだん会いたい人に会えなくなっていってるってこと。
ひとりではないので、自由にうごくこともできず、友人とも疎遠になりがち。
特に、旅先で知り合った人というのは、独り身であるとかに関わらずずんずんと縁が薄くなっている。
日本全国に散らばっているので一度に会えるはずもなく。
で、井伏鱒二を思い出した。
唐(618-907)の于武陵の五言絶句「勧酒」
勧君金屈卮
満酌不須辞
花発多風雨
人生足別離
を彼はこう訳した。
この杯を受けてくれ
どうぞなみなみ注がしておくれ
花に嵐のたとえもあるぞ
さよならだけが人生だ
ところで、漢詩を日本語訳したもの、は高校時代からその響きが好きだったが、酔いどれ詩人のこの詩がすばらしい。
《山中与幽人对酌》李白
两人对酌山花开
一杯一杯复一杯
我醉欲眠君且去
明朝有意抱琴来
両人対酌すれば 山花開く
一杯 一杯 また一杯
我酔うて眠らんと欲す 卿はしばらく去れ
明朝意あらば 琴を抱いて来れ
一度李白を読み込んでみたいが、書店で売っている本は、たとえば岩波など、唐詩選であって、李白個人のものはないようだ。
また、漢詩を読むなら、日本語訳とともに、中国語読みができるようピンイン(よみがなみたいなもの)が記されたものが望ましいが、なかなか見つからない。
ピンインは調べるのが大変だし、また現代語とは読みが違ってくる。
漢詩の日本語訳で高校時代に教師が言ったことをまだ覚えている。
孔子の
有朋自远方来不亦乐乎
訳は、
ともあり、えんぽうよりきたる、またたのしからずや。
と
とも、えんぽうよりきたるあり、またたのしからずや。
の二つがあると。
で中国に留学したときに習ったニュアンスでは、
あるともだちが遠くから来たんよ、たのしいなあ。
みたいな感じであった気がする。
訳というのは、やっぱり訳なんだなあと思った次第。
つまり、訳した後はまるで、
噛んで噛んでまるで味のしなくなったするめみたいに味がごっそり抜け落ちてしまう、と思う。
だから、ドストエフスキーなんかもただのしゃべり過ぎにしか思えなくなってしまう。
まあとにかく、漢詩は落語の次に面白そうだ。
やけに過去のことが思い出されてしまい、余計に眠れなくなってしまった。
今回帰国して思ったのは、だんだん会いたい人に会えなくなっていってるってこと。
ひとりではないので、自由にうごくこともできず、友人とも疎遠になりがち。
特に、旅先で知り合った人というのは、独り身であるとかに関わらずずんずんと縁が薄くなっている。
日本全国に散らばっているので一度に会えるはずもなく。
で、井伏鱒二を思い出した。
唐(618-907)の于武陵の五言絶句「勧酒」
勧君金屈卮
満酌不須辞
花発多風雨
人生足別離
を彼はこう訳した。
この杯を受けてくれ
どうぞなみなみ注がしておくれ
花に嵐のたとえもあるぞ
さよならだけが人生だ
ところで、漢詩を日本語訳したもの、は高校時代からその響きが好きだったが、酔いどれ詩人のこの詩がすばらしい。
《山中与幽人对酌》李白
两人对酌山花开
一杯一杯复一杯
我醉欲眠君且去
明朝有意抱琴来
両人対酌すれば 山花開く
一杯 一杯 また一杯
我酔うて眠らんと欲す 卿はしばらく去れ
明朝意あらば 琴を抱いて来れ
一度李白を読み込んでみたいが、書店で売っている本は、たとえば岩波など、唐詩選であって、李白個人のものはないようだ。
また、漢詩を読むなら、日本語訳とともに、中国語読みができるようピンイン(よみがなみたいなもの)が記されたものが望ましいが、なかなか見つからない。
ピンインは調べるのが大変だし、また現代語とは読みが違ってくる。
漢詩の日本語訳で高校時代に教師が言ったことをまだ覚えている。
孔子の
有朋自远方来不亦乐乎
訳は、
ともあり、えんぽうよりきたる、またたのしからずや。
と
とも、えんぽうよりきたるあり、またたのしからずや。
の二つがあると。
で中国に留学したときに習ったニュアンスでは、
あるともだちが遠くから来たんよ、たのしいなあ。
みたいな感じであった気がする。
訳というのは、やっぱり訳なんだなあと思った次第。
つまり、訳した後はまるで、
噛んで噛んでまるで味のしなくなったするめみたいに味がごっそり抜け落ちてしまう、と思う。
だから、ドストエフスキーなんかもただのしゃべり過ぎにしか思えなくなってしまう。
まあとにかく、漢詩は落語の次に面白そうだ。
Monday, January 9, 2006
Friday, January 6, 2006
Subscribe to:
Posts (Atom)