Friday, November 16, 2007

AJAX.Net & The Freelance Project...

I've been steadily plugging away at my freelance project that I've been working on for way too long now. Luckily, my partner/customer in this endeavor is quite understanding of the time involved in caring for young children and life in general. Luckily, I've managed to make a number of updates to the back-end processing that makes front end processing much easier. Basically, there are a number of things where I was doing some rather heavy calculations for every call, that I didn't need to be making.

For example, the state of a element. This state changes every time more elements are added into the collection, so I can't just give an element a single state when I load that element and be done with it. At the same time, a lot of calls are taken up with calculating that particular state at other times during the life-cycle of the process. Well, my solution was to have a table in the database which records the element and its current state, and create a stored procedure which can be ran to recalculate those states. Also, I'll soon be sending that data down to the page code as a JSON variable so that I won't need to make some of the calls to the web server while playing with elements not in the initial data set.

Basically, a foo object can have 36 elements, but approximately only 18-25 of those elements will come down with the initial retrieval of foo attributes. It's all part of the processing to determine what is displayed that way. Anyways, if I want to include one of those elements that aren't in that initial set in my output, the current process is that I tell the web page, it builds the div for displaying the element, and then sends off a request to the web service backend to get its state. Sure, I'm not doing that a whole lot, but if I can kill a call to the web service, that makes the process just that much faster, because we don't have to wait on the round trip time.

Of course, now that I've got my backend updated, I'm facing some odd issues with the front end. The front end is heavy in JS and CSS because, well it just is. I have the Prototype and script.aculo.us libraries in play, and then it is also a AJAX.Net site. This means it's spitting out a whole bunch of JS. Anyways, my issue is that when I load the site from the testing web server, it's not displaying the elements. Other attributes are changing, but the elements aren't. Oddly, this behavior isn't being replicated on my development box.

I'm not sure if it's an AJAX.Net issue or a Prototype issue. Or something else altogether. Somewhat annoying if you ask me.

Thursday, November 8, 2007

Speeding up File Writing

I'm dealing with rather large data sets these days. I'm talking on the order of a few million records easy. One of the tasks I've been given is to take these records and generate a flat file of them to transfer to another process for external processing.

Not a problem, right? In fact it could be done just from the Query Analyzer with its ability to save results to a file.

Well, sometimes that works all right, but this is a process that needs to be run routinely, plus at random other times of the year. So I shoved it into a simple console application where I have a configuration file, and I can override those configuration options via command line arguments.

It worked beautifully for my first few test sets of data I ran through it, the largest being about 5,000 records. Then I pulled the full test data set, which has about a million records. After staring at that black screen for what felt like forever, I went about hunting a way to speed things up.

My studies uncovered the fact that IO.Stream classes were faster than Microsoft.VisualBasic.FilePut classes. The problem there was that I was already using the IO.Stream classes.

So, I stumbled through things, hunting for ways to improve my efficiency. I tried IO.File.CreateText as a way to return a StreamWriter, but that had no discernable efficiency bonuses (added an extra 300-400 milliseconds at 1,000 records).

I tried using a StringBuilder instance to build the file and then shoved it into the StreamWriter all at one time (as opposed to writing directly to the file every line the way I had been doing). Oddly, that still had no discernable efficiency bonuses (added an extra 100-200 milliseconds at 1,000 records).

Almost ready to give up, I went looking through the IO.File class to see what functions I could use. Which is when I stumbled upon IO.File.AppendText. Giving an internal shrug, I set about reworking my function to use a StringBuilder class and the AppendText file.

As an aside, note that if the file exists, I always delete it so that I'm creating a new file every time.

Imagine my surprise when I saw a rather marked difference in efficiency, as evidenced by a two-second drop in speed. Not quite sure what to make of it, I ran the tests again, and then increased my records to 5,000 and then to 100,000.

I was flabbergasted at these results:
1,000 Records

Method 1:
1. 0:0:16:47
2. 0:0:14:344
3. 0:0:14:406

Method 2:
1. 0:0:12:687
2. 0:0:12:78
3. 0:0:12:343
5,000 Records
Method 1:
1. 0:0:25:0
2. 0:0:24:686
3. 0:0:24:702

Method 2:
1. 0:0:12:280
2. 0:0:12:124
3. 0:0:12:265
100,000 Records
Method 1:
1. 0:4:23:249
2. 0:4:25:798
3. 0:4:25:675
Method 2:
1. 0:0:18:952
2. 0:0:21:77
3. 0:0:20:983
I couldn't believe it. The AppendText function working with a StringBuilder class was nearly 4 minutes faster than writing the file directly. Sure, it means I have to touch the data an extra time, but with that as a speed increase, that is something I'm quite willing to live with.

Monday, November 5, 2007

Merging Data Tables....

I found myself in a situation where I was loading a data table with data, and then possibly bringing in additional data. I knew that .NET 1.1 the ability to merge whole datasets was included, but little did I know how they upgraded that in .NET 2.0.

I was playing with the underlying table of data, and found the .MERGE command. Surprised, I did a quick Google search on it, and found this article describing all the changes to the ADO.NET DataTable class.

Now, if they had only included an APPEND capability, I'd have been even happier.

Wednesday, October 24, 2007

My New Best Friend

Found a new site today, that I absolutely adore!

http://www.connectionstrings.com/

Wednesday, October 3, 2007

Javascript Tree Control

Well, I've finally found a free Javascript tree control, one with a license which means I can use it in the commercial product I'm working on.

It's available for download nowhere, and I have to say I'm pleased with it, as it uses unobtrusive JavaScript to transform a nested UL into the tree.

Edit: Removed the link to the software, as it no longer exists on the linked-to site.

Tuesday, October 2, 2007

XPATH in .NET

Sometimes I'm truly oblivious to things.

I love working with XML in .NET it's a great way to send information across the internet to disparate companies, such as UPS. Well, when parsing XML messages that I receive I use XPATH. No big deal. The problem lies in the fact that I don't do it often, so I tend to forget that first "/".

Not a big deal. Just an hour of hunting down why I wasn't reporting the response I received from UPS.

That, and the fact that I was doing error checking on Node.Value and Node.InnerText when only Node.InnerText was populated.

Friday, September 28, 2007

Tree Queries from the Database

Okay, I've stumbled onto an odd problem. Our System Analyst here at Techsoft is an Oracle guy. He does all these things in Oracle, and then expects us to carry out similar activities in our applications and in SQL SERVER.

Usually it's not a problem.

Oh, but when it is....

He created a table, and populated it in both the Oracle and SQL Server versions of our database. It contained ID, CODE, Name, Description and PARENT_ID columns, and basically was designed to store/output hierarchical data, like you'd find in a TREE control.

Yeah.

So, I spent a good half-hour banging my head, trying to figure out how to generate a SQL statement that would produce the relevant datasource in an easy to use format. So I went to the guy who knows more about SQL Server than me. While we're hashing out possibilities, in walks Mr. Oracle. He seemed to think it was no problem, and produced this ORACLE query:

Select LPad ( ' ', 2 * ( Level - 1 ) ) || Code Code, Name, Description
From JCA
Start With ID = 0
Connect by Parent_ID = Prior ID;

Yeah, and that's where I really started banging my head. LPAD doesn't exist in Transact SQL. Nor does CONNECT BY, and I have my reservations about START WITH.

Of course, what annoys me the most is the misleading GROUP BY. Despite the name, GROUP BY does not group things. It aggregates things. It's an important difference which gives me migraines. If I wanted to aggregate things, I'd look for a function called AGGREGATE BY. If there's a clause called GROUP BY I would expect it to group things according to the column I pass in. After all, that's the way it would work in a programming language.

But nooo... this is databases... :|



Okay, my rant is over, no to once more try to figure out the TSQL version of that evil ORACLE query.

Thursday, September 27, 2007

Why I have been silent...

As the three of you who consistently check this blog via RSS feeds know, I've been silent here for nearly twenty days. No updates, no dumps of knowledge, nothing.

The reason for this is because I'm in the process of moving.

I've gotten a new job with SAKS Inc. which I start about halfway through the month of October. It's a developer's position, doing a lot of the same stuff that I'm doing now (ASP.Net with a SQL Server backend).

Truth be told, there is still some issues on just what I'll be able to blog about in concerns to the new position, but in the end, I'll always have my freelance stuff to fall back on to bring out my thoughts and concerns.

I'll try to be more vocal here, but a lot of my energy is currently being spent on getting my projects at my current employer wrapped up into a state where someone can easily come in behind me and take them over, as well as getting everything packed up and even trying to find a house up in Jackson where we're going.

It's scary. I'm something of a home body, and am very comfortable where I live. I like Pensacola. I've been here for 26 of my 30 years. Yet, just liking a city isn't enough of a reason to pass up such a great opportunity, both career-wise and pay-wise, that SAKS is offering me.

Thursday, September 6, 2007

IE6 Makes me see red....

It's official.

I hate IE6. Back when it was the version that everyone was running, I did very, very little with CSS and I had just a general feeling of malaise related to it. I didn't hate it, I just prefered Firefox.

Yet now after the release of IE7 and it's great (though still not perfect) standards compliance with CSS, coupled with the fact that I'm working more and more with CSS, I realized just how much I hate IE6.

Why you ask?

Because I just spent nearly two whole days fixing my layout so that it would work in IE6. Why someone is still running IE6 I have no clue. They should have been upgraded to IE7 by now. Yet, for whatever reason, my layout fell apart in IE6.

First it just wasn't showing up, and then once I got it showing up, the text would be split duplicated across multiple lines. I have to give nods to a couple of other websites out there which helped me solve these problems:

  1. Hack Free CSS for IE
  2. IE Duplicate Characters Bugs
So, I have these thoughts on what could be causing my problems, and am doing things like destroying the functionality for the collapsing navigation system, and removing all comments and hidden fields from the page. Ultimately, my solution is two fold, and both things are aimed at IE6 where all other browsers will ignore them.

First to kill the duplicate characters bug that was appearing on nearly every link I had, was this bit of code:

Then I also added this to my longer links, to force a wrap and keep the display from hiding characters:

Goodness, I despise, IE hacks.

Wednesday, September 5, 2007

Silverlight v1.0

Silverlight version 1.0 has been finally released. Now to find some time to play with this. Oh well.

What is Silverlight? Well, the Silverlight web page describes it as thus:

Microsoft® Silverlight™ is a cross-browser, cross-platform plug-in for delivering the next generation of .NET based media experiences and rich interactive applications for the Web. Silverlight offers a flexible programming model that supports AJAX, VB, C#, Python, and Ruby, and integrates with existing Web applications. Silverlight supports fast, cost-effective delivery of high-quality video to all major browsers running on the Mac OS or Windows.
Basically, imagine a version of Flash where you can build and utilize ASP.NET web application within it.

Tuesday, September 4, 2007

vCalendar

Well, I find myself working on an application that deals with generating elections, and one of the issues is the fact that users need to be reminded to vote.

Well, I had the wonderful idea of using ICS files so that users can download and input them automatically into whichever calendaring application they prefer.

Well, a bit of searching turned up these classes on CodeProject to make implementation of the generation of the ICS files easier.

This makes the "Future Elections" page much more useful from the voter's point of view. Major points in the usability department.

Doctorow on DRM

The wonderful Science Fiction author has something very interesting to say about Digital Rights Management, and it's influence on the consumers.

It's in the Guardian.

As usual, he's right.

Monday, September 3, 2007

Neglectful...

I know that I've been neglecting this blog recently, but there's a valid reason for this.

  1. I was on vacation, which meant that I was away from work, and totally not thinking about programming.
  2. See Above.
  3. I'm working on a pretty new layout
In all actuality, I'm plugging away on a number of different things, amusingly enough, most of the stuff I've been doing recently has been traditional programming. I'm not using the full power of .NET and it's abilities to create and destroy controls on the fly. What I've been playing with most has been AJAX via the PROTOTYPE library. Sure, I'm doing a lot of interesting things, such as hijacking links, but in the end, and if you take away the JS, it is literally a number of webpages which behave exactly like traditional webpages should.

To the two of you who routinely check this page, thanks!

Tuesday, August 7, 2007

CSS Style Sheets

Okay, I can admit, I'm not as good with CSS as I would like to be. That said, I am better at it than some of my co-workers, and have recently introduced one of the hardcore, let's use tables for layout, designers to the joys of clean CSS. I love the things, but I don't always think in them, and I stayed with tables as a layout medium for years after CSS layouts were popularized.

Of course, now I am an ecstatic CSS-man, happily building my layouts with CSS styles, exulting in that glorious dearth of nested tables.

Beautiful!

Of course, since I'm still learning this stuff, there are problems I'll stumble across. The problem today was liquid templates with a fixed-width left column.

Here's a not-so-secret, I don't like fixed-width templates.

I usually keep my resolutions up high. Higher than most folks out there. As such, standard 800 wide fixed-width templates will only take up at best a half of my screen. The ones designed for 640 are just pathetic.

So, I prefer to build everything using liquid templates. Not that bad, and everything, and one of the reasons I stayed on the tables as layout medium bandwagon for as long as I did.

The problems with liquid layouts that I faced lied in the fact that template I was using needed to be a mixture of fixed and liquid widths. I needed a hardcoded 200 pixel left-navigation, and the rest of the real estate needed to be taken up by content.

Then I also needed such things as a minimum height on the content. Otherwise, the footer would have sneak its way up beneath the navigation. Which is just bad form, all around.

So, I spent a bit of time doing some research, and much to my non-surprise, I wasn't the first to have these problems.

The height thing, was solved by a nifty CSS command called min-height. I provide a minimum height which I want this to have, and if the content does not require enough space to meet that minimum height, then it fills it with white space. Beautiful! Perfect! It works in IE 7! There's even a min-width.

I'm happy as that proverbial clam.

So, I spent a bit more time in Google, searching and hunting. Dipping my nose into those dark and arcane realms of cyberspace which are best left to us geeks: forums for programmers. Well, actually it was a programming blog-but it is still arcane.

Seriously, I discovered an answer to my ails in the form of this blog entry: A List Apart: In Search of the Holy Grail.

And no, contrary to the fact that there is a new Indiana Jones movie coming out, this has nothing to do with Indiana Jones. Or Percival.

Anyways, that blog entry details using negative margins to force pages around.

Which annoyed me, and didn't really work.

But I managed to fiddle with the code there, and discovered the secret CSS settings needed to perform my desired behavior!

