Author Archives: mfrank

mfrank

About mfrank

Professional Developer of SwhistleSoft

MySQL Singleton Class to allow easy and clean access to common mysql commands

The MySQL Database class is implemented using the singleton design pattern. This design pattern allows for only one single instance of the object. This one instance can then be obtained through a static method. This provides a convenience in that you can get your database object from anywhere in your code.
Continue reading

Database PHP Session Handling

Database PHP Session Handling

As you should be aware the HTTP protocol, as used for serving web pages, is completely stateless. This means that after the server has received a request, processed it and sent a response, the process which dealt with that request dies. Anything that the process had in its memory therefore dies with it, so when a subsequent request is received from the same client it is unable to refer to its memory about anything that happened previously.
Continue reading

A JQuery Print Library that fixes the IE7 Shrink-to-Fit issue

There is an option in most browsers called “Shrink-to-Fit”. This is a page setup configuration that, if turned on, will attempt to scale the web page in size to make it fit on the selected paper size you are printing to. The scaling mechanism also attempts to scale it to a size that will fit on the least amount of pages. Although this does make sense when you are trying to print an actual web page, it can be a nightmare for web application developers who are trying to control the print job. For example, say your web application produces a Invoice for a customer. As a developer you want to try to control the layout of the invoice so you probably have a print.css file and you already have taken into account the page layout specific for a print job.
Continue reading

JQuery UI Draggable – data(…)options is null or not an object in IE7

I was working on a project that allows the users to create a list of names in their account. They could then take a name from the global list and drag it to a recipients list to send a mass email to everyone in that list. To accomplish this task and make it look good I decided to go with the great JQuery UI library’s (draggable and sortable to b specific).

Continue reading

Disappearing JSTree when using Themeroller

I am currently working on a project that utilizes a MySQL Nested Folder database design and a JQuery component called JSTree. The implementation actually works great. The system allows users to create “folders” for content and provides the ability to Drag and Drop to move folders, create new folders and sub-folders, etc.

After entering the testing phase of the project we discovered that the folder tree view, powered by JSTree, was not working. The tree would load on the page and then disappear. I spent a solid 12 hours trying to debug what the issue was because it works flawlessly in IE8, IE9, Fire Fox, Chrome, Safari, and Opera. This problem seemed to be isolated to IE7 only. I flipped flopped between potential causes several times — could it be a Javascript issue? could it be a CSS issue? could it be both?

Continue reading

How to ZIP files with PHP

Most web servers these days run on a LAMP configuration (Linux, Apache, MySQL, PHP). Because the Operating System is Linux, the default archival and compression utilities are TAR and GZIP resulting in files like “filename.tar.gz”. There is nothing wrong with these utilities, however, if you are providing a visitor to your web site with a dynamic download of archived files you would probably want to provide the files in the very well known compressed format (typically used on Windows OS computers).