Michael Butler

Michael Butler is an accomplished web developer at RustyBrick and this here is his personal blog. View on Google+, Facebook, or Twitter.

Behringer UCA222 Review and FAQ

Last year I put up a short review on YouTube of Behringer’s UCA222 USB audio input/output interface for recording stuff into your computer. I just did the review for fun after getting my Ultra HD pocket video recorder but, since then, it has received thousands of views and a lot of comments too — many of which I responded to. Here is a rough overview of the device, and after that I’ll put up a small FAQ (Frequently Asked Questions).

This device basically allows you to record to your computer high quality stereo sound from any device that outputs red & white RCA cables. You simply plug in the USB to your computer (Windows, Mac OS X, or Linux) and most systems will install the software automatically. It will show up as a new audio input/output device that you may select in your recording software such as Audacity. For me, the UCA222 was actually selected automatically while plugged in.

The manufacturer claims 48khz 16bit sound quality. This is much higher quality than you’re likely to get from your built in sound card. It can also be used to replace your existing sound card to output stereo sound through the device. In fact, while plugged in, your normal sound card will be muted and you’ll have to use this one for any output.

FAQ:

Q: Can I record my guitar with this device?
A: This isn’t  used for recording guitars. For recording your guitar into your PC via USB, your best bet is to buy the Behringer UCG102, the sister product made for guitars and analogue instruments.

Q: Can you play music on your computer and have it come out through the UCA222 USB like a sound card?
A: Yes, once plugged in, all sound generated from your computer will actually now go through the stereo output on the UCA222.

Q: How is this different from the UCA202?
A: They’re the same exact device, except UCA222 is red instead of silver, and UCA222 comes packaged with EnergyXT software with a lot of free VSTs for making music.

Q: After its connected do you control the volume at the mixing board or the computer?
A: The mixing board. For me, when I plugged it in, there wasn’t anyway to control the input recording volume, it was simply set to 0.0 dB.

Full Video:

No Comments Posted in Music, technical
Free Streaming Dance Mix 03/14/2010

Recorded on 3-14-2010 (Pi day)

Click to stream instantly, right click to download and Save As…
March 13, 2010 StatiK EffecK Mix

Terminal 6 – Solarity
Passenger 10 – Avantgarde
Angel (Axwell Remix) – Pharrell
Tetris – Electrixx
They Need Us – Arnej
Dreamcatcher – Memento
I’ve Been Waiting – Dave Dresden & DJ Lynnwood
Lovegame (Dave Aude Club Mix) – Lady Gaga
Hide & Seek – Tiesto Remix
No Turning Back (Orig mix) – Gui Boratto
Watch the sun come up (Moam remix) – Example
I will be here – Sneaky Sound System & Tiesto
Kids (Soulwax remix) – MGMT
Feel it in my bones (Tiesto remix) – Teagan & Sara

1 Comment Posted in crap i write
JavaScript Object Instantiation!!!

Hallelujah! Finally tackled JavaScript object instances.

I learned JavaScript Object Notation (JSON) a few months ago and it has increased the portability of my JavaScript code. But something I’ve never done with Javascript is the use of the “new” keyword like we do with Java, C++, or PHP with Object oriented programming.

Finally decided to get to the bottom of it when I wanted to quickly write a JavaScript count-down (or count-up) timer display.I wanted to be able to create these counters on the fly, anywhere on the page, by just supplying the DIV id to a function.

Continue Reading »

1 Comment Posted in Programming
Dance Mix MP3 01-31-2010

Here’s another MP3 recorded during my DJ-in-training set.
Click on it to start playing instantly, or right-click to Download & Save As…

statik01-31-2010.mp3 Duration 56:18

Track listing:
Marco V – Unprepared
The Message
I’ve Been Waiting – Dave Dresden & DJ Lynnwood Remix
I Will Be Here – Tiesto & Sneaky Sound System
Papilon – Editors (Tiesto Remix)
I Remember – deadmau5 & kaskade
The Fractal Universe – Mat Zo
Louder than Boom – Tiesto
Sail – Armin Van Buuren
Shivers – Alex MORPH Red Light Dub
On a good day – oceanlab

No Comments Posted in Music
New Dance Mix MP3

Here’s a new mix for your listening pleasure. There were some mistakes so I did some post-processing to remove them as best I could. But for the most part, it is a live mix.
Click to stream & play, right-click to save and download for your iPod.
StatiKEffecK Mix 01/2010 (55 MB)

  1. Triclops
  2. yaya
  3. lovegame
  4. piece of me
  5. halo
  6. evacuate the dancefloor
  7. in the air
  8. let me think about it
  9. hometown glory
  10. i will be here
  11. infinity 2008
  12. poker face
No Comments Posted in Music
Query YouTube Video XML Data


You might know that one can obtain XML information about a YouTube video by its ID, using the YouTube API (basically downloading an XML document at a URL). The URL to do this is: http://gdata.youtube.com/feeds/api/videos/VIDEO_ID replacing VIDEO_ID with the YouTube ID String. Example: http://gdata.youtube.com/feeds/api/videos/iZ_wNWSV-aQ (Click it to see the XML data on a real video).

Here is a function I wrote to extract desired information from the XML document, in PHP:

Extract Information from a YouTube XML File:

