CLSA.Net on DotNetRocks#

I am going to be getting Rocky Lhotka's new book, which is available in ebook form before he comes to speak at the CNUG group in DG.

In addition, he has taped 2 sessions with DotNetRocks available here and here.

I'm watching one of them now.

Categories: Web Site Links
Sunday, April 09, 2006 5:29:56 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Testing Trackback / Image / File / Google filters.#

With this post I am testing out some features of dasBlog.

I am linking to a Trackback faq page by Shai Coggins seen below thanks to the upload image feature (not bad eh?).



It looks like dasBlog just throws these uploaded images into a single folder, which I guess means I could overwrite a file if 2 were uploaded with the same name.  Lemme try...

Yep, it overwrote it.  I guess I will have to be careful about that possible occurance.

On to the file upload option:

Sequencediagram_1.png (1.84 KB)

Interesting, thats pretty cool.

The last thing to test is the content filter ability.

This seems a bit much, you type in a bunch of code and it will output some standard string.  For example, this should produce a google search: chrismay and this should produce an IMDB search: $imdb(The Matrix).

Here goes...

Update
Well it seems that everything worked pretty well except maybe the trackback isn't working.  The URL for the trackback appears to not be saved when I save this article, but maybe that is by design.  I will have to look into it.  I posted a comment on the article I was trying to trackback... maybe that output is cached and it will show up later (?), doupt it.  Here is the article I am dealing with.

Categories: Blogging
Sunday, April 09, 2006 4:23:54 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

Indents Fixed! #

Well a little tweaking of the code that does the generation of the formatted code, and it now produces what I want:

        Public Shared Function AddTOQueryString(ByVal URL As String, ByVal Key As String, ByVal Value As String) As String
Dim RegExp As New System.Text.RegularExpressions.Regex(Key & "=.*?(&|$)")
Dim Match As System.Text.RegularExpressions.Match = RegExp.Match(URL)
If Match.Success Then
Return RegExp.Replace(URL, Key & "=" & Value & Match.Groups(1).ToString)
ElseIf URL.IndexOf("?") > 0 Then
Return URL & "&" & Key & "=" & Value
Else
Return URL & "?" & Key & "=" & Value
End If
End Function
        /// <summary>Gets or sets the RSS version to write.</summary>
        /// <exception cref="InvalidOperationException">Can't change version number after data has been written.</exception>
        public RssVersion Version
        {
            get { return rssVersion; }
            set
            {
                if(wroteStartDocument)
                    throw new InvalidOperationException("Can't change version number after data has been written.");
                else
                    rssVersion = value;
            }
        }

I am not sure that I like what it does with literal strings.  I will probably want to change that.

I am also now convinced that it will not due for formatting Javascript.  J# just doesn't share enough similar attributes.  This tool also doesn't support XML (or HTML), which would be a nice thing too.

This converter looks pretty sweet.  You can include your regions and it will let you keep them collapsed and then expand via javascript, excellent.

I could also just wire up the implementation I already have to deal with HTML and Javascript.

We will see... for now this will do.

Categories: Blogging | VB.Net
Sunday, April 09, 2006 12:51:00 AM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

HttpFilters, HttpModules, and HttpWastedABunchOfTime#

I was just about to make a post talking about the switch over to dasBlog.  I was going to talk about what I liked and didn't like and whatever, but mostly I was going to talk about the work I have been putting in on writing code that will filter out code and format it nicely.

I wrote and tested an HttpModule which loads a Reponse Filter that parses the Html looking for <code> tags and formats the code inside those nicely.

So I go to write my first post, and I am looking for a hyperlink button in the texteditor, but instead I see this icon that look like a C# file.  "No, I did not just waste all that time" I thought. 

public bool IsTimeWasted(String name){
    return true;
}

Public Function IsWasted(ByVal time As TimeSpent) As Boolean
  If time IsNot Nothing Then
    Return True
  Else
    Return False
  End If
End Function

var s;
s = 'asdf';
document.getElementById("asdf"); /* comment */

SELECT * FROM
ThingsToDo
WHERE
WastedTime <> 1
AND
Task = 'Writing HttpFilter'


0 rows returned

So you can see I basically wasted my time doing all that.

This tool doesn't provide an HTML code type, and I used J# in place of Javascript, but it works ok I guess.

The on thing it is really lacking is that it doesn't maintain indents!?!?  I manually restored the indents above, otherwise my vb code would look like this:

Public Function IsWasted(ByVal time As TimeSpent) As Boolean
If time IsNot Nothing Then
Return True
Else
Return False
End If
End Function

Which is weird, b/c it looks fine in the preview window... I will have to look into that.

 

 

Categories: Blogging | Code Link | VB.Net
Saturday, April 08, 2006 7:54:09 PM (Central Daylight Time, UTC-05:00) #    Comments [0]  | 

 

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]  | 

 

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: