What’s a better way to get ready for a gambling trip other than write a blackjack simulator? I am no blackjack expert but one of the strategies I heard off is to double your bet every time you lose. So, if I start with a $100 bankroll and play $10 hands then I lost the [...]
Every time I work with WPF, I constantly think “I hate this shit” and “why is everything so damn hard”, but once I figure it out, I realize how powerful it really is and what I can really do with it. I remember starting out with WPF and trying to figure out how to bind [...]
I hate all the junk that gets added when serializing object to XML, so here is a quick way to do it cleanly. Here is the dirty way: public static string Serialize(this object obj) { string XmlString = String.Empty; using (var memStream = new MemoryStream()) { var serializer = new XmlSerializer(obj.GetType(), string.Empty); using (var xmlText [...]
Selecting 5 random rows in SQL is easy select top 5 * from users order by newid() .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode [...]
I am always looking for this one, so I am blogging it for future reference and for everyone to use. ^(?#Protocol)(?:(?:ht|f)tp(?:s?)\:\/\/|~/|/)?(?#Username:Password)(?:\w+:\w+@)?(?#Subdomains)(?:(?:[-\w]+\.)+(?#TopLevel Domains)(?:com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum|travel|[a-z]{2}))(?#Port)(?::[\d]{1,5})?(?#Directories)(?:(?:(?:/(?:[-\w~!$+|.,=]|%[a-f\d]{2})+)+|/)+|\?|#)?(?#Query)(?:(?:\?(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)(?:&(?:[-\w~!$+|.,*:]|%[a-f\d{2}])+=(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)*)*(?#Anchor)(?:#(?:[-\w~!$+|.,*:=]|%[a-f\d]{2})*)?$ There is more information on Ivan’s blog. Related PostsFailed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be [...]
Thursday, August 12, 2010
View Comments