Visual Studio can require quite a lot of memory.  This is especially true if your solution is fairly large or you are accidentally including a bit to much of your database (opps!).  The important thing to realize is that even if you have a lot of memory, the Visual Studio IDE (as of 2011 at least) is still a 32 bit application.  Once it gets to the 2 GB limit, it starts throwing those annoying OutOfMemory exceptions which can not be handled or caught.  Usually at this point, it will eventually crash.  This can make it very hard to even find and remove the offending code (if possible).

The solution turns out to be to extend the virtual memory to 4GB.  To do this, you just need to do a few things:

Open a command line as administrator and change to “C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE”.

Then execute “editbin /LARGEADDRESSAWARE devenv.exe”

 

If you get an exception that it can not find mspdb100.dll, run “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat” to load the dll.

 

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

With Facebook adding the cover picture across the top of the new timeline layout, the obvious thing to do is to create a special graphic just for that.  Turns out the best size is 850x315px.  A standard jpg works fine.

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

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

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