Showing posts with label Development. Show all posts
Showing posts with label Development. Show all posts

T-SQL Hex String to VarBinary (Improved)

Peter DeBetta posted a while back with a function to take a hex string and convert it to varbinary  It has a couple of slight issues, the biggest of which is it can't handle an odd number of hex digits.  Below is my replacement, because it's using bigints the upper limit isn't as high, but it's good enough for most things:

 

CREATE FUNCTION dbo.HexStrToVarBinary(@hexstr varchar(8000))
RETURNS varbinary(8000)
AS
BEGIN

DECLARE @hex char(1), @i int, @place bigint, @a bigint
SET @i = LEN(@hexstr)

set @place = convert(bigint,1)
SET @a = convert(bigint, 0)

WHILE (@i > 0 AND (substring(@hexstr, @i, 1) like '[0-9A-Fa-f]'))
BEGIN
SET @hex = SUBSTRING(@hexstr, @i, 1)
SET @a = @a +
convert(bigint, CASE WHEN @hex LIKE '[0-9]'
THEN CAST(@hex as int)
ELSE CAST(ASCII(UPPER(@hex))-55 as int) end * @place)
set @place = @place * convert(bigint,16)
SET @i = @i - 1

END

RETURN convert(varbinary(8000),@a)
END
GO

Fun with Twitter.

Dan Hounshell announced his new little side project RandomTweets.  Basically it's similar to bash.org or qdb.us but for Twitter.  Right now Dan is using the API to pull random tweets and then manually sorting through them for humor or inspirational value.  He states his intention is to make the site more community driven in the future, but he's got some pretty funny stuff up there already. You should check it out!

The Microsoft .NET Framework Source Available for Developers!

Scott Guthrie just made an exciting post, starting with .NET 3.5 and VS 2008 the .NET libraries will have source available!  This is quite the boon to developers, the ability to drill down to source level while debugging should lead to more accurate code.  Of course there could be a downside, namely developers coding around implementation details rather then the exposed methods.  But regardless this is a very cool move by Microsoft.  It's being released under the Microsoft Reference License which doesn't give you a whole lot of rights (none really, other then to look at the source), but it's something.  Considering how important the framework is to Microsoft this is a bold move.  For a truly permissive license check out Mono, here's hoping there's no "patent/copyright" pollution there either...

MichaelDotNet's Leaderboard

If you haven't heard, Techmeme has a new feature, the "Leaderboard".  TechCrunch is heralding it as the defeating the last stronghold of TechnoratiRobert Scoble is lamenting the "death of blogging".  Techmeme itself says the list consists of "Techmeme's top 100 sources, including blogs, non-blogs, and everything in between", so they're not trying to be the sort of "Blog Authority" everyone else seems to be trying to make them. 

I don't think Technorati nor blogging in general have anything to worry about.  Technorati is suppose to be aimed squarley at blogs, in this case I'm defining a blog as "The single and unfiltered voice of an individual".   Techmeme's Leaderboard is solely a list of the most newsworthy sites in a particular month, some of which just happen to be blogs. 

The best authority for the top bloggers is, of course, the bloggers themselves.  Until Google starts to release an aggregated form of their users's Reader Stats (which may indeed herald the end of Technorati), we'll have to turn to each other and Technorati will show us that.

In the interest of promoting tech blogs that deserve to be noticed, I provide you with my current personal "Tech Blog Leaderboard" based on my personal Reader trends:

 

  • MSDN Blogs:  Surprised?  You shouldn't be, Microsoft employs alot of smart people, this is the best way to find out something you didn't know before.  And it's not necessarily Microsoft specific all the time.
  • Worse Then Failure:   Geeky humor, and great examples of what NOT to do for coders.
  • Slashdot:  Still a good resource after all these years, not a blog, yet still not on Techmeme's Leaderboard either...
  • CodingHorror:  Everyone in development should be subscribed to this blog.
  • Scobleizer: Cause Robert Scoble always has neat stuff.
  • Robert's Shared Items:  Doing all the crawling/subscribing so I don't have to.
  • Jon Skeet's Coding Blog:  Man knows his C#.
  • Evil Mad Scientist Laboratories: Cause deep inside we're all evil geniuses.
  • Scott Hanselman's Computer Zen:   I mean, doesn't the fact he's not on the Leaderboard make you question it just a bit?

That's just a sampling, alot of webcomics and non-tech blogs in my reader too. 

What are some of your favourite/regular tech blogs? Is there anyone that I'm obviously missing that I just HAVE to subscribe to?

Query Analyzer, Resurrected.

Carpe Datum over at MSDN talks about people wanting Query Analyzer back over Management Studio.  I admit, the lack of Query Analyzer has been a source of ire for me as well.  I like the default Management Studio for editing databases and what not, but if I want to whip up a quick query or something I miss query analyzer.  Unfortunately the solution he provides causes Management Studio to always assume you want to run a query.  After a bit of fooling around, I came up with a batch routine that seems to mimic Query Analyzer pretty well.  I present to you isqlw.bat :)

 

@echo off
if '%1'=='' goto nofile
goto file
:nofile
echo. > %TEMP%\Untitled.sql
start sqlwb -nosplash %TEMP%\Untitled.sql
goto end
:file
start sqlwb -nosplash %1
:end

 


This works well for me, YMMV of course, but I hope you might find it useful.

Are You Just In It For The Money?

Peter Van Ooijen made a post today that ended up being Kicked and generated some discussion.  Basically he's saying that a Software Architect should code.  I agree.  A Software Architect should be someone who is passionate about technology and development.  Some people say they were never given time to code.  I say that's bullshit.  Are you a developer for the pay, or because it's something you love

If you are not passionate about what we do, get out.  Seriously.  I don't want you in my industry, make room for those developers who ARE passionate about what they do.  Make room for those developers who spend at least some of their free time putting around with languages they don't know, technology that's just coming out.  If all you want is a paycheck there are plenty of other places you can go.

I want the kid who hacks on vBulletin in his spare time for his World of Warcraft guild.  I want the father who waits until his kids go to sleep and then spends a few hours hacking in XNA.  Where are those people? 

Why does the guy who simply got in this business because it was "hot" get promoted, while the people who Live To Code are left at the bottom rungs?    Part of it is choice I'm sure, I've done the managerial bit, it's less "fun" for sure.  But those in the trenches are frequently ignored, while those who read "Buzzword Weekly" make all the important decisions.

Fortunately, it seems Peter has a good architect who at least knows what he doesn't know, and that's a good start.

Microsofties Aren't Robots? Perish The Thought...

Glenn Bock over at Microsoft recently blogged that he was not a robot because he uses the following non-Microsoft technologies: A Mac Mini (which really doesn't count, Microsoft doesn't make computers and as far as I am aware they still write software for the Mac),  an iPod, Yahoo, Google, NUnit (MS tech related), Firefox, OpenSource, Resharper (MS tech related), Ruby on Rails, and Linux.  That's all well and good, but would he still follow the Programming Promises? I bet he at least tries, though I'd also guess he's a tad biased. :)  Regardless he's also right in he wouldn't be doing a good job if he wasn't examining and using alternatives, especially when they were better then the items he could dogfood.  It's a reminder that we all need to continually be exploring and expanding our exposure to technology from all fronts.

ArcReady, CodeToLive, and Sidewalks 2.0

Attended the Microsoft ArcReady event yesterday. Got a chance to see Brian H. Prince and Josh Holmes again. I always look forward to try to absorb what I can from these two, very very bright guys.

Josh made a point to show me his new 2007 Road King, hinting that it was somehow relevant to his job. It seems that Josh is doing what looks like is going to be an awesome show, called CodeToLive. He is taking the bike across America with Steve Loethen and interviewing developers. Based on the trailer (which he showed during the presentation) and the first episode, it looks like this is going to be a blast to follow. CodeToLive is definitely a mantra I live by, developing isn't what I do, it is who I am. I'm hoping to see many more episodes from those two.

Due to an administrative error (specifically an admin confusing Kansas City and Cleveland), there was a surprisingly small turnout. That did not prevent a few spirited exchanges though, it was interesting to hear how some could not fathom how Twitter and Twittervision applied to the concept of Platforms being better products then Applications. One of the real benefits of these events is getting a chance to interact with fellow professionals in different areas with different background. Getting those unique perspectives and having a chance to articulate your own positions really helps put things into focus. So regardless of the turn out it was a worth while and lively crowd in my opinion.

Josh's presentation was enjoyable as always, interspersed with personal stories and anecdotes that help illustrate situations we may find in our day to day jobs. The first story he relayed was his treacherous experiencing trusting a single data provider, namely NavTeq. The second related to utilizing your users to drive design. His alum Franciscan University of Stubenville, had installed some new sidewalks and were dismayed to see none of the students using them. They had elected, rather, to cut through the grass along a shorter and more direct route. When the university expanded and added new buildings, the initially did not put any sidewalks in. Instead the planted grass. They then waited until the students had worn trails in the grass along their preferred routes and paved those. It's really quite a good story about the importance of user-centric and user-driven design.

Brian talked next and demonstrated how some of the concepts are used at QuickSolutions. You'd think it'd be incredibly boring, but Brian's skill as a presenter is such that you really don't notice. He demoed a bit with the BizTalk Labs site, specifically the Connectivity Service and went over some of the procedures QS uses. A joy to listen to as always.

Josh also gave us a brief overview of Tafiti (which I had seen before, but it's always good when the MS guys start doing new demos ;) ). And things wrapped up then with the usual giveaways. A few books, a copy of Expression and Office 2007. Though my chances were good I walked away empty handed, yet not empty headed :) I am definitely looking forward to the next ArcReady!

Don't forget to checkout CodeToLive, and a reminder that CodeMash registration will be opening soon!

Determining the Ordinal of A Weekday.

So, at work I'm having the fun experience of having to write a job scheduling app, using MSSQL as the back end. One of the things I had to figure out was how to determine of a day was, say, the first Monday of the month or the third Thursday or so forth. I couldn't find any built in functions that did this, so I had to write one. Behold:

Create Function fn_ReturnOrdinalDay
(
@TestDate datetime
)
returns int
begin
declare
@ordinal int,
@loopdate datetime

set @loopdate = @TestDate
set @ordinal = 0
while datepart(m, @TestDate) = datepart(m, @loopdate)
begin
set @ordinal = @ordinal + 1
set @testdate = dateadd(d, -7, @testdate)
end

return @ordinal
end

When called like fn_ReturnOrdinalDay(getdate()) will return 1 - 5 depending on how many times that day has occured. For instance for today (Monday June 18th, 2007) it would return 3 since this is the Third Monday of the Month.

An Oldie But Goodie

Back in the day I used CrimsonEditor alot, it was a good, free source code editor. Unfortunately it was a one man job and the developer stopped maintaining the application in late 2004. Enter the EmeraldEditor group! EmeraldEditor intends to be a new CrimsonEditor-like editor (ugh that's an awkward scentence), written to be cross-platform and open source. But the news gets better, CrimsonEditor itself was open sourced by it's author and the EE team has effectively taken over maintenance of it! So grab the code and get cracking! I'm glad to have CrimsonEditor back and look forward to EmeraldEditor.

Flies in the Pipes.

Microsoft has announced the private alpha of PopFly (love the .ms domain BTW!), their Yahoo Pipes! competitor. Looks like there's a bit of social networking involved as well with the ability to vote on user's projects and track their progress. One of the big things going in Microsoft's favor is the Visual Studio integration. See some details here. I asked for an invite so we'll see....

WTH is a GWHHM?

The latest issue of Redmond Developer News has a column by William F. Zachmann (got to have the middle initial), BTW he doesn't appear to have a blog...I'm not quite sure how I feel about that. Somehow blogless commentators feel less "authorative" to me...or something. Anyway, he talks about a phenomenon that he terms GWHHMs or Gwhyms, otherwise known as "Geeks WHo Hate Microsoft". His main point is a good one: "Remain open to alternatives that make sense when they do in fact make sense." However, I think he comes down a bit to harshly on the "alternatives" in my opinion.

He does a good job of condemning some of the zealotry that's out there, but unfortunately he really only talks about half the problem. There is another side. GWOLMs (pronounced Qualms) or Geeks Who Only Like Microsoft. Much like Gwhyms, Gwolms are found in every IT department across the Industry. They will turn a blind eye to any and all solutions that are not stamped with the Redmond Seal of Approval. They can cost your company thousands of dollars in licensing fees for potentially inferior products. They are the ones who dismiss AJAX until Microsoft releases their AJAX Library or dismiss Ruby until Microsoft releases IronRuby and then fawn over how wonderful it all is.

Don't get me wrong, I love Microsoft in a number of ways, I make a living coding in C# using the .NET framework. However I also run Firefox as my main browser and use a GTK based IM Client (Pidgin). I use these not because they are open source or because they are not Microsoft. I use them because they are (in my opinion) the best solutions out there. I recently utilized PDFBox in a solution for the same reasons.

Also, I can not agree with his recommendation to make Microsoft solutions your "default choice", my advice is to look at all possibilities in a problem area and choose the best one that fits in with your style, budget, and resources. One shouldn't have a "default choice" in my opinion.

Personally, that's why I can't wait for the next CodeMash, a conference like that epitomizes how software development should work (incidentally Microsoft was a sponsor of CodeMash, so even they realize the importance of learning from one another).

Day of Dot Net: Ann Arbor, MI.

Ah the first real blog post in a while, and even this is late, hoping to get back in the groove here with this one!

After leaving Cleveland at 6am I ended up arriving at Day Of DotNet a little late. Not too bad for a three hundred mile drive, I ended up walking into Josh Holmes' talk on "Architecting the User Experience" (part of the ArcReady series, this was like a sneak-peek) about 10 minutes late. What I saw was awesome though , definitely some things to think about. Jason Follas, who I met at CodeMash and an organizer for DoDN, was kind enough to grab my name tag for me in exchange for me doing a head count of the session (76 people if you're curious).

After having a few minutes to mull over what I had heard, it was time for the next session. "Hardcore Reflection" by Dustin Campbell. This was by far the most valuable session of the the day, for me. Dustin was a great speaker and really knew his stuff. I learned alot there that I'm looking forward to using in my day to day work.

I then had a chance to attend red-gate Software's vendor session, mostly a bore-fest infomercial. Then Lunch, Domino's pizza (if you could get it), I had a couple pizza's and called the wife.

Off to "Next Generation UI" session by Mark Miller. Poor guy, his speaking skills are awesome, but the technology did not want to cooperate! I heard his second session went well, but I had opted to go to "Multithreading in Windows Forms Applications". Patrick Steele gave a good talk on the basics of multi-threading a form application, I was hoping for something more in depth, but all in all a good refresher.

Then we had the Microsoft Vendor Session, which was also hosted by Josh Holmes, he didn't have anything prepared so I threw out the DLR and IronRuby. Well, he didn't have IronRuby, but we got to see some of the DLR in Silverlight 1.1 with IronPython, cool stuff! Someone asked about Silverlight on Linux (which Mono is working on). Josh said that if it made business sense Microsoft would do it (being that they're a business and all), but he didn't think that the Linux made much business sense right now. He's probably right (though I did rib him a bit about Dell putting Ubuntu on consumer systems now), but sometimes developer and community good will pays more then a strict bean counter could see. Could you imagine if Microsoft announced Linux support for Silverlight? I think it would be a brilliant PR move myself. You keep saying your open and look at these cool standards and we're cross platform, and blah blah blah. Just do it already! :)

Anyway, wrapped up the day with Brian Prince's talk on "Agile Processes", I didn't get a chance to hear Brian speak at CodeMash, and I must say I came away impressed. He's quite an awesome presenter! I hope to incorporate some of his company's ideas into my own practices, and at least I'll be more prepared if I ever get a job at an agile shop.

I was glad I went, I learned alot and had a great amount of fun and will be attending the next one! We need more events like this in the Northeast Ohio area!

WinDevPowerTools Launches

Jim Holmes and James Avery's book "Windows Developer Power Tools" now has a companion website. WinDevPowerTools is a simple, yet interesting website. Once you register you can create your own toolbox letting you share with others those utilities you find useful. You can then browse via the tag cloud and "love" those tools you think worthy.

Right now it appears that only Jim and James can add tools (they're working on getting the ones from their book up). I think a tool submission page would really be useful. Letting users submit tools would add to the overhead of the site of course, and I'm not sure if the authors are willing or able to take the responsibility. Even though currently the only method of getting a tool added is to email James. So maybe it would actually free him up more. However, I think a user based submission method could really add to the usefulness of the site. There's a definite feeling of community trying to be built (after all one of the authors helped organize CodeMash), freeing up the tool submission process would really increase that. Maybe that's coming down the road.

The site opens up the possibility for some interesting statistical profiling. Adding the ability to add some user specific profile information (i.e. industry, location, etc) could lead to some interesting information beyond the current "Most Loved Tools". I'd be interested to see what tools were in how many toolboxes broken down by industry, location, or even age group. Right now you just submit desired nick, email, and desired password. Which may be a big plus to some people, but limits any of the interesting reporting that would be possible. Of course any demographic information should be totally optional.

One of the hallmarks of the developer community is the sharing of information, a site like this could definitely help with disseminating information on tools. I could see sites created for Mac and Linux very easily (maybe with companion books?), with a unified toolbox between the sites. Especially with the number of open source cross platform tools.

WDPT is a site just starting out, but with the possibility of being very useful to the Windows developer community, sort of a FreshMeat for the rest of us with a bit of social networking for spice. Be sure to check it out!

Categories/Tags FeedFlare

I went ahead and bit at one of the101 FeedFlare ideas on the FeedBurner site. I went ahead an wrote #25: Display categories/tags. See how to set up the flare here. Oh and if you don't use FeedBurner, I highly recommend it. Let me know what you all think!

Sysinternals Suite Published

I found out that the Sysinternals Suite has been published by Mark Russinovich via MSDN Blogs, ironically there's no mention on his blog about this release. Anyway, Sysinternals stuff has always been good, but the Suite page doesn't list the contents of the download. It only contains this vague description:

This file contains the individual troubleshooting tools and help files. It does not contain non-troubleshooting tools like the BSOD Screen Saver or NotMyFault.

So in the interest of community involvement, for your reading pleasure, here are the contents of the Suite:

  1. accesschk: return access rights by user or group
  2. accessenum: shows you who has access to what
  3. adrestore: undelete active directory objects
  4. autologon: autologon utility
  5. autoruns: view system startup info in a gui
  6. autorunsc: command line version of the above
  7. bginfo: create backgrounds with system info
  8. cacheset: control the Cache Managers working set size
  9. clockres: find timer resolution
  10. contig: by file defragmenter
  11. ctrl2cap: makes the capslock a control key
  12. dbgview: display DbgPrint calls
  13. diskext: Display volume disk-mappings
  14. diskmnt: diskmonitor for NT
  15. diskmon: monitor disk access
  16. diskview: disk sector utility with GUI
  17. du: disk usage
  18. efsdump: encrypted file information
  19. filemon: monitor file access
  20. handle: show open file handles
  21. hex2dec: convert hex to decimal
  22. junction: Create NTFS symlinks
  23. ldmdump: dump the logical disk managers database
  24. listdlls: show loaded dlls
  25. livekd: realtime kernel debug
  26. loadord: display device load order
  27. logonsessions: lists active logins
  28. movefile: move inuse files on next reboot
  29. newsid: change a computer SID
  30. ntfsinfo: file system info
  31. pagedfrg: defrag page file and registry.
  32. pendmoves: show file moves scheduled for next reboot
  33. physmem: physical memory viewer
  34. pipelist: view current pipes
  35. portmon: Monitor port activity
  36. procexp: Process Explorer, monitor running proccess
  37. ProcFeatures: process information
  38. Procmon: monitor file system, registry, and processes
  39. psexec: execute processes remotely
  40. psfile: show remotely opened files
  41. psgetsid: display SID of computer or user
  42. psinfo: get system info
  43. pslist: process info
  44. pskill: kill processes
  45. psloggedon: whose logged on?
  46. psloglist: dump event logs
  47. pspasswd: change passwords
  48. psservice: control services
  49. psshutdown: shutdown/reboot a computer
  50. pssuspend: suspend a process
  51. regdelnull: deletes nondeletedable registry keys
  52. reghide: creates hidden registry keys
  53. regjump: go straight to a registry key
  54. regmon: monitor registry activity
  55. rootkitrevealer: scan for rootkits
  56. sdelete: DoD compliant secure delete
  57. shareenum: scan file shares for security holes
  58. sigcheck: File version and signature checker
  59. streams: view alternate NTFS streams
  60. strings: strings utility
  61. sync: flush data to disk
  62. tcpvcon: console version of tcpview
  63. tcpview: view open sockets
  64. volumeid: set labels on FAT or NTFS drives
  65. whois: whois service
  66. winobj: object manager viewer
  67. zoomit: zoom and draw on the screen

These are all great utilities, now that you know what's in it, grab the Suite from Microsoft!

CodeMash: Day 0.

Just got back from the expert panel on languages, it was most enjoyable. I think they did a pretty good job. I would say Bruce Eckle and Neal Ford pretty much stole the show, but everyone was very informative and entertaining. One of the interesting things I heard was the rise of Domain Specific Languages, something that's been rattling around in the back of my head for work. The only real complaint so far is the wireless connection, it does to drop alot. For instance I've been fighting to upload pictures to flickr for almost a whole hour. Anyway, I've been taking pictures, here's the flickr link. Feel free to tag 'em up!

Off To CodeMash!

Well I'm just about ready to leave for CodeMash, next time you see me (and some of you will see me) it'll be at the Kalahari. :)

Programming Promises

A few days after reading Ted Neward's post about checking your politics at the door and using the right tool for the job, I read this post from "Reed Me" over at Microsoft. Granted, Reed has a point. There's no one you've paid money to (unless, as he points out in his comment, you paid for support) that will update your Time Zone tables for you in order to accommodate the 2007 changes. However, the tone of his post irked me and I had to reply. I won't go into the details of our back and forth here (you can read our thread at his blog here), but it did make me think of what I think a good programmer should be. So here are my Programming Promises:

  • I promise to get the job done.
  • I promise to use whatever tools I need to, regardless of politics.
  • I promise to listen to the Closed Source and Open Source zealots equally, and then dismiss them.
  • I promise to support, as long as I am able, any closed source applications I may release.
  • I promise to release open source any applications I can not, or will not, support.
  • I promise to learn as many languages and libraries as possible, regardless of politics.
  • I promise to engage with as many other programmers as possible, both in person and online, in order to learn from them; regardless of politics.
  • I promise to not bash Microsoft nor GNU, nor others like them, everyone has a place in our industry.
  • I promise to use both Windows and Linux, both have their uses.
  • I promise to ask questions when I don't know the answer, and answer questions when I do.
  • I promise to learn from my mistakes, and to try to the first time.
  • I promise to listen to any idea, however crazy it may sound.

That's all I have for now, I'll share more as I think of them. What other Programming Promises are you willing to make?