Tips and Tricks
Patch for path.module in Drupal 4.7.0 beta 4
You might notice that you are unable to delete url aliases in Drupal. I don"t know the exact version that this problem exists. Anyway, I have patched it right now.
diff -u path.module.orig path.module
--- path.module.orig 2005-12-19 21:51:38.000000000 +0700
+++ path.module 2006-01-27 11:56:01.000000000 +0700
@@ -100,7 +100,7 @@
**/
function path_admin_delete_confirm($pid) {
$path = path_load($pid);
- if (user_access("administer path aliases")) {
+ if (user_access("administer url aliases")) {
$form["pid"] = array("#type" => "value", "#value" => $pid);
$output = confirm_form("path_admin_delete_confirm", $form,
t("Are you sure you want to delete path alias %title?", array("%title" => theme("placeholder", $path["dst"]))),
- sugree's blog
- Add new comment
- Read more
- 887 reads
Patch for blogapi.module in Drupal 4.7.0 beta 4
In Drupal 4.7.0 beta 4, blogapi.module mostly works fine with Post2Blog unless 2 points. The first one occurs when trying to edit post. Categories will not return via XML-RPC. Below is my patch.
diff -u blogapi.module.orig blogapi.module
--- blogapi.module.orig 2006-01-12 17:02:45.000000000 +0700
+++ blogapi.module 2006-01-27 16:02:51.000000000 +0700
@@ -710,6 +710,17 @@
$xmlrpcval["mt_convert_breaks"] = $node->format;
}
+ $terms = module_invoke("taxonomy", "node_get_terms", $node->nid, "tid");
+ $categories = array();
+ foreach ($terms as $term) {
+ $term_name = $term->name;
+ foreach (module_invoke("taxonomy", "get_parents", $term->tid, "tid") as $parent) {
+ $term_name = $parent->name . "/" . $term_name;
+ }
+ $categories[] = $term_name;
+ }
+ $xmlrpcval["categories"] = $categories;
+
return $xmlrpcval;
}
- sugree's blog
- Add new comment
- Read more
- 739 reads
Smooth procedure to upgrade Drupal 4.7.0 beta 3 to beta 4
Since Drupal 4.7.0 beta 4 is available last night, I have just upgraded howforge.com to see the better version. There are many patches was applied to this release. I recommend all you to upgrade as soon as possible. Since I installed lots of modules and themes as well as hot patches during beta 3, the upgrade is not as easily as expect. The most critical problem is I didn"t want to interrupt user by making site off-line for so long. According to the upgrade guide, I have to remove all existing files and extract the new ones. This action is unacceptable for me. That means user might not see the proper message about off-line maintenance or upgrading. Below procedure is what I done today.
- sugree's blog
- 9 comments
- Read more
- 1406 reads
How to Create a DVD on Linux (Part 2)
In part 1, you produced media files suitable for DVD. However, it assumed you already have source files in AVI container. If you are having VCD or SVCD, what you have is MPEG1. Don"t worry. mencoder is a tool to help you convert any media files to AVI in a step as follow.
mencoder -ovc lavc -oac lavc -ffourcc DX50 ${VIDEO}.DAT -o ${VIDEO}.avi
- sugree's blog
- Add new comment
- Read more
- 544 reads
IP Location Lookup
If you are working closely with IP address, website or any affilication program, you might want to know where each visitors come from. The question is how to locate visitors. Let me take you to the very basic detail. What do you know about visitor right now? Well, what you know by now are just IP address of each visitor and referrer URL if specified. So the problem is how to lookup the location of given IP address.
- sugree's blog
- Add new comment
- Read more
- 713 reads
Generating dhcpd.conf from list of IP address, MAC address, and hostname
According to my last post, you might want to customize some part of information, e.g., order and name. For sorting, you can easily insert sort between the pipe chain.
[root@mail ip]# arp -n | sort -t "." -k 4 -g | ./arptodhcpd.sh host host1 { hardware ethernet 00:13:F7:08:20:D2; fixed-address 192.168.10.1; } host host10 { hardware ethernet 00:11:2F:44:F9:44; fixed-address 192.168.10.10; } host server2000 { hardware ethernet 00:11:85:19:F0:D4; fixed-address 192.168.10.42; }
However, name and IP address cannot be modified at all. You could do it by redirecting result of arp -n to a file and then modified it first.
[root@mail ip]# arp -n > iplist.txt [root@mail ip]# cat iplist.txt | ./arptodhcpd.sh
For shorter and more readability, I wrote another script to collect IP address, MAC address and its netbios name in tab separated value (TSV) format. It "s named as collectip.sh.
- sugree's blog
- Add new comment
- Read more
- 1564 reads
Recent comments
3 years 4 weeks ago
3 years 9 weeks ago
3 years 9 weeks ago
3 years 10 weeks ago
3 years 10 weeks ago
3 years 12 weeks ago
3 years 12 weeks ago
3 years 12 weeks ago
3 years 12 weeks ago
3 years 13 weeks ago