Friday, September 7, 2018

Where does my WinForms app store my images?

You don't have to keep the images in the UI project like you might with a web forms app. Instead you will find yourself dragging a PictureBox control out of the Common Controls in the Toolbox and into a WinForm and then clicking upon the little arrow in it to browse for an image. A continued reference to the image source is not needed because a string-full-of-gunk representation of the image is tucked away to a .resx file associated with the WinForm. (There will be a .cs file, a .Designer.cs file, and a .resx file with the same name beyond the file extension.)

 
 

Addendum 9/17/2018: When you add an image through the GUI, you will be given an option for Local Resource (which is probably what you want) and an option for Project Resource File. The second option will tuck away the image to a different .resx elsewhere, not one tied to your WinForm.

How much screen real estate does my WinForms app use?

this.ClientSize = new System.Drawing.Size(756, 432);

Align text within a button in WinForms so that it doesn't just hug the left side.

this.myButton.TextAlign = ContentAlignment.MiddleCenter;

Thursday, September 6, 2018

Two types of WebSphere?

There is a distinction between WebSphere Application Server or WebSphere MQ per this. WebSphere Application Server is more of a traditional web server like IIS and uses "Service Integration" for default messaging. WebSphere MQ is a server just for messages, kinda like an email server.

suck out the InnerException in C#

catch (Exception ex)
{
   string x = "";
   x = x + ex.Message + " | ";
   if (ex.InnerException != null) x = x + ex.InnerException.Message;

the BackgroundWorker in a WinForms app!

Make one like so:

private System.ComponentModel.BackgroundWorker maid
this.maid = new System.ComponentModel.BackgroundWorker();
this.maid.WorkerReportsProgress = true;

 
 

There is the concept of reporting progress like this:

maid.ReportProgress(20);

 
 

I don't understand it yet. There is a progress bar that runs in the application I am immediately looking at. What is above would set the progress bar to 20 percent. I guess the ReportProgress kicks off an event for the reporting. You may have events assigned like so:

this.maid.DoWork += new
      System.ComponentModel.DoWorkEventHandler(this.maid_DoWork);
this.maid.ProgressChanged += new
      System.ComponentModel.
      ProgressChangedEventHandler(this.maid_ProgressChanged);
this.maid.RunWorkerCompleted += new
      System.ComponentModel.
      RunWorkerCompletedEventHandler (this.maid_RunWorkerCompleted);

 
 

The methods for the three events above would start out like so:

  • private void maid_DoWork(object sender,
          DoWorkEventArgs e)
    {
  • private void maid_ProgressChanged(object sender,
          ProgressChangedEventArgs e)
    {
  • private void maid_RunWorkerCompleted(object sender,
          RunWorkerCompletedEventArgs e)
    {

 
 

You could call the first event like so:

object[] stuff = new object[4];
stuff[0] = 13;
stuff[1] = 42;
stuff[2] = "housekeeping?";
stuff[3] = myConnectionString;
maid.RunWorkerAsync(stuff);

 
 

I don't see an example of the last event getting specifically called in the application I am looking at. Maybe this is an example of something that happens upon the tear down of deconstruction in advance of garbage collection.

Was John Brenner embezzling at Wells Fargo Advisors in St. Louis?

That was the rumor when I was there. I was told that he had been placed by Artech. When he staffed the team I was on six out of eight of us were with Artech (also one with Robert Half and one with Collabera). We were pair programming on everything and thus eight people were doing the work of four. Before that sounds normal to you, consider that no other team at Wells Fargo was pair programming. Instead, it was as if someone had argued for a ridiculously large budget. We weren't doing any test-driven development and there also weren't any testers. Instead of having eight developers writing code as four shouldn't we have spent some of that budget on testing? Why not have six developers and two testers? In another example of waste, I was cut from the team after a two month lull (two months of eight people sitting around doing nothing while Kip Garrison, our lead, skipped work here and there pretending to have a hurt back) and not before it. How does that make sense to anyone pinching pennies? I digress. Anyhow, what if John Brenner argued for a ridiculously large budget so that he could get a thousand dollar kickback for each seat he placed from Artech? I'm not saying that I know that was his compensation, but my mind swirls of those thoughts. His lackey with Artech, Jim Hanselman, sure did act like my best friend when he was letting me go and trying to "help me find other work" you know? Anyhow John's project went into red status and now Kip has to actually come into the office and lead the team. Frankenstein's Nazi is quite the bully. He had never run a team before and it shows, or maybe he'll just never be good at running a team. Is it six one way and a half dozen the other? I don't know. Another big mistake early on, my first week there, was abandoning Agile for Waterfall. Without the usual cadence of an analyst baking stories in advance of development, well, you get the two month lull I've already mentioned. I know how hard Wells Fargo is trying to turn its image around, but its red-headed step-child Wells Fargo Advisors isn't helping. Right now the stagecoach is being pulled by some sick horses and the slogan might as well be: "Together, we'll go nowhere."