Thursday, April 05, 2012

Command-Line Warning D9040

I am going to hold this up as another example of why I dislike the Microsoft software model. Firstly its some random error number and a message which is misleading (my edition was Premium that architecture was 64bit), secondly it shows that the 64bit and 32bit compilers are not the same and clearly 64bit is inferior.

http://msdn.microsoft.com/en-us/library/aa983384%28v=vs.80%29.aspx

Command-Line Warning D9040

Error Message
ignoring option '/analyze'; Code Analysis warnings are not available in this edition of the compiler

The /analyze command line option is supported only on x86 versions of Visual Studio Team System. It is not available for x64 or Itanium compilers, or for other versions of Visual Studio besides Visual Studio Team System. To remedy this warning, either switch to the x86 version of Visual Studio Team System, or remove the command line option.

Monday, April 02, 2012

Replacing part of a filename using bash scripting

My brother has a dovecot mail server that every now and again the cache would corrupt on it. He would just go in, check the logs and rename the file affected. He just asked if I could script the process. So this little script will search through a log, extract the filename, alter its name and move the file to the new location:

#!/bin/bash

QFILE=test.log

grep "Error: Maildir filename has wrong W value:" $QFILE | while read line
do
fileNo=$(echo "$line" | awk '{split($0,a,","); for (idx in a) { split(a[idx], b, "="); if (b[1] == "W") print b[2]; }}')
fileName=$(echo "$line" | awk '{split($0,a," /"); print a[2]}')
echo "/$fileName"
echo "$fileNo"
fileNameFixed=${fileName//,W=$fileNo}
echo "/$fileNameFixed"
mv /$fileName /$fileNameFixed
done

Monday, March 12, 2012

Parallel Internet

The Internet is all about transferring files/data from one place to another.

FTP (File Transfer Protocol) and HTTP (HyperText Transfer Protocol) are among the oldest and widely used protocols. There is an effort to update HTTP to 2.0, what I'd like to see is a similar effort for FTP.

One thing that bugs me is I have to decide on a server to server basis what the maximum number of simultaneous connections is. Clearly the server is the best judge as to how many resources it has available for me to download or upload at once.

The SPDY (Speedy protocol) is an effort to improve that by Google but FTP also needs to be more adaptive.

Wednesday, March 07, 2012

How to send an email using Exchange Webservice


public bool SendEmail(
String sUserName,
String sPassword,
String sDomain,
String sSubject,
String sBodyText,
String sRecipients)
{
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2010);
service.Credentials = new WebCredentials(sUserName, sPassword, sDomain);
service.TraceEnabled = true;
/* Discover the Exchange server based on this user */
/* I couldn't get this to work with the Elmstone network */
service.AutodiscoverUrl(sUserName + "@" + sDomain);
//service.Url = new Uri("https://myserver.mydomain.local/EWS/Exchange.asmx");

// Create the e-mail message, set its properties, and send it to user2@whatever.com, saving a copy to the Sent Items folder.
EmailMessage message = new EmailMessage(service);
message.Subject = sSubject;
message.Body = sBodyText;
string[] myRecipients = sRecipients.Split(';');
foreach(string myRecipient in myRecipients)
{
message.ToRecipients.Add(myRecipient);
}
/* Send and save a copy to the default location (most likely sent items) */
message.SendAndSaveCopy();
return true;
}

Thursday, March 01, 2012

Speeding up the Internet

About two weeks ago I switched back to Firefox, however I switched to the 64bit build called Waterfox. I figured since 64bit Firefox on Linux is good to use then the same should be true of the windows version.

After two weeks I am more than happy. Its fast, stable and since I have the HTTPS Everywhere extension the 64bit helps with all the SSL sites I frequent.

N.B. Encrypting as much of your traffic is important not only for your own online identity but also to stop ISP's or other people from injecting adverts and potentially malicious content into your browsing.

This morning I stumbled upon an old trick of speeding up browsing by increasing the number of simultaneous request you make to websites called pipe-lining:

http://egonitron.com/2007/05/25/the-truth-about-the-firefox-pipelining-trick/

Be warned its off by default for a reason, it can break things as much as it can speed things up.

Wednesday, February 29, 2012

Default parameters are evil!!!

I just finished reading about how someone is trying to shoehorn a C++ feature into C again:

http://lefteris.realintelligence.net/?p=593

This is actually a feature I hate. With that and automatic casting of int's to bool's it means that bugs can be hidden and hard to track down. As developers we should be letting our tools do the work for us not trying to hide problems.

Also without default parameters you actually have to think about what you're coding.

To daily build or not to daily build

So yesterday I updated my buildbots to upload the completed program files to the internet and the auto update site.

This means when I release software I am just committing it to a specific branch and overnight it will be deployed. Nothing unusual about that (not that many people do that I expect).

However the interesting question is that I coded up an option into the software so the users can pick:

Why not give users the chance to have the latest and greatest? Yes there is risk, but really every commit to the source code repository should be solid and this will make us all think twice.

Monday, February 27, 2012

IPv6 Ready!

Woohoo!

One of the customers I look after has several support websites which I am responsible for. I recently convinced those with the money to switch all of the sites to a cloud server from Rackspace.

Whilst Rackspace's dedicated servers are expensive, you are paying for the best technical support in the business. Their cloud servers are definitely more cost effective and with a great team behind them I am very pleased.

The bonus was that the new cloud server was IPv6 enabled, so are future proofed! I just needed to setup the IP addresses in the DNS and bind the IIS web server to all IP addresses and it was job done.

I did false start with putting the Microsoft's fe80 address into the DNS. But when I corrected that all the IPv6 test sites reported success.


WORLD IPV6 DAY is 8 June 2011 – The Future is Forever


Next challenge will be migrating all my other sites to IPv6.

Friday, February 24, 2012

Wireshark and the xbox

I have an Xbox 360 and a Linux workstation running minidlna on. I backup my films to the computer and minidlna allows me to stream them to the xbox.

The bit that's missing is the DVD covers. Other than the Windows Media Center I haven't found a UPnP server that will show the cover art.

I decided to use wireshark to see whats happening on the wire.

My forum post

What I think I need is an add-on to wireshark that allows me to see the UPnP conversation without the other protocol data.

Thursday, February 23, 2012

COM+ via .NET

So I am going to make this blog more code focused so that other developers can learn from what I've found during my working day.

Right now one of my tasks is migrating VB6 code to .NET4. This is kind of a major challenge with over 200,000 line of code (loc). Starting simple I am just wanting to create a .net assembly with a COM+ interface. Allowing me to replace the existing COM+ objects with .net.

Today I got this error:

8004E024" error code when you run a COM+ application that creates instances of COM+ services in the .NET

Tracked it down to the Component Services and that my COM+ object was in there twice. Probably from me running:

regsvcs /fc EmailServer.dll

Too many times. Deleting all the instances of that object from the Component Services and then re-registering it cured the problem.

Yes, I hope the migration moves from COM+ to pure .net4