Useful inputrc

Place the following in ~/.inputrc or /etc/inputrc
While ~/.inputrc works sometimes, it doesn’t on all systems.

"\e[1~": beginning-of-line
"\e[4~": end-of-line
"\e[5~": beginning-of-history
"\e[6~": end-of-history
"\e[3~": delete-char
"\e[2~": quoted-insert
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
set completion-ignore-case On

All lines except the last enable nice readline & bash cursor movement (control + arrow keys and what not) while the last line turns on case insensitivity for tab-completion, enabling you to have folders and files of mixed case characters while not having to type the capital letters. (You can have a directory called “Documents” and tab-complete by tying “doc

From: http://linuxart.com/log/archives/2005/10/13/super-useful-inputrc/

Recover corrupted RPM database

From http://honglus.blogspot.com/2011/09/recover-corrupted-rpm-database.html

RPM database consists of a number Berkeley DB files in /var/lib/rpm, the exception is __db.* files, which like cache files are updated for every rpm operation and they can be safely deleted.

#tested in Centos 5.5

$ ls /var/lib/rpm
Basenames __db.001 __db.003 Filemd5s Installtid Packages Provideversion Requireversion Sigmd5
Conflictname __db.002 Dirnames Group Name Providename Pubkeys Requirename Sha1header
$ file /var/lib/rpm/Packages
/var/lib/rpm/Packages: Berkeley DB (Hash, version 8, native byte-order)

If one of the DB files is partially corrupted and it is still readable by /usr/lib/rpm/rpmdb_dump, you can reload the DB file and rebuild db.

$cd /var/lib/rpm/
$rm -f __db*
$mv Packages Packages.orig
$/usr/lib/rpm/rpmdb_dump Packages.orig | /usr/lib/rpm/rpmdb_load Packages
$/usr/lib/rpm/rpmdb_verify Packages

#if you got this error: db_verify: PANIC: fatal region error detected; run recovery
#make sure /var/lib/rpm/__db.* are cleaned
#It is unlikely to rebuilddb if rpmdb_verify fails

$rpm -v –rebuilddb

If one of the DB files is completely corrupted and it is not readable by rpmdb_dump, you have to restore from backup,

$cd /var/lib/rpm
$cp Packages Packages.bak

#simulate a damaged RPM DB file

$ >Packages
$ cp Packages.bak  Packages

# Simply restoring from backup file won’t work
# file verification is successful

$ /usr/lib/rpm/rpmdb_verify Packages

#but any rpm operation fails

$rpm -qa error: rpmdbNextIterator: skipping h#     294 Header V3 DSA signature: BAD, key ID e8562897

#Even “rpm –rebuilddb” fails

$rm -f __db.*
$rpm –rebuilddberror: rpmdbNextIterator: skipping h#     294 Header V3 DSA signature: BAD, key ID e8562897

#Notice the error about signature: BAD? The Pubkeys have to be cleaned as well.

$ mv Pubkeys Pubkeys.bak

#all good after removing Pubkeys file, a new Pubkeys is generated automatically on “rpm –rebuilddb”

$ rm -f __db.*
$ rpm –rebuilddb
$ rpm -qa | head -2man-pages-2.39-15.el5_4bash-3.2-24.el5

Jump to top of iframe

When you want to have the page jump to the top of an iframe upon clicking “Next” or “Submit”, etc, you can easily use this code:

<iframe width="620" scrolling="no" height="2500" frameborder="0" style="background-color: transparent; overflow: hidden;" allowtransparency="true" src="http://www.website.com" onload="window.parent.parent.scrollTo(0,0);"></iframe>

WordPress new user

Hello USERNAME,

To access the back-end for editing and updating:

  • Admin: http://events.ewea.org/annual2012/wp-admin/
  • Username: USERNAME
  • Password: UN12345

What do do next?

Online documentation

There is a world of excellent documention for wordpress.

 

Kind regards,

Jason Bickley

WordPress Plugins for EWEA

Here is a list of plugins I am using for EWEA WordPress websites..

  • Contact Form 7
  • FD Feedburner Plugin
  • Google Analytics for WordPress
  • Google XML Sitemaps
  • PHP Execution
  • Random Text
  • Redirection
  • User Role Editor
  • W3 Total Cache
  • WordPress SEO
  • WP-FileManager
  • WP Realtime Sitemap
  • WPtouch
  • Yoast Breadcrumbs

Google Syntax Highligher

I found a new plugin today for WordPress; “Google Syntax Highlighter”.
It formats your source code pastings on the fly.

Here’s a test below:

<?php

$fp = fopen("$datafile","a"); // Open datafile

if(!$fp) {
 echo "Error: Cannot open file.";
 exit;
}

fwrite($fp, $fname."|$|".$lname."|$|".$org."|$|".$country."|$|".$date."|$|".$ipadd."|$|".$usagent."\r\n");
fclose($fp);

header("Location: http://" . $_SERVER['SERVER_NAME'] . "/offshore/db/thanks.php"); /* Redirect browser */
exit;
?>

Changing the default keyboard to Japanese

When the machine first boots, the login screen defaults to the US QWERTY keyboard.
To change the default keyboard to something else, do the following:

More info:
http://support.microsoft.com/kb/138354

Forcing Windows to use a Japanese keyboard

To force the operating system to use a certain keyboard, make the following changes in the registry.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\i8042prt\Parameters

Value name Value type Value data
LayerDriver JPN REG_SZ kbd106.dll
OverrideKeyboardIdentifier REG_SZ PCAT_106KEY
OverrideKeyboardSubtype DWORD 2
OverrideKeyboardType DWORD 7

More information:
http://support.microsoft.com/kb/927824/en-gb

Installing Adobe CS2 on Windows 7 64-bit

My initial attempt to install Adobe CS2 onto Windows 7 64-bit (hereafter W764) was unsuccessful. W764 has two program folders:  “Program files” and “Program files (x64)”.

By default the installer will try to install into “Program files (x64)” and the unsupported characters “( )” make the path void. I changed this to the other “Program files” folder and continued the installation.

However, upon starting the programs, I was met with a “Your adobe photoshop user name, organisation, or serial number is missing or invalid” kind of error and the application quits automatically. Checking registry editor showed that there was indeed an issue with the installation paths.

Searching the problem on Google gave me the solution. The application must be installed into the “Program files (x64)” folder or it will not work. To do this, the path must be changed to:
C:\progra~2\adobe
in the  installation destination.

Membership Account Details

Dear XXXXX,

Please log in to the Members Lounge using the following details:

  • URL: http://www.ewea.org/index.php?id=650
  • Username:
  • Password:

Kind regards,

Jason