Emerging Technologies Laboratory (ETL) Blog

Oct 01 2012 laufer
By: laufer
Apr 02 2012 laufer

Using FSharp PowerPack in MonoDevelop 2.8.2 on Ubuntu

Assumptions

  • Ubuntu 11.10 with Mono 2.10.x from main repository
  • MonoDevelop 2.8.2 from this PPA (the add-in does not currently compile against MonoDevelop 2.8.8.4)
  • Custom installation of F# for .NET 4.0 per items 1 and 2 of these instructions (required for add-in to work)
  • Custom installation of F# add-in for Monodevelop 2.8.x for Ubuntu from here
  • Custom installation of F# PowerPack for .NET 4.0 per this discussion from here in /opt/FSharpPowerPack-2.0.0.1/bin

Instructions

  • project > edit references > .NET assembly
  • navigate to the location of your FSharp.PowerPack.dll
  • add

Thoughts

MonoDevelop uses pkg-config to pick up existing assemblies, but I could not figure out how to add the F# PowerPack assemblies in this way.

24 notes  /  

By: laufer
Jan 22 2012 laufer

Testing connection bandwidth from command line for automatic monitoring

Among the approaches discussed here, this one seems to be the most solid (ab is part of apache2-utils).

ab -n 4 -c 4 http://speed01.il.towerstream.com/speedtest/random1000x1000.jpg | grep 'Transfer rate' | cut -c 23-28

This gives me the actual transfer rate in KB/sec. I wrapped a little Icinga script around it for continual data collection and notification of bandwidth drops. 

56 notes  /  

By: laufer
Jan 20 2012 laufer

Heroku versus Cloud Foundry from an Educator’s Perspective

There are several useful comparisons between Heroku and Cloud Foundry, including this one and that one. I am going to add a brief educator’s perspective.

Why APaaS in the first place? To have a common reference platform for students to deploy to from day one. This eliminates the common last-minute deployment problems.

My specific requirement is to support the technology stacks I have chosen for pedagogical reasons for my web application and web services courses. (In both courses, we pay considerable attention to architecture.)

  • Scala
  • Play framework for web apps
  • spray for RESTful web services

As a platform, Cloud Foundry is open-source, while Heroku is closed-source. Fair enough. But what are the relevant differences from my perspective?

  • With Heroku, your application needs to have a main class as its entry point. You structure your application using Foreman and push the source to the cloud using git. Building, staging, and deployment then take place again in the cloud. If these steps work on your local machine using, say, Maven or sbt, they are very likely to work the same way on Heroku. 
  • With Cloud Foundry, your application must be packaged as a war to run on Tomcat 6, in the case of Java or Scala. The build process takes places on the local machine, you push a war to the cloud, and this hard-coded server staging logic is invoked. The problem is that you are stuck with the default blocking Java connector! Because spray requires the non-blocking (async) connector, this means that you cannot deploy spray to CloudFoundry.com for now. If you know a workaround, please let me know! 
  • Both have various useful add-ons, such as relational and NoSQL databases, message queues, etc.
  • Heroku has a free tier, while Cloud Foundry has a free trial and it’s final pricing structure has not been announced yet.

For these reasons, I ended up choosing Heroku for this spring semester. I’m quite optimistic that it’s going to be fun.

97 notes  /  

By: laufer
Jan 10 2012 laufer

Non-streaming media formats are transitional (except LPs)

My sister said it almost two years ago as we were dissolving our dad’s household: “Let’s keep the LPs but not worry as much about the CDs. They are a transitional format. LPs, on the other hand, will not go away any time soon.”

I realized that her prediction had already been fulfilled when I finally got around to looking at Spotify. This is a searchable music-on-demand service, like Netflix WI for music but with a vast selection of tracks, like iTunes already populated with almost all the music out there. In addition, it allows you to set up radio stations around specific artists.

My conjecture is that 95% of my CDs are already on Spotify, and my approach is going to be not to buy new CDs or downloadable tracks, except for recordings by regional artists or others that have not appeared on official labels. Similarly, I am not planning to invest in Blu-ray equipment or media.

Here is an in-depth analysis of Spotify versus its competition. Its closest competitor seems to be Rhapsody, which has been around for a number of years. Both claim over 13 million songs. But Spotify has a free plan and lower rates on the paid plans. The next few years should be interesting…

41 notes  /  

By: laufer
+ laufer

Happy with Ubuntu Unity

So many Ubuntu users seem to dislike Unity that Linux Mint has displaced Ubuntu in popularity. I actually like it and have no plans to switch away for these reasons:

For advanced launching needs, I got used to just pulling down Guake.

43 notes  /  

By: laufer
Apr 14 2011 gkt-deactivated20110425-deactiv

