Search
Archive
Categories
Ad

Archive for August, 2009

Clear ques of Postfix

Friday, August 28th, 2009

Problem

You want to delete all the messages in sending ques of Postfix.

Solution

$ sudo postsuper -d ALL

Showing Japanese Texts in Vertial Orientation(縦書き) in Flash Player 10

Monday, August 17th, 2009

Problem

You want to show texts in a vertical orientation on Flash Player 10.

Solution

From Flash Player 10, you can use Flash Text Engine(aka, FTE), included in flash.text.engine.*. To show (and edit) text contents in Flash, you can do much much more than good and old TextField class.

“vertical orientation” is one of the great features FTE offers to us. I made a easy-to-use wrapper class for this feature. Check the code below.

And, here is a sample usage of “VText” class.

package 
{
	import com.hoora.view.VText;
	import flash.events.Event;
	import flash.display.MovieClip;
 
	public class Main extends MovieClip {
		public function Main() {
			addChild(new VText("Hello, 日本語!English words are shown like this. 日本語は縦書きに表示されます。", 80, 180, 0x005596));
		}
 
	}
}

And the result is,

Click on the image to play the SWF. Note that you need to have flash player 10 installed on your machine to see the swf.

Install locate and updatedb on CentOS and Debian

Saturday, August 15th, 2009

Problem

‘locate’ and ‘updatedb’ commands are the best commands to search files on Linux. However, you dont have them installed on your Linux.

Solution

Use these commands. On Debian,

sudo apt-get install locate

, and on CentOS,

sudo yum install mlocate

root_url undefined

Friday, August 7th, 2009

Problem

On Ruby on Rails, you see the NameError of “undefined local variable or method `root_url’ for #<YourController>”.

Solution

You need to set map.root in config/routes.rb, such as

  mpa.root :controller => :welcome

Stop installing rubygems to your home directory when you don’t “sudo”

Thursday, August 6th, 2009

Problem

You don’t want to install rubygems under your home direcotry(~/.gem/ruby/1.x/) when you just forgot to “sudo” and don’t have right permissions to write to system directories.

Solution

First, You need to install rubygems newer than 1.3.2. To check the version, type as

gem -v
1.3.1

To update your gems itself, type as

sudo gem update --system

Next, you need to edit your ~/.gemrc file. Add

gem:  --no-user-install

at the bottom of the file.

Now, if you forgot to “sudo” when installing new rubygems, gem will simply fail with permission erros, like

tomoya@hongkong% gem install sequel
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /opt/local/lib/ruby/gems/1.8 directory.

No response of Sudo on Fedora 11

Tuesday, August 4th, 2009

Problem

On Fedora11 installed via Vmware, sudo does not respond for thirty or fourty secs.

Solution

The cause is that sudo is looking up your hostname to DNS, and waiting until TIMEOUT event is fired. You can fix this problem by just adding your hostname to /etc/hosts

 su -
 nano /etc/hosts
 127.0.0.1       localhost localhost.localdomain <yourhost> <yourhost>.localdomain localhost4 localhost4.localdomain