Friday, April 22, 2005

You already know the original picture shown on Coding4Fun raised within me some concerns I was already outdated, old, unplugged, not into "it" anymore.

Well, I'm thinking of launching a new portal called Coding4Work, where developers will feel more connected to the real thing. Instead of being welcomed by the "Tattoo Dude":

edited-poster-tattoodude.jpg

You will be welcomed by the "Busy Dude":

martin-tattoodude.jpg

Hmmm, that's much closer to my life, dude! ;-)


.NET | Fun

4/22/2005 3:48:17 PM (Eastern Daylight Time, UTC-04:00)  #   
 Tuesday, April 19, 2005

I just got bitten by the .NET Framework COM interrop. We had a problem with Xceed Zip ActiveX used in a .NET application. If the application was handling the ZipPreprocessingFile event and changed the sFilename parameter (BSTR*, or ByRef String if you wish), sometimes the library did not change the filename in the resulting zip file.

That "sometimes" was the mysterious part, though I had a good idea where the problem was. The method which fires the ZipPreprocessingFile event makes a dangerous, but up until now valid assumption. The kind of assumption that would make Raymond Chen or Don Box real mad. It took for granted that the BSTR address would change if the callee was to change the BSTR. I made this assumption based on two facts:

  1. A BSTR is an immutable entity. If you need to modify one, you should create a copy with the new content.
  2. If the implementation of a function that takes a BSTR reference parameter assigns a new BSTR to the parameter, it must free the previously referenced BSTR. (written "as is" in MSDN)

The .NET code that reproduces the problem does a very simple thing:

sFilename = sFilename & "new"

Normally, languages will work with the provided BSTR* as is. And if a modification occurs, they will allocate the required new BSTR, copy chars from the old BSTR, then free it. The new string cannot have the same address as the old one.

In .NET, the COM interrop is actually making a copy of the BSTR to create a System.String, work with that System.String throughout the function, then checks if the string changed before returning control to the COM caller, making either a call to SysReAllocString on the old BSTR, using the String as the "psz" parameter, or simply freeing the old BSTR, then allocate the new one based on the String.

Bam! Turns out SysReAllocString or SysAllocString sometimes reallocate the new BSTR at the same address as the old one. Can't argue against that. My bad.

Three things to conclude with that:

  1. You can never use what you experiment as a proof of concept. Experiments and tests are always a subset of the big picture.
  2. Don't try to make assumptions larger than the initial statement. Assuming that a pointer wouldn't change just because a BSTR* parameter must be freed if changed was stretching the actual fact.
  3. Optimizations may sound good, but can always introduce more problems. Simplicity is bliss.

By the way, I realized I could try a very simple VB6 test. If once the old BSTR is freed any new BSTR can end-up at the same address, does it mean that a VB6 application modifying the sFilename parameter twice can reproduce the same bug? Absolutely! My VB6 sample application did this in ZipPreprocessingFile:

sFilename = sFilename & ".foo"
sFilename = sFilename & ".bar"

Turns out files are sometimes renamed, sometimes not... Sometimes, I feel like an...


COM | Zip

4/19/2005 9:17:39 AM (Eastern Daylight Time, UTC-04:00)  #   
 Monday, April 18, 2005

Scott is inviting us on the MSDN Coding4Fun portal, with news and articles on many programming topics.

It's funny... or should I say perturbing... I'm welcomed by a young tattooed man wearing earphones, working on his laptop, peacefully in what appears to be his living room. The JPG filename is self-explanatory: "c4f-poster-tattoodude.jpg".

I don't have tattoos. I don't have a laptop, I wouldn't code on one if I could anyway. I'm not a "dude" anymore, if I ever was one. I listen to music while coding only to isolate myself of the ambient office noise. I'm a happily maried father who's day job is to develop software, and used to have time to "Code 4 Fun" in a distant era.

I'll be honest, I don't code for fun anymore. I'm having fun most of the time when I code, but I do it for work. I feel old and unplugged when I see "Dude" sites that tell me "programming is cool, man!".


.NET | Fun

4/18/2005 10:00:35 AM (Eastern Daylight Time, UTC-04:00)  #   

The .NET Compact Framework 2.0 beta 2 is out! But it won't run on my awesome state-of-the-art Jornada 545. :-(

Supported Device Operating Systems: Windows Mobile Software for Pocket PC 2003 Pocket PC, Microsoft® Windows Mobile™ version 5.0 for Pocket PC and Smartphone, and Windows CE .NET 5.0.

Ok, ok, I admit, I expected this! :-) My old Jornada is running Pocket PC 2000 (Windows CE 3.0 based), and has an astonishing 16 Mb of base storage to split with both storage and memory. Though I've installed the minimum in main storage, I have 7.5 Mb to work with when I boot. For example, I often can't open Windows Media Player and Word simulteneously, else I run out of memory.

Don't get me wrong, I love my PDA... But less than a few years ago. The battery is giving me less up-time than before, and more often than before I can't find software to run on Pocket PC 2000. I expected this to happen one day. My biggest frustration is I can't install a new OS. Can't brun the ROM. It will die with Pocket PC 2000.

But I'm a little surprise the new version of the .NET Compact Framework won't support Pocket PC 2002. Imagine if the regular .NET Framework was to only work on XP and 2003, but not on Windows 2000. People would scream! I thought the Windows CE 4.x market was big enough to justify supporting it. Oh well, I was wrong...

BTW, do you know where and when I bought my Jornada? At the Microsoft Store during my first Early Adopters .NET lab at Building 20. An impulsive decision at a time I didn't know I needed a PDA.



4/18/2005 9:25:31 AM (Eastern Daylight Time, UTC-04:00)  #   
 Tuesday, April 12, 2005

