My Blog

Jan31

Written by:Philip Beadle
Saturday, January 31, 2009 1:35 PM 

I have been looking for a good way to add code to my blogs and Charles put me onto this.  So this is what code looks like in the DotNetNuke blog when added with the Insert Code for Windows Live Writer plugin.

Bit of C#

   1:static bool IsPhone(string s)
   2:{
   3:// TODO: Add regular expression matching
   4:return Regex.IsMatch(s, @"^\(?\d{3}\)?[\s\-]?\d{3}\-?\d{4}$");
   5:}
   6: 
   7:static bool IsZip(string s)
   8:{
   9:// TODO: Add regular expression matching
  10:return Regex.IsMatch(s, @"^\d{5}(\-\d{4})?$");
  11:}
  12: 
  13:static string ReformatPhone(string s)
  14:{
  15:    var m = Regex.Match(s, @"^\(?(\d{3})\)?[\s\-]?(\d{3})\-?(\d{4})$");
  16: 
  17:return String.Format("({0}) {1}-{2}",m.Groups[1], m.Groups[2], m.Groups[3]);
  18:}

Nice isn’t it :)

And some VB..

   1:Private Sub InitializeTree()
   2:            CategoryTree.IndentWidth = 10
   3:            CategoryTree.CollapsedNodeImage = ResolveUrl("~/images/max.gif")
   4:            CategoryTree.ExpandedNodeImage = ResolveUrl("~/images/min.gif")
   5:            CategoryTree.PopulateNodesFromClient = True
   6:End Sub

Beautiful.  Now to write some code worth bloggin’ about.

Looks better on my DNN blog, so about time I built a new skin for this site. 

Tags:

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
CAPTCHA image
Enter the code shown above in the box below
Add Comment  Cancel 
DNN Template Maker

Artisteer - Web Design Generator

  
UsersOnline
MembershipMembership:
Latest New UserLatest:andpro
Past 24 HoursPast 24 Hours:0
Prev. 24 HoursPrev. 24 Hours:0
User CountOverall:32

People OnlinePeople Online:
VisitorsVisitors:13
MembersMembers:0
TotalTotal: 13

Online NowOnline Now:
  
Talk to me
  
Good Books
My Logos


MVP Logo
From: 2004-2009

Lorraine Young's DNN Site

DotNetNuke Sponsor and Platinum Benefactor logo

 Microsoft ASP.net logo

microsoftcertifiedprofessional.gif

vicnet_logo.gif