Google I/O 2011: Smart App Design

6:23 AM 0 Comments

 I am going to hook Jarvis into this. Just wait until the API piece of Jarvis is done. He will really shine.

0 comments:

Jarvis virtual assistant - William Arends C# & .NET

2 comments:

C# Extract HTML Image URLs From Source

I made a web request and stored the web page's mark up in a string. Then passed it into this method that I found here. This will return a list of Uri objects. (List). Simple and awesome code.

0 comments:

Speech Recognition Concepts.. Best Title I Got!

I found a really interesting QA article today while trying to figure out how to get C# speech recognition to guess what the user meant to input. Then correct the input, if needed.

My goal is to improve the programs natural language processing capabilities. I am trying to create an Iron Man's Jarvis interface type program. I have it working rather well now. It is hooked into the Wolfram Alpha's API. So you can ask Jarvis questions like, "How many people live in New York City?" or "What is 3 minus 4 equal?" 
Well enough about Jarvis. Information about my Jarvis project is coming in another post.

This post is for those of you who were wondering about creating a Google-ish "Did you mean" type response to user queries. Like I am currently looking into. This article should give you the keywords and jargon your looking for. Also links to great pre-existing solutions for you to use. 
Knowing what to search for, is half of the battle. :) 

#################################################################################
The question asked on Stackoverflow: Click here for source site.
#################################################################################
I have the following requirement: -
I have many (say 1 million) values (names). The user will type a search string.
I don't expect the user to spell the names correctly.
So, I want to make kind of Google "Did you mean". This will list all the possible values from my datastore. There is a similar but not same question here. This did not answer my question.
My question: - 1) I think it is not advisable to store those data in RDBMS. Because then I won't have filter on the SQL queries. And I have to do full table scan. So, in this situation how the data should be stored?
2) The second question is the same as this. But, just for the completeness of my question: how do I search through the large data set? Suppose, there is a name Franky in the dataset. If a user types as Phranky, how do I match the Franky? Do I have to loop through all the names?
I came across Levenshtein Distance, which will be a good technique to find the possible strings. But again, my question is do I have to operate on all 1 million values from my data store?
3) I know, Google does it by watching users behavior. But I want to do it without watching user behavior, i.e. by using, I don't know yet, say distance algorithms. Because the former method will require large volume of searches to start with!
4) As Kirk Broadhurst pointed out in an answer below, there are two possible scenarios: -
  • Users mistyping a word (an edit distance algorithm)
  • Users not knowing a word and guessing (a phonetic match algorithm)
I am interested in both of these. They are really two separate things; e.g. Sean and Shawn sound the same but have an edit distance of 3 - too high to be considered a typo.


........... Click the link above to see the answers for the question. Or here... Click here for source site. 

1 comments:

Sql Server Error: @schedule_uid is not a parameter for procedure sp_add_jobschedule.

@schedule_uid is not a parameter for procedure sp_add_jobschedule.
Recently had to resolve an issue with this error when sending in a SQL script. We right clicked a server job and when to:
Script Job As > CREATE TO > New Query Editor Window

 in SQL Server 2008. The script was going to be ran on SQL Server 2005 server.

 On SQL Server 2005 the parameter is @schedule_id and on SQL Server 2008 this parameter is @schedule_uid. If you remove the parameter this will allow the script to be ran on both 2005 and 2008.

0 comments:

C# WPF - Dynamically Loading Images Asynchronously Into a StackPanel From a List of Image URL's


         Recently, I needed to be able to load images from URLs into a WPF window without locking up the UI thread. After looking at multiple websites that posted how to do this or something similar, I wanted to share the solution I came up with after doing research on this topic.

What this does is takes a list of URLs and loads them asynchronously into the StackPanel without locking up the UI. If an image load fails, it inserts an error image and message.  For each image URL, a background worker is created to download the image using WebClient on a different thread. After each image is loaded the program will add it to the form. 

Here is the using statements. I had to give System.Windows.Shapes an alias because of the System.IO.Path namespace. They both contain an object called Path. This solved the ambiguous issue naming issue. Just checking to make sure the folder exists. If not, create it. This main try/catch is where it all happens. A rule of thumb, always leave breakpoints in your catches. Here we create a hard coded list of strings and loop over them and fetch each one in background worker. This will asynchronously load the images without locking up the UI thread. Here is the DoWork event. Its job is to download the image to the image folder and return the path of the downloaded image to the WorkCompleted event. If there is an issue we return NULL so we can load in our error image. In the work completed event we check for NULL and then add our controls to the StackPanel. I add a label then the image to the StackPanel's Children property. I load the images into a BitmapImage object by passing in the image path. Then I set it to the Image object which can be added to the StackPanel. This method is really handy and I found it in one of the source links. This will load up the error image we have in the solution. This is my first WPF project so I had to figure out how to do resource handling in WPF vs. Winforms/Webapps. There is not a huge difference, but it is a little different. Here is the XAML I added to the window. Note the use of the ScrollViewer around the StackPanel node.


Download Example

Sources:
http://stackoverflow.com/questions/8266475/how-to-download-image-synchronously-in-background
http://stackoverflow.com/questions/569561/dynamic-loading-of-images-in-wpf
http://stackoverflow.com/questions/6250240/how-to-add-a-scrollbar-to-a-stackpanel



0 comments:

12:37 PM 0 Comments

Diving Into Android Development Tonight

   I have downloaded Andorid SDK bundle, ADT Plugin, and Java. This is a new laptop and I forgot to install java after I got it. I will outline my steps here and offer any tips or tricks I find along the way. I have experience writing in Java, so this will assume you do also. Wish me luck. 

  • Download the Android SDK.
  • Install the ADT plugin for Eclipse (if you’ll use the Eclipse IDE).
  • Download the latest SDK tools and platforms using the SDK Manager.
  • Install Java... If you have not already... *cough* :) 


Follow the steps here: Creating an Android application
    The link above is what I followed for creating my first project. Pretty straight forward. Only thing I did different was name my project Sandbox. 

    To get this to run on an older LG android phone I had to download it's OEM USB drivers. Then use an android command "adb devices" in the SDK's Platform-tools folder. To see if my device was properly connect. This page helped "Using Hardware Devices"



Next I had got the app to run on my Nexus 7. I had to use windows device manager to point the driver update at the files I downloaded from ASUS. Just another FYI.



   I did the next page and got the app to open and send an INTENT into another Activity. Well I am to the screen now. I just need a great app idea now. I have my developer environment set up. Follow the rest of the my first app guide if you need. It is a great starting point. I just needed to figure out how to launch my apps on devices. Super excited to get going with Android development. 





0 comments: