OS/X Java MicroTip: Decompile Java class from the Finder

August 11th 2010 · Java , Mac Computer

Here’s another micro-tip. I needed to decompile a Java class to step through for debugging. But I wanted to pick and choose classes from the Finder. No problem, this is OS/X and Automator is your friend.

If you don’t already have it, download JAD (Java Decompiler) from http://www.varaneckas.com/jad.

Then open up Automator and create a new Service. Tell Automator that the service will receive only selected files or folders. You can use any application or just Finder, your call. If you like, filter out only the class files. Then comes the real work. Specify the zsh shell and give it this command line:

jad -lnc -o -d `dirname $1` $1

You’ll have to specify the full path to the jad executable if it’s not in your path. The -lnc tells JAD to add original line numbers as comments – very helpful when debugging. The -o tells JAD to overwrite output files without asking. And the -d tells JAD where to put the decompiled files. In our case we’re only allowing a single file at a time and we’re putting the decompiled file into the same directory as the original class file.

When you’re done, it should look something like this:

1

Save the workflow service and name it whatever you like, in my case I named it ‘Decompile Java Class’. Close any open Finder windows and re-open them. Now when you right click on a file you’ll see ‘Decompile Java Class’ as an option in the Services menu. Select it and JAD will decompile your selected class file into a .jad file.


Coda Notes

July 30th 2010 · Dev Trends , Mac Computer , Web

“Panic”, an Apple software developer, has released one of the nicest browser extensions I’ve ever seen. Coda Notes makes it very easy to markup a web page with your own comments and highlights. The annotated page can then be emailed to whomever you like. To use Coda Notes you’ll need the very latest version of Safari – 5.0.1.

Once you install it, Coda Notes adds a little leaf button 3 to the Safari button bar. When you click it, a toolbar slides down and the current web page goes into edit mode. You can draw on the page using a pencil tool (in green, red or blue), you can draw using a highlighter (in yellow, purple or blue), you can change the text on the page or you can put sticky notes with text on top of the page.

When you’re done, click the Send button and the whole page rotates to reveal a postcard on the back. You can email the annotated page with comments to whomever you wish.

Here’s a quick view of an annotated page after it was received in email:

4

Coda Notes is already very slick and very useful, but a few flaws keep it from replacing Skitch for me. The first is that it doesn’t have a tool to draw boxes and arrows yet. The second is that you can only annotate and send the visible portion of the web page. It would be much more useful if you could scroll up and down the entire web page.

One more thing to keep in mind if you make use of the Coda Notes extension, all emails are routed through the Panic servers. Panic has a good reputation and state up front that they don’t keep images, but if you’re at all concerned about security, don’t email your images.


OS/X Microtip: Making forced Exchange server signatures output correctly

July 28th 2010 · Mac Computer

I just started a new job and they forcefully apply an email signature to all outgoing Exchange email. The signature block is dynamic and picks up the senders name, phone number, email address, etc. from Active Directory and puts it in the signature. I sent myself a test email and saw that some of the information was wrong, so I contacted the email admin. He fixed it and asked me to test it again.

When I sent myself another test email it came through as plain text without any formatting. The company signature block is supposed to have formatting and a company logo. I was positive the email admin had messed things up. I was wrong.

Turns out the automated Exchange signature block is output in rich text (HTML) when the incoming message is rich text and is output in plain text when the incoming message is in plain text.

Mail.app has a setting that says whether messages will be composed as Rich Text or Plain Text. I had always assumed that applied to all new messages. Unfortunately it’s now apparent that the setting only means that a message can be sent as Rich Text. If you don’t include any formatting in your message then the message goes out as Plain Text, regardless of the composition setting.

The fix? Create a simple signature block with formatting. My first choice was a simple single-pixel line but Mail.app won’t accept a formatted line without any associated text. So now I just have the word ‘Thanks’ in bold.


Cloud security is the big stumbling block

July 26th 2010 · Dev Trends

http://www.crn.com/security/226200161

Google’s first big government switch to Google Apps has hit a roadblock that will be common to all cloud implementations – security.

The LAPD put the brakes on the City of Los Angles conversion due to security requirements. That includes the big concern all cloud users have, data segregation. In addition, the LAPD requires background checks on all personnel who have access to their data.

Google will work through this process of course and the end result will become standard practices for all cloud providers. Namely the establishment of strict data controls both from the technical perspective and from the personnel perspective.


OS/X Microtip: gfxCardStatus can prevent video out from working

July 24th 2010 · Mac Computer

Here’s another microtip for you. If you have a recent Mac that supports automatic GPU switching, you might have decided that OS/X isn’t smart enough about when it decides to switch. Maybe you run 1Password or The Hit List and can’t fathom why they need the high-powered GPU. So, when you head out on the road, you use gfxCardStatus to “pin” the operating system on the low-powered Intel GPU and give your battery a break.

The problem comes when you go to project a presentation. Suddenly, reliable OS/X won’t do it. Try as hard as you can, click Detect Displays as often as you like – no projection, no secondary display.

Why? Because OS/X requires the high-powered GPU to connect a secondary display like a projector. But there’s no visible error messages or feedback. The connection simply won’t work. To solve the problem just switch gfxCardStatus back to automatic mode.


Don't upgrade to IDEA IntelliJ 9.0.3

July 23rd 2010 · Java

If you’re running IntelliJ on Mac or Linux and use Subversion, don’t upgrade to the new 9.0.3 release. There’s a huge defect that JetBrains doesn’t seem to care about. With the new 9.0.3 release IntelliJ no longer uses the Mac or Linux password keychains. That means all of your passwords will stop working and you will have to manually edit configuration files to get everything working again.

You can find more information in the IDEA-56464 defect. The end result is that you will be required to store all of your passwords in plain text. For those of you on corporate networks that use ActiveDirectory to provide single sign-on to your Subversion instances that means you’ll have to store that password in plain text.

This is completely unacceptable and will keep me on 9.0.2 until this defect is fixed.

<< Previous articles
Next articles >>