dasBlog conversion complete#

Well I have switched over to dasBlog.

Awww crap.  I need to start a new post...

Categories: Blogging
Saturday, April 08, 2006 6:15:43 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

HttpFilter and HttpModules#
Here is another article on the topic, but they cover the use of an HttpModule instead, which is supposed to make it so you don't have to manually install the HttpFilter in your code.
Categories: ASP.Net
Thursday, April 06, 2006 8:50:10 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

dasBlog and httpfilters#
Apparently there is a cool blogging app called dasBlog, which means "That Blog" in German :), that provides a lot of better features when compared with my old blogX, and even better it provides a direct upgrade from blogX, so I don't have to write my own scripts to do the conversion to what I was going to use (newblog on DNN).

The downside is that I had already written the necessary code to parse and replace ... well... "code"... in my blog posts into pretty formatted HTML.

It worked like this... I would type something like [code type=vb]Dim s as New System.Text.StringBuilder [/code] and it comes out looking like:
Dim s as New System.Text.StringBuilder 

So that is pretty cool... but I think I can get the same result, and maybe make it even cleaner, by using an httpfilter.

HttpFilters are registered at application startup and are sent the html just before it gets passed to the browser, so you can use the filters as like a last change modification mechanism. Hopefully I can write some regexps to parse out what I want and replace it with the new stuff.
Categories: Blogging
Thursday, April 06, 2006 8:41:25 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Format String#
The following content has been cut and pasted from Kathy Kam's Blog. The article was Format String 101.


 

I see stuff like {0,-8:G2} passed in as a format string. What exactly does that do?" -- Very Confused String Formatter

The above format can be translated into this:

"{<argument index>[,<alignment>][:<formatString><zeros>]}"

argument index: This represent which argument goes into the string.

String.Format("first = {0};second = {1}", "apple", "orange");

String.Format("first = {1};second = {0}", "apple", "orange");

 

gives the following strings:

 

"first = apple;second = orange"

"first = orange;second = apple"

 

alignment (optional): This represent the minimal length of the string.

Postive values, the string argument will be right justified and if the string is not long enough, the string will be padded with spaces on the left.

Negative values, the string argument will be left justied and if the string is not long enough, the string will be padded with spaces on the right.

If this value was not specified, we will default to the length of the string argument.

 

String.Format("{0,-10}", "apple");      //"apple     "

String.Format("{0,10}", "apple");       //"     apple"

format string (optional): This represent the format code.

Numeric format specifier is available here. (e.g. C, G...etc.)
Datetime format specifier is available here.

Enumeration format specifier is available here.

Custom Numeric format specifier is available here. (e.g. 0. #...etc.)

 

Custom formatting is kinda hard to understand. The best way I know how to explain something is via code:

 

int pos = 10;

int neg = -10;

int bigpos = 123456;

int bigneg = -123456;

int zero = 0;

string strInt = "120ab";

 

String.Format("{0:00000}", pos);      //"00010"

String.Format("{0:00000}", neg);      //"-00010"

String.Format("{0:00000}", bigpos);   //"123456"

String.Format("{0:00000}", bigneg);   //"-123456"

String.Format("{0:00000}", zero);     //"00000"

String.Format("{0:00000}", strInt);   //"120ab"

String.Format("{0:#####}", pos);      //"10"

String.Format("{0:#####}", neg);      //"-10"

String.Format("{0:#####}", bigpos);   //"123456"

String.Format("{0:#####}", bigneg);   //"-123456"

String.Format("{0:#####}", zero);     //""

String.Format("{0:#####}", strInt);   //"120ab"

 

While playing around with this, I made an interesting observation:

 

String.Format("{0:X00000}", pos);      //"A"

String.Format("{0:X00000}", neg);      //"FFFFFFF6"

String.Format("{0:X#####}", pos);      //"X10"

String.Format("{0:X#####}", neg);      //"-X10"

 

The "0" specifier works well with other numeric specifier, but the "#" doesn't. Umm... I think the "Custom Numeric Format String" probably deserve a whole post of it's own. Since this is only the "101" post, I'll move on to the next argument in the format string.

 

 

zeros (optional): It actually has a different meaning depending on which numeric specifier you use.

 

int neg = -10;

int pos = 10;

 

// C or c (Currency): It represent how many decimal place of zeros to show.

String.Format("{0:C4}", pos);      //"$10.0000"

String.Format("{0:C4}", neg);      //"($10.0000)"

 

// D or d (Decimal): It represent leading zeros

String.Format("{0:D4}", pos);      //"0010"

String.Format("{0:D4}", neg);      //"-0010"

 

// E or e (Exponential): It represent how many decimal places of zeros to show.

String.Format("{0:E4}", pos);      //"1.0000E+001"

String.Format("{0:E4}", neg);      //"-1.0000E+001"

 

// F or f (Fixed-point): It represent how many decimal places of zeros to show.

String.Format("{0:F4}", pos);      //"10.0000"

String.Format("{0:F4}", neg);      //"-10.0000"

 

// G or g (General): This does nothing

String.Format("{0:G4}", pos);      //"10"

String.Format("{0:G4}", neg);      //"-10"

 

// N or n (Number): It represent how many decimal places of zeros to show.

String.Format("{0:N4}", pos);      //"10"

String.Format("{0:N4}", neg);      //"-10"

 

// P or p (Percent): It represent how many decimal places of zeros to show.

String.Format("{0:P4}", pos);      //"1,000.0000%"

String.Format("{0:P4}", neg);      //"-1,000.0000%"

 

// R or r (Round-Trip): This is invalid, FormatException is thrown.

String.Format("{0:R4}", pos);      //FormatException thrown

String.Format("{0:R4}", neg);      //FormatException thrown

 

// X or x (Hex): It represent leading zeros

String.Format("{0:X4}", pos);      //"000A"

String.Format("{0:X4}", neg);      //"FFFFFFF6"

 

// nothing: This is invalid, no exception is thrown.

String.Format("{0:4}", pos));      //"4"

String.Format("{0:4}", neg));      //"-4"

 

In summary, there are four types of behaviour when using this <zeros> specifier:

Leading Zeros: D, X

Trailing Zeros: C, E, F, N, P

Nothing: G

Invalid: R, <empty>

 

Now, that we've gone through the valid specifiers, you can actually use this in more than just String.Format(). For example, when using this with Byte.ToString():

 

Byte b = 10;

b.ToString("D4");      //"0010"

b.ToString("X4");      //"000A"

 

Wow... this was way longer than I expected. The BCL team is having blog day today, I need to get back to posting something for the BCLWeblog.

<Editorial Comment>

One of the lesson I learnt from an earlier post is that, readers are not interested in a post that doesn't give you more information than what MSDN provides. Instead, readers are more interested in seeing stuff that are not available on MSDN. So when I was doing research to post about this topic, I found that MSDN actually talks about exactly what the {0,-8:G2} format does. It is just not easy to find nor centrally located.

For example, in the ToString MSDN Doc, the "Remarks" section covered some basic rules on what a "format string" is. In the String.Format MSDN Doc, the "Remarks" section actually have a pretty detail explaination of what the above format does. Furthermore, MSDN provides a format string overview as well as a the table that specifies all the values that are allowed.

This puts me in an interesting position when writing about this topic. MSDN actually have lots of info that cover it. But since I have also heard more than one person being confused about this topic, I decided to post a summary of the documents and more examples. Do you think this is useful? Should I just stick to posting exclusively on non-MSDN topics?

</Editorial Comment>

Categories: T-Sql
Wednesday, April 05, 2006 11:50:22 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Death of Dime (and WS-Attachments)#
DIME and WS-Attachments are basically dead.

MTOM (SOAP Message Transmission Optimization Mechanism) has shown up on MSDN (xml messaging page), and DIME, SwA, and PASwA are marked as superseded.

