Archive for March, 2011

stuff for sale (for those that asked)

I’m getting rid of a few things, and wanted to give you guys the opportunity to take a look before I eBay ’em.  There may be more to come as well.

Asking prices are negotiable (but folks are asking what I want), so don’t be afraid to make an offer.  I’m not shipping anything so you’d have be pretty close.  MSRP is just a reference point; some of these items are discontinued so MSRP is from original release.

I treat my gear very well, all of this is in like new condition.  But your welcome to test drive any of it.  Let me know if you have questions.

what where mspr how much notes
Danelectro “Cool Cat” link (pdf) $99.00 $35.00 Original DanO chorus pedal; cast metal housing. Runs on 9V batteries or 9V adapter (not included). I could probably do a good deal on the whole set if needed.
Danelectro “FAB Tone” link (pdf) $79.00 $30.00 Original DanO distortion pedal; cast metal housing. Runs on 9V batteries or 9V adapter (not included). I could probably do a good deal on the whole set if needed.
Danelectro “Dan-Echo” link (pdf) $129.00 $45.00 Original DanO tape echo (simulated) pedal; cast metal housing. Runs on 9V batteries (x2) or 18V adapter (not included). I could probably do a good deal on the whole set if needed.
Danelectro “Daddy O” link (pdf) $79.00 $30.00 Original DanO overdrive pedal; cast metal housing. Runs on 9V batteries or 9V adapter (not included). I could probably do a good deal on the whole set if needed.
Johnson J-Station link $450.00 $75.00 The J-Station was the only competetion for the original Line6 POD. I bought it for studio/recording to when I didn’t want to carry around the JM150 below.
Behringer FCB1010 link $285.99 $60.00 MIDI foot controller I used with the J-Station and JM150.
Johnson Millennium JM150 link $1,600.00 $500.00 One of the first (if not the first) digital modeling amps; it’s very loud and very heavy :). I may throw in the FCB1010 foot controller if the price is right.
Epiphone G-400 Custom (Black) link $832.00 $275.00 It’s an Epi SG series; this is the ebony model, and it’s a bit hard to find. Includes hardshell case.
Shure SM58 link $124.00 $45.00 It’s an SM58… I don’t think anything else needs to be said.
Yamaha DGX-500 link $1,099.95 $275.00 88 (semi-weighted) key portable grand.
Behringer Mixer   ??? $40.00 12 channel audio mixer, everything works except the effects processor. I don’t have the exact model #, I’ll look it up when I get home.
Behringer B-1 Condenser Mic link $197.99 $40.00 With case and accessories.
Behringer Limiter/Expander/Compressor   ??? $30.00 1U rack mount. I don’t have the exact model #, I’ll look it up when I get home.
Carvin Stereo XP2 (Vocal) DSP link (pdf) ??? $30.00 1U rack mount, digital effects processor.

ah oh…

How did I miss THIS yesterday?

Seems the web developers at MySQL skipped out on their best practices 101 class … you know, the day they talked about binding parameters.

Of course, that’s every developer’s knee-jerk reaction.  I’m sure if you searched all of our code long enough, you’d see some improperly escaped SQL in there somewhere.

Although, I’m puzzled as to how this would have gotten through a formal code review.  Interesting, no doubt.

Now, I’m off to change my MySQL.com account passwords…

More Java stuff

Before you read, just keep in mind that I am a Java developer by trade.  I may be a bit biased, but I try to be somewhat objective.

As I mentioned in a previous post, Java will be absent from future versions of OS X.  It’s not surprise, and we’ve known about it for months.  Apple is handing the reigns over to Oracle so that the actual “java people” can do the Java development.

Really, this is a long time coming and it’s absolutely the best move.  The big down side is that it just won’t be there by default (like it has been since the beginning of OS X).  Mac OS X was supposed to be the operating system of choice for Java developers, but I digress.

With all that said, Java is not a totally lost cause on OS X Lion.  While it will not be installed by default, you will be prompted to download the 1.6.0 release from Apple when trying to launch any Java applications.  At present it will install 1.6.0_24, which is the latest release from Oracle.  It seems that applet support is missing though (I would love to be proved wrong).  You may recoil in horror at the thought of applets, but you’d probably be surprised how ofter you encounter them (for legitimate purposes) and never know it.

