RSS

Monthly Archives: July 2010

Dynamic Reapeaters (ASP.NET)

Dynamic.  In the client/server model you wouldn’t get very far serving up all of your clients the same thing… unless it was the most amazing thing ever.  Even then, the most amazing thing ever would get old and dropped for your competitor’s most amazing thing ever.

If you haven’t caught on, I’m building up to the reason for server side languages such as asp/php/jsp. Most of the time these pages are querying a back end database and serving up a small selection of the data to the end user.  With a neatly designed query, you can serve up this data in a relatively easy manner using asp.net repeaters.

When you query a table in SSMS you get a grid back that looks plain but in reality has a few helpful design characteristics.  These don’t magically happen in ASP.NET out of the box.  When you execute a query you have this invisible dataset that you have to somehow present to your user.

Lets start with executing the query.  The best practice would be to filter the results using SQL clauses (where = etc.) and not in ASP.   Design the query so the exact data in the correct order comes back in the plain SSMS grid just how you want your user to see it. At this point it would also be a good idea to “SELECT columnname as Friendly Column Name” so you can use that when presenting your data.

You can take advantage of 3 elements to the repeater control which are header, footer and item.  You can dynamically populate the header control with the actual result set column names.

This code sample uses XML instead of a SQL table but as far as repeaters go it’s a good beginner example.

http://www.w3schools.com/ASPNET/aspnet_repeater.asp

I repeat, your looking at a beginner example for at least two reasons.  One, they are using tables instead of CSS.  And the second reason is, columns are statically defined and bound.  If you decided to add a column to your search results you would have to update two lines of code instead of zero.

<th>Title</th>

<td><%#Container.DataItem(“title”)%></td>

But how? So in the advanced example you would write a loop something like this pseudo code.

<HeaderTemplate>
<table>
<tr>
For each c in columns

<th>%c%</th>

end for

</tr>
</HeaderTemplate>

And do the same for the binding lines and presto chango, you have a dynamic dynamic website.

 
Leave a comment

Posted by on July 28, 2010 in Uncategorized

 

mail eaters

No not your dog, I’m talking about a program that processes received email messages. Mail eaters often solve integration problems between programs.  You setup an account to receive an email from program A only to process the contents and pump the data into program B.  This is all well and good except for one thing… the disconnect.  Say your mail eater goes down for days, sure maybe you still have all the emails from program A but program B has been deprived of data. Program A needs a way to verify that the message has been processed.

The solution:

Program A needs a response code to verify that program B finished processing the message.  Unless you have dueling mail eaters this verification is never done.  A more effective way to perform this integration was asked for and web services were the response.  A web service is simple a function or set of functions that you can call from code just as if it were in your own application.

A problem with the solution?

But what if program B gets caught in a loop?  Now you have two programs down and not just one.  I have actually experienced someone claiming this is a problem and purposed program A should not wait for the response code.  What a croc, and the perfect way to send us back to the 90s.

 
Leave a comment

Posted by on July 26, 2010 in Uncategorized

 

we have liftoff

But you work on a computer all day, why would you want to waste your valuable free time setting up and posting to some stupid blog?

The answer is my time isn’t that valuable… yet.  What better activity could I be doing? dishes? mowing the lawn? Its all about the opportunity cost and right now I find value in all that is this blog.

nujakcities is a combination of an old college nickname “nujak” and geocities.  I am sure some of you remember geocities, the late, great ad based free web hosting.  What you are viewing now is a culmination of my efforts to get the internet to exist in my basement for little to no additional cost (yes even opportunity cost).

In short, it went something like this:

1. got an old junker pc from work for 40$

2. install xp and wampp

3. site up

4. get tagged for software piricy

5. no more windows updates… site down

6. install debian

7. site up but not fully functional, can’t get users and permissions to work

8. site down

9. install ubuntu server

10. install apache/php/mysql

11. enable ftp

12. enable ssh

13. upload dustinandmandy.net (hurray test site works)

14. install word press

I hope that I find myself reading this in 5 years and feel satisfied that I was able to accomplish such a feat.

 
1 Comment

Posted by on July 24, 2010 in Uncategorized