I love ReSharper for C#, but kept having problems with it generating an warning about “inconsistent naming” on every event handler generated by Microsoft Visual Studio 2010.  I kept thinking that there must be an easy way to tell ResSarper that ”SomeObject_SomeEventHandler” is a valid name for a method.

I finally came across the answer on a thread on their forum, and it is really easy to fix.

In Visual Studio 2010, you:

  • go To Resharper -> Options -> Languages -> Common -> Naming Style
  • Click “Advanced Settings”
  • On the dialog you will find “Event subscriptions on fields“. Change the value to “$object$_$event$” and it should work.
Be the first to comment
del.icio.us this! Digg this! RSS 2.0 TOP

One of the problems that anywhere has is letting in the people and things that you want while keeping out what you don’t want.  This is especially true on the internet.  With a blog like this you have several different groups hitting it:

  • Good users, like yourself, who just want a good read and to maybe learn a little
  • Good robots, that harvest the web for information in a responsible way.  They play by the rules, don’t overload the servers and often provide some positive service.  For example, the googlebot will help make sure that Google has properly indexed my pages.
  • Bad Users, or spam commenters.  You know the ones.  The ones who post spam comments like “Forex Trading Tools…” on your totally unrelated post just so that they can get a link to their site.
  • Bad robots.  Some are just plain evil and are trying to steal data or content, and some may have good intentions, but not be playing nice and end up using a lot of badwidth or causing other colateral damage.

So, how do we allow and encourage the good users while discouraging or totally filtering out the bad?

One suggestion that I always make for WordPress Blogs is Bad Behavior.  This is a must for any PHP-based Web package, such as WordPress or Drupal.

It works alongside your existing spam filters in order to increase the site’s efficiency and effectiveness.  It does this by working very differently than your traditional spam filter.  Rather than just trying to catch spam comments after they are posted, bad behavior “acts as a gatekeeper, preventing spammers from ever delivering their junk, and in many cases, from ever reading your site in the first place”.  By looking at a number of factors about how the user is accessing your site, where they are from and several others, Bad Behavior can filter out some robots and users based on previous activity by that or similar users.  The other thing that it does is to provide an easy way for users who are perhaps accidentally blacklisted to get through.

What good is it if a user can still easily get through?  Well, if you are a robot trying to frantically spam the world, you are more likely to wander off than figure it out.

So, in short, Bad Behavior is a must have.  It reduces not only your spam, but your junk bandwith usage while still allowing all those good users through.

Be the first to comment
del.icio.us this! Digg this! RSS 2.0 TOP

We have been using the Telerik components for a while, but one of the issues that we recently ran into is that when you export to CSV from a Telerik RadGrid, there are “some strange characters at the beginning. This is BOM (Byte Order Mark) header – it marks the file content as Unicode.” (see the RadControls for ASP.NET AJAX Documentation for more info).

It turns out that you have to add some extra code to in the XXX_GridExporting function to remove the UTF-8 BOM code.  Telerik suggests:

protected void RadGrid1_GridExporting(object source, GridExportingArgs e)
{
    if (e.ExportType == ExportType.Csv)
    {
        Response.ContentType = "application/csv";
        Response.AddHeader("Content-Type", "text/csv");
        Response.BinaryWrite(new ASCIIEncoding().GetBytes(e.ExportOutput));
        Response.End();
    }
 }
Since I am exporting from several places, I ended up going a step further and making it a separate procedure.

 

 

Be the first to comment
del.icio.us this! Digg this! RSS 2.0 TOP

I cam across a handy little command line hex editor – XVI32.  While it does not have a lot of flash, it does a good job at giving you a view of the file.

You can find it at the Freeware Hex Editor XVI32 site.

Be the first to comment
del.icio.us this! Digg this! RSS 2.0 TOP

I recently created a quick little app in C# and was outputting data to a multiline textbox (create a textbox and set the MultiLine parameter to true).  The problem that I was having was just entering a new line or getting it to start on the next line.  Being a C programmer, I tried ‘\r’ and ‘\n’ but it didn’t work.

Turns out that the solution is to use “Environment.NewLine“.

example:

    textBox1.Text = "This is line 1" + Environment.NewLine + "This is line 2";

I also came across these:
How can I insert a new line in a TextBox? (C# Knowledge Base) • Geekpedia
How To Add A New Line in a C# or Visual Basic TextBox at DiscoMoose

Be the first to comment
del.icio.us this! Digg this! RSS 2.0 TOP

I recently had to update some Delphi 2007 projects and ended up having to set up the environment on my new 64 bit Windows 7 machine.

I found that whenever I tried to debug code, it worked fine until I stopped the program and then I would get this error popup for bordbk105N.dll (multiple times):

Assertion failure: "(!"SetThreadContext failed")" 
in ..\win32src\thread32.cpp at line 412 
Continue execution?

This got frustrating fast!  If I clicked “no” then Delphi crashed out losing my work and if I clicked “yes”, the popup would come up several times more before allowing me to carry on.  I tried the obvious things like compatibility mode and running as an administrator, but that didn’t help.

Checking Google, I found a good article “A work around for Delphi 2007/2009 with Windows 7 64 bit” which explains that basically there is an incorrect call to the SetThreadContext API call and this is triggering an assert every time.  Someone has figured out that if you change one byte in the dll, it ignores the return code from SetThreadContext and the problem goes away.

A programmer named “LordByte” has released a great little utility that will patch Delphi 2007 and Delphi 2009 to handle this at Delphi_2007_2009_WOW64_Debugger_Fix.zip.  I must admit that I was not thrilled with the idea of just downloading some unofficial program to hack my dll, but it works like a charm and it makes Delphi usable.

Thanks loads to everyone involved in finding, fixing and publicizing this!

1 Comment. Join the Conversation
del.icio.us this! Digg this! RSS 2.0 TOP

We all know that plagiarism is pretty rampant on the web these days. There is also certainly a lot of people who will happily rip of anything that they can. It is even worse though when they try to use your ideas to support their positions without bothering to ask how you feel about it.

This happened to Zach Weinersmith recently (my new favorite blog).  He had published a fun comic about technology.  A group called the National Organization for Marriage (NOM) had reposted the comic on their site.  The catch is that NOM is a group whose major function is lobbying against gay marriage.  I get the distinct impression that Zach does not support NOM or want to be associated with them in any way.  Good for him.

He could have threatened or got upset.  Instead, he got even.  This is the part that I really love.  NOM had not only taken his graphic, they hadn’t even done it well.  They hotlinked to Zach’s site, which among other things means that he gets all the download bandwidth without the advertising stream but it also means that he still controls the content.  So, he did the obvious.  He changed the content.  The end result is that NOM posted a pro gay rights message.  Even better, once Zach’s followers found out and tried to download a screen capture of it, the suden heavy traffic crashed the site.  Ya gotta love it!  Anyways, read the original post on Zach’s site for more info.

Be the first to comment
del.icio.us this! Digg this! RSS 2.0 TOP

Menu not working in IE8 with ASP.NET 2.0

By mbentley | Filed in ASP.NET, C#

I recently came across some weird behavior in Internet Explorer 8.  We had a page that seemed to work fine in development, but when we put it on the production server, the ASP.NET menu was not showing the drop down sections properly.  Instead of the submenus, we just got a blank area with IE8.  If we switched to the IE7 compatibility mode, it worked fine.

Turns out that this is a known bug which should be fixed in ASP.Net 4.0.
I cam across a couple of solutions and ended up just putting the following code in the <head>…</head> section of the page:

<style>
    .adjustedZIndex {
        z-index: 100;
    }//use this css for ur menu
</style>

There is also a patch that you can install on your server, but unfortunately we did not want to reboot our production server at this time.
There is a useful thread about it on the ASP.NET forum.

Be the first to comment
del.icio.us this! Digg this! RSS 2.0 TOP

ERROR: xrxsnmp.dll was not found

By mbentley | Filed in Programming

Periodically, several of our applications (mostly on Windows XP) get a popup with the error “This application has failed to start because xrxsnmp.dll was not found. Re-installing the application may fix this problem.”  Shortly after that, I get a call that the app is broken.

The xrxsnmp.dll file is used by some Xerox printer drivers.  For some reason it seems to get periodically messed up on some machines.  Re-installing the printer drivers always fixes the error.

Be the first to comment
del.icio.us this! Digg this! RSS 2.0 TOP

I often use Firebird because it is reliable, cheap (ok, free) and does everything that I need for most projects.  Recently, while looking into some issues that we were having, a co-worker came across a few things while using the Firebird Monitoring tool by Sinatica.  One of the things that he noticed was that we were not properly specifying our connection information.

After doing some looking around, I found a couple of useful links:

Both of these links provide some great info.

After some tweaking, my current connection string in the web.config file for an ASP.NET 4.0 website connecting to a Firebird 2.1 server is something like:

<connectionStrings>
    <clear/>
    <add connectionString="Server=192.1.1.8;timeout=60; database=192.168.1.1:DATABASE_NAME;User=sysdba;Password=masterkey;Charset=WIN1252" name="corViewDb" providerName="FirebirdSql.Data.FirebirdClient"/>
</connectionStrings>
Be the first to comment
del.icio.us this! Digg this! RSS 2.0 TOP

Bad Behavior has blocked 235 access attempts in the last 7 days.