Just read Mitch's post: Is your general blogging? It's been some time now that I'm trying to convince my generals and colleagues to start blogging too. I feel somehow alone as the only Xceed member to blog. Moreover, I clearly don't have "all the picture" to share with you. It would be so great to see Odi and Dan open and share their experience as Xceed generals.

Odi Kosmatos

Odi is a geek (or greek, both apply)! When he gets interested in some technology, he'll read everything he can to master the subject. I needed winter tires for my car? I asked Odi. Pascal was curious about having a "music anywhere" house. He asked Odi. Odi could share so much on particular technologies using his own experiments and readings. What's even more interesting is that he gets really excited sharing his thoughts with us. Why not have fun blogging about them?

He's also deeply involved at Xceed with marketing, sales, web sites and next products/features decisions; he sure would have a lot of material for blogging.

Daniel Côté

His blog would be in French... or he wouldn't post enough. But I don't see why we couldn't blog in French too. Though Daniel earned the same computer science diploma as Odi and I, he has since concentrated his efforts on management, finances, and human resources. His blog would address the day to day experience of managing a software company and it's employes, dealing with decisions, relations, and the general image a serious company has to withstand.

Besides Xceed's generals, there are pillars at Xceed I would very much like to see blog.

Pascal Bourque

Friend, fellow lead developer and unofficial chief architect, Pascal is probably the person I'm the most eager to see blog. At the time he's reading this, he's probably mad I'm putting (yet again) more pressure on him blogging, but we would all benefit from the exercise, him first!

Let's make it clear: he's a master! Master at leveraging, quickly understanding and popularizing (is that a word?) any technology. And I mean any! He's amazing. He can quickly identify any technology that can get involved in a new product or feature, understand how it could be useful, and easily explain why. He's a very important part of Xceed's expertise.

Samy Kacem

Samy is our main webmaster. Speaking many languages and getting seriously involved in marketing, he has a clear and serious opinion on many worldwide subjects, and it's always a pleasure to discuss with him. And he's very funny, so his blog wouldn't be boring!

Many others here could also enrich the Xceed blogging community with their experience. I feel alone it that community. Help me convince them to join me!



4/12/2005 4:10:16 PM (Eastern Daylight Time, UTC-04:00)  #   

Funny. When I saw the TopDesk post on Neowin, i told myself "Hmmm, looks nice, I should take a look at it one day", and I returned to my work.

This morning, I saw another TopDesk post, this time on ComputerZen. Scott is so impressed with TopDesk that he made a video capture of it in action. His demo and description sold me! I've installed TopDesk, and it's a great tool for only 10$.

It's not the first time Scott convinces me more than any onther people or article to try something. The power of blogging on small software companies is huge... and very important I realize! Maybe I can even try a conclusion: blogging is far more important for small companies than big companies.

Hint to the Otaku Software and Maxivista of this world: If someone named Scott Hanselman wants to buy your software, give him for free, it's a good investment. :-)


Fun

4/12/2005 9:06:44 AM (Eastern Daylight Time, UTC-04:00)  #   
 Friday, April 08, 2005

Don pointed us to the Computerworld Development Survey, where we learn that developers use .NET and C# more than other frameworks and languages.

In the survey, you can read this:

What is your current position/job function?
IT manager 38%
Developer 36%
Non-developer IT staff 8%
Non-IT manager 5%
Other 13%

There are more IT managers than developers? What gives? Another table I had problems with is this one:

What is your current employment status?
Employed in organization with more than 100 employees 86%
Employed in organization with 100 or fewer employees 7%
Self-employed 6%
Not employed* 1%

Hmmm, that looks strange. I felt there were more smaller companies around. Then I read the end of the article:

Methodology
This study was conducted among subscribers to Computerworld.

Ok, now I understand. Surveys are biased by definition. You need the definition to understand them! My understanding is:

  • Computerworld is read by IT managers, not developers.
  • Big companies subscribe to Computerworld for their IT department. Small companies put their money elsewhere first.


4/8/2005 8:57:02 AM (Eastern Daylight Time, UTC-04:00)  #   
 Thursday, April 07, 2005

Did you notice that when maps.google.com cannot find your location, it always displays the same map? It's somewhere in Kansas, close to the Oklahoma border:

somewhereelse.jpg

It made me think of The Wizard of Oz, so I searched where Dorothy Gale was from. She's from Liberal, Kansas, which is way to the West of what's displayed.

The first thing you notice is the Coffeyville Country Club. So I've googled for "Coffeyville Country Club Google", and realized this was simply the default location when you open maps.google.com, and zoom in... Google Maps' center of the United-States... Dah! So much trouble for a so simple solution.


Fun

4/7/2005 4:55:28 PM (Eastern Daylight Time, UTC-04:00)  #   
 Tuesday, April 05, 2005

Just learned through Neowin.net that maps.google.com now supports switching between the drawn view of the map and a satellite view. Switching views is as simple as clicking on either "Map" or "Satellite". And guess what? Zooming and moving works as well in "Satellite" view. They were quite fast integrating their new Keyhole acquisition!

If you compare the "Link to this page" of the same area for both views, you can see that the only difference is the "t=k" extra parameter for the satellite view ("k" as in Keyhole).

Bravo Google, you did it again!

 


Fun

4/5/2005 8:01:28 AM (Eastern Daylight Time, UTC-04:00)  #   
 Friday, April 01, 2005

This one is my favorite news of this "fishy" day!

As a long time Win32/COM developer with several books containing many sample programmers [sic], I am just appalled that Microsoft would consider dropping support for classic IDL. This would cause trouble for developers who are still using the samples that I created 10+ years ago!
--
Geoffrey Rickder

That was funny!


Fun

4/1/2005 10:54:01 PM (Eastern Daylight Time, UTC-04:00)  #