Monthly Archives: March 2008

Allowing a Server Control to Contain Custom Child Collection

I’ve probably done this at least a dozen times, but when you don’t do something everyday, you tend to forget. I created a custom control that I wanted to place into a control collection. So, I created the child control as a custom server control. Then I created another server control that contained a property called Items as a Generic.List(Of T) where T was my custom child control. I kept running my app and couldn’t figure out why I couldn’t create my child controls in the Parent. I forgot that I had to import the namespace System.ComponentModel and add the PersistenceMode property to the property. So, my code looked like this:


Visual Basic



Public Class MyServerControlCollection
    
Inherits WebControl

    
Private _Items As Generic.List(Of MyChildControl)

    <PersistenceMode(PersistenceMode.InnerProperty)> _
    Public Property Items() As Generic.List(Of MyChildControl)
        
Get
            Return 
_Items
        
End Get
        Set
(ByVal value As Generic.List(Of MyChildControl))
            _Items 
value
        
End Set
    End Property

    Protected Overrides Sub 
CreateChildControls()
        
For Each obj As MyChildControl In Items
            
Me.Controls.Add(obj)
        
Next

        MyBase
.CreateChildControls()
    
End Sub

End Class

C#



public class MyServerControlCollection : WebControl
{

    
private Generic.List<MyChildControl> _Items;

    [PersistenceMode(PersistenceMode.InnerProperty)]
    public 
Generic.List<MyChildControl> Items {
        
get return _Items}
        
set { _Items = value; }
    }

    
protected override void CreateChildControls()
    {
        
foreach (MyChildControl obj in Items) {
            
this.Controls.Add(obj);
        
}

        
base.CreateChildControls();
    
}

}

Hope that helps!

Short Bits: TV Library, DSM-750, Scripts

Andy has released a version of TV Library that doesn’t include an expiration timebomb.  While not completely polished, TV Library is a quick and easy TV cataloging plug-in done in MCML.  Download it here, and read more about the plug-in here and here.



Buy.com is set to have the D-Link DSM-750 Extender for $260 once they get it in stock.  That’s not a bad deal considering the MSRP ov $300+.



I doubt that Microsoft can be successful with new scripted shows specifically for download on the Xbox 360, but it is an interesting concept.  In a time where the big broadcasters can’t get a successful series from big name writers and producers, does anything think Microsoft can with like (??) talents like Peter Safran.

Troubleshooting Permission Errors While Updating Software

A number of people are reporting errors when running software update tools. The tools include Windows Update, Windows Defender Updates, Installshield, Adobe Updater, and probably others as well. The errors include 80070005 (from Windows tools) and c0000005 (from others). To see if we can help people get their software updates, Steve Wechsler helped me put together some troubleshooting steps. If these steps help, and more so if they don't, we'd like to hear about it. If you find something else that helps, let us know by posting a comment.


 


All these errors indicate a permissions issue of some kind. All of them basically mean "Access Denied". However, determining exactly what the cause is can be difficult. There seem to be two main reasons why this is happening: multiple firewalls on the same computer, and a permissions issue, usually in the registry.


 


Multiple Firewalls
Several people with this problem report that it disappeared when the shut down one of the several firewalls they had on their computer. If you have installed a security suite, such as Norton Internet Security, on a Windows Vista computer, you have multiple firewalls. That, in and of itself, is not a problem as long as only one of them is running. However, if two, or more, are running at the same time, you will run into trouble. Some third-party firewalls appear to fail to properly disable the built-in Windows Firewall. If you have a third-party security suite installed, take the following steps to ensure the Windows Firewall with Advanced Security is turned off:

  1. Click the Window button (the start menu)
  2. In the search dialog, type "Windows Firewall"
  3. In a few seconds you will have a couple of results, including one that says "Windows Firewall". Click that one
  4. If the right-hand window says "Windows Firewall is on" click "Change settings"
  5. Accept the User Account Control prompt by clicking "Continue"
  6. Select the "Off (not recommended)" radio button and click OK. WARNING: do not do this unless you are sure you have a third-party firewall!
  7. Attempt to run the updater that failed again.

