What’s the problem?

I like to keep my system up to date, and I depend on many Homebrew packages on my OS X machine. Homebrew allows for this but I:

  • want it automated
  • want it to delete old versions that I am no longer using

How did I solve it?

First, I added this into my .zshrc (could be in your .profile if you use Bash):

function brew_update() {
brew update
brew upgrade --all
ruby $HOME/remove_old_brews.rb
CURR_DATE=`date '+%Y-%m-%d'`
LAST_DATE=`head -n 1 $HOME/.brew_update_date 2>/dev/null`
if [ "$CURR_DATE" != "$LAST_DATE" ]; then
echo $CURR_DATE > $HOME/.brew_update_date
echo Updating Homebrew...

Then, I created remove_old_brews.rb in my home directory:

Wait, what?!

Ok, first the shell will check the current date and compare it with a date stored in a .brew_update_date file. If they differ, it immediately updates the file (so I can open another Terminal while the update is in progress), then it calls brew_update.

brew_update tells Homebrew to update its index, then upgrade all out of date packages. Finally, brew_update calls remove_old_brews.rb

remove_old_brews.rb looks at all installed packages in /usr/local/Library/LinkedKegs and finds packages with more than 1 version installed. For those, it finds whichever ones are not the currently linked version and removes them.

Things to consider

This is tuned for my workflow, but yours may differ. What I wanted was:

  • update the first time I open Terminal in a day
    • meaning if I really need a Terminal, I can just open another and the 2nd one won’t update
  • keep what was updated at the front of my attention (which is why I didn’t just put it into cron)

And that’s about it.

Comment and share

Settings button

When working in Eclipse or RAD, I immediately start modifying my environment. Here are some of the changes that I make that might improve your day, please feel free to share you own!

Stop the Servers tab from taking over!

Whenever server state changes (e.g. from Stopped to Starting, to Started, to Republish, etc), the Servers tab automatically shoves its way onto your screen because it wants you to know it did something. Great! But if you’re like me, you immediately dismiss it and now you’re a little distracted and a little annoyed. Here’s how to turn it off!

From within Eclipse’s / RAD’s preferences, click Server. Then uncheck “Show Servers view when server state changes.”

2015-03-30 23_31_39-Preferences

Stop the Console tab from taking over!

Now that we stopped the Servers tab, let’s do the same thing for Console! Output is constantly written to the console, and I typically look at it when I want it, and otherwise don’t care. So, go to preferences, expand Run/Debug, and click Console. Then uncheck “Show when program writes to standard out,” and “Show when program writes to standard error.”

2015-03-30 23_31_46-Preferences

Where did my Console output go? And why can’t I scroll up?!

The Console view defaults to limiting its output. This may make it easier to work with, but has the nasty side-effect of dropping important content when you have large stack traces, or multiple stack traces. To turn it off, go to the Console preferences (from above) and uncheck “Limit console output”.

Makes your static imports work in autocomplete! (e.g. JUnit, Mockito, etc.)

UNIT TESTING! Ok, ok, let’s calm down a little. If you write a lot of tests, and you use JUnit, Mockito, EasyMock, etc., or if you happen to use a library that leverages static imports, you are probably tired of manually adding them to your imports list. But, _you don’t have to! _Go to the preferences, expand Java, then Editor, then Content Assist and click Favorites. Then, click “New Type” and type in org.junit.Assert. Eclipse will add org.junit.Assert.* to the favorites list, and now when you are writing your unit tests you can start typing assertEq, hit Control + Space, and it will autocomplete the static import and add it to your class!

2015-03-30 23_36_04-Preferences

Other, more personal editor settings.

These settings are definitely up to personal preference, but in case you want to give them a try here are some other changes I make:

Use Spaces, not Tabs

You should be using Spaces and never tabs**! **_I’m kidding!!! _Since I have no interest in arguing my personal preferences, here is how you make the change in case you want to: open preferences, expand General, expand Editors, and click Text Editors. Then, check “Insert spaces for tabs” (or don’t).

2015-03-30 23_31_07-Preferences

Auto format and auto organize imports on save

Why should I have to worry about constantly re-indenting my code, fixing it up, etc.? My time is better spent doing other things, you know like writing code instead of styling it. So, I set my formatter preferences, then go to preferences, expand Java, then Editor, then click Save Actions. Then I check “Perform the selected actions on save,” “Format source code,” and “Organize imports.” My personal feeling towards this is you will feel much more free if you make the change, if you can live with the formatter settings you choose. Give it a try!

2015-03-30 23_31_24-Preferences

What changes do you make?

Comment and share


Did you know you can run WebSphere Application Server in development mode, which optimizes it for less powerful hardware and for applications which see frequent updates? It’s actually quite easy, whether you are creating a new profile or working with an exciting one!

Creating a New Profile with the Profile Management Tool

If you are creating a new profile, via the Profile Management Tool (or PMT), just make sure you select these two boxes:

  1. Use the “Advanced profile creation” mode
    2015-03-20 10_57_44-Profile Management Tool 8.5
    This allows you to tweak some very simple settings that you may be interested in, I recommend all people using PMT to create their profiles in this mode.
  2. Switch “Server runtime performance tuning setting” to “Development”
    2015-03-20 11_03_18-Profile Management Tool 8.5
  3. Then just finish the wizard with the settings you want!

Creating a New Profile via the Command Line manageprofiles Tool

For those command-line junkies like myself, creating a new profile via manageprofiles in development is also extremely easy. Simply add this flag to your -create parameter list:


That’s it! To read more about the parameters for manageprofiles, see here.

Modifying a Profile via the WebSphere Admin Console

If you’ve already created your profile, and want to simply enable development mode, simply log into the admin console and change it! It goes like this:

  1. Go to the WebSphere Administrative Console (e.g. http://localhost:9060/ibm/console)
  2. Log in

    1. Tip: If you do not have security enabled, just click Log In
  3. Drill into WebSphere application servers
    2015-03-20 11_08_46-WebSphere Integrated Solutions Console

  4. Drill into your server (e.g. server1)
    2015-03-20 11_09_01-WebSphere Integrated Solutions Console
  5. And check the following boxes:

    1. Run in development mode
    2. Parallel start
    3. Start components as needed
      2015-03-20 11_09_09-WebSphere Integrated Solutions Console
  6. Then click Save, and restart your server!

Modifying a Profile via the Command Line wsadmin Tool

Enabling development mode on an existing server is the most complicated choice, but luckily it is still pretty straight forward. Just follow these steps:

  1. Start your server (via Eclipse/RAD/RSA/Other IDE, or by command line)

    1. To start by command line, open your command prompt
    2. cd into your profile’s bin directory (e.g. C:\Profiles\MyAwesomeProfile\bin)
    3. startServer.bat server1 (or, ./ server1 if you are not on Windows)
  2. With the command prompt in the bin directory (from the above steps), execute the following:

    wsadmin.bat server1
    set server [$AdminConfig getid /Server:server1/]
    $AdminConfig modify $server "{developmentMode true}"
    $AdminConfig modify $server "{parallelStartEnabled true}"
    $AdminConfig save
  3. Then, just restart your server!

    1. Tip: You can use stopServer.bat server1 to do this too (or ./ server1)

Comment and share

  • page 1 of 1

Craig St. Jean

Father, programmer, constant learner, @pluralsight author

Software Architect