Thursday, August 30, 2012

Qt 5 is now beta

Today, Qt 5 is now beta. Qt 5 is the first version that the architecture is totally changed to modular structure.

Monday, August 27, 2012

FreeBSD Study #10

In last Frieday, FreeBSD Study #10 was held in KDDI Web Commnications' Office.

大きな地図で見る

Today's session is "Managing storage on FreeBSD (vol.2)".
  • How to test the data transfer spped of devices
    1. internal kernel
      dd if=/dev/zero of=/dev/null bs=1024x1024 count=80
    2. read only from device da2
      dd if=/dev/da2 of=/dev/null bs=1024x1024 count=80
    3. write only to device da3
      dd if=/dev/zero of=/dev/da3 bs=1024x1024 count=80
    4. read and write data from device da2 to device da3
      dd if=/dev/da2 of=/dev/da3 bs=1024x1024 count=80
  • (4) must be slower than (2) and (3)
  • limit data transfer spped is which slower one of (2) or (3)

  • iostat: statics command of device I/O
    • IOPS
    • data transfer spped
    • %busy
    • svc_t
  • gstat: statics command of GEOM I/O (iostat GEOM version)

  • The true right way to create gmirror
    1. set gm0 as the mirror of ada1
    2. copy whole ada0 to gm0
    3. set gm0 as boot disk, and reboot
    4. add ada0 to mirror member of gm0, and wait sync between ada0 and ada1
  • The way written in FreeBSD handbook is now incorrect :-)

  • New file system feature since 9.0 (1) : GPT as default
    • because MBR cannot deal partitions over 2TB
  • New file system feature since 9.0 (2) : GPT HAST
    • Highly Available Storage
    • like gmirror over the TCP/IP network
    • deals /dev/hast/XXXX block
    • setting /etc/hast.conf in each machines mirroring

  • ZFS
    • architecture of UFS : device -> volume manager -> file system
    • architecture of ZFS : devices -> ZPOOL -> DMU -> ZFS
    • Good purposes for using ZFS
      • many devices
      • dealing petabyte-class data
    • Not good purposes for using ZFS (just a sales talk :-P)
      • speed
      • robustness
      • scalability
    • ZPOOL : Give the name as one block from one or more devices
    • ZFS Data Set : Give namespaces onto the ZPOOL
    • DMU : internal kernel for manipulating dnode
    • dnode : ZPOOL version inode
      • ZFS Data Sets on ZPOOL are dealt like inode
      • Files ans directories on each ZFS Data Sets are dealt like inode
    • ZFS' I/O = copy-on-write
    • ZFS Pros.
      • transactionable
      • lock free
    • ZFS Cons.
      • heavy for dnode
      • updating cost for large size file
    • Tips
      • SHOULD USE amd64
      • set vfs.zfs.cache.size as 0
      • tune vfs.zfs.meta_limit for your machine

Friday, August 24, 2012

PC-BSD 9.1 RC1 is released

Today, PC-BSD 9.1 RC1 is released. I will try it in next week.

Tuesday, August 21, 2012

cache_page directive for ASP.NET MVC

In Ruby on Rails, we should cache the response of the page with cache_page directive on controller.
class SampleController < ApplicationController
  caches_page :home
  caches_action :home_with_filter

  def home
    ...
  end

  def home_with_filter
    ...
  end
end

I learned from the book Programming Microsoft® ASP.NET MVC, Second Edition that we should use System.Web.Mvc.OutputCacheAttribute class on each actions like below:
public class SampleController : Controller

    [OutputCache(Duration=10)]
    public ActionResult Home()
    {
        ...
    }
end

The advantage of rails way is there are two directives: cache_page and cache_action. cache_page does not execute any actions and filters, but, cache_action only executes filters while ASP.NET MVC has only OutputCache attritbute that does not execute any actions and filters too.

On the other hand, the advantage of ASP.NET MVC way is easy to define expiration seconds of caching while rails' one is more difficult.