If this resolves the problem you can resolve it permanently by either leaving Windows Firewall off, or by disabling the third-party firewall. For the most part, they perform the same function, although the built-in firewall typically is far less intrusive and more stable. To disable the third-party firewall refer to the manufacturer's documentation.


 


Permissions Problems


If you do not have two firewalls the problem is almost certainly permissions related. If this is your case you need to resort to advanced troubleshooting tools.


 


Follow these steps carefully. They are written for Windows Vista, but the problem has also affected Windows XP. With only minor modifications (such as the ommission of the UAC elevation-related steps) they work on Windows XP as well.


 


Keep in mind that setting incorrect permissions can significantly harm your computer, to the point where it is either completely insecure, will not boot, or both. There are multiple recommendations out on the Internet that recommend that you change the permissions on large parts of the registry and the operating system. Doing so will render your computer unsupported and disable significant parts of the security sub-system. Surgical precision is key when modifying permissions.


 


  1. First, download Microsoft/System Internals Process Monitor from http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx. Save it somewhere you can remember, such as your Downloads directory or the desktop.
  2. Open the Downloads directory in Windows Explorer (the easiest way is to hold down the Window key and hit E, click your name, and click Downloads)
  3. Right-click ProcessMonitor and select "Extract all…" Walk through the wizard to extract the files
  4. In the window that opens when the extraction is complete, double-click "procmon" or "procmon.exe"
  5. In the "Open File – Security Warning" prompt, uncheck the box that says "Always ask before opening this file" and click Run
  6. Accept the User Account Control prompt by selecting Continue
  7. Accept the license agreement (no, the next time you run the tool you will only have the User Account Control prompt, not all three)
  8. Maximize the window
  9. Hold the CTRL key and hit L
  10. In the drop-down that says "Architecture" select "Result"
  11. In the text box next to "Is" type "ACCESS DENIED" (without the quotes). Here is what it should look like:

  12. Hit the Add button
  13. Hit OK
  14. Hold CTRL and hit X to clear the output window

You now have Process Monitor monitoring all operations on the computer. At this point, retry the updater that fails. If the updater fails with a permissions problem, you should get entries in the Process Monitor window. Each one indicates a potential problem that could harm your ability to install updates, although they may also be unrelated.


 


Here is an example of the types of ACCESS DENIED errors you may see. Note that your process name would not be regedit.exe.
 


To fix the problem you need to set permissions. If you are not comfortable with exactly how to do that, I can help you if you send me the keys that are causing the error. You can do that most easily by clicking CTRL+A in Process Monitor, and then clicking CTRL+C to copy it. Then click the "Comments" link on the right side of the blog to send me a message, and paste the output into it.

 

To fix the problem yourself you can also change the permissions on the registry key (typically) or file that is a problem. I have not yet seen this happen because of file permissions, but if it does, it would be interesting to know. To fix registry permissions problems, do this:

 

  1. Right click the event and select “Jump to…”
  2. Right-click the key that is listed and select “Permissions…”
  3. Click Advanced
  4. Make sure that permissions are at least Full Control for TrustedInstaller, and Read for Administrators and SYSTEM. If that is what you have, and you are using a non-Windows installer (such as Adobe Updater), close the Advanced window, select the Administrators entry, and click the Full Control checkbox
  5. Click OK to close the dialogs.
  6. Retry the update

This will work under the assumption that the proper permissions were overridden on that particular key. In general, permissions on these keys should be Read for everyone except Trusted Installer, as follows:

You may, however, see Administrators have Full Control, or SYSTEM having Full Control. Those are both typically acceptable.

 

If this helps you, and you do not mind, could you please post a comment with the key that was a problem? It would be very interesting if we could figure out if this is caused by some particular piece of software that modifies some particular value.

Troubleshooting Errors While Updating Software

A number of people are reporting errors when running software update tools. The tools include Windows Update, Windows Defender Updates, Installshield, Adobe Updater, and probably others as well. The errors include 80070005 (from Windows tools) and c0000005 (from others). To see if we can help people get their software updates, Steve Wechsler helped me put together some troubleshooting steps. If these steps help, and more so if they don't, we'd like to hear about it. If you find something else that helps, let us know by posting a comment.


 


