Shop

My New Shop
MTS Creations

Subscribe to My YouTube Channel

Thursday, December 6, 2012

Mysterious Mexico Lights...

So I came upon this site today from a Popular Science rss feed I follow.
http://conphotography.com/2012/12/nasas-black-marble/
I saw this light form in what I thought was ocean. I used Google Maps to verify the location of the mysterious lights and Google doesn't show anything but a different colored blue ocean.








Monday, October 1, 2012

XBMC There is no soundcard error

I upgraded my HTPC to Ubuntu 12.04 and it broke my XBMC from being able to run.
I searched high and low for the answer and never found one.  I fought with this to get my sound over HDMI when I first installed my HTPC.  My frustration was that the HTPC could play sounds via the default settings with this upgrade but XBMC would fail to start with the following error:
"There is no soundcard".

After much searching and two very late nights I was able to get it working by doing the following:

I'm posting this here and hope that this will either help me out in the future or will help some other Googler out there.

# aptitude install libcurl4-gnutls-dev
The following NEW packages will be installed:
  comerr-dev{a} krb5-multidev{a} libcurl4-gnutls-dev libgcrypt11-dev{a}
  libgnutls-dev{a} libgnutls-openssl27{a} libgnutlsxx27{a}
  libgpg-error-dev{a} libgssrpc4{a} libidn11-dev{a} libkadm5clnt-mit8{a}
  libkadm5srv-mit8{a} libkdb5-6{a} libkrb5-dev{a} libldap2-dev{a}
  libp11-kit-dev{a} librtmp-dev{ab} libtasn1-3-dev{a}
The following packages will be REMOVED:
  libutouch-evemu1{u} libutouch-frame1{u} libutouch-geis1{u}
  libutouch-grail1{u}
0 packages upgraded, 18 newly installed, 4 to remove and 0 not upgraded.
Need to get 3,974 kB of archives. After unpacking 10.4 MB will be used.
The following packages have unmet dependencies:
 librtmp-dev : Depends: librtmp0 (= 2.4~20110711.gitc28f1bab-1) but 2.4~20110711.gitc28f1bab-1ubuntu0~ppa4~lucid is installed.
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     libcurl4-gnutls-dev [Not Installed]               
2)     librtmp-dev [Not Installed]                       



Accept this solution? [Y/n/q/?] n
The following actions will resolve these dependencies:

     Downgrade the following packages:                                         
1)     librtmp0 [2.4~20110711.gitc28f1bab-1ubuntu0~ppa4~lucid (now) -> 2.4~20110



Accept this solution? [Y/n/q/?] Y
The following packages will be DOWNGRADED:
librtmp0

Monday, August 27, 2012

Arduino + Wave Shield DoorTunes Update

I have had our Doorbell switched out with an Arduino + Wave Shield for a few months now.

It hasn't been working like I had hoped.  There was one problem at first where I was missing a pull-up resistor.  So I installed that it worked so much better.

Now the problem was that for some reason every morning or almost every morning around 8:00am it would trip.  It would trip every so often throughout the day as well.

I increased the resistor on the pull-up resistor and that helped but, it would still trip every so often.  Then I decided to search good ol' YouTube for help with the Arduino and pull-up resistors.  That's when I learned that every digital I/O pin on the Arduino has a built in pull-up resistor. ( DigitalWrite(doorbellPin, HIGH); )

So tonight I downloaded the newest version of the Arduino software 1.0.1 and decided to give it a try.

After making the change to the code I tried to upload my Sketch to the Arduino.  And now there were a bunch of errors.  Such as "error: 'FatReader' was not declared in this scope".  I thought "Oh great, the new version is going to keep me from using this same code."  Back to Google and the forums and then it hit me... "Libraries!"...  Arghh...  I hate it when I forget these sort of things.

So I copied over my WaveHC libraries into the new version and uploaded successfully.

Now it's time to plug the doorbell back in and see if this on-board pull-up resistor is the key to getting this doorbell to be fixed.  I will for sure let you know if it doesn't work.  Otherwise if you don't hear back from me, consider it fixed!

Friday, August 17, 2012

Masonism

Yesterday evening after dinner we received a phone call from our neighbor telling us that there was a fire truck and ambulance down the street.

So I put Ali in the stroller and Mason was going to ride his scooter.

Mason was taking a long time to get ready so Ali and I started walking around the block in the direction of the trucks.

As soon as Mason started down the driveway and turned onto the sidewalk he said "Look Dad, Look!  What happened?".  To which I replied, "I don't know.  That's what we are going to find out."  By this time he had caught up to Ali and I and he then says, "Am I in trouble?", I start to laugh and tell him "No you're far from being in trouble."

Friday, May 11, 2012

Crystal Reports Error

If you try to insert a subreport and you get the following error:
"com.crystaldecisions.sdk.occa.report.lib.ReportSDKException: Unexpected database connector error---- Error code:-2147467259 Error code name:failed"
It means that you need to rename your "Subreport Name".

To do this go to your main report and right click on the subreport, select "Format Subreport...", select the Subreport tab at the top, update the "Subreport Name:" to match your java PojoDataset tablename.

I sure wish that would have been somewhere that I could have read.

Thursday, May 10, 2012

My First Arduino Project: DoorTunes

My first Arduino project!
My "DoorTunes" (AKA: MP3 Doorbell)

Hardware:
Arduino Uno
Audio Shield (v1.1) "Wave Shield"


/*
 * This plays one .WAV file from the SD card by index when the doorbell is pressed
 */
#include 
#include 

SdReader card;    // This object holds the information for the card
FatVolume vol;    // This holds the information for the partition on the card
FatReader root;   // This holds the information for the volumes root directory
FatReader file;   // This represents the WAV file
WaveHC wave;      // This is the only wave (audio) object, since we will only play one at a time
uint8_t dirLevel; // indent level for file/dir names    (for prettyprinting)
dir_t dirBuf;     // buffer for directory reads

const int numberOfTunes = 14;

// See sketch (openByIndex) example
uint16_t tunesIndex[numberOfTunes]; // Number of Tune files.

/*
 * Define macro to put error messages in flash memory
 */
#define error(msg) error_P(PSTR(msg))

// Function definitions (we define them here, but the code is below)
void play(FatReader &dir);
void findFiles(FatReader &dir);
const int doorBellPin = 7; // Analog pin for doorbell
int doorBellState = 0;
long randNumber, lastNumber;

//////////////////////////////////// SETUP
void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps for debugging
  
  putstring_nl("\nRunning Setup!");  // say we woke up!
  
  putstring("Free RAM: ");       // This can help with debugging, running out of RAM is bad
  Serial.println(FreeRam());

  // Set the output pins for the DAC control. This pins are defined in the library
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(doorBellPin, INPUT);

  //  if (!card.init(true)) { //play with 4 MHz spi if 8MHz isn't working for you
  if (!card.init()) {         //play with 8 MHz spi (default faster!)  
    error("Card init. failed!");  // Something went wrong, lets print out why
  }
  
  // enable optimize read - some cards may timeout. Disable if you're having problems
  card.partialBlockRead(true);
  
  // Now we will look for a FAT partition!
  uint8_t part;
  for (part = 0; part < 5; part++) {   // we have up to 5 slots to look in
    if (vol.init(card, part)) 
      break;                           // we found one, lets bail
  }
  if (part == 5) {                     // if we ended up not finding one  :(
    error("No valid FAT partition!");  // Something went wrong, lets print out why
  }
  
  // Lets tell the user about what we found
  putstring("Using partition ");
  Serial.print(part, DEC);
  putstring(", type is FAT");
  Serial.println(vol.fatType(), DEC);     // FAT16 or FAT32?
  
  // Try to open the root directory
  if (!root.openRoot(vol)) {
    error("Can't open root dir!");      // Something went wrong,
  }
  
  // Whew! We got past the tough parts.
  putstring_nl("Files found (* = fragmented):");

  // Print out all of the files in all the directories.
  root.ls(LS_R | LS_FLAG_FRAGMENTED);

  putstring("\nCalling findFiles()");
  root.rewind();
  findFiles(root);
  putstring("\nDONE WITH SETUP");
}

