Is there anyone that has experience with the Your Online Choices | IAB site?
They seem to be able to turn off cookie tracking for selected advertisers.
I’m anxious to hear if this scam or not.
–jeroen
Posted by jpluimers on 2012/11/16
Is there anyone that has experience with the Your Online Choices | IAB site?
They seem to be able to turn off cookie tracking for selected advertisers.
I’m anxious to hear if this scam or not.
–jeroen
Posted in LifeHacker, Opinions | Leave a Comment »
Posted by jpluimers on 2012/11/15
A while ago, one of the users at a client got an error in a .NET 1.1 app of which the sources were not readily available:
“application has generated an exception that could not be handled”
I think it is a e0434f4d exception.
This particular site has very strict rules about what you can and cannot do as a developer. Which means that on a production system, you basically cannot do anything.
A few links that should help me finding the solution, and escalate far enough upstream to get someone with local admin rights to assist me:
If WinDbg is allows to be ran, these should help me:
–jeroen
Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2012/11/14
Over the course of development time, each suite of projects is bound to get some renames.
Doing that from the Visual Studio IDE is a pain, so I was glad to find Visual Studio Project Renamer by ComVisible.
Though it only supports C# and VB.NET projects (so no solution rename or rename of F#, Database or Reporting Service projects, nor stuff outside of the Microsoft realm like Prism).
These Just geeks: Renaming a Visual Studio Project link led me to the project.
Renaming solutions still is largely a manual operation as it involves renaming directories. You have to re-add some (sometimes all) projects later where this tool can come in handy: CoolCommands by SharpToolbox.
–jeroen
via:
Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, F#, Prism, Software Development, VB.NET, Visual Studio and tools | Leave a Comment »
Posted by jpluimers on 2012/11/13
Thanks Andre for this cleanup code:
To clean up a file name you could do this
private static string MakeValidFileName(string name) { string invalidChars = Regex.Escape( new string( Path.GetInvalidFileNameChars() ) ); string invalidReStr = string.Format( @"[{0}]+", invalidChars ); return Regex.Replace( name, invalidReStr, "_" ); }
Next to GetInvalidFileNameChars, you have GetInvalidPathChars.
–jeroen
Posted in .NET, C#, Development, Software Development | 2 Comments »
Posted by jpluimers on 2012/11/12
Usually, I run IIS only on server systems, but for the occasional time when I need it on a (development) workstation (as Cassinni only listens to localhost), these links come in handy:
C:\inetpub\wwwroot realm), make sure the rights are set correctly.–jeroen
Posted in Development, IIS, Software Development, Web Development | 2 Comments »
Posted by jpluimers on 2012/11/09
Thanks to Matthijs ter Woord who pointed me to these.
They require a single Intel®, Nvidia®, or AMD® primary WDDM driver. That driver does the actual rendering, the USB device then gets the rendered parts over USB to the monitor.
The really cool thing is: they work on a PC with Windows XP and higher, and on Mac with OS X Tiger or better.
The chipsets are based on DisplayLink technology; they have their own USB devices as well.
USB2.0 to DVI-I Graphics
CSV-2000D – SenseVision USB Graphics – USB2.0 to DVI-I
USB2.0 to DVI-I graphics devices let you easily add an additional monitor to your notebook PC, desktop and MacBook®. The Club 3D SenseVision USB2.0 to DVI-I Graphics allows you to extend your desktop display beyond 1080p HD resolution displays. … View Details
USB2.0 to HDMI Graphics
CSV-2000H – SenseVision USB Graphics – USB2.0 to HDMI
USB2.0 to HDMI graphics devices let you easily add an additional monitor to your notebook PC, desktop and MacBook®. The Club 3D SenseVision USB2.0 to HDMI Graphics allows you to extend your desktop display beyond 1080p HD resolution displays. … View Details
–jeroen
Posted in Apple, Mac, Mac OS X / OS X / MacOS, Mac OS X 10.4 Tiger, Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, Mac OS X 10.7 Lion, MacBook, MacBook-Air, MacBook-Pro, Power User, Windows, Windows 7, Windows 8 | Leave a Comment »
Posted by jpluimers on 2012/11/08
Handling names of drives and paths (directories, filenames) is hard in Windows, as both C:myfile.ext and C:\myfile.ext are valid – but potentially different – filenames, C is a valid driveletter, C: and C:\ are valid – but also potentially different – directory names.
This leads into confusion as how Path.Combine behaves.
Part of the confusion comes from the meaning of the absence or presence of the leading DirectorySeparatorChar as explained by user Peter van der Heijden:
C:filenameis a valid path and is different fromC:\filename.C:filenameis the file filename in the current directory on theC:drive whereasC:\filenameis the file filename in the root of that drive. Apparently they wanted to keep the functionality of refering to the current directory on some drive.This behaviour is described here in MSDN
Another oddity is that Path.Combine will only use the drive portion of the left argument when the right argument contains an absolute path.
If you understand the above, then dealing with cross platform directory and path separators, spaces in filenames and UNC path names are peanuts (:
–jeroen
Posted in .NET, C#, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »
Posted by jpluimers on 2012/11/07
Once every while a Dilbert strip is so great, you *have* to re-publish it.
So here it goes: Wally and testing the new 3-DD printer.
–jeroen
via: Dilbert comic strip for 11/05/2012 from the official Dilbert comic strips archive..
Posted in Comics | Leave a Comment »
Posted by jpluimers on 2012/11/07
A while ago I needed to shorten SqlClient ConnectionStrings. One way to do that is to use the shortest Key for each property (and not use the default key names that are much longer).
I beefed up the code to show you both the shortest and all equivalent keys (a few of the Microsoft exams want you to memorize most of these).
The HTML table below (similar to the huge and therefore hard to read table on MSDN) comes directly from the C# code at the bottom of the post. The only post-editing I did was making the header row bold.
| Key | ShortesEquivalentKey | EquivalentKeys |
| Application Name | app | Application Name,app |
| ApplicationIntent | ApplicationIntent | ApplicationIntent |
| Asynchronous Processing | async | Asynchronous Processing,async |
| AttachDbFilename | AttachDbFilename | AttachDbFilename,extended properties,initial file name |
| Connect Timeout | timeout | Connect Timeout,connection timeout,timeout |
| Connection Reset | Connection Reset | Connection Reset |
| Context Connection | Context Connection | Context Connection |
| Current Language | language | Current Language,language |
| Data Source | addr | Data Source,addr,address,network address,server |
| Encrypt | Encrypt | Encrypt |
| Enlist | Enlist | Enlist |
| Failover Partner | Failover Partner | Failover Partner |
| Initial Catalog | database | Initial Catalog,database |
| Integrated Security | trusted_connection | Integrated Security,trusted_connection |
| Load Balance Timeout | connection lifetime | Load Balance Timeout,connection lifetime |
| Max Pool Size | Max Pool Size | Max Pool Size |
| Min Pool Size | Min Pool Size | Min Pool Size |
| MultipleActiveResultSets | MultipleActiveResultSets | MultipleActiveResultSets |
| MultiSubnetFailover | MultiSubnetFailover | MultiSubnetFailover |
| Network Library | net | Network Library,net,network |
| Packet Size | Packet Size | Packet Size |
| Password | pwd | Password,pwd |
| Persist Security Info | persistsecurityinfo | Persist Security Info,persistsecurityinfo |
| Pooling | Pooling | Pooling |
| Replication | Replication | Replication |
| Transaction Binding | Transaction Binding | Transaction Binding |
| TrustServerCertificate | TrustServerCertificate | TrustServerCertificate |
| Type System Version | Type System Version | Type System Version |
| User ID | uid | User ID,uid,user |
| User Instance | User Instance | User Instance |
| Workstation ID | wsid | Workstation ID,wsid |
The code below uses a few techniques referenced as StackOverflow links:
Both the main program and the SqlConnectionStringBuilderHelper class are less than 70 lines of code (each about 50 when excluding comments and empty lines).
The SqlConnectionStringBuilderHelper uses the internals of the SqlConnectionStringBuilder class (all DbConnectionStringBuilder descendants I have seen work in a similar way):
Related:
Persist Security Info: [WayBack] c# – Persist Security Info Property=true and Persist Security Info Property=false – Stack OverflowNetwork Library:
OLE DB Services:
Enjoy the code: Read the rest of this entry »
Posted in .NET, ASP.NET, C#, C# 3.0, C# 4.0, C# 5.0, CSV, Development, LINQ, Software Development | Leave a Comment »
Posted by jpluimers on 2012/11/06
Boy, was I astonished to see the code fragments below in production apps. It is far more Daily WTF than Coding Horror.
However, it did make debugging the production problem at hand a lot worse than it should be.
First a few short pieces:
private void method(Word.Application objNewDoc, string stringWithCsvSeparatedDotFileNames)
{
char c = char.Parse(",");
string[] wordAddIns = stringWithCsvSeparatedDotFileNames.ToString().Split(c);
}
It took me almost a minute to understand what happened here. Especially because the names of parameters actually were pretty meaningless.
foreach (string sFilename in attachments)
{
Word.Application mailDocument = new Word.Application();
string[] filePath = sFilename.Split('\\');
string tempDirectory = GetTempDirectoryFromConfigFile();
object fileName = tempDirectory + filePath[filePath.Length - 1];
File.Copy(sFile, (string)fileName, true);
// some code that actually does something with the attachment
}
It took me more than a few minutes to realize that:
internal virtual bool Method(/* parameters */, Word.Application objDoc)
{
// lots of pre-initialized empty string variables that are used at the very end of the method
Word.Application objNewDoc;
if (objDoc != null)
{
objNewDoc = objDoc;
}
else
{
objNewDoc = new Word.Application();
}
// lots of Object variables for COM, including:
Object missing = Missing.Value;
Object bFalse = false;
try
{
// lots of code that does not use objNewDoc
}
catch (IOException IOex)
{
objNewDoc.Quit(ref bFalse, ref missing, ref missing);
objNewDoc = null;
throw IOex;
}
catch (Exception ex)
{
objNewDoc.Quit(ref bFalse, ref missing, ref missing);
objNewDoc = null;
throw new Exception("Some error message.", ex);
}
finally
{
// empty finally block
}
try
{
// actual coder that does use objNewDoc
}
catch (Exception ex)
{
objNewDoc.Quit(ref bFalse, ref missing, ref missing);
objNewDoc = null;
throw new Exception("Some error message.", ex);
}
return true;
}
I rewrote the whole piece into separate methods.
Luckily the person who wrote this got promoted away from programming a few years ago.
–jeroen
Posted in .NET, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development | Leave a Comment »