October 23, 2007 19:57 by
dgood
I am America (And So Can You!) - One word: Hilarious. Technically, that's three.
Yes, I'm still alive. I've been very busy lately. I jacked up the radiator cap on my Jeep and I've been busy putting a new Jeep under it.
ProgrammingGoody, you say? Blog about software, eh?
How's this: Boxing and Unboxing in C# can be tricky operations for the inexperienced or uninformed.
Example:
struct Point
{
int X;
int Y;
public Point(int x, int y){ X=x; Y=y; }
public void Move(int x, int y){ X = x; Y=y; }
}
public static void main(string args[])
{
Point p = new Point(0, 0); // value type
ArrayList arr = new ArrayList(); // only holds reference types
arr.Add(p); // Box it
((Point)arr[0]).Move(5, 5); // Unbox it
Console.WriteLine("Point: {0}", arr[0]);
}
When the Point struct is unboxed, the pointer to the boxed Point on the managed heap is used to copy the values from the heap into a new instance of a Point value type on the stack. In effect, there are now two separate instances of Point - one on the stack and one on the heap. Using Point in this manner will not lead to the desired outcome.
The same mechanism applies to any value type stored as a boxed reference. (Hint: think Session state)
This one's for you, Classic Colin.
Cheers.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
July 5, 2007 19:30 by
dgood
I'm working on an essay, more of a research paper, really.
I was listening to an interview with Grady Booch during which he mentioned that much software architecture is grown, or evolved, rather than planned.
That got me thinking about architecture in general, and brought to mind a quote from Linus Torvalds:
Nobody should start to undertake a large project. You start with a small _trivial_ project, and you should never expect it to get large. If you do, you'll just overdesign and generally think it is more important than it likely is at that stage. Or worse, you might be scared away by the sheer size of the work you envision. So start small, and think about the details. Don't think about some big picture and fancy design. If it doesn't solve some fairly immediate need, it's almost certainly over-designed.
http://en.wikiquote.org/wiki/Linus_Torvalds
I left off the last couple of sentences from Linus' quote which could provide more relevant context, I don't know, that's for you dear reader to decide. Personally I find that it doesn't provide any mitigation to the first couple of sentences, so it's irrelevant.
Then I began to think about software engineering in general, and particularly the essay that Steve McConnell wrote the other day about Software Engineering: Rumors of Software Engineering's Death are Greatly Exaggerated (aka Software Engineering Ignorance, Part II)
I think if you ask 10 seasoned software engineers to define software architecture, or software engineering, that you will likely get 10 different yet conceptually similar answers. So it sounds fairly simple. Then why are there so many contradictory philosophies?
- Problem: Too much architecture is not planned
- Solution: Need more planned architecture
- Problem: Too many people plan big fancy architectures
- Problem: Too many people don't engineer software
- Solution: Need more emphasis on the engineering aspects of software
So, I solicit your input on the following:
- When is it ok, or not ok to have Big Design Up Front (BDUF)?
- Can BDUF and Agile methods coexist?
- What separates Software Engineers from Software Architects?
- How big, or how complex should the architecture really be? (No lame answers of "only as big as it needs to be")
- In other words, If I'm sitting down today to begin creating the next generation of a complex system, how complex can the architecture be if I "start with a small _trivial_" architecture?
What gives?
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
June 28, 2007 18:33 by
dgood
So, last night I mentioned I chose
Subtext over
dasBlog due to some rendering issues in Safari. Ok, I didn't mention it quite like that but you get the idea. Since my main machine at home is an iMac, Safari support wasn't crucial but it was the equivalent of a coin toss for me.
Scott Hanselman pointed out in his comment, rightly so, that it looked fine to him. I know what I saw, so I quickly downloaded Safari beta 3 on my windows dev machine at work to get a screen shot of what I was talking about. Unfortunately, he's right. It looks exactly the same as it does in IE 7, and as it is intended I presume.
This can't be right. I know what I saw.
At that point I was convinced that it must be an issue exclusive to OS X. I rushed home this evening and started opening browsers.
Here's what I found:
 |
 |
 |
| IE 7 on Win XP |
Safari 3 Beta WinXP |
Safari 2 OS X |
So I'm not crazy, nor is Scott Hanselman. We're both right.
On that note, I decided to get the Safari 3 beta for OS X and see if it's Safari 2 or just Safari on OS X that's the issue.
Here's Safari 3 Beta on OS X Tiger:

