Showing posts with label tools. Show all posts
Showing posts with label tools. Show all posts

Monday, October 4, 2010

Is Xmarks Dying or Not?

Early this year, I made the switch from Google Bookmarks to Xmarks. I've been really happy with Xmarks and have used it to sync the bookmarks and open tabs in Firefox, Chrome, and IE on Windows and Firefox, Chrome, and Safari on Mac OS. They had plans for an Android client which I would have installed the moment it was released. Unfortunately, the company announced on September 27th that they'd be discontinuing the service around the end of this year. You should have seen how much the news deflated me. I'd finally found a way to keep all of my browsers in sync and now the service would be going away! Well, I found out some promising news today. The outpouring of support and the number of disappointed users expressing their willingness to pay for the service has made the company reconsider. If you're an existing customer or even someone who just found out about the service and would be willing to pay at least $10 per year for it, please go and sign the pledge at PledgeBank! I really hope it reaches their 100,000 signature threshold.

Update: Xmarks was acquired by LastPass, a company that provides a password management service. You can continue to use each service for free, pay $12/year for each of the premium services separately, or do what I did and sign up for the combination for $20/year.  What a nice outcome! :)

Thursday, September 17, 2009

Subversion – Odd Problems and Funny Solutions

I've been using Subversion and TortoiseSVN since 2005.  They're both great technologies and I'm very happy they exist.  However, I think anyone who's been using them for a while has periodically encountered some weird problems and has had to come up with a few strange (and even funny) solutions.  I certainly have.  In this post, I describe one example.

Earlier this week, a developer I work with saw the following in a TortoiseSVN window when he ran update on a working copy:

Error: Couldn't do property merge 
Error: Unable to make name for 'C:\tempfile'

Not knowing how to proceed, he asked me for help.  We tried my typical first approach: running cleanup via Tortoise on the working copy.  That didn't fix it, so we ran a "Check for modifications" and discovered that there were a few temp files scattered through the directory tree.  We deleted those and tried again.  Still the same message, so on to Google.  I searched for various permutations of the error messages, but was unable to find anything other than code check-in comments for Subversion itself, which appropriately enough uses a Subversion repository.  For some reason, I wish I remember why, we next tried updating just one child directory within the working copy.  It worked!  We tried updating all the other child directories and those worked as well.  So, that suggested that there was something wrong with the Subversion metadata, but only at the top level.  We went into the .svn directory and started browsing through the files.  When we looked at the entries file, we noticed a few lines starting with "incomplete".  I tried moving the entries file out of the .svn directory to a totally different location in the file system, hoping that when we updated or ran another cleanup, the file would simply be recreated.  Unfortunately, with that file missing, the directory was no longer considered by Subversion to be a working copy.  Disappointed, I moved the entries file back into .svn and started thinking about what to do next.  On a whim, the guy I was helping tried updating again and it worked!  Somehow, changing the directory from a valid working copy to an invalid one and back again was enough to fix everything.  Who knew?!

Have any good Subversion/TortoiseSVN troubleshooting stories or troubleshooting tips of your own?  Please leave them in the comments.

Wednesday, May 27, 2009

FogBugzReporter: Introduction

This is the first post in what I plan to be a series about a small application named FogBugzReporter that I began writing in October of 2007.  I'd recently started using the on demand edition of FogBugz from Fog Creek Software to track my time spent consulting and was disappointed to discover that it had no direct way for me to generate time reports.  Fortunately, I discovered that along with the web UI, FogBugz also had a pseudo-REST API for interacting with the application (I say "pseudo-REST" because almost all operations can be performed with HTTP GETs, including ones that change state on the server).  I read the API docs, quickly wrote a simple Swing application in Java, and made it available to the rest of the FogBugz community.  Soon after, I started experimenting with Groovy and realized that porting the app would be a nice way to get some experience with the language, including SwingBuilder and the great APIs for processing XML.  I did that and eventually moved the code from a private Subversion repository to one on Google Code under an Apache license.  Until a few days ago, it sat for the most part unchanged.  In the meantime, my Groovy skills have improved a bit (I'm still no expert), the language has evolved, and the technologies around it have grown.  In this series, I plan to gradually bring the application up-to-date and polish up the code.  I'll update this posting with links to the other posts in the series as I write them.

Posts:

Planned Posts:

  • FogBugzReporter and Griffon
  • Suggestions?

Monday, May 11, 2009

Trying out DISQUS for Comments

I've decided to try out DISQUS for handling comments on my blog. Let me know what you think. I can always revert back to Blogger comments if desired.

Update: It turns out that there's a bug in Blogger that precludes you from using DISQUS in conjunction with an external post editor. Since I'm happy with Windows Live Writer, I guess I'll disable DISQUS for the time being and revisit the decision if the bug gets fixed.

Sunday, May 10, 2009

VisualVM and Cutting Method Calls by Over 1000x