<?php
// Get & Parse YouTube XML data
	static function getYouTubeInfo($id){

		$xml_data = @file_get_contents("http://gdata.youtube.com/feeds/api/videos/".$id);
		if(strlen($xml_data) < 25){
// Not enough data
return Video::getYouTubeInfoBasic($id);
}
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;
		if( ! $doc->loadXML($xml_data) ){
    // Failed Loading XML Doc
			return Video::getYouTubeInfoBasic($id);
		}

		$ret = array();

    // Get Thumbnail HREFs
		$media = $doc->getElementsByTagNameNS("*","thumbnail");

		if($media){
			foreach($media as $node){
				$ret["thumbnails"][] = $node->getAttribute("url");
			}
		}

    // Get Video Title
		$titles = $doc->getElementsByTagNameNS("*","title");

		if($titles){
			$ret["title"] = $titles->item(0)->nodeValue;
		}

    // Get Link to Video
		$link = $doc->getElementsByTagNameNS("*","player");

		if($link){
			if( $link->item(0) ){
				$ret['url'] = $link->item(0)->getAttribute("url");
			}
		}

		return $ret;
	}

        // If the above function doesn't work (i.e. the XML is not available,
      //    this function will be called to grab the information manually and check if a video exists by checking for thumbnails
	static function getYouTubeInfoBasic($id){

		$check = @get_headers("http://img.youtube.com/vi/".$id."/1.jpg",true);

    // Check if Thumbnail exists
		if( strpos($check[0],"404") > 0 || strpos($check[0],"400") > 0){
			return false;
		}

		$ret = array();
		$ret['thumbnails'][] = "http://img.youtube.com/vi/".$id."/1.jpg";
		$ret['thumbnails'][] = "http://img.youtube.com/vi/".$id."/2.jpg";
		$ret['thumbnails'][] = "http://img.youtube.com/vi/".$id."/3.jpg";

		$ret['title'] = "Watch Video";
		$ret['url'] = "http://www.youtube.com/watch?v=".$id;

		return $ret;
	}
?>

Sometimes requesting the YouTube XML data URL results in a 404 or 403 error. If the XML data is not found (usually when a video is new, but sometimes can happen even on old videos), there is a fail-safe function that checks if a YouTube video exists based on the existence of its thumbnails. With the fail-safe function, the title of the video is not obtained, though it could be edited to grab the Title by parsing the actual YouTube video page for the <title> tag.

Here’s another helpful function to extract the YouTube ID from different kinds of URLs and even the <embed> code that a user might copy & paste:

Extract YouTube ID From a String using Regular Expression

<?php
	static function getYouTubeID($str){
		$matches = array();

// Links from a user channel page will have the ID in the # hash tag
		if(strpos($str,"/user/") !== false && strpos($str,"#") !== false){
			$params = explode("/",$str);

			$the_id = array_pop($params);

			return $the_id;
		}

// Normal YouTube public page link
		preg_match("/watch\?v=([^&]+)/i",$str,$matches);

		if(!$matches[1]){
// last resort, try getting ID from embed code
			preg_match("/v\/([^&\"']+)/i",$str,$matches);
		}

		return $matches[1];
	}

?>

Obtaining the Duration of the Video in Seconds

Use this snippet to read the duration of the video in seconds.

$durations = $doc->getElementsByTagNameNS("*","duration");
		if($durations){
			$ret["duration"] = $durations->item(0)->getAttribute('seconds');
			// echo $ret['duration'];
		}
2 Comments Posted in Programming
Disabling Apache’s Mod Security Rules

I tried upgrading phpMyAdmin to a new directory on a server, not using the built-in cPanel environment. It installed fine, but I couldn’t run certain SQL queries like DROP TABLE tablename; It would generate an Internal Server Error 500.

After some testing I realized that if I simply tried to access any url with the string “x=DROP TABLE abcxyz” the page would simply be an internal server error 500. To see if your server has mod_security enabled, create a test PHP page with hello world in it, call it test.php, and try to access yourdomain.com/test.php?x=DROP TABLE xyz (even if your script doesn’t do anything with the x variable.

To get around this for certain web applications (which are denied access from the public anyway with password protected directories), find the file /usr/local/apache/conf/modsec2/whitelist.conf and add this to it:

<LocationMatch /phpMyMyAdmin/*>
<IfModule mod_security2.c>
SecRuleEngine Off
</IfModule>
</LocationMatch>

You may replace the /phpMyAdmin/* part with any regular expression for a part of your site for which you would like mod_security turned off. If you cannot find whitelist.conf, you can try adding the same code to your httpd.conf (use updatedb and then locate httpd.conf to locate the file)

After you save the change, it might not take effect for a few minutes, or you might have to restart the web server!

No Comments Posted in Programming
Honda Fit 2007 5-Speed Miles Per Gallon MPG

I have recorded my Honda Fit’s MPG since Sept. 2009 and compiled a speadsheet graph of the results:

You can see that the closer we come to winter, the less the MPG. Still, from these results, it was an average of 37 MPG. I drive 12 miles to and from work, 5 days a week.

No Comments Posted in crap i write
Maine Thanksgiving

Here’s a video from my Thanksgiving time in Maine this year.

No Comments Posted in crap i write
StatiKEffecK Mix 01 MP3

After practicing with the iDJ2 for a few weeks, and obtaining some recording equipment, I recorded 30 minutes into an MP3. Part of it can be watched on YouTube, or you can download the MP3.


Youtube Link

Download the MP3 28:00 (might want to right-click and Save As…)

I also obtained a Flip UltraHD pocket camcorder. Maybe I’ll write about that one day.

No Comments Posted in Music