All Things Techie With Huge, Unstructured, Intuitive Leaps

C# - Determine if a Form is Open

I had a requirement to determine if a form was open in Visual Studio using C#.  If it wasn't open, I wanted to open a new one, and if it was, I wanted to pop it to the front.  Obviously, I needed a method to see if there was one.

Here is the code for the method:

 private Boolean checkFormOpen(string formName)
            Boolean openForm = false;
            FormCollection fc = Application.OpenForms;
            foreach (Form namer in fc)
                if (namer.Name.Equals(formName))
                   openForm = true;

            return openForm;


I just call this method and pass the handle of the Form name to it.  Hope this helps.

C# - Truncating FileName

Some people, especially lawyers and bankers who create documents, often have an essay for the filename.  Most systems are quite adept at handling very long filenames, but for practical reasons, I recently had to truncate a filename to 250 characters in a C# .Net program.

You simply cannot truncate with a substring, because you will lose the file extension.  Also, in the past, you could always bet that a file extension is always three characters preceded by a dot "," like .doc, or .jpg.  However now there is a good possiblity that you encounter a 5 character file extension including the dot.

So the algorithm is to get a string of the last 5 characters of the very long file name.  Then you get a substring of the first 245 characters.  The number in the substring is an index number that begins at zero, so it is 245 - 1 or 244.  Here is the code snippet:

if (filename.Length > 250)
     String t1 = filename.Substring(0, 245);
     String t2 = filename.Substring(filname.Length - 6, 5);
     filename = t1 + t2;

Hope this helps someone.

AOL Troubles ?

I mentioned in a previous blog entry that AOL was hacked and I got an email from them.  After that, I notice that I am getting AOL errors that I never had before.  I got to give them full marks for creativity in delivering the bad news with their zoid thing, but take a look at the second notice.  My settings were not available.  That's generally a sign of system cancer.

However, once the messages went away, I never got them again, so it looks like a fix.  These sorts of things make me feel better about the bugs in my own enterprise system.

Promox Product Review

I was just introduced to the open source server virtualization tool PROXMOX and I have to say that I am fairly pleased.

It was easy to set up.  You can administer the machines with a web interface and with a console, you can switch containers by typing vzctl enter and the number, and you are there.

I give this tool two thumbs up for a small virtualization effort.  I haven't used this in a large production environment.

AOL Hacked

I got this note in email box from AOL:


Dear AOL User,

At AOL, we care deeply about the safety and security of your online experience. We are writing to notify you that AOL is investigating a security incident that involved unauthorized access to AOL's network and systems. Recently, our systems alerted us to an increased incidence of email users receiving spam emails from "spoofed" AOL email addresses. AOL's security team immediately began investigating the cause of the spoofed emails. Spoofing is a tactic used by spammers to make it appear that the message is from you in order to trick the recipient into opening it. These emails do not originate from the AOL Mail system – the addresses are just edited to make them appear that way. AOL is working with other email providers like Gmail, Yahoo! Mail and Outlook·com to stamp out spoofing across the industry, and we have implemented measures that will significantly limit its future occurrence.

Although our investigation is still underway, we have determined that there was unauthorized access to AOL users' email addresses, postal addresses, contact information (as stored in the AOL Mail "Address Book"), encrypted account passwords, and encrypted answers to security questions that we ask when a user resets his or her password. We believe spammers have used this contact information to send spoofed emails that appeared to come from roughly 2% of our email accounts.

Importantly, at this point, we have no indication that the encryption on the passwords or the answers to security questions was broken. Likewise, there is no indication that this incident resulted in disclosure of users' financial information, including debit and credit cards, which is also fully encrypted.

Nevertheless, as a precautionary measure, we strongly encourage you to reset your password used for any AOL service and, when you do so, you should take the time to change your account security question and answer. You may reset your password and account security question at

