Tuesday, October 18, 2011

iOS Development on Windows w/ PhoneGap Build

I have wanted to write apps for the iOS platform for a long time. I am a windows developer and did not really have any ideas for apps to constitute buying a Mac. Regardless, I still wanted to write apps. On this journey to develop apps for iOS, I have been hopeful, discouraged, and then hopeful again. Finally, I have finally been able to successfully write an app and get it installed (and ready to submit to the app store) all using only my Windows 7 box and an amazing tool called PhoneGap Build.

Wednesday, January 6, 2010

jQuery Dialog Example: ASP.NET with UpdatePanel

A while back I posted about jQuery Dialogs (jQuery: Using a dialog on an ASP.Net UpdatePanel) and it looks like that is a popular topic so I have decided to create an example of how to use them on an ASP.NET web page that includes an UpdatePanel.

Download:UpdatePanel.zip




Friday, January 1, 2010

VMWare Server 2 and Sun VirtualBox do not play well together

I just spent quite a bit of time trying to figure out why my vm's running on VMWare Server 2 had no network access.  They would obtain an IP address from my network like they should, but I could not ping any machine on my network or on the Internet from those boxes and none of my boxes could ping the VM's.

After many hours of fiddling around and trying several different things, I remembered that I had installed Sun VirtualBox.  I noticed this because one of the network adapters was for the VirtualBox installation.

On a hunch, I uninstalled VirtualBox.  After a reboot, VMWare Server 2 was happy again.  I don't know the details, but since I did not find anything while searching Google,  I thought I should put it out there.

Monday, December 21, 2009

jQuery: Using a dialog on an ASP.Net UpdatePanel

I recently decided to start using UpdatePanel's in my code.  I know this is not the best way to write an AJAX enabled app, but it was the quickest path to making my product more responsive.  I also decided to integrate the use of jQuery in my app.  Along with that, I have decided to utilize the jQuery Dialog.

At first, it was a little difficult to get my head wrapped around how to best take advantage of this feature, but I eventually developed a process.  I have user controls that are placed on the page in UpdatePanels.  Sometimes those user controls need to pop up a dialog, so I will include the code for the dialog on the user control in a hidden DIV.

Now having a dialog in a DIV is not enough, you have to add javascript to create the dialog from your DIV, that's just how jQuery works, so I include code in an event handler that gets fired every time the UpdatePanel is updated (each user control uses the $(document).one("eventName", function() {}) syntax, but how that works is for another post).

Well I was noticing that I was having problems on the post backs when I had a dialog that was created from the user controls.  As it turns out, the problem was coming from the fact that each time the user control was refreshed, it was loading the jQuery Dialog into the DOM.  That meant that every post back puts a new copy of the dialog into the DOM causing problems with the values that post back to the server (not to mention a potentially bad memory leak).

I finally ended up with a solution that works great.  I have code that checks the DOM for the existence of the dialog prior to creating it and if it exists, I remove the first one.  Now this is not a problem for me, but if the dialog were to get updated in the post back, you would probably want to remove the last one and not the first one since the first one in the DOM is probably the one updated from the post back.

var dialogs = $("dailogSelector");
    if (dialogs.length == 2) {
        $(dialogs[0]).remove(); 
    }
}

This was something that after finding it seemed very obvious.  It was completely obvious once I fired up FireBug and saw that I had multiple copies of the dialog in memory.  However, prior to that, it seemed like there was some gremlin somewhere in the page life cycle stealing my post back values and it was very frustrating.  I only hope this post saves someone the frustration it caused me!

Saturday, December 12, 2009

SQLCMD Error: Login timeout expired

So I was automating the creation of a database and I was getting the following error:

Command
C:\sqlcmd -s "(local)SQLEXPRESS" -d TestDb -i MySql.sql

Error
HResult 0x2, Level 16, State 1
Named Pipes Provider: Could not open a connection to SQL Server [2].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

This was really confusing because all of the blogs that talked about this error were telling me to do things that I had already done.  I guess it is common to get this error, but the usual culprits were not at play with me.  I was stumped  I could not figure out why I had configured my DB Instance to accept remote connections and it was functioning properly, but I was still getting this error.

Well I finally found a post on this page that had the answer.  Let me say that it is all my fault, but I contend that if the SQLCMD program had better error messages, I would have figured out the problem quite quickly.  As it turns out, the -s parameter is to set the colseperator.  What I should have been using the -S parameter which is to set the server. 

C:\sqlcmd -S "(local)SQLEXPRESS" -d TestDb -i MySql.sql