Handy command to mass-drop all tables:
$ drush sql-dump | grep DROP | drush sql-cli
Handy command to mass-drop all tables:
$ drush sql-dump | grep DROP | drush sql-cli
Question from a long-time client and friend, who runs a web agency: “I’m getting a demo of SalesForce’s new SiteForce CMS next week with a client in the SF Bay Area. In order to evaluate it properly, what questions do we need answers to? Can you please put together a list for me?”
When evaluating a new CMS with no particular project or client in mind, the questions that come to mind are:
Add a comment if you think I missed anything important.
Question from a colleague: “I have both Drupal 6 sites (Ubercart) and Drupal 7 (Ubercart or Drupal Commerce) sites that need shopping cart integration. Do I need to have the PayPal $30 a month merchant account to integrate using the API? Or can I integrate with the “free” PayPal account?”
There’s two (or more) ways to integrate Paypal – Website Payments Standard and Website Payments Pro. The simpler option takes the user via Paypal to process the payment and is free to implement. The “white label” version where the user never leaves your site is paid.
Used Paypal with UC a few times and it’s always been easy to implement and hassle free. The Payments Standard does allow paying with a credit card but users can get confused and the conversion rate drops because they assume they need a Paypal account to pay (they do not, but the option to pay using a CC with no Paypal account is a bit hard to see).
If you expect a lot of people checking out who do not have Paypal or don’t understand the system (ie. non-technical users), and a 5-10% drop in conversions is greater than the monthly price of Payments Pro, then it’s worth upgrading to the Pro version. Also, if you’re going to be doing mid-$x,000+ a month in transactions then compare the cost of Paypal to the cost of a full authorize.net merchant account, as there’s a point where Paypal’s high fees make it cheaper to go with a traditional merchant account.
Original discussion (that people requested I write up as a blog post): http://groups.drupal.org/node/165544
Helped a client work through some issues with their support ticket workflow for a large enterprise Drupal website. Too many issues were being defined as high priority or urgent – making it difficult to spot what was a real emergency. We came up with these guidelines for priority assignment:
Depending on the organization, Urgent and Immediate issues may also trigger a page to senior management and require providing a status updates to them before the issue can be signed off as completed.
Filed under Project Management
Useful query to seed a database table with random numbers. I used this for testing a support desk application:
UPDATE support_ticket SET priority = CAST((RAND() * 3)+1 AS UNSIGNED);
Where “3″ is the highest number in your range. By default, numbers range from 0-3, but in our case we needed to set the numbers from 1-4, so we set our max as 3 and add one at the end.
Drupal 7′s DBTNG database abstraction layer introduces the db_merge() command which replaces the if($id) { db_update() } else { db_insert() } construct. Very useful.
One issue I ran into is retrieving the last MySQL insert ID. db_insert() returns the ID as expected, but db_merge() only returns a STATUS_INSERT or STATUS_UPDATE integer value, which isn’t much good for anything.
Reading through Drupal 7′s source code, modules/simpletest/tests/database_test.test contained an elegant solution where we run a SELECT query using the known values to pull the row back out of the database, where the ID is correctly set.
$result = db_merge('test_people')
->key(array('job' => 'Presenter'))
->fields(array(
'age' => 31,
'name' => 'Tiffany',
))
->execute();
$person = db_query('SELECT * FROM {test_people} WHERE job = :job', \
array(':job' => 'Presenter'))->fetch();
$last_insert_id = $person->id; // Core test does not actually include an ID,
// but this is how it could work
Filed under Code
MySQL originally used the latin1 character set by default which stored characters in a 2-byte sequence. In recent versions it defaults to UTF-8 to be friendlier to international users.
When migrating MySQL databases, occasionally you’ll see odd characters appear on the new system. For example, a simple quote mark may be replaced by 4-5 characters of junk symbols.
This happens when MySQL is trying to display characters using a different character set to the one they are stored in. To fix, we need to make sure the database is marked as latin1 when we export it from the old system, and then re-encode it into UTF-8 when importing it into it’s new home.
mysqldump -u $user -p --opt --quote-names --skip-set-charset \ --default-character-set=latin1 $dbname > dump.sql
mysql -u $user -p --default-character-set=utf8 $dbname < dump.sql
Filed under Code