Thursday, March 19, 2020

Political polling essays

Political polling essays The web site I chose to critique explains political polling and the statistical process behind the polling numbers. This was of particular interest to me, because I like many other Americans have never been asked nor know of anyone that has been asked a political question used in political polling. In short, the site explains what the numbers actually mean. The site uses a fictional mayoral election to explain the numbers. Also, it discusses margin of error and how it affects the polls. Next, the site goes on to clarify confidence. Finally, elucidation on what can go wrong in the polling process is discussed. In the fictional case Republican Stephanie Higgins was running against two-term incumbent, Democrat Webster Fletcher. Once Higgins formally announced she was running for mayor, the polls showed that Fletcher would win with 56% of the vote. However, six months before the election the mayoral race was tightening up. The polls showed that Fletcher continued to have a slight lead of 3%, with a margin of error of +/- 5%. The site raised the question of whether or not Fletcher actually had a lead if the margin of error is +/- 5%. Three months before the election Higgins took a 15% lead in the polls with same margin of error. Oddly enough, the day before the election some polls showed Higgins winning by a landslide. As expected it was a close election. The lead changed hands several times. However, Higgins pulled ahead and won the election in its last moments. To begin the site discusses the importance of the random sampling used in political polling. In class we defined a random sample as, everything in the sample stands the same chance of being selected at any point and any time. A great example was given on the site. If a doctor wants to figure out a patients white blood cell count, the doctor doesnt drain out all the patients blood and count the white blood cells. The doctor randomly samples the patients blo...

Tuesday, March 3, 2020

TColorButton Delphi Component Source Code

TColorButton Delphi Component Source Code The background color of a  TButton  is controlled by Windows,  not Delphi. TButton is a simple wrapper around the standard Windows button, and Windows does not allow it to be colored except by choosing the colors in Control Panel.   This means you can not set the background color of a TButton, nor you can change the background color of TBitBtn or TSpeedButton. Since Windows insists on doing the background coloring with clBtnFace, the only way to change it is to draw the button yourself by making an owner-drawn button component. TColorButton Source Code The TColorButton adds three new properties to the standard TButton: BackColor  - Specifies the background color of the buttonForeColor  - Specifies the color of the button text. Note that this overrides the Font.Color propertyHoverColor  - Specifies the color used to paint the buttons background when the mouse hovers over the button. Heres how to set color-related properties of the TColorButton at runtime: ColorButton1.BackColor : clOlive; //background ColorButton1.ForeColor : clYelow; //text ColorButton1.HoverColor : clNavy; //mouse over Installing Into a Component Palette The TColorButton comes  as  a single unit file with the .PAS file extension. After downloading the component, you need to install the source component into an existing package.