The TcpClient has a Connected property that is very convenient to use but unfortunately it doesn’t do what you think it should do. A better name for this property would be WasConnected or WasLastOperationSuccessful. The problem is that this property only tells you the status of the last operation. For…
Tag: .Net
How to group items in InDesign using VB.Net/C#
First off, give up going the native route. There’s no way that I’ve found that you can convert an array to an InDesign.Objects object. Also, subclassing InDesign.Objects doesn’t appear to work either. What does ultimately work? JavaScript. Don’t worry, you can create JS on the fly and have InDesign execute…
“Could not find any resources appropriate for the specified culture or the neutral culture”
Just recieved this error: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure “AjaxControlToolkit.Properties.Resources.NET4.resources” was correctly embedded or linked into assembly “AjaxControlToolkit” at compile time, or that all the satellite assemblies required are loadable and fully signed. Sometimes .Net errors look a lot…
Sql OUTPUT Params, SqlDataReaders and “Object reference not set to an instance of an object”
When you call ExecuteReader() on a SqlCommand object that has OUTPUT parameters you won’t be able to access the OUTPUT parameters until the SqlDataReader has been closed. Private Shared Sub SomeMethod() Using Con As New SqlConnection(“DSN…”) Con.Open() Using Com As New SqlCommand(“MyProc”, Con) Com.CommandType = System.Data.CommandType.StoredProcedure Com.Parameters.Add(New SqlParameter(“@YourOutputParam”, System.Data.SqlDbType.Int) With…
Fixing “The remote server returned an error: (417) Expectation Failed”
After failing at breakpointing and debugging request and response headers I almost snapped Wireshark to my connection to determine why I was getting an WebException of “The remote server returned an error: (417) Expectation Failed“. A little searching took me to this site with the solution. The simple solution is…
Creating a simple multi-threaded VB.Net application
I write lots of desktop tools that help me do my job more efficiently. For instance, I’m normalizing a 98 million row live table and do to the nature of the server, table locks, etc, I’ve decided to pull the data down in batches using a VB.Net app, analyze it…
Fixing “query processor ran out of stack space”
I’ve been normalizing a table with 98 million rows for a couple of days now and with a recent change I’ve been able to run my batches in groups of 100,000 instead of just 10,000. The program doing the normalization pulls down 100,000 records at a time, analyzes and groups…
ASP.Net PNG and the dreaded “a generic error occurred in gdi+”
If you ever make a PNG on the fly using ASP.Net and try to write it directly to the Response.OutputStream you’ll get the exception “a generic error occurred in gdi+“. If you change the output type to JPG or GIF it runs just fine, just PNG breaks. Now usually .Net…
True ASP.Net (and IIS) 404 errors
UPDATE: I should found out that in ASP.Net 3.5 the <customErrors> section in web.config now supports the attribute redirectMode which default to ResponseRedirect but can be changed to ResponseRewrite. This will force the proper HTTP status codes to come through for errors. So I launched a new site porting it…