Quarantine - Code-id 19

For two months now, we've been social distancing. Luckily I have a job where I can work from home. This saves me an hour at least per day in commute time. Except, now I have to home school too, but that's fun. It just takes time.

In order to be more efficient, I try to automate everything. Everything I write that is not directly doing work for a work project, is doing something to make me more efficient and also limit the amount of grunt work I would have to do.

Recent Problems

Dev content is out of sync! 

Solution:  Write a dbsync tool. Luckily the db we deal with mostly has no identity insert auto incremented integer id fields. This makes it easier. The thing that makes it harder is that the dbs for which I wrote this tool have millions of rows, are frequently updated, and have blobs that are multiple megabytes in size. This one I haven't made public.  But it will take a config of two connection strings, one is the source, one is the destination, then it will also have table definitions along with a timestamp field to be able to tell which rows have been updated since the last time the tool ran. When it reads all of the rows from the source table, it will update the time stamp so it gets much less data the next time. I just run these occasionally for all of the different databases that I have to manage. Having up to date content for development is a headache reducer.

Configuration is complex!!

Sitecore uses about a hundred configuration files. We have to keep track of different settings across multiple environments, like development content management and a separate content delivery, then the same thing for UAT, and the a more complex configuration set for production, with a CM and two CD servers typically. I solved this during a build by having a build process take all of the base Sitecore configs, then copy over application specific configuration, then finally copy over environment specific configuration. Then a separate process deletes files where there's also a .deleted file along site of it, like something.config and something.config.deleted.  Then a separate processes merging updates to Web.config in the root. This is pretty useful.

The main problem with this is that if we inherit a site, or want to convert an older site that didn't use this configuration process. So I made a config split tool! So you have a folder with all of the Sitecore configuration files, then each environment's configuration files in other folders, and run cfgsplit with the proper parameters. It will remove all the files that are the same across all of the folders. Then you run another pass at it with slightly different parameters, and it will move all configs that are the same from the environment configuration files into a separate application specific configuration folder, where all of those configuration files are the same. After that you're pretty much done.

The other aspect of this is the Web.config. There's a similar process with this except it works on XML, not folder structures. The idea is the same though. However, some XML nodes are extremely tricky to figure out a unique identifier for. Like, <x><y><a id="unique" /> <b x="y" /></y></x>   where the b node is the same across many different instances of y, and where y never has any attributes but there are multiple in succession. You might think using indexes might be a good idea. But, we're comparing whether these nodes exist in the other file, and having them be identified by index would not match the other files, so I had to match by content.

For a node like x or y, I would grab a hash of the children's contents. This was a good unique identifier. For a node like b, I had to grab a hash of the siblings. If there are two identical y nodes under this specific x, my code will fail. But you can argue when that would be useful, having two identical nodes as siblings in XML. I won't share this code either. It is nearly complete.

A File is too big to copy over RDP!

This one was a fun one and only took me an hour. I was heavily inspired from my memories of downloading "warez" in college, where you'd get a RAR file as a bunch of files, instead of one large one. This code I can share, it is here. I simply call it parts. It just does that, takes a file and splits it into chunks whose size is passed in via a parameter. There's no check on that size, now that I think about it, but I can check to see how many chunks would result and maybe throw an error if that's over an arbitrary limit, like 100 or something. But if you want to create 2 billion files, go ahead.

Happy coding!

Which base?!

- "0" in binary?  or decimal?  or is that 0 in hex?

Work always provides opportunity for memorable conversations.

Because of this code -  

if( ImplementationID == "0" )
parameters[0] = BuildParameter("@ImplementationID", DbType.Int32, 4, 0, ParameterDirection.Input);
parameters[0] = BuildParameter("@ImplementationID", DbType.Int32, 4, Convert.ToInt32(ImplementationID), ParameterDirection.Input);

if implementationID == "0"  -> pass hard coded 0
else pass Convert.ToInt(implementationID)

"0" doesn't parse correctly


me -- shut up

bb -- did you just tell yourself to shut up?

me -- i was preemptively telling you to shut up about asking if i told myself to shut up

Work Frustrations and Booze

they have to enumerate changes that i have to make to the html
they can't just commit the whole thing, and be like, we updated html, please comply
because i don't know that i'll get everything
it's very manual, like that bar game where you compare dirty pictures to see what is the difference
and i am only good at that game after 4-6 beers
do they want me to drink?!
i can...

A Chat with a Coworker

Hilarious-to-me stuff bolded 

Mark Coworker: well, do they at least map to properties that have well written property names?
Me:: their property names are their querystring keys
Me:: QS.rdb = 1
Me:: javascript man, it's awesome :)
Mark Coworker: yeah... that's what i avoid with those strongly typed querystring objects of mine.
Mark Coworker: too many query string keys that don't make any sense.
Me:: strongly typed is weakly handwritten
Me:: :P
Me:: just tried to come up with something that you couldn't possibly have a comeback for, and which was cleverly punned
Mark Coworker: i don't understand how i'm the only person here who seems to have an issue with the hard-coding of non-sensical query string keys all over the place.
Me:: personally i depend on url rewriting so that the client doesn't see the querystring names... if the technology allows it easily
Me:: so i don't use querystring in my node.js web apps
Me:: i have a very nice helper method that will look for a unique key in the database... so if you passed it the text, "I dislike Mark Coworker's Strongly Typed Querystrings", with the table and the field (mongodb doesn't know of such things by those names), it will take the whole string, lowercase it, remove non-characters, replace spaces with hyphens, then look to see if that's unique. if not, it will have add an incremented value to the end and find

Mark Coworker: =P
Mark Coworker: sorry. ddin't see IM alert until the last message.
Mark Coworker: trying to get CLIENT_REPLACED build ready.
as the unique key to use in the URL for rewriting

Me:: heh
Mark Coworker: linky-no-worky
Me:: post 1253 was about wearing sweatshirts on 80 degree days  (EDITOR: side note, the day this chat took place, it was 80 degrees, early October, as we left for lunch and he had his sweatshirt on)
Me:: i mispelled your name in the url anyway
Mark Coworker: you did!
Mark Coworker: even after fixing it, the url still doesn't work.
Me:: yeah, it's down for maintenance, need more database space
Me:: too many posts
Mark Coworker: well, it's not his fault that there are some many things wrong with the world. such as the lack of database space on servers.
Mark Coworker: I'm through half my bottle of Purell
Me:: damn
Mark Coworker: it's a small traveller sized one though.
Me:: i've used half a bottle in my lifetime
Me:: post 1255, germophobe
Mark Coworker: post 1255: half of your office getting sick right before you're hosting a EVENT that took up TIME_SPAN of your life and DOLLAR_AMOUNT dollars to get ready for.
Me:: post 1256: wants editorial authority on site which talks badly about him

Note:  Things like TIME_SPAN and DOLLAR_AMOUNT were editorialized from the original chat so that stuff like that doesn't get public...

I write Node.js in work too.

Read my blog post on Node.js as a tool to get work done...

Task Notification with Google Talk via XMPP

I wrote a post for work about using XMPP to send task notifications through Google Talk.

Today I got Vista

I was at the "Heroes Happen Here" launch event for Visual Studio 2008 and a bunch of other software that still lags behind open source offerings. I knew we were getting free software (Visual Studio 2008, SQL Server 2008, Windows 2008) but I didn't know we were getting Vista. It was a pleasant surprise because now when games start coming out that only work on Vista, I'm ready and don't have to spend $400. And that's all I have to say about that. Thanks Microsoft!

It was generally a good time. Four of us from work. We got there and registered with 40 minutes left to go until the first event, so we headed out to the Reading Terminal Market for lunch. It's across the street from where the event was hosted, at 12th and Market (Marriot). Mark lost his sunglasses so went back to get them while we went to the market. We ended up going to Famous Frank's near the Beer Garden, and then ate at the Beer Garden. You have to buy beer in order to eat there, which we did. Mark doesn't drink, so I said if he gets accosted about having to buy beer, I suggested he just buy one, put it in front of him, and I'll drink it. He didn't, but a couple got thrown out before he got there because they weren't boozin.

We left and went to the first show, which we were late for. It was my friend and former coworker, Danilo Diaz, giving the first developer track talk. After that, we got our free software, checked in with the second talk, and left after 10 minutes because it was general crap.

During the first talk, it was stuff that all of us have done already. The only interesting feature about 2008 and .NET 3.5 is Lambda expressions (which I'm not even really impressed with), and they weren't even covered. Way to go Dan :P We were talking through a lot of it. When he showed the Javascript debugger in Visual Studio 2008, everyone cheered, and I said, kinda loud, "Firebug!!". Some dudes behind me laughed. I was texting a coworker stuck back at the office, checking if I could get internet on my iPod, and just generally being a jackass. I was there for the free shit. We learned nothing new. Everything that was covered, one of the four of us have already done, and it's just like "Oh, yeah, look at this code in source safe, and here's some other hints about it." I don't know one person who (besides my Java friends :P) hasn't done ASP.NET AJAX and used UpdatePanels. It certainly didn't need all that time to go over it.

Oh well, Danilo works at Microsoft now, and I've never been impressed with their code examples or presentations, so I guess that just comes with the territory. Do they say "Keep it short and don't cover interesting stuff" ? I don't know, there might have been people there that haven't seen that stuff. Who knows. Maybe I'm just at a very technologically advanced company. That could very well be it, but I can't understand, then, why I've been doing PHP for the past two months :)

Other than that it was a good time. It helps when you're like best friends with the people you work with.

Thanks for Vista, suckers.

I like that old time rock & roll

I just bought two "compilation" albums that should keep me occupied for a couple of days.

Eddie Cochran
Buddy Holly

Greatest hits or whatever. I get the morning shift in work, of music. We throw on tunes and rock. Friday I put on the Beastie Boys "License to Ill", and previous installments included Red Hot Chili Peppers, Guns n' Roses, Blind Melon, and I forget what else. It's a good time. Time to mix it up with some 50s rock.

An even bigger week

So, some big weeks lately... This week:

Monday: Paid off my car on Friday and got the title on today!

Tuesday: Received second iPod Touch that I didn't order, and assumed I'm on some sort of iPod touch weekly subscription, for only $400 a week! I sent it back. (It was Amazon's fault, not Apple's :P )

The rest of the week... I will finally be buying my house! My parents sold their house and move on Halloween. They are hiring movers.

My keyboard's kinda screwed up because soda was spilled on it (not me!!). The keys were really sticky, so I pulled a bunch of them off and wiped behind them with a wet paper towel, but my "I" key will never be the same (although it works fine, it just sticks up a little more than the others), and my "0" (zero) key (and hence, my "close parentheses" key) makes some weird noise when pressed.

This month and next are big months for gamers:

Crysis Collector's Edition DVD-ROM with Bonus! PC Pre-Release
Ships 11/13/07 $59.99
Kane & Lynch: Dead Men with Bonus! PC Pre-Release
Ships 11/20/07 $49.99
Sim City Societies with Bonus! PC Pre-Release
Ships 11/13/07 $49.99
Super Mario Galaxy Wii Pre-Release
Ships 11/12/07 $49.99
Uncharted: Drake's Fortune PS3 Pre-Release
Ships 11/20/07 $59.99
Zack & Wiki: Quest for Barbaros' Treasure Wii Pre-Release
Ships 10/23/07 $39.99

That's my shopping cart at EB games.

This Friday will be the first time all of us from work head out to the bar since we hired a bunch of new people, including me! We're gonna get wasted.

I'm 3-3 in Fantasy Football this year, winning the last game by 2 points! Tony Gonzalez had a huge game, and Muhsin Muhammad has finally started scoring for me. My team stinks, though. It will be miraculous if I finish over .500. I only had 76 points, and really only got points from those two and the Eagles D. No one else contributes. This week I play my brother Scott. He'll be at the Eagles game so I'll have to call him and tell him I'm whooping his ass.

I joined Netflix finally. It's gonna be a great way to finally watch all those movies I haven't seen yet.

I'm also trying to quit smoking. It's rough, and I know drinking will make it really hard, but the trick would be to go back to quitting after a long night of drinking with a few smokes here or there. Drinking in Philly is a lot easier than in the suburbs.

This post has a little of everything.