I’m beyond overjoyed that the OpenJDK project is taking over development on the OS X port, but I am a bit dismayed at the current attitude toward Java in the Apple community.  After all, they have quite a bit of experience with resurrecting obsolete/near-dead programming languages … I’m looking at you Objective-C :)

But hey, maybe I really shouldn’t care.  Nobody uses OS X in the server world; Apple killed Xserver and OS X server may be on the same path.  It’s also not going to be too long before the only people with a need for an OS X computer are iOS application developers.

And as always, I take great comfort in knowing the “cloud” (that makes everyone’s iDevice usable) lives and breathes on linux and java :)

Java SE 7 Developer Preview

It’s probably been 9 months since I’ve played with Java SE 7, and now the Developer Preview window is just about over.

I’ve been on a crazy release schedule since late October, so I haven’t had the time or energy to go play with it.  I’m downloading now though to test out our software.  The GA date is set for mid-summer 2011.

Go get it HERE and try to break it :)

On a related note, it is looking more and more definite that a version 7 release will not be ready for OS X at launch.  We’ve been told as much, but there’s been a bit of wishful thinking on everybody’s part none the less.  It seems a shame, as OS X Lion will not be shipping with Java out of the box (and the version you download from Apple does not include applet support).

Simple Android Speedometer

UPDATE

There’s been quite a bit of activity on this post. Some of the info is old, and people keep asking for the full Eclipse project.

Here’s something even better… Step-by-step tutorial for the simple speedometer:

Nothing but old info below here…

I’ve seen lots of questions concerning the use of the GPS functionality in Android.  It’s super easy, but some of the explanations are needlessly complicated.

The code below is a simple speedometer that uses the GPS chip to show your current speed.  There are optimations that can be made (specifically in the “locationManager.requestLocationUpdates” call), but this is good enough to get you going.  The Android API documentation should fill in the gaps. As always … take it, run, and share with the rest of us.

Check out the interface and class below, and make sure to see the previous post for the “CLocation” class.

import android.location.GpsStatus;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;

public interface IBaseGpsListener extends LocationListener, GpsStatus.Listener
{
  public void onLocationChanged(Location location);

  public void onProviderDisabled(String provider);

  public void onProviderEnabled(String provider);

  public void onStatusChanged(String provider, int status, Bundle extras);

  public void onGpsStatusChanged(int event);
}
import java.util.Formatter;
import java.util.Locale;

import android.app.Activity;
import android.content.Context;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.TextView;

public class CSpeedometer extends Activity implements IBaseGpsListener
{
  public void onCreate(Bundle savedInstanceState)
  {
    super.onCreate(savedInstanceState);
    this.setContentView(R.layout.speedometer_main);

    LocationManager locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
                                           0,
                                           0,
                                           this);

    this.updateSpeed(null);

    CheckBox chkUseMetricUnits = (CheckBox)this.findViewById(R.id.chkUseMetricUnits);
    chkUseMetricUnits.setOnCheckedChangeListener(new OnCheckedChangeListener()
    {
      public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
      {
        CSpeedometer.this.updateSpeed(null);
      }
    });
  }

  public boolean onCreateOptionsMenu(Menu menu)
  {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.speedometer_main, menu);
    return true;
  }

  public boolean onOptionsItemSelected(MenuItem item)
  {
    switch (item.getItemId())
    {
      case R.id.menuItemQuit:
        this.finish();
        return true;
      default:
        return super.onOptionsItemSelected(item);
    }
  }

  public void finish()
  {
    super.finish();
    System.exit(0);
  }

  public void updateSpeed(CLocation location)
  {
    float nCurrentSpeed = 0;

    if( location!=null )
    {
      location.setUseMetricUnits(this.useMetricUnits());
      nCurrentSpeed = location.getSpeed();
    }

    Formatter fmt = new Formatter(new StringBuilder());
    fmt.format(Locale.US, "%5.1f", nCurrentSpeed);
    String strCurrentSpeed = fmt.toString();
    strCurrentSpeed = strCurrentSpeed.replace(' ', '0');

    String strUnits = "miles/hour";
    if (this.useMetricUnits())
    {
      strUnits = "meters/second";
    }

    TextView txtCurrentSpeed = (TextView) this.findViewById(R.id.txtCurrentSpeed);
    txtCurrentSpeed.setText(strCurrentSpeed + " " + strUnits);
  }

  public boolean useMetricUnits()
  {
    CheckBox chkUseMetricUnits = (CheckBox)this.findViewById(R.id.chkUseMetricUnits);
    return chkUseMetricUnits.isChecked();
  }

  public void onLocationChanged(Location location)
  {
    if (location != null)
    {
      CLocation myLocation = new CLocation(location, this.useMetricUnits());
      this.updateSpeed(myLocation);
    }
  }

  public void onProviderDisabled(String provider)
  {
    // TODO: do something one day?
  }

  public void onProviderEnabled(String provider)
  {
    // TODO: do something one day?
  }

  public void onStatusChanged(String provider, int status, Bundle extras)
  {
    // TODO: do something one day?

  }

  public void onGpsStatusChanged(int event)
  {
    // TODO: do something one day?
  }
}

UPDATE

I’ve uploaded the source, layout xml, and manifest xml here:

speedometer_test.zip

 

Android Location class with U.S. customary units (instead of metric)

I’m a big proponent of going metric; I’ve never fully understood why we don’t just do it.  Then again, I’d also like the entire world to be on UTC time.  But since we insist on using our own bass-ackward units of measure, I needed an Android Location class that returned U.S. customary units instead of metric.

So, here goes…

import android.location.Location;

public class CLocation extends Location
{
  private boolean bUseMetricUnits = false;

  public CLocation(Location location)
  {
    this(location, true);
  }

  public CLocation(Location location, boolean bUseMetricUnits)
  {
    super(location);
    this.bUseMetricUnits = bUseMetricUnits;
  }

  public boolean getUseMetricUnits()
  {
    return this.bUseMetricUnits;
  }

  public void setUseMetricUnits(boolean bUseMetricUnits)
  {
    this.bUseMetricUnits = bUseMetricUnits;
  }

  @Override
  public float distanceTo(Location dest)
  {
    float nDistance = super.distanceTo(dest);

    if (!this.getUseMetricUnits())
    {
      // Convert meters to feet
      nDistance = nDistance * 3.28083989501312f;
    }

    return nDistance;
  }

  @Override
  public float getAccuracy()
  {
    float nAccuracy = super.getAccuracy();

    if (!this.getUseMetricUnits())
    {
      // Convert meters to feet
      nAccuracy = nAccuracy * 3.28083989501312f;
    }

    return nAccuracy;
  }

  @Override
  public double getAltitude()
  {
    double nAltitude = super.getAltitude();

    if (!this.getUseMetricUnits())
    {
      // Convert meters to feet
      nAltitude = nAltitude * 3.28083989501312d;
    }

    return nAltitude;
  }

  @Override
  public float getSpeed()
  {
    float nSpeed = super.getSpeed();

    if (!this.getUseMetricUnits())
    {
      // Convert meters/second to miles/hour
      nSpeed = nSpeed * 2.2369362920544f;
    }

    return nSpeed;
  }
}

This class really isn’t anything special, it just allows you to toggle which units you would like to use:

  • U.S. Customary Units:  feet and miles/hour
  • Metric:  meters and meters/second

Please, take it and make it better :)

Gingerbread on my 1st gen Droid

My first leap into the Android world was the 1st generation Motorola Droid.  When it was released, it was THE droid to have.  I still love the phone, but when my contract was up, I couldn’t resist the call to a newer/better phone.

Because I’m cheap, I upgraded to an HTC Incredible (it was free at BestBuy).  A decent phone in it’s own right, but it’s last year’s technology.  Even though, it’s a good bit above my old trusty droid.  I wanted to hold out for Thunderbolt or Bionic, but it just didn’t happen that way.

So, now that I’ve got this shiny new phone, I can be geeky with the old one.  Thanks to the folks over at Ultimate Droid, I’ve got Gingerbread up and running on the old droid.  I must say, it’s amazing!  It’s almost making me have a few second thoughts about my upgrade.

Perhaps it’s time for me to consider rooting my main phone?