Thursday, August 14, 2008

Computers: Vista's speech recognition bloooows

My wife just got a new Dell Studio 1535 with included Webcam and array mic. I had never really used Vista, so I was searching around the computer and found it included a speech recognition program built right into the OS. "Wow!" I thought, but oh wait, it gets good.

We wanted to ensure it would have the best chance of getting words correctly, so my wife went through the included tutorial meant to make the system better learn your voice patterns. After reading sentence after fragmented sentence for a good part of ten minutes, we were finally ready to try out the real program. We chose to start with Firefox, which is mostly what my wife uses. Let me just say it doesn't work with Firefox, at least not easily. There was no easy way to even get to the address bar or have it type something in the Google text box when searching. Ok, so forget Firefox, moving on to WordPad, which the tutorial suggested would rock with speech recognition.

All I have to say about the speech recognition in WordPad is, "WTF?!" Let me just provide a quote of what it thought we said in paragraph:
Sure, can slow down into the late in the back of a team of her eye you on track whole new to win this election rally allow all ireland's body to my computer and now last five men who can bring I think you need all of them are hoping my family home evening and really off from it by a well be very deliberately all black weakening of October will develop a living that you could write an essay by limit the use of your alarm off PM close

Now I don't really know what we said, but I can tell you it certainly wasn't that crap. My wife got a real kick out of it though and read over what the speech recognition thought we said and it produced the next beauty of a paragraph.
Sherri camouflage out and elections in Israel over a high you want to call the land of blacks and Ronnie Allen is behind some of the computer and not what had been given in all of them are helping my family home evening and really costs from its title and he married literally all last week in an October Nelson reduced even it made no limits the use of your alarm of the Anglos

Ok, so at this point its kind of like trying to teach a two year old how to talk except they have quite a vocabulary already just no knowledge of how to string words together. So I don't know where Microsoft was going with this speech recognition but it turned out to get a huge laugh out of both of us so maybe it's a comedy application. Ha ha, Microsoft, I get it!

Monday, October 29, 2007

Programming: Load javascript dynamically

So I was trying to do something I thought was pretty simple: load javascript dynamically from a web service call in a web page. Basically, I wanted the page to be able to load with minimal code, contact a web service to get more code, and load it into the page for use by controls on the page.

Many of the results I found through searching were adding a script element to a page, while pointing its source at the file name.

<script src="myscript.js" type="javascript/java"></script>

You can accomplish adding this script tag dynamically by adding the script in the DOM:

var scriptTag = document.createElement ( "script" );
scriptTag.src = "myscript.js";
scriptTag.type = "text/javascript";
document.getElementByTag ( "head" )[0].appendChild ( scriptTag );

So, basically the script tag tells the browser to load the file, "myscript.js," after the page has technically loaded. But what if you don't have the javascript in a .js file? What if the javascript is dynamically generated, say from a database, and you don't know what the javascript will be ahead of time, nor do you want to link it to a specific source. Instead you can take plain old text containing javascript, and load it at runtime via the eval function.

function GetScript () {
var script = "alert ('hello!');"
eval ( script );
}

So that example is really simple, right? However it demonstrates the beginnings of dynamic script. If you paste this into a <script> element, then open the website, you will see an alert box that says, "hello!"

The next step would be to call a web service. Now I am using Microsoft's ASP.NET AJAX (http://www.asp.net/ajax), which makes loading and using web services so darn easy anyone can do it. If you want to approach connecting to web services a different way that go right ahead.



<scriptmanager>
<asp:scriptreference path = "ScriptService.asmx"></scriptreference>
</scriptmanager>


<script type="text/javascript">
function GetScript () {
MyNamespace.GetScript ( GetScriptComplete );
}

function GetScriptComplete ( result ) {
eval ( result );
}


So if GetScript returned "alert ( 'hello!' );" then it would now show an alert window saying, "hello!" Alright, so that's still really simple. What if you want to have a button on a website that calls a function named RunScript that you don't even know what it does yet? Okay, so there is probably some security issues here, but if you trust all the code that is placed on the website, why not figure out how to do something like this?

It's actually quite simple really. Instead of the script containing just

alert ( 'hello!' );
you can have the script look like:

RunScript = function () {
alert ( 'hello!' );
}

So now the button on the page would look simply like:

<input onclick="RunScript()" text="Run Me" type="button">


Go ahead, don't be afraid, and try it out! I'm sure anyone reading this post can take it much further than what's here in this post.

Let's sum it all up. You can use a web service to pass javascript as plain text to dynamically load as javascript in the browser using the eval function. Well, that's my take.

Television: Heroes and X-Men anyone?

Okay, so is it just me or is Heroes turning into X-Men? Let's see, in the most recent episode we've got some doctor, "Bob", who is trying to convert a virus to counteract the mutations, but may lead to infecting the general public. Does this sound familiar? Good, because it sure seems familiar to me.

I thought this show was very much like X-Men from the beginning, but my friend told me I was full of it because the show was much different. Phewy! Shouldn't everyone be able to put the points together? I'm not saying Heroes is bad because it is basically a different telling of X-Men. On the contrary, I really like the show. It has pretty good character development once they got passed the first half of the first season; the first half had way too much jumping between characters. The quality is good, probably one of the best produced shows on today. Point is that people need to just realize X-Men was quite original and Heroes is just a good retelling.

To sum it up, Heroes is bascially X-Men with a different take, but still one of the best shows around! That's my take anyway.

Sunday, October 28, 2007

Wedding: Photographers

So my fiance and I recently decided on a wedding photographer for our wedding next June. Amazing how hard it was to find available photographers. We began our search shortly after reserving the site, which was over two months ago, and at first we were surprised by the prices some wanted. Their work looks really awesome, but we weren't sure if we were prepared to cough up $5k for the photographs!

Fastforward to the present day, and sure enough, we are paying $5k and then some (read that as $5,500). Turns out we are quite picky on the style we like in a wedding photographer, and there happens to be a name to describe what we want: photojournalistic wedding photography. Basically it is a style of photography meant to capture the action and true essence of the moment. Anyway, that word automatically means lots of money, so oh well. Allyson Magda is our photographer, and her work looks really good, pretty much like artwork. We plan to put the art in frames on some of our walls it looks that good.

So to sum this post up, how and when did photographs become so expensive? Such is life, and such is wedding expenses. That's my take.