Archive for category Learning

Doctrine ORM – Set a Custom Parameter

In order to set a parameter on a Doctrine object that doesn’t exist from your database, use the mapValue() method:

$record->mapValue(‘name’, $value);

No Comments

Strongmail API PHP Sample Code

Strongmail is a mail delivery company that we began using about a month ago. They’ve got an amazing delivery platform and are a very world class company, except when it comes to their API. With a lot of the stuff that we do, we needed to have a mail auto-responder, and unfortunatly that’s one feature that Strongmail doesn’t provide. The solution is to code the auto-responder yourself and then use the Strongmail API to send the emails on a transactional basis.

I wondered “how hard can it be?” I’ve worked with Authorize.net’s API, Twitter’s API, Facebook’s API, Paypal’s API, you name it. When it comes to working with an API, it’s not that challenging for me… Until Strongmail came along. They sent me the documentation, and I was immediatly lost. The API is a SOAP based API (not that untypical), but their documenation is horrible, so I asked if they had any sample code to implement it with PHP (not that untypical). They provided me with some sample code and it immediatly game me errors.

Turns out it was meant to run on a PHP server that doesn’t have SOAP compiled in with it… well, that’s a problem I tell them. I try to get their help on the errors I’m getting, and with such little documentation on how the API works, and what options are needed for each call it’s pretty much like throwing a rock at a bucket in the dark from 50 yards away and trying to hit it. I was in desperate need of help. I finally got one of their professional service members to take me seriously and start providing some actual help, but even then it seemed futile.

Last night I finally cracked it. Everything began working! I ran into a couple of small errors, but they were easily solved and it began working! After two long weeks of sending code back and forth, reporting error codes, deciphering documentation I finally figured it out on my own. They bill us thousands of dollars a month for their service, and I had to show THEM how their own API works.

If anyone out there finds themself in the same situation, I’m providing you with the sample code that I rewrote for them. I asked them to make it available in their support site, but I don’t know if they will or not. I really hope this sample code can help someone out there that’s trying to do the same thing.

SAMPLE CODE

2 Comments

Changing Front Door Speakers in 2005 Toyota Corolla S

I got a couple of speakers from a friend on mine to put into my Corolla. It’s a 2005 S model, and this is only my second time replacing speakers in a car. I tried to look up some info online about how to do it, but there wasn’t a whole lot of info and there certainly weren’t any pictures to go along with it. I will show you how I replaced the stock speakers and if you have any questions at all, just post them in the comments.

Tools

Tools

Tools:

  • flat head screwdriver
  • philips screwdriver
  • wire strippers
  • wire cutters
  • cordless drill
  • 1/8″ drillbit
Remove arm rest

Remove arm rest

The arm rest comes off fairly easy just using your hands.

Remove electronic panel

Remove electronic panel

Removing the electronic panel was a little tricky. Use the flathead screwdriver to pry up the top (closest to door hinge) side first, then slide it forward as you pull it out.

Hidden screw behind door handle

Hidden screw behind door handle

Remove this hidden screw and the two screws under the arm rest.

Door is removed

Door is removed

Pull off the tweeter cover to make removing the door panel easier. I just started at the top of the door and worked my way down, there are little plastic snaps that hold it on and the whole door came off really easy.

Close up of stock speaker

Close up of stock speaker

They decided to use rivets to hold on the stock speaker, so I got out my drill and drillbit. Drill in the center of the rivets about a quarter of an inch. Using your flat head screwdriver you can now pry off the flat part of the rivet that you can see. Now you have to wedge the screwdriver into the sides of the speaker mount to pry it off the door. It will give you a little trouble, and don’t worry too much about the rivets deforming the holes.

Holes drilled for new speaker mount

Holes drilled for new speaker mount

With the stock speaker removed, I had to drill two new holes for the new speaker mounting. I still just used the 1/8″ drillbit.

White to Pink, Black to Purple

White to Pink, Black to Purple

I’m not an expert on wiring… but I do know you should never cross wires. Unfortunatly Toyota does not label which wire is ground. My reasoning was to pair up the lightest colors and the darkest colors. The speaker still works and sounds good, so I hope that’s how it’s done. Good luck with that. I had to manually wire it because the car harness was different than the speaker harness.

Finished installing new speaker

Finished installing new speaker

Wrap the wires in electrical tape and I’m done! I had to mount the speaker upside down to give me a little more room for the wiring. Now you just have to snap the door back on and screw in the three screws!

If you have any questions at all, I’ll try to answer them. I’m by no means an expert, but hopefully this will help you out a little.

1 Comment

Making A DOS Bootable USB Flash Drive

If you have a computer that has a damaged CD-ROM or no CD-ROM at all, then you’ll need a DOS bootable USB Flash Drive. I recently had to make one for myself and while there were a lot of articles about it on the internet, they were either out-of-date or very confusing. Here is what you need before you get started:

  1. USB Flash Drive that is capable of being bootable (nearly all USB Flash Drives made in the last 2 years have this capability).
  2. Computer with a mother board that supports booting from a USB device (again, virtually all modern mother boards support this).
  3. HP USB Disk Storage Format Tool here
  4. Windows 98  boot files here

