Thursday, October 17, 2013

Hoaxes

I've got a couple of blogs, and I don't really post much on this technical blog.  I use this one mainly for myself--to make it easier for me to find my own little tricks.

But I thought I'd get on a soapbox and speak out against something that has been bothering me lately--Facebook Hoaxes.

Now, I value my privacy, but I also like to remain connected to my friends.  I'm on Facebook as an easy way to keep in touch, but I also don't post much to it.  I don't go posting about what I had for lunch--and get annoyed when others think I care about the minutia of their lives (those are usually the ones I "unsubscribe" to), but I do post little bits here and there that I think might make someone's day a bit better.

Lately, I've seen some of my friends advertise idiocy by perpetuating various hoaxes on Facebook, namely variations of privacy protection.  It's gotten extremely annoying to me because I can tell in an instant that it's a stupid hoax--I don't need to look it up to know that--but I'll look it up to get the reference that proves it.

One hoax, mentioning a "Graphic App", states that you need to uncheck posting options on a the poster, then add the comment "done" so that they will know to do the same to you (Snopes link: http://www.snopes.com/computer/facebook/graphapp.asp).  The stupidity of this is that doing this does NOTHING to protect your privacy, but will instead keep you and your friend from seeing posts each other make.  It will not stop any stranger from looking you up and browsing through any and all information that you have made PUBLIC on Facebook.

The other hoax I've lately seen is one that tries to use legalese and copyright to protect your private information and photos (Snopes link: http://www.snopes.com/computer/facebook/privacy.asp)--something that completely ignores the TERMS OF USE that YOU AGREED TO when you signed up to Facebook.  When I first saw this (there is a reference to the "Rome Statute" in it), I wanted to go right into the person's profile and SHARE everything in it--just to make a point.

My point in this is that if you are concerned about keeping your things private, then DON'T POST THEM WHERE THE WORLD CAN SEE IT!  You want to say something or post a picture that only your friends can see?  There is a setting in Facebook called "Friends".  If it says "Public", then the world can see it.  Change it to "Friends"--you have that control.  If you don't want even your friends to see it, then why are you putting it in Facebook in the first place?  What is wrong with you?

On Facebook, I posted some information I wish to keep private, but I've set it so that only my friends can see it.  They won't be able to share it--but I do trust them not to cut-and-paste it into a post of their own.  But even then--it wouldn't be the end of the world--the information I post IS public information, obtainable by other means (just a bit more difficult).  The things that really matter don't get posted anywhere, except where only I have access to.  Things like my social security number is safely hidden away, and you won't find it even if you get my password to my accounts.  But things like my photos--so what?  If I had any compromising photos of myself, you can rest assured I'd not be stupid enough to post them where anyone in the world could easily obtain them.  If you are concerned that someone might share and spread that naked photo of yourself--don't be stupid by publishing it.

Monday, March 4, 2013

WPF and MessageBox in Dispatcher.Invoke

Painful, painful, painful.

That was my experience when a WPF application I was creating would display a MessageBox on startup.  For efficiency many things were going on simultaneously, and most was tripped off with Dispatcher.BeginInvoke.  If something needed user interaction at startup, a MessageBox would display to get the user's attention.  The problem was, it was not modal, so the user would see the MessageBox flash and disappear, with the default value selected (which was very problematic).

A google search finally revealed the answer.  When using Dispatcher.Invoke, you need to pass the owning window to MessageBox:

MessageBox.Show(this, "message");

Friday, February 1, 2013

Helper for System.Diagnostics.Process

It's one thing to kick off a process from C# using Process.Start out of System.Diagnostics.  Nothing to that.  But what if you want to send the process some input beyond the arguments?  Or you want to perform processing on the output is sends to the console?



This code provides that help.

Just call ProcessHelper.Start.

The delegates for output and error provide a mechanism for processing each line of output.  The delegate will be called for each line produced.


This code below provides a simple example of how to use the ProcessHelper.  Each line of output is simply added to the StringBuilder objects.




StringBuilder outData = new StringBuilder();
StringBuilder errData = new StringBuilder();

System.Diagnostics.Process p = ProcessHelper.Start("MyProcess.exe", "arg1 arg2 arg3", "Standard Input Data",
        delegate(string parm)
        {
            outData.AppendLine(parm);
        },
        delegate(string parm)
        {
            errData.AppendLine(parm);
        }
);

p.WaitForExit();