PHP $_POST Empty After Setting post_max_size & upload_max_filesize

$_POST was empty! Firebug showed that the web browser was submitting the form’s data to the server. Yet, for some reason, PHP was not putting the data into the $_POST array. If I switched the form’s action from POST to GET, PHP properly populated $_GET. What was wrong with $_POST?! Continue reading

Posted in Programming | Tagged , | Leave a comment

Rake Package Task Fails with Status 127 on Windows

The other day, I tried running a Rake Package task on a Windows system. Rake aborted with “Command failed with status (127): [zip -r Module.zip Module...]“. What could be the problem? Continue reading

Posted in Programming | Tagged , | Leave a comment

Storing Incomplete (Partial) Dates in SQL Databases

Complete (full) dates and unknown dates can easily be stored in a database table via a nullable date column. What about storing incomplete (partial) dates—where the month, day and/or year is unknown? How do we record July 10 (unknown year) or June 2012 (unknown day)? Continue reading

Posted in Programming | Tagged | Leave a comment

Unit Testing & Magento’s Autoloader

If code written for Magento is executed outside of Magento—as occurs when running unit tests—Magento’s normal startup process (which registers its autoload functionality) is not run. Without the autoloader in place, the first time PHP encounters a request to initialize a class which it doesn’t recognize, it will error out with a “class not found” error. Also, without Magento’s startup process running, PHP doesn’t know about the Mage family of singleton methods (e.g. Mage::getModel(), Mage::helper()) which are commonly used to create class instances. Continue reading

Posted in Programming | Tagged , , | Leave a comment

Passing a Memo Field to SAGE Payment Soluations’ Gateway API

In SAGE Payment Solutions’ virtual terminal, transactions have a memo field. However, the gateway’s HTTPS Bankcard Specifications API documentation doesn’t mention a way to programmatically set this field. Using the HTTPS POST API, is there a way to pass in memo text? Continue reading

Posted in Programming | Tagged | 2 Comments

Show Insert File Instead of Record Audio Dialog – FileMaker Pro Container Fields

Click on a container field in a FileMaker Pro form and you’ll be presented with a Record Audio dialog. To store a file or other non-audio content, you must right-click on the field and then choose Insert File (or Insert Image or Insert Object, etc.) from the pop-up menu. When a container field is primarily used to store non-audio content, the required right-clicking quickly gets old. How do you modify a container field’s behavior so that a left-click displays the Insert File dialog? Continue reading

Posted in Programming | Tagged , | Leave a comment

SET FMTONLY ON Changes SQL Control-of-Flow Statement Processing

The other day, my friend Jonathan (of Camenisch Creative) surprised me by pointing out that SET FMTONLY ON changes the way Microsoft SQL Server processes control-of-flow statements (IF…ELSE…END, GOTO, RETURN, etc.)

When SET FMTONLY is OFF (the default), SQL Server processes control-of-flow statements normally. In the case of an IF statement, SQL Server determines which conditional expression evaluates to true and then executes the code associated with that expression. Turn FMTONLY to ON and SQL Server executes every conditional branch, even those associated with conditions evaluating to false!

Continue reading

Posted in Programming | Tagged | Leave a comment

Programmatically Setting a Magento Item’s Price When Adding It to Cart

Using code, how would we give a Magento item a one-time special price then add that item to the shopping cart?

The process is simple:

  • Create an instance of the Magento product,
    • give it a custom price by calling setSpecialPrice,
    • then save the product instance (store must be running as the admin store).
  • Next, grab the Magento cart object (a singleton),
    • add the product instance to the cart,
    • then save the cart.

Continue reading

Posted in Programming | Tagged , | 2 Comments

Can you force .Net garbage collection?

Confusion exists on whether .Net’s GC.Collect() simply suggests or actually forces garbage collection (GC). Thankfully, developers don’t usually need to worry about such mundane details. However, in unusual circumstances—like WeakReference testing (which may rely on predictable, guaranteed destruction of unneeded objects)—particulars like this become vitally important. Continue reading

Posted in Programming | Tagged , | Leave a comment

New Feature: Make the Store Address’s First Line Stand Out on Magento PDF Invoices

Want to make your store name stand out on your PDF invoice (example to the right)?

By default, Magento’s PDF invoice displays your entire store address/information block using the same font/font size. Now, Ben Gribaudo’s Customizable PDF Invoice Module gives you separate font/font size settings for both the store address’s first line and the rest of the address. Continue reading

Posted in Programming | Tagged , | Leave a comment