|
Life of a Programmer |
Posted: Sat Feb 21, 2009 2:40 am
|
|
I've been doing a lot of coding lately on CMUD and TeSSH, trying to get it ready for the next beta release.
Some days, programming is fun. You get to solve challenging problems in creative ways. You get to build something from scratch that didn't exist before, and you have almost total control over it. If you want a cool new feature, you work hard at it until the problem is solved and that gives me a great amount of personal satisfaction and motivation.
Then there are the "other" days. Days like today. When all you want to do is fix a bug or add a new feature, but instead of spending time on your actual code challenge, you deal with weird, flaky, random, annoying problems that seem completely out of your control. Suddenly, something you expected to take five minutes ends up taking four hours. Some stupid, trivial little problem that just won't go away that really has nothing to do with the core work you were trying to get done.
Today was like that. I was working on the "jerky" mapper panning, and the mysterious appearing/disappearing horizontal scrollbar. Resize the map so that the horizontal scrollbar isn't needed and it disappears. Well, almost. A blank bar still remains where the scrollbar used to be. Tweak the window size just a bit and it magically disappears. Now resize the window smaller to make the horizontal scrollbar appear again. It doesn't. But again, if you tweak the window size just a bit, it will suddenly appear.
What the heck is going on here. The code for this is really simple:
Code: |
if (WindowSize > MapSize) then Scrollbar.Visible := false
else Scrollbar.Visible := true; |
How can something this simple go so terribly wrong?? Then, just when you are in the middle of trying to solve this problem and are working in the debugger, you come across a block of code like this:
Code: |
v := somevalue;
if (v <> nil) then begin
// do stuff here
end
else begin
// do other stuff here
end; |
And when you debug this code, the Delphi debugger skips *both* sections and doesn't execute either of them!! How in the world is this possible?? Isn't the whole idea of an if-then-else statement that you will execute *one* of the blocks? How can the debugger skip both blocks completely?
It's usually about this time that Chiara goes into the other room because she is tired of hearing me swearing at my computer. The cats all run away, and I'm left alone with my problems. I scream at the computer until my face is red, and contemplate the wisdom of throwing my computer though the window of my office. At this point, the neighbors are probably ready to call 911 thinking I'm about to murder someone (yes, my computer, I'm talking about you!).
It's days like these that I wish I wasn't a programmer. I wish I had never seen a computer. I wish that I was on some tropical island where they have never heard about computers.
Instead, I just keep yelling at the computer and keep trying random stuff until the gremlins go away and leave me alone and everything magically starts working again.
In the above cases, the scrollbar issue was caused by some screwy Windows messages that were still in the queue when the window was being resized. I was responding to one of the resize messages and toggling the Visible property of the scrollbar, but during the message I was handling, toggling the Visible property doesn't work in Windows properly. The solution was to post my own user-defined message into the Windows message queue telling the scrollbar to enable/disable after the rest of the messages were processed. One of those times that Windows messages will drive you crazy because of all their weird undocumented side effects.
The other case turned out to be a simple problem (BUG!) with the Delphi debugger. It only *looked* like it was skipping the code. In reality, the proper code block was being executed, but the debugger just wasn't stopping in the middle to show it to me. In fact, if I told it to single-step a few more times, it would magically bounce up to the block being executed and show me the lines being executed. It would start toggling between showing the line being executed, then popping to the line after the block, then popping back to the line being executed, etc. It had nothing to do with my code at all. It was just some weird Delphi debugger behavior that I had never seen before. After I rebooted my computer, the problem was gone. Blame Delphi, Blame Windows Vista, or just blame the gremlins that decided to make my day hell.
So, the next time you wonder why bug fixes take so long, or wonder why I don't promise specific release dates, now you'll know why. Some days the universe just doesn't want me to get anything useful done. If you ever plan to become a programmer, you have now been fore-warned. |
[Post your comment] Comments: 14
Last comment: Mon Jun 26, 2017 10:27 am by ZigZag
|
|
|
World Science Fiction Convention |
Posted: Sun Jan 20, 2008 6:14 pm
|
|
Anyone else planning to attend World Con in Denver this summer?
Zugg and Chiara will definitely be there. We've been suckered...I mean volunteered...to help out since a good friend is the instigator, I mean chair.
Let us know who's coming! |
[Post your comment] Comments: 11
Last comment: Mon Aug 11, 2008 5:11 pm by Zugg
|
|
|
Vista Experience - Take Two! |
Posted: Sat Mar 17, 2007 1:32 am
|
|
OK, here it is...the blow by blow blog (say that ten times fast) of my Windows Vista development system installation experience.
Using Acronis Disk Directory (the same company that makes the excellent Acronis True Image backup system), I created a 20GB partition for Vista on my 100GB SATA RAID array. This worked easily. I know you can also use Symantec PartitionMagic, and there is a free linux tool you can copy an ISO image to a CD to make a bootable CD that will also repartition the drive.
Edited: DO NOT USE Acronis DiskDirector 5.0. It does not properly format partitions for Vista!!! I wish I had known this before I started.
This drive now looks like this:
C: Apps (70MB)
F: WinXP (12MB)
V: Vista (20MB)
I purchased the Vista Business Upgrade edition, and it was time to install. That is, once I figured out how to open their new-fangled box. That's Microsoft for you...always trying to do something different. The box has hinges, so it looks like it would open like a book. But no. And CompUSA had placed an additional plastic seal to stop it from opening. Removing the seal was going to rip off the authenticity label, so I had to cut along the seam of the case with a knife, and then open it. I've never had so much trouble with a software case in my life. Why didn't they just use a standard DVD case? Who knows. Hope it isn't a bad omen.
Inserted the DVD into the drive while WinXP was running, and selected the options to install a fresh copy on the new V: partition. It was easy because the existing F: system partition wasn't big enough so the evil "upgrade" option was actually disabled.
About 30 minutes later, Vista is up and running with no problem at all. Haven't installed any apps yet, but the network is up and running just fine. The only hardware it seems to have trouble with is the sound card. It's a SB Live! so you'd think it could handle that out of the box. The Vista Compatibility wizard didn't even complain about it. But that's minor and I should be able to solve that later.
Unlike on Chiara's laptop, I find Vista to be significantly faster than XP so far. Maybe Dell is doing something wierd, or maybe it's the difference between doing a clean install vs an upgrade. So far, I'd definitely recommend doing a clean install like everyone else has said.
When I reboot the computer, I automatically get the boot manager prompting me to select which version of Windows I want to run. So the dual-boot happened automatically. I then rebooted and selected the "Previous Windows version" (WinXP). WinXP starts checking the V: Vista partition for consistency and then started reporting a bunch of "Recovering Orphaned Files". Hmm...what is it doing with that? WinXP doesn't like the Vista partition somehow?? Just when I thought it was going to go really smoothly :(
OK, it displayed the "Recovering Orphaned File" message a *lot*. It did this for about 10 minutes! Then WinXP started up. Then I got an error saying "This version of Windows could not be installed. Your previous version of Windows has been restored". Huh?? Something wierd left over from running the installation from within XP to start with? Maybe I should have just booted the DVD?
Anyway, WinXP seems fine. No other errors. Delphi 7 still works. Firefox works, etc. Really wierd.
So, let's try to reboot WinXP again and see if it's really ok. This time it doesn't check the Vista disk and it starts XP just fine.
OK, now let's try to boot into Vista. No problem with that. Vista starts up just fine. No errors.
OK, one last try for WinXP. Let's see if WinXP can boot right after Vista. This time it works fine. No Orphaned files, and no error message in XP. So I guess it just had some stuff left over from installing the upgrade from within WinXP and then not expecting to finish installing in a different partition.
Could have been slightly smoother, but honestly, this is better than I remember my first WinXP installation being.
Edited: Yeah right...I was just being fooled. Keep reading to find out what a nightmare of an installation this really turned out to be.
*Ding* Round 1 is over...and I'm still standing! |
[Post your comment] Comments: 56
Last comment: Mon May 14, 2007 10:28 am by Fang Xianfu
|
|
|
Happy Birthday Zugg!!! |
Posted: Fri Aug 04, 2006 1:18 pm
|
|
That's right, it is our beloved Zugg's Birthday today. Another year older (or, after yesterdays horrific bug search, possibly 2 years older.)
So lets all wish him a Happy Birthday today!
Chiara |
Last comment: Tue Aug 08, 2006 1:09 am by edb6377
|
|
|
A Challenge for CSS coders...the horror! |
Posted: Wed Sep 07, 2005 12:54 am
|
|
You know, I get really annoyed at standards pay more attention to themselves, rather than to what people *want* to do with them.
CSS is my current example. We all know that Firefox (and Opera, etc) are more "compliant" with the standards than Internet Explorer. But you know, in many cases, Internet Explorer does what you'd WANT the standard to do.
My current gripe is the fact that the HEIGHT style in CSS is ignored for inline entities (SPANs). Internet Explorer allows you to use HEIGHT in a SPAN, but it's not "standard" and Firefox ignores this property.
Why does this matter? Try converting an HTML TABLE into non-table CSS form. In a table, you can have a cell with a background image and you can adjust the height and width of that cell to show the entire background image. A table cell is an INLINE entity. In other words, TD elements are stacked horizontally. But in CSS, an inline element cannot have a width and a height! This makes it nearly impossible to convert tables to non-table CSS!
Here is the specific problem that I was tackling today. I finally GAVE UP trying to do this with pure CSS. After about 4 hours of messing with it, I just gave in and used a TABLE to achieve the desired goal.
Challenge: Create a set of classes to create extendable (sizeable) buttons that can be placed INLINE with other text. Here is what I want it to look like:
text text text text
The design requirements are:
- Must render the same on IE, Netscape, Firefox
- The text in the middle can be anything, so the button needs to resize it's width based upon the text being displayed
- The images must be specified in the CSS style sheet, and not in the inline HTML code
- The HTML code to place a button on the screen should be as short as possible
- The button must be able to be displayed INLINE with other text, and should align itself to look good next to the text
Ideally, the HTML code for the button would look something simple like this:
Code: |
<SPAN class="Button">
<SPAN class="Button_Left"></SPAN>
<SPAN class="Button_Middle">Button Label</SPAN>
<SPAN class="Button_Right"></SPAN>
</SPAN> |
The problem with this is when you try to assign the background images. If you do the obvious and define the Button_Middle class like this:
Code: |
.Button_Middle {
background-image: url("button_left.gif");
} |
then you will find that Firefox shrinks the size of the box down to the height of the text, so you don't see the entire background image. If you attempt to use the HEIGHT property in the style sheet to increase the height of the button, it gets ignored because these are INLINE elements.
If you try to convert everything to DIVs where the HEIGHT property works fine, then you have the problem that the button no longer can be placed in the middle of text. Using the "display: inline" property doesn't work on Firefox, so you can't use that trick either.
Feel free to play with this in your spare time and let me know if you come up with a good solution. Until then, I'll just stick with the TABLE method that seems to work.
But this is just one of the examples where I'd like to use CSS to get rid of a table, but I can't because the idiots defining the standards didn't think it was useful to allow the height of an inline box to be changed. Why not? Changing the text-size will change the box height, and you can freely mix text of different sizes on the same line. So obviously all browsers need a way to handle mixed box sizes of inline elements. So why not let the designer specify their own size instead of auto-computing it from the text itself? It's just stupid. |
[Post your comment] Comments: 23
Last comment: Thu Oct 27, 2005 12:42 am by rck
|
|
|
|
Zugg's Blog
|
Zugg's official personal blog where he will post various rants, discussions, ideas, and other potentially interesting (or not) stuff.
|
|
Send private message
|
|
Occupation: CEO, Zugg Software Inc.
Resumé
Location: Colorado, USA
Interests: MUDs, MMORPGs, Programming, Woodworking, D&D, SCA
All about Zugg
|
|
Go: Back/Forward
View Past Entries
|
|
Entries: 131
Blog Age: 7352
Posts: 2453
Visits: 215612
You cannot post new entries in this Blog You cannot reply to entries in this Blog You cannot edit your posts in this Blog You cannot delete your posts in this Blog
|
|