I’ve been using VisualVM on and off with modest success since I first found out about it at JavaOne 2008.  In addition, since JDK 6 update 7, it’s been included as part of the standard JDK installation (released in July of 2008).  I was quite happy when it helped me identify bottlenecks and cut down the time to run a suite of unit tests by 50% (from 2 minutes to 1 minute).  After all, the less time it takes to run unit tests, the more often they’ll get run.  However, my biggest success using VisualVM came in early April, when I was asked to figure out why a use case was exhibiting disturbing performance characteristics.

When I first walked through the use case, it was taking about 10 seconds to run with 50 items.  The time appeared to be proportional to the number of items or perhaps even worse.  This was a scary prospect given that there would often be more than 10,000 items in a real production setting and that the use case was intended to be interactive (as opposed to a batch or background task).  A careful code review might have revealed the problem, but I knew it would be far more efficient to profile the code as a way to identify hot spots.  I started up VisualVM, connected to the relevant JVM, turned on CPU profiling, and collected data for the use case.  Sadly, I seem to have lost the relevant snapshot, so you’ll have to trust me when I tell you that the method SqlQueryFile.isSupported() was being called over 36 million times!  I made some minor tweaks to the method itself which improved its performance by about 10 percent – okay, but not nearly enough.  I next identified what was effectively a loop invariant.  The isSupported() method was being called repeatedly with the same query and schema.  As you can see from the snippets below, I pulled that check out of the nested loop.

Before:
for(Platform platform=p; platform != null; platform=platform.getParent()) {
  for(SqlQuery q : metricQueries) {
    if (isSupported(q, datasourceSchema)) {
      if(q.getMetricPath().equalsIgnoreCase(metricPath) &&
         q.getPlatform().equalsIgnoreCase(platform.getName())) {
        if(ret==null) {
          ret=q;
        } else {
          if(isMoreRecentThan(q, ret)) {
            ret=q;
          }
        }
      }
    }
  }
}
After:
Collection supportedQueries = new ArrayList();
for (SqlQuery q : metricQueries) {
  if (isSupported(q, datasourceSchema) && q.getMetricPath().equalsIgnoreCase(metricPath)) {
    supportedQueries.add(q);
  }
}

// need to optimized this code for better performance
for (Platform platform = p; platform != null; platform = platform.getParent()) {
  for (SqlQuery q : supportedQueries) {
    if (q.getPlatform().equalsIgnoreCase(platform.getName()) &&
        (ret == null || isMoreRecentThan(q, ret))) {
      ret = q;
    }
  }
}

When I ran the profiler again, it turned out I'd vastly reduced the number of calls to (~36 million to ~9 million) and the time spent in (80+% to 26.3%) the isSupported() method, as you can see in the picture below:

snapshot-040109-7pm

I probably could have left it there, but after taking another quick look, I noticed a very simple way to save even more time.  I could flip the order of the conditional expression in the first if statement.  That way, the cheap operation (which usually returns false) would come first and frequently allow us to skip the evaluation of isSupported().

