Sunday, May 17, 2009
Sunday, May 17, 2009 7:35:37 PM (GMT Standard Time, UTC+00:00)
God blessed us with the ability to laugh, so it’s only right that I focus on that ability in a TFTW. Hope you enjoy..!
When Forest Gump died, he stood in front of St. Peter at the Pearly Gates. St. Peter said, "Welcome, Forest. We've heard a lot about you." He continued, "Unfortunately, it's getting pretty crowded up here and we find that we now have to give people an entrance examination before we let them in."
"Okay," said Forest. "I hope it's not too hard. I've already been through a test. My momma used to say, 'Life is like a final exam. It's hard.' "
"Yes, Forest, I know. But this test is only three questions. Here they are."
1) Which two days of the week begin with the letter 'T'?"
2) How many seconds are in a year?
3) What is God's first name?
"Well, sir," said Forest, "The first one is easy. Which two days of the week begin with the letter 'T'? Today and Tomorrow."
St. Peter looked surprised and said, "Well, that wasn't the answer I was looking for, but you have a point. I give you credit for that answer."
"The next question," said Forest, "How many seconds are in a year? Twelve."
"Twelve?" said St. Peter, surprised and confused.
"Yes, sir. January 2nd, February 2nd, March 2nd .."
St. Peter interrupted him. "I see what you mean. I'll have to give you credit for that one, too."
"And the last question," said Forest, "What is God's first name? It's Andy."
"Andy?" said St. Peter, in shock. "How did you come up with 'Andy'?"
"I learned it in church. We used to sing about it." Forest broke into song, "Andy walks with me, Andy talks with me, Andy tells me I am His own."
St. Peter opened the gate to heaven and said, "Run, Forest, Run!"
Have a great week!
tagged: Christian | funny | life | professional //
Saturday, April 11, 2009
Saturday, April 11, 2009 8:38:09 PM (GMT Standard Time, UTC+00:00)
I haven’t posted stuff related to Visual Basic Development in ages but no time better than the present eh? Here’s a great article – titled Custom Tab Control Layout - I found on customizing the layout of the Windows Forms TabControl so that the tabs are placed horizontally on the left (believe it or not, the TabControl does not allow this by default!).
tagged: international | professional //
Wednesday, March 25, 2009
Friday, September 21, 2007
Friday, September 21, 2007 5:13:36 PM (GMT Standard Time, UTC+00:00)
Needing to select a random row in MS SQL is definitely not your everyday task but then again, I'm not your everyday developer am I?
. Luckily finding this SQL query was a piece of cake. Check the code below:
SELECT TOP 1 <column> FROM <table> ORDER BY NEWID()
Interesting thing is, I've never heard of NEWID() before and MSDN's description for it doesn't fit in with its use above at all! Anyway, it works.. so hurray!
Special thanks to this site for providing the code and I also recommend it as it has examples for selecting a random row in MySQL and PostgreSQL.
tagged: professional //
Monday, July 23, 2007
Monday, July 23, 2007 3:45:52 AM (GMT Standard Time, UTC+00:00)
As a web application developer knowledge of regular expressions, or at least, what they can do for you, is a mUSt. These strange looking character sets can do anything from checking for a numeric value in a textbox to protecting against cross-site scripting (XSS) .
Here's an article a pal (thanks Ramal)directed me to lately that I think is well.. appropriately titled! : 5 Regular Expressions Every Web Programmer Should Know.
Truth-be-told though, I think (web) developers should seriously understand how to construct their own, as the need for unique expressions is almost inevitable. However, if you're in a rush and need one quickly (as is often the case with me), you can head over to this library, it's pretty extensive and the expressions are reasonably reliable.
tagged: professional //
Wednesday, July 11, 2007
Wednesday, July 11, 2007 7:01:36 PM (GMT Standard Time, UTC+00:00)
Off and on for the last 5 hours, I've been trying to find out exactly how DLLs are handled and can be deployed within Visual Studio 2005 (ASP .NET 2.0). My issue is this:
When I drag a third party component (control) I'm using, onto an aspx web page, it correctly, automatically, (a) adds a link (create a reference) to the file in the Global Assembly Cache (GAC) and (b) adds an assembly reference in the web.config file. What it doesn't do however, is copy the necessary DLL to the Bin folder of the project!
This "not copying to local" as I term it, becomes an obvious problem at the imminent deployment stage, well, that's unless you always have the same GAC on your development machine as on the production server! (Hardly ever the case!) So, for the morning I've been trying to decide how best to handle this situation.
Another option would've been to find the DLLs and manually copy them to the application's Bin directory.. The problem with this however would be that you most probably would get a "ambiguous reference" error as VS2005 wouldn't know whether to use the DLL from the GAC or from the Bin folder.
Ok, after all that background info, I'll stop boring you and move on to the solution I've found..
. Simply, let the stuff I said in Paragraph #2 happen.. but when coming to deployment, where you'll need the DLLs to be on the production server, you can do the following: In Visual Studio Project, select the Bin folder but instead of going to "Add Reference...", use "Add Existing Item". When the window opens, navigate to the needed DLLs, click 'Ok' and then sit back and let VS2005 adds them to the Bin folder.. Once this is done you're ready for deployment..
One of the best things I think about this solution is that the references in the web.config folder are maintained.. So if on the production server, the files are in the GAC, I expect it'll use them from there, or, if they're not, it'll use the ones in the Bin folder (not 100% sure about this last part though, just going on "tech sense").
Enjoy! 
tagged: professional //
Tuesday, July 10, 2007
Tuesday, July 10, 2007 10:25:42 PM (GMT Standard Time, UTC+00:00)
Captain's log, stardate 20070710, Eastern Caribbean Quadrant.. As I sit here building this web application for work, I am amazed at how "easy" MS has made things for us developers. I mean, dragging and dropping controls, nice pretty configuration screens and tools, directory security by access levels at the click of a couple rectangular buttons.. Does this happen in other languages? PHP? Coldfusion? I remember my stint with PHP and, yea.. it's super flexible and sure, it's free, but man.. I can't imagine developing the apps I do now in PHP.. especially not considering the time frame clients demand!
But of course, I know, there's a price for the beauty of (the l33t versions of) MS tools, and at times the price is as shocking as the tools themselves! But.. really, can one say that it is not worth it? Also noting the amount of tools (more coming in each new edition) and the support from places like ASP.NET Forums?
I'd like to see two development teams build the same web application, one a ASP.NET team and the other a PHP team... I wonder who'd do it faster and which one of them would produce the better quality (reliable, and such) product.
Please note though, I'm not bashing PHP, it's a very workable, free alternative and I totally love the dollars sign ($) to indicate variables .. lol .. I guess the drag and drop of MS tools have me. 
tagged: professional | techie //
Monday, June 18, 2007
Monday, June 18, 2007 1:33:51 AM (GMT Standard Time, UTC+00:00)
Recently while trying to get (databound) cascading drop down lists (a dropdownlist that is dependent on another) within a FormView to work, I came across the error "Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control."
Anyone who comes across this error whilst trying to get dependent drop down lists working, I advice you to check Demo for 2-way databinding cascading lists within a FormView. It's a great resource as the author first explains the error (and even directs you to MS's comments on it), and also gives a sweet approach (with code in VB and C#) to handling cascading drop down list.
Kudos to him/her! They saved me a good amount work!
tagged: professional //
Saturday, June 16, 2007
Monday, June 11, 2007
Monday, June 11, 2007 12:34:23 AM (GMT Standard Time, UTC+00:00)
Sometime ago I posted on formatting strings (specifically dates) in .NET but I've found some more information so I thought I'd add to that post.
To start, I'll talk about the values that can be used in the BoundColumn.DataFormatString Property. This is the property used when formatting within databound controls (with a GridView or FormView for e.g.). The possible values for numbers range from C (currency), D (decimal), E (scientific or exponential) and even X (for hexadecimal). Then for for dates, there's "dd/MM/yyyy" etc. It's all really pretty simple to implement using like {0:C}, {0:dd/MM/yyyy} etc. For more formats you can check Custom Numeric Format Strings Output Examples.
The core of this post though is to point out a gotcha that you MUST be wary of when doing this formatting. And no, the gotcha is not the HTMLEncode that you must set to false, I mean beyond that! lol.
Now lately, I was trying to format a number into telephone format ###-####. I had the following inline code for a label (that was within a FormView template):
Text='<%# Bind("Telephone", "{0:###-####}") %>'
Looks all nice and correct huh? It should! Because I took it straight from this msdn site. For some reason however, this code was NOT working!!! The reason? At first I was totally lost! However after checking asp.net forums site, I FINALLY found a solution!
In my database the telephone field is actually a varchar, so in my DataSet, the telephone field came over as a String type. That was the problem!! If the field is of type String, the formatting does NOT work! The field must be of a number type (e.g. Int32, Decimal etc). So.. you can either change the datatype in the database (to a number type) or, CAST it in the SQL Select Query when you are retrieving it from the database.
Enjoy!!
tagged: professional //
Thursday, June 07, 2007
Thursday, June 07, 2007 9:19:22 PM (GMT Standard Time, UTC+00:00)
Here's some interesting information I found online..
If you encounter an error (which becomes an exception in VS) returned to VS 2005 application from SQL Server and all you get is the error number, you can actually search SQL Server for the "deep description" behind the number itself. All you have to do is get the respective error number probably from the SqlException.Number Property and then check the sysmessages table in Master database.
Eg. Let's assume that in my ObjectDataSource1_Updated event, e.Exception contained a SqlException (it'll be at the InnerException level). You could get the sql error number (which we'll call @errorNumber) of that exception with SqlException.Number property. Next, you can run the following query SQL Server:
USE [master]
SELECT * FROM sysmessages WHERE error = @errorNumber;
Then.. you'll see the information on your error. Enjoy! 
tagged: professional //
Friday, April 27, 2007
Friday, April 27, 2007 7:46:50 PM (GMT Standard Time, UTC+00:00)
Maintaining values through postbacks, across pages etc. has always nicely been handled by asp2 and I for one am accustomed to the basic use of this functionality. Today however, I had the chance of expanding my knowledge and looking at maintaining values across Sessions.. using the Application object and the Global.asax file.
In my quest to find information on this file and methods such as Application_Start, Application_BeginRequest, Session_End and the like, my first source was MSDN. They have a nice write-up on the ASP.NET Application Life Cycle Overview and if you have half an hour or so, I recommend this read first. For me though, being the eager lad I am, I wanted to get immediately into it and this meant finding out (and getting in-your-face examples) about the Application object and Global.asax and it's methods.
For this information, I headed over to Working with the ASP.NET Global.asax file. This guy gives a brief description of the methods, when they're fired etc. and also gives some code examples in c# and vb. Good show!
tagged: professional //
Friday, April 13, 2007
Friday, April 13, 2007 8:52:10 PM (GMT Standard Time, UTC+00:00)
Sometimes coding can be SOO frustrating, but other times, it is SOO cool!! I think one of the main things that I thrive on when I have a problem (with coding) is that "this is coding, there MUST be a way to get this done! A different way to skin the 'proverbial' cat!" Then... after a while, I usually get it done!
This time the problem was with asp:LinkButton (embedded in a DataList control ItemTemplate). Essentially what I wanted to to was to pass a field (abc_id) from the current DataList item, into the code-behind when the user clicked the LinkButton. Ideally, I would have liked to do the following (in theory):
<asp:LinkButton ID="Button1" runat="server" Text="ABC" OnClick="b_Click('Eval("abc_id")',Nothing)"></asp:LinkButton>
Then.. in the code-behind have:
Protected Sub b_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'Do whatever... with the received "abc_id" which will be in the "sender" object
End Sub
The problem with this however is that you get the error, "'AddressOf' operand must be the name of a method (without parentheses)." i.e. you can't have the "('Eval("abc_id")',Nothing)" after the b_click or even just the "()"! Sooo, what to do now?
Well luckily on this site, the author lead me to a quite lovely solution to the problem that would enable you to pass field values nicely to the code-behind. The trick is to use the Command properties (e.g. OnCommand, CommandName, CommandArgument) of the LinkButton! So.. if I modify my original code above we'll now have:
<asp:LinkButton ID="Button1" runat="server" Text="ABC" OnCommand="b_Click" CommandArgument='<%#Eval("abc_id")%>'></asp:LinkButton>
And in the code-behind:
Protected Sub b_Click(ByVal sender As Object, ByVal Args As CommandEventArgs)
Dim abc_id as string = Args.CommandArgument
'Do whatever else... Oh and the "sender.id" and "Args.CommandName" can also be used.
End Sub
Nifty huh? I find this technique so useful in dealing with data controls (like DataList, FormViews and Repeaters) when they've been nested.
tagged: professional //
Friday, April 13, 2007 6:34:01 AM (GMT Standard Time, UTC+00:00)
It's 2.21am and I'm up working on some "good ole" asp.net and reading some pretty interesting articles on MSDN. Today I managed to learn some real good stuff mainly in the area of URL Re-writing in asp.net (without IIS configuration!! I might add!). That was some headache at times though, there are tons of people claiming to have "the right solution", but usually it just gives you PAIN attempting to make it work.
Fortunately for me, I found two solutions and I used one to tweek the other, and *presto*, it works! For some reason though, I don't think it's an ideal solution but, like I said - it works!
I'm tempted to blog on "my" solution now, but as I write my eyes are slowly closing and I'm making too many typos, so I'll leave that post to another time.
Right now, I'm going to head back to work, see if I get an issue resolved then it's off to sleep!
tagged: life | professional //
Tuesday, April 10, 2007
Tuesday, April 10, 2007 12:34:03 PM (GMT Standard Time, UTC+00:00)
While building a database lately, I was called to make the decision on a primary key field.. now the way I usually do database implementation is to use an Identity and let the auto-increment take care of it. This time though while playing around a bit before heading to that solution I came across the GUID field type (a type that is also used for primary key or.. unique key requirements). To give you a little background on it though, I've included the snippet below..
"An alternative to using an auto incrementing value is to use the NewGuid method of a Guid object to generate a GUID, or globally unique identifier... The NewGuid method generates a 16-byte binary value that is created using an algorithm that provides a high probability that no value will be duplicated. In a SQL Server database, a GUID is stored in a uniqueidentifier column..." (MSDN)
Now, let's look at this excerpt properly:
1. "generates a 16-byte binary value" .. this usually is in the format of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. Yea.. pretty long eh? That will mean some overhead will be involved in the lookups. Not exactly a feature you would like in searching, sorting, joining, etc. Also.. remember, computers work better with numbers, this GUID seems just like a long string.
2. "an algorithm that provides a high probability that no value will be duplicated" .. a.. high probability.. well, that's good .. but with Identity (auto-increment), there will be no duplications period.
Those are what I consider the top two reasons to probably stick with an Identity ( i.e. autoincrement value).
One of my key sources for insight into this topic was here. Even though there's no Author name (hence some might say it is not that 'credible'), at least he/she put links for where they sourced their information from.
tagged: professional //
Friday, March 30, 2007
Friday, March 30, 2007 2:09:14 PM (GMT Standard Time, UTC+00:00)
While perusing the ASP .NET site a day or two ago, I came across the "CSS properties window" addin (to VS 2005), in the Sandbox projects section. After reading the description I thought it looked fairly OK so I downloaded it and after giving it a whirl, I'd give it a (y)!
Essentially it's just a addin that enables you to edit CSS in-line styles and style sheets much more easily than in native VS 2005. Two of the features I particularly like are:
1. It allows you to edit styles of multiple elements
2. It gives a nifty window to work with that can be manipulated just like the Solution Explorer, Server Explorer or Properties windows.
The only thing I don't like about it, .. which is something I don't like about VS 2005 in general, is that I think MS should use Hex for colours instead of using colour names, (as you can see an example in the pic above/to the right).
To view more about CSS properties window and grab the download file, check out the official site.
One gotcha though is that: "The CSS Properties Window doesn't work with Visual Web Developer (I believe this is the free version). You may use it with Visual Studio 2005 Standard edition and above."
tagged: professional //
Thursday, March 22, 2007
Thursday, March 22, 2007 12:10:29 AM (GMT Standard Time, UTC+00:00)
Ok folks, I'm here to deliver on my promise and.. finally, release the first version of the 'My Mashup' Project (you can see a screen shot there on your left). I thought that now would be a good time since ASP AJAX has been 'out' for almost a full two months and thus, any release problems would have already been addressed (in forums, blog posts, etc.).
One 'gotcha' about this release though is that you need a username/password to peruse it. I originally intended it for "public viewing" but have decided for now to limit it to persons I know or who request login details. For those of you who wish to view My Mashup just drop me an email or IM me and I'll be glad to set you up.
Truth be told, I am rather excited about this!! I remember, one of my main goals with this project was to make postbacks (or more simply, page refreshes) a thing of the past and.. I've successfully done that but still have been able to produce what I think is, a very interactive and useful web site/app.
I'd be glad to hear what ALL you people think especially the techies amongst you. Two things to note though:
1. Before you view the site, check the Release Notes (there's a link at the bottom).
2. The Project seems to like "a bit" of your bandwidth.. I'm not sure but ADSL is required suggested. For those of you who check the site, please let me know reaction times etc. Thanks. 
tagged: professional | techie //
Friday, March 16, 2007
Friday, March 16, 2007 5:07:01 PM (GMT Standard Time, UTC+00:00)
Lately I was having some problems trying to customise a GridView control to use a dropdownlist. After playing around with the TemplateField for a bit and then consulting my pal Ramal, I finally deduced how to include a dropdownlist and two-way bind it nicely. Admittedly however, this took too much time.
I'm now posting to refer you to a site that gives a good example of how to use the TemplateField in the GridView in the event that you are in the painful situation I was in a couple weeks ago.
So, here's the link to the article - Using TemplateFields in the GridView Control (in VB and in C#)
tagged: professional //
Friday, March 16, 2007 2:46:09 PM (GMT Standard Time, UTC+00:00)
Well there are two ways I know of these (select) parameter values can be set but I've come across a third this morning, so I thought I'd share (all).
1. You can setup a ControlParameter and link it to a control at design time. Like shown below where we have a link to the PlayerID field of the dropdownlist.:
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="PlayerID" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
2. In situations where the value that the DataSource is linked to does not relate to a control on the form but rather to some code e.g. the the current month (accessible programmatically via Now.Year)... You can do two things:
(a) Don't add the select parameter to the asp page but instead create it at runtime probably in the page load event.. below I use the Add method to add the parameter and set its value i.e. Now.Year.ToString.
If Not Page.IsPostBack Then
ObjectDataSource1.SelectParameters.Add("myparam", TypeCode.String, Now.Year.ToString)
Else
'Do nothing or you will be adding to the parameter already present
End If
One note about this however is that you'll have check for postbacks (as I've done above).. if there is a postback you'll have to skip re-adding the parameter. Yea... I know this method isn't good at all.. but in some situations where the parameter doesn't need to be frequently updated, it can be an option.
(b) If the parameter value isn't that important and security of it isn't a priority, you can go the lond-winded route.. i.e. Create a "holder control" e.g. a label or textbox on the asp page, then in the Form Load event, set the parameter value to the Label.Text property... THEN, use option (1) and create a ControlParameter and bind that parameter to the created Label so you get something like below:
<SelectParameters>
<asp:ControlParameter ControlID="Label1" Name="myparam" PropertyName="Text"
Type="String" />
</SelectParameters>
This should work .. but also remember to set the Label.Visible property to "false".
3. Now to the one I found this morning on the asp.net 2 site. This one is rather simple and I tried it a second ago and it works well. This scenario is where you need to set a parameter value in code like in (2) above. The approach? Simply... use the DataSource_Selecting event... like below:
Protected Sub ObjectDataSource1_Selecting _
(sender As Object, e As ObjectDataSourceSelectingEventArgs) _
Handles ObjectDataSource1.Selecting
e.InputParameters("myparam") = Now.Year.ToString
End Sub
And.. that's it! When the DataSource goes to fill itself with data, it comes to this event and picks up the input parameter.
K ta!
tagged: professional //
Thursday, March 15, 2007
Thursday, March 15, 2007 3:41:00 PM (GMT Standard Time, UTC+00:00)
ASP.NET 2, Web.config, security, aspnetdb.mdf related..
MembershipPasswordFormat Enumeration describes the encryption format for storing passwords for membership users. By default though, pass is hashed using SHA1. See the documentation for it at the official MS site.
tagged: professional //
Saturday, March 10, 2007
Saturday, March 10, 2007 8:02:15 PM (GMT Standard Time, UTC+00:00)
As I sit here working on My Mashup, something that I remember learning during my recent studies popped into my head, .. it went something like this.. "when doing websites one must remember that usability is important.. one should not bundle functionality on JavaScript (as it may not be enabled on the browser), and colours and images should not be paramount (as there are some users who may have text only browsers etc etc)".. (this also links in with disability legislation.)
One question... with "bad boy" AJAX on the scene.. what happens with all this usability talk? ...
Looks like everyone better keep JavaScript enabled, usability take backseat (.. at least here).
tagged: professional //
Wednesday, March 07, 2007
Wednesday, March 07, 2007 8:07:08 PM (GMT Standard Time, UTC+00:00)
Further to this post, and assuming that you're using special tools like me to have formatting even in Textboxes that hold currency amounts (this is in the Insert and Edit item templates).. one may also have to make changes to FormView1_ItemUpdating and FormView1_ItemInserting events. This will be just like mentioned in the previous post i.e. that you will check for the "$" sign and remove it if it is present to avoid the "Input string was not in a correct format." exception.
PS. Roy Makaay just scored the Fastest Goal In Champions League History against Real. I think they clocked it at 11 seconds. Wow!
tagged: professional //
Tuesday, March 06, 2007
Tuesday, March 06, 2007 1:17:23 AM (GMT Standard Time, UTC+00:00)
Quick post on an error I was getting for the last hour that has made my night somewhat of a rush! This is related to ASP.NET 2, VS'05, FormView, ObjectDataSource, applying Data formats to fields.
I was trying to delete a record using a FormView and I kept getting the following error, "Input string was not in a correct format."
As I reviewed the stack trace I saw the following:
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +2752771
System.Number.ParseDecimal(String value, NumberStyles options, NumberFormatInfo numfmt) +119
System.Decimal.Parse(String s, NumberStyles style, IFormatProvider provider) +37
System.Convert.ToDecimal(String value, IFormatProvider provider) +50
So naturally, I figured it must be a conversion problem (from String to Number). Possibly a string that I have in the form being converted to a number (int or decimal) before being passed to the database. Since I only had one int/decimal I was dealing with in this form, it was easy to find.. - it was a currency field.
Now I had formatted this currency field using "<%# Bind("price", "{0:C}") %>", or more specifically {0:C} for currency (it renders the amount with a "$" sign prefixed). As I investigated some more, I recognised that the problem here was that the entire "$<number>" was being passed to the procedure.. therefore when the attempt was made to convert it to a number to send it to the DB, it failed as "$" can't be converted.
To avoid this problem, you can do two things, forget about the {0:C} formatting... which is really not an option (as it is always nice to show the currency sign), Or in the FormView1_ItemDeleting event, simply remove the "$" from the parameter. (Remember this event is called before the parameters are passed.)
I honestly believe there should be some other way to do this though, so I'll look into it a bit. This thing really should not be an issue.
tagged: professional //
Friday, March 02, 2007
Friday, March 02, 2007 10:55:27 PM (GMT Standard Time, UTC+00:00)
It's been an issue with me for a wHILE - when I'm looking to do formatting of dates in vb.NET, I always get lost and waste time! Well I've found a site that's GREAT for information.
The site from Macon State College - here it is.
To be honest, that site has functionality in its raw form as relies on the Microsoft.VisualBasic namespace (DLL), a now outdated namespace. So, even though I support that site I think you should more use the following formats when dealing with dates...
Assume you wanted to format #12/30/07# from that dirty US date format... (Also assume "aDate = #12/30/2007#"), you'd do the following:
aDate.ToString("dd-MMM-yyyy") 'which would give 30-Dec-2007 as a nice string.
And what if you wanted to format times?
Now.ToString("dd-MMM-yyyy hh:mm
s tt") 'gives 02-Mar-2007 06:45:15 PM
There you'd recognise that the "tt" gives AM or PM, which ever is relevant. Rather cool instead of using any 24 hour format!
Anyway, enough on that for now but definitely check that site, I'm using this blog post as a Bookmark to it also! 
tagged: professional //
Wednesday, February 14, 2007
Wednesday, February 14, 2007 9:57:59 PM (GMT Standard Time, UTC+00:00)
A while ago I blogged about the tool used to deploy web sites in VS 2005 i.e. VS 2005 Web Deployment Projects. Well now I'm back on that trail as I've found a little hole that people keep slipping into, which I myself was a victim of.
Now, the problem came about as I was trying to build a deployment web project and I was prompted with the following message in the Output mini-tab.
Target AspNetMerge:
Running aspnet_merge.exe ...
C:\...\WebDeployment\v8.0\aspnet_merge.exe "J:\...\Visual Studio 2005\Projects\test\test_deploy\Release" -prefix ss -copyattrs
C:\...\Microsoft\WebDeployment\v8.0\Microsoft.WebDeployment.targets(574,9): error MSB6006: "aspnet_merge.exe" exited with code 1.
Done building target "AspNetMerge" in project "test_deploy.wdproj" -- FAILED.
Done building project "test_deploy.wdproj" -- FAILED.
Build FAILED. (<-in a nutshell)
After checking the net for a while I found many forums and blogs with this error documented... The most common reported cause of this problem was the presence of duplicate classes within the project.
One solution suggested by a dude in ASP.NET forums was to "pick the option "Create a separate assembly for each page and control output" in the Web Deployment project property under Output Assemblies." (Ref). ... This works well however I just didn't like having each file/page with its own .DLL, seems a bit much for me (even though updating pages would be quite easier).
Another solution which really is the only RIGHT solution .. "hey, if there are duplicate class names, why not just rename the classes!". This is really a no-brainer.. however, what if VS doesn't tell you which classes are duplicated? This is what happened to me! Even though I followed this guy's advice and switched MSBuild output verbosity to Diagnostic.
I then tried using Diagnostic, Normal, but nothing would tell me what class names were duplicated! So I had to go through one by one to find the duplicate.
Lesson of the story? DO NOT COPY Pages or Classes without renaming them IMMEDIATELY! (This is what lead to my duplicate classes - copying pages for reuse.)
tagged: professional //
Saturday, February 10, 2007
Saturday, February 10, 2007 12:21:48 AM (GMT Standard Time, UTC+00:00)
It's been a while since I've posted anything related to my "professional" life... but alas I'm back, and sad to say, on a sour note!
This time I'm commenting on the "Control.FindControl Method (String)". This method just works.. soo.. unreliably! At first, I thought I was making some mistake in understanding its purpose but it clearly states on MSDN "Searches the current naming container for a server control with the specified id parameter.", so I'm left to wonder if it is a waste. I mean, I remember it working before.. but it refuses to work now!
My problem has come in my trying to find a control within a ContentTemplate (Read a bit more on that here) which I can clearly find if I loop through the collection of contained controls in the Controls property (of the template). When I try to use the FindControl method, the return value is a persistent "Nothing". I also have checked online for this problem and a number of other sites, especially forums have had persons complaining about it. One I quite like is this one, where the guy asking for help is absurdly sarcastic when he doesn't get his questions answered. Ways.. I've decided that if I'm looking for a control in a container the most reliable path is to do the following.
'Creating reference to desired control
Dim dControl As UI.WebControls.Xml = Nothing
'Looping through container to find desired control
For Each ctrl As Web.UI.Control In tempContainer.Controls
'If control has been found.. btw control is identified by its ID, in this case, "Xml1"
If ctrl.ID = "Xml1" Then
'Save control since it has been found. Of course Ctype it first..
dControl = CType(ctrl, UI.WebControls.Xml)
Exit For
End If
Next
(i.e. loop through the controls manually... after all, this is what's being done by the FindControl method anyway! In my case, it's only about 3 or so more LOC.)
tagged: professional //
Thursday, January 25, 2007
Thursday, January 25, 2007 2:42:36 AM (GMT Standard Time, UTC+00:00)
I've been asking for it for a while now and FINALLY ASP.NET AJAX 1.0 RTM has been Released! (Released yesterday I believe.)
However... wait, wait, before you go downloading and installing like crazy.. I suggest you do like I did and take a quick peek at the Ajax forums. Sad to say.. there seems to be some problems already.
I just was reading a post titled "Do not install this release" (encouraging name huh?) and in it the writer is complaining about some problems he has encountered while trying to migrate from the RC to the final release. As it turns out, the RTM actually seems to require an aspect that is not really available yet but instead will be disseminated in a WindowsUpdate... (Hopefully, it'll be in February's update cycle.)
Anyway, I'm no expert with respect to that, I'm merely following what was said and trying to comment a bit on it. For the full story however, I recommend you have a look at that post I mentioned above and also keep your eyes fixed on that forum for any more information/problems on this final release of AJAX.
PS. I'm seeing A LOT of posts since the final was released.. seems like a lot of apps/stuff that worked in the old versions is now broken when tried in the final. Hmm.. how... scary.
tagged: professional //
Saturday, January 13, 2007
Saturday, January 13, 2007 12:04:26 AM (GMT Standard Time, UTC+00:00)
It's Friday night and I'm... busy... I'm listening to some Three Doors Down and in the middle of developing the "My Mashup" project. This mashup thing is pretty cool, the entire concept is honestly just beautiful. I can't wait until I get to show you guys and gals!
Sadly though, because I'm so MS-oriented, my work on this project is being held back because MS hasn't released the final version of ASP.NET AJAX yet. And I refuse to go do something greaT then a version with major changes to the one I have is released. So just hold on a bit folks. I will try my hardest to make it worth your while.
Still on the "Projects" topic, I have made what I consider significant headway in the (WinForm-based) IRC client I have been working on. Right now, it handles colors, multiple windows, multiple channels, the usual mIRC commands and some other stuff. Now to some of you this may seem trivial as mIRC handles all this stuff already. However, to me, it's rather novel because it's something I worked on from "almost" ground - up. From the creation of the connection to the handling and formatting of raw IRC commands from and to the server.
Considering what I've done with that IRC client and the fact that I think it has potential, I've toyed with making it "open source". This I think may help development of it (there's tons of stuff that needs to be added - yes I have a lengthy To Do list) and make it even better. Also, I've done a considerable amount of searching online and there are really no "open source" VB.NET clients readily available. So... I may be onto something. We'll see though, we'll see. For now though I'll hang on to the c0d3 for safe keeping. 
Oki, well I'm going to press on with My Mashup,.. I would like to find 2 or 3 more APIs to throw into the mix! The more... "Mashed up" the better. :-) .. *jason cranks up the Kaiser Chiefs*
tagged: professional | techie //
Thursday, January 04, 2007
Thursday, January 04, 2007 2:27:42 AM (GMT Standard Time, UTC+00:00)
I'm finally finished the Windows app I was working on so it's back to Web-related stuff for me once again. I think I will be heading back to AJAX, especially now that I've 'sourced' (*heh) a JavaScript book AND the ASP.NET AJAX RC 1.0 is out. To make the mix even better, I've found a couple nice APIs and 'free' Services.
So for now Windows and your System.Windows.Forms namespace, I wish you bye bye! Helllooooo xHTML!
tagged: professional //
Saturday, December 30, 2006
Saturday, December 30, 2006 2:09:27 PM (GMT Standard Time, UTC+00:00)
Well it's not the final version (which I'm not happy with) BUT it's a step in the right direction!
I haven't tried out this RC yet, but I'll get to it in a bit, just as soon as I get this Windows app I'm working on now off the To Do List. Also, if you are looking to get it, remember to Read the Documentation! Especially if you're like me and have Beta versions installed.
tagged: professional //
Wednesday, December 20, 2006
Wednesday, December 20, 2006 5:05:39 PM (GMT Standard Time, UTC+00:00)
From ASP.NET 2 to AJAX to Data Driven Web apps now to Windows Programming.
Well, for the last couple days I've been doing some serious Windows Programming and as a result, I've been working on that limited VB 6 IRC client I mentioned in this post. Progress is actually coming pretty good with that and believe it or not, I got it converted to work on .NET Framework 2.0 (under VS 2005)! My task now (a HUGE task indeed) is to make it really useable, because right now it's lightyears away from mIRC quality in every aspect.
On the bright side though, it gives me something to work on in my spare time, instead of watching TV!, and increases my knowledge and experience with VS 2005 from a Windows Programming perspective.
tagged: professional //
Friday, December 15, 2006
Friday, December 15, 2006 6:48:56 PM (GMT Standard Time, UTC+00:00)
Just a couple minutes ago, I was watching a Microsoft webcast and I noticed that the person doing the cast had their intellisense working in the web.config file! Now, mine doesn't work so this had me a bit lost! So after playing around for a couple secs, I did a search and found that this is a common problem. The good thing though is that it has a 'fix'!
If you're using VS 2005 and the intellisense isn't working in your web.config, here's a link to Scott Guthrie's blog post that gives the reason for it not working and also the fix.
In a nutshell though, all you have to do is go into the web.config file and in the "configuration" tag, remove the 'xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"' property text. Now.. do a quick save, and you'll notice your intellisense is working once again! Cheers Scott!
Enjoy!
tagged: professional //
Wednesday, December 13, 2006
Wednesday, December 13, 2006 6:49:41 PM (GMT Standard Time, UTC+00:00)
Well it looks like MS is taking the CSS move really seriously (as they 'should'). Just today I saw an article talking about a new kit called ASP.NET 2.0 CSS Friendly Control Adapters 1.0 which is designed to change the rendered content of ASP.NET controls to a more CSS friendly formatting.
To me, I have no rush to do this because once the content renders how I want it I couldn't be bothered how the xHTML is formatted. .. Of course this would be a different case if the xHTML was to be validated or pass on the desk of a CSS man - ouu.. that would be trouble!
Ways, if any of you ASP.NET 2.0 Developers are interested in this, check out the official site.
WHAT I AM MORE INTERESTED IN though... is the final version of ASP.NET AJAX !... Come on MS... you said in December! (*Jason checks the ASP.NET AJAX site and... can't find the text which promised the December release anymore!
... January then... maybe?)
tagged: professional //
Monday, December 11, 2006
Monday, December 11, 2006 4:23:01 PM (GMT Standard Time, UTC+00:00)
There's one final property setting that needs to be made in order for the ObjectDataSource to correctly pass the original values to the dataset methods (eg. Update, Delete) The ObjectDataSource has a ConflictDetection property that can be assigned to one of two values:
* OverwriteChanges - the default value; does not send the original values to the dataset methods' original input parameters
* CompareAllValues - does send the original values to the dataset's methods; choose this option when using optimistic concurrency
Take a moment to set the ConflictDetection property to CompareAllValues.
(The above is a partial excerpt from The Official Microsoft ASP.NET 2.0 Site)
..- If you don't do this you will get this exception: "System.ArgumentNullException: Value cannot be null.
Parameter name: Original_(whatever the field name)" when trying to get optimistic concurrency working.
tagged: professional //
Friday, December 08, 2006
Friday, December 08, 2006 3:25:22 AM (GMT Standard Time, UTC+00:00)
So today I embarked on what will be a 'pause' to my usual AJAX-only work. My focus now switches more to dealing with data in ASP.NET 2. And no sooner than I started to work with those 'no-coding-necessary' data controls, I ran into Pure trouble. *Surprise surprise*
This trouble mainly is associated with how concurrency issues are handled by the data controls "as is". To me, they do an 'ok' job but the core problem is that they are not flexible at all. Before I start to bash these controls any more though, I think more research is necessary, so I'll stop here for now.
/me resumes googling like crazy.
Just incase you're interested but lost at what I mean by concurrency issues, you can do a bit of background reading.
tagged: professional //
Wednesday, December 06, 2006
Wednesday, December 06, 2006 4:46:34 AM (GMT Standard Time, UTC+00:00)
Well, as I haven't slept yet, I still technically consider today as Tuesday.
Ways... this post is just to mention that today I've looked at a wiiiddee range of programming/scripting/query (languages)! No "big deal" really, but this isn't normal for me at all.
I've looked at: VB.NET, JavaScript, AJAX, ASP.NET, C++, Java, SQL and Excel spreadsheet programming. (I admit there is some overlap in that listing.)
Wow. I'm so versi-wild... or is that versatile? *tehe (bajan joke if you listen to the radio.)
tagged: professional //
Wednesday, November 29, 2006
Wednesday, November 29, 2006 8:42:54 PM (GMT Standard Time, UTC+00:00)
Well sometime back I blogged about some good code converters that did c# to vb.net and visa versa.. This post is to update that post and to .. well.. delete one of them off the list. The one I'm referring to is www.kamalpatel.net/ConvertCSharp2VB.aspx.
A strange thing about this though (ie why it warrants this post) is that a little while before this happened, I found a little... asp.net security 'no no' in the site and I wrote the dude an email informing him about it. Then a couple days after, the site was down. Strange huh?
Anyway, the other ones are still up and running and of course they promise that they don't store your code.... *cough*.
tagged: professional //
Saturday, November 25, 2006
Saturday, November 25, 2006 12:00:56 AM (GMT Standard Time, UTC+00:00)
Prerequisite: When reading XML I usually use the XML.XMLDocument class and its SelectNodes() or ChildNodes() methods.
So today whilst using this method to read some XML which was output from a RPC I made, I again used the SelectedNodes method. Sad to say, this time it didn't work. When I tried "SelectedNodes("//result")" (which should return all the 'result' nodes), no nodes were returned even though they were there!
Upon investigation of this problem though (about 2hrs worth of searching I might add
), I found out that it was because the XML doc that was returned from the RPC had a default namespace included (this doesn't always happen, but mostly occurs from online XML output) i.e. the root node read "<bookstore xmlns="urn:newbooks-schema">".
Now, once a document has this included, one must use the overloaded SelectedNodes() function, which also takes an XMLNamespaceManager object. As MSDN Library states, "If your XML includes a default namespace, you must still add a prefix and namespace URI to the XmlNamespaceManager; otherwise, you does not get any nodes selected." <- i.e., what was happening to me!
So, now the 'fix'... assuming the XML document is a local file with the namespace suggested below.
Dim doc As XmlDocument = New XmlDocument()
doc.Load("newbooks.xml")
' Create an XmlNamespaceManager to resolve the default namespace.
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable) nsmgr.AddNamespace("bk", "urn:newbooks-schema")
' Select all book titles.
Dim nodeList As XmlNodeList
Dim root As XmlElement = doc.DocumentElement
nodeList = root.SelectNodes("/bk:bookstore/bk:book/bk:title", nsmgr)
(This is an excerpt from the MSDN Library help. The full version, including the XML document can be found here.)
tagged: professional //
Thursday, November 23, 2006
Thursday, November 23, 2006 8:58:29 PM (GMT Standard Time, UTC+00:00)
Looking for a good VB Reference? This MSDN site provides pretty good reference information for various aspects of the Visual Basic language.
Some good operator keywords to remember are: IsFalse, IsNot, IsTrue, OrElse, Xor, TypeOf, AndAlso and Like
tagged: professional //
Thursday, November 23, 2006 2:07:43 PM (GMT Standard Time, UTC+00:00)
-To get the content of a textbox use:
document.getElementById("MyTextBox").value OR with asp.net ajax use $get("MyTextBox").value
-To set the default button for a web page use:
The defaultbutton property of the form tag. IE. Set the defaultbutton property's value to the id/name of the textbox. eg. <form ... defaultbutton="MyButton">
tagged: professional //
Wednesday, November 15, 2006
Wednesday, November 15, 2006 8:57:29 PM (GMT Standard Time, UTC+00:00)
Lately I was explaining (the little I know about) PHP to someone and I was commenting on how it focuses on embedding code blocks into HTML which are processed server-side and then the .PHP page is sent to the user. For a comparison I mentioned how PHP and ASPX (ASP.NET pages) differs, in that ASPX uses a code behind file or some script code at the top of the page but there's not really any code embedded into the HTML. But it just clicked that this is wrong!
Something clicked today and I browsed to an MSDN site and clarified that code can be embedded into the ASPX page HTML content, similar to PHP and what was done in the ASP days. This site gives a good idea, but one can easily use the "<% %>" to indicate code. So it's like having the benefits of placing code either place ie. embedded (and thus easily viewable relative to your HTML) or neatly tucked away in the code behind file (where I believe 80% of developers put it).
Interestingly, a comment at MSDN stated "Embedded code blocks are supported in ASP.NET Web pages primarily to preserve backward compatibility with older ASP technology." (Ref) Now... to me this is a bit sad as I'd think that keeping it was a good thing because it gives developers the choice and possibly, since this is similar to PHP, you could probably lure some of the PHP following (as I assume is the reason for all these Express tools).
Anyway..., either way, I'm happy its there!
tagged: professional //
Monday, November 13, 2006
Monday, November 13, 2006 10:17:33 PM (GMT Standard Time, UTC+00:00)
I remember a rule I had which went something like this, "never work with or download for 'serious' use, anything with the label "BETA" on it" (granted this usually applied to IM prog updates, new OSs etc). But would I listen to my rule? Normally... yes! ... but with all the buzz about ASP.NET AJAX, formerly code named "Atlas", this time I made an exception and rushed to the site to get the ASP.NET AJAX 1.0 Beta 2 Release (released 9 days ago ie Nov 4th 2006 - yea, I'm right on the ball).
So I went and got the necessary installs, dlls etc. and honestly, from what I see here things look .. promising. The main problem I've had thus far though and this I also admit is totally understandable, is that finding nice examples on how things are done IN THIS CURRENT BETA release can be a pain (especially when some developers who really have good intentions post code but forget to document which release their code is geared for).
What makes this problem more frustrating is that from what I see (and because I'm new to Beta releases this I guess may be a n00b exaggeration), the differences in the Beta versions is well not small eg. there are changes in tag name prefixes, how they are formatted, where elements and tags go etc.
I'm saying all this to remind myself (and whoever's reading) to keep my (your) distance or.. be cautious with that word 'Beta'. Experiment? yea sure, look at the features? yea sure, think about development? errr... take a rain check. In addition, keep in mind that some of the features in earlier Beta versions may not even be in the final product release (this relates to all Beta's but I'm mostly speaking about ASP.NET AJAX).
So now I'm at the stage of tinkering and hoping that some good/useful code/examples/documentation to suit this Beta 2 release will soon emerge. A good thing though is that "the fully supported version of ASP.NET AJAX that is scheduled for release near year-end" (Ref)... So, let's hope that means late November. 
(Btw, don't ask me about the topic, I got a bit happy, :\)
tagged: professional //
Wednesday, November 08, 2006
Wednesday, November 08, 2006 7:26:11 PM (GMT Standard Time, UTC+00:00)
Sometimes, I really, reallllllly like Open Source... They really hit the nail on its head at times. Two great examples being development of PostgreSQL (an alternative dbms to MySQL) and who can forget, The Red, Fiery Fox.
Interesting, almost all the "IT savvy" folks I know use FF. Also, I remember during my last stint at uni, using FF was the norm (that's right not IE - that was IE 6 though).
Ah Open Source..., I wonder what shall become of you.
tagged: professional | software //
Tuesday, November 07, 2006
Tuesday, November 07, 2006 4:00:03 PM (GMT Standard Time, UTC+00:00)
In asp2 the Page.IsPostBack() property comes in rather handy at times but the key to its use is having a clear understanding of the property and when exactly it returns true or false.
To help me determine this, I checked the MSDN library and found the following Summary for the property: "Gets a value indicating whether the page is being loaded in response to a client postback (in which case it returns TRUE), or if it is being loaded and accessed for the first time (in which case it returns FALSE)."
Sad to say, this summary is actually a tad misleading. When it comments "or if it is being loaded and accessed for the first time", this to me gives the impression that ONLY the FIRST TIME that page is loaded/accessed (by that user), the property will return FALSE. This however, is not the case.
The actual times when the Page.IsPostBack() property returns FALSE are: a) when the page is being accessed (by that user) for the first time AND also b) if the page even though accessed already is being accessed again from another page (ie you went to Page 1 already but currently have browsed to Page 2... Now, whilst on Page 2 you click a link that takes you back to Page 1. Here, the Page.IsPostBack() property in Page 1 will return FALSE).
Hopefully this should clear things up a bit, it sure did for me.
tagged: professional //
Friday, November 03, 2006
Friday, November 03, 2006 12:28:35 AM (GMT Standard Time, UTC+00:00)
When working with asp2, CSS is a must. Actually, when working with any web site project, CSS is a must. This I understand and am totally cool with.... UNTIL it gets to testing CSS in multiple browsers.
Time and Time again, I create a nice layout in IE (the default browser for VS'05) and try to run it in FF and there are problems. My latest problem is with the "em" which is used for text sizing (I believe it acts like a percentage... ie font-size: 1.2em is 120 percent of the normal text size).
Basically, what was happening was that some text in IE was showing bigger than text in FF. Why? I don't have a clue. I did some rough checking in the CSS files, however didn't find anything that strikes me as wrong. Before I go any further though, I must admit, I'm not a CSS guru therefore somewhere in my ".css" may be some ".foolishness", I accept that...
Now... On to the remedy or, "tip".. If you've been getting this problem or one similar to it, I suggest you LEARN CSS PROPERLY
... In the event that you're like me though and couldn't be bothered for now, just set your font-size to absolute values ie font-size: 12px and it should work fine (hopefully).
tagged: professional //
Thursday, November 02, 2006
Thursday, November 02, 2006 4:36:58 AM (GMT Standard Time, UTC+00:00)
It's after midnight and I'm still awake pushing hard at my ASP.NET 2 (asp2 hereafter). Thus far it's been an interesting ride, and out of all these "cool" features that asp2 Webcast presenters boast of, I think the coolest (and easiest) thing I've seen is the entire 'securing the web site' functionality.
That's right, not Themes (CSS applied to .NET controls), or Master pages (a theory that was around for ages but now streamlined in VS'05) or even the new, very highly regarded GridView control (even though this is pretty cool!). The 'securing the web site' tools have taken the cake!
The way VS'05 + asp2 handles the basic security for a web site using the ASP.NET Web site Management tool (which integrates nicely with the behind-the-scenes ASPNETDB), Roles, Membership, Login controls, etc, is pretty useful once you get it understood. I've also tried to do some basic 'security checks' on some small test sites I created and the level of security seems to be pretty OK as well.
Now with asp2 going full steam ahead, I assume it'll soon be 'complete' (to an extent) and next up will be AJAX (I really hope that's fun...). That's one thing about the MS-route though, there's never a dull moment. .NET Framework 3.0 anyone?? 
tagged: professional //
Friday, October 27, 2006
Friday, October 27, 2006 10:18:56 PM (GMT Standard Time, UTC+00:00)
Wow, this took a little while and one or two headaches but my first update to the web site is now complete! What's the update you ask?
Well, if you ever browsed to this blog via www.jasonnurse.com, you would have recognised the quote under my name... That's it!!!! ... Ok, you look puzzled so I'll explain.
Before, there was only one quote on that web page and no matter when you went to that page, you'd get that quote (kinda what us web savvy people call a static HTML page). Now, as opposed to that static system, what's happening is that a quote is being randomly selected from a set of quotes (which are stored in an XML file) and then, its being spit out onto the screen (with the XML content styling handled by XSL). Cool huh! 
tagged: life | professional //
Thursday, October 26, 2006
Thursday, October 26, 2006 9:49:05 PM (GMT Standard Time, UTC+00:00)
No doubt some of you are like me and dislike situations where you find a great code snippet online then to recognise its not in your chosen language ie VB or C# -
. Well, I had found a site before that helped me a lot in this area.. more specifically in moving from C# to VB, and today I found another two sites that allow conversions -
. So being the nice gentleman I am, I thought I'd post'em all for your benefit and just in the event I forget the links myself!
Here are both sites: site 1 (allows C# -> VB and also has an offline converter, I'm yet to try the offline one), site 2 (allows conversion both ways) and site 3 (allows for both ways AND does it REAL TIME ie when you type, it converts, no buttons to click).
So far these have worked pretty well for me but each one may have its own little "known issues" (documented or not), therefore one should read the sites carefully before copy/pasting code into the textboxes. Especially if you have secret, classified, level 500 clearance code (yea... right). EnjOy!
tagged: professional //
Thursday, October 26, 2006 3:08:15 PM (GMT Standard Time, UTC+00:00)
"The date and time functions (dateTime) are part of XPath 2. Thus, they are not supported in any browser yet." Ref
Hmm... "Why You Won't See XSLT 2.0 or XPath 2.0 in the Next Version of the .NET Framework" ('2004 article - Ref)..
Explains a lot.
tagged: professional //
Wednesday, October 25, 2006
Wednesday, October 25, 2006 9:08:22 PM (GMT Standard Time, UTC+00:00)
This post is to do with how VS'05/ASP.NET handles the DataSet and connection strings.
Today, I got the following error:
Error 39 Unable to convert input xml file content to a DataSet. Requested value 'ConnectionStrings' was not found.
The reason for this error was that I had named my ConnectionString JN.ConnectionString. Now looking at it, this seems a pretty normal name, however a problem arises because of the "." within that string's name. Apparently in the Connection element of the DataSet1.xsd (ie the DataSet file), mistakes the "." to mean something it shouldn't and thus generates the error I mentioned above. (More specifically it's this line: 'PropertyReference="...ConnectionStrings.JN.ConnectionString.ConnectionString"' - I show the problem in bold,red,underlined).
To fix this and also ensure that you never have the error mentioned, make it a RULE NEVER to include a "." (dot/full stop) in your connectionstring's name. So you'll have: 'name="JNConnectionString"' in your web.config and 'PropertyReference="...ConnectionStrings.JNConnectionString.ConnectionString"' in your DataSet1.xsd file.
(By the way, I didn't find this error on Google, so apparently it's only me that make this mistake.
)
tagged: professional //
Tuesday, October 24, 2006 11:51:33 PM (GMT Standard Time, UTC+00:00)
OK, finally, I seem to be making some progress, Thank You God! This thing was driving me crazy. The amount of permissions etc. that have to be set to get this working.. wowwy, there SHOULD BE A MANUAL (those of you who have some affiliation with MS, *hint *hint
).
Hopefully I can do some documentation on how to get through it (ie to move from finishing develop asp ;2 apps to getting then properly deployed) and put it up here (*cross fingers).
Until then, these were two of the sites that helped me understand some of the madness - Site 1, Site 2.
tagged: professional //
Tuesday, October 24, 2006
Tuesday, October 24, 2006 2:29:13 PM (GMT Standard Time, UTC+00:00)
Currently, I am in a state of disbelief as to how difficult it is to be able to create a fully functional website in VS'05 and then have that same website GIVE PAIN to work under IIS. (This is mostly with respect to ASPNETDB.MDF and SQL Server 2005 Express dbs in general - with Integrated Security = True.)
And I understand, I'm new-ish, so I may make silly mistakes but some of these podcast and videos online give NO HELP WHATSOEVER. They show how to do the development under VS'05 (which runs everything under your user account ie what DOES NOT HAPPEN when the site is deployed to IIS), yet they do not show how to deploy the web app and have it work!
Thus far I've been plagued by errors such as:
Cannot open user default database. Login failed. Login failed for user 'PC\ASPNET'.
(This is just as I try to login using the new login controls which are to interact with ASPNETDB.MDF)
An attempt to attach an auto-named database for file C:\...\DB.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.
(This is just as I try to Connect to my DB under SQL Express... For this one I found out I had to detach the db from Express FIRST.)
Also, online, there are tons of people facing this same problem and solutions have been suggested such as changing NTFS permissions on the DB folders and files to allow read/write/modify access to ASPNET user account... For me though, that doesn't seem to work with any stability at all (ie I could wake up this morning, it works, go have lunch, come back and it doesn't).
MS... what are you really about though? I mean, if there are "expected" changes people are suppose to make (eg. setting up NTFS permissions, SQL User accounts for ASPNET, NETWORK SERVICE Windows accounts), WHY NOT MAKE IT CLEAR? Stupse.
The login controls, Web site Admin tool etc were a step forward but, the deployment stage is LACKING (for lack of a better word). Or... am I suppose to keep the app in development mode and put it on the web site like that ie running under VS'05?
Bleh.
tagged: professional //
Saturday, October 21, 2006
Saturday, October 21, 2006 12:46:25 AM (GMT Standard Time, UTC+00:00)
System.InvalidOperationException: ObjectDataSource 'ObjectDataSource1' could not find a non-generic method 'Update' that has parameters: ...
This was my fate after simmplllyy following an ASP 2.0 tutorial vid(eo) click-for-click. Thinking that somehow this was my fault ie I mistakingly omitted some parameter, I spent about an hour doing the thing over and over and... o.. Eventually I found the problem, and it was linked to the way that ASP 2.0 (and VS'05) handles the ObjectDataSource object (this also depends on the data and data types as they are in your database). IE, It can happen to anyone and is not directly proportional to your c0ding skill.
In retrospect, I should've checked online, as when I did (a couple hours after I got it fixed), I saw that tons of developers had that problem! And good suggestions have been made to curb it. Here are a couple: one, two.
Other that that little hickup, ASP 2.0's looking very very nice and yea, I know, I'm late... as it's been out for a while but, better late than never! And once I see no ASP 3.0 headlines from MS, I still think I'm sitting well!
tagged: professional //
Wednesday, October 18, 2006
Wednesday, October 18, 2006 9:39:34 PM (GMT Standard Time, UTC+00:00)
Today I had the rare 'pleasure' of dealing with some C++;. To start, the first thing I had to do was get a compiler. For this I ran to my usual engine and typed in "free c c++ compiler". The first hit said "Borland C++ Compiler version 5.5 Free Download Is Here !!!", to which I responded with a HUGE
, as I used Borland compilers before in my undergrad yrs.
Sad to say however, to get that free 8.7MB product, released on 08/24/2000 it told me I had to register and fill out a form. Some of the required fields for this form were: first name, last name, telephone, address, city and country. Now, I'm not one for giving out easy personaL info esp just for a quick dabble in C++, so I pushed the Back button a couple times and returned to my engine. After about 20mins, that too proved to be a waste.
I then found an old Visual C++ cd from MS lying around the place and installed that (this is version 1.52). That installed great and took about 155MBs (stupse) but I didn't care as I got my compiler! To test, I put in some code and click Build. Immediately I get an "iostream : No such file" error... again, "stupse!". So I rushed to claim back my hd space and get rid of that prog however, no uninstall file, not even from Add/Remove programs. By now, I'm not the happiest guy around as one can imagine!
FINALLY, something tells me to check VS 2005 and in the Project Types side-pane in the New Project window, there is the heading "Visual C++".
<- he reappears here.
So I go to creat a new project but for some reason I've found it a bit difficult, it not as simple as I would have thought at all. Ways, for ones who just want to use VS 2005 to play around with standard Windows C++ (cpp) files follow the following steps (PS, of course this is under the pretense that you've installed Visual C++ component when you installed your version of VS 2005):
- File -> New Project
- Click Visual C++ heading in left pane and come down to Win32
- Click Win32 Console Application and in the bottom of the window enter the project name (yes, you should create a project first)
- In the Win32 Application Wizard window that pops up, Click on Application Settings link in the left pane and ensure the following are selected - Application type: Console application; Additional options: Empty project.
- Now, your project is created all you have to do is add the C++ files by Right Clicking on Project Name or relevant directory in Solutions Explorer and choosing the C++ File (.cpp) option in the Code category.
- Enter the name of your file and you should be sorted!
One last thing, remember in using C++ to include the "using namespace std;" to enable you to just put 'cout << "blah blah";' instead of 'std::cout << "blah blah";'. Oh and if you want VS 2005 C++ specific help, pop the string "visual studio 2005 c++" into your search and hopefully that gives you some good info. Usually a nice MS link should be up there with some samples and even a team blog. Enjoy!;
tagged: professional //
Saturday, October 14, 2006
Saturday, October 14, 2006 6:09:32 AM (GMT Standard Time, UTC+00:00)
So in playing with ASP 2, a time came for me to try to deploy/publish my test site... sad to say, the VS 2005 as is, didn't handle this for me too well. For example, I wanted each directory compiled into its own dll WITH its respective name, as this I consider is a standard setup especially for identification and updating purposes (and code privacy as well). AS IS however, VS gives you something along the lines of App_Web_(random letters), my favourites being: "App_Web_3tyx-q0m.dll" or "App_Web_chu6wowl.dll"
Now, with the knowledge that these configuations of directory name for dlls was done in VS '03, I figured there must be a way to do it in '05 - Enter 'VS 2005 Web Deployment Projects'. This is a plugin file from Microsoft (which is freely downloadable of course
) which allows the configuration I mentioned above and also, has some other interesting features for use at the deployment stage for web sites.
For more information on this plugin see the 'VS 2005 Web Deployment Projects' site, there also will be a link to download it.
Truth be told, I must thank this guy's blog on the topic as he is the one who directed me to this required plugin.
tagged: professional //
Monday, October 09, 2006
Monday, October 09, 2006 4:17:05 PM (GMT Standard Time, UTC+00:00)
After an "event-less" weekend, I'm back to the glorious asp 2.
For web site construction, I have actually had the pleasure of using Dreamweaver (DW) a bit and I must say that it appears a very good tool, especially the fact that it allows for working with aspx and, if I ever again get the urge, php. With this knowledge (more with respect to aspx), I was actually tempted to use DW more and do away with my VS 2005 (esp. because at times, VS sites seem to be more tailored to entirely work only with IE & not other popular browsers such as FireFox or Opera).
While thinking on this topic though, I stumbled across an interesting set of articles labelled 101 Microsoft Visual Studio 2005 Features Compared to Adobe Dreamweaver 8. This article, published by MS (no comment...) looks to compare these two development products in various videos. After watching a couple of these vids, I was shocked to see how much functionality DW has, from server side controls, sql server connections, datasets .. a bit of the stuff found in VS. However, the products do have many differences including that VS uses the aspx file for UI mostly and .vb or .cs files for server side code, whereas DW seems to put everything in the aspx file (even though one can create the code files manually). Anyway, enough of that, if one has access to both tools or desires to purchase/use one of them, I suggest you at least check out the link above. At worst, it will be a good introduction to both dev tools.
tagged: professional //
Thursday, October 05, 2006
Thursday, October 05, 2006 1:40:01 PM (GMT Standard Time, UTC+00:00)
So starting today I embark on learning ASP.NET 2 properly. I expect to take a look Ajax sometime soon as well.
All this on my goaL of becoming an mvP.
Update on the day:
So far so good, did a brief recap of HTML & CSS as well. So far I haven't seen any of the tons of stuff in the meta tag as with Visual Studio .NET 2003.. so that's a good sign! Hopefully this is a sign of great stuff to come!
Sidetracking a bit.. .NET Framework 3.0 good to go with Vista?! MS doesn't waste any time at all. Luckily though, it seems more of an "addon" to .NET Framework 2.0 with more technologies such as the Windows Communication Foundation (WCF, formerly code-named Indigo), an expected, "big player" in Service-Oriented Architecture. Another lucky thing is that there's no ASP.NET 3.0!! *PHEW! Anyway, more on .NET Framework 3.0 in future posts, for now, it's all about ASP 2.
tagged: professional //