User login
Navigation
Recent blog posts
- Ubuntu mirrors up and improved!
- Google-jstemplate: Iterate object with unknown properties
- nginx https proxypass for php apps
- sugarcrm & memcache: Doing it Wrong
- subversion and https in Ubuntu Karmic
- Drupal: Views block delta converted to md5 hash
- Ubuntu Server install requires PAE
- Installing Drupal from command line
- Drupal: Handling form field weight through CCK
- minify javascript using Google Closure Compiler
angch's location
angch twitter
drupal

Drupal: Views block delta converted to md5 hash
kamal — Fri, 08/01/2010 - 17:03
Find out this only through reading the views.module code. In case of your views block display has a long name (> 32 chars)(the views name would be used as delta in block table), Views would hash it through md5. You can get the list of hashed names stored in the variable table as views_block_hashes. For example, mine:-
Array
(
[ba843477361f490ca5c9e42548f0127d] => imagegallery_block_latest_images-block_1
)
The related code is in line 298 of views.module.

Installing Drupal from command line
kamal — Tue, 08/12/2009 - 19:04
Using twill because until Drupal 7, there's no way you can install Drupal without opening the browser.
#debug http 1
go http://192.168.1.6:12000/install.php?profile=pulut&locale=en
code 200
find "To set up your Pulut database, enter the following information."
#show_cookies
fv 1 db_type pgsql
fv 1 db_path gmp
fv 1 db_user kamal
fv 1 db_pass abc123
submit op
find "All necessary changes to <em>./sites/default</em> and <em>./sites/default/settings.php</em> have been made. They have been set to read-only for security."
fv 1 site_mail kamal@bytecraft.com.my
fv 1 account[name] admin
fv 1 account[mail] kamal@bytecraft.com.my
fv 1 account[pass][pass1] abc123
fv 1 account[pass][pass2] abc123
fv 1 update_status_module1 0
submit op
find "Congratulations, Pulut has been successfully installed"
clear_cookies
go http://192.168.1.6:12000/
fv 1 name admin
fv 1 pass abc123
submit op
find "Log out"It's pretty crude at the moment but I guess a good start. Couple with some other tools I'm working on, installing Drupal can be fully automated. The next step is to convert this twill script into Python equivalent to be more flexible.
Update
Here some good and better explanation on this from Lin Clark's blog.

Drupal urlencode: Dealing with ampersand in filename
kamal — Mon, 09/11/2009 - 10:31
A bug poping out with some files failed to download, returning 404. Looking closer at the issue, turned out the files that failed contained ampersand "&" in the filename. PHP would translate the "&" in request path as a key in $_GET variable. So something like:-
$ wget http://www.somesite.com/system/files/fm/somefile_with_&_ampersand.pdfwould result in PHP $_GET as:-
array(
[q] => system/files/fm/somefile_with_
[_ampersand] =>
)urlencode'ing' the path is not enough because PHP would still translate that to an ampersand.

Drupal: Where's my CCK content get stored in db ?
kamal — Tue, 16/06/2009 - 12:10
Wrote about internal CCK storage in my personal blog sometimes ago but looking through issues coming up recently in our issue tracker suggest that some of developers here still not sure where their CCK content are stored in the database. Briefly revising this topic to give some clue on where to look after when something goes wrong with our CCK related content.

Drupal: Namespace your CCK fields
kamal — Wed, 03/06/2009 - 15:34
Not aware of this until it was too late. All CCK field was stored in a flat container in table node_field. It's not unique per content type. That means you cannot have two fields with a same name although that field was used in different content type. From the UI, if you create field with a same name, it'll just append an arbitrary number such as _0, _1 to make it unique.

Drupal: Programmaticaly creating nodes
kamal — Mon, 13/04/2009 - 10:49
Note: Work in progress, need to jot down for future reference.
When migrating content from the old system to Drupal, we need some programmatic way of doing that. If we did some Google search with keyword such as "programmatic Drupal", two methods become obvious - node_save() and drupal_execute(). Before we go further, better to clarify that both methods are not exactly some kind of Data API that Drupal provide to programmaticaly import external data. It far from that. It just happened that we can leverage both functions to help us put external data in place within Drupal structure.

Drupal: PostgreSQL vs MySQL
angch — Thu, 26/03/2009 - 19:11
Let's get this out of the way first: MySQL beats PostgreSQL for Drupal sites in terms of raw performance. See this benchmark
But the real question is the how and why, and also how to make sites even faster and more scalable?

memcache woes in Ubuntu Intrepid.
angch — Wed, 25/03/2009 - 19:03
Seems like Ubuntu Intrepid uses a beta version of memcache module for PHP. This has caused a number of grief in my Drupal 5 + cacherouter + memcache development site: e.g. http://drupal.org/node/245341#comment-1397634

Dogfood, cobbler's kids, changes to blog.bytecraft.com.my
angch — Fri, 20/03/2009 - 13:16
Haven't been working on this site (blog.bytecraft.com.my) for a while. There are plenty of things that needs to be done, and while it's not perfect:
This site is based on our pulut's Drupal 6 branch. Easier to maintain several sites with well known and tested modules.
Changed the theme to Acquia's Marina. Still needs some tweaks to css for our content.
Experimenting with Drupal's cacherouter with memcache to speed things up.
Tweaked the PostgreSQL config a little (fsync is slow, asynchronous commit is a Good Thing). Yes, using MySQL for drupal would be faster, but it's dogfood, and we're more comfortable with PostgreSQL.
Added the lego logo.

Drupal: Disable region on certain url path
kamal — Tue, 06/01/2009 - 16:12
Need to disable 'region' on certain url path such as 'admin' or 'edit'. Previously it did involve hacking the core block.module (not me).