Safari 3 Beta OS X
So, it's obviously Safari 2 that has rendering issues. I guess the question remains how important is it to support Safari 2 on OS X? Probably not very, but it did swing my vote.
(As a side note, all this screen grabbing must have tore my monitor - I just found a dead pixel. Not happy about that.)
Cheers.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
June 27, 2007 20:41 by
dgood
As you can see the conversion to Subtext is complete. All in all it was fairly simple and went as smooth as I could have hoped.
I haven't looked at any source code but I'm impressed with the functionality and how well it works out of the box. It needs a little polish, but it's an impressive app for a zero dot something build. My hat is off to the Subtext team, I think you've put together a nice app.
There is this one dig I have to make, however. I switched from Wordpress 2.0 and there is no "simple" way to convert the data. I did search the Subtext forums on Sourceforge and found a thrown-together app to export Wordpress data to BlogML format for importing using the built-in Subtext import feature. I understand it would be difficult if not impossible to create and maintain converters for every other blog platform out there.
So, I'm working on a Wordpress to Subtext direct convert app. So far, it's been pretty simple. The data structures map fairly nicely. My hope is to make it available by this weekend as a simple Windows app to do straight MySQL to SQL data conversions, skipping the XML export. From there I'd like to make it flexible enough to support multiple versions of Wordpress, and from there I'd like to add a feature for advanced users to drag-and-drop map the data structures if the app can't figure them out.
Why all this work for a simple one-time-use converter? I dunno. Something to keep me occupied and fiddling around with non work-related code.
The last thing I'll say about it is that I'm posting this from Firefox 2.0 on my Mac. It works fine in Safari with the exception of the HTML editor. Mac functionality is one of the main reasons I chose it over dasBlog - sorry Hanselman dasBlog looks terrible in Safari. Other than that it's a peach in FF.
Cheers.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
June 26, 2007 21:30 by
dgood
I've been reading
Phil Haack's blog for a while, and of course I've been hearing all about
Subtext. So, I thought I'd give it a try and at least see what all the fuss is about.
I'll be migrating all of my posts from my old blog soon, and I've got a ton more topics to rant, err post about too.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
January 26, 2007 21:33 by
dgood
I've been working on a prototype for a new piece of software which will add new functionality to our system. It is to be a proxy between an existing Win32 MFC app written by a different engineering group and our system which has functionality that they need. The MFC app could be anywhere on a network and our system can be anywhere else. So, the prototype needs to have the ability to be somewhere else entirely as well. The real trick is, the MFC app has to work with or without the proxy - the proxy has to be completely invisible to the MFC app.
So, I wrote a multi-threaded library that opens a socket and listens on that port for incoming connections. When a connection is made it handles the tcp stream and incoming byte arrays accordingly. It's configurable with an XML file to specify how many listeners to start and on which ports they're to listen on when it starts up. It listens on a given socket for incoming connections, when a connection is made it passes it to a worker thread that does some logging and forwards the tcp packets on to another waiting socket connected to our system on the back-end. I built-in a garbage collector to clean up the worker threads if client connections are dropped, and it's got a combination of asynchronous delegates and ThreadPool delegates to dump messages into MSMQ and raise events for client subscribers (e.g. a Console app or Windows Service) to trace events.
All-in-all it works pretty good, it's scalable, and it's pretty robust. But there's this one little bug that continues to drive me mad Mad MAD! I can't put my finger on it.
The method that does both the send and receive to the socket on the back-end is synchronized so only one client can forward packets at a time. Any other packets just queue until the back-end socket gets the bytes out of the receive buffer. For this particular application it makes it more robust since the system that the back-end connects to can't handle many connections. When the tcp packet reply is received on the back-end the first byte, or first two bytes specify the size of the incoming packet, that way I know how much to receive from the stream in case a number of packets are arriving at the same time. There is a concrete rule - there is a 1:1 relationship between messages and replies. Now there's the problem. Something is bunking up my receive buffer (sporadically) on the back-end. I believe the other system is broadcasting something as an additional response to the original message that isn't expected. Consequently, there are two results - It's unpredictable and it's insanely frustrating to debug!
Good night.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
January 25, 2007 21:28 by
dgood
Catchy title.
I had my friend
Jason hook me up with an account at his site
WordsForWords.com. I do read a number of books and I'd like to contribute to the site, plus it gives me an outlet for discussion. I almost said I read a
lot of books, but A) that's relative, and B) not *nearly*
one hundred books a year like Todd Gerber. I'm in the more conservative wife-house-job-twin boys 10-20 per year category. Although, to be fair, Todd is just as busy.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
January 25, 2007 21:13 by
dgood
A couple of years ago, not too long after building my last computer, I purchased a very nice, very large LCD monitor. It's a
Samsung SyncMaster 213T 21 inch, 1600x1200 resolution, pretty much the cat's whiskers at the time. Several years ago when I bought it, it was pretty much the best thing available in the retail space without jumping up to the $2000 pro range.
I bought the Apple mini-dvi to dvi adapter and set my 21" Samsung as my secondary monitor. I was chuffed, thoroughly satisfied with myself, and absolutely pumped about the amount of screen real estate I was going to have.
I turned it on. Man, do I have a ton of real estate - the 24" iMac is running 1920x1200 beside the Samsung running 1600x1200. Boo-yah!
One thing though...
This Mac screen makes the Samsung look *terrible*. Apple does mention on their site that the 24" iMac is, purportedly, 40% brighter than the 20" iMac. I can tell you that it's most definitely brighter than the 21" Samsung. Let's look at the stats:
Samsung: 250 nits 500:1 contrast
24" iMac: 400 cd/m 700:1 contrast
Stunning. I had no idea what I'd been missing all this time! The iMac is so much more vivid and gorgeous, and all the while I was looking at my Samsung thinking how wonderful it was. The difference, especially side-by-side, is truly remarkable.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
January 24, 2007 11:55 by
dgood
While
everyone is ranting about simplicity and common sense with design, how about we discuss the missing option on my iMac?
Let's be clear, the 24 inch iMac is a giant monitor with a computer built-in.
Last night, I started downloading XCode, which is a svelt 932 MB. I wanted to turn the monitor off and leave the computer on to download while I
become a Viking.
Can't.
What?
For the love of all things good, who designed this thing?
Touch the power button.... it goes to sleep.
Restart? No.
Sleep? No.
Shutdown? No.
Where's the 'turn off monitor' feature for crying out loud?
Wait, I can go to system preferences, power settings and adjust the computer to never sleep and the monitor to blank out after 1 minute of idle time!
Ridiculous.
Steve, I want a monitor off option on the apple menu. How hard can this be? You shut it off if my computer is idle, how about giving me the option to do it manually?
Oy.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5
January 23, 2007 19:28 by
dgood
It just works.
I'm at a complete loss for words.
disclaimer: I'm still in my honeymoon phase with my new iMac, so anything I say forthwith should be considered suspect. The only things I can come up with to describe it are that it makes KDE look like a wannabe little brother, and Windows * look plain ridiculous.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5