All these errors indicate a permissions issue of some kind. All of them basically mean "Access Denied". However, determining exactly what the cause is can be difficult. There seem to be two main reasons why this is happening: multiple firewalls on the same computer, and a permissions issue, usually in the registry.


 


Multiple Firewalls
Several people with this problem report that it disappeared when the shut down one of the several firewalls they had on their computer. If you have installed a security suite, such as Norton Internet Security, on a Windows Vista computer, you have multiple firewalls. That, in and of itself, is not a problem as long as only one of them is running. However, if two, or more, are running at the same time, you will run into trouble. Some third-party firewalls appear to fail to properly disable the built-in Windows Firewall. If you have a third-party security suite installed, take the following steps to ensure the Windows Firewall with Advanced Security is turned off:

  1. Click the Window button (the start menu)
  2. In the search dialog, type "Windows Firewall"
  3. In a few seconds you will have a couple of results, including one that says "Windows Firewall". Click that one
  4. If the right-hand window says "Windows Firewall is on" click "Change settings"
  5. Accept the User Account Control prompt by clicking "Continue"
  6. Select the "Off (not recommended)" radio button and click OK. WARNING: do not do this unless you are sure you have a third-party firewall!
  7. Attempt to run the updater that failed again.

If this resolves the problem you can resolve it permanently by either leaving Windows Firewall off, or by disabling the third-party firewall. For the most part, they perform the same function, although the built-in firewall typically is far less intrusive and more stable. To disable the third-party firewall refer to the manufacturer's documentation.


 


Permissions Problems


If you do not have two firewalls the problem is almost certainly permissions related. If this is your case you need to resort to advanced troubleshooting tools.


 


Follow these steps carefully. They are written for Windows Vista, but the problem has also affected Windows XP. With only minor modifications (such as the ommission of the UAC elevation-related steps) they work on Windows XP as well.


 


Keep in mind that setting incorrect permissions can significantly harm your computer, to the point where it is either completely insecure, will not boot, or both. There are multiple recommendations out on the Internet that recommend that you change the permissions on large parts of the registry and the operating system. Doing so will render your computer unsupported and disable significant parts of the security sub-system. Surgical precision is key when modifying permissions.


 


  1. First, download Microsoft/System Internals Process Monitor from http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx. Save it somewhere you can remember, such as your Downloads directory or the desktop.
  2. Open the Downloads directory in Windows Explorer (the easiest way is to hold down the Window key and hit E, click your name, and click Downloads)
  3. Right-click ProcessMonitor and select "Extract all…" Walk through the wizard to extract the files
  4. In the window that opens when the extraction is complete, double-click "procmon" or "procmon.exe"
  5. In the "Open File – Security Warning" prompt, uncheck the box that says "Always ask before opening this file" and click Run
  6. Accept the User Account Control prompt by selecting Continue
  7. Accept the license agreement (no, the next time you run the tool you will only have the User Account Control prompt, not all three)
  8. Maximize the window
  9. Hold the CTRL key and hit L
  10. In the drop-down that says "Architecture" select "Result"
  11. In the text box next to "Is" type "ACCESS DENIED" (without the quotes). Here is what it should look like:

  12. Hit the Add button
  13. Hit OK
  14. Hold CTRL and hit X to clear the output window

You now have Process Monitor monitoring all operations on the computer. At this point, retry the updater that fails. If the updater fails with a permissions problem, you should get entries in the Process Monitor window. Each one indicates a potential problem that could harm your ability to install updates, although they may also be unrelated.


 


Here is an example of the types of ACCESS DENIED errors you may see. Note that your process name would not be regedit.exe.
 


To fix the problem you need to set permissions. If you are not comfortable with exactly how to do that, I can help you if you send me the keys that are causing the error. You can do that most easily by clicking CTRL+A in Process Monitor, and then clicking CTRL+C to copy it. Then click the "Comments" link on the right side of the blog to send me a message, and paste the output into it.

 

