CakePHP and XDebug

CakePHP LogoSo this is not going to come as much of a shock to people experienced with CakePHP, but I’m just learning now and liking what I’m seeing. CakePHP 1.3 has a really nice set of conventions to work against and provides a seemingly pretty good scaffold for most typical webapps, so I’m thinking I’ll be making some more progress with that. Questions I still need to resolve include:

  1. Does it support jQuery easily enough (CakePHP uses Prototype/Scriptaculous as its default framework, but has provisions for using others)
  2. Is the Ajax-y goodness baked in enough?
  3. Will it really be flexible enough to accomodate my needs?

AS part of this I also ended up installing Xdebug, since that’s the default debugger for CakePHP. I must admit, the things I really like about it so far are:

  1. Ease of install (instructions here got me up and running and a couple of tweaks to my Eclipse PDT setup (which supports Xdebug out of the box – nice!) found here and here got me the rest of the way). The tailored install instructions that analyze your php.ini, provide the correct download and customized install instructions is the coolest thing for a newb like me to get up and running quickly! ;]
  2. Code coverage analyzer! I’m not sure if Zend Debug is able to do the same thing, but that’s way cool!

All in all, looks like I’ve found me a framework I can be happy with – finally! ;]

PHP ZendDebugger and WAMP

So I wanted to write about my woes with PHP ZendDebugger and the latest WAMP install. Bottom line: I can’t get it to work with PHP 5.3 yet. I believe this is an incompatibility in the debugger DLLs that I have been able to find for 5.3 – looks like the linkers used are incompatible with what WAMP is using.

So, here are my findings (in no particular order):

  • PHP 5.3 requires zend_extension whereas 5.2 and prior require zend_extension_ts, so since 5.3 doesn’t work for me yet, I used zend_extension_ts
  • You do not need a separate extension configured for ZendDebugger.dll, contrary to what some posts have you believe…
  • I was able to use the PHP 5.2.11 from the WAMP distribution (click the “Get more…” menu item in WAMP’s task icon and download and install PHP 5.2.11)
  • WAMP’s php.ini seems to be copied to the Apache/bin directory – haven’t figured out why that is yet… So, make sure you’re editing the correct one!
  • I was able to get it to work with these lines added to the end of my php.ini file:
    1
    2
    3
    4
    
    [ZendDebug]
    zend_extension_ts=C:\wamp\bin\php\php5.2.11\ext\ZendDebugger-5.2.15RC1-cygwin_nt-i386\5_2_x_comp\ZendDebugger.dll
    zend_debugger.allow_hosts=127.0.0.1,192.2.3.44
    zend_debugger.expose_remotely=always

    Note the addition of the second host IP there – that’s the actual IP address I was using (well, not really, but you get the point… ;] ) – without that the Eclipse plugin wouldn’t work

  • The ZendDebugger-5.2.15-cygwin_nt-i386.zip using the 5_2_x_comp ZendDebugger.dll (not the 5_2_x_nts_comp!) from here worked for me – YMMV.
  • Otherwise I followed the instructions here

Hope that helps some of you!

Big Bang Theory

So I wanted to look up a Big Bang Theory episode yesterday and I noticed that Google found quite a number of pages referencing it. As a result, I got curious how many results each of the episodes would return. A few lines of Perl code later, here is the result.

(click the image to see a large version)

Big Bang Theory Popularity Chart

It lists the number of results returned for each episode as a measure of relative popularity. Interesting… By the way, I had to cut out the pilot episode because it turns out that the NSTA pilot’s certification requires you to know about the Big Bang Theory… Huh, who knew!? ;]

Here is the Perl code for the previous Big Bang Theory chart. In case you’re interested… ;]

Edited 2011-11-12 to improve the Perl code, removed dependency on having video files to pull titles from and pull from the Wikipedia Big Bang Episodes list article instead.

#!/usr/bin/perl
use strict;
use warnings;
use LWP;
use Data::Dumper;
use File::Find;
use GD::Graph::bars;
use GD::Graph::colour qw(:colours :lists :files :convert);
use List::Util qw /max/;
 
my $googleAPIkey = 'INSERT-YOUR-KEY-HERE';
my $googurl = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=";
my %results = ();
my @csv;
 
my @episodes = &getEpisodeList();
foreach (@episodes) {
  if (!($_ =~ /pilot/i)) { 
    $results{$_} = dosearch($_);
    push(@csv, [$_, $_, $results{$_}]);
    sleep 10;  # Sleep for a while to avoid triggering quota issues
  }
}
 
my @values;
my @keys = sort(keys(%results));
my $key;
foreach $key (sort(keys(%results))) {
  push(@values, $results{$key});
}
my $maxYVal = (max @values) + 100;
print $maxYVal;
 
my $graph = GD::Graph::bars->new(800,600);
$graph->set( 
    x_label           => 'Episode',
    y_label           => 'Popularity',
    title             => 'Popularity of Big Bang Theory Episodes',
    y_max_value       => $maxYVal,
    transparent       => 0,
    bgclr             => qw(white),
    fgclr             => qw(black),
    textclr           => qw(black),
    x_labels_vertical => 1
) or die $graph->error;
my @data = (
  [@keys],
  [@values]
);
my $gd = $graph->plot(\@data) or die $graph->error;
open(IMG, '>BigBangTheoryPopularityChart.png') or die $!;
binmode IMG;
print IMG $gd->png;
close IMG;
open CSV, ">BigBangTheoryGraphData.csv";
foreach (@csv) {
  print CSV join(",", @$_), "\n";
}
 
