Much ado about scripting, Linux & Eclipse: card subject to change

Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

2011-02-01

Syntax highlighting for code snippets in blogs

Where does he get those wonderful toys? - The Joker, Batman (1989)
Recently I was asked how I make code snippets on this blog prettier. Here's how.
  1. In your blog's template, install Alex Gorbatchev's Syntax Highlighter.
  2. Then, in the body of the blog post (with all occurrences of "<" HTML-escaped as "&lt"):
    <pre class="brush:shell"> ... </pre>
    or
    <pre class="brush:java"> ... </pre>
    or
    <pre class="brush:xml"> ... </pre>
  3. There are other "brushes" available too with which you can "paint" your code. I generally only need java, xml, and shell.

2008-12-23

Helpful Javadoc?


...as the moon sets over the early morning Merlin, Oregon mountains, our intrepid adventurers type...
-- Funny, yes, but not so helpful... unlike this bit of doc.

2008-12-04

My love-hate with SVN, Part 3: CollabNet Subversion (JavaHL)

Installing Subclipse w/ JavaHL (aka CollabNet Subversion)

  1. Download CollabNet Subversion for your operating system (Linux, Windows, MacOS X). This provides the JavaHL layer so that Subclipse can talk to SVN repos using pure Java (but not SVNKit). Install it.
  2. Download Eclipse 3.4.1 (or Fedora Eclipse). Start it up, making sure to pass in -Djava.library.path=/opt/CollabNet_Subversion/lib (linux only).
  3. Help > Software Updates... > Available Software > Manage Sites... > Add... > http://subclipse.tigris.org/update_1.4.x
  4. Install the whole site. Restart when prompted.
  5. Window > Preferences > Team > SVN > SVN Interface > Client > JavaHL (JNI)

Well, I feel I've been remiss in ranting about Subclipse. Turns out a fresh Eclipse + a fresh install (and a lot of trial and error / googling has fixed things.

You have not exactly given us a chance to help you with your Subclipse issues.
Mark, you're right, Subclipse does work -- it's just not the most straightforward thing to install. And when it breaks suddenly and for apparently no reason, losing hours of productivity to fighting w/ source control instead of writing and committing code, it's VERY frustrating, especially considering that Eclipse's CVS support Just. Works.
Does the JavaHL library exist in the folder you pointed to?
Well, given the wiki doesn't actually say what file(s) are supposed to be there, I had to guess. I have /usr/share/java/svnkit-javahl-1.1.4.jar and /usr/share/java/svnkit-javahl.jar (a symlink to the previous). Is that what Subclipse / Subversive are looking for? No idea.
Do the preferences say "Not available"?
They do. After much surfing, googling, testing, registering to download, waiting for a password, cursing, downloading and rpm -i ... I finally figured out that all I needed to do was get CollabNet Subversion Command-Line Client v1.5.4 (for Red Hat Linux), and (as noted in the wiki), add -Djava.library.path=/opt/CollabNet_Subversion/lib to my Eclipse startup. Could you save others this search by linking to the downloads page from the wiki? Or even linking to it from the Downloads page??
I think somehow an old version of their JAR is being loaded by your Eclipse and not the one in their plugin. Do you have their JAR installed in your Java extensions folder or something?
Reinstalling Eclipse and purging some jars of unknown pedigree & version seems to have worked. I have svnkit 1.1.4 in the above folder (/usr/share/java), and org.tmatesoft.svnkit_1.2.0.4949 in a linked folder in my dropins/.
Finally, as to your History error, Subclipse does not have this problem, but I know the cause. Your history view is setup to "Show Merged Revisions". I would assume that Subversive exposes this as an option in the UI that you can turn off. That is what we do in Subclipse.
I expected to find this as an option under Window > Preferences -- some digging showed me that, no, it's under the view's menu > Include Merged Revisions. Thanks for the tip!
Anyway, we also catch that exception when talking to older Subversion servers and just make the request again without asking for the merged revisions. If you have not already filed a bug report with Subversive you probably should.
Good idea -- see bug 257669. I just want something that will work, won't crash Eclipse, won't freeze up during an update, won't leave dozens of "not really there" files in my Synch view (that magically disappear when I click the 'collapse all' button in the view), won't throw errors when I try to look at file histories.

So, for the moment, I'm back to Subclipse. I've upped the permgen and heap for Eclipse to 400M and things are working again. Seems large projects + SVN = crashing/freezing/OOM errors. Maybe JavaHL won't be so greedy? We shall see.

2008-12-02

My love-hate with SVN

Since joining JBoss, a division of Red Hat, I've gotten to know the foibles of SVN rather intimately. Here are my two favourites, both encountered this week:

  1. This client is too old to work with working copy; please get a newer Subversion client.
    Problems reported while synchronizing SVNStatusSubscriber. 2 of 3
    resources were synchronized.
    An error occurred synchronizing /devstudio-workspace: Error
    getting status for resource P/devstudio-workspace
    org.tigris.subversion.javahl.ClientException: svn: This client is
    too old to work with working copy; please
    get a newer Subversion client

    This happens if you use SVN 1.5.4 and Subclipse 1.4.6 with SVNKit & JavaHL plugins. Solution? Switch to Subversive 0.7.5, or follow this advice (so I'm told, I haven't tried yet).

  2. Installing subversion-javahl-1.5.4-3.i386 (on Fedora 10 Rawhide) causes Ant 1.7.1 to fail to do SVN checkouts.
    (from /var/log/yum.log)
    Nov 27 19:51:47 Installed: subversion-javahl-1.5.4-3.i386
    [java] fetchElement:
    [java] #
    [java] # An unexpected error has been detected by Java Runtime Environment:
    [java] #
    [java] #  SIGSEGV (0xb) at pc=0x05984ec5, pid=24986, tid=3086982032
    [java] #
    [java] # Java VM: Java HotSpot(TM) Server VM (11.0-b15 mixed mode linux-x86)
    [java] # Problematic frame:
    [java] # C  [libapr-1.so.0+0x1fec5]  apr_threadkey_private_get+0x15
    [java] #
    [java] # An error report file with more information is saved as:
    [java] # /opt/public/jbt-jbds/nightly-20081128-0002/org.jboss.ide.eclipse.
             releng/builders/hs_err_pid24986.log
    [java] #
    [java] # If you would like to submit a bug report, please visit:
    [java] #   http://java.sun.com/webapps/bugreport/crash.jsp
    [java] # The crash happened outside the Java Virtual Machine in native code.
    [java] # See problematic frame for where to report the bug.
    [java] #
    [java] Java Result: 134
    (from /var/log/yum.log)
    Dec 02 11:19:23 Erased: subversion-javahl

    And now it works again!

2008-11-22

Is there a MIDP 2.0 Music Player that does Ogg?

Having switched from ubuntu to Fedora and from .mp3 to .ogg and .flac, I've been looking for a player for my Sony Ericsson W810i... at least until such time as I finally settle on a Blackberry.

Here's what I've tried...

  • jorbis 0.0.17 - unusable UI (won't play); sources provided (no precompiled binary) won't compile with anything less than JDK 1.3; my phone requires CDC-1.1/MIDP 2.0, so this one's a non-starter
  • jOggPlayer 1.1.6s - works on linux with .ogg; ugly UI; won't compile locally with CDC-1.1 (no JApplet class) or JVM 6.0 (missing kiwi.io.* classes in source bundle); precompiled binary won't install on phone
  • jlGui 3.0 - works on linux with .mp3 and .ogg; WinAmp-skinnable; requires JDK 1.4 (won't install on phone)
  • jlGui 2.x - requires JDK 1.3
Does anyone know of a good .ogg or .flac player for MIDP 2.0 devices? None of the ones I tried above work.