I have seen some places describing MTOM as basically the same thing as XOP (XML-binary Optimized Packaging), not sure if that is true or whatever, but it seems the message is clear: DIME is yesterdays news.
Categories: WebServices
Wednesday, April 05, 2006 11:08:14 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Some options for converting DATETIME in SQL to different formats using CONVERT()#
To see the effects, just run this script against your database:

PRINT '1) HERE IS MON DD YYYY HH:MIAM (OR PM) FORMAT ==>' +
CONVERT(CHAR(19),GETDATE()) 
PRINT '2) HERE IS MM-DD-YY FORMAT ==>' +
CONVERT(CHAR(8),GETDATE(),10) 
PRINT '3) HERE IS MM-DD-YYYY FORMAT ==>' +
CONVERT(CHAR(10),GETDATE(),110)
PRINT '4) HERE IS DD MON YYYY FORMAT ==>' +
CONVERT(CHAR(11),GETDATE(),106)
PRINT '5) HERE IS DD MON YY FORMAT ==>' +
CONVERT(CHAR(9),GETDATE(),6)
PRINT '6) HERE IS DD MON YYYY HH:MM:SS:MMM(24H) FORMAT ==>' +
CONVERT(CHAR(24),GETDATE(),113)

Categories: T-Sql
Tuesday, April 04, 2006 9:10:48 AM (Central Daylight Time, UTC-05:00) #    Comments [1]  | 

 

How does Vista change IIS and P2P apps (WCF)#
This article on MSDN talks about what Vista changes when it comes to IIS and P2P apps (WCF or Indigo as I would rather call it but MS idiots changed it to WCF, which makes me say WTF).
Categories: Windows
Friday, March 24, 2006 7:31:00 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Troubleshooting .NET Applications - Knowing Which Tools to Use and When#
This whitepaper: Troubleshooting .NET Applications - Knowing Which Tools to Use and When talks about different methods for debugging .net applications, and talks about the various tools available to aid in the debugging efforst.
Categories: .Net Framework | Tools
Friday, March 24, 2006 7:27:28 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Best Practices for Problem Resolution and Production Support of .NET Applications#
This Whitle Paper discusses some of the well defined practices for supporting and scaling .net applications.
Categories: .Net Framework
Friday, March 24, 2006 7:26:15 PM (Central Standard Time, UTC-06:00) #    Comments [2]  | 

 

IIS and ASP.NET#
This article talks about how requests are dealth with by IIS and ASP.NET, and how after requests are passed to ASP.NET, how they are handled internally by various httpHandlers.
Categories: ASP.Net | IIS
Friday, March 24, 2006 7:24:08 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Project References vs. Assembly References#
In our current applications we are using Assembly References so that you can load up a project without needing to load up every project it references, and all the ones that they reference and on and on.

However MS suggests that you use Project References whenever possible, so I think when we cut over to TFS we will be switching to project references.
Categories: Code Links
Thursday, March 23, 2006 4:41:08 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

SqlDependency#
I am at a Developer event at Microsoft right now, and the presenter just talked about some a way to setup a dependency on some data from sql server.

He didn't go over it much, but it is something I should look into a bit more.

I would guess it needs to poll the DB or something, will be interesting to see how it works.
Categories: Code Links
Thursday, March 23, 2006 2:06:12 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

The Geico / Google Joke#
A while back there was a lawsuit filed by Geico against Google.

They were angry that when people typed in Geico into Google, ads for car insurance would show up on the right under the google adwords program.

I thought this was funny, so I quickly placed an ad for the keyword "Geico," and some guys from this website http://truckandbarter.com/mt/archives/2004/12/geico_sues_goog.html immortalized my joke with the following screen capture:

Categories: Funny
Thursday, March 23, 2006 10:20:22 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

QotSA#
I need to remeber to order this.
Categories: Cool | Movies | Music
Sunday, March 19, 2006 12:47:00 PM (Central Standard Time, UTC-06:00) #    Comments [2]  | 

 

MP3s#
This website is awesome.

I have been telling everyone about it, but I guess not many of them are downloading yet. Oh well I think its the best.
Categories: Misc
Thursday, March 16, 2006 12:52:38 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Back to school#
Over the winter I was accepted into the graduate school of the University of Chicago, which may I please point out, is not UIC.

I am pretty excited about going to such a prestigious school. Northwestern is the only other school in the area who can compete with U of C, but they don't offer a Masters program for Computer Science, U of C was the only place I applied to. I attended the DePaul open house but left feeling very unimpressed. For example, DePaul has "Web Programming with ASP.NET", U of C has "Object Oriented Architecture and Design Patterns" (a great class). The course on parallel computing will get students access to the super computer facility at Argon Nation Labs. How sweet is that?

Anyway, it isn't going to be easy with all the work I have going on, but if I don't do it now I may never get back to it.

And I feel so inferior to my wife with her Masters degree! :)
Categories: Misc
Thursday, March 16, 2006 12:51:13 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Returning Business Objects from .NET Web Services#
There are times when it would be nice to pass a business object over a webservice and consume it on the other side.

This is made somewhat complex by microsoft auto generated proxy system that builds a stripped down version of you object for the client to consume.

You can manually go in and modify the proxy class files, which is what I had done, but now there are some other options available to you to achieve this. This article talks about how you can get customize the proxy creation, so that you can auto generate your proxies whenever you want, and you won't lose your custom code.

Here is another possible solution. But the latter link looks like it is doing a lot of mapping with the use of a wrapper class. A lot more work that I would want to do probably.
Categories: Code Links
Thursday, March 16, 2006 12:43:31 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Unit testing of Data Access Layer code#
One of the parts where Unit testing seems to fall apart, or become a giant pain at least, is in applications or parts of applications that rely heavily on data access from a large relational database like sql server.

You run some operations against the database and end up with a result set. Is that result set right? Ok it looks good, now what? Well some people would say that you should restore the DB to the point before you started this last test. This can be very painful if you are trying to run hundreds, or even simply dozens of tests.

In this article on MSDN the author goes over some options for avoiding the use of database restore. There is some talk about using mock objects in conjunction with NMock, which of course Fowler would like to remind you aren't stubs, but the majority of the article focuses on the use of DTC to rollback changes made in each test teardown.

I had some problems getting DTC to run across machines, but it worked great locally, so there was some success in my tests.
Categories: Code Links
Thursday, March 16, 2006 12:37:19 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Finally an update#
Well we completed the move a while back, but getting updates to my site was not a very high priority for me, but I figured it was time.

Aside from all the crap with moving the house, I have been working a ton, and so has Kathleen. On top of that I have started back going to school for an MS in CS from UC, OK? But that is another blog post.

More to come.
Categories: Misc
Thursday, March 16, 2006 12:24:28 AM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

Synchronizing the ASP.NET Cache across AppDomains and Web Farms#
This article covers an interesting topic that has shown itself in my current project: using the Cache across appdomains and web farms.

In the end his solution is basically to create a mechanism to write out cache information to files that each app domain watches for changes (or so I gleamed from glancing over it) but in our case we are storing little bits and pieces and not large things. In other words, the added overhead of reading/writing to the filesystem would probably eliminate the benefit of using the cache for our application.
Categories: Code Links
Tuesday, December 06, 2005 8:36:20 PM (Central Standard Time, UTC-06:00) #    Comments [0]  | 

 

All content © 2010, Christopher May, Inc
Open Job Positions
On this page
Google Ads
This site
Calendar
<April 2006>
SunMonTueWedThuFriSat
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456
Archives
Sitemap
Blogroll OPML
Disclaimer

Powered by: newtelligence dasBlog 2.3.9074.18820

The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

Send mail to the author(s) E-mail

Theme design by Jelle Druyts


Pick a theme: