October 2003 - Posts
30 October 2003
doh...
So, there you are...sitting somewhere with the woman of your dreams...or perhaps about to win your the game you've been playing for 48 straight, whatever...just plug in your dream situation. then it hits you...FUCK, I WROTE THAT CLASS WRONG!!! that is just what happened to me, except i was in the middle of a seinfeld episode i had never seen before (yeah, i am lame) so, i wrote that singleton object that exposes all the elements of a config file via static properties...DOH! that was the wrong way to do it! erase all of the static keywords in AppConfiguration, and replace any calls to the singleton class w/ AppConfiguration.Getconfig (the previous way was simply AppConfiguration.[whatever]... live and die by the code j
Read More...
30 October 2003
Ramblings...
how are we american programmers getting displaced by thousands by foreigners? if they program in VB, they almost have to learn the entire english language just to use it! ok, that was a cheap shot...but still... come on america...step it up! where else can you not work for pennies a day living in a shanty and be grateful for every second of it! whatever j
Read More...
29 October 2003
T-SQL nightmares...
So, i've been given the task of scrubbing some data for a group at my work. apparently they have about 50 records w/ either invalid zip codes or invalid SSN's. writing regular expressions in C# is a snap, however i have to load this data into an excel spreadsheet, so it would be a lot easier to try and validate the data on the server with T-SQL. have you ever tried to do string parsing with T-SQL? there is absolutely no way to check and see if it's going to work until you hit the little green play button in SQLQA... this is gonna be a fun one... j
Read More...
29 October 2003
Follow up for a previous post...
I had previously posted a blog on 10/28 about how to get a class library to dynamically find it's own config file...then i realized that i didn't give any instructions on what to do next as far as loading that config file into some sort of object so that your application can use it! Personally, i would load the configuration file into a singleton object. per msdn documentation, the C# code for this would be: class Singleton { public static Singleton Instance() { if (_instance == null) { lock (typeof(Singleton)) { if (_instance == null) { _instance = new Singleton(); } } } return _instance; } protected Singleton() {} private static volatile Singleton _instance = null; } i personally find this a bit wordy and complex for what we are really trying to accomplish here. we need one object to share common properties with any subscribing assemblies, for the most part this information isn't going to change, so why waste round trips instantiating a new object each time your assembly needs a property...
Read More...
29 October 2003
Bedtime thoughts...
if you are going to concat more than 2 strings, consider using a StringBuilder object...or just use the code below to obtain a nicely formatted string: public static string BuildStrings(params string[] stringsToBuild) { string delimiter = " "; // this will be the return string string builtString; // use a StringBuilder as the internal mechanism to build the string StringBuilder localBuilder = new StringBuilder(); // loop through each string passed in and add it to the string to build foreach(string stringToBuild in stringsToBuild) { localBuilder.Append(delimiter); localBuilder.Append(stringToBuild); } builtString = localBuilder.ToString(); return builtString; }
Read More...
28 October 2003
Tip of the day...
VB.NET supplies the "Optional" keyword for parameters in methods, if none is supplied you can explicitely define a default value in the parameter signature. C# doesn't supply this functionality (and for good reason, it leads to lazy coding). it's good coding practice to always check the values of parameters in your components, and either throw an assertion or an exception if it's not supplied, like so: void myMethod(type myType1, type myType2...) { // check here for params that cannot be null, or "" for strings if(myType == null) throw new ArgumentNullException([message], [inner exception]...); // now check for validity of the param using regex, etc, you can't count on client code doing these checks if(myType != [some sort of criteria]) throw new ArgumentException ([message], [inner exception]...); } that being said, if you wanted to provide a default value, you can use ternary syntax to provide one void myMethod(type myType1, type myType2...) { myType1 != null ? MyType1 : [your default...
Read More...
28 October 2003
Quote of the day...
The less buttons you give end users, the less shit that can go wrong. it's directly proportionate...sometimes i feel like my company should hire a herd of monkeys, they'd probably fuck up less. j
Read More...
28 October 2003
What a day
So, today i learned the hard way that .NET class library apps don't intrinsically support .config files. after about 4 hours of head scratching i came up w/ the following bit of code that will dynamically load a config file with the same name as the assembly loading it: internal void GetConfigurationFilePath() { DirectoryInfo currentDir = new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory + "\\"); _pathToWorkingDirectory = currentDir.FullName; //loop through all assemblies currently loaded foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) { string asmName = asm.CodeBase; int index = asm.CodeBase.LastIndexOf(@"/"); string part = asmName.Substring(index + 1); //now compare that substring to the name of any config files found in the current directory foreach (FileInfo file in currentDir.GetFiles ("*.config")) { if (part.Trim().ToLower() + ".config" == file.Name.Trim().ToLower()) { _configFileName = file.FullName; } } } } it's actually quite simple once you look at it....
Read More...
28 October 2003
Welcome to my Weblog!!!
i sure as hell wasn't going to pay for one, so i built (read: hijacked) my own. we'll see how it goes, i am pretty good at breaking shit. The purpose of this blog is for me to share just how little i have learned i know about coding and .NET technologies...each day i learn a little bit more... more to come! j
Read More...
Home
Contact
The [K]nightly Build
Blog | JK [DOT] COM
RSS for Posts
Atom
RSS for Comments
Search Site
Go
Recent Posts
Site Migration to Azure: Azure Front Door is the Key to Speedy and Secure Websites
How To: Configure Ubiquiti Unifi Wireless Authentication With Windows NPS And RADIUS
Default Interface Methods in C#: What Are Traits, and Why Are They Needed?
Dashlane Password Manager: The One Password Manager to Rule Them All
The Web Is The New Desktop: Microsoft Announces Chromium To Power Edge
Post Topics
.Net (151)
Being Jayson (60)
C# (4)
Charlotte (38)
Community Server (127)
CS Tidbits (29)
Design Patterns (3)
F# (1)
Firefox (33)
Gameage (30)
General (293)
Irks (51)
Languages (2)
Life Inside Microsoft (2)
Links and News (214)
Medical Student (1)
Metablog (31)
Mono and Linux (4)
Music (36)
Opinions (152)
Photos (12)
Programming Paradigms (6)
Python and Django (1)
RSLS (3)
Ruby and Rails (1)
School (2)
Site News (53)
SQL Server (7)
SubText (2)
Suggestion Box (1)
Tech Articles (14)
Technology and Internet (411)
TFS (1)
Tools and Resources (173)
Trinkets (4)
TV and Movies (20)
Vista and WinFX (22)
Visual Studio (31)
Web Frameworks and CMS (2)
Windows (3)
Windows Live Writer (4)
Yoga (1)
Archives
March 2019 (1)
December 2018 (3)
March 2018 (1)
August 2017 (1)
February 2015 (1)
March 2013 (1)
January 2013 (4)
December 2012 (1)
September 2012 (3)
August 2012 (1)
August 2010 (1)
December 2009 (1)
December 2008 (1)
November 2008 (2)
October 2008 (1)
September 2008 (3)
July 2008 (1)
May 2008 (2)
March 2008 (2)
January 2008 (1)
November 2007 (1)
October 2007 (2)
September 2007 (4)
August 2007 (3)
July 2007 (4)
June 2007 (5)
May 2007 (4)
April 2007 (11)
March 2007 (7)
February 2007 (13)
January 2007 (20)
December 2006 (14)
November 2006 (25)
October 2006 (26)
September 2006 (19)
August 2006 (32)
July 2006 (19)
June 2006 (26)
May 2006 (31)
April 2006 (19)
March 2006 (22)
February 2006 (21)
January 2006 (29)
December 2005 (32)
November 2005 (33)
October 2005 (25)
September 2005 (18)
August 2005 (31)
July 2005 (29)
June 2005 (27)
May 2005 (25)
April 2005 (41)
March 2005 (20)
February 2005 (16)
January 2005 (17)
December 2004 (23)
November 2004 (15)
October 2004 (24)
September 2004 (16)
August 2004 (22)
July 2004 (5)
June 2004 (10)
May 2004 (4)
April 2004 (6)
March 2004 (7)
February 2004 (3)
January 2004 (7)
December 2003 (19)
November 2003 (8)
October 2003 (9)
Site Navigation
Home
Blogs
Media
Wikis
News
Contact
About
Anonymous comments have been disabled until I can implement a better comment spam fighting strategy. New comments are now enabled via DISQUS.COM.
My Sites
Home
Corporate
Creative
Blog Subscription
Email Notifications
Go
/Blogs/
.Net Weblog Archives
aBlogByGus
BizTalk Core Engine
Blog by Bob
Brad Abrams
cbrumme's WebLog
Chris Pratley
Cyrus' Blather
Dan Fernandez's Blog
Dave Navarro
DevNinja
Dino Esposito
Don Box's Spoutlet
Eric Gunnerson's C# Compendium
Eric Lippert's Blog
Erik Meijer
Extreme RAD
FeedDemon
Frans Bouma's blog
Fredrik Normén's Blog
GotDotNet Blogs
IntraVNews | Home
ISerializable
Jacob Stohler
James Avery
Jason Zander
Jayson Knight's Old Blog
Jeff Key
jeremyk
Joe Beda's 80%
Larry Osterman
LonghornBlogs.com
Luca Bolognese
Lutz Roeder
Maoni's WebLog - CLR Perf
Mark Sparling
Mark Wagner
Matt Hawley
Matt Warren
Matthew Reynolds
Matusow's Blog
Microsoft Community Blogs
Microsoft Monitor
Mike Grass
Rick Shaut
Rico Mariani's WebLog
Robert Hensing
Robert McLaws
Robert Stribley
Rory Blyth
RoudyBob.net
Sam Gentile's Blog
Scobleizer
ScottGu's Blog
Sheep News
SimpleGeek
Scott Mitchell
Scott Watermasysk
Technical Careers @ Microsoft
The Daily WTF
The Old New Thing
The Sandbox [Non-tech]
The Sell's Spout
Tim Marman
Weblogs @ ASP.NET
WebTransports's WebLog
you've been HAACKED
/CS::Bloggers/
Keyvan Nayyeri
The Souplog
CodeVerity.com
Eicar -- Sites using CS
Off Shot Thoughts
Intensive Design
Community Server Forums
/Comics/
B.C.
Dilbert
Get Fuzzy
Peanuts
Pearls Before Swine
/Etc/
20 Questions
F*ckedCompany.com
Guide to Electronic Music
InternalMemos.com
Kuro5hin
My Tunes -- 2,548 tunes, 16.9 gigs
Stuff for Smart Masses
/Humor/
A No Nothing Production
BBSpot -- Satire for Smart People
Bored at Work
Carrier Pigeon Internet Protocol
Engrish (Hilarious)
Excessive Penguin Abuse
Fark.com
Intercal Reference Manual
More Excessive Penguin Abuse
Postal Experiments
Random Programming Languages
Resign Patterns
Star Wars Gangsta Rap
Star Wars Kid
The Bastard Operator from Hell
This is True
/Local Stuff/
Carolina Nightlife
Charlotte Forums
Charlotte Mix
LazyDay.NET
Liquid Lounge
Menage
Mythos'
Sky Lounge
Sleepless in Charlotte
The Steeple
Tonic Lounge
Urban Evolution
Eden
/My Pubs/
Internet Explorer Downloads
Introduction to XEN
Tech - Articles/Opinions
Becoming an Architect
Matching Tools to Developers
Software Engineering, Not Computer Science
The C# Design Process: A Conversation with Anders Hejlsberg
The IT Industry is Shifting Away from Microsoft
Tech - Books
The Pragmatic Programmer
Tech - Code["Mine"]
Exception Logging Block (WIP)
Tech - Code["Other"]
Dynamic Invocation (Plugin Support)
Tech - Devel
.NET Developers
An Extensive Examination of User Controls
ASP.NET
C# v 2.0 Spec
CLR Memory Performance Counters
Code Project
Dictionary of Programming Languages
DotNetBips
Microsoft .NET Framework Performance
MIT CompSci
MS Application Blocks
MS DHTML Reference
MS Longhorn SDK
MSDN TV
Operating .NET-Based Applications
P/Invoke.net
Performance Counters for ASP.NET
SSCLI (Rotor)
The .NET Show
Writing Faster Managed Code
Tech - Misc
AnandTech
Microsoft Employee Biographies
Original Macintosh Commercial
Quite Possibly the Most Insane Machine I've Ever Seen
Research Topics at MS
Tech - News
/.
Artima Developer Community
BetaNews | Inside Info
CNET News Headlines
MSDN News Headlines
Neowin.net
OSNews.com
Paul Thurott's Site
TheServerSide.NET
Tech - Tools/DL's
Assortment of Tools
Chris' free developer tools
CLR Performance Profiler
Excellent web.config Editor
GotDotNet Tools and Resources
IDesign .NET Process Solutions
Lutz Roeder's Programming.NET
NUnit
Research DL's from MS
Sharp Toolbox
Snippet Compiler
Windows Server 2003 System Services Reference