2011-10-11 :-(
_ [ruby][Time.parse]ruby の Time.parse
時刻ぽい文字列じゃなくても Time.now になるのだな
irb(main):002:0> require 'time' => true irb(main):003:0> Time.parse("]") => Tue Oct 11 19:02:12 +0900 2011 irb(main):004:0> Time.parse("") => Tue Oct 11 19:02:38 +0900 2011
Ruby の Time.parse で文字列を Time に変換するときのエラーチェック
irb(main):005:0> Time.parse("",0) NoMethodError: undefined method `year' for 0:Fixnum from /usr/lib/ruby/1.8/time.rb:156:in `make_time' from /usr/lib/ruby/1.8/time.rb:243:in `parse' from (irb):5 from :0
ほう
irb(main):006:0> Time.parse("",0) rescue nil => nil
ほう
_ [NetBSD][pkgsrc][ubuntu]NetBSD のパッケージコレクション pkgsrc を NetBSD 以外のオペレーティングシステムで使ってみよう (2)
ubuntu でインストールしてみる。
% uname -a Linux ubuntu-vm 2.6.32-34-generic #77-Ubuntu SMP Tue Sep 13 19:40:53 UTC 2011 i686 GNU/Linux
Chapter 3. Using pkgsrc on systems other than NetBSD
3.3.5. Linux を見ると libncurses-dev をインストールしとけ、と書いてあるので入れておく。
% sudo aptitude install libncurses-dev
pkgsrc げっと
% env CVS_RSH=ssh cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot checkout pkgsrc % cd pkgsrc/bootstrap % ./bootstrap ERROR: Your shell's echo command is not BSD-compatible. ERROR: Please select another shell by setting the environment ERROR: variable SH.
ほげった
% echo $SH
あれ? 空っぽ?
bootstrap を読む。これか
bootstrap_sh=${SH-/bin/sh} bootstrap_sh_set=${SH+set} case "$bootstrap_sh" in /*) ;; *) echo "ERROR: The variable SH must contain an absolute path" 1>&2 exit 1 ;; esac # On some newer Ubuntu installations, /bin/sh is a symlink to /bin/dash, # whose echo(1) is not BSD-compatible. dash_echo_test=`$bootstrap_sh -c 'echo "\\100"'` if [ "$dash_echo_test" = "@" ]; then { echo "ERROR: Your shell's echo command is not BSD-compatible." echo "ERROR: Please select another shell by setting the environment" echo "ERROR: variable SH." } 1>&2 exit 1; fi
やってみる
% SH=/bin/bash ./bootstrap : =========================================================================== $NetBSD: MESSAGE,v 1.5 2009/02/02 12:34:59 joerg Exp $ You may wish to have the vulnerabilities file downloaded daily so that it remains current. This may be done by adding an appropriate entry to a user's crontab(5) entry. For example the entry # download vulnerabilities file 0 3 * * * /usr/pkg/sbin/pkg_admin fetch-pkg-vulnerabilities >/dev/null 2>&1 will update the vulnerability list every day at 3AM. You may wish to do this more often than once a day. In addition, you may wish to run the package audit from the daily security script. This may be accomplished by adding the following lines to /etc/security.local if [ -x /usr/pkg/sbin/pkg_admin ]; then /usr/pkg/sbin/pkg_admin audit fi Alternatively this can also be acomplished by adding an entry to a user's crontab(5) file. e.g.: # run audit-packages 0 3 * * * /usr/pkg/sbin/pkg_admin audit Both pkg_admin subcommands can be run as as an unprivileged user, as long as the user chosen has permission to read the pkgdb and to write the pkg-vulnerabilites to /var/db/pkg. The behavior of pkg_admin and pkg_add can be customised with pkg_install.conf. Please see pkg_install.conf(5) for details. If you want to use GPG signature verification you will need to install GnuPG and set the path for GPG appropriately in your pkg_install.conf. =========================================================================== => Registering installation for pkg_install-20110805 ===> running: /bin/sh /home/rin/work/pkgsrc/bootstrap/work/bin/install-sh -d -o root -g root /usr/pkg/etc =========================================================================== Please remember to add /usr/pkg/bin to your PATH environment variable and /usr/pkg/man to your MANPATH environment variable, if necessary. An example mk.conf file with the settings you provided to "bootstrap" has been created for you. It can be found in: /usr/pkg/etc/mk.conf You can find extensive documentation of the NetBSD Packages Collection in /home/rin/work/pkgsrc/doc/pkgsrc.txt. Hopefully everything is now complete. Thank you ===========================================================================
イケたようだ。
[ツッコミを入れる]