existdissolve.com
the singularity of being and nothingness
the singularity of being and nothingness
Aug 20th
Here is the code on GitHub, if you want it.
Over the last several months, I’ve been working heavily in a brand-new environment (to me): one that is built upon ColdBox and leverages all of the awesome goodies that ColdBox provides in the way of rapidly and easily developing ORM-driven applications. If you spend more than 3 minutes in a ColdBox ORM app, you’ll quickly come to rely upon–and LOVE–ColdBox’s CriteriaBuilder, which lets you easily build intensely complicated HIbernate criteria queries…without the nonsense of string concatenation.
The other day, however, I ran into a bit of a wall. Before I explain the issue, let me give a quick summary of the context.
In my app, I have a good number of concrete services that extend the uber-handy Virtual Entity Services. Since my app is driven largely by an AJAX frontend, there are lots of cases in which I not only want to return a JSON-representation of a result set, but also important meta-data about the result set (e.g., total record count for paging, etc.). Obviously, since I want that bundled into one single response, I have lots of methods that do something like so in one of my concrete services:
function getResults( event, rc, prc More >
Jun 23rd
Over the last several days, I’ve been trying to use Sencha Command to package a Sencha Touch 2 app as a native app. Honestly, for most of the process, everything worked perfectly…until I actually had to package the app. I ran the build command, like so:
sencha app build native
Throughout the build process, everything seemed to be going well, until the minification of the actual app.js file. Here’s the error I received:
[ERROR] Error: Command failed: [ERROR] 28305:18:missing variable name [ERROR] 28305:20:syntax error [ERROR] 28306:25:syntax error [ERROR] 28318:14:identifier is a reserved word [ERROR] 28420:21:identifier is a reserved word [ERROR] 1:0:Compilation produced 5 syntax errors. org.mozilla.javascript.EvaluatorException: Compilation produced 5 syntax errors. at com.yahoo.platform.yui.compressor.YUICompressor$1.runtimeError(YUICompressor.java:154) at org.mozilla.javascript.Parser.parse(Parser.java:392) at org.mozilla.javascript.Parser.parse(Parser.java:337) at com.yahoo.platform.yui.compressor.JavaScriptCompressor.parse(JavaScriptCompressor.java:312) at com.yahoo.platform.yui.compressor.JavaScriptCompressor.<init>(JavaScriptCompressor.java:533) at com.yahoo.platform.yui.compressor.YUICompressor.main(YUICompressor.java:131) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Pretty helpful, right?
Well, I *finally* figured it out. I emphasize “finally”, as the issue was actually a code error on my part. In my app, I used the word “final” as a variable in one of my controllers. Apparently, this is a reserved word (or something like that), and so the minifier blew up. Changing the variable name resolved all the issues.
So how many hours of frustration was that? I am stupid.
Share More >Jun 5th
With the recent updates to DragonVale v1.8, the app has seen some impressive evolution since its inception. The app now has a thriving community, and despite its ridiculous freemium business model, the updates keep coming…so money is being made off of it.
As we get closer to the 2.0 release (not suggesting it’s imminent), I thought I’d share some ideas about what should be done to really take this game to the next level. With dot releases, you don’t expect a revolution…nice touches here, a new feature there, but nothing off the chain. With the release of a whole version, though, it’s a chance to reinvent and make a play for a whole new set of players. So without further introduction, here are some things I’d like to see in the 2.0 release.
More Robust Management ToolsCurrently, the app only really allows you to manage your world on an item-by-item basis. There is literally no way to get a “high” view of what’s going on. Version 2.0 needs to fix this. So what does this look like? One idea is global interfaces for managing common “types”–dragons, buildings, farms, etc. It’s tremendously annoying to have to go to each habitat in order More >
May 16th
On the heels of yesterdays’s official release of ColdFusion 10, I’ve updated Gloss with support for both ColdFusion 10 AND ColdFusion 9 reference guides.
Enjoy!
Share this:May 2nd
I ran into an interesting issue today. To make a long story a little less uninteresting, I was basically trying to go from an array of ORM entities to an Excel dump of the data in those entities. Obviously, the easiest way to accomplish this is to first convert the array of entities to a query, and then pass the query result set off to the built-in CF Excel manipulation functions.
Easy enough. With one little line of code, you can very simply convert ORM entities to a ColdFusion query…just like so:
// get the orm entities ormstuff = EntityLoad( "Art" ); // convert the orm goodness to a CF query anicequery = EntityToQuery( ormstuff );
Cake, right? If I were to hand this query off to CF’s spreadsheet functions, I could easily prepare and export a nice Excel file full of the data I just converted. But of course, nothing is that simple…and that’s where the potential bug announced itself.
A Dark ForebodingYou see, instead of simply dumping all the data for all the columns of the query-which-was-once-an-entity, I wanted to pare down the list of columns that would be output in the Excel export. Since I already had a query handy, More >
Apr 26th
Recently, I’ve been messing around quite a bit with ORM in ColdFusion. I really like the benefits that it brings to developing applications. However, I noticed a very big bug yesterday while attempting to user serializeJSON() on a an entity using a one-to-many relationship.
Some ContextLet’s say that you have two entities that are related via a one-to-many relationship (Artists and Art, for example). You can easily create this relationship in your model by doing something like the following:
property name="art" fieldtype="one-to-many" fkcolumn="artistid" cfc="Art" remotingfetch="true";
If we were to dump the result of an EntityLoad() of “Artists”, we’d see a nice structured relationship: First, an array of all Artist entities, and then an array of all Art entities related to the particular ArtistID. Additionally, I’ve specified remotingfetch=true, which will force CF to load the Art entities for each Artist.
The BugThe bug, however, comes into play when you try to serialize the result of EntityLoad(). While it properly composes the relationships, it represents the first two entities in the “art” array; any subsequent entities in the given array are returned simply as “{}”. Whether you have 3 “Art” entities for an artists, or 20, only the first 2 will ever be serialized properly.
See More >
Apr 23rd
One of my absolute favorite things about ExtJS’ data model is how simple it is to apply a Model instance to a form. If you’ve never done this before, consider the following data model:
Ext.define('Validations.model.Person', { extend: 'Ext.data.Model', fields: [ {name:"name", type:'string'}, {name:"age", type:"int"}, {name:"hobby", type:"string"} ] })
Also, assume we have a form defined like so:
Ext.define('Validations.view.people.Form', { extend: 'Ext.form.Panel', alias: 'widget.peopleform', bodyPadding: 10, border: false, initComponent: function() { var me = this; Ext.applyIf(me, { defaults: { width: 250, labelWidth: 70 }, items: [ { xtype: 'textfield', name: 'name', fieldLabel: 'Name' }, { xtype: 'numberfield', name: 'age', fieldLabel: 'Age', value: 20 }, { xtype: 'textfield', name: 'hobby', fieldLabel: 'Hobby' } ] }); me.callParent(arguments); } })
NOTE: Notice that the “name” properties of each form field maps 1:1 with the “name” properties in my Model.
Now, let’s say that we want to edit a Model instance. We could, of course, manually set the value of each form field to that of the corresponding field in the Model. However, this is clunky and unnecessary, given that the form itself has a method for doing this automatically. Consider the following:
// get More >
Apr 21st
A few days ago, Sencha rolled out Sencha Architect 2, the major overhaul and rebranding of what was formerly Sencha Designer. You can check out the release blog post to get the low-down on all the new features.
When I saw the news about the release, I have to say I was a bit hesitant to look much further. I’ve tried Sencha Designer several times in the past, and I’ve been somewhat disappointed with it. Sure, it was great for laying out apps, but when you actually needed to *code*, it was lackluster at best. But even worse, I found it to be very buggy; it would crash at random times, and overall I found the process of trying to mockup an app to be more frustrating than anything else.
So initially, I wasn’t planning on even trying out the newest iteration. But then I noticed that one of the biggest additions to the product is support for creating a full ExtJS or Touch app–not just the UI. I felt I had to take a closer look, and I’m glad I did.
UIOut of the box, Architect 2 is worlds better than its previous iterations. The interface is slick and responsive, and the way More >
Mar 1st
As if the title doesn’t give away the whole plot, I’m currently working on a project that uses PHP–gasp! No, I’ve not abandoned ColdFusion, and too be completely honest, I’m kind of a PHP noob.
Sure, I can do a fair amount of things in PHP…you know, querying databases, echoing content, that kind of stuff. Where I really get hurt, though, is when things start to get complex.
Some ContextNOTE: If you don’t particularly feel like reading and just want to see some code, be sure to check out my GitHub repo for this.
For example, I recently needed to build out an ExtJS View, and I wanted to have some pretty heavily-nested data. My ideal outcome would print something to the page like so:
Main Group 1 Category 1 Name 1 Name 2 Fav Color 1 Fav Color 2 Main Group 2 Category 1 Name 1 Name 2 Main Group 3 Category 2 Name 1 Category 3 Name 1
And so on. In other words, each step in the “tree” can have multiple children, which can themselves have multiple children, ad infinitum.
Now in ExtJS, creating a View is dead simple. You simply have to pass the View a JSON structure wherein each level is More >
Feb 25th
I recently created a free ColdFusion 10 Beta hosting account with Hostek.com. It’s pretty awesome, so you should create one too!
Anyway, with that in place, I’ve uploaded my examples of ArrayEach(), StructEach(), and ArrayFilter(). I’ve also put them out on GitHub, so feel free to take a look if it suits you.
Enjoy!
Share this: