Archive for May, 2008

T-SQL: Hex String to Hex Value func

Posted by at 19th May, 2008

SQL Server 2005 includes an undocumented function, sys.fn_varbintohexstr, that converts a hex value to a string representation of that hex value (0x3a becomes ’0x3a’), but there is no function to go back from a hex string to a hex value. Below is something that does the trick quite nicely

CREATE FUNCTION dbo.HexStrToVarBin(@hexstr varchar(8000))
RETURNS varbinary(8000)
AS
BEGIN 
    DECLARE @hex char(2), @i int, @count int, @b varbinary(8000
    SET @count = LEN(@hexstr
    SET @b = CAST( as varbinary(1)) 
    IF SUBSTRING(@hexstr, 1, 2) = ’0x’ 
        SET @i =
    ELSE 
        SET @i =
    WHILE (@i <= @count
     BEGIN 
        SET @hex = SUBSTRING(@hexstr, @i, 2
        SET @b = @b + 
                CAST(CASE WHEN SUBSTRING(@hex, 1, 1) LIKE ‘[0-9]‘ 
                    THEN CAST(SUBSTRING(@hex, 1, 1) as int) 
                    ELSE CAST(ASCII(UPPER(SUBSTRING(@hex, 1, 1)))-55 as int
                END * 16
                CASE WHEN SUBSTRING(@hex, 2, 1) LIKE ‘[0-9]‘ 
                    THEN CAST(SUBSTRING(@hex, 2, 1) as int) 
                    ELSE CAST(ASCII(UPPER(SUBSTRING(@hex, 2, 1)))-55 as int) 
                END as binary(1)) 
        SET @i = @i +
     END 
    RETURN @b
END
GO

Category : Uncategorized (0) Comment

Responding to Will Manly’s “Dear Barack” Article

Posted by at 18th May, 2008

Link to original Article

I’d had your piece sent to me by relatives there in KS as part of a general blast sending it to all their friends. It struck me how very different sides of the fence there really is, and I wonder if there’s any way around it. I grew up in Smalltown, KS (Emporia to be specific), and now have lived in San Francisco since I came out here for college. 

 

When I first heard Obama’s comments, I thought ouch, he’s going to get smacked around for that – but that also the words were rather true. Emporia recently had some Somali’s imported into town by a local company as a new labor force, and the racism, fear, and loathing (not that they took any already existing jobs) was just profound. From my days in KS, IA, and MS, I always remembered with fondness the open doors, the friendly, the everyone knew your name, and it’s what I was always so wistful about being able to return one day and settle back down. But the short-sighted fear and venom of anything different than themselves was just stunning. There were actual posts about the diseases carried by these people, how they’ll rape your daughters. Effectively the very same kinds of things said about Mexicans, or about the Irish when their last migration came in during the turn of the last century, and so it goes.

 

If it’s true that small-town folks don’t like government trying to solve problems for them – so if I’m reading it right (and from the general tenor of things), small towns don’t like federal social programs (giving money to people who don’t help themselves) and whatever else happens to be the democratic cry of the day. But how is that fundamentally different to the opposition that Democrats have of Republicans trying to solve their perceived lack of morality. Perhaps the dividing line is republicans are concerned with  imposing right-wing Christian morals, and democrats with imposing “responsibility” for whomever or whatever crosses their path.

 

Is there such a difference in intrusive government between one side forcing me to believe abortion is a sin, and the other side that welfare is a necessary element? I think that after reading your post, there’s no common frame of reference for both sides. It’s so alien to each other’s experience – for big towns, immigrants are inherently useful to doing jobs that Americans don’t take anyway (due to the cost of living, it’s simply preposterous for anyone college age or above to take those 7-11 or mcdonalds jobs). But in a small town where the economy base is very different, then they may well be taking someone’s job. Ok, I can go with that but consider how the perspective flips at a certain point. Republicans don’t like immigrant policy by and large. But they do tend to support corporations, so it’s the Repub’s that have always supported and pushed through the H1-B visa quota – which allow professional work-visas (mostly from India). Those threaten the large city professional’s job, but those legal immigrants are supported by Republicans but Decried by Democrats.

 

If I were to ever get laid off, unemployment can’t do anything for me (are you aware that it only gives a % of a salary, but only to a certain point, after which it cap’s off – effectively if you make 75k a year or 200k, your amount you would receive would be the same, doing zero good). So economy is more important in a large economy base in the sense that a worker making 40k has a short term safety net of unemployment. Someone making 120k does not. The same amount that helps the one person at least make rent and get groceries can’t help the other person nearly at all.

 

I can respect the difference views. I was small town once, and had harbored the illusion of still being a small town boy at heart. But I’m not scared of illegal immigrants nearly as much as I am of people who kneejerk (on either side of the spectrum). Or who simply spout out the same fear-mongering that was thrown about 200 years ago when the Germans were first arriving in droves, and been pretty consistent since then.

 

I used to be a proud war-hawk. But with the Iraq debacle, we lost all moral high ground we had achieved since WWII and up to and including Afghanistan. But starting with his unilateral dismissal of SALT II, through an invasion on known-bogus pretences, the role which used to be the Republicans badge of honor (that America was the world’s role model), has all but evaporated in under 8 years. Even Regan would have been disgusted.

 

Anyway, thanks for the chance to vent/write. I did appreciate your article in that you were eloquent in responding without just ranting that he’s a jerk. And that you showed that there’s such a divide in perspective that it’s sad that no matter what happens on November 4th, on the 5th, 50% of the country will feel deeply/profoundly wounded.

 

Perhaps there is no way for the sides to come together. It’s hard enough to see the other side, let alone to be able to merge them together.

Category : Uncategorized (0) Comment

Why is Senator Erwin Silent?

Posted by at 15th May, 2008

Back in 2005, Senator Hank Erwin of Alabama had proposed (among others), that hurricane Katrina was God inflicting punishment on the sinners which lived in New Orleans. Similar comments were made during other disasters which struck major cities (since presumably the most sin occurs in such places, like Ft. Lauderdale).

But now with the more recent tornado tragedies, why aren’t they talking about the evident God-Summoned sin-clensing that must have been sent to the heathen states of OK and NC? Perhaps there was something awful going wrong there as well. Or perhaps it was God going after fundameltalist evangelicals who have been spending too much time bible thumping and criticising than doing the perported prime Christian directive of caring for their fellow man.

No, this isn’t a slam on the grief and sadness over the destruction that’s plagued those regions over the past few weeks. It’s indeed a horrible event that people should stand together and help them stabilize and rebuild.

What would be more horrid that using it as a time to comment that “they must have deserved god’s wrath”. So why do it when a major city is hurting? Next time around, they should save their bible waving chest thumping fire and brimstone crap and be Christian and send aid, volunteers, and workers - the way that they are now into the damaged regions.

I just can’t stand it when one group is deemed more worthy to help than others. But that’s another rant.

Category : Uncategorized (0) Comment

From the Professional to Semi-Professional to the Personal

Posted by at 15th May, 2008

Time rolls on, work is slowly getting somewhat less crazy as time for Valhalla approaches. I always become a combination of depressed, manic, and generally a stress puppy when faire time comes around. I’m trying desperately to get into high gear for the faire, but I feel rather like I’m a manual transmission car and I’m grinding the gears (or the clutch is just continually popping out of place).

I have a number of things to do in the next day or so to get most of the current things tied up, but I suppose I’ll get to them all. Oh crap, just remembered I need to send the next amount for the venue rental fees off tomorrow. Meh.

The GTA stuff is calming down, so that’s a plus on the work side. Not that everythings been solved, but the optimizations are getting fewer and fewer. I need to pull open the MiniMe Processors again tomorrow to see if I can do the dbPreLoad in a side thread to sideline that while processing is happening. Bleh, I’m rambling, don’t mind me, drive on. Next it looks like some more stuff using my Teams/Clans SDKs so that’ll be cool, as long as people stop wanting me to do custom implementations each time. What’s the point of making a shared system when everyone want’s their own custom version. Meh.

For the personal, I’m just tired. Apologies to all the delayed emails and notes people have been sending me over the last month or so, I wish I could say that it’s been my typical flakiness, but I am actually alive, just been buried under work, and then just so far out of my regular sleep patterns and mojo that I’m just kind of in a basic malase that I’ve got what, about two weeks to shake off?

Hm, what else – had a meeting with a new venue that looks like we’ll have an ideal location for a new 2009 event to take the place of Pittsburg Faire in the immediate region, though the dates will most likely be an end of September kind of date. Details on that to follow as time progresses. It was actually on the way back to the office from that meeting that some of this really rather hit me. At this point I can pitch RenProd to almost anyone, anywhere. We know well what we’re doing, come across as more than competent, experienced with planning and production, and all that hooey. But to what end? At this point anything we set out to prove, we’ve done that. Now it’s just tiring. Exhausing even, and for what? If we don’t start getting into some serious black this year (more than we have), then this is just a bit too much to keep on doing without getting something back out of it.

So yea, after the first two decades, it does start to wear on you. Time for bed I think, I’ll be clearer in the morning.

Category : Uncategorized (0) Comment

Work rolls ever on…

Posted by at 11th May, 2008

Well at least it’s getting closer to being back to normal. Since midnight of Sunday after Visalia Faire (back on the 27th of April), we’ve been nearly at it 24 hours. For the first week it literally was 24 hours a day with 18-20 hours on, and a few hours for some quick sleep on a broken rotation.

It was fun, really. Both being able to work on a really big title, and also to work with a team that is both cool, and also one that never once got bitchy or angry no matter how exhausted we all were, but rather we just got more slap-happy.

Work can suck an awful lot with all of the internal politics and ineptitudes with communication between departments, and differing (and often competing) marching orders. But what makes sticking with it really worth it for me is that I love the team that I get to work with. It was commented on as being a rock star team (no pun intended regarding Grand Theft Auto), but really is a group that has it’s strengths in each person, everyone steps up, and it just gets done.

But for now, things look like they’re improving with GTA. Now the db’s are running at 100% cpu, so there’s that to deal with, but at least we’re ahead of the curve there at long last. Though I’m still poked fun at for the names of my processor apps and some of the odd little messages and errors that they spout out at various times (e.g. when you telnet into one of them, it will randomly protest being bothered because it really should be doing something more productive than answering the users questions).

A great team makes the rough times so infinitely more bearable, even when the suckage is great.

Category : Uncategorized (0) Comment

Recent Comments
  • simplyredheads: All you lovely redheads may like to check out www.simplyredh...
  • admin: Woot - I got a response. I didn't think that there wasn't pe...
  • cyclone: You said: "There’s nothing wrong with living in a small to...
  • MrsH: You're so right, Bill! Thomas Jefferson would roll over in ...
  • Escarlata@FaireNews.com: Thanks for sharing how Golden Gate went, Bill. It sounds lik...
Flickr