I've made a simple script to remove the beta box.
Link
Greasemonkey script to remove "People Who Dugg This Also Dugg"
Posted by
twig
at
9:48 AM
Thursday, January 29, 2009
Batch migration of users into Drupal
Posted by
twig
at
12:16 PM
Sunday, January 25, 2009
The $new_user array can contain any field with the name matching a field in the "users" database table.
Once the data is filled, call user_save() to create the user.
Be sure to check "$new_user_object afterwards != FALSE" in case the registration process failed.
This code was checked and working with Drupal 6.x.
$new_user = array("mail" can be omitted, but the important one is the username.
'name' => $username,
'pass' => $password,
'mail' => $email,
'status' => true,
);
Once the data is filled, call user_save() to create the user.
$new_user_object = user_save(NULL, $new_user);The important part is to give the first parameter NULL, as we want to be creating new users.
Be sure to check "$new_user_object afterwards != FALSE" in case the registration process failed.
This code was checked and working with Drupal 6.x.
Firefox Dynamic Bookmarking
Posted by
twig
at
8:57 AM
Monday, January 19, 2009
If you're like me who uses the Firefox history to quickly access pages, you're more than likely to search for a link in the dropdown, modify it a little and then view it.
An example is viewing bug tasks in Trac.
At work, ticket numbers get passed around rather than the whole link.
I tend to type in "trac" so the Firefox Awesome Bar returns a few results.
I select the result that closely resembles the ticket url, and then modify the ticket ID so it takes me to the ticket I want to view.
Now imagine that could be quicker.
Luckily, Firefox supports bookmark keywords which DOES make it quicker!
I can just type "trac 1234" and it'd take me to that very link.
For example, the link http://www.youtube.com/watch?v=HXi-8nLK_dc
An example is viewing bug tasks in Trac.
At work, ticket numbers get passed around rather than the whole link.
I tend to type in "trac" so the Firefox Awesome Bar returns a few results.
I select the result that closely resembles the ticket url, and then modify the ticket ID so it takes me to the ticket I want to view.
Now imagine that could be quicker.
Luckily, Firefox supports bookmark keywords which DOES make it quicker!
I can just type "trac 1234" and it'd take me to that very link.
For example, the link http://www.youtube.com/watch?v=HXi-8nLK_dc
- Bookmark the page and edit it.
- Edit the link so you keep the "http://www.youtube.com/watch?v=" chunk, but replace the video ID with "%s" so it becomes "http://www.youtube.com/watch?v=%s"
- Give the bookmark a keyword such as "yt"
- Test by typing "yt HXi-8nE65JshkU" into the Firefox address bar.
Detecting PHP output buffer leaks
Posted by
twig
at
11:14 AM
Tuesday, January 13, 2009
If you want to check for "ob_start()" leaks or incorrectly closed buffers, add the check at the end of each file you wish to check.
If running PHP in command line mode, by default there are no buffer levels.
However, when the request is from a browser, the default buffer level is 1.
So, at the end of the script, add the following.
Typically this would be sufficient in command line, but since a browser request has one level of buffer set, we need to also check "ob_get_level()".
If running PHP in command line mode, by default there are no buffer levels.
However, when the request is from a browser, the default buffer level is 1.
So, at the end of the script, add the following.
if (ob_get_length() && ob_get_level() > 1) {The "ob_get_length()" checks if there is any data in the current buffer.
error_log("ERROR: Output buffering leakage detected: ({$_SERVER['REQUEST_METHOD']}) {$_SERVER['REQUEST_URI']}");
error_log("ERROR: Output buffering args:\n" . print_r($_SERVER['argv'], true));
}
Typically this would be sufficient in command line, but since a browser request has one level of buffer set, we need to also check "ob_get_level()".
Adobe CS4 Disable Updates
Posted by
twig
at
8:47 AM
Saturday, January 10, 2009
I hate automatic updates, especially ones that aren't easy to disable.
Heres how to disable it from the CS4 iteration of their software offerings.
[ Source ]
*edit - 29/01/2009*
Just to make things a little easier, I've translated the instructions above into a command you can run from the start menu.
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe" /f /v AdobeOnlineDefault /d "0"
and
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\CSXSPreferences" /f /v UpdatesAllowed /d "0"
*edit - 24/03/2009*
Sadly, the instructions from Adobe just don't work.
After being annoyed even futher, I've discovered yet another way to disable the updates.
Go to "C:\Program Files\Common Files\Adobe\Updater6" and run "Adobe_Updater.exe".
Now before you think I've gone completely insane and given in, just let the initial scan finish.
It'll present you with a notification dialog and you can select "Preferences".
Untick everything!
Hopefully, this will work.
*edit - 29/11/2010* [ Source ]
Anonymous (who deleted his/her own comment) gave this helpful tip.
An option for system admins to disable the updater altogether is to create a registry key which blocks it from running, even if the user tries to update manually by running "Adobe_Updater.exe".
Heres how to disable it from the CS4 iteration of their software offerings.
- Go to HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\
- Set "AdobeOnlineDefault" to "0" (zero).
If it doesnt exist, create it as a new String Value. - Go to HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\CSXSPreferences\
- Set "UpdatesAllowed" to "0" (zero).
If it doesnt exist, create it as a new String Value.
[ Source ]
*edit - 29/01/2009*
Just to make things a little easier, I've translated the instructions above into a command you can run from the start menu.
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe" /f /v AdobeOnlineDefault /d "0"
and
REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\CSXSPreferences" /f /v UpdatesAllowed /d "0"
*edit - 24/03/2009*
Sadly, the instructions from Adobe just don't work.
After being annoyed even futher, I've discovered yet another way to disable the updates.
Go to "C:\Program Files\Common Files\Adobe\Updater6" and run "Adobe_Updater.exe".
Now before you think I've gone completely insane and given in, just let the initial scan finish.
It'll present you with a notification dialog and you can select "Preferences".
Untick everything!
Hopefully, this will work.
*edit - 29/11/2010* [ Source ]
Anonymous (who deleted his/her own comment) gave this helpful tip.
An option for system admins to disable the updater altogether is to create a registry key which blocks it from running, even if the user tries to update manually by running "Adobe_Updater.exe".
- Using Regedit.exe, navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Adobe
- Create a new key in this folder named "Updater"
- Create a new DWORD value within this key named "Enterprise" with a value of "1"
Basic SVN commands and configuration
Posted by
twig
at
3:14 PM
Monday, January 5, 2009
Pathnames
Linux and Windows pathnames are used in the same way, except in Windows we need to specify the drive letter also.
ie.
Linux
/repositoryRoot/newProject
Windows
C:\repositoryRoot\newProject
Create Repository
Command: svnadmin create [repository_location]
Then modify the following files:
Migrate Repository
Firstly we need to dump it into a portable file so we can transfer it.
Command: svnadmin dump [repository_location] > ./outputfile
Transfer the output file to the new server.
Once the new repository has been created, we can in the old repository data.
Command: svnadmin load [new_repository_location] < ./inputfile
Note: this does not transfer your settings such as passwords or access configurations.
Linux and Windows pathnames are used in the same way, except in Windows we need to specify the drive letter also.
ie.
Linux
/repositoryRoot/newProject
Windows
C:\repositoryRoot\newProject
Create Repository
Command: svnadmin create [repository_location]
Then modify the following files:
- /conf/svnserve.conf
Disable anonymous access and allow password file usage. - /conf/passwd
Create yourself a login.
Migrate Repository
Firstly we need to dump it into a portable file so we can transfer it.
Command: svnadmin dump [repository_location] > ./outputfile
Transfer the output file to the new server.
Once the new repository has been created, we can in the old repository data.
Command: svnadmin load [new_repository_location] < ./inputfile
Note: this does not transfer your settings such as passwords or access configurations.
Subscribe to:
Posts (Atom)