Monday, June 30, 2008

Flash unable to request swf files from another subdomain within the same web server.

Flash unable to request swf files from another sub-domain within the same web server.

I just experienced an issue with flash loading other swf files in the same web server but requesting from another sub-domain.
For example: is requesting

The crossdomain.xml is not issue. This is configured to allow * all access.
The website path is provided to shell.swf via a param. If I change the param to provide “” it will work when the user is using This is very weir because everything is stored in the same location is just an issue with host headers.
I solved this issue my simply providing the current url host header to the shell.swf via the param.

So if the user is using “www” I will use If the user is using “”, then flash will use
I am not sure 100% why flash is unable to request files from other sub-domains. But this was the quickest solution to this problem.

Friday, June 27, 2008

Strip numbers from String : C# .NET Remove numbers from string

Here is a simple function I created to strip/remove numbers from a string.
I used the regular expressions to check if a char is number.
I choose to use regular expressions than using the Double.TryParse() because I feel RegEx are faster then the TryParse function. I could be wrong but at this point is doing the job.

public string StripNumbers(string input)
Regex regEx = new Regex("[0-9]+");
StringBuilder sb = new StringBuilder();
foreach (char a in input)
if (!regEx.IsMatch(a.ToString()))

return sb.ToString();

The next steps will be to test performance and find out what method is faster to check for IsNumber().

Wednesday, June 25, 2008

The transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D024)

In .Net this exception occurs when using the TransactionScope.

using (TransactionScope ts = new TransactionScope())


Follow this instructions on all database servers and web servers to configure properly the MSDTC service.

First verify the "Distribute Transaction Coordinator" Service is
running on both database server computer and client computers
1. Go to "Administrative Tools > Services"
2. Turn on the "Distribute Transaction Coordinator" Service if it is not running

If it is running and client application is not on the same computer as
the database server, on the computer running database server
1. Go to "Administrative Tools > Component Services"
2. On the left navigation tree, go to "Component Services > Computers
> My Computer" (you may need to double click and wait as some nodes
need time to expand)
3. Right click on "My Computer", select "Properties"
4. Select "MSDTC" tab
5. Click "Security Configuration"
6. Make sure you check "Network DTC Access", "Allow Remote Client",
"Allow Inbound/Outbound", "Enable TIP" (Not required if the client machine and remote machines are in the same domain)
7. The MSDTC service will restart.

On the client computer use the same above procedure to open the
"Security Configuration" setting, make sure you check "Network DTC
Access", "Allow Inbound/Outbound" option, restart service and computer
if necessary.

On the SQL server service manager, click "Service" dropdown, select
"Distribute Transaction Coordinator", it should be also running on
the SQL server computer.

Is this does not solve the issue, check the web server to ensure if DTC is enable.
1) Go To Control Panel
2) Add Remove Programs -> Add/Remove Windows Components
4) Select the Application Server and Click on the Details button
5) Ensure that Enable DTC Service is selected.

Additional Reading about MSDTC here:

Monday, June 23, 2008

C# Get Person Age In Years By Birth Date ( DOB )

Here is quick method for C# to get the age of a person given the birth date.

public int GetAge(DateTime dob)
// Get year diff
int years = DateTime.Now.Year - dob.Year;
// Add year diff to birth day
dob = dob.AddYears(years);

// Subtract another year if its one day before the birth day
if (DateTime.Today.CompareTo(dob) < 0) { years--; }

return years;

Friday, June 20, 2008

ASP.NET LinkButton does not work in FireFox as the DefaultButton

I recently discover that LinkButtons do not work in FireFox as the form's default button to trigger the form submit on the Enter keystroke.

I tried doing this:

this.Form.DefaultButton = this.lbtnLogin.UniqueID;

And no luck.
I also tried
and this also did not work.

But here is more info to solve this issue.
I worked around by making my button and ImageButton instead of a LinkButton.

Friday, June 13, 2008

Bookmarking with Flash and Javascript

Bookmarking using Flash

To bookmark a page from a Flash call, flash needs to call an external JavaScript function in your page to actually do the bookmarking any browser.

But here is the trick....

In order for the bookmarking prompt window for example in IE to show up the focus needs to be outside the flash object. So you need to set a focus to a DOM element outside flash.

