Showing posts with label DEVELOPMENT. Show all posts
Showing posts with label DEVELOPMENT. Show all posts

Monday, April 26, 2010

Dark Themes for Eclipse

If you've been following along you'll know that I'm dipping my toes in the Android development waters.  My buddy Greg aka Android Code Monkey has a great step-by-step tutorial on setting up your development environment.  I did a more in depth how-to on this subject over at his place.  If you just want the quick and dirty see below ;)

If you've done any development at all you'll notice how stark white the Eclipse IDE is.  Given the natural g33k affinity for poor lighting conditions this can be very tiring on the eyes.  I found THIS post which covers how-to apply ready-made color themes.  I'll keep it simple for you here ... download THIS file and extract the 2 files (org.eclipse.jdt.ui.prefs & org.eclipse.ui.editors.prefs) from your desired theme folder into 

WINDOWS: [workspace]\.metadata\.plugins\org.eclipse.core.runtime\.settings\
LINUX/MAC: [workspace]/.metadata/.plugins/org.eclipse.core.runtime/.settings/

There are screen capture previews in the root of the downloaded file.  I chose the Zenburn theme pictured below.



The download link for the themes no longer works.  So, I've encapsulated the original .zip archive inside the "Theme Files Hidden Inside" image above.  Simply save it and open it with your favorite compression tool.



Wednesday, April 21, 2010

Enabling Local Development

Sometimes you've got to take a step back from what you know and think.  We've been managing hosts files for years.  In fact, one of my previous posts discusses how we make sure each user keeps the most up-to-date copy on their PC.  That's still required for some things, but when my most recent request came in to assist with local development on the developers machines it gave me pause.  This is what I came up with ...

Use DNS.  We already have DNS setup for our domain mydomain.local.  All of the machines in our environment register themselves there.  We also maintain local copies of our public domains with the internal private IPs so we can manage and test the environments even when they're not publicly accessible.  One of the things we implemented many years ago were wildcard entries so ...

A host entry for * in the domain mydomain.com would resolve for pickle.mydomain.com, mail.mydomain.com or www.mydomain.com.  We also implemented subdomains in the scheme to allow for simple development and testing.  A * entry in dev.mydomain.com and test.mydomain.com makes pickle.dev.mydomain.com and www.test.mydomain.com valid ;)

The developers were using their local hosts file to reference pickle.dev.mydomain.com so that the URLs would match data driven lookups.  The trouble is they had to maintain a huge hosts file and things can get crossthreaded very easily.

That's when it hit me ... use a wildcard entry in a new subdomain named local and point it to 127.0.0.1 in DNS.  Now pickle.local.mydomain.com and www.local.mydomain.com both work from each developers' local workstation.  The hosts file entries are greatly reduced and revisions/management of said files has all but been eliminated.


It also makes surfing from the server itself possible which can be priceless in troubleshooting -- or proving to the devs it really is their code having a problem and not the server, network or firewall! ;)

Saturday, February 6, 2010

SUBST, Java and Beer ...

I've recently picked up the coding bug again.  I had started going through some C# material and then my girlfriend bought me an Android based phone for Christmas.  Android development is done in Java.  Here was my first experience and a crafty DOS trick that solved my problem.

The "Head First Java" book discourages the use of an IDE while you're learning Java.  The thought is learn the language then learn the tool.  I'm on board so I fired up Notepad++ and entered my code (see below).  I have a shared Dropbox folder setup for Android development.  Nice way to get full versioning and I have it shared with a group of developers for collaboration/help if required.

The book claims their BeerSong.java code will compile and run.  Taking nothing for granted I typed the code in and tried to compile it.  It compiled.  Well, it compiled after I changed "While" to "while."  I've been using M$ stuff too long ;)

Now I had a BeerSong.class file, but it would not run.  My first error was this:

Exception in thread "main" java.lang.NoClassDefFoundError: BeerSong

There were 2 issues.  I made the rookie mistake of trying to execute the code with:

java BeerSong.class

As any old Java salt will be glad to point out, "You don't execute the .class file.  You execute the BeerSong bytecode and it will find the .class file!"  At least it's a common mistake ;)

Mine still did not run.  *sigh*  Turns out I needed a CLASSPATH statement in my environment variables to tell Java where to find my .class files.

That's easy enough, but this is ugly:

set CLASSPATH=C:\Users\bill.mote\Documents\My Dropbox\_AYDABTU.Development\PROJECT.target\BILL\HeadFirstJava\Chapter1

Enter our old friend SUBST.  If you're an old timer you probably remember using that command back in the early 90's to point 1 drive to another.  You can also point a directory to a drive letter!  Try this:

subst b:\ "C:\Users\bill.mote\Documents\My Dropbox\_AYDABTU.Development\PROJECT.target\BILL\HeadFirstJava\Chapter1"

Now you have a drive letter, B, mapped to your path.  Set your CLASSPATH ...

set CLASSPATH=b:\

Now try to run java BeerSong.  Worky!

Just for fun, here's the BeerSong code:

public class BeerSong {
    public static void main (String[] args) {
        int beerNum = 99;
        String word = "bottles";
       
        while (beerNum > 0) {
       
            if (beerNum == 1) {
                word = "bottle"; // singular, as in ONE bottle.
            }
           
            System.out.println(beerNum + " " + word + " of beer on the wall");
            System.out.println(beerNum + " " + word + " of beer.");
            System.out.println("Take one down.");
            System.out.println("Pass it around.");
           
            beerNum = beerNum -1;
           
            if (beerNum > 0) {
                System.out.println(beerNum + " " + word + " of beer on the wall\n");
            } else {
                System.out.println("No more bottles of beer on the wall");
            }
        }
    }
}

 
And, the output.  Notice the grammar problem in the output? :)