EppesConsulting Blog

The Random Tech Stuff I Run Into Every Day

Browsing Posts in code

I was playing around with MOBI/EBOOK formats today (more posts to come in the future) and needed to add a MIME type to my GoDaddy shared hosting account.  I found a great article on how to do this through your Web.config file here.  In my case, the Web.config ended up looking like this:


<configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".epub" mimeType="application/xhtml+xml" />
     </staticContent>
    </system.webServer>
</configuration>

One of my friends wrote an excellent article on Wireframing
with Fisher Price
.  The idea is that you can use a child’s toy (similar to
an Etch A Sketch) to wireframe effectively.  I believe the most important theme
he captured was:

No detail – It’s very hard or nearly impossible to put any type of detail into
these drawings. In some parts of design, detail is very important, but in wireframing,
detail can be the downfall of the process.

Ever need to automatically send a tweet?

Tweet#

The best way to restart a Windows machine from C# code:

restart
computer using c# code

Tired of using TortoiseSVN from Windows in conjunction
with Visual Studio?  Integrate the two:

AnkhSVN

My Windows Update kept wanting me to install KB971092 for VS 2k8 over and over again. 
After a few minutes of Googling, I found the work-around.  It sounds like the
installer was checking for C++ to be installed and I didn’t have it, but it was trying
to update it anyway.

https://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=478117

I needed a thumbnail of a PDF for a web site.  The trick is the PDF updated daily
and I didn’t want to have to re-create the JPG every day.  This problem was
solved in two pieces:

  1. Ghostscript – A single
    command rasterized the PDF into a JPG.
  2. ImageMagick – A single command (with two
    sub-commands in it) cropped the JPG and resized it at my output thumbnail size.

I scheduled this conversion after the PDF had been built (using MSSQL Server Agent)
and the process was 100% automated to run every day.

I had to re-load my entire system the other day (I believe it was a trojan/virus that
came through the hole announced in Acrobat) and when I restored all my C# projects,
one couldn’t compile.  The error I was getting was:

The custom tool ‘MSLinqToSQLGenerator’ failed. Unspecified error

After browsing around for a while, I came across the fix.  I am pretty sure I
was running Visual Studio 2008 SP1 before, but I know for sure I am now, so maybe
I’m just remembering it wrong and the upgrade from vanilla to SP1 explains the error
starting to show up now.

http://www.rvduren.nl/dotNet/comments.php?y=09&m=02&entry=entry090220-093932

The best way I’ve found so far to tell if I’m running inside a virtual machine is
to check the video driver.  You can enumerate the system devices using something
like this:

Query hardware device
status in C#

And then check the video driver for a string like “VMware SVGA II” (for VMware Server).

I ran into a strange problem the other day trying to send an email from code (C# using SmtpClient/MailMessage). 
I was sending an email TO an external email address using our network’s SMTP relay. 
I was authenticating, so the email should have gone through w/o a problem.  The
code worked just fine for me, but whenever a contractor that works remotely ran it
on their system, the email wasn’t sent.  There wasn’t even an exception to show
for it.  Amusingly, with my internal email address in the CC, the CC made it,
but the external TO did not.  I double checked the username/password.  Tried
the IP address instead of the DNS name of the mail server.  Finally on a hunch,
we added the “domain” parameter to the NetworkCredential that
was being created with our domain name.  That finally fixed it.

Apparently, the way the Cisco VPN we have works is even though he was logging in using
domain credentials, the computer isn’t actually being joined to the domain, so the
code wasn’t seeing a domain name when it created the NetworkCredential
I also would have assumed that since the SMTP relay knew about our domain, that would
have been the default domain it would have authenticated against, but apparently not.