Unix/Linuxプログラミング理論と実践 14章 (スレッド)

スレッドプログラミング(pthread)

ProductName Unix/Linuxプログラミング理論と実践
Bruce Molay
アスキー・メディアワークス / ¥ 6,090 ()
在庫あり。

12章のwebサーバをスレッドを利用するように書き換える。

Unix/Linuxプログラミング理論と実践 13章 (ライセンスサーバ)

データグラム通信を利用したライセンスサーバを書く。

ProductName Unix/Linuxプログラミング理論と実践
Bruce Molay
アスキー・メディアワークス / ¥ 6,090 ()
在庫あり。

  • sendtoとrecvfromを使う
  • kill 0 でプロセスの存在の有無がわかる
  • Unixドメインソケットを使ったプログラミング

Unix/Linuxプログラミング理論と実践 12章 (Web server)

Cでweb serverを書く

ProductName Unix/Linuxプログラミング理論と実践
Bruce Molay
アスキー・メディアワークス / ¥ 6,090 ()
在庫あり。

GETだけをサポートした簡単なものを書いた。

週末の畑

島おくらの花

1255608518

ほうれん草と小松菜も発芽してた。

1255608525

Scalaでhttp

Souce.fromURLで

import scala.io.Source

object Main {
 def main(args : Array[String]) : Unit = {

   println(
     Source.fromURL("http://blog.kzfmix.com/","utf8")
       .getLines
       .mkString
          )
 }
}

proxyの指定は

import scala.io.Source

object Main {
 def main(args : Array[String]) : Unit = {

   System.setProperty("http.proxyHost","proxy.co.jp")
   System.setProperty("http.proxyPort","8080")

   println(
     Source.fromURL("http://blog.kzfmix.com/","utf8")
       .getLines
       .mkString
          )
 }
}

参考 - scala.io.Sourceとscala.xml.parsing.XhtmlParserCommentsAdd Star

high

小夜衣のとこの山廃

1255524739

小夜衣らしさは感じる。

小夜衣って後味ちょっと残る感じがするんだよな。

今日のキットパス

娘と熊

1255524534

ProductName キットパスきっず 12色

日本理化学工業 / ¥ 1,050 ()
在庫あり。

Unix/Linuxプログラミング理論と実践 11章 (ソケットプログラミング)

ソケット

ProductName Unix/Linuxプログラミング理論と実践
Bruce Molay
アスキー・メディアワークス / ¥ 6,090 ()
在庫あり。

socket->bind->listen->accept->read/write->close

Scalaをさわりはじめた

おもむろに。

scala> var increase = (x: Int) => x + 1     
increase: (Int) => Int = <function>
scala> val l = List(1,2,3,4,5)
l: List[Int] = List(1, 2, 3, 4, 5)
scala> l map increase
res3: List[Int] = List(2, 3, 4, 5, 6)
scala> l.map(increase)
res5: List[Int] = List(2, 3, 4, 5, 6)

map 関数 listじゃなくてlist map 関数なのね

gauche

gosh> (map (lambda (x) (+ x 1)) '(1 2 3 4 5))
(2 3 4 5 6)

clojure

user=> (map (fn [x] (+ x 1)) [1 2 3 4 5])
(2 3 4 5 6)

Unix/Linuxプログラミング理論と実践 11章 (popen)

11.4 popenを書く

pipeしてforkして親の標準入力をパイプにつないで、この標準出力をパイプにつないで、execlでsh -c commandを実行する

ProductName Unix/Linuxプログラミング理論と実践
Bruce Molay
アスキー・メディアワークス / ¥ 6,090 ()
在庫あり。

shの-cオプションはコマンドを実行して終了する。

-c string If the -c option is present, then commands are read from string.  
If there are arguments after the string, they are assigned to the positional 
parameters, starting with $0.