Another reason against software patents

by Sander Gerz June 26, 2005 13:26
Most developers, at least in Europe, should be aware of the discussion about software patents. No, I'm not going into that right now, but here's another reason against patents, more or less in general. Please, don't take this post too seriously.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Fighting spam, again [update]

by Sander Gerz June 26, 2005 09:26

I noticed this post, and it triggered me to check my weblog-database. And yes, there they were, about 50+ records pointing to online casino's, cheap loans etc. Appearantly, this time it's not comment spamming, for which I had a solution (capatcha).

Now it's trackback spamming. The records were all from yesterday and today, so it seems someone has just started the spamming engine. They're easily deleted with a simple SQL statement, but prevention is always better. I'll try to implement a suggested solution asap.

[update]

Brian Delahunty  has developed a new method of fighting trackback scam. This one will work for .Text and dasBlog and, so he says, any other ASP.NET based blogging engine. So far I've only scheduled a Sql Server job that will delete all unwanted urls. It automatically runs every 15 minutes to keep the blog clean. Of course, prevention is always better.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

New MVP logo

by Sander Gerz June 22, 2005 08:11

I received the MVP Logo kit today  and here's the new MVP logo. Do I need to throw away all my current business cards? 

MVP Logo

I hope not.

Not everyone seems to be happy with the new logo (read the comments). Personally, I think the old logo was really outdated.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

PDC '05

by Sander Gerz June 08, 2005 08:19

If you're missing out on Tech-Ed '05, perhaps you can convince your boss (or spouse, sometimes they're the same person) to let you go to the Professional Developers Conference. Those that are lucky can do both.

While Tech-Ed is usually focused on what's available now, the focus of PDC is more on what's to come. Personally, looking at the tracks of both Tech-Ed '05 and the PDC '05, both events come closer together than last PDC in 2003. Still, if you're a developer and need to prepare for the future, PDC is an event not to be missed.

 

Currently rated 1.5 by 8 people

  • Currently 1.5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.NET | .NET | .NET | .NET

Custom settings in Web.Config

by Sander Gerz June 03, 2005 20:22

Ever felt the need to switch settings in your web application based on the server it was running on? Well, I have. Suppose you have a connection string in your Web.Config (encrypted, sure). You don't want to be changing the configuration manually everytime you switch from development, to testing and to production. So here's what I do.

First, you create a new section in the Web.Config file.

    <mySettings>
        <!-- development -->
        <Configuration url="http://localhost"> 
            <add key="ConnectionString" value="server=(local);database=Northwind;user id=sa;password=..." />                     
            <add key="SettingWhatEver" value="true" /> 
        </Configuration> 
        <!-- testing -->
        <Configuration url="http://testserver"> 
            <add key="ConnectionString" value="server=testserver;database=Northwind;user id=dbusr_test;password=..." />                     
            <add key="SettingWhatEver" value="true" /> 
        </Configuration> 
        <!-- production -->
        <Configuration url="http://liveserver"> 
            <add key="ConnectionString" value="server=prodserver;database=Northwind;user id=dbusr_prod;password=..." />                     
            <add key="SettingWhatEver" value="false" /> 
        </Configuration>         
    </mySettings>

The mySettings element is inserted as a child of the configuration root element in your Web.Config.

Then, you create a custom section handler for the Web.Config file.

Imports System
Imports System.Xml
Imports System.Configuration
Public Class MySettings
    Inherits Hashtable
    Implements IConfigurationSectionHandler
    Public Function Create(ByVal parent As Object, ByVal configContext As Object, ByVal section As System.Xml.XmlNode) As Object _
        Implements System.Configuration.IConfigurationSectionHandler.Create
        Dim HostUrl As String = HttpContext.Current.Request.Url.Host
        Dim NodeSetting As XmlNode
        Dim NodeSettings As XmlNodeList
        Dim Settings As New Hashtable
        NodeSettings = section.SelectNodes("Configuration[contains(@url,'" & HostUrl & "')]/add")
        For Each NodeSetting In NodeSettings
            Me.Add(NodeSetting.Attributes.GetNamedItem("key").Value, NodeSetting.Attributes.GetNamedItem("value").Value)
        Next
        Return Me
    End Function
End Class

This section handler will read from the mySettings element, and select the node with the url-attribute that contains the HostUrl value. This is a simple XPath expression, perhaps you want to finetune it depending on your needs.

Finally, you go back to the Web.Config and make sure the section is understood and read by adding this element to the Web.Config

<configSections> 
  <section name="mySettings" type="WebApp.MySettings, WebApp" /> 
</configSections>  

The first attribute holds the custom section name in the Web.Config. The second attribute holds the class that will handle this section (WebApp.MySettings) and the assembly where this class can be found. The section handler is located right under the configuration root element, but before the mySettings element mentioned above. Be aware that XML is case-sensitive.

Now that your done, you can access the desired setting through:

Dim constr As String = Context.GetConfig("mySettings")("ConnectionString")

Depending on the host you are running the web application on, this will return the development, testing or production connection string.

Currently rated 5.0 by 2 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

.NET

OMG, yet another VB.NET versus C# article

by Sander Gerz June 02, 2005 11:32

Not another C# versus VB article, says the author. And yet, it is. Although not the technical comparison, but as it turns out a, let's say, cultural comparison that deals mostly with the developers using either language. While a nice article to begin with, explaining the history of both languages, the role Java played in the construction of C#, its creators, the result is pure VB bashing.

Take some of these quotes:

  • “ 80% of VB programmers are not good“
  • “the average C# programmer is a better programmer than the average VB programmer“
  • “Most VB teams have trouble writing high quality code“
  • “An organization with an exceptional VB team should switch to C#. “

I cannot begin to discuss each of the arguments Nigel Shaw, the author, makes, because most of the article lacks any ground for his reasoning.

 

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen | Modified by Mooglegiant