In addition, there are steps you can take to protect yourself from cyber risks. They include:
  • If you receive a suspicious email, do not respond or click on any links or attachments in the email.
  • When in doubt about the authenticity of an email you have received, contact the sender to confirm that he or she actually sent it.
  • Never provide personal or financial information in an email to someone you do not know. AOL will never ask you for your password or any other sensitive personal information over email.
  • If you believe you are a victim of spoofing, consider letting your friends know that your emails may have been spoofed and to avoid clicking the links in suspicious emails.
We place a premium on the security of our systems and our users' information. We are implementing additional measures to address this incident, and we are working with law enforcement to pursue the matter.

If you have any further questions, additional information and an extensive Q&A can be found at We apologize for any inconvenience, and we are addressing the situation as quickly and forcefully as we can.

Bud Rosenthal
Bud Rosenthal, AOL Membership Group CEO

Sender address rejected: not owned by user

I don't use MS Outlook at all.  I think that because it is Microsoft, it is extremely vulnerable to viruses, hackers, bots and spammers.  It is an easy gateway for malware and everything bad about the internet.  It hasn't even been configured on my machine.

However, I am writing a program for inviting people to our app, and I needed to get Outlook contacts to send them an email (that will be the subject of another blog post).  So I configured Outlook and the base email address was an AOL email address that I rarely use except for testing and for signing up for things where I don't want them to know my real identity (like the kajillions of white papers and secrets that one can get just for giving someone your email address -- a spam feedlot of sorts).

Well, it was supposed to be painless and take a few seconds.  I let the wizards set up Outlook for me and then of course, I had to test it.  I sent an email to my other email address.  Immediately it was rejected.  The error message was:

Your message did not reach some or all of the intended recipients.

      Subject: Test 
      Sent: 05/05/2014

The following recipient(s) cannot be reached:

      '' on 05/05/2014 11:19 AM
             <>: Sender address rejected: not owned by user test2

I thought -- WTF!!!  It had just used that identity to create an account for me using the account wizard.  It had just authenticated me to aol using that identity.  It was a total mystery.

I burned over an hour trying to de-bug this.  Here is the simple solution.  I went to Accounts on Outlook and clicked on the account to show the properties. The username was test2.  When I go into the web interface of AOL mail and sign in, I just put in test2 and the password.  Outlook knew that the domain was because it had just automatically used those exact same credentials to create the account.  To make it work, I simply modified the username to include the domain -- ie. instead of test2, I put in and it worked.

This has done nothing to change my opinion of Microsoft products.  They are still a piece of crap.

Getting Google Contacts with JSP

I found this blog entry incredibly helpful in getting Google contacts using JSP.  It even sends emails through the Google SMTP.  It's a great resource:

I'd like to thank the author for putting it up.

The Myth of Apple and Great Design

Common wisdom says that Apple products are great designs.  Not only can that statement be construed as a myth, it could also be a lie.

Don't get me wrong -- Apple products have great aesthetics, but that isn't enough.  This was proven to me when my iPod Nano, 6th Generation failed.

Quite simply, the power button doesn't work.  What happened, is that the membrane switch didn't quite reach the aluminum switch, so there is a shim on the membrane switch, about the thickness of a piece of scotch tape.  The shim is the size of a pepper grain.  It is glued in place.  The glue fails, the shim falls off, and the on/off button doesn't work any longer.  Piece of Crap design for reliability.

But its not over yet.  To fix it, you get a heat gun, and you apply heat to the screen.  You then pry it off with a guitar pick.  Can you imagine -- the screen is only glued on.  It gets worse.  There is an aluminum shield underneath, and it is held on by screws.  The battery is also held in a piece of metal with screws.  The screws are different sizes.  When you finally get to the membrane switch mechanism, it is held in with tape.  Crap mechanical design.

Here's the worst part - Apple charges you $149 to fix this.  They go in, find the little black shim and glue it on again.

This design is the equivalent of wrapping feces in Christmas gift wrap.  It looks good, but once you open it, the design stinks to high heaven.