Archive for the ‘Programming’ Category

Vista Strikes Again

Sunday, August 19th, 2007

So, the Flickr tool for uploading has been written on Vista, because I don’t want to dirty the XP game box. Hehe, yeah compiled on Vista means it doesn’t run on XP. The shell32 reference in the Interops is Vista’s and you get an Interface error on XP about missing items. If you use an Shell32 Interop you must compile a version of the app on the target OS. That sounds like a fun build farm to make for a 20 project.

Loving the Vista!

Anthony Cracked the NTFS File Metadata Problem

Thursday, August 16th, 2007

Wahoo! Anthony cracked the problem of the NTFS file metadata. Using Shell32.dll and adding this reference to the project you can make a ShellClass and store all the file details in an ArrayList; name, attributes, datetimes, title, comments, etc. This took a lot of time to find. So, I’ll post the full results later tonight. It’s very easy to do, which is probably why there is not a .Net API to use.

http://www.thinkdigit.com/forum/showthread.php?t=30292

Flickr App to Upload Organized Files

Tuesday, August 14th, 2007

Flickr Upload is great it lets you drop files on it and then uploads them to Flickr. It’s a pain if the files are already sorted and arranged, because all this is lost. All the files at all the levels go in one group.

I went looking for something that would treat each folder as a tag and the lowest folder would be the set. I couldn’t find something, but I did find enough info to make something to do this. Explorer Sync started today and it already scans through the folders and upload the files as I described above. It’s still very crude. Right now there is one button and everything is hard coded. I downloaded MS Visual Studio Express 2005, SP1, FlickrNet, and NUnit. Using this thin document I got the Flickr part working. And this article shows how to iterate the folders. The interface needs to let you pick a root folder and some tweaks to the uploading and tagging. At this level it solves my immediate problem, v.1. I want to keep from uploading files twice. Maybe, by storing the filepath in the comments on Flickr.

For extra credit, I want to let multiple people make comments or tag the photos on Flickr and carry this info back to the Windows file metadata. Then I can see what comments people make and move/update the photos accordingly. Oddly, there is not a .Net NTFS metadata API. You have to make an Interop to the old Win32 libraries. I found someone who did this with c#, but is is not working on my Vista.

Took about 5 hours so far. I would guess it’s about 33% done or less. The rest will probably take 15-20 more.

Recursively Iterate Through Folders Using c#

Tuesday, August 14th, 2007

I have written recursive file and folder iteration in VBScript more times than I can count using the FileSystemObject. FSO Rules! This is the same code for .Net c#.

http://weblogs.asp.net/israelio/archive/2004/06/23/162913.aspx

Catching up on Michael Kaplan’s Blog

Tuesday, July 24th, 2007

Language Translation of Plurals

This is a good post that underscores the difficulty in translating one language to another.

One Hippopotami

One hippopotami cannot get on a bus,
Because one hippopotami is two hippopotamus.
And if you have two goose, that makes one geese.
A pair of mouse is mice. A pair of moose is meese.

A paranoia is a bunch of mental blocks.
And when Ben Casey meets Kildaire, that’s called a paradox.
When two minks fall in love, with all their heart and soul,
You’ll find the plural of two minks is one mink stole.

Singulars and plurals are so different, bless my soul.
Has it ever occurred to you that the plural of “half” is “whole”?

A bunch of tooth is teeth. A group of foot is feet.
And two canaries make a pair–they call it a parakeet.
A paramecium is not a pair.
A parallelogram is just a crazy square.

Nobody knows just what a paraphernalia is.
And what is half a pair of scissors, but a single sciz?
With someone you adore, if you should find romance,
You’ll pant, and pant once more, and that’s a pair of pants

Sorting It All Out : Don’t let commas distract you from the big money!
And this post is good one talking about the variable use of commas in numbers. In some countries, where numbers are 123,456,789 money might be in the format $123456,789

She typed in ‘God damn clippy’
Remember the Clippy paperclip help from Office. It’s off by default, but if it’s on you can find out how to turn it off by looking for ‘God damn clippy’. Help will be displayed on how to turn him off. These are the little things in programming that go unnoticed every day.

Rands in Repose

Tuesday, July 3rd, 2007

I found a new blog mentioned on Joel on Software blog. Rands in Repose is very interesting to read.

My personal weblog. No, Rands is not my real name. I use my real name as a full time engineering manager of teams that designs phenonmenal software. Yeah, that’s me in the logo. I hadn’t shaved in some time. My hair is longer now.

I’ve been writing here since April of 2002. I tend to write about four significant pieces a month, but changes depending on shipping schedules. Content varies from thoughts of being an engineering manager in Silicon Valley to writing to Vegas.

Before Rands in Repose, I wrote a weblog called The Bitsifter Digest. The site is no longer available and the articles are gathering dust on my hard drive. One of these days, I’ll dig up those articles and repost them because they document an interesting time of the Internet.

Origins of VBA

Thursday, April 26th, 2007

Joel on Software has a great blog on the origins of Visual Basic for Applications and the fact that it is being dropped from the Mac versions of Office. Microsoft has slowly been dropping their Mac versions for the past 2 yrs or so.

Joel on Software

COM/.Net Interop Solutions

Friday, April 20th, 2007

A quick update on the COM/Interop problems I’ve been writing about the past few months. As I mentioned in the extremely long post on 4/7, we came much closer to solving the problem than before. Previous solutions had been to account for all the COM objects and release all of them when the application close. However, this did not fix the problem only alleviate it.

In writing the next version and with the freedom associated with change a new version and not a patch, I decided to make one COM object that the whole web session would used. We were making an object next to the code that would use it, then releasing it when finished. The idea being if the make and release seemed error prone than reduce the number of times that happens.

The same call that takes the root level COM object from ASP creates the FieldManager. And the same call that closes the root level COM object destroys FieldManager. Then all references to the COM FieldManager get replaced with the .Net FieldManager. Suddenly, there’s one more layer between the working .Net code and the COM code.

Some cleanup was done after this; inheritance from a base object and replacing some COM FieldManager methods with a .Net version. Turns out one of the most heavily used aspects of FieldManager is to ask for more information about a field. And some of this information is hardcoded in a c++ object in the COM source code. A c# program was written to “translate” the relevant lines of the c++ code into equivalent c# code. There are about 1400 fields stored this way and changes from one version of the COM object to the next may go unnoticed byt the .Net team. So an automated solution was much prefered. Now, instead of a COM call for this information and .Net call for this information is used. If the information is not held in .Net then a COM call is made. For our most standard test file, all calls for field information were handled by the “translated” .Net code.

The last set of changes concerning the FieldManager field info are untested, but the other changes have already passed through QA into production and there seems to be no side affects. Hopefully, this addresses the problem and the solutions above turn out to be the correct way to handle COM/.Net interop.

P.S.
In making the import c++ code I discovered something interesting. Some lines in the c++ code imported as strings did not readily convert into integers in .Net. Maybe they were blank or an enum. The first method I tried was to use a try/catch. “try{ Int32.Parse()}catch{//you must be an enum}”. This personaly annoys the shit out of me. I should be able to evaluate a string that very likely is a string and maybe is an integer and decide what to do instead of waiting for it to fail a try/catch. VB.Net has IsNumeric() to do this. c# has nothing (thanks MS). So I referenced Microsoft.VisualBasic and then used “if (Microsoft.VisualBasic.Information.IsNumeric()){Int32.Parse}else{ //you must be an enum}”.

I was stunned by the performance difference. The results were the same, but the first solution using try/catch took over a minute to run. The second solution take ~15 seconds. This is huge. Cheers.

Update of SQL Server Database Publishing Toolkit for Web Hosting

Friday, April 20th, 2007

ScottGu’s Blog: Update of SQL Server Database Publishing Toolkit for Web Hosting

The SQL Server Hosting Toolkit is a free download that makes it super easy to create a .SQL script file capable of re-creating your database (including the schema, sprocs, and actual data content). When it is installed you can simply right-click on a database inside Visual Studio or Visual Web Developer and walkthrough a wizard to script it out…

c# Dictionaries

Wednesday, April 18th, 2007

I recently discovered how to use the Generic Dictionary class in c# to make a dictionary that holds anything. VB6/VBScript dictionaries use the Scripting.Dictionary class which consist of a string key/value pair. There have been many times that I wanted to store an object in the value part. In c#, I wanted them to keep from looping all the items in a list simply to check existance. Ah, .Contains where art though.

The following lines demonstrate.

//Includes
using System.Collections.Generic;

//Declaration/Instanciation
private Dictionary objContacts = new Dictionary( );

//Existance check
if (objContacts.ContainsKey(nIndex))

//Addition
objContacts.Add(nIndex, objContact);

//Removal
objContacts.Remove(nIndex);

//Iteration
foreach (int nIndex in objContacts.Keys)

//Access element by key
Contact myContact = objContacts[nIndex];

O’Reilly
MSDN IDictionary Interface

What a week!

Saturday, April 7th, 2007

Holy crap this was a busy week. I haven’t forgot about the blog by any means. Sometimes the db is down and I can’t post. That’s really annoying. When I have time I’ll probably move hosting companies or do this from one of my computers. I’ve resisted this is the past because I couldn’t trust myself not to fiddle, but I’ve proved that wrong recently.

Anyway it went like this…
Last Friday at work we tried something new to solve a persistent multi-user performance issue between COM and .Net. Basically, cache the problem COM objects. I had been working on a weaker solution for the next version after talking with Tim we decided to put this in the current code and test it. Weekend tests showed this worked well. So on Monday we went to put an improved solution in place. I would be off work from Tue to Wed. I got this done on Monday no problem.

Wed. was my birthday and Mom and Gma were coming on Tue. They showed up about 10:00 am to do whatever. That was their birthday present. Eminently more useful than crap. Not all the existing crap has found a living place in the new house. Grandma talked about painting the master bedroom and that seemed like a good idea. I had washed the walls, but there were tar stains in the corners and the small closet was knock down cigarette smelling. The MB screams out for a repaint more than any other.

It took a while to get going. Showing the house and talking about various aspects. We went to Lowe’s about 12:00 for paint. I realized that I was a day from 32 and I had never chosen the color for my own room. Apartments, dorm rooms, and my home in Canadian were all chosen for me. I was at a complete loss. I was concerned I would pick a color, because it was familiar not because I liked it. Several earlier favorites were also colors in the house or mom’s house. After a while I picked a brown-pink for the walls.

We moved some furniture and threw a plastic over the floors and bed and started painting Kilz. Wow, that stuff is tough to paint. It took from 2:00-5:00 with 3 of us going after the ceiling, closets, moulding, walls, and doors. The we waited an hour. Mom gave a coat of enamel to the closet shelves, Grandma raked, and I sanded wood for the pantry shelving. It is really uncomfortable telling Mom and Grandma what to do and my project list consists of one-person jobs. Grandma identified almost all the plants around the yard. There are tulips, daffidils, onions, garlic, yarrow?, peach or apricot trees, sweet peas, and more I can’t remember. She showed me were to plant the cantalope, watermelon, and pumpkins.

At 6:00 we started the actual painting. Grandma tried one lower panel and it was pink. Not much brown in it. This might work for a girls room, but I can just hear Patience and Jessica; “Red Flag!”. So, we decided to focus exclusively on the closets. This seemed quite reasonable given the time. What an education though. Closests are one of the hardest “rooms”. Two and a half of us worked for 3 and half hours to put down a spotty coats of pink. The blue just kept bleading though again and again. They went home at 9:30. I felt very guilty they stayed till 9:30 and had a 2 hr drive home and we only got the closets done. Grandma felt bad that she left the job unfinished and I could sleep in my bedroom.

Wed. I woke up with a very large unexpected project on my todo list. Though many things are not in thier final resting place or even a good resting place they are waiting on a project. The active list shouldn’t be more than 2 or 3 long. At this time I had unfinished trellis for the hops, replacement shelves for the kitchen pantry and lower cabinets, a bit of touch up design on the large garden bed based on lessons learned in building the second bed, and various little things that jump up and take just 5-5 minutes. The trellis project lacked braces, shelf project lacked a air tank+compressor for blowing off the sawdust, the raised beds lacked dirt, and the others lacked time. Now, I had a room to be painted. This project lacked color selection and somebody to paint.

I made my list of togets (like todos) and went to Lowe’s first. Sucky place to get an air tank unless you want want to mount it on a truck. This came from Harbor Freight who also had a very cheap router and bits. I’m looking for that extra little bit of bang on the wood working projects. We used routers in 4-H and it’s a simple and fast way to add pinache. Wish I had found it before putting up the trellis posts, but oh well. Sometime I know I should wait and just don’t want to. Other times, I know something will solve itself and being proactive is just a waste of time (Water Heater replacement).

The raised bed dirt came from Pete’s greenhouse. 30 bags of mulch and 60 bags of Pete dirt run about $320. That’s 1500 lbs of dirt. Delivery is $15. OMG, yes! That’s on Monday. Yay! I have onions waiting, planning on plant selection and placement, and work on adding the probiotics to brink life and balance to the soil. The place selection and placement is another project buzzing in the back of my head. Something about the wrongness of planting all the same plant all together in rows or grids. It would be better if it looked like a real world environment. Diff plants, diff heights, selected based on their strengths and weaknesses. I’ve heard of this with 2 or 3 plants; basil next to tomatoes for example. But not with 12 or so like I’m thinking/feeling. It may take years to work this one out.

At Lowe’s I got several color papers. If it looked interesting I picked it up. When I got home I made myself pick colors first. That was tough, ’cause I really didn’t want to do it. The risk of another bad decision is high and I make myself feel bad for bad decisions (and nothing happens for good decisions; Gotta love that logic). It really helped when I cut up all the colors and reduced them to one per sheet instead of three. Then sorted the colors. There were about 4 or 5 major categories; light brown, dark brown, dark gray/blue, and light blue. And the ceiling color too. I made my choice on all, set them down, and went to work finishing other projects. The closet shelves got another coat of paint, cleaned the pantry shelf wood and gave it one coat on one side, finished the trellis, and planted the hops. Heather, Kayla, and Grandma called to wish happy birthday. And that was my birthday.

Back to work on Thursday. I’m running a little slow, because my mind has been on completely different things. Tim immediately tells me that the solution from Monday. Great news! This has been a problem since January. We promised a patch for that day with the fixes. I’m also thinking how to put this into the next version. There are at least a couple of improvements it could used immediately and I had made a list of more time consuming ones on Monday. Tim asks if I’m not doing anything else, no. So I get dropped into the EE bug bash, which started 15 minutes ago. EE is a completely different program. It has a piece of Interview, but I haven’t thought about EE or wanted to for a month.

Remember, Tim told me they needed a patch today and it looks like the SW build had problems while I was gone. First things first, SW is behind on testing and has to build. Try to logon to the build server, but no connection. Try another couple of things. Read email. Oh, look there’s a virus outbreak going on today. The Chicago-Amarillo link is closed, we can’t test Oracle bugs, I can’t get to the build servers, and our computers are going to spontaneously reboot this morning after applying a patch. IT is working hard to resolve all issue.

Back to the Bug Bash since I can’t do anything else. Thank God they didn’t close all connections. My EE code is over a month old. We have a strategy meeting. My part’s pretty simple. Only Leo and I know Interview and Interview Designer (ID) intimately. Leo assigns me some ID bugs (you don’t need a full working EE). The day rolls on and I fix all the bugs and break the build once. I contributed a lot more than I thought I could. IT sent and email at 10:30 saying the virus problems would be cleared by mid-day. My computer patches and reboots. More bugs in ID get fixed. Some people really have problems getting anything done without and Oracle connection.

At 10 till 4:00 try the build server. Connecting…Connecting…Conn Connection Made. Yay! The build server is jammed from 4/1. Clear up a couple of things and keep it stopped. Start making the patch. Need code from my computer on build server. Need any updates to PE, including pdbs. PE build server is down. It was infected by the virus. Thank God the SW build server was not. Copy old patch, review SW build and SOS, test SW build. It’s 6:00 the bug bash is over. I contributed 12 points and lost 10 for killing the build. Sucks because it was a stupid thing, only Leo should have been affected, and I had it fixed in 6-8 minutes. But it made everyone think the build was always broke. Yay, bug bash people(on the conference phone). Back to patch.

At 7:00 we go next door for dinner. Rob is treating. He is my boss’s boss and the one who hired me. Dinner till 8:00 with 5 of us. Rob builds PE. It’s still sensitive after its SOS crashed a few weeks ago (the reason testing for SW is behind schedule). Patch ready, waiting on PE files and final build. The patch was waiting since about 5:00. From 5:00-6:00 I was fixing a defect the bug tracker and decided to an a minor enhancement. Really a deficieny that bugged me since I started. Fixed and tested. Link to PE files come in. Up to build server. Building… Copy only relevant files to patch. Check patch, fix patch, check again, fix again, check again. Patch is ready. Send email on patch. Send email on minor enhancement. 9:00 I’m going home. That was Thursday.

Friday, I read the email that says we get off at 1:00. Thank God, several home projects got nothing at all done Thursday. I need a coat of paint on several projects. Still haven’t figured out what to do about the master bedroom painting project. I’m sleeping on the floor on an air mattress. TiVo, cable box, and TV are hooked up. It’s somewhat annoying, because I get the feeling that my angels or spirits are standing or towering over me beside the air mattress. This makes me annoyed at them. It’s not really their fault. Then I start thinking why they can’t be shorter. Where they come from is closer or is absolute and not relative. Size is for physical. Ether sees no such constraint/property.

Uh, anyway it’s Friday and we get off at 1:00 and I’m running behind. Start working on next version of SW. Some defects came in while I was gone and the bitmaps for Installshield are done. It’s too bad, last Friday I had SW down to one defect, which was going to take all of Friday to fix. After work, go home and eat then to Lowe’s for paint. I decided the colors from Wed. look good and if I make a mistake in selection it’s not the worst thing in the world. Tracy said paint a room takes a week. That’s not intolerable. Grandma and mom made me nervous and concious of their time constraint. W/o that I could take as much time as I wanted and just do it. Also, the trellis project was finished, the pantry wood is getting painted, and the air mattress is cold. While at Lowe’s I run into Marlena who is also painting her house. There are 4 colors in all; trim , chair rail, and doors, above chair rail, below chair rail, and ceiling. The ceiling is Anthem White. A light brown on the upper walls, darker brown on the lower walls, and a very light brown on the trim. Actually, the trim test looks white.

I start at 3:00 and go until 9:30. The walls got 2 coats of color 1, 2 coats on the ceiling, color 2 on the pink panel Grandma painted, and a strip on the moulding to test. It’s funny the wet paint reminds me of melted ice cream. The pink in the closet, light cream color and dark brown cream color make me think of a neapolitan. All the colors seem to go well together. Maybe the pink is a shade or two too pink. I really like it; not too male or too female, neutral, soft, clean looking. Soooo much better than the yellow mustard. Even the ceiling had been yellow. And the very dated blue from the closests is gone.

Today, I got up and saw the phone rang several times. Oops, left it in the kitchen. Call Grandma back and Mom answers. Christopher and Staci had their baby this morning at 1:20 AM. So, I went to NWTH and visited with them for a few hours. Came home and wasted some more time then painted again and did a few little projects in the garage. For example, the sheetrock was starting to come off the ceiling.

Tomorrow morning I head to Canadian and Easter. It snowed a little today. And occured to me that white is the only color they don’t make plastic eggs in. So, they will be highly visible. :) Jessica left today. Patience and Adam arrived today. Mom’s already there. I look forward to it. Should be fun.

Definition: Spiral Defect Development

Friday, March 30th, 2007

The practice of fixing a version A defect in version B then going back to version A and making a better fix. Version C contains the best features of both fixes.

Favicons in IE7

Wednesday, March 7th, 2007

This is an explanation of Favicons in IE7

VS03 Error: The following two files are marked as incompatible

Friday, March 2nd, 2007

I have VS03 and VS05 and .Net 1.1 and .Net 2.0 with associated projects on the same machine. VS03 isn’t used too much and recently a VS03 project coughed up this bug.


The following two files are marked as incompatible:
C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\vspackages\cslangsvc.dll
(Version 7.10.3077 [2])

C:\Windows\Microsoft.NET\Framework\v2.0.50215\cscomp.dll
(Version 8.0.50215.44(beta2.050215-4400)[4b000050])



Then compiler cannot be used in this configuration. This is usually caused by installing different flavors of VS and NDP, and not specifying the VS version for the /CompilerSourcePath and /NonNdpSourcePath options when running NdpSetup.

http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=93272&SiteID=1

The solution is to reinstall/repair VS03. Below is the link to the Service Pack, which is a little harder to find now that VS05 is out.

Microsoft® Visual Studio® .NET™ 2003 Service Pack 1

Code Monkey by Jonathan Coulton

Thursday, February 22nd, 2007

Again listening to Net@Nite I found this very funny song. The lyrics are here. The song is here. This the video for the song. I understand there are mashups and lots other versions besides the original.

I donated 3 bucks. It was worth it. The song is a free mp3.