Here is an example script that works.
function bookMarkPage(url, title) {
// set focus to a DOM element, otherwise it won't work.

case "Firefox":
window.location.hash = url;//set the hash value
alert("Please press 'Ctrl + D' to bookmark this page.");

case "Explorer":
window.external.AddFavorite(url, title);

case "Safari":
alert("Please press 'Ctrl + D' to bookmark this page.");

case "Opera":
// Create document element dynamic and invoke
var bookMark = document.createElement('a');

alert("Please bookmark this page manually.");

Thursday, June 12, 2008

The problem with video captions today?

What’s the problem with adding closed-captions to online videos up until today?

As I dig more into the online video closed-captioning market and get more convince that has the yet the best web editor for adding captions to your captions.

You see the #1 problem with the websites today such as Google Video Captioning,,, veoTag, and many others is that they force the user to use minutes and seconds. The user does not want to remember or even set the start and end time for the captions. That’s too painful. I have tried it and I hate it! Adding captions should be more simplified and super easy to use. Everyone knows that adding captions is not as easy as it looks. So, that’s why you have to provide the best out of the web for these users. Features like, copy and paste, resizing, drag and drop, delete, etc are small features that makes the user experience a much better one.

This is why I am very passionate about On top of rewarding the users that provide the captions with money (cash $), we are trying to make a better and a more pleasant experience when it comes to adding captions (closed-captions) to their favorite videos. Try the caption editor here to start playing with the “captionizer” and add captions in seconds.

Video captions will take video viewing, searching, and of course the advertising to another level. This is the next step to online video viewing. The users will be able to find exactly what they are looking for just by simply entering short keywords that are found somewhere in a video with captions.

Oh, I am forgetting, is 100% free and will always be. Every can add captions, comments, transcripts, and etc to any online video. At this point only is supported but with good response from the public we will be able to add support to other video providers.

Give it a try and let us know what you think.

Tuesday, June 10, 2008

IIS Error: You have attempted to execute a CGI, ISAPI..

I setup a new 2.0 application under IIS web service and I come across this error:

The page cannot be displayed
You have attempted to execute a CGI, ISAPI, or other executable program from a directory that does not allow programs to be executed.

When you get this error it usually means that you have not set execute permissions to "Scripts only" under the "home directory" tab in your website properties. When creating a new website the value for execute permission is set to "none". Changing to "Scripts only" will solve this problem.

Friday, June 06, 2008

Thursday, June 05, 2008 Videos with Closed Captions

It’s been a very good journey working on my latest website
I started this experiment site with my friend Alex Le. I took on this challenge primary to learn something else other than .NET. Yes, I started to learn ruby on rails. We started this project 2 months ago to be exact. Our dedication was just part-time since we both have real jobs. However, the project got more and more interesting (actually a lot more fun than work) that we spend more and more time on in and in 3 occasions we coded through the night. No we are so happy that we can at least provide a beta version out in the web so that users can start experimenting with

I learned a lot working with Alex as a team. We both worked remotely and we did pear to pear programming in our laptops over IM.
Early in the game I had the opportunity to chat with Rohit Kumar, new CIO for the Chicago Sun-times newspaper ( at an i.cstars event. Rohit and I had a great chat about online video broadcasting and advertising. Up to today videos are only searchable by the title and the description. Some companies are trying tagging the videos with keywords so that searches and ads are more targeted and related to the video content. But with you can take this to the next level. Our videos are not just searchable by the title, description, and tags but also by the entire video content. One of my first videos I added captions was a music video by 3 Doors Down (Without you). Two (2) minutes after my captions were published the ads next to the video were about 3 Doors down music rings. Then I experiment with the movie trailer from Iron Man and same thing. A minute later the ads next to the video displayed a video ad for the new Hulk movie. How cool is that?
I believe has lots of potential.

I am personally going to use it to record my own videos, upload them to YouTube, and add captions to provide teaching and how to for the i.cstars community of interns and alumni.
What’s great about TubeCaption?
One nice feature about our site is that we share the revenue with you!
Once you have created an account us, you can link your Google Adsense account and we will display Google ads using your account when your video captions are displayed, about 50% of the time. In the near future will ad support for additional advertising providers.
Well, that’s if for my starter. I have plenty to say but I got to keep in short for today.
Thanks for reading and make sure to visit

Monday, June 02, 2008

ruby on rails: will_paginate anchor param

Recently I discover that I can add an anchor to the will_paginate helper for the will_paginate plugin in rails.

This will create the url as "path/?page=2#myanchor".

<%= will_paginate @videos, :params => {:anchor => "myanchor" }%>