Monday, January 30, 2012

Start reading "Refactoring: Ruby Edition"

I have started reading the Japanese edition of "Regular Expressions Cookbook".

The cover of English edition is below:

Contrary to expectations before buying it, there are plenty of sample codes to train refactoring. So that I will take a long time for finishing to read this book.

Friday, January 27, 2012

Privacy and Big Data

This book contains nothing about any programming languages, but, IMHO, this is the greatest one among no-programming-language books ever published by O'Reilly.

As title said, this book is about "Privacy and Big Data". Authors describe how different view of privacy between U.S. and Europe, and they also describe how degree our privacy is protected or violated in nowadays - in the digital age. This book shows us some sub themes how and what courts, companies and agencies have dealt with privacy or big data, with recent news keywords from all over the world:
  • Arab Spring
  • Right to be forgotten, proposed by EU
  • London Riots and censored BlackBerry
  • Demo at BART and shutting down cells

This book was published at September 2011, so that there are no mentions about SOPA and PIPA themselves. But, there are certainly mentions about MPAA, RIAA and what they want and how they want to do. If you are programmer or not, and, if your business deals big data or not, we all the people living in the digital age may read this book. And we may reconsider how and what we do for our privacy on and off the Internet.

(Here comes the new topic in phosphorescence: Consumer Privacy Bill of Rights.)

Tuesday, January 24, 2012

Install OpneJDK7 on FreeBSD

FreeBSD deals many kind of JDKs. But, at the time of writing this article, OpenJDK7 is the only one that are ready for Java7. So that I introduce the way to install OpneJDK7 on FreeBSD.

Edit /etc/make.conf for OpenJDK7

Add these definitions to /etc/make.conf:

Install via packages (mandatory)

# pkg_add -r openjdk7
That's all. Let's check the output of java -version command.

Install via ports (option)

If we want to install openjdk7 via ports, however, we must prepare for another JDK to be installed. In this article, I suggest to install openjdk7 via packages(above) at first, then install openjdk7 via ports.
# pkg_add -r openjdk7
# cd /usr/ports/java/openjdk7
# make install clean
# pkgdb -F
Let's check again java -version command.

Saturday, January 21, 2012

Rebuild Korundum and QtRuby to use Ruby 1.9

In the previous article, I introduce thee way to rebuild portupgrade to use Ruby 1.9 on PC-BSD. By the way, on PC-BSD, there are two more libraries that depend on ruby 1.8 - Korundum and QtRuby. So that I introduce the way to rebuild these to use Ruby 1.9.

Thursday, January 19, 2012

Rebuild portupgrade to use Ruby 1.9

PC-BSD installs portupgrade as default, but, it uses Ruby 1.8 - not Ruby 1.9. In this article, I introduce the way to rebuild portupgrade to use Ruby 1.9.

Before rebuilding

  1. Prepare ports on /usr/ports
  2. Install ccache to build Ruby 1.9, on /usr/ports/devel/ccache
  3. Add RUBY_DEFAULT_VER=1.9and RUBY_VER=1.9 to /etc/make.conf
  4. Deinstall Ruby 1.8 on /usr/ports/lang/ruby18
  5. Install Ruby 1.9 on /usr/ports/lang/ruby19

Rebuild portupgrade

# cd /usr/ports/ports-mgmt/portupgrade
# make deinstall
# make install clean

After rebuilding (optional)

Fix the information about ports dependencies
$ sudo pkgdb -F

Monday, January 16, 2012

Dual Boot PC-BSD 9.0 and OS X Lion on Macmini

A few days ago, both FreeBSD 9.0 and PC-BSD 9.0 are officially released, and these handbooks are also upgraded.
IMO, the best advantage of PC-BSD 9.0 compared with FreeBSD 9.0 is that the installer can make easily dual boot with FreeBSD 9.0/PC-BSD 9.0 and Mac OS X 10.5 or later on Macmini, Macbook and any Mac machines. In this article, I introduce the way I make dual boot.

Friday, January 13, 2012

mini_magick 3.4

At the end of last year, both mini_magick 3.4 and subexec 0.2.1 are released. Before this release, we had to write different codes for POSIX and for Windows as mentioned in phosphorescence: mini_magick - A better RMagick alternative. Then now, since this release, we can write the same codes both for POSIX and for Windows.
require 'mini_magick'
image ="")
image.resize "50%"
image.format :gif
image.write "localcopy.gif"

Tuesday, January 10, 2012

I've finished reading "Regular Expressions Cookbook"

I've finished reading Regular Expressions Cookbook.

  • Between Chapter 1 and Chapter 3, This book makes us learn or re-learn the basis of Regular Expression. It is useful both for newbie and for others.
  • Between Chapter 4 and Chapter 8, This book is totally "the recipe book". We should re-read each corresponding chapters whenever we need any solutions.
  • Japanese edition contains how to deal Japanese encodings and characters in Regular Expression domain. This is also useful for Programmer dealing Japanese language.

Saturday, January 7, 2012

Enable G1GC

Since Java7 update 2, Java7 becomes stable, steadily. So that now is the time to try G1GC.
> java -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC Another args...

If you want to use G1GC commonly, set these VM args to environment variable JAVA_OPTS.
JAVA_OPTS="-XX:+UnlockExperimentalVMOptions -XX:+UseG1GC"
> java $JAVA_OPTS Another args...
Another advantage to set JAVA_OPTS is that other Java programs often reads and uses this environment variable, e.g. tomcat, JRuby and so forth.