To fix the problem yourself you can also change the permissions on the registry key (typically) or file that is a problem. I have not yet seen this happen because of file permissions, but if it does, it would be interesting to know. To fix registry permissions problems, do this:

 

  1. Right click the event and select “Jump to…”
  2. Right-click the key that is listed and select “Permissions…”
  3. Click Advanced
  4. Make sure that permissions are at least Full Control for TrustedInstaller, and Read for Administrators and SYSTEM. If that is what you have, and you are using a non-Windows installer (such as Adobe Updater), close the Advanced window, select the Administrators entry, and click the Full Control checkbox
  5. Click OK to close the dialogs.
  6. Retry the update

This will work under the assumption that the proper permissions were overridden on that particular key. In general, permissions on these keys should be Read for everyone except Trusted Installer, as follows:

You may, however, see Administrators have Full Control, or SYSTEM having Full Control. Those are both typically acceptable.

 

If this helps you, and you do not mind, could you please post a comment with the key that was a problem? It would be very interesting if we could figure out if this is caused by some particular piece of software that modifies some particular value.

McAfee, Inc. Launches Global S.P.A.M. Experiment

McAfee, Inc. today announced the launch of its global S.P.A.M. (Spammed Persistently All Month) Experiment. For the month of April, participants from around the world – ranging from homemakers, government executives, and students to retirees – will surf the Web, make online purchases and register for promotions. Participants have been provided with a clean laptop without spam protection and a new email address. Beginning today, they will blog about their experiences daily at http://www.mcafee.com/spamexperiment.

http://www.mcafee.com/us/about/press/corporate/2008/20080331_175000_k.html

11 year old is in-charge of 60 machine network

At 11-years-old, Penn has become his school’s network administrator, taking over the job from the previous admin who left suddenly last year. One could call into question the qualifications of Penn’s predecessor, however, considering the major clean-up job the adolescent wonder has on his hands.

http://www.switched.com/2008/03/31/11-year-old-takes-over-as-schools-network-admin/ via http://www.engadget.com/2008/03/31/arkansas-school-has-an-11-year-old-it-department-no-really/

Jobs.ie probe as hackers access users’ personal details

The internet recruitment service Jobs.ie sent a report to the Data Protection Commissioner yesterday after hackers gained illegal access to users’ personal details.

http://www.irishexaminer.com/irishexaminer/pages/story.aspx-qqqg=ireland-qqqm=ireland-qqqa=ireland-qqqid=59140-qqqx=1.asp

New Sophos facial recognition technology uses webcams to stop hackers in their tracks

Sophos appeals for computer users to send in pictures to increase accuracy of new RAPIL system

IT security and control firm Sophos today announced its new RAPIL (Recognition and Analysis of Potentially Intruding Lifeforms) system which is able to produce a real-time forensic analysis of a PC or Mac user’s facial features to determine if they exhibit any characteristics commonly associated with hackers.

The new system uses webcams, now in widespread use on modern computers, to assess the facial characteristics of computer users, and cross-references them against features typically found in cybercriminals. Current tests show that with a clear background and provided the face is free of any obstructions, including hats, moustaches and sunglasses, the beta version of RAPIL has a success rate of 97.78 percent.

To add to the Sophos library of faces and help the fight again cybercrime, please upload your photographs at: www.flickr.com/groups/ra-pil

Video clip and screenshot at http://www.sophos.com/pressoffice/news/articles/2008/04/rapil.html

Teenager guilty of million-dollar hacking campaign

A New Zealand teenager accused of leading an international ring of computer hackers which skimmed millions of dollars from bank accounts was today convicted of illegal computer hacking.

Owen Thor Walker, 18, pleaded guilty yesterday to six charges related to using computers for illegal purposes. Police allege that he led a group of hackers who took control of 1.3m computers around the world without their owners’ knowledge.

Hackers routinely send out viruses, worms and malicious Trojan horse programs which allow them to take control of a victim’s machine. Linked through the internet to form a “bot-net” network, the infiltrated computers are used to access personal bank accounts, steal credit card details or bombard users with spam.

