• blog
  • about
  • portfolio
  • contact
  • login

del.icio.us

  • Ecommerce SEO Checklist
  • Ecommerce SEO Checklist
  • Changes coming to improve CC security | Ubercart
more

Recent comments

  • Re: Killing hung SyBase clients
    3 weeks 17 hours ago
  • ok
    6 weeks 4 days ago
  • Cool
    6 weeks 4 days ago
  • :)
    19 weeks 2 days ago
  • Interesting Post about modules
    19 weeks 2 days ago
  • Indeed you are ;) Charlie
    22 weeks 3 days ago
  • Am I the first one to
    22 weeks 4 days ago
  • looking great
    24 weeks 5 days ago

What's wrong here?

Submitted by jason on Thu, 03/20/2008 - 06:04.

/**
# Version: this is the API version in the request.
# It is a mandatory parameter for each API request.
# The only supported value at this time is 2.3
*/

define('VERSION', '3.0');

This is from the Paypal NVP API SDK example code.

  • code
  • lol
← tags
  • jason's blog
  • Add new comment

Avoiding Java Properties Stupidity

Submitted by jason on Wed, 02/20/2008 - 23:49.

I just spend the last several hours figuring out why my application won't talk to a couple of external services that I'm integrating with. For future reference, when using java.util.Properties,

key=value

behaves as expected (storing value into props.getProperty("key"))), while

key="value"

wraps the values in quotes, which is not at all what I wanted. I only caught this because I was noticing spurious quotes in my debug logs :)

I'm now off to recapture the time lost figuring this out.

  • java
← tags
  • jason's blog
  • Add new comment

Killing hung Sybase clients

Submitted by jason on Thu, 01/03/2008 - 00:35.

At my day job, we use Sybase for our database servers. From time to time, I have to reload databases from saved dumps for development environments. This can sometimes be a pain when people have forgotten to log out from the database (especially after they've all gone home :) ). I did some quick research and figured out that (with the appropriate privileges) you can kill off the offending processes.

First, find the offending process by listing connections using sp_who.

Then, select the process that you need to kill off and do so by using the kill command

kill <spid>

It's straightforward and obvious, but quite helpful for those cases when I need it.

ref: Sybase Manual

  • database
  • sybase
  • work
← tags
  • jason's blog
  • 1 comment

Distributing modules with install scripts

Submitted by jason on Thu, 12/13/2007 - 05:59.

So you've created the next great Drupal module that change the world, it works, and you're all set to go. But then you consider what it takes to get the module running, and realize it's nontrivial for an ordinary user to get things up and running. Most of the contrib modules that you can pull from Drupal.org don't have this problem; normally one plugs them in, enables them, and away you go (with the occasional exeption of a module which needs external code added by hand due to license restrictions).

I've run into this problem a couple of times, and yesterday I figured out how to set things up for installation. Modules are allowed to have modulename.install scripts which export implementations of hook_install() and hook_uninstall(), which are invoked on a module being installed for the first time, and being uninstalled.

In my case, I want to enable a new CCK type upon my module being installed. This means that the module requires both the Content (CCK) module and Content Copy (which is distributed as part of CCK). To make a note of this, I added both modules to my dependency list in my modulename.info.

dependencies = content content_copy

Now that we have the dependencies being enforced by the system, let's fill out our install hook, shall we? In this case, we are going to import a CCK type that I had previously created upon module installation. I grabbed the code for doing this import from Snipplr.

Here's the contents of my modulename.install file:

/**
 * Implementation of hook_install().
 */
function modulename_install() {

	include_once('./' . drupal_get_path('module', 'node') . '/content_types.inc');
	include_once('./' . drupal_get_path('module', 'content') . '/content_admin.inc');

	$cck_definition_file = './' . drupal_get_path('module', 'modulename') . '/ccktype_export.txt';

	watchdog('modulename', "loading CCK type from $cck_definition_file");
	
	$values = array();
	$values['type_name'] = '';
	$values['macro'] = file_get_contents($cck_definition_file);
	drupal_execute("content_copy_import_form", $values);
}

My uninstall hook is empty for the moment, but I would imagine I should remove or disable my custom CCK type on uninstall.

Also, note that disabling a module does not uninstall it (nor run the uninstall hook). To uninstall a module you disable it, then go to the 'Uninstall' tab on the page and from there select the module for deletion. It turns out that even then, the module is not completely cleaned out from the system. To completely remove the module (and, it turns out, to get the install hook to fire on module enable), you have to go into the database and remove the module reference from the system table. I haven't had the chance yet to see if removing the line from the system table is an action commonly taken by modules in their uninstall hooks.

  • drupal
  • initsoft
  • modules
← tags
  • jason's blog
  • 4 comments

Porfolio Implementation

Submitted by jason on Mon, 12/10/2007 - 16:37.

For the portfolio entries, I settled on using the CCK Slideshow module, which takes one or more images uploaded to a node using the Image CCK field, and renders them as a javascript slideshow which can be configured to automatically rotate images.

This ended up working quite well, and you can see the results on the portfolio page. This module satsfies some of the same requirements that I had for Mariska's Designs (still in progress), where individual products for sale needed image galleries. For that project, I hacked up a solution which rendered images uploaded as node file attachments as a flash-based gallery using the excellent SimpleViewer gallery.

  • drupal
  • esc
← tags
  • jason's blog
  • 2 comments

Update

Submitted by jason on Thu, 12/06/2007 - 20:43.

I was getting tired of looking at just the one post, so I thought I'd add one more with a list of things that I've still got outstanding:

  • Add portfolio entries and figure out how to get associated images displayed nicely
  • Add pathauto so that we get clean, accessible URLs
  • Add poormanscron for search indexing, if it's not already there

Looks like we're there! I just need to actually start generating content worth reading. Site architecture, easy. Generating worthwhile content? Another thing entirely :)

  • esc
← tags
  • jason's blog
  • Add new comment

Almost there

Submitted by jason on Sun, 11/25/2007 - 07:30.

I've got a decent start on the site theme, which I've based off the so-far-excellent Deco template. I'm ironing out a couple of bugs with some design elements, then we should be ready to roll.

My intent is to discuss items of technical interest here, as discovered during the course of my work. I hope to keep track of lessons I've learned and solutions I've come up with, and I also hope to share the knowledge I've gained with the community and make some issues easier for others.

  • esc
← tags
  • jason's blog
  • 1 comment
Syndicate content

Copyright © 2007 Eat Sleep and Code

Associates

  • Ask Julie
  • Ingrafted Software
  • Initsoft
  • San Bei Ji

Search