X doesn't work in 2.6.26-2-xen-amd64 kernel

Posted on Jan 28, 2010

When I switched a new kernel 2.6.26-2-xen-amd64, the X can’t be started, here are some logs in the Xorg.0.log file:


Fatal server error:
xf86MapVidMem: Could not mmap framebuffer (0x48110000,0x10000) (Invalid argument)

Fix this by change add a kernel parameter dom0_mem=512M, so my kernel looks like:


title       Xen 3.2-1-amd64 / Debian GNU/Linux, kernel 2.6.26-2-xen-amd64
root        (hd0,8)
kernel      /boot/xen-3.2-1-amd64.gz root=/dev/sda9 dom0_mem=524288
module      /boot/vmlinuz-2.6.26-2-xen-amd64 root=/dev/sda9 ro console=tty0
module      /boot/initrd.img-2.6.26-2-xen-amd64 root=/dev/sda9

Reboot it, X works again.

BTW: You may need to add a line “extra = ‘xencons=tty’” to the /etc/xen/YOUR-SYSTEM.cfg file if you can’t start it.

I AM BACK

Posted on Jan 20, 2010

The domain my.cnzxh.net is live again, Now, I’m using the free ROR services on heroku.com. It works fine so far, unfortunately, There are some old posts has lost.

Here are some extensions/plugins which they are useing in the blog: will_paginate, RedCloth, textilize_editor_helper

This is the first post in 2010 :-) Good luck!

Simplewindow.js 1.0 released

Posted on May 02, 2009

supported browsers: IE7+, FF, Chrome, Opera, Safari.

more please check http://my.cnzxh.net/simplewindow/ and http://github.com/xianhuazhou/simplewindow.js/tree/master

can download from http://github.com/xianhuazhou/simplewindow.js/downloads

Http_request.rb v1.0.2 released

Posted on May 02, 2009

Proc.call(block) style supported, did some small changes and improved the redirects(support relative path and absolute path).

HttpRequest.get('http://www.example.com/') {|http|
  puts http.body
  http.each_header {|k, v| puts "#{k} => #{v}" }
  http.cookies.each {|k, v| puts "#{k} => #{v}" }
}

HttpRequest.ftp(nil, “ftp://user:pass@localhost”) {|ftp|
puts ftp.ls
ftp.chdir(‘soft’)
ftp.getbinaryfile(‘ruby.exe’, ‘/path/to/local/ruby.exe’);
}

more please check http://github.com/xianhuazhou/http_request.rb/tree/master

Http_request.rb on RubyForge

Posted on Apr 10, 2009

Yes, now, you can install the http_request.rb by the gem command.

gem install http_request.rb

More infos please check http://rubyforge.org/projects/httprequest/. I just store some files in the rubyforge site, the main updates still on the github

Some updates for http_request.rb and simplewindow.js

Posted on Apr 04, 2009

I’m really busy in these days…(no, it’s about my job, not the following small projects), I need to take a short break:-)

http_request.rb 1.0.1 (ftp protocol supported)
http://github.com/xianhuazhou/http_request.rb/tree/master

simplewindow.js 1.0 beta (the basic core has done)
http://github.com/xianhuazhou/simplewindow.js/tree/master and http://my.cnzxh.net/simplewindow/

Publish some examples for simplewindow.js

Posted on Mar 28, 2009

Can have a look via the url or download from github, it works on (IE/FF/Chrome/Safari/Opera) with their newer versions. well, it’s not finished yet. I’m still working in my spare time. hopefully, I can release the beta version nearly 10 April. And, you will see more nice examples on that time.

Namespace and anonymous functions in PHP5.3.0

Posted on Mar 27, 2009

PHP5.3.0RC1 has released, 2 new features “Namespace” and “Anonymous functions” are very useful. now, we can organize and manage our codes easier than before, also, can write some “cool” codes with the anonymous functions.

  Read More...

A short script: mb_string.rb

Posted on Mar 24, 2009

mb_string.rb is a very old script created more than 2 years ago, I just put it into github, no plan to upgrade or do any changes for it.
Shortly, the script can convert or get string between different encoding for multiple bytes(only test it for chinese characters). it’s similar to mb_string extension in PHP.

Http_request.rb 1.0 Released

Posted on Mar 24, 2009

Support uploading files by the “:files” key, for example:

HttpRequest.post(
  :url => 'http://localhost/upload.php', 
  :files => [{
    :file_name     => 'test.txt',            # original file name, default is rand name such as 0cdex_0
    :field_name    => 'user_file',           # input field name, default is "files[]"
    :content_type  => 'text/plain',          # content type, default is application/octet-stream
    :file_content  => 'Have a nice day!'     # file content
  }]
)

Another issue, I changed the name from httprequest.rb to http_request.rb on github.

More please check http_request.rb

Please feel free to tell me if you find any bug or have any question.

A new javascript library: simplewindow.js

Posted on Mar 17, 2009

Just commited to the github.com, it’s based on prototype/scriptaculous library, can handle the “inline window” which generated by div(or iframe). some features are:
support inline content, ajax embedded, fits size automatically depends on the size of content, support 9 different positions for display, some callback functions such as “beforeOpen”,“afterOpen” etc… (it’s still in the developing).

hmmm, why do we need another xxxwindow? LightBox, LightWindow, Prototype-window …, they are not good? no, they are very good in some lazy cases. the reason is sometimes I just want to show a simple but flexible and extendible inline window, I need to controll everything for the window whatever styling or position or even more than one window will be display in the page. I don’t like the library depends on the styling or something else, that’s designer’s job, just keep it simple, easy to use, flexible. so I did this.