Saturday, August 18, 2012

Agile Web Development with Rails 4th edition has been updated on recent rails version

Agile Web Development with Rails 4th edition has been updated on recent rails version from 3.2.0 to 3.2.6:

The notable point is that Rails 3.2.6 is the first version support attr_accessible setting as default.

But, The file upload way on chapter 21 is still older one. See my post : phosphorescence: Sample for uploading file in Rails3 way on AWDwR 4th chapter21.

Thursday, August 16, 2012

ASP.NET MVC 4 is also ready for VWDExpress 2010 too.

In these days, Many Microsoft products comes to RTM. These products are for Windows 8 , .NET 4.5, Visual Studio 2012 and so forth. But, ASP.NET MVC 4 is also ready for Visual Studio 2010 and VWDExpress 2010 (in other words, ASP.NET MVC 4 runs on .NET 4.0 too).


After installation, dialog contains some projects related with ASP.NET MVC 4 like below:

Friday, August 10, 2012

(Reprise) JRuby for Windows users or for Non-western languages

A few days ago, JRuby 1.7.0 preview 2 has been released. But, there are still some bugs - especially, ones related with Ruby 1.9 encodings. So that I re-post the blog article : phosphorescence: JRuby for Windows users or for Non-western languages.

Windows users

As mentioned in this article by Thomas Enebo, Windows platform becomes the first-class platform as same as Unix, Linux and Mac OS(These are de-facto platforms in OSS-develop) since JRuby 1.7.0. Ruby-lang in the JRuby goes green almost. But some gem libraries are not yet. So this article calls for gem library developers to treat Windows platform.

Non-western languages

Since version 1.9, CRuby deals String class with including its own encoding. And since JRuby 1.7.0, as mentioned in this article by Charles Nutter, JRuby also deals it in the same way. It's useful way if you are reading, speaking or writing in non-western language (for me, these are in Japanese). In the current release - JRuby 1.7.0 preview2 -, It's working good for ASCII and UTF-8 characters and encodings. But It has still a bit of bugs with non-western languages and its encodings.

So I hope, if you are in non-western language(Japanese, Chinese, Korean, Arabic, Hebrew and so on), I would like you to download JRuby 1.7.0 preview2, then try and test some Ruby snippets about String, IO, or its related classes, with your own language and its encoding.

Tuesday, August 7, 2012

Easy NuGet CDN testing if you are NOT in USA.

NuGet is the Contents Delivery Network library for .NET, like as CPAN in perl and as RubyGems in Ruby. A few days ago, NuGet Team has announced that they has wanted the people not in USA to test NuGet's CDN is robust and reliable.


The test is quite easy. Above blog post explains:
  1. Download NuGet-CDN.zip
  2. unzip it
  3. run NuGet-CDN.bat

Saturday, August 4, 2012

errors.add for ASP.NET MVC

In Ruby on Rails, we should add error information of model with errors.add method from ActiveModel::Errors class.
  errors.add(:customer, 'Invalid country.')

I learned from the book Programming Microsoft® ASP.NET MVC, Second Edition that we should add error information of model with ViewData.ModelState.AddModelError method from System.Web.Mvc.ModelStateDictionary class.
    ViewData.ModelState.AddModelError("Customer", "Invalid country.");

Thursday, August 2, 2012

SecureRandom

SecureRandom class is the facade class to issue base64, uuid and so forth.
[1] pry(main)> require 'securerandom'
=> true
[2] pry(main)> SecureRandom.hex
=> "444adf4fe82c00ab6d9a7cdffc6d46e1"
[3] pry(main)> SecureRandom.base64
=> "B4hdEsaM3icerGi2/LIEFw=="
[4] pry(main)> SecureRandom.urlsafe_base64
=> "--gOBG02VkWhimQz-6mVyA"
[5] pry(main)> SecureRandom.uuid
=> "da3488c8-0aca-45d0-bd60-d2d1a1df1a02"