sub getEpisodeList() {
  my @episodes = `curl http://en.wikipedia.org/wiki/List_of_The_Big_Bang_Theory_episodes | grep '
\\([a-zA-Z0-9 ]*\\).*/\\1/' -e 's/]*>//g' -e 's/"//g'`; return @episodes; } sub dosearch { chomp @_; my ($term) = @_; $term =~ s/ /+/g; my $agent = LWP::UserAgent->new(); my $search = "${googurl}The+Big+Bang+Theory+${term}&key=${googleAPIkey}"; $agent->timeout(1800); print "$search\n"; my $response = $agent->get($search); die "Cant't get $googurl -- ", $response->status_line unless $response->is_success; my $resp_content = $response->content; # print "$resp_content\n"; if ($resp_content =~ /"estimatedResultCount":"(\d+)"/) { print "$1 results\n"; return $1; } else { return 0; } }

Coolest new Firefox extension?

Just tried out Ubiquity – somehwat of a crossover between Greasemonkey and Quicksilver with roll-your-own mashups underneath it all… ;] Great of you want to use your keyboard more for Firefox. Possibilities are staggering!

Firefox Download day a drag so far… (part deux)

So it’s almost at the end of download day, and I have to retract what I was saying yesterday.  I guess Internet impatience got the best of me… ;] So of course, the good folks at Mozilla had the smarts to make sure they’d be ready for the storm of requests and it looks like their infrastructure only got weak knees for a little while at the start.  Recovered nicely thereafter and at about 1:35pm EDT time FF3 showed up. I proceeded to happily download to my various machines and think this is much less of a drag now… ;]

spreadfirefox.com shows 7,389,769 downloads at the time of this writing, so I’d call that pretty successful – at least pending the next world record attempt. Since this is a new record, we’ve got no other benchmarks to compare it against, but I’d call that some pretty significant interest that will be hard to replicate!

Firefox Download day a drag so far…

So, here we are, 20 minutes after the start of FF download day and already http://www.spreadfirefox.com/ is down. mozilla.org is up, but the download link for FF 3 RC3 is unreachable, never mind the fact that the final FF3 isn’t visible anywhere yet. Hrmph.

Update (1:30pm EDT): Alright, so the RC3 is downloadable again, but FF3 Final still nowhere in sight.

More decisions, decisions, decisions…

Alright, so while the to Zend or not to Zend question is still under debate, I’m also looking at some AJAX-y goodness. There are several I’m looking at. Now, please do keep in mind that this is my personal preference only and does not reflect a wider standard. These are my opinions related to what I need to use these for. Flame on, if you like! ;]

GWT

  • Pros
    Obviously a nice framework, lots of support and has some good depth to it.
  • Cons
    Needs a JSP container (e.g. Tomcat) so that disqualifies me since my server setup will not have this available.

dojo

  • Pros
    Lots of widgets, loads of things already done for you. Very extensive and seems to be pretty cohesive in its approach.
  • Cons
    I tried to like it, I really did, but bottom line was that the examples just seemed a little behind the times (using old versions of the framework) and I ran into a couple of errors in FF 2.0 (although to be fair that might have been due to some other issues).

Prototype + script.aculo.us

  • Pros
    Nice and tight “framework” (more of a toolkit set than a framework, really), very fast and small.
  • Cons
    There are fewer ready-made widgets that are part and parcel of the base tool set. Oh, I know, I could download a boatload of widgets from various places, but it seems these are all just ever so slightly different in their implementation details and quality of implementation, I just don’t feel like giving myself that headache. I’m a one-stop-shop kinda guy (for now ;] ).

YUI

  • Pros
    Big-name support, lots of features. Reasonably intelligent about what can be included and what not, should help keep size down.
  • Cons
    Well, can’t think of any yet… ;]

Looking at this list, looks like YUI will be my choice. Time will tell whether this was a bad idea or not. ;]

To Zend or not to Zend…

I am currently evaluating whether to use the Zend framework in the development of the site. Any suggestions/feedback/practical experience sharing welcome. I don’t want to get myself tied down to a large, cumbersome and potentially inflexible framework (which Zend at least claims not to be, but not having used it yet, I’m not so sure).

Welcome!

Welcome to the new trackmypop.com. This site will allow you to enter information on how many sodas you have consumed. The idea will be to provide charts, usage data, a forum to discuss consumption habits, etc.

I personally am addicted to Diet Mountain Dew and thought that if I was to track my usage, I might be able to figure out how to reduce my intake. I started doing this using an Excel sheet, but that quickly became cumbersome. I’d like to be able to provide this service as a Web 2.0 site, and ultimately also a mobile service in order to allow for quick entry of how many sodas you’ve consumed so far.

I’m a programmer exploring web technologies and see this as a learning opportunity for myself. Feature requests are welcome, but please do be aware that I am doing this in my spare time and will not always be able to respond quickly.

The code for running this site should be released as Open Source when I’m ready to have a first bundle ready to go for people. Right now this is just an idea with nothing concrete behind it yet – so I’ll keep you posted on development progress here, for now.

PS: In case you’re wondering why it’s “Track My Pop” (instead of soda) – thank my wife, who’s from Pittsburgh and had me thinking about pop.

Bad Behavior has blocked 6 access attempts in the last 7 days.

Performance Optimization WordPress Plugins by W3 EDGE