if (q.getMetricPath().equalsIgnoreCase(metricPath) && isSupported(q, datasourceSchema)) {

To my surprise, this cut the number of calls to around 27,000 and the time spent in the method to 1%!

snapshot-040109-8pm

With these optimizations in place, the same use case with 11,000 items now took less than a second.  Thanks VisualVM!

Update: This post was a second place winner in the Java VisualVM Blogging Contest!

Sunday, May 3, 2009

Groovy versus Scala (Update)

Back in March of last year, I wrote a post comparing Groovy and Scala.  Enough time has passed that I thought it was worth revisiting the topic.

In my original post, I reached the conclusion that at least for me, it made sense to first focus on Groovy and then later learn more Scala.  I still feel that way, but my thoughts on the matter have evolved.  How about combining Groovy and Scala in the same program or architecture?  That thought had vaguely occurred to me already, but it was solidified by the discussion of Twitter’s use of Ruby and Scala.  They started off using Ruby (Ruby on Rails, in particular) to run their whole site.  When they ran into performance and scalability issues, they determined what was causing the most trouble (back-end tasks) and gradually converted the relevant parts of the system into Scala.  This kind of polyglot programming makes sense to me.  It follows the principle of “using the best tool for the job.”  I think the combination of Groovy and Scala makes even better sense: they’re designed to run and interoperate with other languages on the same VM.  Not surprisingly, I’m not the first person to think of this.  I found two posts from Andres Almiray (“Griffon: Groovy & Scala working together” and the follow up “Follow up on Griffon/Groovy/Scala”) showing some practical examples and another on a different blog discussing the ability jointly compile “Groovy+Scala+Java”.  I’m excited to watch and perhaps participate in these exciting developments.

Side Note: On the subject of Groovy, when my one-year IntelliJ license was close to expiring, I decided to check out NetBeans.  I was pleased to discover it had quite good Groovy and Grails support.  I’ve been using the 6.7 milestone builds and now the beta, in order to get support for Grails 1.1.  If you haven’t tried Groovy/Grails development in NetBeans yet, you should.

Update: Here are links to the items Andres mentioned in the comments

Update (Jan 12, 2010): Andres recently posted the highly relevant Groovy & Scala: a tale of two JVM languages

Saturday, April 25, 2009

Simple, But Very Clever

I was reading some articles on PCWorld (see my last post to find out why) and came upon an interesting link in one of the comments.  The link took me to SuperFiller.  It's a simple service which helps solve a problem I have all the time.  Have you ever put together an order on Amazon where all the items qualify for free shipping, but the total is a bit shy of the required 25 dollars?  Well, as the front page of the site shows, you can ask SuperFiller what items are available on Amazon for $1.47, or whatever amount you need.  It's simple and probably wasn't very hard to code, but someone had to think of it.

p.s. I'm guessing they make a small amount of money on each purchase through Amazon Associates referral fees.

Sunday, April 5, 2009

Blogger Causing Problems for SyntaxHighlighter

I kept noticing blog entries with beautifully rendered source code snippets and finally clicked the blue question mark in the upper left of one and discovered that they were using Alex Gorbatchev's SyntaxHighlighter JavaScript library. For my last post, I followed the instructions in the Usage Guide, using the hosted version since I can't upload JS files to Blogger, at least as far as I know. If you look at my post, you'll notice that I have two 1 line Groovy snippets and one 5 line Java snippet. The 1 liners were no problem, but when I first tried to display the 5 lines of Java it showed up as just one line with visible <br> tags where the line breaks should have been. It turns out that when I pasted the code into Blogger's post editor, even though it was in HTML source mode, it inserted <br> tags for the line breaks even though they were showing up inside of a <pre> tag. It turns out that there are two solutions to the problem. I'll explain the better one first, although I didn't find out about it until trying the other one.

When I asked Google for help, it led me to a page talking about how to use SyntaxHighlighter with Blogger. The post itself didn't contain any new information for me, but the comments were useful. "Robje" had apparently experienced exactly the same problem as me. "Debiprasad" then asked, "What is your settings for 'Convert line breaks' set to? In my case, if I set it to 'Yes', it's inserting <br/> into codes defined under <pre> tag." Ah ha! I looked on the "Formatting" subtab under the "Settings" tab in the Blogger control panel and discovered that mine was set to "Yes". Ack! What an annoying default! With it set to "No", it seems to fix the problem.

In case that doesn't work for you, Google also brought me to a page on what must been the old home for SyntaxHighlighter. Once again, the gold was in the comments. "fahd.shariff" mentioned that if you use the post editor in Blogger in Draft, this isn't a problem. As I said earlier, I gave this a try before finding the preferable solution and it worked for me so it's a reasonable solution to fall back on.

Saturday, October 25, 2008

JetBrains Seeder Program

JetBrains has recently started the JetBrains Seeder Program, an attempt to build a volunteer evangelism network for their products. I'm not sure I'd make a great evangelist, since my use of IntelliJ IDEA has mostly been limited to my experimentation with Groovy. I might join the program anyway, since IntelliJ is a great IDE (especially for Groovy) and I'm curious to see how the seeder program works.

Update: I decided that I'd already signed up for enough programs like this without taking full advantage of them. As a side note, I've been trying out NetBeans 6.5 for my Groovy and Grails projects and have been pleasantly surprised. I'll have a dilemma on my hands when it comes time to either renew or drop my IntelliJ license in April.

Saturday, August 16, 2008

Amazing Research in Image Processing and Presentation

I recently stumbled upon a very interesting pair of research projects that started at the University of Washington.

The first is titled, Using Photographs to Enhance Videos of a Static Scene. The video toward the bottom of the screen demonstrates using still images to automatically enhance the resolution, lighting, and color of videos, along with the ability to mask sections of scene and replace them with substitute images.

The second project has been picked up by Microsoft Labs and further developed into Photosynth (unfortunately requiring a Windows-only browser plug-in). It allows you to view a set of images of the same subject in a 3-D browser. See this very cool video for several examples.

Wednesday, April 2, 2008

RightScale - managing Amazon EC2 instances

I was recently reading some postings on High Scalability and came upon one discussing some cool new features in EC2. It also mentioned a company, RightScale, which has a product for automatically managing your EC2 instances, including automatically launching and killing them based on spikes in demand. The company also has a good EC2-related blog, which unfortunately seems not to have an available RSS feed (odd!).

Wednesday, February 20, 2008

Sizer - nice little window sizing tool

I was just looking at the blog of Jeff Winkler, another member of the Boston Java Meetup and saw his entry, "Fix Offscreen Windows Easily with Sizer". Using a screencast, he describes a cool little app called Sizer, which allows you to set the exact size of an application window on a Windows machine (looks like it doesn't support Vista yet), but also helps you make lost/off-screen windows visible again. It comes with three preset window sizes (640x480, 800x600, and 1024x768), but you can easily add your own by right-clicking on Sizer's System Tray icon and choosing "Configure Sizer...". I've added a few which subtract the approximate height of the taskbar (30 pixels on my machine) so that I can see what an app would look like at other standard monitor sizes. I like my widescreen monitor, but I know not everyone has one. I hope you find it useful.