Today’s Coding Challenge November 9, 2008 3:55 pm
Posted by Doug McCaughan in : PHP, Programming, Technology, jQuery , 2commentsIn one of my applications, I use jQuery’s UI Datepicker as part of the interface for easy date selection in adding and editing some data. I have two screens that show the current date. One screen is a report that says "Today’s date is…" and shows the current date. The other is the form for adding this data. The datepicker calendar is supposed to default to today’s date.
Problem 1: On the development server, the report and the form both default to today’s date. On the staging server, the report and the form both default to today’s date. On the production server, the report defaults to today’s date; the form defaults to December 31, 1998.Solved. In a special case, a null string was being passed when a date type was expected.
Problem 2: When editing, if the date is in the current monthmonths of March and November, the highlights for datepicker don’t work. The day still gets selected appropriately but the date itself is never highlighted making the user think they didn’t click the date. Click to see a working example of the problem. Update: This is partially fixed. In UI version 1.5.2, the highlight does not work in November or March. This is demonstrated at http://sidesigns.com/pub/datepicker/index152.php. I tested with the 1.6rc2 release candidate and November now works but March is still not highlighting correctly (the first week highlights but no others). This is demonstrated at http://sidesigns.com/pub/datepicker/index16rc2.php. I’ll be submitting a bug report to the jQuery UI team.
Today’s Programming Challenge November 7, 2008 12:06 pm
Posted by Doug McCaughan in : PHP, Programming, Technology , add a commentI am working on a PHP application that is mysteriously losing the value of a particular session variable. There is only one place in all the code that the variable is set. All comparisons have been confirmed as comparison operators == instead of assignment =. In debugging a vardump shows the variable as:
["foo"]=> &string(2) “35″
and a second later it becomes
["foo"]=> ∫(35).
Does the ∫ symbol mean undefined? And if so, why does it still show the value? echo “***”.$_SESSION['foo'].”***” shows ****** in the later instance and ***35*** in the previous.
Ah ha! It’s the integral symbol. I just didn’t expect to see that in debugging. Why is my string suddenly an integral?
Update: From the notes on vardump "Now ∫ translates into an integral sign, and since the browser may be inclined to overlook the missing semicolon, you may be seeing integrals where you were expecting &int"
Update: Solved. A locally scoped variable of the same name was being set to null. I’m still unclear on why the session variable would assume the value of the locally scoped variable.
add a commentCode Buzz October 20, 2008 10:36 am
Posted by Doug McCaughan in : AJAX, Daily Life, JavaScript, PHP, Programming, Technology , add a commentRunners get a runner’s high. I’ve got a coder’s high. My head is buzzing as I’ve been hitting the keys hard. My current PHP application has dynamic content loaded via AJAX but when the user navigates with the browser’s forward or back buttons the state is lost, that is, all the dynamic content disappears. Also if the natural navigation of the application takes the user away from the dynamically generated content, when they return the content is lost and the user frustratingly has to drill down, dynamically loading more content, to get back to where they were. Using jQuery, some custom JavaScript, and some fandangled PHP, I have overcome this obstacle and created a state engine that remembers which content was loaded and re-presents it on the screen whenever the user navigates with the browser’s forward or back buttons or the applications natural navigation. I’ve just finished the behind the scenes mechanics of this code and now have to fix the presentation level (after a 10 minute break). Whew! This was fun!
add a commentDailyWTF August 5, 2008 6:33 am
Posted by Doug McCaughan in : PHP, Programming, Technology , add a commentI wrote this piece of rocket science last night:
<select id="birthdateyear" name="birthdateyear">
<?php for($byear = date("Y",time()); $byear >= 1901; $byear--){ ?>
<option value="<?php echo $byear; ?>" <?php if($birthdateyear == $byear) echo "selected"; ?>><?php echo date("Y",mktime(12,1,1,1,1,$byear)); ?></option>
<?php } ?>
</select>
And that is why you shouldn’t code tired.
add a commentWhy PHP drives me batty! April 15, 2007 2:22 pm
Posted by Doug McCaughan in : PHP, Programming, Technology , add a commentDo you use date() or date_format()? Want to have some real fun? Let’s debate the most correct way to read a file!
add a commentError converting tiff to pdf November 22, 2006 10:54 am
Posted by Doug McCaughan in : Daily Life, PHP, Programming, Technology , 1 comment so farSo I am trying to deploy the website I recently completed. Deploy? That means move the site from a development server to a production server where the world can see the application in action. It took this long to deploy because the webhost was running PHP 4.0.0 and had to upgrade to at least PHP 4.4.4 (went to 5.1.6 which is nice). However, they did not take the extra 10 minutes it would have taken to include CURL support.
So, the dev works great using CURL to pull a series of tiffs from another server, then using the Zend Framework, combine those tiffs into a single tiff, and finally convert the tiff to a pdf. I moved the code to the production server and it works fine until we get to converting the tiff to a pdf. It actually converts but the pdf is unviewable simply producing the error "file does not begin with ‘%PDF-’." These kinds of problems are why developers never make their deadlines. I am working on the presumption that I failed to write some header information into the file. I want this over.
1 comment so farOh yes! Program done! November 4, 2006 4:32 pm
Posted by Doug McCaughan in : Daily Life, PHP, Programming, Technology , 1 comment so farI now have successfully written a PHP program that goes to another website, downloads any number of tif files (one test used 48), combines them into a single tif file, converts the tiff to a single pdf file (48 tiffs become a 48 page pdf), and presents the new single pdf and single tif to the enduser for downloading or viewing. This was a nightmare and has cost me dearly. It is done and I can move on.
1 comment so farGood Regular Expressions linkage October 13, 2006 2:41 pm
Posted by Doug McCaughan in : PHP, Programming, Regexp, Technology , add a commentFor you programmer types working through painful regexp problems, you may find The Realtime JavaScript RegExp evaluator very handy. If you are working in PHP, remember that PHP uses a couple of different regexp syntaxes.
add a commentLower the bar! October 3, 2006 9:35 am
Posted by Doug McCaughan in : Daily Life, PHP, Programming, Technology , 2commentsI have to quit taking on the impossible projects.
What am I doing now? My current contract is to allow a user to enter a single product id or a list of product ids then go out to a government website and download the 17 or so pages of pdfs for each product. Then I combine the multiple pages of pdf documents into a single pdf document and present it to the user for download to their local machine. I may end up inserting footer information into each page of the pdf. I have to do this for 4 different countries. Then I have to convert the code from php 4.4.4 to php 4.0.0.
2commentsCoding hurts June 27, 2006 3:46 pm
Posted by Doug McCaughan in : Daily Life, PHP, Programming, Smarty, Technology , 1 comment so farThis is the stuff that makes my eyes bleed:
<FORM action="{$register_script_name}?{$smarty.server.QUERY_STRING}" method="POST" name="registerform"{if $js_enabled} onsubmit="javascript: if (check_zip_code(){if $default_fields.email.required eq 'Y'} && checkEmailAddress(document.registerform.email){/if}) return true; else return false;"{/if}>
PHP Programmer in Knoxville Needed Immediately June 22, 2006 8:26 am
Posted by Doug McCaughan in : Announcements, Of Interest, PHP, Programming, Smarty, Technology , add a commentOne of my clients is allocating some budget to bring on an assistant to help help a project we are doing. If you know PHP (and Smarty would be a bonus!) and are available for parttime or fulltime contracting for a few days, contact me with a rate. We are making customizations to x-cart.
add a commentSimple is never simple May 21, 2006 12:13 pm
Posted by Doug McCaughan in : ColdFusion, Daily Life, PHP, Programming, Technology , 3commentsSo I take on two quickie low cost, fast turn around projects and they are eating me alive!
The first is a ColdFusion reporting project that is simply supposed to take the existing statistics report and produce a chart using CFChart. Works fine on my CFMX6.1 development server but apparently IIS6 and CF7.1 don’t play nice when it comes to CFChart. The problem is with IIS but Adobmedillare has been kind enough to release a hot fix that doesn’t work. "This hot fix explicitly generates HTTP headers before the chart data."
The second simple project is a PHP COTS shopping system (x-cart) that needs some customization. Only, it’s not using PHP per se. The customizations are all done using SMARTY. The challenge with programming, particularly web application programming, is constantly having to learn new languages/frameworks/methodoligies and being able to turn work like its old hack.
Using this simple CFChart example works in CF6.1 and fails in CF7.01 even after the hot fix.
<cfchart>
<cfchartseries type="pie">
<cfchartdata item="New car sales" value="50000">
<cfchartdata item="Used car sales" value="25000">
<cfchartdata item="Leasing" value="30000">
<cfchartdata item="Service" value="40000">
</cfchartseries>
</cfchart>
Anyone have extra tickets for CFUnited? I’d love to go this year but can’t justify the cost of the event.
UPDATE: Just tried the ColdFusion MX 7.0.1 Cumulative Hot Fix 2 with no luck. Note the hot fix advises:
Any individual hot fixes previously installed that are now contained in this cumulative hot fix should be removed.
…
we recommend always using the latest version of the cumulative hot fix
In short, remove any previous *.jars and only install the latest fix.
3commentsSeeking PHP Programmer in Knoxville April 24, 2006 9:46 am
Posted by Doug McCaughan in : PHP, Programming, Technology , add a commentAny bored (ie. time on your hands) PHP consultants about willing to assist on a fixed rate project? If so, drop me a line at juggler@gmail.com. Work doesn’t have to be onsight but it does need to be done in Knoxville.
add a commentProgress! March 26, 2006 7:11 pm
Posted by Doug McCaughan in : Daily Life, PHP, Programming, Technology , add a commentToday I have coded like a mad man. Pending client approval, I have put a project to rest and enjoyed myself in the process! Next…
add a commentAnother Anti-PHP Rant February 22, 2006 5:57 pm
Posted by Doug McCaughan in : ColdFusion, PHP, Programming, Technology , add a commentAnother person frustrated with PHP. Oh how I love ColdFusion!
add a comment