Police alleged that Walker wrote software that evaded normal computer anti-spyware systems, and then sold his skills to criminals around the world.

More at http://www.guardian.co.uk/technology/2008/apr/01/hitechcrime.hacking

In the garden : March 2008 wrap up

March was a month of extreme weather.  The first two weeks were record highs. This really brought on the tomatoes.  Then the last two weeks were colder than usual, and had a bit of rain.  The rain put out the nearby tyre fire:



 


I think the smoke helped ripen the tomatoes and give them that  kind of BBQ flavour.  But the rains were good.  I stopped watering the garden as I got plenty of inflow from the nearby tip.  A year or two ago, they lined the dams around the tip, around the same time as they got that medical waste contract.  Since then the plastic liners mean that water doesn’t get wasted, and when there’s a good downfall I get lots of run-off :)  The veggies seem to be bumper crops from it !



But it all hasn’t been this good.  There was some damage to one of my fences just before the rains came.  I guess it must have been hoodlums having too much to drink the night of the meteor shower.  I went to fix the fence today, and it’s  bigger job than I thought.  But it gets worse. They seem to have introduced some weird kind of weed into the garden. I haven’t seen it before, kind of like a tropical plant, very tall.



The leaves seem to make the funniest noises even with the lightest of winds, a strange clicking noise.  I was going to pull them out today, but I must be allergic to them, as I got some pollen in my face and it’s really irritated my eyes.  Feeling really sleepy, so perhaps it will all be right in the morning.


More on the garden soon …. I hope.

MVP Insider – Q & A with Wes McDonald

I don’t know why the Microsoft MVP Program’s MVP Insider webpage do not have new MVP Insider entry but there’s one today at http://blogs.msdn.com/cdndevs/archive/2008/04/01/mvp-insider-q-a-with-wes-mcdonald.aspx

Slide.com Hosting Malware

Websense Security Labs has been tracking the use of Slide.com as a hosting site for malware for several months. The popular Web 2.0 social networking website, ranked 252 by Alexa (Alexa Ranking), is both the largest Facebook application developer and a free and easy place to host malware.

Having tracked the various ways malware is hosted on the site, it appears most popular with attackers targeting Spanish- and Portuguese-speaking audiences. We have seen targeted attacks with fake YouTube email lures in Portuguese that link to malware hosted on Slide.com.

More with screenshots at http://www.websense.com/securitylabs/blog/blog.php?BlogID=183

Storm worm using April Fools’

The Storm Worm is out and about with a new lure campaign, this one centered on the April Fool’s Day holiday tomorrow. The campaign appears to have started in the past few hours, and reports indicate it was in preparation for the past 24 hours or so.

http://asert.arbornetworks.com/2008/03/april-storms-day-campaign/

“And poor detection on one sample” — Alex E. at Sunbelt blog
http://sunbeltblog.blogspot.com/2008/03/heads-up-storm-worm-using-april-fools.html

Other areas:

http://www.avertlabs.com/research/blog/index.php/2008/03/31/nuwar-isnt-fooling-around/
http://www.f-secure.com/weblog/archives/00001410.html
http://isc.sans.org/diary.php?storyid=4222

Businesses Leave Wi-Fi Hot Spots Unprotected

Printers wirelessly leak PostScript, and Linksys routers are the most popular hot spots going—just a few examples of Wi-Fi vulnerabilities many companies don’t even know they have or need to secure, says a Wi-Fi security expert. 

http://www.eweek.com/c/a/Security/Businesses-Leave-WiFi-Hot-Spots-Unprotected/

Hackers Flood Epilepsy Web Forum With Flashing Lights

Unknown miscreants had a good time two weekends ago when they posted hundreds of flashing animated images onto discussion boards hosted by the Landover, Md.-based Epilepsy Foundation.

Flashing lights or bold moving patterns can trigger often violent seizures among 3 percent of the estimated 50 million epileptics worldwide.

“I was on the phone when it happened, and I couldn’t move and couldn’t speak,” RyAnne Fultz, who has epilepsy, told Wired News about her reaction to viewing one of the images on March 23.

