Posted on 2 Comments

Today’s Coding Challenge

In 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.

Posted on Leave a comment

Today’s Programming Challenge

I 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.

Posted on Leave a comment

The Joy of Software

I’ve written this PHP application. I work on a development server. Then I move code to a staging server for preliminary testing and client approvals. When the code is ready, it gets moved to a production server. In an ideal world, dev, staging, and production would all be configured identically. In the real world, you get different operating systems, different versions of the middleware application software (PHP, ColdFusion, .NET, etc.), different version of the databases, drivers don’t match, security patches are applied on one server but not another, and so forth.

So, this PHP application has a calendar piece for associating a date with a form collecting data. When adding a new thing, the form should have certain default values and the date should automagically show today’s date at 00:00 hours for the starting date and today’s date at 00:14 hours for the ending date. This works great on the development server. This works great on the staging server. But on staging, the date defaults to December 31, 2008 at 19:00 hours for the first date (the beginning date) and December 31, 2008 at 00:14 hours for the second date (the ending date).

It’s the little that make life so interesting and keep the padded rooms booked up.

Posted on Leave a comment

jQuery’s datepicker driving me nuts

I love jQuery! And its UI library. But I’m having difficult implementing a simple date picker. The datepicker method is throwing an error for me: "inst is undefined datepicker" The solution of adding "{onSelect: function() {}}" did not work. I’m at the point of no return. Choosing a different calendar application.

Update: Solved! I had an artifact left over from trying to implement the Yahoo! User Interface (YUI) Library‘s calendar. jQuery’s UI datepicker conflict’s with YUI’s datepicker.

Posted on Leave a comment

Code Buzz

Runners 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!

Posted on Leave a comment

And Mariner 1 nosed dived into the ground…

Yup. I’m that guy. The one responsible for the missing hyphen. I’ve been debugging my code. I have a relatively simple action in front of me that is misbehaving. Turns out, I was missing a closing parenthesis. Like Mariner 1, it was a simple mistake with a catastrophic impact…well, nothing blew up on me. I’m just behind schedule for what I wanted to accomplish today.

I’ve always cited the period instead of a comma as causing a space probe to miss its mark but apparently the typo never caused any dreadful results.

Posted on Leave a comment

Dear Open Source Community

If you write code to make my life better, once you release it into the wild, an example does not count as documentation! If I have to spend as much time deciphering your code as it would have taken for me to write it in the first place, you have failed the community. As an open source developer, 1) test your code, 2) show working example, and 3) document it thoroughly!

Posted on Leave a comment

Early Birding It

Productive day ahead! My simple goal today is show results to my client. One of the challenges of freelancing or working remotely is showing results. Sometimes a developer’s time is spent behind the scenes or working through an issue in test files that are isolated from your application. That is how I spent my day yesterday. So at the end of the day, there is nothing to show and if your boss is not in a possible to peek in on you or look over your shoulder than not showing anything is comparable to not working.

Today I rose at 4am, in a jolt. I sprang from bed, sat in the cool air of the morning for a little chanting, bathed and dressed, ate a banana, and got to work. What a great way to start the day!

Posted on Leave a comment

Undo global search and replace screwup

I made a mess. Does anyone remember how to back out of (undo) a global search and replace in CFStudio5? Should be the same process for Homesite+.

Update: Seems like I remember undoing a global search and replace in the past. Fortunately my replace string was absolutely unique and I was easily able to fix this with another global search and replace. The lesson is "don’t start a global search and replace and walk away from the computer for 15 minutes. If you did the find part wrong, you could be faced with many of changes!"

Posted on Leave a comment

Coder’s High

I’ve got that coder’s high right now. I’m in the zone. Yet the clock still speeds by. I can feel the seconds tick in the pulsing throbbing of my wrists as I type at top speed.

Update: Eek! Technologies merging. I just tried to use JavaScript syntax in PHP and when I went to look it up in the PHP docs I searched for a ColdFusion function. May need to slow down just a bit!