cf.Objective()

I’ll be presenting at cf.Objective() next week. I’m giving 2 talks:

Payments: I’ll be talking about some of the new options for processing payments, focusing primarily on Stripe.com (sooo developer friendly), as well as a lesser known option, Noca.com.

Authentication: This will be about adding oAuth and OpenID authentication options (focusing on Twitter, Facebook, and Google). We’ll be looking at doing this on a new application, as well as integrating these options into an app with an existing authentication scheme.

I’ll be doing a Lightning Talk as well. I won’t give it away yet, but it will be about “CF”, but maybe not what you’re expecting. :-)

If you want to hear me talk about my talks, check out the CF Hour Podcast, show #144

SQL INSERT syntax – omit column names

I’ve been writing SQL for a while – so long that I think I have a lot of rules stuck in my head that aren’t necessarily true.

We’ve all written INSERT statements:

INSERT INTO myTable (a,b,c,d)
VALUES ('E','F','G','H')

Assuming this is all of the columns, except for an auto-incrementing primary key, I by accident did the following (in SQL Server):

INSERT INTO myTable
VALUES ('E','F','G','H')

Apparently it’ll attempt to implicitly write to the columns as they’re ordered in the database, with the apparent exception of the auto-incrementing identify column.

Let me say this is BAD code, since it’s not clear what’s being inserted, and if the column order changes, or you add column, etc, all sorts of errors can spring up. The point is, however, I’ve always assumed that this query wouldn’t work. May be time to revisit some of those old skills I thought I long ago mastered.

Multiple inserts in one statement with SQL Server

A nice feature of MySQL is that you can easily, with one statement, perform multiple inserts:


insert into myTable (colA, colB)
values
('a','b'),
('c','d'),
('e','f');

SQL Server doesn’t have this capability. Prior to SQL Server 2008, SQL Server couldn’t do this. (See comments … I’ll leave this post here for entertainment sake or for those on SQL Server 2005 or 2000)

However, today I came up with a way of hacking it (maybe well known but I came up with it without Google or Stack Overflow, so there…)


insert into myTable (colA, colB)
select 'a','b'
union
select 'c','d'
union
select 'e','f';

I’ll make no claims as to whether or not this performs, but it’s a interesting hack. (I actually used it with real select’s, doing a mass batch transform of a data mapping)

CFML Language advocacy: a win

Saw a post on Twitter decrying the fact that an Australian government site was developed in ColdFusion: (I’ll respect the author’s right to not be trolled)

Looking at licensing costs is a small piece of the puzzle, so we went back and forth on that issue.



I’m not ignoring the elephant in the room: open source CFML. I just wanted to address the idea that if it’s open source, it’s better no matter what. We need to be smart in our discussions of the value of a solution. Never in this discussion what this Drupal advocate able to dismiss the development time idea.  At that point, I was able to pull the ace out of my pocket:

I smiled at his response:






One other thing. I saw this in his Twitter feed:

In language advocacy (or religion, or politics, or ….) if you come back with “my X does Y better than your Z”, you’ve already failed. Operate in the common ground, and challenge their preconceptions about your position. Often you’ll find that the arguments they used are the same tired arguments everyone else uses, and they need to be educated. Focus on that common ground, and don’t go off topic (this person had never mentioned security or support, but did mention cost re language and CMS). Most of all: be civil. Don’t troll, and don’t go all “my dad can beat up your dad”. This harms the reputation of your language, since the platform IS the community.

 

 

Open CF Summit 2012 Presentation: WebSockets Now!

I had the honor of speaking at the Open CF Summit in Dallas on February 25, 2012. I spoke on adding WebSockets support to all the different options for building CFML apps: ColdFusion 9, Railo, Open Dragon, and of course, the new baked-in functionality built in to ColdFusion 10.

There wasn’t much code to share, as most of it was in the presentation via GitHub repositories, but there it is:

Restart ColdFusion 10

On Mac, I typically use the ColdFusion Launcher GUI to start/stop ColdFusion (v 9). However, as ColdFusion 10 will be using Tomcat, you can start/stop in the same manner as you start/stop other servers apps like Tomcat, Apache, Railo, etc – via the command line, which is my preference. (I have a ~/servers/ folder, where I launch things via the command line as my development needs dictate: CFML, node.js, you name it)

With the move to Tomcat, the following is available to you in CF10: (I’m on Mac; adjust paths as appropriate for you platform; for example, on Windows, probbably c:\ColdFusion10\)


cd (cf10directory)
cd bin
./coldfusoion restart

Obviously this starts CF10 .. more examples follow, assuming you’re in (Coldfuion10Directory)/bin (these should be obvious, no explanation necessary)


./coldfusion stop


./coldfusion start

An additional option, “status”, just tells you what’s going on


./coldfusion status

The final option, “wsconfig” is how integrate CF10 into existing web servers like IIS or Apache. This command is pretty complex, and worthy of a post by itself. Supposedly to get a GUI similar to what you’re used to, you run


java -jar wsconfig.jar

but this file was nowhere to be found.

Tomcat in ColdFusion 10

Much has been made of the move from Jrun to Tomcat in ColdFusion 10. This move has changed up the directory structure of ColdFusion 10 compared to prior versoins.

