Showing posts with label software development. Show all posts
Showing posts with label software development. Show all posts

Thursday, December 4, 2008

I Love IntelliJ

I had some hex values for colors, e.g.:
Color c = new Color( 0xcc33cc );
What I really needed, though, was to have the colors broken out into their constituent, base-10, parts. 

Ctrl+Enter on the "Color(" brings up a context menu, "Choose Color". Up comes a dialog box. Hmmm... Click on the RGB tab (alt+G), click OK (hit enter), and voila! I've got what I need:
new Color( 204, 51, 204 )
Yeah... I love IJ :-)

Thursday, October 2, 2008

Debugging GWT

Finally figured out this nifty little trick to help with debugging GWT apps. Since the only way to work with CSS issues is in FireBug, and GWT generates so many tables, and divs, and so forth, how can you easily map from the generated HTML back to your code?

Add styles everywhere! Name the styles similar (the same?) as the Java class, and you now know exactly which <div> corresponds to which Java class!

Monday, August 11, 2008

Setting up Subversion in a VM

I need to get a pretty basic subversion setup, so I figured I'd give it a go. (There's one pretty basic VMWare appliance available from http://www.ytechie.com/svn-vm, but it's really old (Ubuntu 6.06, older version of subversion, etc...)

So, here's what I'm after:
  • Up-to-date Ubuntu
  • NTP (to keep time synch'd)
  • Subversion 1.4 (latest stable), at least with svn+ssh access, but even better with https access
  • WebSVN
  • Webmin (so I don't have to get to the box to do stuff)
Lesson #1: Uninstall stuff you don't want before applying patches. This way, you don't wait for things like Open Office, Evolution, various games etc..., to all get updated, none of which are desired.

During setup, I noticed a common problem I (and others!) seem to always run into with linux in a VM...crazy key repeating. This post (on the linuxquestions.org) ends up with reconfiguring X. However, it seemed for me that just going to System -> Preferences -> Keyboard, and changing from "US 105 (Intl)" to "US 104" did the trick.

For setting up subversion, I'm referring to a post on the Ubuntu Help pages.

When it came time to install the certificate for Apache, another Ubuntu page came in handy.

Notes:
  • This procedure winds up creating a self-signed certificate, which may not be sufficient in all cases.
  • When you access svn, you'll be notified with an error message that starts off with, "Error validating server certificate for 'https://svn-server:443'". Go ahead and accept the certificate permanently.
Installing WebSVN: I noted above that I installed webSVN, but that was a mistake. I completely purged it, and then re-installed it. This time, the configuration was a bit better, asking me if I wanted to configure apache and where my svn repositories were. Now, when I hit https://svn-server/websvn, it works!

I did find another article at Howtoforge that gave some hints on configuring websvn. No matter what I did, though, trying to enable use of enscript doesn't want to work. Oh well, got bigger fish to fry.


Email Notifications: I installed svnmailer (from the Ubuntu repositories). The docs there pretty much tell you what to do... Testing this will have to wait until I'm in the office and the smtp server can be reached to do its thing... However, it appears that svnmailer has a bug, which causes practically unreadable diffs to be produced. Luckily, the debian bugs list suggests a work-around.

UFW: For security, I enabled ufw, and then set it to only allow ports 22 (ssh) and 443 (https).

SendMail: Well, turns out I needed to install sendmail locally. Just apt-get install, and all is good...gotta love it!

FogBugz Integration: The instructions for configuring the integration are here.


Late Breaking: Here's another site that has instructions for getting things going:Howtoforge.

Tuesday, July 22, 2008

How to Make a Software Developer Pull His Hair Out

If you're writing any sort of software that you expect others to build off of (e.g., some sort of library), and you want to make sure that your users scream in agony and never need the services of a barber again, here's a few ways to do that:

1. Make sure you've got all the important functionality implemented, but then hide the implementation with private methods and package local classes so that developers can't extend or customize the functionality.
Real-Life Example: At work, we're using MyGWT (well, not for much longer). We have a tree table, and when the user hides (or shows) a column, that needs to be saved (duh). Turns out that for some reason, simply marking a column as hidden doesn't actually hide it. Yet, the functionality works when I click on the menu item! Well, in order to make that happen, I needed to programatically make the same method call that happens when you (un)check the box to hide (show) the column. Good news--that method is protected. Bad news: (a) it's in a class that's automagically instantiated by another class. (b) one of the arguments to that method relies on a package local field of another class. Yikes. Well, 5 silly new classes later, I can stand up and say, "Mission Accomplished".


2. Write your code as inefficiently as possible. You know...call a method (say, foo) which returns an array, find out how many elements are in the array. Then:


for ( int i = 0; i < foo().length; i++ ) {
Thing[] things = foo();
Thing thing = things[i];
}
Yeah, nice, until you peek under the hood and realize what foo() does... Whoa. That wasn't pretty...