Fultz’s 11-year-old son walked over and closed the browser window after about 10 seconds. Fortunately, she suffered nothing more than a bad headache.

By then, the second day of vandalism on EpilepsyFoundation.org, the jerks had moved on to hijacking the browsers of anyone who clicked on certain forum posts, filling the screens with bright, flashing colors.

http://www.foxnews.com/story/0,2933,343808,00.html via http://www.cgisecurity.com/cgi-bin/redir.cgi?story=080312

This blog is changing URL..

..but I’m hoping you won’t notice! The new URL is the somewhat simpler www.sharepointnutsandbolts.com, and if everything goes to plan everything will be redirected from old to new, so any bookmarks should continue to work. Or that’s the theory promised to me by my blog host, but I thought I should say something just in case :-) Certainly all subscribers to the feed won’t need to do anything – the Feedburner URL will stay the same.

Changeover will be later this week – if anybody notices a problem I’m keen to hear, please drop me a comment to let me know!

P.S. I’m likely to switch over to using the CKS : EBE framework at some point soon. A few people have commented that since we moved into 2008, they found it harder to find articles since the navigation on the right buries them under the ‘2007’ node. I’ve tried to mitigate this by adding the ‘Most popular articles’ list (as indicated by Feedburner), but I know navigation isn’t ideal. Rest assured I’ll improve it when I have more control over the site!

The end is nigh?

'The End is nigh!  A big stakes suit to save us all.' That is the Page Two headline in today's International Herald Tribune.  It is the story of how two men – Walter Wagner and Luis Sancho – are suing the Conseil Européen pour la Recherche Nucléaire (CERN), or rather are suing for a court-ordered restraining order that would prevent them from operating their Large Hadron Collider (LHC).  The claim is that the proper due diligence has not been performed, and that CERN '…has failed to provide an environmental impact statement as required under the U.S. National Environmental Policy Act.' (International Herald Tribune, Monday March 31, 2008, p.2)

