Clayton Cramer's BLOG |
|
|
Clayton's commentary on news and events of the day. Broadly speaking, I'm a conservative with libertarian sympathies (getting more conservative as my children get older).
![]() Never forget! I ran for Idaho state senate in 2008--didn't win I've written a number of history books, as well as scholarly and popular articles, (see my web page). Relocating to Boise? Use my realtor, neighbor, and friend, Cindy Smith csmith@1realtyone.com.
Magazines for cheap!
PayPal members: to make a contribution
Email me at blogmail at claytoncramer dot com. Sorry to be so indirect, but all spambots must die! But they haven't died yet! Include the word spamIamnot in your subject line to make sure that my spam blocker lets you through. |
Saturday, September 06, 2008
C#/.NET Question There has to be an easy way to put up a message window--and then take it down again without waiting for a user input. It is probably a function that you call that returns a handle, and then when you are ready to take the window down, you do something with that handle. I thought that there might be a MessageBox option that does this, but I couldn't find it. Any hints? Labels: Csharp C#: A Different Program I certainly won't claim that I have learned everything that I need to learn about graphics in C#, but I had reached a point with that plotting program when I had resolved all my concerns about event related stuff, and I had at least a rough idea how various display functions work. I'm now writing a program that is a bit less graphical, but exercises many of the other facilities of C# and .NET. It reads in a web page, determines all the links to other pages (and names within the current page), and verifies that they can be opened. This is the broken link detector--often useful if you link to lots of other pages, and those links break. In addition, it will be recursive within a particular domain. If I tell it open www.claytoncramer.com/index.html, it will try to open all links to pages at or below www.claytoncramer.com, then repeat the process for each of those pages. It will stay at or below the level of the original web page, otherwise it would take a very long time to complete the process, what with the several billion web pages that are out there! And yes, I have seen the gag page that claims to be the last page on the World Wide Web, and tells you that you may now turn off your computer! I've reached the point where the program reads in a web page and parses the HTML to find all the HREFs contained therein. (Or at least, I think it finds them all. We'll see when I start trying other pages.) There are HTML audit programs like this out there already, I know. But writing one of my own forces me to learn a lot of capabilities that I otherwise might not learn. Learn by doing works for me a lot better than reading a tutorial. UPDATE: Well that's cool! I don't have the recursive part done yet, but I ran it against my home page, and it discovered that one of the links from my recent restructuring is broken! Labels: Csharp The "Palin Attended Multiple Colleges" Scandal! Tom Forbes over at Red County points to this ominous Associated Press story: Republican vice presidential candidate Sarah Palin attended five colleges in six years before graduating from the University of Idaho in 1987.Oh yes, I'm sure that she transferred from school to school because she was being expelled for Satan worship, human sacrifice, and building WMDs in the chemistry labs. There are a lot of us that attended several colleges before getting our degrees. I attended UCLA part-time when I was in high school (1973-74). I attended USC full-time for a year (1974-75)--scholarships actually made it less expensive for me than UCLA. Then I ran out of money. I went to UCLA for one quarter while working full-time--and had to drop out from a combination of a staph and strep throat infection (1978). And because UCLA wasn't really set up for working adults, I attended West Coast University in the evenings for a couple of terms in 1979. I went back to college 1982-83 at Sonoma State University. I moved around the state a lot, working for various electronics companies (I have a "Migrant Software Worker" T-shirt), so I wasn't back in school until 1989, again at Sonoma State University. I received my B.A. in 1994, and my M.A. in 1998. If liberals had any experience in the real world (instead of growing up in the world of wealth and privilege), they wouldn't find anything startling about Palin attending multiple colleges.There's a little part of me that sometimes wonders if a real populist movement (and not the faux populism of obscenely rich people like John Edwards, Teddy Kennedy, and George Soros) might be a good thing--at least to put a scare into the billionaire's wing of the Democratic Party. For example: a 2.5% annual tax on net assets above ten million dollars. I wouldn't advocate that myself--but it would be entertaining to watch the liberals making excuses for why only incomes (those who are trying to become wealthy) are subject to taxes, but not assets (those who are already there). UPDATE: I couldn't satirize the contempt that liberals have for whites that weren't born rich better than the comments over here: As to your whine about the mean old left and Sarah Palin, don't you ever wonder if she attended so many colleges because she was trying to have sex with as many college men as she possibly could but her Alaska bound boyfriend at the time, Todd Palin, would get wind of it and drive his camaro down, his mullet flapping in the breeze, to kick some ass? So she had to keep changing schools?I was almost tempted to link to this jerk's blog, where he claims that Palin's infant was obviously drugged at the convention, because he wasn't fussing or crying, but it appears that he is intentionally posting false quotes from Palin in order to increase his number of visitors. Why help him? UPDATE 2: Here's a news story about her college attendance. No great surprises. Labels: 2008 presidential candidates Friday, September 05, 2008
Working Moms Running For Office Like a lot of other conservatives, I cringe at kids in daycare. There are a lot of families that don't have much choice on this; they need both incomes to pay the bills--and they aren't living all that well, even with both Mom and Dad working full-time. (Oddly enough, back when most mothers stayed home to raise kids, there were thus about 70% fewer Americans looking for jobs. Individual worker wages were higher, and many fathers were able to raise a family on one income. Odd how that works, isn't it?) There are other families that do have some choice on this. We used to live in California. One of our neighbors did daycare. She finally stopped doing it because of the situation with one of the kids. Mom had some important job with a bank in San Francisco; she drove a shiny new BMW. Six weeks after giving birth to her son, she was dropping him off at daycare every morning and heading to work. She was gone from 7:00 AM to 6:30 PM. Dad gave instructors to the daycare provider to not tell Mom about the first time her son rolled over, or took his first steps, or spoke his first words. Dad wanted Mom to think that she was there for these emotionally significant steps. By the time this yuppie puppy was two years old, he would only call the daycare provider "Mom" and would actually hit his biological mother when she arrived in the evening to pick him up. If that doesn't make your want to cry, you might want to skip the rest of this posting. Some Democrats are criticizing Governor Palin for putting the pursuit of political office above the needs of her family. Now, if conservatives were doing so (and a few, such as Dr. Laura Schlesinger, apparently are), it would be a consistent position, although one that you could still criticize as "old-fashioned." But the Democrats are the party of subsidized daycare and aggressive, sometimes bizarre enforcement of laws against employment discrimination based on sex. And they are complaining that Governor Palin shouldn't be running for office because she has three kids at home, one of whom has Down's Syndrome and thus needs more attention? If Democrats who are making this criticism mean it, I guess that they will be arguing for revising the sex discrimination laws next to allow--no require--employers to discriminate against women with minor age children at home. Would I like to see more mothers staying home to raise their own kids? Absolutely. Should they be required to do so? No. They should have that choice, free of the continual culture war sniping of the left that any woman who stays home to raise her own kids is somehow beneath contempt--practically a domestic, in the eyes of many feminists. UPDATE: Karl Lembke makes a very similar argument (great minds think alike) over here: A third argument has to do with the pregnancy of Palin's daughter. If this had happened in a leftist family, there'd be much less fuss made over it, or expected in the media. The daughter could abort, and it would be a woman exercising her freedom of reproductive choice. Or she could move in with her boyfriend (or girlfriend) (or both) and it would be celebrated as an "alternative lifestyle". But conservatives advocate standards, and any deviation from those standards is always called "hypocrisy", never "being human and failing to live up to high standards". Here, we have the Left assuming the Palin family, and indeed, the entire pro-life movement, acts like the caricatures dreamed up by the Left. Upon hearing of Bristol's pregnancy out of wedlock, they imagine the instant response is to drag her out to the city gates and stone her to death. Well, maybe just kick her out into the street and erase every mention of her from their lives. For a pro-life, conservative Christian to love and support anyone who has strayed from the straight and narrow must be hypocrisy. Labels: 2008 presidential candidates, feminism C#: Reducing Flicker Some professional C# and Visual Basic developers have been making suggestions that tell me that this isn't as obvious as I had thought. One suggestion that certainly reduces the flicker--as well as teaching me something that I needed to know--was to use a timer to drive the refresh. Instead of hooking up event handlers for just about every possible mouse event, instead: Timer Clock; And then disable the various this.Invalidate() calls for the event handlers for mouse movement, mouse up, and so on. Obviously, if the interval between refreshes is very short, you still get the flicker, but it is at least a consistent flicker. (Is that a virtue? Well, it's less distracting than the random timing flicker that comes when you move the mouse around.) At three seconds, it is slow enough to be annoying, because you can see it taking time to do the refresh. At two seconds, you sometimes notice that the image hasn't refreshed, and sometimes you don't. But then I pulled back for a second, thought about it, and realized that I was doing this all wrong! The real problem is that when I perform operations that cause, or could cause, a change in the data, that's when I need to call this.Invalidate() to force a refresh. So I've removed all the funny event handlers, and it now is flicker free, and simpler! I'm updating the listing and the code shortly. Labels: Csharp The Interview Today Went Very Well It was a screening interview--but went on quite a bit longer than I expected, which I think is a good sign. The interviewer gave me one of those problems that I did very well on--and he commented that I even avoided the mistake that many people make. He also asked a couple of questions designed to see how much of what I knew was just programming, and how much was computer science. He wanted me to differentiate a queue from a stack--and then explain conceptually how you would implement these in a programming language. I can tell that he was pleased with my answers. I took advantage of the discussion of stacks to explain how most programming languages use a stack to implement parameter passing and automatic variable using the base pointer and frame pointer registers, and the experience I have had building symbolic debuggers using that information. He was clearly impressed with the level of detailed knowledge in this area--where I gather a younger generation of computer science graduates may have not even studied this in school, or had little actual opportunity to use this knowledge. There's another set of interviews in a week or two. The good news is that there are positions here in Boise with Microsoft! I also had a chance to talk to representatives from several other companies, although the ones in Boise wanted current C# and SQL experience--and the one that was interested in my SNMP experience is in Pullman, Washington, which is about a five hour drive from here. The "Scandal" Involving Palin's Ex-Brother-in-Law Liberals are threatening to make a big issue about whether Gov. Palin used undue influence to get her ex-brother-in-law fired from the Alaska state police. This article from the July 27, 2008 Anchorage Daily News shows that even if she did, this might be a sign of her reformist tendencies: Yes, I can see why Democrats are holding Wooten up as a hero. He's their sort of state employee! Labels: 2008 presidential candidates Thursday, September 04, 2008
A Friend Is Running For Idaho State Senate T. Allen Hoover is running for Idaho State Senate district 17. He won the Republican nomination--but this is a Boise state senate district, so he could use some help. For those of you nearby, he could use some volunteers. For those at a distance: money helps! Hoover is strongly pro-gun, pro-life, and definitely a conservative. Allen is an interesting character--not Mr. Polished and Hubba-Hubba politician. If it gives you some idea what kind of guy he is, he likes to tell the story of turning in a paper for a college class, and the professor marked him down for citing something to the first printing of Alexis de Tocqueville's Democracy in America--when clearly, he used a later edition. No, Allen was working from a first printing! For those who helped me with my primary challenge to Senator Corder: thank you. Help put Mr. Hoover in office, and it's almost as wonderful as putting me there! Labels: Idaho politics This Isn't Papa Bush's Republican Party Governor Palin, with EBR (Evil Black Rifle). ![]() She's sure got the gun nut vote nailed down! Labels: 2008 presidential candidates Lunatic Fringe If you really want to know how deranged the liberal news media have become, read this column that the Philadelphia Daily News published on September 2, 2008. After ranting about the desperate poverty that has swept across our nation, one of their columnists tells us what is going to happen if we don't let Obama win the election: If McCain wins, look for a full-fledged race and class war, fueled by a deflated and depressed country, soaring crime, homelessness - and hopelessness!That's certainly a way to get the vast majority of Americans (regardless of color) on your side: insist that you either get your way, or we'll start a race war! And why does Obama and fellow leftists want to disarm law-abiding Americans? To make sure that we can't defend ourselves in case anyone listens to these raving liberals? (Thanks to Snowflakes in Hell for pointing me to this trash.) Labels: 2008 presidential candidates I Didn't See Palin's Speech It was apparently devastatingly effective. This article from the September 4, 2008 Sun (one of the British tabloids) makes me think I missed something world-changing:
And the comments from British readers are just amazing, like this one: My interest in American politics has been limited; until I saw Palin's speech in the early hours of this morning. She was brilliant, she spoke like she really cares about her 'fellow Americans' and the country, what was best for them and what was not, and answered her critics intelligently and with dignity. Our politicians could learn a hell of a lot from her....And this one: Wow what a woman- What a speech. Our lot look tired and unitersting by comparison. Its about time our leader had the right of veto and use it. Were all sick of the lefty icreasing size of government that is crippliong business and industry through taxation. Its about time like the Americans we returned to our Godly roots.And this Irishwoman living in the U.S.: As an Irish woman living in the USA I am so happy to finally a worthy candidate for vice president. I watched her speech last night and I saw a woman who speaks her mind openly and with great conviction.UPDATE: Here's video of the speech. And yes. This is one of the world-changing political speeches of our generation. She is a powerful, but very natural speaker. Obama has just lost. Palin will be extraordinarily qualified to run for President in 2012. Labels: 2008 presidential candidates Another Tragedy From the September 3, 2008 Seattle Times: This article from the September 4, 2008 Seattle Post-Intelligencer says what I have been saying for some years, without effect:
Labels: deinstitutionalization Wednesday, September 03, 2008
The Job Search This morning, the job search situation was looking pretty encouraging--enough that some job listings from Texas did not get my immediate attention. But then one employer in Seattle decided that my Java experience wasn't recent enough (and I can't argue the point). A position in Fresno turned out to require Linux kernel experience, which I don't have. A couple of Boise firms decided that they needed people with a closer match to their language requirements. The only position that seems likely right now is in North Carolina, and my wife is fiercely hostile to me being gone for six months. I'm not keen on it either. It's at least eight hours to fly either direction, which, along with the cost, would strongly discourage seeing my family. The prospect of sitting after work in a hotel room in Raleigh for months on end sounds fiercely unattractive. The C# Plotting Toy Gets Better And Better I'm not going to inflict the source on the blog from now on; you can read it, and see the details of how to install the executable here. Recent improvements: 1. I am now using the ClientSize method for getting the inside of various objects when figuring out how much room there is to plot. This is more accurate, and doesn't require as much fudging. 2. When you start the program, instead of using a Panel on which to draw the graphs, it graphs directly into the Form. I had hoped that some of the failure to refresh problems would go away, but they really didn't. It did simplify the code a bit, as did removing Panel from the various popup windows. 3. Instead of a fixed sized Panel, the area used for plotting the graphs expands to fill the available Form--and if you resize the window, everything inside resizes and redraws. 4. I've mentioned the problems with getting refresh to work more consistently. At the moment, the choice is either a bit too much flicker (because every mouse movement event causes refresh), or waiting for you to move the mouse outside of the window, or release the mouse button, or any of several other events, to cause refresh. There has to be a more elegant way to do this. 5. There is a new File, Open Web Page command that lets you grab CSV files in the appropriate format from a web page. There's a default URL as well. The behavior when you give an invalid URL isn't quite as elegant as I would like, but that's for tomorrow. Labels: Csharp Solving The Double Click Problem I alluded to this problem yesterday that I wanted if a user double clicks in a ListBox for it treat this the same as selecting a choice, then hitting the OK. I couldn't figure out how to make it happen. Here's the solution. This line adds the double click event handler: The event handler:box.DoubleClick += new EventHandler(this.listBoxDoubleClick); The configDlg is a Form created from within this class, setting DialogResult controls what gets returned to the ShowDialog() caller. The annoying gotcha of this is that to make configDlg visible in the event handler, I had to store in as a class level variable, rather than simply declare it in the function where I create the dialog window. My guess is that if the event handler was ever invoked while the dialog window didn't exist, this would cause an exception--but heck, I'm writing for fun right now. If someone wants to pay me to write C#, I would put in exception handling for this.private void listBoxDoubleClick(Object s, EventArgs e) The this.configDlg.Close() method closes down the dialog window. When ShowDialog returns, the DialogResult.OK gets treated as though the user hit the OK button, and the selected values are set up correctly. if (configDlg.ShowDialog(this) == DialogResult.OK) I was especially pleased to find out that if I selected one item in the ListBox first, then double clicked on another item, both items came back in the SelectedIndices field. UPDATE: Oh yes, the plot area also adjusts to the size of the overall window. If you resize the window, the plot area changes and redraws automatically. Labels: Csharp Since You Know The Democrats Will Use This The Governor Palin in a bikini holding a gun is a fake. Details here. Labels: 2008 presidential candidates Mismatch & Affirmative Action I've mentioned before that affirmative action in education doesn't just injure whites and Asians--it also damages the supposed beneficiaries of it as well, because it encourages minorities to attend colleges where they will be in over their heads. A high school senior with a B- average and 60th percentile SAT scores gets recruited into UC Berkeley--and fails, where he might have gone to San Jose State and graduated. A high school senior with a B+ average and 90th percentile SATs gets lured into Harvard--and drops out during the first year--who might have graduated from UC Berkeley. But as long as the liberals that run the universities feel good about themselves for being so open-minded--who cares what happens to the dropouts? Back in 2004, there was apparently a study of this issue with respect to law schools--and the conclusion was similar--that the elite law schools were using affirmative action programs to get minority students in the door who were simply not adequately prepared to compete with other students (including other minorities) who were admitted under the standard admissions criteria. There's a new study out discussed in the September 3, 2008 Inside Higher Education that somewhat confirms the mismatch hypothesis--but also argues that without affirmative action, only the very bottom tier of law schools would have as many black students as they do now: But the new research — using simulations of admissions without affirmative action — finds that race-neutral policies wouldn’t send black students to law schools where they would do better. Rather there would be a huge falloff in black law enrollments — far more than might be counteracted by some black students doing better on bar exams. The elimination of race-based admissions policies, the authors write, would lead to a 63 percent decline in black matriculants at all law schools and a 90 percent decline at elite law schools, the paper says. Even if some positive impact took place in the experience of black students who did enroll, there would be at least a 50 percent reduction in the production of black lawyers, they write.Why is this? Because even the bottom tier of law schools are actually very difficult to get into--and the number of blacks who can meet the very demanding standards of the LSAT is, relative to the number of blacks entering law school--quite small. A rational person would, at this point, start to ask, "Uh, maybe we need to fix this problem a little farther back then admission to law school? Is there something hopelessly broken in either the schools that American blacks are attending, or in the culture in which American blacks are growing up?" But hey: why bother? It is so much easier to just keep admitting underqualified applicants who can then drop out of law school, or fail to pass the bar exam. When the goal isn't to fix the problem--but to make liberals feel better about themselves--results don't much matter. Labels: affirmative action Moloch, Baby Sacrifices, & The Democrats Over at Power and Control is a surprising posting about the Democrats. It starts out with a long quote from Asia Times columnist "Spengler" (who is always a delight to read, even when I don't agree with him) about how McCain's choice of Palin is going to seal the fate of the Democrats in November. I suspect that Spengler is right about this, although I don't have quite that much confidence. But Power and Control points out a couple of aspects of where the Democratic Party is headed that I find fascinating, especially what Power and Control (who is a libertarian) calls the "fetishizing" of abortion: It is interesting that the Democrats keep nominating successively weaker candidates. First Gore. Then Kerry. And now Obama. I think it is becoming obvious for all to see that the Democrat Party has no soul. As such it has no direction except the will to power. In fact the behavior of his base since Palin was nominated is an expression of that weakness. It would appear from their behavior that strong women frighten them. And they should be frightened. Labels: 2008 presidential candidates, abortion Tuesday, September 02, 2008
That C# Application Keeps Growing I mentioned it yesterday. It has grown a good bit. The Config menu choice now pops up a window where you get to select which rows of data from the CSV file you want to display--and then it autoscales the plot, based on the new data. I'm learning a lot, and thanks to those who patiently answer questions. It has been years since I enjoyed myself this much at work. One area that I am still struggling with is that when I double click on an entry in the ListBox that contains the list of data sets to plot, I want it to select that entry, and be the equivalent of hitting the OK button. The problem is that there's something magic that I need to do from the ListBox event handler that tells the Form that it is time to return DialogReturn.OK--but I can't tell what.
Labels: Csharp A Job Resource That You May Not Be Aware Of The Heritage Foundation has a job bank for connecting up those of us on the right with jobs. Okay, they admit that they only manage to find about 75 jobs a year out of 5000 submissions, but that's 75 jobs that might not otherwise have happened. Pretty obviously, this is focused on public policy wonks (and I think I qualify as one), but since there are some public policy wonks in training out there reading my blog, I figured that you should know! To My Surprise And Pleasure Unlike the last time I had to look for a job, there are lots of jobs outside of Boise for someone like myself. Many of these are high paying contract positions--enough that I could afford to at least fly home on the weekends. The number of phone calls from recruiters has been quite phenomenal. My incentive to help with getting the 14th Amendment incorporated against the states may be increased if I end up working on a contract in Sunnyvale. More C# Learning Experiences I was trying to figure out how to create a modal dialog window in C#. (For those not familiar with the terminology: modal means that the user has to finish with this dialog window before he can go back to functions in the parent window.) I thought that this would be easy to find, but in the fast sea of C# documentation out there, it wasn't easy! From the function that gets called when you select a menu option: If you specify dlg.Show(), you get a modeless dialog window instead.Form dlg = new Form(); A lot of the examples out there for dialog boxes assume that you are using the Visual Studio tools for building the dialog box. If you want a dialog box that is built dynamically from within your program, the examples are a bit harder to find. You can't add a Button or ListBox control directly to a Form; you need a Panel object there first (much like Java's UI). A FlowLayoutPanel gives you a fair amount of control--or you can let it do most of the work for you, again, much like the equivalent in Java's UI. CORRECTION: You can add controls, like Button directly to a Form. But all the controls end up on top of each other in the upper left corner of the Form, unless you tell them where to go. I'll probably just keep expanding this as I learn things. You add a button click event driver like this: b.Click += new EventHandler(this.bClick); and the event handler is: private void bClick(Object s, EventArgs e) Labels: Csharp Palin's 17 Year Old Daughter Is Pregnant Yes, I'm disappointed by this--but doubtless not as disappointed as Governor Palin. The left, of course, has decided that this is a sign of hypocrisy. Huh? If Governor Palin had encouraged her daughter to have sex outside of marriage, yes, it would be. But as any parent of teenagers can tell you, you can tell them what's right until you are blue in the face, but they have a free will, they make their own decisions--and often, those are bad decisions. I grieve with Governor Palin about her daughter's first bad decision to have premarital sex, and second bad decision to fail to use a condom. (Assuming that's the case. There were a couple of college students at our church in San Jose who decided not to wait--and the condom broke, accelerating their marriage plans.) But the daughter's decisions are not an indication of hypocrisy on Governor Palin's part. Now, if Governor Palin had dragged her daughter off for an abortion, the left would have a valid basis to scream hypocrisy. But then, no one would even know about this, would they? I'm guessing that the louder the left screams about this, the more parents of teenagers will say, "I sympathize with Governor Palin." It doubt it will get any votes for the McCain/Palin ticket--but I can't imagine it turning any votes away. There is one way that Governor Palin could use this to her advantage: remind everyone that the left promotes sexual promiscuity and premature sexualization of teenagers through their control of the entertainment media. I certainly wouldn't argue that this constant pressure is what caused disappointments like this. Teenagers and young adults have been making mistakes like this for many centuries. I recall reading an analysis of Puritan birth and marriage records that concluded that at least 16% of brides were pregnant when they said, "I do." For exactly that reason, the culture needs to be promoting restraint and mature decision making. The entertainment business is pouring gasoline on a fire when they should really be bringing a fire extinguisher. UPDATE: Byron York of National Review went around talking to evangelical activists at the Republican National Convention--and received much the same reaction that I had: “For me personally, it hit my heart this morning,” Sharkey told me, “because I was a 17 year-old girl, just like Sarah Palin’s daughter, and I had — I was in those shoes. And my son is with me, who will be 35 years old next week, and so I know what a difficult road there is for her.”Yup. We live in an imperfect world, one that has been made even worse by the left's obsession with encouraging every 13 year old to be sexually active, regardless of the emotional and medical risks. This is a bad situation for Bristol Palin, and I'm hoping that what happened will be a warning sign to lots of other teenagers across America that it's easy to get carried away in the passion of the moment. Labels: 2008 presidential candidates Monday, September 01, 2008
|