Thursday, May 14, 2009

Read XML nodes in SQL


DECLARE @htc xml

SET @htc = '
<boatGroup>
<boat>
<boatId>1CDA141</boatId>
</boat>
</boatGroup>'


SELECT O.boat.value('(boatId)[1]','nvarchar(max)') AS BoatID
FROM @htc.nodes('/boatGroup/boat') AS O(boat)




Reads all the 'boatId' elements within the 'boat' node. Element names are case sensitive.

Sunday, January 6, 2008

Psychology

I was contracted by an individual in Italy to develop Psychology. It is a web based chat/game facebook application which trains people to communicate in a more effective manner. Peers rate each other while following the rules of the game. It was a very interesting project, both the concept and the development. The solution was built in ASP.NET using the AJAX toolkit and custom Javascript to create the necessary interface. The chat interface is different that what you would find on a typical chat room, it uses dialog bubbles to show who is speaking and it's position is on the right or left of the window depending on who is speaking. This information is published with the permission of the intellectual property owner.

Saturday, June 30, 2007

Wishlist Gifter Facebook Application

When the Facebook API was release I became excited about it, I knew that social networks were rapidly becoming a part of life, and finally developers would interact with it. Strangely enough I find the possibilities of social networks more interesting than the sites themselves. In the past I leaped onto myspace, but soon became disappointed with their disdain for third party developers. Developer access to social networks enable applications to have a real social context for their users and a real relevance to their lives.

I developed Wishlist Giter to get my feet wet with the Facebook API, which is very intuitive thanks to the .Net Facebook Toolkit. Its purpose is simple, grab a user's wish list from Amazon.com and display the items in the user's profile. The user's friend can look at these, click on them and be directed to pay and ship the item to the user.

The process is seamless, point, click and get your friend/relative the movie or CD they wanted for their birthday.

The application works with the international Amazon sites and only requires the email address you use with Amazon.

Thursday, March 1, 2007

Phone access to MySpace. Early Testing. Couldn't wait.



This is a project I am working on, it's a phone based gateway to MySpace. This does not use WAP(mobile web) access, it uses a regular phone line to access your MySpace message inbox. It works with TTS (text-to-speech) voice synthesis and voice/tone recognition.

Soon you'll be able to check your MySpace inbox even from a pay phone! I just hope Tom doesn't shut me down.

This is the first test after implementing the message parsing functions. The code is still not done, but is operational. This not a Beta, its an Alpha version.

I need a better name for this project.
PhoneSpace is the code name, please send me suggestions for the final name.

The application is now connected to this account:



[PhoneSpa..


1) Send a message to that account [PhoneSpace]
2) Call 1-877-338-6225

When it answers enter this :

PIN: 1111
User ID: 4024444

It should now read messages, remember it's experimental so errors might occur!


UPDATE: The live demo has been disabled until it is moved to another server.

Tuesday, February 27, 2007

Sunday, February 25, 2007

PhoneSpace

Recently I’ve taken an interest in VoiceXML and related technologies which are used to develop a new generation of phone based applications. I’ve also had a few thoughts for a library component to programmatically access my MySpace inbox. The merger of these two itches is becoming a small project known informally as PhoneSpace.

The idea is to access your MySpace mail inbox in the same way you access your phone’s voice mail.


You would dial a 1-800 toll free number and have your messages read out loud by TTS (Text-To-Speech) voice synthesis.

It’s an elaborate process considering it requires a VoiceXML client that connects to a server (ASP.NET) which communicates with MySpace by simulating the user.

I don’t really have the time for these endeavours, but this is something fun that might prove useful.

Why?
I have always held a deep interest in technologies that connect us with the world, and more importantly with the software that drives and inter-connects these mediums. I've written software that has connected Pocket PCs, desktops, servers, mobile phones and video game systems to other systems or services enabling communication and control on the go.
It’s satisfying to connect two points together and to provide access to systems in innovative ways.

Coming soon!

Wednesday, January 24, 2007

GetVideoURL and GetVideoName from Youtube

Update: 1/15/2009 YouTube made breaking changes to their site, the code below no longer works.

The function GetVideoURL returns the direct URL to the movie file in a Youtube page by passing the page's HTML source.


Private Function GetVideoURL(ByVal htmlSource As String) As String
'Youtube's url to retrieve the video
Dim targetUrl As String = "http://www.youtube.com/get_video?"
'locate the src url passed to the flash player
Dim regexpFindID = New Regex("/player2.swf?((.\n)*?)"",", RegexOptions.IgnoreCase)
Dim matchID As Match
matchID = regexpFindID.Match(htmlSource)
If matchID.Success Then
'extract the videoID query string
Dim vidID As String
vidID = matchID.Value.Substring(13, matchID.Value.Length - 15)
Return targetUrl + vidID
Else
Return Nothing
End If
End Function

Private Function GetVideoName(ByVal htmlSource As String) As String
'locate the title based on the div tag
Dim regexpFindName = New Regex("video_title"">((.\n)*?)", RegexOptions.IgnoreCase)
Dim matchName As Match
matchName = regexpFindName.Match(htmlSource)
If matchName.Success Then
'extract the title
Dim vidName As String
vidName = matchName.Value.Substring(13, matchName.Value.Length - 18)
'remove common invalid file system chars & html syntax
Dim arrInvalids As String() = {"\", "/", ":", "?", "<", ">", "", " ", "<", ">", "&", """}
Dim invalid As String
For Each invalid In arrInvalids
If vidName.Contains(invalid) Then
vidName = vidName.Replace(invalid, "")
End If
Next
Return vidName
Else
Return Nothing
End If
End Function


Xido is just an IE control using these functions along with threaded asynchronous calls using the Net.WebClient object to download the files (the download limit is by design to prevent abuse).
Many people are now focusing on these kinds of applications, both running as clients or web applications and are including video transcoding as well as other features.

By contrast Xido is only a small application built out of boredom using these old functions which I had once written out of my frustration while using keepvid.com. Sites like KeepVid forced me to copy/paste URLs and manually rename every single file. Xido was only meant to alleviate this problem and should be considered defunct until an interesting challenge comes up using embedded Flash video.


Go build your own rip site like :

http://www.dubayou.com/mytube.php

http://www.ripzor.com/youtuberipper.html
http://www.keepvid.com/

Someone even built a webservice that does this same thing (I still don't know why).