The story goes on to explain that the LHC could create a black hole, and that although it is theorized (by Stephen Hawking) that black holes '…evaporate in a poof of radiation and elementary particles,' this phenomenon has never been witnessed, so Wagner and Sancho theorize that black holes might actually be stable, and that a micro-black hole created in the LHC could expand and destroy the Earth and eventually the universe (which I contend would be irrelevant to many of us once the Earth and Schwartz's Hebrew Delicatessen in Montreal were gone).

I find several points to this suit severely flawed, not the least of which is that they are suing in (sic!) the U.S. District Court in Honolulu.  While I am sure that the scientists and lawyers from CERN (located outside Geneva in Switzerland) would relish the idea of spending time on the beautiful Big Island in Hawaii, I am equally sure that they are not stupid enough as to cede to the U.S. District Court's jurisdiction in order to do so.  These are, after all, the people who actually invented the Internet (yes Dave, shot #2 at Mr. Gore this week!), as well as a Large Hadron Collider capable of creating matter and reproducing conditions not witnessed since the trillionth of a second following the Big Bang!

The same scientists bringing this suit did the same (unsuccessfully) against the Brookhaven National Laboratory when they fired up their Relativistic Heavy Ion Collider (RHIC).  The RHIC at Brookhaven is a similar (somewhat smaller) machine to the LHC, and has been operating without causing any recognizable destruction of the universe since 2000.  What makes the pair think that a slightly (sic!) larger machine would cause destruction unfounded in the smaller version?

For those of you interested in the technical details of the LHC in plain English I suggest you read Angels and Demons by Dan Brown.  It is the novel that introduced the main character from his later novel The DaVinci Code, and is for my money a much more interesting read.  Although its writing presumes the opening of the LHC some ten years before actual, most of the science in that work is plausible… though I will not speak to the matter/anti-matter issue of which my knowledge is limited to Star Trek and that novel.

My very limited knowledge of the LHC and CERN did not originate with that novel, but then I am almost as ignorant as any non-scientist on the matter.  The LHC is the largest machine in the world, and if I remember correctly (I am currently 32,000 feet above sea level in a Boeing 737-800 and unable to access the Internet to check my facts) extends beyond the borders of Switzerland into Italy and France.  It is a giant particle accelerator that will smash protons together and allow their scientists to '…sift through the debris for clues to the nature of mass and new forces and symmetries of nature.' (Ibid)  If you discount the minute possibility that it might destroy the universe, I do not see a downside to it.

If you are keeping up on your reading (and what is more important than reading my blog?) you will know that last week I visited the Nobel Museum in Stockholm and had a lot of opportunity to think about science and discovery.  Although I do not know what new knowledge and discoveries could be made by sifting through this matter, I do understand that most great discoveries were done so by accident, or at least without really knowing what the scientists were looking for.  I am certain though that if penicillin can be discovered by examining mouldy bread, the possibilities of examining this primordial sludge (what a great term!) has infinite possibilities beyond even the comprehension of the geniuses at CERN.

I hope that they do not blow it by showing up in Honolulu.

BOL. «Пометки на полях»

Сайт MSDN2 вместе с электронной документацией по Visual Studio 2005/2008 и SQL Server 2005/2008 содержит ещё и встроенный «MSDN Library WiKi». На страницах WiKi содержатся примечания, примеры или пояснения к статьям документации. Недавно стало возможно делать такие пометки и для переведённого на русский язык варианта BOL 2005. В русском переводе WiKi получили название «Содержимое сообщества». Подобно блогам, русскоязычное содержимое может сопровождаться тематическими тегами и имеет свой веб-канал, в котором можно отслеживать последние изменения:  http://msdn2.microsoft.com/ru-ru/library/community-edits(rss).aspx

Для того, чтобы оставлять свои комментарии к статьям BOL, нужно зарегистрироваться. Для регистрации используется LiveID. После этого, на MSDN2 будет создан ваш профиль и другие участники WiKi или читатели интернет – версии BOL смогут видеть список ваших заметок и даже подписаться на новостной Веб-канал вашего профиля.

Наиболее активные и ценные соавторы попадают на «доску почёта», которая доступна на домашней странице WiKi. Судя по активности WiKi на других языках, оказаться на такой доске почёта очень достойно ;) Пока пальму первенства там прочно удерживают сотрудники Майкрософт.

IIS Stack in Windows Server 2003+

Apparently the IIS stack has changed in Server 2003. I’ve never noticed any issues with my ASP.NET apps, but in case you do, here’s the full post: http://blogs.msdn.com/tom/archive/2008/03/31/stack-sizes-in-iis-affects-asp-net.aspx.

Resharper Isn’t Always Smart

I was writing some code today, essentially like this:

public class MyClass

{

    private int value;

    public MyClass(int value)

    {

        this.value = value;

    }

    public static bool operator==(MyClass left, MyClass right)

    {

        return left.value == right.value;

    }

 

    public static bool operator !=(MyClass left, MyClass right)

    {

        return !(left == right);

    }

}


    //…

    MyClass myClass1 = new MyClass(1);

    MyClass myClass2 = new MyClass(1);

    if((Object)myClass1 != (Object)myClass2) // “Type cast is reundant”

    {

        Console.WriteLine(“not equal”);

    }

    else

    {

        Console.WriteLine(“equal”);

    }

…where Resharper warned that both the casts to Object were redundant and offered a “Quick-fix” (red light bulb) to “Remove cast”.  Well, doing that to one of the casts results in a compile error so you have to manually change the other; but what it’s suggesting is this:

    if(myClass1 != myClass2)

This completely changes the output of my application from “not equal” to “equal”.  What Resharper doesn’t know (or doesn’t care to check) is that removing those casts switches from a reference comparison to a value comparison and may have different results.  What I wrote with the original code was to test if the two references referenced the same object.  The default behaviour of a class is to do a reference check; but I’ve overloaded operator== (and operator !=) to perform a value comparison (I’ve left out the lovely bits that truly gives MyClass value semantics for clarity).


So, when Resharper offers to change your code, be sure you know side-effects of that change before you let it do it.  You could introduce a nasty bug.


kick it on DotNetKicks.com

Recent Comments

Archives