Well, today I stepped down as the Lead Front End Ordering Engineer at Market America. Since I started in January 2010 I have had the chance to meet and work with a bunch of amazing people. I managed to learn many things during my time there, but all good things must come to an end. It was not an easy decision to make but it was time to pass the torch and move on.
I will miss the family I have made there; none more than the other members of the Ordering team I have spent years in the trenches with. I love all you guys and wish you all the best!
Just a quick note, the Stripe Java API I have been working on is now up on GitHub. I have not had a chance to work on it lately, but I have been meaning to get it up there.
I wanted to go ahead and push out my latest update on the Stripe Java API I have been working on, but due to an extremely crazy schedule, I am afraid I cannot attach much documentation now. I hope to remedy that in the future as soon as my schedule lightens up a little. Here is the stripped down CFC. Currently it is able to process a charge as well as grab a list of events from Stripe. Here is the code.
As an example of how to use the CFC, here is a small demo.
A few things to note here. To get around having to javacast the expiration month and years to ints, if you pass them as string values they evaluate correctly. This also applies to the amount field. Any parameter you are allowed to pass according to the java API documentation should work just fine.
I have setup a few servers the last few days and I have finally honed my nginx/Railo configuration down to the point where it is about as good as it is going to get. The actual server configuration is minimal; set the host name and the log file location and you are done. Everything Railo needs to run is set in an include file that can easily be added to any site.
As a quick example, here is an example host file:
The host configuration is straight forward. Next we move on to the Railo connector:
The Railo connector is pretty much a rehash of my other posts, with a few differences. Every thing is now contained in the include instead of just the main connector. This handles the main rewrite block (supporting SES URLs out of the box), locks down the Railo admin so that it cannot be accessed directly as well as hiding the admin in /secret/location/(web|server).cfm.
Also I have added the extra proxy parameters to the Railo admin proxy. This should keep you from banging your head on the desk for a few hours wondering why you Railo context seems to be pointed somewhere else since the host headers are not getting proxied to Railo. It was a bit of an oversight in the original posts.
I have been working on a pet project for a week or so and I thought it would be nice to add the ability to process payments. I remembered a post I read a while back about using Stripe to process credit card payments so I thought I would give them a shot.
Actually getting them going was not that hard. There are quite a few projects out there wrapping the Stripe API, however most of them are pretty big and I am just looking for something simple. They have a Java API available so I thought I would give that a shot. There is not much information about using the Java API in ColdFusion, so it was a little trial an error.
First, I needed to get two jar files and add them to my classpath; the latest stripe api and also the Google gson jar file (links to both may be found on Stripe’s web site.
The fun part was getting it to work which was easy enough by looking at the API documentation and examining the stripe-java test code on GitHub. Here is what I quickly came up with. Not all functionality is working of course, but at least there is a test charge going through and successfully completing.
I hope to have something more complete working later this week.
I was working on some URL rewriting rules on my server this evening when I was taking a break at work. Just out of curiosity I tried hitting some of the files that are available in the WEB-INF directory and was surprised to find out that I could easily view all my context logs and anything that was not a ColdFusion template. In retrospect, I should not have been surprised but I should have taken steps to prevent that from ever happening.
I have a drop.conf file that gets loaded on every site so blocking directory access on all my sites was just a matter of adding the directive to block access to the directory and restarting nginx.
In hindsight, I should have checked that a long time ago. Hopefully someone will learn from my mistake.
Recently I shut down my Windows Media Center PC and it felt like the end of an era. I was no longer using its TV recording capabilities but mostly using it in my son’s room as a media receiver. Needless to say it seemed a bit of a waste so I finally just pulled it down and we have been using a Sony SMPN-100 that can easily be moved around the house wherever it is needed.
Fast forward a few weeks my son decided he wanted his own computer. I had the old Media Center machine sitting in a closet providing a nice home for a bunch of dust and a few spiders so it made sense to pull it out of mothballs. I knew it would easily plug into his TV as that is how it spent a majority of its life so I went about getting it reconfigured. I have recently switched my personal system over to Arch Linux so I thought it would be a good time to reload his machine with Arch and install XBMC on the machine so he could also have a media center when he is not playing Minecraft.
I quickly had Arch and XBMC up and running. Next I had the IR receiver and my old Hauppauge MCE remote hooked up and then trouble began. It would seem that the newer Linux kernels have baked in support for IR remotes out of the box which is definitely a plus, but there is not much documentation out there about getting it working correctly. Even without installing the lirc daemon the remote somewhat worked with XBMC but not as I would have expected. I spent the better part of two days attempting to get it working as my remote of old. I googled, I read forums and every blog post I could find about lirc and getting it setup with XBMC. There may have been a little grumbling and swearing thrown in for good measure. No matter what I tried, running irw it seemed to pick the remote up as a keyboard.
Since my remote apparently had an identity crisis I decided to try a different approach; if the remote wanted to be a keyboard that was fine with me. The trick is finding the key map for the remote and reprogram in such a way it did what I wanted it to do. First I needed to find out what driver it was using for the remote by running ir-keytable.
Found /sys/class/rc/rc0/ (/dev/input/event5) with:
Driver mceusb, table rc-rc6-mce
Supported protocols: NEC RC-5 RC-6 JVC SONY LIRC other
Enabled protocols: RC-6
The important part here is to find out what key table the remote is using, in this case I am using the rc6-mce key table. Next I copied the key table in /etc/rc_keymaps/rc6_mce into my home folder and basically the next part is trial and error. I ran ir-keytable -t (which operates much like irw) and pushed the button I wanted to map starting with the OK button to find the key code. I would then push the button that worked in XBMC to find out what that key code was and then Ctrl-C out of ir-keytable and fire up an editor to modify the rc6_mce key map file in my area. I changed the KEY_OK to KEY_ENTER in this case and saved the rc6_mce file. Next I ran sudo ir-keytable -c to clear the current table and then reprogram the buttons with sudo ir-keytable -w ~/rc6_mce which loads my new key map. I tested to make sure it worked as expected and I was happy to have my OK button back. OK indeed.
Basically just rinse and repeat for any key you want to map on the remote. Once I was happy with my results, I copied the rc6_mce keymap from my home folder back to /etc/rc_keymaps so it would be reloaded at boot. I made a backup of the original rc6_mce key map file just to be on the safe side.
Hopefully that will save someone a little bit of time and heart ache.