Step 1 – Preparing Files

  1. Download and install the HP USB Disk Storage Format Tool
  2. Download and extract the Windows 98 boot files to any location on your hard drive. I extracted them to C:/bootdisk

Step 2 – Formatting USB Flash Drive

  1. Launch the HP USB Disk Storage Format Tool

    It will look disabled at first

    It will look disabled at first

  2. Insert your USB Flash Drive. In this case I’m using a 512 mb Cruzer Mini, and the program comes to life.
  3. Select FAT32 for the file system
  4. Check Quick Format
  5. Check Create a DOS startup disk
  6. Cick the three dots and browse to the location that you extracted the boot files to (C:/bootdisk)
    02
  7. Click on Start
  8. It will prompt you that you will lose all data on the Flash Drive, click on Yes.
    03
  9. Once it’s finished you’ll get a report that looks something like this:
    04
  10. Click on OK, then close the application
  11. Open your USB Flash Drive and you will see that there are no files on it
  12. Copy all of the files from the C:/bootdisk folder to your USB Flash Drive but DO NOT OVERWRITE ANY EXISTING FILES (there should be 2 files it will ask you if you want to overwrite)

Done! Now all you need to do is restart your computer and interrupt the startup process so that you can choose which device to boot off of (or manually change your BIOS to boot off of the USB Device before it boots off of the hard drive) and boot off of your USB Flash Drive. You should see a quick Windows 98 splash screen then a DOS prompt. You should have all the cool tools like fdisk, smartdrv, and format, plus quite a few others.

No Comments

Microsoft SuperPreview

Microsoft has released a tool that will let you compare different versions of IE side-by-side. It’s super nice being able to test how a website looks in IE 6 without hunting down an old Windows XP machine or setting up a local virtual machine.

Download

4 Comments

Fixing Transparent .png Images in IE 6

Just found this great plugin for jquery that worked like a charm and wanted to pass it on!

http://allinthehead.com/retro/338/supersleight-jquery-plugin

No Comments

Amazon Elestice MapReduce

A new service by Amazon has surfaced. It combines their computing cloud with their storage surface to bring the power of super computers into your backyard. It is meant for heavy and intensive jobs like web indexing, log analyzing, or even scientific simulation. It is basically an automatic interface that will create your computing cloud instance, allocate the proper resources, do the job, then remove the computing cloud instance. You only pay for the resources you use.


http://aws.amazon.com/elasticmapreduce/

No Comments

A Developer’s Furniture

I recently had someone at work call me a furniture expert. I don’t know if I’m an expert, but I sure am very particular about my work space and with good reason. For someone that spends as much time as I do in front of a computer, I need to take care of myself so that I remain efficient, comfortable, and durable. It starts with the chair. You should never get a cushy chair, this will only promote slouching and will lead to back problems. Get a chair that is firm, put it up as high as it will go, and lock the tilt mechanism. Uncomfortable? Maybe a little, but your back will thank you.

Since I’m a developer, my stress ball mouse and keyboard get the most action at my desk. Don’t EVER get a wireless mouse or keyboard. I have tried almost 20 different models, and every wireless device that I tried had some delay, or simply didn’t register my key strokes. Maybe I just type faster than electrical impulses travel… Get a mouse with a high DPI setting, this will typically be a gaming mouse. However, DON’T get a gaming keyboard. Be sure to get a smooth, cute EXPENSIVE mouse pad as well. To top it off, get a wrist rest (with beads) for your mouse wrist, and use an ergonomic keyboard that will keep your wrists straight with your forearms.

No Comments

Smarty Iframe Plugin

Here is a plug-in for PHP Smarty Template engine that will allow you to display an iframe. Just unzip it into your Smarty plug-in folder.

functionhtml_iframe.zip

No Comments

AMember Cancellation Script

This script is absolutely free to use! I hope that others can find this script helpful. If you have
any feedback or problems with it, please email me at tim@golen.net and I will try to help you out.

PURPOSE
This script is a basic API to expire a membership in AMember. It will look up an AMember account
based on AMember ID, or email, or first and last name. It will then set the expired date for a
subscription to a date in the past. The effectively cancels the subscription, but it keeps
all of the data intact in the database. This script does nothing to cancel payments, it just expires
the subscription.

FEATURES
- Looks up an amember account by amember id, or email, or first and last name
- variables can be passed as GET or POST
- password protected
- expires accounts so all data is left in tact
- can be used by payment gateways to expire a membership if the payment subscription is cancelled
(see advanced use section)
- debug features
- sends an email on success and failure

amembercancel.zip

- 2009-11-28 Update: there was an error in the cancel.php file that wasn’t allowing the script password to work properly.

1 Comment