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:

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 account.aol.com.

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 faq.aol.com. 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:

      'test@test.com' on 05/05/2014 11:19 AM
             <test2@aol.com>: 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 AOL.com 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 test2@AOL.com 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:

http://javasantoshanand.blogspot.com/2013/06/how-to-get-gmail-contacts-using-jsp.html

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.

Tomnod

I am a member of Tomnod.com.  It is a satellite imaging website that uses crowdsourcing to search miles and miles of ocean imagery or earth imagery.  The public has help in the tsunami efforts as well as the search for Malaysian Airlines Flight MH370.  I pored over miles and miles of ocean imagery myself, trying to find debris.  It is a unique concept and I would urge you to join.  Here is an email that I just got from them:




THANK YOU!


We had an incredible response to our search for Malaysia Airlines flight MH370. Over eight million of you joined Tomnod’s campaign and tagged 15 million satellite image clues. We are humbled and thrilled by the immense help that each of you contributed.

Search teams investigated all of the promising leads we discovered but the plane has still not been found. We mourn with the families and friends of everyone on board MH370. However Tomnod’s mission to crowdsource the world continues -- and we hope you’ll continue to join us!



Please consider joining them. Thanks.

The T.co domain -- Twitter


So I was idly looking through the analytics and traffic stats of my blog, and I see t.co as a visiting domain.  Curious, I check it out by typing it in the URL address box.  Turns out that it is the domain shortener for twitter.  Above is the message that pops up.  To learn more about this, type in t.co into your browser and click on the Learn More button.

Android Media Player Snippet


I recently tested a bit of code with an Android media player .  The Java code is quite simple.  Toss a media player in layout.xml, import an mp4 video into the raw folder,  and then put the following code in your onCreate() method in the activity:

MediaController mediaController= new MediaController(this);
   mediaController.setAnchorView(contentView);        
   Uri uri=Uri.parse("android.resource://"+getPackageName()+"/"+R.raw.video_name);        
   ((VideoView) contentView).setMediaController(mediaController);
   ((VideoView) contentView).setVideoURI(uri);        
   contentView.requestFocus();

   ((VideoView) contentView).start();

Hope this helps someone.

Joomla Review


I am a regular visitor to a site built with Joomla.  As the site grows, it is one of the most frustrating sites to visit.  The content consists of photos and entries, and it is s.........l.............o..........w, sssssssssslllllllllllloooooooooowww, how slow can you go to load.

Not only that, but every once in awhile you get a very long wait, and then a message saying that it cannot connect to the database.  If you wait awhile, reload and then wait some more, it eventually works.

I was consulting about 5 years ago when Joomla first broke out, and one of my colleagues was singing its praises to its simplicity for creating content management.  I wasn't about to put something brand new into an enterprise system and I am glad that I didn't.  It may be good for amateur and small jobs, but Joomla gets two thumbs down from me when it comes to doing heavy lifting -- or even moderate lifting.

Software Invention That The World Needs

OK all you code monkeys, here is something that is needed -- a software invention -- Annotable Text on a Directory Folder.  Calling Microsoft and Mac and Linux GUI coders.  When I examine a folder on my computer, tablet, etc, I want the capability of annotating the folder.  I want to mark it as read, or vetted or junk or whatever.  I want the capability of adding a note to the folder without changing the name of it, and the note travels with the folder.

This is something that could make your name as a coder.  I am too busy to do this, but someone needs to do it.

Idly wondering about Heartbleed bug ...



Just sitting here idly wondering if the Heartbleed bug was the NSA back door to OpenSSL encryption.

It makes a lot of sense.

Revising My MH370 Predictions - It's the Pilot


All of my previous inferences on what happened to Malaysian Airlines Flight MH370 have been incredibly accurate.

However, I wish to revise one of them.  I previously made a published inference that the co-pilot was responsible for the loss of the flight.  I made that inference on the basis that he was the last one to speak to Malaysian air traffic control.

Now that the Malaysian authorities have change their story, and are saying that the pilot and not the co-pilot was the actual voice in the last transmission, I am amending my inference to say that it was the pilot who caused the loss of Flight MH370.

It makes sense.  Just a day before the flight, the pilot went to the trial of a political opponent of the Malaysian Prime Minister.  He was upset at the trumped up charges of the opposition leader.

My inference was based on the last voice from the cockpit, and since it was the pilot, it had to be him responsible.  The left turn for the plane had already been programmed into the flight computer before the final transmission.

Once again, time will tell.  It looks like the plane may be found.  We shall see.