Less is more, ETL style

We in the ETL have always been about technology, so what I am writing is likely not going to surprise anyone. We’ve changed our web site (again) back to one that is based on Google Sites. A lot has changed since the last time we tried using Google Sites. Google’s developers seeming have been working overtime to make the product not only a compelling option for private sites and wikis (where it all came from back in the days of JotSpot) but also for public-facing sites, much like we need for our laboratory. 

What precipitated this resurgence of interest in Google Sites on my (our) part? I was recently reading this article on Mashable about the top 5 design mistakes small businesses make. I won’t rehash the article here but will just say that we were guilty of violating at least a few of them. I’m not going to go into the details but am going to claim with minimal proof that Google Sites helps our research lab to solve all of the problems, thereby allowing us to focus on the most important thing when it comes to web sites: content. Content is king…or queen! While we still have a ways to go in terms of content, Google Sites was particularly helpful at solving problems of navigation (#1 on Mashable’s list), color and contrast (#3), and clutter (#5).  We already had a clear call to action (#2), so our focus can now be entirely on content (#4). In addition, our Google site is usable on mobile platforms, including Android and iOS.

While we’re still convinced that many large organizations and corporations will continue to find it necessary to deploy large-scale content management systems (commercial and/or FOSS solutions), we’re more convinced than ever that “cloud” hosted solutions like Google Sites are only going to get better as we’ve observed firsthand. Not only are these solutions backed by a rock-solid distributed foundation to yield near-zero downtime, they are easy to manage from anywhere and customize to match institutional/organizational house styles. It’s really hard for any self-hosted solution to compete with what Google offers to anyone and everyone!

We’d still like to see Google offer a bit more customization of the site theme and allow for more flexible layouts of page elements, but these features are not strictly needed for a growing number of uses. And as we mentioned, the ability to do so has improved almost exponentially since the last time we tried using Sites. I know that I would rather spend more time working on the various projects we’re hosting in the ETL and less time thinking about whether my web site will be up and running when I am asleep at night. Thank you, Google.

59 notes  /  

Mar 10 2011 laufer

Successive Pattern Matching and the Happy Path

Before

Successive (nested) pattern matching with exhaustive matching at each point, 16 LOC in Scala.

    case req @ DELETE(Path(Seg("users" :: name :: "bookmarks" :: uri))) => {
      val uriString = uri mkString "/"
      logger.debug("DELETE /users/%s/bookmarks/%s".format(name, uriString))
      userRepository findByName name match {
        case Some(user) => req match {
    	  case BasicAuth(u, p) if verify(u, p, user) => {
    	    user.bookmarks.remove(uriString) match {
    	      case Some(_) => NoContent
    	      case _ => NotFound
    	    }
    	  }
    	  case _ => NotFound
        }
        case _ => NotFound
      }
    }

After

Successive happy-path style pattern matching with non-exhaustive patterns and MatchError exception handling, 9 LOC in Scala.

    case req @ DELETE(Path(Seg("users" :: name :: "bookmarks" :: uri))) => try {
      val uriString = uri mkString "/"
      logger.debug("DELETE /users/%s/bookmarks/%s".format(name, uriString))
      val Some(user) = userRepository findByName name
      val BasicAuth(u, p) = req
      val true = verify(u, p, user)
      val Some(_) = user.bookmarks.remove(uriString)
      NoContent
    } catch { case _: MatchError => NotFound }

Using for-comprehensions

A similar happy-path style with similar conciseness but without exceptions can be achieved using for-comprehensions with the Option monad. 8 LOC plus 4 LOC abstracted into the custom extractor.

    case req @ DELETE(Path(Seg("users" :: name :: "bookmarks" :: uri))) => {
      val uriString = uri mkString "/"
      logger.debug("DELETE /users/%s/bookmarks/%s" format (name, uriString))
      (for {
        MatchingBasicAuth(_) <- Some(req)
        _ <- repository.removeBookmark(name, uriString)
      } yield NoContent) getOrElse NotFound  
    }

Discussion

  • The nested style is ugly because it is verbose and includes multiple branches with the same result. The happy-path style is much more concise and easy to read.
  • The happy-path style “misuses” exceptions (in this case, MatchError) for non-erroneous control flow. This needs to be weighed against the conciseness and readability gains.
  • Why not an assertion instead of using true as a pattern? Because this is a functional concern, whereas assertions are a testing concern that might be disabled in production use.
  • The for-comprehension style using the Option monad is the most clean and concise. It also integrates beautifully with custom extractors.
  • Other thoughts?

103 notes  /  

By: laufer
Mar 09 2011 gkt-deactivated20110425-deactiv

Welcome to the ETL Blog

Our first post—not too exciting!

23 notes  /  

Page 1 of 1