{style>
html, body{height:100%; width:100%; min-width: 640px;}
body {
background-color:#F7F7F7;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
font-size:1.0em;
text-align:center;
font-family:Verdana,Tahoma,Arial,sans-serif;
}
#MainRegion{Padding-left:200px; min-width:600px;}
#ContentArea{float:left; width:100%}
#menuArea{position:absolute; width:190px; top:154px; left:0px;}
{/style>
{div id="MainRegion">
{div id="menuArea">{/div>
{div id="ContentArea">{/div>
{/div>

Okay... Blogger is a great CMS for most things, but it annoys me when I try to post code samples like this. I need to see if I can find a CODE SAMPLE widget for this blog. Anyways, the example above provided me what I needed, and behaved properly!

Monday, July 30, 2007

Binary Encoded Strings & Zebra printers....

We built a little application which talks to UPS via XML to print out their shipping labels. Well, until a few days ago, this portion of the application worked perfectly, and we had never had any troubles with it. Basically, all of a sudden, the printer stopped printing the labels.

So I spent a few days hunting through the logic looking for a problem. Didn't find a thing wrong.

Then I checked the Application Log, hunting for any errors listed. Nothing.

Sent the XML messages that I send/receive off to UPS. Still nothing wrong.

Today, I pulled out the relevant bits of program, and toss it into a new app, just to print these labels. No XML communication. No XML Parsing. I supply the base64 encoded string to the app, and it converts it and prints it.

So, what do I get? Nothing.

Finally, I try sending printer codes without conversion. Again, nothing.

Of course all of these things are done using the Zebra's programming codes for the Thermal 2844. Basically, I have to open the port and then write out to it directly.

Alternatively, whenever I open the printer through traditional .NET printing classes and print using those, then it works perfectly, and the printer obediently spits out the text as ordered.

I am now, officially, smacking my head up against the wall. And of course, Google is less than useless for this.

Wednesday, July 25, 2007

VS Studio pasting from the browser

I'm working on this little project, and I needed a modal window system. So I did a little searching and stumbled upon Prototype Window. It's released under the same MIT license as the Prototype JS library.

That's all good. But, I'm also using a bit of JSON in this particular application, so I want to make sure that I have the latest Prototype because that's where the JSON functionality is built in at. So, I go to the PrototypeJS.org site, hit the download page and then copy from there the text for the JS file.

I happily go over to VS and paste that text into my JS file and hit the site.

Where everything proceeds to throw up. Over and over again.

After searching all the code that I had written, trying to figure out what was going on, I finally open up my local copy of Prototype.js - the one I had just pasted into, and right there at the top is a nice big old: <pre>.

... <-- that's me smacking my head against the desk

And then I remembered that most hated of VS 'features' the fact that it tries to paste text copied with formatting attributes, with those formatting attributes translated into HTML.

Which means you'll get a bunch of MS Word junk when you paste from MS Word, and a bunch of HTML junk when you paste from a browser.

I can see the usefulness of such a thing, but it should not be the default setting. Or at least it should be configurable as a default setting or not.

I believe it's fixed in VS 2005, as I don't seem to remember having that headache when working on a site in it earlier this year.

Well, that's my story of my own stupidity for the day. Enjoy.

Friday, July 20, 2007

Identity Generator

Something fun wandered across my RSS Feed this evening. It's a random fake identity generator.

They can generate a whole bunch of information needed to make this fake identity look real, and they can generate medium-sized datasets for you (up to 40,000 records) for free.

In the past, I've worked on a medical PDA application, and all our testing data had to be cleaned before we could do any testing on our application.

The part of the application I worked on was where this would have been the most useful. I built a Windows service which polled the message queue where the Enterprise data source would dump its data. It then took that data, parsed it out and shoved it into our own data structures for the application. A lot of fun XML and Message Queueing and just Windows services in general, but it wasn't a lot of fun anonymizing 10,000 records of personal information. Oh, if only I had had this 3 years ago.

Thursday, July 19, 2007

Learn something new everyday...

Apparently IE has a modal option for JavaScript to launch new windows.

I can't see it being truly useful though, as it's not supported in Firefox or Opera.

Anyway, the functionality in JavaScript looks like this:

Function modalWin() {
if (window.showModalDialog) {

window.showModalDialog("xpopupex.htm","name", "dialogWidth:255px; dialogHeight:250px");

} else {

window.open('xpopupex.htm','name', 'height=255,width=250, toolbar=no,directories=no,status=no, menubar=no,scrollbars=no, resizable=no ,modal=yes');

}}

As I said, I'm not 100% certain what the usefulness of this is, as if I want something modal, then that means I need it modal in Firefox and Opera as well as in IE.

Wednesday, July 18, 2007

Ruby.Net

An interesting topic flashed across my RSS Reder courtesy of TheServerSide.Net.

Basically, it was Ruby.NET (a .NET implementation of the Ruby programming language) is going open source.

I like Ruby, though I've not played on it nearly enough, and I'm fairly excited about this happening, especially if WATIR and other Ruby tools (i.e. RAILS!) can be folded into the Ruby.NET implementation.

This definitely bears further attention.

Tuesday, July 17, 2007

Scripting SQL Server Roles

For our prime contract, we have multiple applications all using the same database. We choose this schema because there is some information that is shared among all these applications, and rather than having it duplicated, we decided to just shove it all into the same place. Additionally, we have users tacked onto the databases, for each application which owns the objects of that application.

This allows us to have two tables named the same, but schema'd out to the application. For example, the EPB.Documents table and the ELETA.Documents table. While they are named the same, they serve distinctly different purposes. The EPB.Documents table is the meta data for the documents which EPB generates. The ELETA.Documents table is attribute data for documents displayed by ELETA.

Little things like that.

Anyways, in addition to all of that, we use Roles to control access to the application. For example there is an EPBUser role and a ELETAUser role. This means that we can quickly assign access to the db user to those elements which each application needs to function.

The problem comes in with generating SQL script files for backup/configuration/deployment purposes. 2000's Enterprise Manager has no support for scripting the role to a file or a query window. 2005's SQL Server Studio does, but it only scripts the creation of that role, not all the underlying permissions.

So, I hunted the internet and found this. What this does is displays just what attributes a user or a role has (there are 2 scripts on that link, the top one is for users the bottom for roles).

I grabbed it, plugged the name of my role in, and within seconds I had a nice batch of GRANT statements which the role needs to run the application.

Monday, July 16, 2007

Windows Integrated Security for Websites...

A lot of our websites that we build for our prime contract have anonymous access turned off, and integrated Windows security turned on. What this means is that when you try to hit the site, you get the Network username/password prompt box, where you have to enter your username/password for the domain. Not that big of a deal, it's easy security to implement, and we don't have to deal with generating passwords, and it's one less password for the user to remember. Additionally, if you're on their network and using IE, then the authentication process is transparent for the user.

Up until now, we had been using a server variable and then session variables to store the username. In fact this is the exact code we used from the Session_Start function of Global.ASAX:

Session("User") = Trim(Request.ServerVariables("LOGON_USER")).Replace("/", "\").Replace("'", "''")
Session("User") = CStr(Session("User")).Substring(CStr(Session("User")).LastIndexOf("\") + 1)
Not the most beautiful code in existence, but it did what we needed. It got the network username from the server and stuck it in a place where we could use it.

Of course I hated that code. It annoyed me because it was a hack. Enforced psuedo-authentication. What is worse, is that it didn't use the Page.User functionality.

So, we got a new project from that prime contract, and I was pondering how I could get that LOGON_USER ServerVariable into Page.User. So a bit of research, and I came up with some new code. First, the retreival of the LOGON_USER moved from Session_Start to Application_AuthenticateRequest. Then I added this code to that method:
Dim username As String
username = Trim(Request.ServerVariables("LOGON_USER")).Replace("/", "\").Replace("'", "''")
username = username.Substring(username.LastIndexOf("\") + 1)

System.Web.Security.FormsAuthentication.SetAuthCookie(username, False)

Dim id As New System.Security.Principal.GenericIdentity(username)
Dim p As New System.Security.Principal.GenericPrincipal(id, getUserApplicationRoles(username))
HttpContext.Current.User = p
What this does is retrieves the username from the server variable, uses that username to generate the authentication cookie so that the PAGE object knows about the authentication, and then generates the GenericIdentity and Generic Princpal objects necessary for Page.User functionality.

The final bit of usefulness would be the getUserApplicationRoles function which returns an array of strings, and basically gets the roles associated to the passed in user for our application.

So, we still use the server's security, but we now have access to Page.User.Identity.Name and Page.User.IsInRole. And I'm happy.

Friday, July 13, 2007

JSON Editor

I love JSON for use in JavaScript functionality. It's easier, faster and just better to use than XML in the same scenarios.

The only problem with it, is it's a hassle to format properly sometimes. Especially if you're dealing with dynamic data on the server side.

Well Thomas Frank has now put together a JSON Editor. It runs online or you can download a copy to run locally.

http://www.thomasfrank.se/json_editor.html

Thursday, July 12, 2007

A New Project and a RadioButtonList

Got two new things at work this week. The first is a new employee and the second is a new project. That ramps up the total current projects that I'm assigned to to 4. One is "turned off," while the other three are happily chugging alone. And of course, none of these projects are simple business websites. No, these are full fledged web applications, all running on an interconnected database.

Whee.

And, I get the joy of training the new guy. Truthfully, I enjoy training. I enjoy imparting my knowledge to others. It's fun. Especially in the workplace where people actually WANT to learn. The downside is that there's a lot of knowledge that needs to be imparted. Everything from process to arcane code structures which we use to improve application efficiency (i.e. using "OBJECT Is Nothing" rather than "IsNothing(object)", etc).

This of course cuts into the time I have to spend on developing. Since we were tossed another application, that means I had to toss some development towards the new guy before I was certain how much he understood what the code is doing. Well, I was trained via trial by fire, so I guess it will work for him as well.

Anyhow, I spent a good hour cursing at .NET 1.1 this morning. I have a RadioButtonList on my form, and the datastore that was coming from the database was the Text, Value and Selected attributes of the ListItems. So, I spent a bit of time, hunting the web to see if there was a way to utilize the selected attribute while doing a classical databind.

Unfortunately, there's not. That meant that I had to walk the DataReader myself, creating the ListItems and setting their Selected attribute all the while. How annoying.

I wonder if they fixed that in .NET 2.0, but somehow I doubt it.

Friday, July 6, 2007

Developer Testing

This must probably be the most onerous portion of my job. The task where I have to play with the currently stable pre-release version of our product prior to turning it over to the testers for system testing. Fixing little things like someone having changed every ":" in the application's text to a ".".

I know it needs to be done. I know WHY it needs to be done, and I can do it. I just rather be rebuilding the processing engine (again), because, well, that is FUN!..


Speaking of rebuilding the engine, the product I'm talking about is our document builder (and if we ever get our commercialization stuff finished, I'd be ecstatic to provide links to this thing, as I'm proud of it). Anyways, our document builder has certain controls which are always on the page. These controls are basically for the information that is shared across pursuit-scopes for the documents (such as the name of a project). That's not a problem, the problem is that there are multiple pursuit scopes, and each scope has a slightly divergent need for controls. So the design involved adding pursuit-pages to handle that, in addition to the INDEX page. A change from previously where we had only a single page. An unfortunate side-effect of that was suddenly our code base tripled in size, with a lot of that being replicated functionality for those pages.

I didn't like that then (too much chance for functions not getting update) and I don't like it now. So my solution is to change how the system works. Currently, the application asks for a pursuit and an department. Once it has that information, then it allows you to create the document in the database. Which seems backwards to me, especially since the application is a document builder. If we made those shared controls dynamic, then we could pretty much force the application to create a path for data entry based on document type. Which not only means we can go to a single page again, but that we can also use the tool to generate documents that are not specifically tied to a project (what those mythical documents are, I'm not sure, but it sounds good as an argument).

Anyways, now I must convince the project leaders of the glory of my vision. And then tell them I want to change the system even more, so that the controls are all built dynamically via JavaScript, loading and saving data through a web service accessed via AJAX.

That should be a fun discussion.

Thursday, June 28, 2007

I know better...

Earlier this year, I picked up a freelance project. From the description, I figured it would be an easy problem to solve and a quick build.

So, I made the decision to forgo a requirements document, and just jump right in and develop what I thought was wanted/needed.

I can't believe that even after 4.5 years of doing this type of stuff, I still do things that stupid on occasion.

I was at a meeting with the guy last week, and discovered that our fundamental visions for how the application was supposed to work where off from one another. Sure, on the generals of the application, it was fine, it wasn't until the details were reviewed that we realized that I wasn't creating the functionality in a manner that was just slightly... well, off.

So, now I'm in the process of generating an SRS, SDD and DBDD, mainly because I'm sick of the hassle of not knowing exactly what it is I'm supposed to be doing here. Not that that isn't anyone's fault but my own of course.

Wednesday, June 27, 2007

Google Docs

Well, I logged into Google Docs this morning (much as I do every morning, it's one of my STARTUP Tabs in Firefox) and got a nice surprise. A brand new layout for the file system.
Frankly, I like it a lot better than the old layout. I like the folders, and the "Outlook" style that it is using here. It's more user friendly, and more intuitive to use-after all it is the paradigm that is used by Windows File Explorer, Outlook, and Google's own GMail and Reader applications.

I for one will not miss the pull down menus that were up there, and am glad they've made these changes. Thanks, Google.

Monday, June 25, 2007

What happened to my gridview buttons?

Argh, I have a website I'm working on. The website is broken into functional components (such as a page to deal with courses and a page to deal with events and so on), and these pages deal with every aspect of those components (adding, editing, listing, etc).

Well since I needed to be able to jump from one component to the other, I used query string variables to control which page I was on.

Not a big deal, it's an old technique which works. I could have just as easily used POST commands, but frankly, this works better as those query string variables can be bookmarked by the user.

Well, for whatever reason, the click events for some LINKBUTTONS in my GRIDVIEW aren't working. I don't know why, there's no reason why they shouldn't. They just don't work. It annoys me to no end.

I have the buttons defined properly. I have the GRIDVIEW defined properly. I've even got the GRIDVIEW RowCommand event handler defined properly, but for whatever reason, the thing just doesn't want to work.

Time to go smack my head against the wall for a bit, I guess.

EDIT: I meant to update this the other day, but I finally figured out what it was. The PANEL which held the GridView had the EnabledViewState attribute set to False.

Wednesday, June 20, 2007

Okay, this is just silly....

We're developing an web-application. Not that bad, we have a set of originating requirements, and a number of other design documents. We're using an AGILE methodology because the client isn't entirely certain of just what type of functionality they want.

Strike 1.

Also, the client isn't sure what type of database backend they're going to use, but they think it's Oracle - but it MIGHT be SQL Server.

Strike 2.

And they don't know on which server they're going to deploy this thing. It could be a UNIX box, or it could be under IIS.

Strike 3.

Yes, I definitely feel like I've struck out with this project. Unclear requirements and then top that off with the fact that we might not be able to develop in our primary development environment.

I may have to learn RUBY or some other arcane language in order to translate all my .NET code into something that can run happily on a 'NIX box.

It just hurts my head. Yet, at the same time, they won't let me go ahead and just learn RUBY because it might still be deployed on an IIS box, so they don't want the overhead of me learning a new language.

It's at this point, when I have an aneurysm.

Oh well, I have a pretty new design now, so I think I'll go bang my head against the wall for a bit.

Monday, June 18, 2007

Sometimes, I'm too smart for my own good....

I have an application, and it's common practice to build our applications with external data layers, that implement an interface, utilizing common data types and interfaces to send data back and forth. One common one is the IDataReader.

Well, I have this web application that I built - the one running the Oracle database - and we kept getting either a TNS Listener error or Connection Timeout errors. Frankly, I'm of the opinion that they're the same error, it's just that some are getting reported out of the .NET native OracleClient classes (which I utilized) and some are getting reported out of Oracle's implementation of the same (which my co-worker utilized).

Anyways, we kept getting these errors, which resolved down to the connection pool was getting filled up with connections. Bad for business to say the least.

What it ended up being, was we had forgotten a parameter on the Command.ExecuteReader function.

Normally, you don't need to pass in any parameters to this function, as most people use it directly there in the code with the connection and command objects, so they can destroy them all at the same time.

The problem comes in with the fact that since we're passing the DataReader out of the method which generates it, so it can be used elsewhere, we can't close down or destroy the connection and command objects as that would destroy the DataReader as well.

Which is where that parameter comes in.

It's called the CommandBehavior enumeration, and it is used like this:

Function GetValue As Data.IDataReader
   Dim comm As New OracleClient.OracleConnection
   Dim conn As New OracleClient.OracleConnection
   ' Snip Connection/Command stuff

   comm.CommandText = "EXEC MyPackage.StoredProcedure"
   GetValue = comm.ExecuteReader(CommandBehavior.CloseConnection)
End Function
Really, quite a simple solution when I remember to add it in.

Anyways, the CommandBehavior enumeration has a couple different options, but as noted, the one we're interested in here, is the CloseConnection option. What this does is destroys the underlying connection and command objects of a DataReader when the DataReader itself is destroyed.

And since I added it into the ExecuteReader calls in my data retrieval functions, the connection pool isn't being filled up, so I'm not getting all those errors.

Friday, June 15, 2007

Oracle SQL Developer

A couple days ago I was lamenting the lack of a good visual tool to work in Oracle with.

After all, there's only so many times you can do something in Notepad++ before you're wanting to pull your hair out.

Anyways, a wonderful commenter (thanks again, Justin) stopped by, and pointed me towards Oracle's SQL Developer. It's a free tool provided by Oracle that does almost everything I wanted from such a tool (it might do everything, but I haven't found a database diagramming option-of course that could just be merely that I can't find it, after all I've only been playing with it for a little bit.

Thursday, June 14, 2007

Software Development Related Body of Knowledge Listing

The Real World Software Architecture blog has published a listing of software development related bodies of knowledge here.

It seems my list of things I need to read in the upcoming month or so, has just increased greatly.

Oracle Tools

When I work in Oracle the thing I miss the most are the tools provided by SQL Server.

In SQL Server 2000, they had Query Analyzer and the Management Console. From those two applications, I could control everything about SQL Server.

In 2005, they rolled all of that into a single application called Sql Server Management Studio, and additionally rolled a lot of the functionality into Visual Studio 2005 as well.

I love using those tools. They're visual, powerful and if I need to get into the nitty-gritty SQL, I can.

Why, oh why, can't Oracle have something like that? I''m sick of working in Notepad++ building all these scripts - which I'm not sure are going to run, and then going to Oracle SQL *Plus to run them, only to discover I have some typo somewhere in that mass of SQL code.

Oracle is a powerful system - it has a lot of good features. Yet how you work in it is definitely not one of them.

IMO, Oracle needs to provide a good, powerful, visual interface to their system. I don't want to have to do everything in Oracle through SQL, and to be honest, the web interface that is provided is not good enough. Not when it's compared to SQL Server's Admin Console.

Wednesday, June 13, 2007

The Portable Web-Development Toolkit

An interesting article stumbled across my RSS Reader entitled The Portable Web Development Toolkit.

Basically, it is a web development & testing environment that can fit on a thumb drive (with at least 512MB of room).

So, I downloaded bits and peices of it (XAMPP, the portable web server mainly) and stuck it on my thumbdrive and tried to use it at the house.

And failed. It wouldn't serve my pages.

A tad frustrated, I took it to work, and all it managed to do was screw around with my IIS and caused me to need to reboot my machine.

Even more frustrated, I realize that I'm going to have to figure out someway to do testing on my little PHP thing. So, I checked to see if my webserver (hosted by GoDaddy) still ran PHP. Happily it appeared to do so - at least until I tried to connect to a database. So now, I'm having to contact GoDaddy support and figure out if it's just an issue with the Windows hosting or if they've removed PHP from the windows hosting all together.

Lucky me.

Storyboarding A Website

Well, I get to play catch up in regards to some of the documentation for one of the projects I'm working on. Basically, the REQMP section never got storyboarded for the SDD replacement document for that section. So that means that I get to do so.

Ah, the joys of random paperwork.

It's a nice, well defined process, and all the data is on the testing website or in the database scripts which work with the UI so it's not like I have to hunt long and hard for the data, it's just a tedious cut-n-paste job.

But, we need all our documentation in order, now don't we.

Monday, June 11, 2007

I seem to gather things to do...

Well, I have managed to bring in a new project onto my plate. It's not something overly large, just a simple PHP application for a forums that I'm involved in to rate things that the forum users produce.

So, I get the joy of ramping back up on PHP & MySQL to build this thing.

Friday, June 8, 2007

I'm on a redesign kick.

One of the projects that I "inherited" back when my co-worker was on paternity leave is codenamed EPB.

This is the application which I built all the interfaces for, to allow for ease of use in switching controls back and forth.

Not that big of a deal.

At least until I started thinking about things. Specifically the fact that the prime client for this application may want to go to an ORACLE solution using Oracle Application Pages (or whatever their psuedo-webserver thing is called).

Now, EPB represents hundreds, if not thousands, of man hours of development, all of it in .NET. The design of the database, and how the application works is mine. I laid the framework for it all, and I love it. The newest thing of using interfaces for the controls allows an even easier time in regards of new content and maintenance for the system.

So, you can imagine my frustration at all of that code being effectively useless in the Oracle stuff. After all, there's not a 1-to-1 relationship between how Oracle produces HTML and how .NET does it, so all those server controls we've built will need to have something else done to them.

Well, the other night, I went to sleep considering these implications - in part thanks to a visit from one of the principals from the client organization - and the next day thought up a solution.

Javascript, DHTML, AJAX, JSON and web services.

The system currently posts back to the webserver and then builds the page in .NET and streams out HTML to the client. What the server controls are, are little bits and pieces of logic designed to facilitate that whole process, and group it into logical data/processing parts for our system.

Yet, there is nothing stating that the system MUST behave this way. Heck, there's nothing stating that we have to have those little bits and pieces of logic in our compiled .NET DLL.

My solution is to kill all the ASPX pages, and have all of the data processing in a web service. With AJAX, we can get the data that we currently use to determine which page is being displayed, and then with JavaScript/DHTML (specifically, using the Prototype JS library) we can build that page dynamically as needed. Javascript will be responsible for control creation and destruction and sending the user-entered data to the web service.

JSON would ease, the amount of data being sent, in addition to just plain being easier to use as a data transfer medium.

Additionally, because the data saving logic is all on the web server, as long as it continues to accept the same properties, and return the same data, then we can transfer that logic into any code that we wish (with only possible manipulations of the asynchronous data transfer code). The HTML page and its attending JavaScript which would be the meat of how the UI works would stay the same, regardless of any changes tot he business logic.

And as a third benefit to this, we can use this web service in other scenarios as well. Consider, the application is built as a web interface. Well, with the data flow being in a web service, building a windows forms UI which consumes that service in a manner similar to the web UI would be an easy task.

Now, all I have to do is tell the principals here at my company that I want to redesign how EPB works once again.

Wednesday, June 6, 2007

.NET Data Parameters

so, we're working on this application, and its backend is an Oracle database, as I've been harping on for a week or two now. Anyways, we're utilizing packages and parameter lists because, well, it's Oracle, and the folks that designed the thing want every single data access to be via a stored procedure.

I can live with it.

Well, I've been playing with things, and discovered a slight flaw in the .NET to Oracle relationship. If I pass an empty string or a string without any characters to it, I get an error back from Oracle.

So, basically, if I have a text field and I enter a just a space, and then trim the value from that text field as I set it as the value of the data parameter I will get a hard crash.

Same as if the user leaves a text field blank.

This is the exception being reported by .NET:

Parameter 'teacher': No size set for variable length data type: String.
Why it would not accept the empty string, or even assume a NULL value I'm not certain. So I tried to provide default values, and apparently the parameter is overriding the default value as I get the same error.

Anyways, what I'm having to do is add a space to the values from the text field and then trim that value before I use it in the stored procedure.

And it gets better.

I can't reassign a value to the parameters, because they're all IN parameters by default. I guess I could change them to IN/OUT but that's a lot of hassle. So I'm having to do the trims every time I use the variable in the stored procedure.

This is just so much easier in SQL Server...

Tuesday, June 5, 2007

I feel like an idiot thanks to Oracle Stored Procedure parameters

Yeah, Oracle's Stored Procedures parameter lists made me feel like an idiot.

Consider, I have a person table, and one of the fields is an email address, named "Email." Well, not thinking perfectly well, I labeled the parameter that is being passed in "email" as well.

Oracle was perfectly happy with that.

Anyways, this Stored Procedure is designed to handle Insert/Updates for this Person table. Well with my parameter list the INSERT happens just dandy. Without a problem. But my UPDATE refused to put the new value into the column.

Ultimately, I realized that the stored procedure was ignoring my parameter on the update in order to have the table update the column with the value that is currently in there. Why, oh why wouldn't Oracle say "Hey, stupid, I don't know which value you want me to use, you've given me to variables named the same thing!" But no, unless I was paying close attention (and by the time I did my own testing, I missed it, and it only showed up in peer testing) I would have missed the fact that that single field of the Course wasn't updating.

Ah, just another reason why I love SQL Server over Oracle.

Monday, June 4, 2007

Michigan Man Fined $400 for Using Coffee Shop’s Wi-Fi Network

I just read this article over at Darknet.org.uk.

And frankly, it kind of scares me. I've been known to pull out my laptop and jump onto any network that I can log into. My wife has done it. I'm planning on buying a network-aware PDA soon, and would probably do it with that as well.

After all, in my point of view, it someone provides free access to something like that, I would assume that it was available for use. If they didn't want me to use it, then they should restrict it. If they want me to pay for using it, then they should provide a gateway where I have to enter payment for a timeblock.

To me, this is no different from parking at night outside of a business and opening up a book to read by the light provided from the lamps that the store provides in the parking lot. I didn't pay for that light, it's not mine, but the store is providing it without restriction.

Now, I guess I need to hunt through Florida's laws to see if there's a similar law down here.

Friday, June 1, 2007

Google Gears

All I've got to say is "Oh my stars and garters..."

Here's TechCrunch's article on this stuff, and here's the Google website for it.

I'm excited about this, and can't wait to see how well it works. Of course, now the question is do I learn Silverlight first or this first. Ack, decisions, decisions....

Thursday, May 31, 2007

Silverlight Learning Guide

SearchVB.Com has a whole host of information concerning Microsoft's Silverlight.

Such things as tutorials and blogs. Read about them here.

Wednesday, May 30, 2007

MS Surface

Oh, I'm so drooling over this: http://www.microsoft.com/surface/


I'd love to have an interface like that. I hope they become reasonably available in the very short term future.

Friday, May 25, 2007

Stored Procedures v. Inline SQL

One of my coworks loves his stored procedures, and this is the coworker that set up the SOP for my current project. Which of course means that everything is done using stored procedures.

And of course, this is also Oracle back end for a .NET front end which makes it even so much better.

Which of course means that I'm now writing lots and lots of stored procedures for Oracle to do even the simplest query such as straight SELECT by ID.

Now, I can see the benefits to using stored procedures, things such as not needing to recompile to make changes to your data access and less round trips to the data server.

Yet, I don't think that those benefits outweigh the costs of using them.

If I was using SQL Server, I could just open up the stored procedure in Visual Studio (especially 2005) and make the changes there. Yet, for Oracle I have to open the file in some other editor (or I could use VS) such as Notepad++ and then log into SQL PLUS. Make the changes in Notepad++ and then type this long string of characters to make the changes onto the server.

Frankly, I see nothing wrong with having inline SQL. It makes things easier to read and maintain.

And frankly, with things like SQL Server using JIT compilation in their 2005 version, it's not even that much of an decrease performance wise over stored procedures.

As for the editing of things. I have found that it's rare that I need to make changes to the underlying data stream and not make changes to the compiled code that uses that stream.

Now, do note that I'm not saying that we should abandon all stored procedures and use only inline SQL. That's just silly. There are things that would be insane to do using inline SQL just because of their complexity.

Yet at the same time, it's stupid to have an INSERT/UPDATE statement (or even worse, a simple SELECT) in a procedure just because you want everything to be stored procedures.

Monday, May 21, 2007

Still Elbow Deep In Oracle...

Well, I'm still struggling with the differences in Oracle and SQL Server.

I can admit that Oracle does have quite a few nice features to it. It's a great system.

Yet SQL Server beats it hands down as far as ease of use is concerned. Especially for those of us who don't use it on a daily basis.

For example, I want to find out what types are the columns of a given table. In SQL Server, I'd just open up either Server Explorer or Query Analzyer and lo and behold they'd be right there. Heck, I could even just connect VS 2005 to the database and have access to that data.

Oracle's SQL Plus? No clue. I'm sure there's some arcane SQL command to get that information, but I've yet to discover it on Google

UPDATE: I found out how to get that type of data. In SQL*Plus (Oracle's odd command window for stuff) you run the command DESC and it provides a description for the specified table (column name, type and if it allows nulls).

Oh well. I guess that's why they have the WEB Interface.

Thursday, May 17, 2007

Elbow Deep In Oracle...

My company is a MS shop. We use .NET and SQL Server on almost every project. It's the standard development environment that we keep.

So of course, we have a client that wants an Oracle backend.

So all day yesterday I was tripping over the differences between SQL Server (and Transact-SQL) and Oracle.

And there's a lot of little things that one can trip over. Such as:

  • Using := instead of = for assignments
  • Packages (and the @ command to run them)
  • That whole output from Stored Procedures thing
  • Using END IF rather than BEGIN/END around IF logic blocks
  • ELSIF rather than ELSE IF

And those are just the ones off the top of my head. I think what makes it the worst is the fact that ultimately they are so close to one another. It's like the difference between Java and C++. There's just enough similarities in the syntax to confuse you when you're switching back and forth between them.

Oh well, it's back to writing stored procedures for me.

Tuesday, May 15, 2007

Scratch

I'm often looking at ways to help my children succeed in this life. And of course one of those ways is making sure that they are proficient with a computer.

Imagine my joy when I discovered that some folks at MIT went out of their way to create a programming language focused on children.

It's called Scratch, and uses a graphical approach to developing the programs.

I'm interested in this, and think I'll grab it for my eldest son soon.

Of course, I also have to wonder if the language will 'grow' with the boy. After all, drag and drop programming blocks is one thing, but being able to code the concepts that those blocks represent is something else all together.

If Scratch (and it's associated IDE) can allow the blocks to degrade into smaller and smaller concepts as the child becomes more proficient with programming, then I'd be all excited about that. Well, apparently their site is currently down due to extra traffic from the BBC and DIGG, so I haven't gotten a chance to play with it, and find out the answers to my thoughts listed above. I guess I'll try again in a few days, and see if I can grab a copy then.

Monday, May 14, 2007

CogHead and other Miscellenia

A few weeks ago a webapplication building system came stumbling across my RSS Reader. It was an interesting company by the name of CogHead. I spent a few hours playing with it, and set myself up a Software Bug Tracking system. I like it as a concept, but am hesitant about the usefulness of the application. It's pretty and dynamic and I can create my own little application there in the website, but it's still slow.

I realize that it's a website, but just the creation process is tedious and seems to take forever-especially when you consider that it's built in FLASH. Likewise, what you're supposed to do with a screen while working on the UI or Data Layer is not always clear. In fact at one point, I managed to find a screen where I couldn't enter or modify data and I could actually make the screen go away. Since then I've not been able to replicate that, so I'm not sure if it was just something idiotic that I did or what.

I think I'm more interested in Silverlight (Microsoft's answer to Flash) and it's inherit support of the .NET Framework. On the downside, that's another plugin which will be slowing down my browser.

Then you have to add in Sun's new JavaFX.

Frankly, there's too much being released in too short of a time. I had just gotten comfortable using .NET 1.1 when 2.0 was released, and before I had even finished a single project in 2.0 then 3.0 was released. Additionally, MS has pushed out Expressions and Silverlight. It's enough to make the mind boggle, and as a poor developer I can't seem to catch up. I don't have enough time in the day to code, do family stuff, read, write and learn the onrushing tide of new technologies.

Oh well, such is the mysteries and hardships of being a developer.

Thursday, May 10, 2007

Still More Interfaces...

I know, I'm on an interfaces kick. Well, that's what I've been working on/with all week, so it's perfectly understandable.

Anyways, I'm building that interface system so that I can treat all my custom server controls for the project in the exact same way. Well, I came across the realization that I needed to be able to raise events. Basically, there's a specific framework in the application for displaying messages to the user in the same way for every message. Well, to get information from the depths of some of these controls, they were raising events.

And since I'm treating every control in the exact same manner, I can't make allowances that some controls will implement the event and not others. Therefore, the interface must declare the event.

Which ended up being surprisingly simple.

First I built the EventArgs class whose information is being passed back and forth for. Then after that I defined the delegate:

public delegate void DisplayMessageEventHandler(object sender, DisplayMessageEventArgs e);
Then after I had my delegate defined, I added in the event code into the interface :
event DisplayMessageEventHandler DisplayMessage;
Like I said, it was surprisingly simple.

Wednesday, May 9, 2007

Inheriting Interfaces

As I'm sure I said earlier, I'm currently going backwards and implementing an Interface on all the custom controls of one of our projects, and implementing even standard controls with this interface, to make things a tad easier to maintain and to shorten the code base a bit.

It was going happily along, until I stumbled across a set of classes one of which inherited from the other.

In C# that's not a problem, I wouldn't have ever even known. But of course, the project is in VB.Net and it threw up compiler errors. Apparently, in VB.Net you can't implement an interface in a class if a base class already implements the interface.

So, disturbed by this glaring problem in the VB.Net design, I went to our friend Google to find an answer. Much to my enjoyment (and almost amazement) Google actually provided an answer to my problem this time, and it was the top search return, so I could have even used the "feeling lucky" button.

Anyways, the return result was this article, entitled 'Re'implementing Interface Implementations: VB.Net vs. C#.

Glee! A solution has been proposed. And apparently it's the simplest solution possible. For VB.Net all one has to do is override the base class's method which implements the Interface's method and it's all good to go.

Tuesday, May 8, 2007

An Interface here, an Interface there....

I'm currently working on retrofitting an application which dynamically creates controls with an interface which allows those controls to be created even more dynamically.

Currently, we have a whole host of functions which deal with insatiating the controls and then getting the attributes for the controls and then even more dealing with saving and loading the data from those controls.

My solution to this maintenance nightmare is the interface. Using the ACTIVATOR object, and a couple of support classes, I've streamlined the process of creating these dynamic controls into something that takes a single function call for instantiating ALL the control types. And single high-level methods to do attribute assignments, loading and saving of data.

The magic is done via the fact that a lot of our controls are custom built server controls. So, we're already down in the low-level bits and pieces of the Framework and it's a simple matter of creating and implementing the interface.

What this does for maintenance, is make the controls even more of a blackbox than they were previously. Assigning the various attributes, is a matter of passing that data in a DataSet to a ReadOnly Property. Loading the data is giving a single specialized class to the control. And saving the data, is a matter of reading from a specialized collection from the control. Then the control itself is responsible for what happens with the passed in data.

Monday, May 7, 2007

SQL Server Express

As I noted in my last post, I inherited a new pc from a co-worker who quit. A beautifully quiet machine.

Well, at lunch the other day, I decided to do a little work on my freelance project. Not that big of a deal, it's an ASP.NET 2.0 website, and I keep a copy of all the data structures in a SQL Server Express database for development purposes. That way, I have my development system with me all the time (on a thumbdrive) and I don't have to worry about using my employer's bandwidth if I do work on it at lunch.

Imagine my surprise when I went to launch the thing in debug mode and it immediately collapses in error on a DropDownList's databind call.

So, I went home, it launched perfectly from home and everything worked perfectly.

Now, I was really confused. Well, I have a project I'm working on which uses a SQL Express database as a datastore. And lo and behold it fails to launch as well.

Getting angry, I tried to open the server up in the SQL Management tool only to get shot down there by some arcane error message.

And that's when I remembered that the machine was probably set up under my co-workers account. Which means that his corporate account is the one with permissions to the SQL Server running on this box. I have yet to test my theory (which as far as I can tell means uninstalling and then reinstalling the SQL Server 2005 toolset.

If anyone else out there has any other ideas on what can be done, I'll happily listen to them, as it will probably be Friday at the earliest before I have a chance to deal with this problem (the joys of getting ramped up on currently ongoing projects - even if you're one of the ones that laid the groundwork for the system).

Saturday, May 5, 2007

Nothing new to report...

I would have a witty story or something here. But I worked on corrections for an SDD for almost the entire time I was at work. Which of course wasn't long, as I took vacation time and went to see Spider-Man 3 and the company had a celebration for getting one of our major contracts to CMMI ML 3. Then cooking dinner and family time, followed by a trip to the store and then some odds an ends that I've been putting off to work on my freelance project, means that I didn't get any work done on my freelance project.

I did do a bit of help on one project, because of some stupid things Oracle did in their data access classes for .NET. I'll talk about that tomorrow though, it's too late at night for thinking about that right now. I don't want to get frustrated at Oracle, and not be able to sleep.

Friday, May 4, 2007

Silence in my office

I got a second LCD monitor for my office at work, so now I'm flying high with two of the things. They're quite nice and pretty and bright, and I'm enjoying them immensely. I also got a new PC. I had had the previous one for just shy of 3 years now. But what amazes me about this thing is that I can't hear it.

At all.

If I didn't know better I would swear this thing just doesn't have a fan in it or a heatsink, it's just that quiet. Of course that means I have to spend a decent amount of time reconfiguring the machine to work for me. I use a lot of custom settings in all the applications that I use on a consistent basis. But that's a fun all of its own.

Thursday, May 3, 2007

A Surprise for a Lead Software Engineer

The wife is sick this week - so I missed work Tuesday which postponed a meeting until this morning (well, technically, it was yesterday morning now, as it's well after midnight when I'm posting this). I was hoping that it would be a quick thing and she'd be back on her feet after having a day's rest - but she wasn't. So I had went down to the office for a quick meeting and after that took her to the hospital. Apparently she has a rather nasty kidney infection. She's on an antibiotic now, so hopefully she'll be feeling better real soon.

Anyways, my main project at work is now over. The deliverable was a number of requirement and design documents, with any coding we accomplished basically icing on the cake. What this means is that I get to spend a few more hours cleaning up my SDD and then it's off to another project.

Or a group of them at least.

One of my co-workers who's wife is about to have a child is lead Software Engineer for three ASP.Net projects. And I'm getting shoved over onto those projects. Which means that while he's out on 'maternity leave' that I get to do that lead Software Engineer stuff for those projects.

Yeah, go me.

Anyhow, the first of those projects has been running for a few years now, and has gone through three iterations on the underlying processing engine and two iterations on how it generates the end product. I was highly involved in the design and development of that processing engine - with the current thing being a series of dynamically created controls which query the user for information to generate the output, and all of this is happening on a single ASPX page.

It's a beautiful design and I'm quite fond of it.

Yet, there were certain requirements which made that solution viable for that product. First it was a Web Application not a Website. Secondly, it had a linear flow of data collection. Third, the user should always enter the application in the same way. And finally, the data is loosely coupled to the database.

What that last means is that there are no distinct data structures in the database that relate to a given page of the Web Application. All data is stored in the same data table, with the system not caring which page it came from.

Once the design was implemented, such a thought wasn't nearly as complicated as it sounds.

Anyways, the latest project's prototype (BlackBelt) is being built in a similar manner. More or less, a stripped down version of the first project's design.

Of course, while I was being briefed on BlackBelt, I pointed out the flaw in his thinking. Namely that the new project doesn't meet all the needs of a site which that design would be useful for. BlackBelt is not a linear data collection tool, it collects a certain set of data on a single page. That page would have no relation to any other page. Then the data structures in the database are tightly coupled to the pages (i.e. every page has a table or view which it directly reads/populates). Finally, the user may wish to enter directly to a single, specific page.

For example, if User A only uses Page 3, and that's the only page he ever uses, then he would want to create a link to Page 3. With the current engine, that is just not possible. There's only 1 page - and it requires PostBack information (the user selecting which page to view) for the application to know what controls to display. Basically, what that means is that for User A to get to Page 3 requires the user to hit two different pages of the application. That's not a good usability point right there.

Anyways, the point of my story is that as I was telling him that we shouldn't use my design for this application, his face kind of got that confused, deer-in-the-headlights look. Apparently, it kind of shocked him that I was telling him that it was a bad idea to use my design for this site, especially since I pushed him into using it's forerunners in the first two iterations of that first project.

Oh well, BlackBelt is just a prototype anyways. Created solely to derive requirements so we can build the real product.

Tuesday, May 1, 2007

Ajax.Asp.Net and Me...

Okay, I have to wonder what on earth I'm doing wrong with this thing. I have an Ajax.ASP.Net UpdatePanel and UpdateProgressPanel on an ASPX page. No, big deal - the runtime is supposed to handle all of that fun stuff automatically.

I made sure that I had my ScriptHandler and everything is situated the way it's supposed to be according to the documentation found on the website.

But it doesn't work.

Oh, I get the UpdateProgressPanel to display in Firefox - but Firefox has other issues with my dynamically created DIV's not doing what I expect them to.

So, of course, being the enterprising programmer that I am, I went and copied the code from the Ajax.ASP.Net documentation page for UpdateProgressPanels. Created a page on my site and tried it. Low and behold, it works perfectly.

So, now my new issue to discover is just how I'm screwing up the code. After all, it's not that complicated. This is what I have:

<form>
<asp:scriptmanager id="ScriptManager1" runat="server" enablepartialrendering="true">
<services>
<asp:servicereference path="getData.asmx">
</asp:servicereference>
</services>
</asp:scriptmanager>

<asp:updateprogress id="UpdateProgress1" runat="server">
<progresstemplate>
<img src="http://www2.blogger.com/images/loading.gif" alt="Loading..." align="texttop" border="0" /> <strong>Loading...</strong>
</progresstemplate>
</asp:updateprogress>

<asp:updatepanel id="UpdatePanel1" runat="server" updatemode="Conditional">
<triggers> <asp:asyncpostbacktrigger controlid="btnBack8" eventname="Click"></asp:asyncpostbacktrigger></triggers>
<contenttemplate>
</asp:updatepanel><div class="InnerContentArea" id="Back8Data">
<asp:label runat="server" id="lblBack8Data"></asp:label>
</div>
</contenttemplate>

<asp:updatepanel id="InsertEmployeeUpdatePanel" runat="server" updatemode="Conditional">
<contenttemplate>
<input runat="server" id="gameID" type="hidden">
<input runat="server" id="GameName" type="hidden">
<input runat="server" id="HighNumber" type="hidden">
<input runat="server" id="NumberDrawn" type="hidden">
<input runat="server" id="DrawsTableName" type="hidden">
<input runat="server" id="GameTypeID" type="hidden">
<input runat="server" id="Numbers" type="hidden"> </contenttemplate></asp:updatepanel>
</form>
Like I said, not that complicated. Yet for whatever reason, it's not behaving the way I would expect it to. In ASP.Net 1.1 controls inside the PANEL control were accessible but the controls that I place in the LOGINVIEW control I have to jump through hoops (well, ctrl.FindControl("ControlName") - which counts as a hoop) to get at it. I have to wonder if it is some arcane thing like that that is causing my issues.

Oh well, I think I'm going to go watch a movie rather than continue pounding my head over this.

Monday, April 30, 2007

Silverlight

This article just came across my RSS Feed. I was interested in Silverlight previous to this, but without .NET support on the backend, I thought it would not be worth the effort to learn or develop for. Well, Microsoft has done away with my only reason to not learn how to play with this new technology. I just hope that it will be natively easier to use for us lowly developers than Flash is.

According to the article it should be going gold sometime this summer - so I still have a few months left before I need to learn something brand, spanking new.

Success with the Dynamic Divs

Well at least partly. The last post here, I was complaining about the behavior of my drag/drop divs which I created from data returned from the web server. Well the Firefox behavior is still there and annoying.

But the IE behavior I seem to have figured out.

I was using the command DIV.setAttribute("class", "MyDivClass"); to set the class attribute. That command works in Firefox - but apparently not in IE. IE requires DIV.className = "MyDivClass";.

Just one of those small annoyances which is the difference between IE and Mozilla browsers. Frankly, I'm scared to open the site in Opera to see what happens.

Monday, April 23, 2007

Dynamically Generated Divs

For my freelance project, I'm creating a bunch of HTML DIV elements and using Prototype and the Scriptaculous JavaScript library making them Drag/Droppable.

Not a big deal, and the DIVS are being generated - and even drag/drop. But of course there are some errors. And of course, it's different ones for FireFox and IE.

In IE, the classes that I associate with the DIV aren't being applied for whatever reason. Of secondary issue is that since the class is not being applied, the DIV that the elements are dropped into is not registering it as a drop.

In FireFox, when I drop the dynamically created DIV onto the DIV that accepts it, the dynamically created DIV reverts to the top left corner of the page rather than the place where I had gotten it out from.

So, I get to do a decent amount of research in the upcoming short term. Yeah me.

Friday, April 20, 2007

Back to Documentation

I never thought that I would enjoy getting back into a bit of documentation.

But that's what's happened.

Basically, I got some feedback back on the lowest of my design documents (DBDD & SDD), so I put off the research into getting the library working with .NET and jumped back into documentation mode. I've never been so happy to open up a Database Design Description. Monday I get to play around with fixing my SDD - and with the sheer number of screw-ups I made there, I'll probably be doing that until I'm so worn out of documentation that I can jump back into the research/coding thing.

Monday, April 16, 2007

Prototype.js

For my freelance project, I'm using the PROTOTYPE JavaScript library as a means to enable AJAX functionality easily into my website.

But for whatever reason - the functionality pretty much refuses to behave properly. I'm not sure if I'm doing something wrong, or if there's a problem with my configuration of FireFox or if it's something inherently hard about Prototype.

All I know is that I don't need this much hassle - so what I'm going to do is kill the AJAX aspects of the pages, and make it a traditional web application. At least until I get the system working and stable. Then I can go in and layer in AJAX functionality on top of the website to make it more responsive and like a desktop client.

I'm just bothered by the whole hassle of the thing.

Friday, April 13, 2007

I'm Starting to Hate C++.Net

My main focus at work is merging some C .LIB precompiled libraries into a form that can be used by my VB.NET GUI.

One would think that this would be a simple, straightforward process.

Maybe if I knew more about C++ it would be. But as it stands, it's nothing more than a comedy of errors and hassles, designed to drive me batty.

The latest issue is I've got a string, and I'm trying to move the string from HEX to BINARY. Not a big deal?

.... yeah right.

I'm getting a System.ArgumentException complaining about a pointer being in the bottom 64K of the process's address space.

I have no clue how it got there - nor how to get it out.

Go, Microsoft on that one.

I must share!

Today I stumbled across this wonderful little selection of useful tidbits for MS Word. It's a beautiful discussion on how to turn off some of the more annoying 'features' of MS Word - such as documents opening from email attachments in the "Reading Layout."

The usability of MS Word just went up a notch for me.

Tuesday, April 10, 2007

ASP.Net Development Server & Style Sheets

I'm developing my freelance web application using Visual Web Developer Express at the house. And though I do have a full fledged Web Server running IIS I could develop on, I prefer having the actual development being done on my box and then I routinely push the changes out to the website so that my partner can view a stable version of the software.

Not a big issue. It's a good paradigm.

Well it would be, except for whatever reason, the built-in development server is reporting that my style sheets have a mime type of TEXT/HTML rather than TEXT/CSS. The friendly Error Console in FireFox is reporting this:

Error: The stylesheet http://localhost:2877/Lotto/login.aspx?ReturnUrl=%2fLotto%2fcorners.css was not loaded because its MIME type, "text/html", is not "text/css".
Source File: http://localhost:2877/Lotto/login.aspx?ReturnUrl=%2fLotto%2fdefault.aspx
Line: 0
And while once you get logged into the system, it's not a problem - prior to that, when TEXT/HTML files are restricted, it means that none of my pretty styles are showing up for the login screen. And it's not just the VWDE that I'm using at home - it's also my Visual Studio Professional at work. At lunch the other day, I tried it and came up with the same results of CSS being misreported as the wrong MIME type.

And it gets better. Even external JavaScript files are doing something flaky:

Error: syntax error
Source File: http://localhost:2877/Lotto/includes/prototype.js
Line: 3
Source Code:
Google, Asp.Net, MSDN and Google Groups are, of course, utterly unhelpful with this particular issue.

Of course, while I was building my little blog entry here, I realized what was truly happening.

I had disabled the ability for things to be retrieved from the web server without authentication. Which meant, any request prior to the user being logged into the system would be met with the login prompt. Which meant that I was trying to load in my LOGIN page in my style sheet & script tags.

It's at times like these that I feel utterly brilliant.

Anyways, moving my stylesheets to my INCLUDES folder and then adding in the following to my web.config solved my problem.

<location path="Includes">
<system.web>
<authorization>
<allow users="*">
</allow>
</authorization>
</system.web>
</location>

Now, if only I had the time I spent trying to figure this out back. Though I guess, that's what I get for not paying close enough attention to the message that Error Console is reporting to me.

Monday, April 2, 2007

C Libraries and .NET

This is still insane. I spoke early last week about .NET and my C Library problem - which is the root cause of me not having any spare time to blog about programming and have discovered a bit more.

If I run the library directly through a C++.Net Console application it works without a problem. But if I try to use the DLL version even in the Console application it gives me the NULL REFERENCE exception.

The only thing that makes sense to explain this issue is that since the DLL version uses a class as a container for the various methods where I pass data to/from the library in a "managed" way this is setting aside a certain bundle of memory for the library. Which the library tries to get outside of by doing a MALLOC call, and thus resulting in the NULL REFERENCE exception.

So I'm faced with three possibilities (excluding retiring the project, which is a decision I can't make):

  1. Rewrite the libraries in a .NET language
  2. Write a C++.Net console application and call that from the VB.Net GUI when I need to do something - passing data through the command line and file I/O
  3. Write a Windows Service in C++.Net and pass data to/from the service via the Message Queues
Option 1 was shot down in an earlier meeting - but it's always there. So that leaves us with options 2 and 3.

Now, I can admit it's been years since I've done any serious C++ programming. Not since I graduated college - it's an atrophied skill as my job is a VB shop. The closest I've come is a bit of C# programming when the task I need/want to do is easier to implement there than in VB.

So with that in mind, I came up with this table to determine which of the last two options I should consider.

Service

Console

About

Use a Windows Service and Message Queues to send/receive data

About

Use either a series of task-specific console applications or a single console application with task flags. Use VB.Net to launch those applications and feed in parameters on the command line. Output saved to a file which the VB.Net application then reads in.

Pros

· Simpler to maintain than a series of task specific applications

· Can pass well-defined data easily through the message queues

· No File I/O

Pros

· Easier to develop

Cons

· Harder to code

· More complex system

Cons

· Memory Intensive from launching all the small applications

· Slow due to File I/O

Need to Learn

· Coding windows service in C++.Net

· Using Message Queues in C++.Net

Need to Learn

· How to launch other applications within VB.Net via its internal scripting system

· Refresh how to pass arguments into a console application via the command line when the system begins executing

Blog Widget by LinkWithin