Ramin Hossaini (blog)

21Apr/100

Getting rid of Gmail theme-backgrounds

I love that Gmail added theming functionality, but I would actually like some of the themes more without the backgrounds. This isn't a fancy solution, but it's more of a reference for myself. You could also use plugins that let you modify the CSS, but I'm just using Adblock-plus for Firefox here.

Take for instance the Pebbles theme:

Not my cup of tea, but I love those neutral colours.

The easiest thing to do is to add a Block-rule in Adblock-Plus:

1
2
https://mail.google.com/mail/images/2/5/pebbles/rocks_tile.jpg
*/images/2/5/pebbles/rocks_tile.jpg  /*wildcard version - for Google Apps*/

Refresh Gmail, and it's gone:

Other blockable backgrounds (some of the themes are day-of-the-week specific, so I'll add more to the list as I find them):

1
2
3
4
5
6
7
8
9
10
11
12
*images/2/5/pebbles/rocks_tile.jpg
*images/2/5/mountains/mon/*
*images/2/5/mountains/tue/*
*images/2/5/mountains/wed/*
*images/2/5/mountains/thu/*
*images/2/5/mountains/fri/*
*images/2/5/mountains/sat/*
*images/2/5/mountains/sun/*
*images/2/5/tree/sunny/header_bg.jpg
*images/2/5/ocean/weekdays/weekday_header.jpg
*images/2/5/planets/base/star_tile.gif
*images/2/5/planets/saturn/saturn.jpg
18Apr/100

Migrating WordPress

Here are a couple steps I follow each time I move a WordPress instance from one environment to another. I'll assume you're moving from Development to Production.

Database configuration

A migration usually involves changing the database configuration in wp-config.php.

Instead of having to modify the file every time, you could just modify wp-config.php to include something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
if ($_SERVER['HTTP_HOST'] == 'dev') //could be 'localhost' or anything else
{
	define('DB_NAME', 'dev_db_name');
	define('DB_USER', 'dev_user');
	define('DB_PASSWORD', 'dev_password');
	define('DB_HOST', 'localhost');
	define('DB_CHARSET', 'utf8');
	define('DB_COLLATE', '');
}
else
{
	//production config:
	define('DB_NAME', 'prod_db_name');
	define('DB_USER', 'prod_user');
	define('DB_PASSWORD', 'prod_password');
	define('DB_HOST', 'prod_server');
	define('DB_CHARSET', 'utf8');
	define('DB_COLLATE', '');
}

That's one less thing to worry about.

Database Export and Clean-up

I like using PHPMyAdmin for quickly exporting and importing between databases. But regardless of what tool you use, WordPress stores the full URL in the database (something I find very annoying) so you'll also have to clean-up your database - these SQL commands have served me well:

1
2
3
4
5
6
7
8
9
10
11
--
-- run after doing an import
--
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://dev_host', 'http://www.prod_domain') 
WHERE option_name = 'home' OR option_name = 'siteurl';
 
UPDATE wp_posts SET guid = REPLACE(guid, 'http://dev_host','http://www.prod_domain');
 
UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://dev_host', 'http://www.prod_domain');
 
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://dev_host', 'http://www.prod_domain');

.htaccess

Depending on how your development environment differs from production, you might also have to change your .htaccess file. You could of course just edit the file, but I find the easiest for me is to:

  • Log into the WordPress admin (/wp-admin)
  • Expand the Settings tab, then click on Permalinks
  • Clicking on "Save changes" re-writes the .htaccess file

This is a tried and tested method I've been using a lot - but I'm curious to know how you do it. There might be some great plugins or tools that do all (or most) of this for you.

14Apr/100

Recompile invalid objects in an Oracle schema

To compile all procedures, functions, packages, and triggers in a specific schema:

EXEC DBMS_UTILITY.compile_schema(SCHEMA => 'SCHEMA_NAME');
Tagged as: No Comments
14Apr/100

Cancel Oracle shutdown

You might want to cancel a shutdown if you issued the wrong command when there were connected users.

If you try to shutdown immediate from another session, you’ll get this:

SQL> shutdown IMMEDIATE
ORA-24324: service handle NOT initialized
ORA-24323: VALUE NOT allowed
ORA-01089: IMMEDIATE shutdown IN progress - no operations are permitted

When you issue a shutdown, only the SYS/SYSTEM user will be able to connect, so open another SQL*Plus session and type this:

CONNECT /AS sysdba
startup force
Tagged as: No Comments
14Mar/100

Backing up an Oracle database without RMAN

If you aren’t using RMAN for your backups (and are using something like Netapp’s snapshots, or the simple copy-command) (in Oracle 9i this can only be done when the Database is in mounted-mode, not opened), you can do this:

Note: Archivelog must be enabled for this to work.

ALTER DATABASE BEGIN BACKUP;

At this point, you can begin copying/taking snapshots. When you’re done:

ALTER DATABASE END BACKUP;

In older databases, you’ll have to use (run for every tablespace):

ALTER TABLESPACE tablespace_name BEGIN BACKUP;
ALTER TABLESPACE tablespace_name END BACKUP;
Tagged as: , No Comments
11Mar/101

Quote from ‘Kafka on the Shore’ – Murakami

I love how random Haruki Murakami gets:

"Are you really Colonel Sanders?"
Colonel Sanders cleared his throat. "Not really. I'm just taking on his appearance for a time."
"That's what I thought," Hoshino said. "So what are you really?"
"I don't have a name."
"How do you get along without one?"
"No problem. Basically I don't have a name or a shape"
"So you're kind of like a fart."
"You could say that."

Tagged as: , 1 Comment
11Mar/100

Design Inspiration: Maryland Security Professionals

http://www.marylandsecurity.net/

Bear