//////////////////////////////////// LOOP
void loop() {
  doorBellState = digitalRead(doorBellPin);
  if(doorBellState == HIGH) {
    putstring("\nDOORBELL is Pressed!\n");
    // print a random number from 0 to NumberOfTunes
    randNumber = random(numberOfTunes);
    while(randNumber == lastNumber) {
      Serial.println("Dude, we already heard that song! Pick something original");
      randNumber = random(numberOfTunes);
    }
    lastNumber = randNumber;
    
    putstring("\nRandom Number: ");
    Serial.println(randNumber);
    // Try to open the root directory
    if (!root.openRoot(vol)) {
      error("Can't open root dir!");      // Something went wrong,
    }
    Serial.println(tunesIndex[randNumber]);
    // open by index
    if (!file.open(root, tunesIndex[randNumber])) {
      error("open by index");
    }
    
    // create and play Wave
    if (!wave.create(file))
      error("wave.create");
    wave.play();
    uint8_t n = 0;
    while (wave.isplaying) {// playing occurs in interrupts, so we print dots in realtime
      // I also use this to keep it from trying to play more than one file while the doorbell is pressed.
      putstring(".");
      if (!(++n % 32))Serial.println();
      delay(300);
    }           
  }
}

/////////////////////////////////// HELPERS
/*
 * print error message and halt
 */
void error_P(const char *str) {
  PgmPrint("Error: ");
  SerialPrint_P(str);
  sdErrorCheck();
  while(1);
}
/*
 * print error message and halt if SD I/O error, great for debugging!
 */
void sdErrorCheck(void) {
  if (!card.errorCode()) return;
  PgmPrint("\r\nSD I/O error: ");
  Serial.print(card.errorCode(), HEX);
  PgmPrint(", ");
  Serial.println(card.errorData(), HEX);
  while(1);
}

/*
 * Find all the tunes - possible stack overflow if subdirectories too nested
 */
void findFiles(FatReader &dir) {
  putstring("\nRunning findFiles()");
  FatReader file;
  int tunesCounter = 0;
  while (dir.readDir(dirBuf) > 0) {    // Read every file in the directory one at a time
  
    // Skip it if not a subdirectory and not a .WAV file
    if (!DIR_IS_SUBDIR(dirBuf)
         && strncmp_P((char *)&dirBuf.name[8], PSTR("WAV"), 3)) {
      putstring("\nfindFiles() Not a wav or subdir.");
      continue;
    }

    Serial.println();            // clear out a new line
    
    for (uint8_t i = 0; i < dirLevel; i++) {
       Serial.write(' ');       // this is for prettyprinting, put spaces in front
    }
    if (!file.open(vol, dirBuf)) {        // open the file in the directory
      error("file.open failed");          // something went wrong
    }
    
    if(file.isDir()) {
      putstring("Subdir: ");
      printEntryName(dirBuf);
      // recursive call to findFiles(file);
    }
    else {
      // Add the file to the tunes[]
      // Aha! we found a file that isnt a directory
      putstring("Adding file: ");
      printEntryName(dirBuf);              // print it out
      if (!wave.create(file)) {            // Figure out, is it a WAV proper?
        putstring(" Not a valid WAV");     // ok skip it
      } else {
        Serial.println();                  // Hooray it IS a WAV proper!
        putstring("tunesCounter: ");
        Serial.println(tunesCounter);

        // Save file's index (byte offset of directory entry divided by entry size)
        // Current position is just after entry so subtract one.
        tunesIndex[tunesCounter] = root.readPosition()/32 - 1;  
        tunesCounter++;

        sdErrorCheck();                    // everything OK?
      }
    }
  }
  putstring("\nDONE Running findFiles()");
}

Tuesday, April 10, 2012

Homemade Skee Ball

What do two cardboard boxes and 100 plastic playpen balls make?

A skee ball game of course...