Gillius's Programming

All Posts

Introduction to Groovy

This Friday, I will be giving a presentation on Groovy at the university where I work (RIT). You can view the presentation online (with extra notes under "speaker notes") or as a PDF and you can view or download the source code for the examples. It is primarily meant for audiences already familar with Java code, but it should be approachable if you know other languages like C#. A description of the talk:

Groovy is a dynamic language for the Java Virtual machine inspired by Python, Ruby, and Smalltalk. After Java, it is the first approved JVM language (via JSR 241). Groovy can be used as a scripting language in a shell environment, a way for applications to provide scripting and extension capabilities, domain specific languages and configuration files, or as the base language for whole applications and frameworks such as Grails (like Ruby on Rails) and Griffon. Due to supporting most Java syntax and ability to integrate with any existing JVM code, Groovy is particularly useful for existing Java developers wanting to leverage dynamic languages while retaining use of the full Java ecosystem.

This talk will cover the following areas:

  • Groovy syntax compared with Java
  • How dynamic calls are implemented
  • Closures
  • Runtime Metaprogramming: how Groovy extends existing Java libraries
  • Compile-time Metaprogramming (AST transformations)
  • Creation of Domain Specific Langauges (DSLs)
  • Code examples where Groovy's features make the strongest impact 

Understanding Angstrom Bitbake Recipes

I'm getting to play with the BeagleBone, an "embedded" ARM device. The "official" image for this device contains a build of the Angstrom distribution. Angstrom itself is based on OpenEmbedded. If you want to modify or make any software for the bone, or just stay on the cutting edge and build your own images, you want to build using the bitbake system (instructions are at the bottom of this page). Once you've gone this far, you might wonder if you can extend this to build your own software. Currently I'm trying to figure it out, but the documentation is very hard to find and I wanted to share the locations of the most useful information in the hope that this helps your search. Read on for more details.

Continue Reading >

Removing php extensions in IIS with Ionic's Isapi Rewrite Filter

I was placed in a situation of updating and redeploying a PHP application on an older IIS 6 server. I have some small experience with PHP, but none at all with IIS (only Apache). One thing that I feel is very important that I know not everyone cares about is having clean URLs, or at least, removing the extension of dynamic pages. I don't know why a user to a website should have to see and know (when typing) whether my page is implemented in PHP, ASP, ASPX, JSP, or whatever. Typically I also like to remove .html as well, but actually I feel you can go either way on that one (because HTML is the content type the browser sees, not a backend). In this case the site was already moving URLs, and the long-term move away from PHP was also possible. I didn't want to risk having to break bookmarks again in the future.

Normally in Apache I would turn on MultiViews and also rely on default files like index.htm/php. While IIS 6 supports default files, it doesn't support MultiViews as far as I can tell. My searching didn't find much workarounds. I did find Ionic's Isapi Rewrite Filter though, which bascially is an open-source mod_rewrite for IIS. Read on for details on my configuration.

Continue Reading >

Java and Scientific Python with JEPP? Nope

At work, I and the other software developers work primarily with the Java programming language. Part of our organization's goal involves algorithms and scientific data analysis of data sets, which is researched by another team. Traditionally there has been a lot of data analysis and scientific work with Matlab, but since the team has switched to Python. Python appears to have a strong scientific community and tools (such as pythonxy) for rapid development for scientific computing, data analysis, and data visualization. Since then, I have looked at ways where we can collaborate by running their algorithms in the JVM, without the need for costly and error-prone porting to Java. Ideally I'd like a way for the Python code to leverage a codebase developed over 8 years for our problem domain, and for Java code to leverage new work being done in Python.

Read on for my current progress...

Continue Reading >

Jove crash when compiling automake

Short answer for the web searchers: if /usr/bin/emacs points to jove, install emacs.

I've had the privilege of starting to play around with Angstrom (fork of OpenEmbedded) on the BeagleBone. I needed to build some bleeding-edge software with bitbake on an Ubuntu 10.10 but I ran into an interesting problem. When building the distribution, it builds all of the tools from the ground up, including automake. However, automake would crash when building some sort of support for emacs with a jove crash. I couldn't understand how they were related.

In the end, I found that since jove was installed but Emacs was not, /usr/bin/emacs actually pointed to starting jove. Automake was trying to use some kind of compiler for emacs (I guess it was making some emacs macros or syntax thing?). It must have thought emacs was properly installed and called Jove with a set of parameters that caused it to crash. In the end, the solution was to install Emacs. The build system itself wasn't in error, it was my machine, so it can't be reasonably "fixed" in the code so I put this post in hopes of people finding it if they search for the same problem.

Web Security: XSS and CSRF

At work I've been making a foray into web development. I've always been one to be very interested in "how to do it right" rather than just "get it done" and stop when it looks like it works. Security is one of the things where it works perfectly for the user -- but also for the attacker if you don't do it right. I've had a lot of experience with securing things with encryption, but the web is an entirely new (and scary) world.

The two attack vectors I looked into is XSS (Cross-site scripting) and CSRF (cross-site request forgery, aka XSRF).

Continue Reading >

Custom CRT Resolution on NVIDIA GTX 460

I have a dual monitor setup that consists of an old 19" CRT (Philips 109P) and a 20.1" 1600x1200 LCD (Samsung 204B). I've always just managed with having different resolutions on the monitors, but one thing that always bugged me is that the pixels were different sizes if I picked standard resolutions. When you drag a window from one monitor to the other you get an odd "zoom" effect. But I always knew that CRTs don't have fixed resolutions and you can pick whatever you want. I figured out the setup to create a custom resolution in Windows so the two differently sized monitors would match up exactly.

Continue reading for the details.

Continue Reading >

Coder Grub - Quick Chunky Pasta Sauce

Even coders have to eat sometime. Check out my guest post on my wife's blog, Kitchen Trial and Error.

Summer is great for food because you can always find fresh ingredients at the local farmers' market or your own garden. Sometimes you bought (or harvested) a lot of great vegtables and don't know what to do with them. With no meal planned on a lazy Saturday afternoon, we were getting very hungry and needed something fast. I made a fresh pasta sauce from the tons of fresh vegtables in the house.

Conversion to Movable Type - Part 3 - Assets

The last challenge in the Gillius.org conversion was assets. At first, I tried to find an external solution like the "Asset Handler" plugin, but it only works for MT4. In the end I wrote my own Java code to scan my assets and upload each of them via the XML-RPC interface.

Continue Reading >

Conversion to Movable Type - Part 2 - Page Import

Using the XMLRPC interfaces I mentioned in part 1, I needed to parse my HTML content, strip it of the original "template", and upload it to my development Movable Type instance. I used Java and XMLRPC for this, Java because I was most familiar and XMLRPC since that is what MT provides.

Continue Reading >