Geeks With Blogs
Fórmulas e Cenas Object Reference Not Set to an Instance of an Object March 2010 Entries
WTF #4

Well... I cant really express my feelings for this kind of programming...

The WTF way:

DateTime myNewDate = DateTime.Parse((myOldDate.Year - 1).ToString() + "-" + myOldDate.Month.ToString() + "-" + myOldDate.Day.ToString());

 

The right way:

 DateTime myNewDate = myOldDate.Date.AddYears(-1);

 

Posted On Tuesday, March 23, 2010 12:17 PM

WTF #3

Well, this one i simply cannot understand... why anyone would do +0 after and int.parse. Any Ideas?

int myVar = Int32.Parse(ConfigurationManager.AppSettings["mySetting"] + "") + 0;

 

Posted On Monday, March 15, 2010 7:52 AM

How to: Change Master Page at runtine

        protected override void OnPreInit(EventArgs e)
        {
            Page.MasterPageFile = "~/LinkToMasterPage";
            base.OnInit(e);
        }

 

Enjoy :)

Posted On Wednesday, March 3, 2010 5:39 AM

How to: Reset table index on SQL Server
DBCC CHECKIDENT (yourtable, reseed, 0) Enjoy :) ......

Posted On Tuesday, March 2, 2010 10:34 AM

What if: Virtual machine can't access the internet

It's a tricky and annoying situation...

To do work around it, execute the following command on command prompt:

netsh winsock reset

Then Restart Windows enter the next command:

netsh int ip reset reset.log

Restart Windows and you are ready to go.


Enjoy :)
 

Posted On Tuesday, March 2, 2010 4:23 AM

Copyright © Sglima | Powered by: GeeksWithBlogs.net | Join free