20110925

source for html5 audio element static?

here are some sample html5 code that uses the audio element to play a song. the section below the script assigns an audio file to the player. i've tested it and it runs fine. i have a total of 4 songs that i need to put on this page and creating a player for each song works fine. 

but then i decided to get creative by using a single player and making it possible for the user to load 1 of 4 songs to the single player before clicking the play button. when you click on any of the songs, the audio element's source files are changed by the script. 

however, only the first song loaded (the default song "Song 1" loaded at the time the page loads) plays. it seems that the source file loads at page load time and cannot be changed. is this a restriction of the html5 audio element? any suggestions?

thanks.

<!DOCTYPE html><html dir='ltr' lang='en-US'>
<head><title>media</title></head>
<body>


<script>
function loadSong(songTitle, oggFile, mp3File) {
document.getElementById('song_title').innerHTML = songTitle;
document.getElementById('ogg_file').src = oggFile;
document.getElementById('mp3_file').src = mp3File;
}
</script>


<div class='audio_box'>
<span id='song_title' name='song_title'>Song 1</span><br /><br />
<audio controls='controls'>
<source id='ogg_file' src='media/music/Song1.ogg' type='audio/ogg' />
<source id='mp3_file' src='media/music/Song1.mp3' type='audio/mpeg' />
<p>Your browser is not currently supported for playback of music. Please use a browser such as the latest Firefox, Google Chrome, or Safari.</p>
</audio>
</div>


<!-- these are the song choices -->
<span><a id='song1' href="#" onClick="loadSong('Song 1', 'media/music/Song1.ogg', 'media/music/Song1.mp3')">Song 1</a></span><br /><br />
<span><a id='song2' href="#" onClick="loadSong('Song 2', 'media/music/Song2.ogg', 'media/music/Song2.mp3')">Song 2</a></span><br /><br />
<span><a id='song3' href="#" onClick="loadSong('Song 3', 'media/music/Song3.ogg', 'media/music/Song3.mp3')">Song 3</a></span><br /><br />
<span><a id='song4' href="#" onClick="loadSong('Song 4', 'media/music/Song4.ogg', 'media/music/Song4.mp3')">Song 4</a></span><br /><br />


</body>
</html>


20101022

jailbreaking and unlocking ios4.1 on my iphone 3g

the iphone dev team just released the new pwnage tool 4.1 for jailbreaking and unlocking ios 4.1 for the iphone, ipod touch, and ipad. i've been waiting on it for a while since my iphone 3g was already on ios 4.0 when it was handed over to me. and as many others have experienced, ios 4.0 on the iphone 3g is slow...really slow. included in ios 4.1 is a fix to cure the iphone 3g of is sluggishness. apple released  ios 4.1 a couple of months back but i could not upgrade right away to ios 4.1. doing so without the ability to unlock it would mean that i could not use it on t-mobile.

well, the wait is over. as always, the way the pwnage tool works is by creating a custom firmware from the official one that itunes uses to ugrade your phone. once you have pwnage open, you point it toward the downloaded firmware file from apple. you make a few selections as to the type of device you have, the unlock option, and software that you might want to install along with the cydia package. a few minutes later, it spits out a file that you should be using to upgrade your phone. at the end, it asks if you have jailbroken your phone previously. if so, you could just fire up itunes, option-click the restore button on itunes and point it to your custom firmware. if the phone is not currently jailbroken, it helps you put your phone into a mode called "dfu" (essentially recovery mode) so that itunes will accept putting the custom firmware onto your phone. there is a message that says if you are unsure, then you should say that it is not currently jailbroken and go through this extra step.

well, since i've been using it on t-mobile, i know that it has been jailbroken. so i opted to just bypass this next step and jump right into using itunes to upgrade my phone. let me tell you that this was a HUGE mistake. after working for what seems to be forever, it quits and tells me that error 1603 has occured. not only that, the iphone kept on displaying the spinning wheel without letting up, indicating that it was still working. by this time, the spinning wheel is now called the spinning wheel of death. i had to force a shut down by simultaneously holding down the home and power buttons until the screen went blank. upon powering it back on, it was introduced to the "connect to itunes" graphic. so i connected to itunes and it finds the phone. it says that it has to be restored before it can be used. so i do the option-click thing and pointed to the custom firmware file i created. and again, after a long while, it errors out.

i went online and did some research, tried all suggested fixes, but nothing worked. by this time, i was on my 4th or 5th try, and still getting nowhere. i thought that i had a dead phone. the last piece of advice i got from researching was to restore back to version 4.0 and attempt the upgrade once again. luckily, i kept the custom firmware i created for version 4.0. and i'm not sure if this mattered or not, but another piece of advice was to do the upgrade using a different user account. i tried the combination of the two and it worked. but it only worked to put me back to where i was before...on ios 4.0.

after getting my phone to boot on ios 4.0 again, i went back to my original user account and used the pwnage tool to put the phone into dfu mode. then i option-clicked restored once again and pointed to the newly custom 4.1 file again. this time, it worked. in about 20 minutes, the phone was on ios 4.1. it took another half hour to load everything from a backup onto the phone. after that, i went into the cydia app and installed the ultrasn0w unlock utility so that i could use the phone on t-mobile again. what should have taken about an hour to accomplish took me 4 hours.

so my learning in this was that you should ALWAYS ALWAYS ALWAYS use the pwnage tool to put your phone into dfu mode, even when it says that previously jailbroken devices do not have to go through that step.

now my phone is running much faster. no more waiting 2 seconds after i make an entry for it to take effect.

one last thing. always backup by forcing a sync before you attempt to upgrade. you don't want to have to re-enter all your contacts and calendar events from scratch. oh, and i did this on a mac. as of this day, the windows version of pwnage tool 4.1 is not yet available.

20091203

cisco sta1520 (sdv tuning adapter)

after using the required tuning adapter with my tivo s3 recorder for a couple of months now, i can definitely say that this piece of equipment did not improve my cable service. in fact, it completely sucks. there are a couple of problems.

the first is that it reboots on almost a daily basis. and when it does, if i happen to be recording something, even if the source is a hd signal from my outdoor antenna and not a cable channel, it cancels my recording.

the second problem is that on many occasions, the hd channels that i do watch from the cable source are coming in very pixelated, to the point of dropping audio completely and making the video entirely unwatchable. before the tuning adapter was installed, my hd signals from cable were rock-solid. if the point of the sdv tuning system is to ease up on bandwidth usage, why is the picture quality now worse than before?

20091004

Microsoft Security Essentials

Microsoft Security Essentials is officially out for the public. If you haven't heard, this is free anti-virus, anti-spyware, and nti-malware software from Microsoft. I have been using Avast for years and have finally switched when it became available. I decided to switch because reviews have been generally positive, especially since it uses very little resources such as disk space and ram, and it works just as well as any other anti-virus software out there.

However, the auto-update mechanism has to be tweaked when it comes to new virus defintion files. I'm sure that it does auto-update. I'm just not sure what the schedule is since I don't leave my computer on all the time. I would prefer for it to check whenever it comes out of standy/hibernation, or when it boots/reboots, which Avast has already implemented (in my experience). This is something that must be implemented by Microsoft if they hope to have it widely adopted as the primary malware protection of users.

It can be downloaded at the Microsoft Security Essentials page.

One last thing. Your copy of windows must be validated in order for you to download the software.

20091003

flip minoHD review

i have used a flip minoHD for a few months now. the video quality is terrific if you have adequate lighting. with 1280x720 resololution, the quality is definitely better than that of the iphone or the new ipod nano. there's 8GB of flash memory, good enough for an hour of recording.

on the negatives, there is no memory expansion slot if you need more recording time. you simply have to offload video to a computer to gain more recording time. and there is one more negative aspect of this recorder that i consider to be huge for me. in order to charge the recorder, you have to connect it directly to a usb port on your computer. this isn't bad per se. but if it's the one and only way to charge it, then i would say it's a bad thing. to be fair, they do sell a separate charger that you can plug directly into a wall socket. however, that's another $30 on top of the $200 i've already spent.

since it charges exclusively via usb, i thought that a usb hub with its own independent power supply would be able to charge it. but it won't. i also tried an ipod power adapter. no go. then i have a griffin power block, made for charging devices that charge via usb. this charges my ipod and every other device i have that charges via usb. but it won't charge the minoHD. since all three of these options that i have available to me supply its own power, i don't understand why it won't charge. the blinking light indicates that it is charging, but it's not. and not only will it not charge, but it actually drained power from the minoHD. that's right. according to the battery indicator, i started out with a half-charged battery. leaving it plugged in overnight drained it completely.

the only explanation i can come up with is that the flip minoHD has some kind of built-in circuitry that prevents you from charging without a computer. but they do sell that charger as an accessory. so the conclusion i have come to is that they did it on purpose just so that you have to buy their charger, designed to bypass this no-charge circuitry, if you want the option of charging without a computer. what a racket.

yes, i can always use a computer. but think about this. the power needed to charge this device is miniscule. but it forces me to waste a lot more power by using a computer. i do not leave the computer on 24/7. that's just a waste of power and perhaps shortens the life of its components and i don't understand why people do it. i turn it on when i need to use it, then it's off when i'm done.

it takes just 2.5 watts to charge the flip minoHD, but the power source is using up anywhere from 30 watts (let's say a netbook) to 300+ watts (full desktop), which puts efficiency under 10% at best. how would you like it if the company providing your electricity charges you 100 watts for every 10 watts of light your light bulb outputs?

20090428

the great 2009 lay offs...it's my turn

well, i got my notice today. after 13 years and some months, they had to let me go. kind of glad, since i've been wanting to stop doing work with marketing data and transition into programming instead. this was the kick i needed.

20090325

cigarette tax 2009

i hate that not only did the federal government raise the cigarette tax, but that california also did it as well. do they think that the added revenue will lift america out of this recession? why are smokers singled out to pay this extra tax? how would you like it if your habbit is going to sporting events and every time you enter a stadium, they charge you an extra tax? what about a tax on every drink you order in a bar?

they justify it by saying that it will discourage people from smoking. that's true enough. but if they want to raise revenue, why would they want anyone to quit? it's a contradiction.

last year california voters also approved a tax increase on cigarettes. the revenue goes to keeping emergency rooms open. are smokers responsible for keeping emergency rooms open? what percentage of emergency visits are accounted by smoking-related problems? why don't they tax purchases of guns for this. afterall, gun shots will certainly land you in an emergency room. and what about people who participate in sports? they should be taxed for participation because they are more likely to suffer injuries that land them in an emergency room. how do you justify NOT taxing them?