Many of us are no stranger to Tomcat, where CF is deployed as a WAR, inside the webapps folder (unless you changed this in (tomcatdirectory)/conf/server.xml). Say you wanted to add a virtual directory: you knew to go to the server.xml and add a new entry under the <Host> node.

So where is the Tomcat directory in ColdFusion 10?

(ColdFusion10installDirectory)/cfusion/runtime

Adjust as necessary of course for Windows. (probably c:\ColdFusion10\cfusion\runtime)

As best I can tell, Tomcat admin is as you’d expect, so to add a virtual host or change the root directory, you go to (directoryAsAbove)/conf/server.xml

I’ll of course update my blog as find exceptions to the normal Tomcat process

ColdFusion 10: Security First

When I install ColdFusion on my local macine, I typically give it an easy little password for the admin, etc, something like “cf”

Of course, this is rare: most places tend to keep you from using something so easily guessed. I’d never use such a password in production, but I like to get in fast when I’m developing.

When installing the beta 1 release of ColdFusion 10, I saw this for the first time:

So CF 10 tries to set on the right path, but gives you the flexibility if you want an easy password. Maybe they should force you (or at least give you a develpment/production option: forced password complexity if it’s production), but nice to see this change (even if it means I have to click a few extra buttons during install)

Using Seagate MomentusXT in external enclosure

Recently upgraded my laptop to an SSD after using a Seagate Momentus XT 500 GB drive for over a year and a half. The XT is a wonderful drive: it is a hybrid drive, combining storage of a 7200-RPM disk with speed of a small SSD, all in a normal 2.5″ hard drive form-factor. It actually uses the SSD as a type of cache, so it appears as one drive. Much faster than a typical 7200-RPM drive. I like it so much, than as I’ve bought new laptops, I’ve always moved it to the new machine, selling the “new” hard drive in the old laptop.

Well, I jumped up as high as I could go, finally springing for a 512 GB SSD. I wanted to do a clean OS install, and just copy files over from the XT, by putting the XT in an external enclosure. Typically with 2.5″ drives the power consumption is such that you can use a USB powered external enclosure. Not so for the XT. When I put it in the enclosure (NexStar SX) the drive started beeping. Thought it was the enclosure, but turns out it was the drive. I then tried jury rigging the drive with a Western Digital MyBook interface (it took a fall, breaking the enclosure, but the circuitry and the drive itself work great). For whatever reason, that didn’t work either, though no beeping (perhaps that interface is designed to only work with WD drives)

I ended up putting the XT back in my laptop, doing a full backup of it, and now I’m restoring off of that backup.

Turns out the SSD part of the XT requires a bit more power to start the drive than a normal 2.5″ drive. So if you want to use it in an external enclosure, you’ll need either a powered one (use a 3.5″ enclosure) or if your 2.5″ enclosure doesn’t support external power, you can use a USB cable that draws from multiple USB ports. See http://forums.seagate.com/t5/Momentus-XT-Momentus-Momentus/Momentus-XT-500go-as-an-external-mass-storage-experience-and/td-p/88486

ColdFusion support in Sublime Text – the easy way

For a while now, I’ve been using Sublime Text instead of ColdFusion Builder/CFEclipse – it’s faster and just gets out of the way. (I do still use Eclipse for MXUnit plugin however)

Getting ColdFusion support wasn’t too hard – I used the great package at https://github.com/indynagpal/coldfusion-sublime-text-2. However, it felt a little too “hands-on” for me for 2011.

However, today I discovered another ColdFusion package. The folks over at sublimetext.info (as best I can tell, not connected to the official company) have a GitHub repo at http://github.com/SublimeText with a number of Sublime Text packages for various languages. ColdFusion is one, and while it doesn’t have the massive snippet support of indynagpal’s, it does do a good job of mirroring some of the most common shortcuts used in Eclipse. You can do the downloading and unzipping thing (or git clone) – uggh – but you can also use the very excellent package manager over at http://wbond.net/sublime_packages/package_control to install ColdFusion support in Sublime Text in just a few steps:

  • Install Sublime Text from http://www.sublimetext.com if you haven’t already (unregistered version currently never times out, but I recommend purchasing it – the time you’ll save not waiting around for Eclipse to load will pay for itself quickly!)
  • Open Sublime, press CTRL (Update: both Mac and PC – *NOT* CMD on Mac) + ` (For the confused: hold down those 2 keys at the same time – note it’s the character below ESC, not a single quote)
  • Copy and paste the following into the console that comes up in Sublime Text: (from http://wbond.net/sublime_packages/package_control/installation)
    import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'
  • When it finishes (“Please restart Sublime Text to finish installation” shows in the bottom line of console), close Sublime Text and reopen
  • Click Preferences > Package Control
  • Click “Package Control: Install Package”
  • Scroll to or just type “ColdFusion” – hit Enter
  • You’ll see some action in the status bar of the app – it’ll tell you when it’s installed
  • Code your little ColdFusion heart out now – for into on shortcuts, etc, see the readme at https://github.com/SublimeText/ColdFusion

 

1 2 3  Scroll to top