February 2010 Archives

system management in Heroku

| No Comments | No TrackBacks
This article investigates the capabilities exposed to the client user and the user experience.
Image representing Heroku as depicted in Crunc...

Image via CrunchBase


The client user of Heroku is usually a developer focusing on Ruby on Rails.  Due to its specific user case this platform is tuned with great effort to ease the deployment and publishing of a web project.

Heroku exposes two management systems for developers.  One is the online account management; the other is the command line tool.

Online account management:

This is via web interface.  The developer can see clearly how many sites he has created on behalf of his account.  Besides, from this interface, the developer can do all the resource allocation - to upgrade the account, to add more workers/dynos etc.  Add-ons are handled as well.  There are lots of add-ons: full text search, cron jobs etc.  Some of them are free; while some of the professional features have to be charged accordingly.

Command line tool:
The client of Heroku platform is enabled via Ruby Gems.  And it is a command line tool.  Therefore, the command line takes most of developers' time.   For example, to create a Heroku application, one can invoke 'heroku create'.  The command line tool is a superset of the web interface above.  The developer can invoke the heroku command to change the workers/dynos as well.  The detailed features include ('heroku help' shows every specific command used.):
  • Manage addons
  • Manage bundles
  • Manage database:
  • choose different database capabilities
  • shared DB or dedicated DB
  • pull the database into a local database
  • push a local database into app's remote database
  • reset the database for the app
  • Web service start/stop/restart
  • Manage scaling: add/remove dynos/workers
  • Manage domain names: add/remove a custom domain name

Overall status:
Heroku shows an overall status of how the system goes.  Take a look at this link: http://status.heroku.com

Summary:
Heroku is a terrific platform for developers with Ruby on Rails in mind.  It provides 'Ruby on Rails as a Service'.  Therefore, it frees developers from worrying the deployment of their web projects.  The developers need only to focus on the code.  The concepts presented by Heroku are minimal.  It abstracts the infrastructure underneath to concepts like 'dyno' and 'worker'.  And these two parameters can be changed on the go.  In a word, Heroku is easy to use and really cool for Ruby on Rails developers!

To take a look at my little 'hello world' demo.

problems with building ichm on xcode

| No Comments | No TrackBacks

I'm trying to compile ichm on my Mac. It's a chm reader on Mac platform. The source code can be downloaded from here.

This project takes advantage of three other frameworks, namely chm_lib.framework, PSMTabBarControl.framework and Sparkle.framework.  However, these three frameworks are not in the ichm repository, therefore you have to download it manually. The detaild URL and instructions can be found here. However, I would like to add some comments on how to build chm_lib framework:


The default SDK for ichm is 10.5. But when you're creating the framework for chm_lib, it will default to 10.6, and the default architecture is x86_64 and it's a debug version. Therefore, to make it right and make it be able to be linked against, it should be changed to "Release, i386". Otherwise, ichm will complain that the framework is not a right architecture.


At this phrase, I'm able to build the project successfully. Yes, you got that, there is always a 'but'. But it can't run. The loader can't find the Sparkle framework. To understand the whole story behind this, let's see how a typical Mac applications structures. Generally speaking, Mac application is a bundle of useful resources, it's just a directory containing all the stuff. Let me give you a rough idea.


You can see that the three lines that pointing to the framework from the output of otool. Otool on mac is similar with the 'ldd' command on Linux platform which lists all the dynamic libraries.

The default ichm project doesn't include copying the files. So we have to manually add these files. Choose "Project" -> "New Build Phrase" -> "New Copy Files Build Phrase". Then you'll see there is one more directory showing on "Targets". 
xcode-copy-files.jpg
Then you can just drag the frameworks into this directory. And "Build". Hopefully it should work fine then.

the ubiquitous B-tree

| 3 Comments | No TrackBacks
Let's continue with B-tree discussion. Writing this name reminds of an interesting experience in my interview, one guy asked me what the differences between B minus tree and B plus tree. Lol. Well, literally speaking, there is no B minus tree thing. The phrase of "B-tree" should be read as "B tree" instead of "B minus tree". The "-" is a hypen...
A simple B+ tree example linking the keys 1-7 ...

Image via Wikipedia


Today's paper is "The ubiquitous B-tree" by Douglas Comer. This article is cited for 455 times at this time of writing.

This paper is mainly a summary for the de-facto widely used B-trees and shows lots of B-tree variants. It's a good introduction for whose are confused by the mysterious tree names behind them. In my view, the important variant is B+ tree. Now let me go back to my previous interview problem and try to give a shot. The main diff is B+ tree put all the keys on the leaf node, while the original B-tree puts keys on interior node as well. The advantage is B+ tree can provide really quick sequential access, since all the keys are on the leaf node and these leaf nodes can be linked together.

Reblog this post [with Zemanta]

B-tree originates from this paper

| 2 Comments | No TrackBacks
This paper is "Organization and Maintenance of Large Ordered Indexes" by "R.Bayer and E.McCreight". It was published in 1972, which is older even than my age. :-) Though, it was the root of B-tree related literature.

The insert/deletion operations doesn't seem to be very difficult from the current point of view. However, it was innovative to think beyond binary search tree and add more sons on a single node. The background of this is that scientists tried hard to reduce the disk access time involved in database system development. As we now all know, B-tree is a balanced, multi-way tree. It's widely used nowadays in file system, database indexing etc. Hence it's worth reading.

Even it's simple to understand the idea, we should take a more deep look as how the detailed implementation should go, I list some questions below:

Insert:
Overflow? If yes, then to the left sibling or right one? What's overflow, you may wonder. It's a trick to re-distribute between your siblings instead of splitting right now.

Delete:
If the number entries doesn't become  less than k, then everything is fine. However, if it's not, then we should judge which sibling to peek into (left or right?) Then what strategy to take: if the total number is less than 2*k, then we should choose 'concatenation', otherwise, we do 'underflow'.

I made a small pictures depicting the choices:
b-tree-operations-insert-delete-choices.jpg
The later part of this paper details on the choice of k and shows the detailed performance report. But I doubt it still holds on today's modern machine, as its result was carried out on an ancient IBM machine.

problems with macport

| No Comments | No TrackBacks
I was trying to build git-core on Mac using MacPort. But due to the update of port tree, the current port tree is old, therefore it results in an checksum error of the package file. To solve this problem, use 'sudo port selfupdate' to make sure the port tree is the newest. Later, due to the corrupted file 'curl' distfiles, I was not able to proceed, thanks to this post, 'sudo port clean --all curl curl-ba-bundle' saved me.

I learned these two tricks. Hope it may be useful to you.

You've created a button, take it as an example, later you want to change it to 'Disabled' by default.

The easy way to do it is to modify the properties displayed in "Interface Builder" directly. And hopefully everything will be fine. However, what if you want to do it by lines of code?

Yes, there is also a way to accomplish this trivial task. You can add your actions or codes your "- awakeFromNib" method of the controller class.

The tentative trial would be to add your code in the "- init" method which is wrong. Because at the time of initialization of the controller class, there is no indication showing that the buttons are already done with its own initialization. Hence, the only safe and correct way to do is to utilize the "awakeFromNib" method.

the driver support for Huawei CDMA is good.

| No Comments | No TrackBacks
I'm surprised by the fact that Huawei CDMA card supports my Mac OSX really well. In my own view, I thought these products lack the support for other operating systems other than Windows.

I can't help take a picture of it.
cdma-card.jpg
Its application name is called "MobilePartner". At the first setup, we have to create a new configuration. Click 'New' in 'Connection Management' section, and press 'OK' button afterwards. Everything should be fine.

This card is for my nephew, I'm thinking buying one for my own use. If you ask how much it costs, well, it's 1300 RMB in total (the hardware and the service price).

access method

| No Comments | No TrackBacks
In Stonebraker's "The Implementation of Postgres" paper, he et al mentioned that they designed the access method TOO HARD. Because there were two many connections for this sub-system to work well. You have to know:
  1. lock manager
  2. buffer manager
  3. know the states between the query engine
  4. write 13 non-trival routines
So it seems it's a good start to get hands dirty on this part, hopefully it will get myself quicker to be familiar with this database system.

connect to postgresql on another machine

| No Comments | No TrackBacks
If the postgresql is setup on a server, but you want to connect to it on another machine, say on your windows machine. We have to modify the pg_hba.conf file in DATADIR directory, add one line to it:
host    all     all             10.0.0.0/8              trust
if the postgresql server is running, you can invoke
pg_ctl reload -D DATADIR
to reload the configurations. HTH

About this Archive

This page is an archive of entries from February 2010 listed from newest to oldest.

January 2010 is the previous archive.

March 2010 is the next archive.

Find recent content on the main index or look in the archives to find all content.