So, I’m going to try to get back in the habit. I owe Ray two posts, so this is a warmup. Anyway…
I’ve just added JSONP callback support to Entity Broker. This allows you to make a data feed that can be used for mashups. The normal JSON feeds don’t allow for this because, when the script tag is added, the object literal just drops into the ether – it needs to be handed off to a function. Plenty of others are using this technique now and it’s well supported in things like jQuery; just search around.
The important bit is that you can either use the default callback function (jsonEntityFeed) or specify your own. You just craft a URL to the entity and optionally give a parameter. For example:
If you are using jQuery, you can use the getJSON method to call an inline, unnamed callback like this:
It’s all pretty straightforward and tracked in SAK-16757. I imagine that this will get tagged at some point, but it’s just in trunk for now. Happy Hacking! -NB
So, I’m doing some development against Oracle with PHP and really wanted Express Edition on a local machine to be able to hack without a lot of messing around (my other Oracle instances are behind VPNs, etc.) I’ve also been thinking about hooking my desktop back up for one of those environment changes that results in a productivity boost. A third factor is that I want to do this development in Aptana because, well, it’s just plain sweet. Easily said…
…and pretty easily done once the steps are laid out.
The Aptana Studio and XE installs were both cake. I love that, however it has come about, “just works” is finally taking hold across all three big platforms. I also highly recommend SQL Developer (so far, anyway.) For anyone who’s worked extensively with SQL Server 2000, this thing feels like Query Analyzer, and I couldn’t be happier.
So, what’s the problem?
Well, Aptana has that very slick integrated PHP instance, and I don’t plan to do anything beyond that… but it doesn’t ship with the Oracle extensions. After enough poking around, I was pleased to find that the extensions are stored in one of the Aptana plugin directories, and the php.ini files are there, too. This just leaves getting the DLLs and dropping/enabling them.
To get to the goods, assuming Aptana and XE are installed:
- Download php_oci8.dll and php_pdo_oci.dll from PECL4WIN. (Aptana 1.2 ships PHP 5.2.5, so grab 5.2)
- Drop these into
- Add your extensions to the php.ini files in
That’s it. Now you can connect to Oracle instances. I, personally, prefer PDO, so included the driver in the directions. You wouldn’t need this if you were doing raw OCI. For a cheatsheet, the connection looks like this:
$dbh = new PDO("oci://host/SID", "user", "pass"); With a local XE, the default would be
//localhost/xe. I hope this saves someone the couple of hours I spent messing around. -NB
I was seeing somewhere between 30 seconds and a minute to get to the keychain login, and another 30 seconds to bring up a contact list. Clean out the logs, relaunch – about 4 seconds for each.
The logs live in
~/Library/Application Support/Adium 2.0/Users/Default. Remove or archive them and watch it fly. -NB
So, amidst an interesting fight with CakePHP, I was fortunate enough to spot a quirk in
json_encode when passing arrays. If you have a typical ordinal array, life is good. If you have a typical associative array, life is good. The quirk is in how PHP decides what you have.
We define “life is good” here as: you pass something without meaningful keys, you get an array; you pass something with meaningful keys, you get an object.
When you have a regular old array of values (or rows of a result set, in my case) and you filter it with, e.g.,
array_filter, you can end up with holes in the ordinal numbering. This delights
json_encode, which displays its exceptional, “just works” intelligence, giving you an object full of numeric indexes pointing at what you thought would be unnamed items in an array. In some cases, this makes no difference but, in some, it can be a big problem.
Fortunately, I’m generally in tune enough with the stylings of PHP that I went straight to trying
array_values – and now, all is right with the world. Just wrap any
array_filter calls with
array_values if you plan to turn the goods into JSON. -NB
So I’m debugging a chain of Sakai helpers and I ask myself…
“Self, is there an easy way to use the Eclipse debugger to fake some runtime/dynamic tracing?”
And the answer is a resounding “yes!”
If you set up conditional breakpoints at the places where you want those debug statements and inject some great println justice, magic is made. Eclipse is also nice enough to allow blocks of code or expressions. This means you can use just the println like an expression if you don’t care about the breaks, or make a println and a return if you do. See the screenshot for a somewhat nonsensical example.
All of this can be yours with a single startup of Tomcat and a tail -f. If you’re lucky enough to be hacking something in *-tool, life is even better. Save, mvn install sakai:deploy, relaunch your debug scenario, and keep an eye on that terminal. Somebody who knows what they’re doing with Eclipse could probably tell you how to even target an IDE view – catalina.out is fine for me, though.
…And for quick reference, you can right click on a breakpoint in the left-hand trough and select Breakpoint properties or use the Breakpoints view. On a Mac, Cmd-Shift-B toggles a breakpoint on a line, but getting to the properties with the keyboard is a pain (Opt-Shift-Q, B). In there, a natural-feeling sequence of arrows and Opt-Enter or a right click opens the dialog. Getting back to the editor is easier: F12.
Happy hacking! -NB
«« Newer Entries
Older Entries »»
OK. So I thought I wasn’t crazy. I reviewed my code. I tested Dojo versions. I isolated conditions. I followed dead-ends in desperation.
And then the problem goes away. I can’t get SharedObject storage to break anywhere (and I’m still not sure why it was broken, then magically fixed – I suspect an update to the remote machine I was using, since the cluster is monitored/managed).
And then, today, we replicate it in the one place in the world we really care about, and scrape the Flash version: 188.8.131.52.
So I check if Adobe is benevolent enough to lend a hand (installable old version) to poor developers who are getting hosed. They give a nice package, so I was thrilled.
Then I fight with the installers/uninstallers for 6 versions until I find a golden nugget: uninstall_flash_player.exe /clean takes care of the registry entry that was stopping anything but the latest version (as it had already been installed) from running, though they install with “no problems”.
And, with undue buildup, the point of this post:
Flash 184.108.40.206 does NOT work with Dojo Storage 1.1, period.
The good news is that all newer versions do, and 9.16 is coming up on two full years old with 3 major updates since. Time to beg for this lab to be updated and get on with better problems – like IE’s eternal lifetimes of objects created in iframes and its derivative memory leaks. -NB