Interesting issues and tidbits about software development, generally using .NET
PingBack from http://weblogs.asp.net/tgraham/archive/2007/01/02/subversion-hosting.aspx
PingBack from http://weblogs.asp.net/tgraham/archive/2007/01/11/razr-survives-the-washing-machine.aspx
PingBack from http://weblogs.asp.net/tgraham/archive/2007/01/14/installing-vs-2003-after-vs-2005.aspx
PingBack from http://weblogs.asp.net/tgraham/archive/2007/03/09/software-startup-series.aspx
PingBack from http://weblogs.asp.net/tgraham/archive/2007/03/15/a-realistic-log4net-config.aspx
PingBack from http://weblogs.asp.net/tgraham/archive/2007/04/20/a-log4net-appender-that-uses-smtpclient.aspx
PingBack from http://weblogs.asp.net/tgraham/archive/2007/05/02/loading-the-assembly-for-a-custom-log4net-appender.aspx
So what do you do about the ".. does not override Object.GetHashCode()" warning..?
The solution provided by Doug de la Torre can be implemented if you are hosting the web service and have control over the server's config. But if you are just utilizing a web service provided by somebody else, then the ICertificatePolicy hack provided by Ted is your only way around this issue.
If the author of Alice in Wonderland was a developer, he might have written riddles like, "when is private also public."
So far the debate on private vs. public testing has focused on the "public" being the entire outside universe and "private" being only with a class. But let me pose an alternative view. Suppose that the universe was reduced to that of an assembly.
I recently started working again on a pet project that I wrote years ago, and in it I have some internal classes. These are supporting classes for the rest of the assembly. For one reason or another I chose not to make them publicly accessible to the world.
Although they are not public to the world, they are public in the context of the assembly. Any class and method and property can access those internal classes, but are they testable.
I like to place the unit tests in a separate project. I would like to be able to test those internal support classes, but I cannot without some work with reflection.
The solution provided by Doug de la Torre means modifying the machin.config of your local machine instead of the server machine. since it is the local machine's responsibility to check whether the server certificate is authticate or not.
Therefore, it has nothering to do with the web service being hosted by yourself or somebody else.
Thanks Ted. Informative.
Thanks for the checklist - covers some items I hadn't put on my PSP C# checklist.
Which subversion hosting service are you using?
Did you try www.codespaces.com?
Il est pourri ton code, c'est normal qu'il y ait des bugs après faut pas s'étonner...
MarshallByRef.
Also look at DI/AOP. These allow for code to be execute before/after/around a method/class decorated with the attribute or even configured in the appropriate file.
w://
<a href="www.justpiplanet.info/chesterfield19.html">chesterfield county public schools virginia</a> chesterfield county public schools virginia,<a href="www.wpisupplies.info/lies17.html">love-lies-bleeding plant</a> love-lies-bleeding plant,<a href="www.wpiproject.info/certain46.html">a certain spider</a> a certain spider,<a href="www.wpiproject.info/showers32.html">colored glass showers</a> colored glass showers,<a href="www.wpisupplies.info/lies17.html">believing innocent lies</a> believing innocent lies,<a href="www.pihlz.info/ran52.html">democrats ran as conservatives</a> democrats ran as conservatives,<a href="www.pihlz.info/.../a> t233,<a href="www.pihlz.info/tricia91.html">tricia smith doll</a> tricia smith doll,<a href="www.wpiproject.info/showers32.html">twater save showers</a> twater save showers,<a href="www.pihlz.info/tricia91.html">tricia rozanski of lockportil</a> tricia rozanski of lockportil,
Pingback from A log4net appender that uses SmtpClient
Pingback from Could not establish trust relationship with remote server.
map http://www.pumixon.0pi.com home link here
Another problem with the 'value==null' test in Adam's post is that if the Customer class or one of its ancestors overrides the == operator, then the test 'value == null' could throw an exception. This depends on how the == method is written, but some implementations throw exceptions when presented with null argument(s). Thus the test 'value == null' is bad because the Equals(Object) method is not supposed to throw an exception. Replacing the test with '((Object)value)==null' would work, but if we are going to do that then we might as well test 'obj==null' at the top of the method. And if we're doing that, we might as well use the GetType() system in the original post. In summary, using the "as" idiom does not seem to be a good idea in methods that Equals(Object).
Thanks - I hadn't heard of that attribute before, it will be very helpful. I guess the reason they made you use "DEBUG" is because by using a string, you could block methods from executing in other build configurations too, like if you had a build configuration named "DEBUG NO SYMBOLS", etc.
<a href="www.razahabaheights.info/sabbath29.html">wa">www.razahabaheights.info/sabbath29.html">wa pigs black sabbath</a> [url=www.razahabaheights.info/sabbath29.html]wa pigs black sabbath[/url] wa pigs black sabbath www.razahabaheights.info/sabbath29.html,<a href="www.puzzlewuzzles.info/grasshopper82.html">grasshopper">www.puzzlewuzzles.info/grasshopper82.html">grasshopper sparrow</a> [url=www.puzzlewuzzles.info/grasshopper82.html]grasshopper sparrow[/url] grasshopper sparrow www.puzzlewuzzles.info/grasshopper82.html,<a href="www.officialwuz.info/kok13.html">kiek">www.officialwuz.info/kok13.html">kiek in de kok</a> [url=www.officialwuz.info/kok13.html]kiek in de kok[/url] kiek in de kok www.officialwuz.info/kok13.html,<a href="www.wuzsupplies.info/overheating86.html">kia">www.wuzsupplies.info/overheating86.html">kia sportage overheating problem</a> [url=www.wuzsupplies.info/overheating86.html]kia sportage overheating problem[/url] kia sportage overheating problem www.wuzsupplies.info/overheating86.html,<a href="www.officialwuz.info/kok13.html">t233</a> [url=www.officialwuz.info/kok13.html]t233[/url] t233 www.officialwuz.info/kok13.html,
<a href="www.freewuzstore.info/overlay50.html">chromium">www.freewuzstore.info/overlay50.html">chromium carbide overlay plate</a> [url=www.freewuzstore.info/overlay50.html]chromium carbide overlay plate[/url] chromium carbide overlay plate www.freewuzstore.info/overlay50.html,<a href="www.superwuz.info/peinture22.html">peinture">www.superwuz.info/peinture22.html">peinture aerosol belton</a> [url=www.superwuz.info/peinture22.html]peinture aerosol belton[/url] peinture aerosol belton www.superwuz.info/peinture22.html,<a href="www.officialwuzsupplies.info/vacant38.html">massage">www.officialwuzsupplies.info/vacant38.html">massage therapist cornwall positions vacant</a> [url=www.officialwuzsupplies.info/vacant38.html]massage therapist cornwall positions vacant[/url] massage therapist cornwall positions vacant www.officialwuzsupplies.info/vacant38.html,<a href="www.glanderiver.info/venue56.html">venue">www.glanderiver.info/venue56.html">venue for broadway shows in new york</a> [url=www.glanderiver.info/venue56.html]venue for broadway shows in new york[/url] venue for broadway shows in new york www.glanderiver.info/venue56.html,<a href="www.glanderiver.info/venue56.html">gay wedding venues</a> [url=www.glanderiver.info/venue56.html]gay wedding venues[/url] gay wedding venues www.glanderiver.info/venue56.html,
<a href="www.wuznation.info/seizures47.html">historical">www.wuznation.info/seizures47.html">historical treatments of seizures</a> [url=www.wuznation.info/seizures47.html]historical treatments of seizures[/url] historical treatments of seizures www.wuznation.info/seizures47.html,<a href="www.sawuzi.info/boomer17.html">boomers">www.sawuzi.info/boomer17.html">boomers avondale pa</a> [url=www.sawuzi.info/boomer17.html]boomers avondale pa[/url] boomers avondale pa www.sawuzi.info/boomer17.html,<a href="www.wuznation.info/seizures47.html">seizures after brain surgery</a> [url=www.wuznation.info/seizures47.html]seizures after brain surgery[/url] seizures after brain surgery www.wuznation.info/seizures47.html,<a href="www.wuznation.info/seizures47.html">diabetic dogs and seizures</a> [url=www.wuznation.info/seizures47.html]diabetic dogs and seizures[/url] diabetic dogs and seizures www.wuznation.info/seizures47.html,<a href="www.habasitio.info/preisvergleich25.html">Casio">www.habasitio.info/preisvergleich25.html">Casio FX991ES preisvergleich</a> [url=www.habasitio.info/preisvergleich25.html]Casio FX991ES preisvergleich[/url] Casio FX991ES preisvergleich www.habasitio.info/preisvergleich25.html,
<a href="www.wuzsupplies.info/gwen22.html">gwen">www.wuzsupplies.info/gwen22.html">gwen welch</a> [url=www.wuzsupplies.info/gwen22.html]gwen welch[/url] gwen welch www.wuzsupplies.info/gwen22.html,<a href="www.wuzsupplies.info/gwen22.html">the sweet escape by gwen stephani</a> [url=www.wuzsupplies.info/gwen22.html]the sweet escape by gwen stephani[/url] the sweet escape by gwen stephani www.wuzsupplies.info/gwen22.html,<a href="www.glanderiver.info/race16.html">the">www.glanderiver.info/race16.html">the restaurant and fast food race: whos winning</a> [url=www.glanderiver.info/race16.html]the restaurant and fast food race: whos winning[/url] the restaurant and fast food race: whos winning www.glanderiver.info/race16.html,<a href="www.superwuz.info/polygon67.html">polygon">www.superwuz.info/polygon67.html">polygon worksheets</a> [url=www.superwuz.info/polygon67.html]polygon worksheets[/url] polygon worksheets www.superwuz.info/polygon67.html,<a href="www.wuzwizard.info/heat26.html">furnaceair">www.wuzwizard.info/heat26.html">furnaceair to air heat exchangers</a> [url=www.wuzwizard.info/heat26.html]furnaceair to air heat exchangers[/url] furnaceair to air heat exchangers www.wuzwizard.info/heat26.html,
Instead of the null check followed by the type check you can write:
if (!(obj is Customer))
return false;
And instead of casting you can use the "as" operator.
On the other hand, rolling your own may be superior to "tracking" bugs via a combination of e-mail and Excel.
I would guess that the reason many small shops end up writing their own bug-tracking system is because it seems easy enough to knock out in an afternoon, and it's "free" to do so.
IMO it's much better to bite the bullet and pay for something reasonable (or set up an open source alternative, I guess) and spend your time on something that pays the bills. My company started out with TrackRecord, which was written by the people who created BRIEF, and had an...interesting...user interface that never reached critical mass among our non-developers. We switched over to TestTrack Pro, by Seapine Software, and have used that ever since. It's got a couple warts, but overall is quite nice.
(Yes, I realize I'm responding to a 4.5-year-old blog post. Thanks, Google!)
very useful! thank u very much.
Code reviews are generally underrated. From my perspective and experience , if they are being conducted
This sounds like Aspect Oriented Programming. Take a look at Spring.NET.
Hi guys, I think it's almost right though there are a couple of issues I see with the implementation.
Use of the 'is' keyword is an implicit cast of which an 'as' explicit cast may as well be used as you're going to need it later on. Performing an is then an as is redundant. This wasn't part of the solution bu just explaining why it should be avoided.
You should also be returning the "base" equals implementation if yours fails. In almost all cases it will fail, but as a practice you should rely on the base class to determine this, it could be that the base class has a bad implementation that could pass when it shouldn't, who knows, this could have been the desired design goal.
I have a standard implementation that I have in my "Class" template in VS that looks like the following:
/// <summary>
/// Returns true if this object is equal to <c>obj</c>.
/// </summary>
/// <param name="obj">Object you wish to compare to.</param>
/// <returns>true if this object is equal to <c>obj</c>.</returns>
public override bool Equals(object obj) {
//if (obj != null && obj.GetType().Equals(this.GetType())) {
// Class1 other = obj as Class1;
// if ((object)other != null) {
// //TODO: Add Equals implementation
// }
//}
return base.Equals(obj);
}
Simply uncommenting will provide you with a basis for property comparisons, eg
if (obj != null && obj.GetType().Equals(this.GetType())) {
PocketIdentityKey other = obj as PocketIdentityKey;
if ((object)other != null) {
return other.Cabinet == Cabinet
&& other.Row == Row
&& other.Tier == Tier
&& other.SplitCode == SplitCode
;
Use of your GetHashCode implementation should always be consistant with your equals implementation as it affects the way a hashmap works, always perform an exclusive or of all properties that are being compared as a minimum, you may wish to perform a shift on some of the properties for a better uniqueness result.
another impl:
if (objFoo.Foo.ToString().Equals(true))
{
chkFoo.Checked = true;
It was a time saver :)
Pingback from Unit testing private methods « Joachim Van den Bogaert’s Weblog
how do you use this class? You have given no instruction on how to implement it.
is it possible to set up appenders so that one appender would log messages from one source and another from another?
Work from home moms.
This seems to be resolved in .NET 2.0+ as it returns TRUE in all the cases now.
Pingback from ted graham
Not Working!!!!!!!!!
This one is not too bad either: (it seems like a comprehensive security checklist)
iase.disa.mil/.../dot-net-checklist-v1r2-1.pdf
Nima
//---------------------------------------------------------
Information Security Software Tools
cryptoexperts.blogspot.com
4fGood idea.8u I compleatly agree with last post. nyo
<a href="http://skuper.ru">ламинированный паркет</a> 9h
I found that the issue could also be due to not having the root certificate installed, for the relevant certificate you have.
This was found on a Windows CE device.
You can get the root certificate by taking the cert from the handheld to your windows box, then opening it.
From here, go to "Certification Path" tab, and click on the top one from the list. Then click "View Certificate", "Details", then "Copy to File...".
Even to find out that one process is running with a name the same as the current name I think it should be processes.Length >= 1
Hello, thank you for this code.
To add two little lines to it :
To use this class, you need two lines :
"using System.Net"
and right before the webservice call :
"ServicePointManager.CertificatePolicy = new AcceptServerNameMismatch();"
My problem was win untrusted root, so i had to change that if to....
hgjgjuhjgggh
hgj
ghjhg
My email is sajazbi@hotmail.com.
I am not able to log in XML file. The following message displayed when I open the XML file:
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
--------------------------------------------------------------------------------
The operation completed successfully. Error processing resource 'file:///C:/AppLog3.xml'. Line 1, Position 363
Following is the code in my App.Config file:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net debug = "false">
<appender name="XmlFile" type="log4net.Appender.FileAppender">
<file value="C:\AppLog3.xml"/>
<appendToFile value="true"/>
<layout type="log4net.Layout.XmlLayout">
<param name="Prefix" value="log4net" />
</layout>
</appender>
<root>
<level value="WARN"/>
<appender-ref ref="XmlFile"/>
</root>
</log4net>
</configuration>
I don't know what I am doing wrong, I would really appreciate it if you can help me to resolve this issue.
Thanks.
Hi Syed,
I think, you don't have admin rights to create xml file on C: drive.
I have used same config setting which you have used & its working fine.
SimpleLogin.aspx.cs:
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using log4net;
using log4net.Config;
using log4net.Layout;
using log4net.Appender;
public partial class SampleLogging : System.Web.UI.Page
//Creating Object of ILog
private static readonly ILog Logger = LogManager.GetLogger(typeof(SampleLogging));
public SampleLogging()
//BasicConfigurator.Configure();
XmlConfigurator.Configure();
protected void Page_Load(object sender, EventArgs e)
Logger.Debug("Logging done at Debug Level.");
Logger.Info("Logging done at Info Level.");
Logger.Warn("Logging done at Warn Level.");
Logger.Error("Logging done at Error Level.");
Logger.Fatal("Logging done at Fatal Level.");
Web.Config
<level value="DEBUG"/>
<appender-ref ref="XmlFileAppender" />
<appender name="XmlFileAppender" type="log4net.Appender.FileAppender">
<param name="File" value="C:\XMLLogTest1.xml"/>
<param name="AppendToFile" value="true"/>
xml Output :
<log4net:event logger="SampleLogging" timestamp="2008-10-22T12:37:02.4357529+05:30" level="DEBUG" thread="4" domain="72f89c2d-1-128691328188888098" identity="LEH\8kaupate" username="LEH\8kaupate"><log4net:message>Logging done at Debug Level.</log4net:message><log4net:properties><log4net:data name="log4net:HostName" value="mbnbw000053" /></log4net:properties></log4net:event>
<log4net:event logger="SampleLogging" timestamp="2008-10-22T12:37:02.6076312+05:30" level="INFO" thread="4" domain="72f89c2d-1-128691328188888098" identity="LEH\8kaupate" username="LEH\8kaupate"><log4net:message>Logging done at Info Level.</log4net:message><log4net:properties><log4net:data name="log4net:HostName" value="mbnbw000053" /></log4net:properties></log4net:event>
<log4net:event logger="SampleLogging" timestamp="2008-10-22T12:37:02.6232565+05:30" level="WARN" thread="4" domain="72f89c2d-1-128691328188888098" identity="LEH\8kaupate" username="LEH\8kaupate"><log4net:message>Logging done at Warn Level.</log4net:message><log4net:properties><log4net:data name="log4net:HostName" value="mbnbw000053" /></log4net:properties></log4net:event>
<log4net:event logger="SampleLogging" timestamp="2008-10-22T12:37:02.6232565+05:30" level="ERROR" thread="4" domain="72f89c2d-1-128691328188888098" identity="LEH\8kaupate" username="LEH\8kaupate"><log4net:message>Logging done at Error Level.</log4net:message><log4net:properties><log4net:data name="log4net:HostName" value="mbnbw000053" /></log4net:properties></log4net:event>
<log4net:event logger="SampleLogging" timestamp="2008-10-22T12:37:02.6232565+05:30" level="FATAL" thread="4" domain="72f89c2d-1-128691328188888098" identity="LEH\8kaupate" username="LEH\8kaupate"><log4net:message>Logging done at Fatal Level.</log4net:message><log4net:properties><log4net:data name="log4net:HostName" value="mbnbw000053" /></log4net:properties></log4net:event>
Regards,
Kaushal Patel
Thanks. I would like to add Refactoring also in this checklist.
You don't need to modify the machine.config. Just add the same configuration element to your web.config / app.config file (depending on whether you are consuming the web services in a web application or another type of application).
A more .NET 2.0 way to do this (accept any server certificate, or customize the delegate):
#if DEBUG
System.Net.ServicePointManager.ServerCertificateValidationCallback =
(System.Net.Security.RemoteCertificateValidationCallback)
delegate(
object o,
System.Security.Cryptography.X509Certificates.X509Certificate c,
System.Security.Cryptography.X509Certificates.X509Chain ch,
System.Net.Security.SslPolicyErrors s )
return true;
};
#endif
Then use your Web service client proxy.
This code snippet doesnt work.
<a href= http://fasster.angelfire.com >baltimore and convention center and headquarters</a> <a href= http://gertui.angelfire.com >nasdaq 100 tennis tournament</a>
<a href= http://fairra.angelfire.com >landls end</a> <a href= http://vonucshka.angelfire.com >chancellor internal med</a>
<a href= http://chkola.angelfire.com >avlastkey</a> <a href= http://bustersw.angelfire.com >how to start a strawberry patch in alabama</a>
<a href= http://kustur.angelfire.com >dad vail regatta</a> <a href= http://trututa.angelfire.com >ratings apartments eagle ridge alabama</a>
<a href= bestpre.com ></a>
<a href= spiritez.com ></a>
<a href= membres.lycos.fr/maffals >genetic disorters</a>
<a href= membres.lycos.fr/dertull >zx10r graphics</a>
<a href="http://myrxpill.com">Prescription pills</a> http://MyRxPill.com
"Is foreach used in preference to the for(int i...) construct?"
This is an interesting one.
Referencing this article www.c-sharpcorner.com/.../IterationsInNet.asp
it would seem to be that the for(int i...) is faster than a foreach. I've always found anecdotatl evidence that a foreach is slower than a for(int i...) loop. What is your experience using the two and why do you prefer foreach?
Pingback from Wertegleichheit von Objekten pr?fen | hilpers
I like the points, but I think as a checklist there are too many items here. I might know all these things as an expert developer, but as an aide-memoir a check list need to be short enough so that every item can be covered and, if need be, signed off with consuming hours for ever code review.
My own checklist is much shorter: nomorehacks.wordpress.com/.../code-review-checklist
thanks man.. works perfectly.. :)
I was taught the way you've blogged although recently have been questioning it.
We're using a Command pattern, with one public method, Execute. Within that method other commands may be called etc...
We're finding we have to Mock an awful lot in order to make sure unnecessary code isn't hit. This becomes messy and unmanageable.
I know people will argue we should refactor, but are code is quite clean, and broken down into lots of small commands. It's just that a command may call 4 others during execution.
This is leading me to looking at other ways of testing, and possibly testing private methods.
<a href= adultpersonalsfinder.com >singles</a>
<a href= http://adultromancefinder.com >find partner</a>
<a href= adultpersonalsfinder.com >find partner</a>
<a href= http://adultchatsfinder.com >find partner</a>
<a href= adult-singles-finder.com >dating</a>
Hi,
I tried putting entries in both machine.config and web.config of web application. But that didn't work.
Code is of C#. Can you plz provide in Vb.net?
Sehr wertvolle Informationen! Empfehlen!
Forum di registrazioneeeee.. Helpppp?praticamente mi sn iscritto e so ke ci sn 10 sms al giorno gratis...volevo sapere se vale la stessa cs anke x gli mms
grazie ;)
<a href=www.chat-libera.net/.../chat-lazio.html>Chat Lazio</a>
____________
buon 2009
find stripper
THANKS!
Step #2 solved my problem. I developed a complex mobile app for my company that had to be put on hold for financial reasons. Finally, someone got interested again, but the device had been sitting around resulting in the battery getting low resulting in the clock resetting to an early default date. I spent hours trying every fix I knew. This did it.
System.Net.ServicePointManager.ServerCertificateValidationCallback
is not available in Windows Mobile platform
www.message_rolcrolit.com
how to use the class? what changes need to be done on App.config
Hi Thanks a lot!
I am not OIK with point # 17 : Are readonly variables used in preference to properties without setters?
Don't you think this violets encapsulation?
You can press esc and it should come out of flat mode...
Que bacana !!!! Procurando por um checklist para fazer um Code Review de um projeto que estou atuando
learner, thanks a bunch, that's the tip i needed.
yes, just adding command type solved my problem.
Does your software project need an expert code review? In addition to maintaining this blog, I'm one of the founders of CodeReviewers, a community of experts who believe in the power of peer reviews.