A simple animation with <canvas> tag

Posted on Mar 16, 2009

It’s really cool, I know the speed is not so fast and only support 2d for now, but the feature is very nice, and seems many browsers have already supported the tag(except IE?). more info can check here, there is a simple example I did just for test:-), can check it via http://my.cnzxh.net/uploads/2009/03/16/canvas.html.

PS: the tag is a part of the html5, still in the developing.

Bug fixing for the click game:-)

Posted on Mar 11, 2009

There is a bug for the click in IE. the thing is that the Effect.Morph can’t support color’s name such as “yellow” or “red” in IE. so I have to use “#f0ff00” or “#ff0000” instead of the name, then it works fine in IE and other browsers. another issue depends on the difference, let’s see this:

var color = '#ff0000';
$(document.body).setStyle({
   'background': color
}).getStyle('background') == color;

In IE, it’s true, but false in FF….why? because IE doesn’t convert the color string, just keep the original one if the color name is valid whatever it’s ‘#ff0000’ or ‘red’, but FF always convert the color to RGB mode, Opera always convert to ‘#xxx’ mode. and Chorme(Safari also?) will keep the color’s name if use color’s name, will convert to RGB mode otherwise. So, that’s the different between these browsers, make the thing doesn’t works in IE and maybe others.

Really hate the cross browser thing:(, I’m using FF and Opera in Linux as my developing platform.then if I want to test something in IE or Safari, I need to open vmplayer or use rdesktop to use Windows operating system for testing. IE/FF/Safari/Opera/Chrome…, we spend too much time to make the web application to support those browsers. Sometimes it’s really hard to test it and make it works very well in all major browsers even use some cross browser frameworks or libraries.

A really really small Javascript game?

Posted on Mar 10, 2009

Just for click, can check it via http://my.cnzxh.net/fun/click/. I have ever seen the same thing did in Javascript long time ago, this is the prototype/aculoscriptus version I did:-)

Fetch cookies and send cookies using http_request.rb

Posted on Mar 09, 2009

Fetch cookies from response, for example:

hp = HttpRequest.get('http://www.yahoo.com')
hp.cookies.each {|k, v|
   puts "#{k} => #{v}"
}

Add cookies in http header for send request, for example:

HttpRequest.get(:url => 'http://www.example.com/', :cookies => {:login => 'Yes', :userid => 101})
HttpRequest.get(:url => 'http://www.example.com/', :cookies => 'login=Yes; userId=101')

More can check the http_request.rb.

Implement PHP's ucfirst function in Ruby

Posted on Mar 07, 2009

There is a function called “capitalize” in Ruby, can convert the first character to uppercase and others downcase. In PHP, there is a function called “ucfirst”, can convert the first character to uppercase, but do nothing for the remainder. this is the Ruby version same as the PHP’s “ucfirst” function, easy:-)

def ucfirst(text)
  text[0,1].upcase + text[1..-1]
end

A quick fix for the RedCloth library for the <pre> tag

Posted on Mar 07, 2009

Textile is a kind of text format, basically, it’s like UBB code. RedCloth is a Textile tool can convert from Textile format to html or latex format. but it doesn’t work well as expect somehow.

  Read More...

I'm on github.com

Posted on Mar 06, 2009

I did it, just published my first script http_request.rb (more info can check http://github.com/xianhuazhou/http_request.rb/tree/master) to github.com. why don’t you put it to rubyforge.net ? because the rubyforge.net seems only for ruby scripts. I’m sure I’ll publish some other tools writed by other program languages such as PHP, Javascript etc. another reason is I like git now:-), So I chose the github.com.
can access it via http://github.com/xianhuazhou

Don't like the weather these days

Posted on Mar 05, 2009

I like rain in the Spring, but it give me too much these days, enough:-) don’t think it’s a real Spring, seems still in the winter, some cities are snowing even in south of China.
Missing the sunshine as usual Spring.

Use photo2html.rb to create html pages for photos

Posted on Mar 04, 2009

photo2html.rb is a small ruby script file, can create html pages for photos by some given options from command line, require the convert program from ImageMagick , so you need to download and install it first if don’t haave one.

— Features

  • use erb template, it’s easy to change the template or create new one for customization
  • recursion directories, means can find all of images in the given directory and its sub-sub directories.
  • can convert .jpg, .gif and .png formats for now
  • can define number of rows and columns for show per page.
  • can run it in ruby 1.8/1.9:-) so, basically can run it in Linux/Windows/Mac.
  Read More...

Detect browser back button

Posted on Mar 04, 2009

Sometimes, we need to check whether user clicked the browser back button, then do some checking such as force to reload the previous page, go some special steps which generated by AJAX or Flash directly etc. as we known of the back button, for each browser like IE, FireFox, Opera and Safari, the behavior is different even the settings are same.

  Read More...

Welcome to my new blog

Posted on Mar 01, 2009

I havn’t written an post for a long time. Because I’m always busy, need to learn new thing for work, need to care some personal things, need to sleeping:P, etc. anyway, everything goes well, So I have some time to start my new web log now.

Yes, This is my new web log in english:-), for improve my english skills, I’ll try to write it in english. hopefully, I can keep:P

Currently, I’m learing some new features in Ruby and Rails, because many things has changed. Ruby 1.9 and Rails 2.3 released their test version for testing now, therefor, some other related objects depends on it need to update and testing also.

I’ll update some old small tools written in Ruby to support ruby 1.9. will publish them later if no problem.