ear-fung.us I’m a programmer. I’m also pro-grammar.

5Jun/070

NYPD Will Arrest You For Asking Questions

Robert Carnevale was arrested while videotaping an NYPD bicycle raid after he asked one of the officers for his badge number. Carole Vale, a nurse observing the scene, was also arrested when she asked why Mr. Carnevale was being detained. Mr. Carnevale was held for 22 hours and Ms. Vale was held for 13 hours.

read more | digg story

25May/070

How to Drive Like a Cop

Police CarsThe FBI says police officers are about as likely to be killed in a vehicle crash as with a criminal's gun. Cops drive in a high-threat, workload-intensive environment: blaring sirens, flashing computers, screaming radios, civilian drivers seemingly bent on kamikaze attacks, and, at their destination, angry bad guys who don't particularly respect public servants. All reasons that cops take driving very seriously. With feedback from officers in the field, law enforcement driving instructors have compiled numerous tips to help their students avoid becoming a statistic. Here, we pass those along to you...

Read the rest ->

22May/070

Yummy

Don't watch this shortly before eating.

12Jan/070

Nike+ Public API and Blog Theme Changes

Nike+iPodI've been prodding around the Nike+ API by opening the code in in the official Nike+ Mac OS X Widget.

I've got a WordPress plugin written and I'm going to be testing it over the next few days. I'll be releasing a version 1.0 soon!

It only has a basic feature set, but will get all the information you see on the right hand side of my blog.
Are you interested in it?

On another note: I've changed the design of my blog to something more "IE friendly". My last theme had a lot of transparent PNG files which render completely wrong on windows and IE. Only after I switched themes did I realize that the guy whose project my Nike+ project is based uses the same wordpress theme! (scrapdog, this was completely unintentional and i'll be modifying the theme a bit more over the coming days.)

*UPDATE* WordPress plugin now available.

31Oct/060

Dark Fish Tank

Here's a recent photo I took of my fish tank. It was all dark and the only light in the room was from the fish tank itself.

Additional Information:
Camera: Canon EOS Digital Rebel XTi
Exposure: 0.025 sec (1/40)
Aperture: f/4
Focal Length: 28 mm
ISO Speed: 1600
Flash: Flash did not fire

20Oct/060

First Pic From My New Camera


Well, this isn't my first photo i took, but it's the first GOOD photo from the camera.

If you don't recognize him, this is Tango, our little (and I mean that literally) dog.

We adore him and I'm sure you'll see him around here again.

19Oct/060

Feel Free To Comment

I know that some people read my blog that never leave comments. I'd like to change that.

Commenting is easy as filling out a government form! (just kidding)

Really... all you have to do is click the title of the article and put in your name and email address and a comment and hit "Submit Comment". If you've submitted comments before what the same email address, it will show up immediately on the site, otherwise if you're a first time commenter I'll get an email asking to confirm you as a commenter. Form then on, you'll get to comment without a delay.

I'd really like to know what you all think of my posts and how I can improve my blog. I'm sure that with my new digital camera coming in the mail that I'll be posting a lot more photos here in the coming months.

-Mark

21Sep/060

A useful PHP Function for Everyday Use

Many of you know that I'm a PHP developer. I just thought I'd post a little snippet of code that i use daily in my debugging.

I use a lot of arrays in my day to day work of gathering results from a database and displaying it to users or manipulating it and inserting it back into the database. anyone knows that to see the contents of an array, just use the print_r function. It doesn't look very pretty being formatted in one long wrapping line so i use the <pre> tag to make it print really nicely on the line.

So we have:

echo '
';
print_r($my_array);
echo '

';

Now what happens when you have HTML in those array elements? Yeah. Everything on the page goes wonky.
Here's a function that will not only present the array in a nicely formatted manner, but will also interpret the contents of the HTML entities in the array:

function print_pre($a, $protected = true){
	echo "
";
	$search = array("< ",">");
	$replace = array("<",">");

	if(is_array($a)){
		if($protected){
			print_r(str_replace($search, $replace,$a));
		}else{
			print_r($a);
		}
	}else{
		if($protected){
			echo str_replace($search, $replace,$a);
		}else{
			echo $a;
		}
	}
	echo "

";
return true;
}

I hope you like it, and drop me a line if it helps you out in any way, shape, form, or fashion.