Posts from My External Blog

<p>The other day I started working on a personal project involving
Angular 1.x and the latest version of Grails (3.0.1). I created a
Grails controller with a method that returned a list of domain class
objects as JSON, while on the Angular side I wrote a service method to
make an HTTP request to retrieve that JSON. But because the HTTP
request came from a different domain, it was disallowed: I needed to
instruct Grails to accept the request via <a title="Link to Wikipedia entry on CORS" href="http://en.wikipedia.org/wiki/Cross-origin_resource_sharing" target="_blank">CORS</a> (cross-origin resource sharing).</p>
<p>
After some trial-and-error, I came up with a solution involving the <a title="Link to Grails Interceptor documentation" href="http://grails.github.io/grails-doc/3.0.x/guide/single.html#interceptors" target="_blank">Interceptor</a> artefact introducted in Grails 3.</p>

<p>Recently I've been playing around with the current beta distribution (0.8.3) of <a href="https://material.angularjs.org/#/" target="_blank">Angular Material Design</a>:
a set of Angular modules and resources that apply the "Material Design"
style and behaviors used in Android 5.0 to an Angular website.</p>
<p>One of the services added by the Angular Material modules is the <a href="https://material.angularjs.org/#/api/material.components.toast/service/$mdToast" target="_blank">$mdToast service</a>,
which provides an easy way to display small pop-up notifications
("toasts") in response to events (a common behavioral convention on
mobile devices). I wanted to use the $mdToast service in my <a href="http://www.webdeveasy.com/interceptors-in-angularjs-and-useful-examples/" target="_blank">httpInterceptor</a>
service function for handling HTTP response errors so that I could
display a toast message if the server returned a nasty 500 HTTP status
code.</p>
<p>But I ran into a problem: when I tried to inject $mdToast into my
interceptor service factory using standard Angular dependency injection,
I got a "circular dependency found" error message when I loaded my
Angular app. The same thing happened when I tried injecting $mdToast
into a service module of my own creation - toastService - and injecting
that into my interceptor service factory.</p>
<p>The solution to the problem offered on the <a href="https://groups.google.com/forum/#%21forum/ngmaterial" target="_blank">"ngmaterial" Google Group forum</a> was to manually inject $mdToast into the service factory via $injector:</p>

<p>Suppose for a moment that you have an AngularJS single-page
application, one with view routes managed with then ngRoute module, that
is used by users with different roles. A user in your company's Sales
group has access to certain areas of the application, while a user in
Accounting works in other parts of the application. And there are also
some areas of the application that are common to all users.</p>
<p>Now, you already have the navigation menu wired up so that users only
see the navigation links appropriate to their user roles. And even if a
Sales user somehow ends up in a view meant for an Accounting user, the
server answering the REST calls for the data powering that view is going
to check the security token sent with the request and isn't going to
honor that request. But you'd still like to keep users out of UI views
that aren't meant for them.</p>
<p>You could do a user access check at the start of each controller, or
perhaps within the resolve property of each route, but that would be
repetitive and it's something you could forget to do on occasion.</p>

<p>Sometimes projects take on a life of their own, and you end up with something unexpected.</p>
<p>I set out to create an template for CRUD-focused single page
AngularJS web applications, something I and perhaps my colleagues could
use as a foundation for writing new applications. But under the
momentum of self-applied scope creep, what I ended up creating was a
Grunt-powered codebase library management tool, with my original
template concept as the first codebase of potentially multiple
foundational codebases.</p>

Profile Information

What do you like about CFML

It's easy and quick to use, yet quite powerful.

What other technologies do you use?

HTML (obviously), CSS, JavaScript, and Flex (a little)

About Me:

I'm the sole ColdFusion developer in the Portal and Web Services unit at the University of Maryland, College Park. I develop CF-powered web applications for departments that don't have their own programming expertise, troubleshoot legacy CF applications, and develop CF-powered portlets for the relatively new university portal. I'm married with 4 greyhounds.

Brian Swartzfager's Blog

I blogged about this on my external blog yesterday but thought I'd share it here as well.

One of the new features in ColdFusion 8 is the ability to manipulate images using ColdFusion tags and functions. In addition to being to do generic image manipulations (like rotating, resizing, and cropping), you can also add text to an image using the ImageDrawText function.

A week ago, an idea popped into my head: "What if you could create a UI tool that would let a user decide what… Continue

Just finished a post on my external blog about a technique I developed recently that allows me to write a single set of ColdFusion code to validate data submitted via an HTML form that can then be executed via AJAX if the user's browser has JavaScript enabled or executed server-side via a regular form post if JavaScript has been… Continue

Brian, I totally agree. I put CFUnited as a group the minute I signed up. I have been begging for someone to do this for a long time. I think all attendees should create a profile. It is a great way to get connected. I see great things in the future for this site. I plan on inviting Nick Tong to CFUnited Europe.

Hey guys,I know I haven't been on here in a little while. I'm hoping one of you will have some information on this...A client of mine asked me to integrate PayPal into their existing custom shopping cart. It's just the typical old PayFlow-style, send the browser to PayPal and then bring them back afterward. I read through all the documentation and I've got it creating the form and sending to PayPal and it all works.Now PayPal says form encryption is not required, although they also say you…See More