Listing CF Scheduled Tasks

Tuesday, March 15th, 2011

#allTasks[i].task#

Blogging this because I always forget how to do this when it comes up.

Trick for Targeted Unload Events JQuery

Monday, March 7th, 2011

Insert my typical caveat here. There may be better solutions to this out there, but as a hasty mechanism, it seems to work.

I needed to have a confirmation dialog pop up on leaving an administrative page, asking if the user wants to send data to someone. The problem is the form also receives self-referential posts as well as a paged data set, so I didn’t want to reconstruct the entire page around this simple need.

Enter JQuery. Within $(document).ready, this works well, but it triggers on every unload.

$(window).bind('unload'), function() { // function here });

But the problem is that paging nav and posts fire the same event.
So I add a check for a reusable hidden field value.

$(window).bind('unload',function(){
if ( $("#unloadbindingvar").val() != 1 ) {
var answer = confirm('Yes, no, maybe so');
if (answer) {
// do something
} else {
return true; //and let them continue on their merry way
}
}
});

Then, on form submit, set that value and return true.

$("form").submit(function() {
$("#unloadbindingvar").val("1");
return true;
}

But what to do about GETs from href paging nav? Easy, add a class to your nav, if one isn’t there already, and simply hit them in $(document).ready this way.

$("a.nav").click(function(){
$("#unloadbindingvar").val("1");
return true;
});

Works fairly well for what I’m trying to achieve.

EXIF Data, Coldfusion, and iPhones

Wednesday, March 2nd, 2011

Like so many others have discovered, iPhones shave processing and battery expenditures by writing image orientation data to EXIF data, rather than physically reorienting the image.

I’ve seen cumbersome uses of libraries and such for people seeing a solution with CFIMAGE.

To quote a coworker – quick and dirty – without having to incorporate new classes or jump through tremendous hoops.

First, either by cfimage or imageRead, get the file.
Then, create a structure using ImageGetExifMetaData, so you can get at the Model and possibly Orientation properties.

To correct the rotation, right or right side specifications under Model “iPhone 4″ go clockwise 90 degrees, left or left side seem to work with -90 degrees counterclockwise. ImageRotate will handle this.

Finally, the magic. Manipulating that data either with CFScript or cfimage, and saving down the file WILL preserve the EXIF data. There are a variety of reasons why you might want to strip that out; user privacy, file size, etc.

What WILL get rid of it–again, quick and dirty–is the following:

blankImg = ImageNew("",ImageGetWidth(oldimg),ImageGetHeight(oldimg));
ImagePaste(blankImg,oldimg,0,0);

Then write out that new image. Try ImageGetExifMetaData on the new one, you’ll be pleasantly surprised that with the paste operation, CF does not preserve the EXIF data with the paste operation.

Certainly, this works with CF8. I will test with CF9, and hope that this is not considered a bug. I would hope this absence of functionality, if you will, is a feature, given the absence of an ability to remove or modify the EXIF data by other means.

: isValid

Monday, February 21st, 2011

What is the point of having isValid “float” if it’s the same as isNumeric? A coworker ran into this today, but how else, without using regex, could you easily validate the presence of decimals? Sigh. It doesn’t happen often, but it’s a pain that float just validates as an integer and not as what you would expect, a float.

Go with XML instead of SOAP for eBay’s File Transfer API

Friday, October 22nd, 2010

The developer sandbox may work with the SOAP12 API, but for some reason, production chokes. I find this whole API utterly suboptimal.

Here’s the proper CF formatting:

and your XML request should look like:

#arguments.jobid#
#arguments.filerefid#
zip

#tobase64(Local.filebin)#

Note that the local.filebin is loaded with cffile and the readBinary action.
Sigh.

Fun with CFIMAGE and CF9

Thursday, October 21st, 2010

Layout woes.
Lets say you want to construct a layout with layered PNGs, but you need it to be backwards compatible with older browsers because that’s the nature of your synagogue membership and their computers.
First, let me warn that this is expensive if you run this each and every time an IE user comes to your site. I would always opt for the client-side PNGFix scenarios, but there are times when your design is just so cool but not possible to quickly make compatible with the variety of browsers out there.

Here’s a simple version that seems to work for my site with IE 6.


If ( ListGetAt(CGI.HTTP_USER_AGENT,2,";") eq "MSIE 6.0"){
// above checks for IE 6 in the CGI variable, below checks our "cache" to ensure we don't already
// have said file
if(not FileExists(ExpandPath("images/headercache/test.png"))) {
// this now creates our working image, with the appropriate dimensions
BlockImage = ImageNew("",800,194);
// in CF9, not sure in CF8, ImageNew can create an object out of existing files, which is what we do here
LeftImage = ImageNew("images/graphic_bar_left.png");
NavImage = ImageNew("images/graphic_bar_nav_bg.jpg");
LogoImage = ImageNew("images/graphic_bar_logo.png");
BackgroundImage = ImageNew("images/frontpage/mainsanctuary.jpg");
//ImagePaste lets us take the image, the first argument, and paste the image in the second argument
// at the x and y (third and fourth arguments) respectively.
ImagePaste(BlockImage,BackgroundImage,0,0);
ImagePaste(BlockImage,LeftImage,0,0);
ImagePaste(BlockImage,NavImage,72,0);
ImagePaste(BlockImage,LogoImage,198,0);
// we now write that image to file. I could have opted to write it to browser, but figuring this
// this process could be quite expensive, I'd rather check against the file system first. In my real
// world implementation, the background image is randomly pulled from a list of objects, so I'd have
// variable filenames for all of this.
ImageWrite(BlockImage,"images/headercache/test.png");
}
}

ColdFusion is very, very nice at times.

Ebay’s File Transfer API Redux

Thursday, October 21st, 2010

For anyone that needs to know this for ColdFusion…
I previously had to rename zip files to .gz and pass them through Ebay’s API (http://developer.ebay.com/devzone/file-transfer/CallRef/uploadFile.html).
This is one of the more poorly documented and arcane pieces of this process. This morning, our bulk insertions were failing with the “evil payload” error (I paraphrase). Now, it would seem, contrary to an Indian developer on Ebay’s developer forums, that the File Transfer Service does accept plain old zip files without tricking the system with a .gz extension. We’ll see how long this one lasts. I had hoped to automate a number of these functions but have held off precisely because of this sort of thing.

Warrior Leader Course & the High Holidays

Monday, October 4th, 2010

I had the honor of performing the role of ba’al tekiah this year on the first day of Rosh Hashanah at our synagogue, blowing the shofar to symbolically alert Jews to repent. At the end of the next day, I was to heed another “clarion call” of self-evaluation and self-improvement, at Warrior Leader Course run by the NCO Academy at Fort Indiantown Gap in Pennsylvania.

Fascinatingly, the Days of Awe and the time spent in this course complimented one another in a way that has seldom occurred in my military career. Sure, I’ve often found Torah-observant Judaism and military service are analogous. We obey orders that often have no discernible root in logic. But just as we elevate the mundane tasks of daily life to a Divine level through our obedience, so too does the following of a seemingly ridiculous order have a ripple effect within the service. Obey a strange mitzvah or fill a sandbag, somewhere, the Divine spark is enhanced or a levee does not break. Someone can be brought closer to or prevented from prematurely meeting G-d.

As far as this school is concerned, where the focus is on professional development as a leader, one could make the argument that there is also little distinction between personal and professional development. To evolve as a leader—to become something more—one has to personally shift perspectives, adopt new means of accomplishing old tasks, and force oneself to do things one had not previously considered doing.

But two weeks is not necessarily life-changing. In most cases, this school is not. Neither is 10 days at the beginning of the Jewish calendar. Yes, we repent, rinse, and repeat year after year, because if the sacred boilerplate truly affected gross personal change, we as Jews would only need to do it once in our lifetime.

For my part, the High Holidays and Warrior Leader Course made me realize that I am rapidly approaching being the man I deeply desire to be. A good husband, a good father, a fine leader of men, a productive worker, an obedient-yet-critically-thinking Jew. It is my premise now that for those Jews in the military, that we approach the totality of what we, as Jews, are meant to be. A Jew in the military cannot but recognize the causality of our faith as applied to reality around us. A Jew in the military cannot but recognize the power and hand of a Creator. A Jew in the military cannot but recognize the validity of our lifecycle events. We see it come and go quickly before our very eyes in garrison, in theater, and anywhere else our booted feet take us. Jewish service members embody the best our community has to offer.

On Yom Kippur, though, I realized one big personal shortcoming as two conversations with congregants talked to me about the military experience in a way that tried to isolate me from my own experience as much as they were isolated from my experience. In both cases, with my wife and I, who have both endured the pain of long military separation for deployments and training, it’s a reality that we know too well. Who someone knows tangentially at a duty station across the continent does not afford us the ability to relate. I don’t like relating it to people, it feels like too much work, and there’s this sense that many of our coreligionists feel like we’re the equivalent of janitors for doing what we do. Maybe, but instead of cleaning up vomit in aisle 5, we’re cleaning up terrorists in hot, dirty places.

It true to say that many American Jews, it would seem, can only relate to many experiences by proxy. Many of our kids identify with Israel because of a short Birthright trip, though they remain detached enough from Israel that many of them can join ranks with schmucks like J Street and tell Israel what to do, whether having visited for months, weeks, or never. Of course, you’re always measured against the other kid, the one that became a doctor.

My wife opined that this is the way the small Jewish community relates to itself, by telling you who they know that does the same thing. Perhaps this is post-Shoah culture as well, where all of us feel the heat of the ovens on our skin just because we live and die as a community. I can see this.

However, this also reeks of a sort of “not invented here” syndrome. I believe it to be the same thing as when a congregation has enormous cantorial talent perhaps in its own congregation, and yet contracts a guest cantor for the High Holidays without looking within first. We all know it happens, how often we overlook internal talent. When did this become ingrained in our communal identity?

I don’t even know if my premise is correct, or if it holds true from community to community. Generalization, after all, is a good way to look stupid. What I do know, however, is that whenever I meet a former or current Jewish service member, I am immediately struck by worldliness, a lack of pettiness all too present with some boards and committees, and commitment to the community that is truly meaningful, and not just the obligatory fund-raising and arm-twisting message the synagogue president gravely delivers on Yom Kippur. This is not to say this occurs in Jews without military service, of course. I’m just saying I’ve never seen a departure from that in Jewish service members.

We’re approached in shul by neoconservatives and liberals who try to relate to our experience and make it relate to their political views. On other days, we have people that just want to make idle, noncommittal chit-chat. We suffer it in lonely, head-nodding silence. We stand apart because it’s not someone else that we know who has lived an experience. We’re the ones who have felt the sting of sand from a Chinook’s rotor wash. We’re the ones who, with an engine going out on the C-141, begin taking funny pictures of each other as the plane does an emergency landing because gallows humor is how we deal with such things. We’re the ones that have sat on a vessel, 6 months under the surface of the ocean. We’re the ones that have buried friends, 19 year old kids blown up in a Baghdad market, for what, except for an ephemeral line in the sand most Americans can’t or won’t give a tinker’s damn about, because, damn it, healthcarejobsdeficithousingbubble is more important. We’re the ones that endure that frustrating apathy punctuated by political lip service here at home. Damn it, politicians, if we wanted lip service, we’d begin with unbuttoning our trousers! At least Vietnam vets had people willing to spend enough time to spit on them. This generation of soldier gets not even that. We’re the ones who have endured firefights with enemies of rationalism and modernity, over drugs, oil, or ideology. People talk about the IDF with a mystified awe, but meanwhile, the Jews that stand on the wall between the American Jewish community and tyranny aren’t carrying Uzis and wearing OD Green–they’re right here, wearing US uniforms and flags. The guy that keeps you safe at night isn’t a pilot in the Israeli Air Force or a soldier invading Lebanon. He’s Daniel Agami, z”l, a good kid from Florida who should be on the lips of every Jew for the horrific-yet-heroic way he freely gave his life, or a fresh kippah-wearing recruit at Benning who will be soon receiving the blue cord of the infantry and then going to Airborne School to become an American paratrooper. These are the folks our b’nei mitzvah crowd should be seeking to emulate.

So this came in the middle of Warrior Leader Course, when I was bleary-eyed tired from the onslaught of all that is supposed to make you a leader of soldiers. For the past 16 years, I have really struggled with a profound disdain, to say the least, for civilians who have never served. Again, not all, but many. So on yontiff, decorum means you have to politely nod and indulge their tangential relationship to something they don’t know, they’ll never understand, and meanwhile think, “would it kill you to kiss my ass and shut up about who you know for 10 minutes?” It’s not the presumption that we care about their sixth degree of separation from the service. It’s the absence of any curiosity about our experiences that is obnoxious. After all, if they expressed the same curiosity with their friend as they did with us, I can’t imagine they know all that much about their friend’s friend’s experience either. Yes, that’s “friends” x2.

But then, after I crossed the stage at Warrior Leader Course (my daughter asking later, “why did you have your mean face, daddy?”), it hit me where and how I was failing. I don’t do what I do because I want a fellow congregant I might see once a year (or less) to kiss my tuchus. I bet she didn’t give two thoughts to a single airman, Marine, sailor, or soldier, deployed abroad during these Days of Awe. But we’re thinking about it. We’re thinking about our military Jewish community. We’re thinking about our larger community, which is why you find Jews leading from the front in our military roles. We realize that because of who we are and how we are positioned, many who have never met a Jew before will judge our entire community by our comportment. Most civilian Jews don’t get that experience, and they should consider themselves lucky. I want the Kentucky hilljack who never met a Jew before to go home and say, “I met this Jewish soldier, and he was one of the best soldiers I ever met. Jews are neat.” I don’t want them singing along when Sasha Baron Cohen in his Borat persona leads them in singing songs about tossing us down a well.

We all suffer so many indignities, from cleaning pubic hair from toilets, to flying multiple sorties in a 48 hour period, to kicking down doors in Iraq, that we will never be able to fully relate the breadth of our experiences to our loved ones, let alone the untested masses. It’s lonely, unless we’re amongst our own service Jews. We all serve, I assume, in part, so the rest of our community doesn’t have to think about it. And if you think about it, so what if Bev’s son David became a dentist pulling down six figures, and you’re a steely-eyed trigger-puller? You can go to Brandeis, be comfortable and remunerated, or you can be awesome. You can also use your college benefits and establish comfort and remuneration later, after you’ve established awesomeness and a six-pack abdomen. I promise that this will actually move your needle on JDate just a hair ahead of the oblivious, anxious young podiatrist with the Mazda Miata and velvety-soft, unworked hands.

Sometimes we just do it because our little girls are proud of us walking across a stage with our mean face as we pivot on the balls of our feet. The military, after all, does not walk in curved lines, nor do we smile while we’re marching.

For whatever reason we do what we do, I do hope that our service, our leadership, and our continual drive for improvement can subsequently elevate the rest of our community. This Yom Kippur I had to weigh out my own comportment as a Jew for this past year, but I also had to weigh out my effectiveness as a leader. In both cases, I felt assured of my strengths and have a clear path for improvement of my shortcomings. I am extremely grateful that the two overlapped and reinforced one another. By themselves, either could have been the same rote experience we all endure in our yearly Jewish lives or professional military advancement.

G-d and the military both ask basically the same thing from us: Don’t just go from event to event, checking the blocks. Move the needle. Improve the circumstances around you. One of our instructors used a line from The Lion King, “Everything the light touches is our kingdom.” This is as true of a Sergeant as it is any thinking Jew. Take ownership of the things you can control around you. If it’s in your power to change it, then it belongs to you. Improve anything you can touch. Your relationship to your loved ones, your wife, your husband, your children, your parents, your community, and your G-d—all of these things can bear the weight of continual improvement. Think of G-d as the First Sergeant with a white glove, looking for dust in the obvious places and some not-so-obvious places. In our human lives, G-d will come up with a dirty glove after it runs along the length of our year, but G-d gives us ample cleaning supplies in the form of Torah and common sense. We have ample guidance. Any failure to make “good” happen is our own.

You’ll think, too, of Yom Kippur as your yearly spiritual After Action Review. What was supposed to happen? What did happen? What went right? What went wrong? What will we do better this year? Sustain what you did right, improve what you did wrong. Then come back to G-d next year not just repentant, but that you have a plan to not be as repentant next year.

This is what it means to be a leader. This is what it should mean to be a Jew.

All the best to you and yours.

Online Kosher Databases, Meet Web 2.0

Thursday, September 2nd, 2010

It’s tough being a kosher digital Jew.

It’s tough being a kosher digital Jew developing a web application for a food services-related organization, and realizing that the OU and OK online-offerings, while excellent in their own right, do not offer much in the way of derivative services.

Here’s the deal: I’m working on an e-commerce site that deals specifically with restaurant supply. This of course has applicability for caterers, community centers, synagogues–anything that could be concerned about kashrus.

I noted when I started that we occasionally have listed as a feature bullet on some of our products “Kosher certified.” It doesn’t tell one which agency. It doesn’t say parve, meat, dairy, etc., and it certainly can’t be as fresh. Look at the alert emails one gets from the OU or OK.

If I can’t get a detached version of their database, then I would at least like to get some kind of web service so I could pass brand, product, perhaps manufacturer’s SKU along to one of these certifying agencies, and get a nicely formatted response which I could then list alongside our products.

It serves them, and it serves us. Most importantly, it serves the kosher consumer. I’d even be happy to develop one for them, if it would make it happen.

The “Webbe Rebbe” at the Orthodox Union doesn’t respond to my emails. I don’t even know where to begin with OK’s stuff.

This is community content. Both organizations tout a commitment to kashrus, and they could expand that by widening the digital channels to this information.

It could even be a paid/subscription service. This would be such a boon to my market in trying to appeal to the kosher niche, which is a consistent revenue model, that it would be worth a monthly subscription fee.

So c’mon, Orthodox Union – give me a call. I’d like to take your data and run with it!

Here’s an idealized model:

1. Web application (e-commerce site) at some point has a generated listing for a specific product. When it is input, a push button reaches out with a SOAP call to the OU’s web service (the one I dream of), and the response is how and if the product is classified as kosher.
2. Periodically, the site, when loading this product dynamically, would poll against the same web service to ensure that the most current kashrus information is displayed, as well as the correct hechsher.

Saving binary MIME SOAP attachment – revisited!

Tuesday, August 24th, 2010

So, okay, you get that byte array, and you write it to a file.

WinZip will open it.
Windows “compressed folders” will not.
CFZIP will not, and neither will the supportive underlying Java.
Why? Because .toByteArray turns the entire SOAP response, including header and MIME boundaries, into your byte array, so yeah, you end up with in Ebay’s case, about 800 or so extra bytes at the beginning of your file.

I’m hard pressed how to get this one completely resolved without creating an external class library and retrieving this response some other way. DLL perhaps, CFX… JavaCast and creating a Java object just do not provide enough to make magic happen.

So, I figured, rather than go outside and start from scratch with my data retrieval function, why not find a command line executable or DLL that could process a zip in the manner that WinZip does?

UnZip 5.52 seems to serve the purposes on a Windows platform. I understand there’s a permissions security hole with the Unix version so Unix hosted CF sites may not find this palatable as a solution. But there it is, pass those variables to cfexecute, as loathe as I am to do so, and we have another work around.

Follow

Get every new post delivered to your Inbox.