Friday, April 30, 2010
 

I just read Jeff Atwood's Coding Horror blog, where he asks the question "What Wrong with CSS?"  It seemed insightful enough to link to here -- I've had some pretty painful experiences with CSS.

What's Wrong with CSS?

 


Geek Speak
4/30/2010 11:48:49 PM UTC  #    Comments [0]

Friday, April 16, 2010
 

I started to go through Stephen Walther's ASP.NET Framework Unleashed by way of learning MVC for ASP.NET, but ran into some seemingly insurmountable problems.  Or one such, anyway.

I started with Chapter 2, Building a Simple ASP.NET Application, and managed to successfully create the very basic application, and I could insert a new item, and get a list of all items in the database.  Unfortunately, that is where my efforts ran off the rails.  Mr. Walther goes from that point into Chapter 3, where he discusses controllers and actions, but he never returns to the simple application.  I'm left wondering how to build a page that edits items, deletes items, and views the items.  From this point forward, he starts explaining the vagaries of MVC, and it looks very good.  Except for one thing: I wanted to find out how to do these other things.  It seems that it would have been simple enough.

At the outset, Mr. Walther indicates that in the second part of the book he will walk through creating an entire MVC applicaton: a simple blog app.  I tried to work into the chapters past the "simple" application that was never filled out to completeness, but got lost.  So, following the author's advice I skipped past everything in order to begin working with the blog application.  And I'm going to try to do this over the next week, but I have to say, finishing up the "simple" first app might have been better for me.

Yes, I know, I just a complainer.

One more complaint has to do with the MVC application template in Visual Studio 2010.  I started a brand new MVC app, and having created it (and its test app), it would not compile "out of the box".  The test project's code referred to the NerdDinner project that I was creating, but the project did not get decorated with a reference to the project it was supposed to be testing, oddly enough.  I had to go in and manually add the reference.  I would have thought that to be a given, but apparently this got left out.  Oh, well.


Geek Speak
4/16/2010 9:51:23 PM UTC  #    Comments [0]

Wednesday, April 14, 2010
 

I've been meaning to get "into" ASP.NET MVC for some time, and I finally got around to it in the last few days.  I went out and bought Stephen Walther's book, ASP.NET MVC Framework, and just to keep things new, downloaded the just-released Visual Studio 2010 and began to work though the examples in Walther's book.

This worked fine until I stopped to compare the code that VS2010 created for me, and compared it with that in the book.  Mostly the same, sort of, except for some syntax that appears wildly different.  Two examples:

Book: <%= Html.Textbox("Id") %>

VS2010: <%: Html.TextBoxFor(model => model.id) %>

What on earth?  I surmise from this that there has been some change with bound-field handling, but there are two syntactical elements here that I have never seen before. 

  • <%: 
  • =>

I've seen <%= before.  It's old school.  But what is <%:  ?  The answer turns out to be that this is a new expression for Html encoding.  <%: expression %> is the equivalent of <%= HttpUtility.HtmlEncode(expression) %>.  Amazing!  Some explanation HERE.

And what is this => thing?  More to the point, what is .TextBoxFor?  This turns out to be a new Html helper method, namely a Strongly-Typed HTML Helper Method.  See the explanation HERE.  And the =>?  This is something called a "lambda expression".  I've heard the term before, but I hadn't the faintest idea what it meant.  There is a Wikipedia article on Lambda Calculus that is relevant, if unfortunately completely impenetrable by yours truly.  MSDN fortunately has an article on C# lambda expressions HERE

That's what is fun about programming: always something new to learn!


Geek Speak
4/14/2010 4:03:24 PM UTC  #    Comments [0]

Friday, February 12, 2010
 

There I was, debugging an application using VS2008 and stepping through the code, and suddenly, when I press the F11 key to step into a method in another class, up pops this dialog box saying something like "No source available for the current location."  Options are to show disassembly (wow, that would help) and I think not to show disassembly.  Meanwhile, despite any breakpoints in the method I'm trying to debug -- that's logical, because if there's no source, then how can it breakpoint? -- it runs to completion and execution resumes at the next breakpoint in the code that I can see.

This is most perplexing, because the source code most emphatically exists -- I can see it -- and restarting VS2008 doesn't help, rebooting the machine doesn't help, and when I load another project and attempt to F11 into code in that one, it works just fine.

This last gives me a clue.  I'm not much for delving into the operating details of Visual Studio, but it seems to be that if I can step into code everywhere else except this one class, maybe there's something going on with the class, and not VS or the machine.  I then have this flash of insight: maybe it's the .PDB file for the assembly that is toast.  How to fix this, if true... hmmm.  I could edit it and force a recompile (I'm going to edit it anyway as soon as I can figure out why it isn't working right), but perhaps a similar problem might have occurred in some other assembly.  So the best thing to do under the circumstances is to force a rebuild of the entire Solution. 

I click on Build -> Rebuild Solution, and it goes through everything.  Now I try the debugging with the F11 Step-into, and BINGO!  It works.  Great, 'cuz I was beginning to get worried that I was going to have to use up some precious project time debugging Visual Studio!!  Thank goodness I am now back on track.  I'll be finished today, if all goes well, and ready to deliver to QA for testing!


Geek Speak
2/12/2010 6:50:01 PM UTC  #    Comments [0]

Tuesday, February 02, 2010
 

I thought it might be noteworthy to note that I am currently developing a replacement for the Inter-Agency Payment import system that my friend Paul Mehner developed while he was on contract here.  It's about time, as Paul wrote this in VB6 using the now-obsolete ADO RDS technology, and the application has started acting rather quirky over the past couple of years. 

I had my choice of technology to redevelop the application, and I decided to use Websphere MQ as the transport layer, and a Web Service for the business layer interface.  I am supposed to be finished by the end of next week, or at least, have delivered the application for QA testing by the end of next week.  I will be done well before that, in fact.

It's very much fun to be back in the coding saddle, I have to say.  Cranking out code is what I like best when it comes to work. 


Geek Speak
2/2/2010 8:05:43 PM UTC  #    Comments [0]

Tuesday, January 12, 2010
 

I have in the past coded up Windows Form or Console apps in Visual Studio (2005 and earlier), and the IDE has facilitated linking up with a web service.  Now I am building a console application that needs to consume a web service, but when I right-click on the project (or References), I do not see a "Add Web Reference" context menu item (for WinForm or Console app).  There IS one if I right-click on a Web Application project, but this doesn't help me, as the application I am building MUST be a console app.  This was not the behavior in VS2005, or earlier!  What's up with that?  The MSDN page that describes the process for .NET 3.5 does not make a distinction; i.e. does not acknowledge a difference.

I am not making this up, and it is not an optical illusion.  Here's are the two context menus, side by side:

So now I am wondering how I am supposed to hook up a web service to a Console application. I imagine that this is still possible at a lower level (i.e. it can be hand-coded), but I am unsure how to proceed. I have posted the question on StackOverflow.


And StackOverflow Comes Through With an Answer!

With VS2008 MS is focused on WCF-Services. You can select a Webservice Reference by clicking "Add Service Reference..." and on the following dialog clicking the "Advanced..." button. In the following dialog you can choose to add a Web Service Reference.

And just as Filburt said, so it was. I love StackOverflow!

But my observation is: Leave it to Microsoft to hide something that used to exist in a highly visible location, and without comment in the documentation, shove it into an obscure location 2 levels deeper in the IDE! I can imagine some design wanker saying to himself, "Well, nobody cares about this anymore, so we'll just hide it where the sun doesn't shine." Did someone take a survey to decide this? He probably just asked his liberal-arts degreed girlfriend, and when she said "Huh?" he ticked the box marked "Asked the users?"


Geek Speak | Stack Overflow
1/12/2010 7:43:35 PM UTC  #    Comments [0]

Wednesday, January 06, 2010
 

At work they enforce changing our passwords on a periodic basis, and that's a fairly common security measure in order to avoid having hackers hijack computer resources.  I have learned to accept this grudgingly as a good, yet annoying, process.

However, Steve Gibson of Gibson Research has passed along word from another security guru named Cormac (didn't pick up the last name) that changing a perfectly good non-hacked password on any kind of rational schedule is likely quite pointless.  When he said this (check out the podcast Security Now!, episode 229, "The Rational Rejection of Security Advice") I was at first aghast at the idea, but the rationale for not bothering seems upon some thought to be quite valid.

Consider that if someone who is not supposed to learns your password, when is he going to use it to do something bad?  Right away, or is he going to wait for a couple of weeks?  The answer is, probably right away.  So if you change your password every six weeks, for example, what are the odds that you're changing the password just before someone who has learned your password is going to use it for the first time?  Almost no chance at all!  And if they do learn my password, and use it, I'm going to find out in very short order and change it immediately -- especially if it costs me money (like my bank account getting hacked).  So the whole notion of changing your password periodically only makes sense if the account you're protecting doesn't matter all that much!  Heh.

I listen to Security Now! regularly, and I recommend it for anyone who wants to keep up with security and the mitigation of security threats.


Geek Speak
1/6/2010 4:53:03 PM UTC  #    Comments [0]

Wednesday, December 30, 2009
 

I recently read on Slashdot that Microsoft is worried about the threat posed by OpenOffice.org to MS Office.  Apparently, they are trying to hire someone with OOO experience to give them a perspective on the problem.

Rubbish.  OOO is a nice product, in its way, but I've used it and it actually sucks.  I don't care for it.

If I couldn't afford Office, then OOO would be adequate.  But I can afford Office, so there we are.


Geek Speak
12/30/2009 4:57:24 PM UTC  #    Comments [0]

Friday, May 22, 2009
 

My son has a landscape business.  And he doesn't have a website for it.  Rather than having him go to some outfit who will charge him a few hundred (or thousand) dollars for building him a website, so he can finally drop the overpriced Yellow Book and Yellow Pages ads, it seemed that I ought to help out and create a nice one -- for free!  Well, anyway, at cost.

So, viola!  http://www.greenscapeconstruction.com

The site went live just a few days ago, and it's still a bit what I would call spare.  You know, less content than one would like?  But I'm still working on it.  There's behind-the-scenes infrastructure to build yet (for example, it doesn't use a database for its dynamic features so far -- that's on the way -- and although there's a login for administration, there's no administration features yet.  But as a fun little project it is just great!  I plan to shove some jQuery effects into it before I'm done.

Now for the Doh! moment.

Ideally, if one wants search engines to index your site correction, you have to have some meta tags (although those are nowhere near as important as they used to be), but Yahoo! tells us that the site's Title is very important.  And I couldn't get the site title to change from the default.  I changed it in the html part of the .aspx on the master page, but it wouldn't change in reality.  It was starting to make me crazy -- what on earth could be causing that?  Some kind of weird caching thing going on?  Turns out: Nope.

I was setting the Title text in two places.  Once in the .aspx, and then in code during Page_Load.  Yikes!  The Page_Load event code had exactly the same Title that the original .aspx had.  So OF COURSE it's not going to change. 

Gotta watch for that kind of thing.


Family | Geek Speak
5/22/2009 3:51:20 PM UTC  #    Comments [0]

Thursday, May 07, 2009
 

Actually, I've been trying to avoid jQuery for several months.  I've had enough on my hands at the moment without digging down into some JavaScript nonsense -- aside from the fact that as much as I respect JavaScript, I could say with some degree of exaggeration (OK, a huge amount of exaggeration) that I hate JavaScript to the root of my soul.  Well, jQuery is JavaScript, and it's starting to get as ubiquitous as JavaScript, so I should hate it, too.

I turns out that jQuery may, however, be my salvation as far as JavaScript is concerned.  Because if you want to do anything remotely nifty and peachy keen on the web, you need to know JavaScript, and the niftier and peachier that you want to be, the better you better know JavaScript!  This is largely because it is an integral part of AJAX -- which stands for Asynchronous JavaScript And Xml. 

So, it's jQuery to the rescue!  I bought a book, jQuery in Action, by Bear Bibeault and Yehuda Katz, and CoDe Magazine has been publishing a new series on jQuery, by Rick Strahl, so it's time to dive deep and see what treasures I can wrest from the deep. 

Who knows?  Maybe I'll actually become good at this.


Geek Speak | jQuery
5/7/2009 10:29:13 PM UTC  #    Comments [1]

For you non-programmers out there here's a fair warning, this is probably going to be of little interest to you.

The rest of you, if you haven't heard of Stack Overflow yet, this is one Rockin' site for developers.  Just have a quick look:

Stack Overflow

It is a marvelous place to ask programming-related questions, mainly because there are people there who will answer them!  I've done some comparisions between Stack Overflow and the MSDN Forums, and my experience is that questions that garner 2 or 3 views in a week or two on MSDN (and maybe no answers) will get several views in an hour and a first response within minutes.  Awesome.  Maybe they've all gone over to Stack Overflow, I don't know, but this is one heckuva "social networking" site for nerds, let me tell you.  Nerds want to talk about tech, and programmer nerds want to talk about programming, and even better, show off their smarts.  This is the place!


Geek Speak | Stack Overflow
5/7/2009 3:31:25 PM UTC  #    Comments [1]

Tuesday, February 12, 2008
 

Learning new things is almost always fun, and one must try to check one's assumptions at the door.  However, what if your brain assumes something and doesn't come right out and say so?  That's interesting.

Keeping in mind that I am new to ASP.NET 2.0...

I'm experimenting, and here I have a neat little master page with a hidden field on it that I want all the other pages to use, so one page puts data in the field and then transfers control to the next page.  The next page then checks that hidden field and doesn't find anything.  This had me wondering what the darned problem was, until suddenly it occurred to me how on earth I could expect anything to be there?  The master page is not stateful, and it is generated from scratch each time.  Doh!  Somehow it had gotten into my head that the master page was some sort of repository -- despite the fact that I know there is no state preservation or information passing beyond query strings, forms, and session/application variables.  Amazing what assumptions one can make with no justification whatsoever and contrary information and experience in rich abundance from past encounters.  Makes me feel like I just called up customer support with the complaint that my computer's cup holder had broken. 

Doh!

 


Geek Speak
2/12/2008 12:39:02 AM UTC  #    Comments [0]

Among the trials innovators in teams are expected to go through is the convincing of skeptical team members that a particular technology is something worth considering.  And when that technology is mature, but unfamiliar except through what skeptical team members see as "trendy" buzzwords, the task might be especially difficult.

Take RSS, for example.  Real Simple Syndication provides a pull-model for content that beats static-content models all hollow.  What if you want your users to be able provide content blurbs that only their own customers can see, and allow them to be able to submit the content themselves (going through moderation, to save you from inappropriate content)?  Well, a syndication model works best!  Examine this particular entry, and you will see why!


Geek Speak
2/12/2008 12:23:39 AM UTC  #    Comments [0]

Monday, February 11, 2008
 

And what if you are trying to create a way for your customers to put content into an application that their userswill see (and only their customers).  With the additional proviso that their entries have to be approved by a moderator, and that their content can expire. 

One model that could be used is the model of a blog -- with the content accessible via RSS.  It's a thought, at least.


Geek Speak
2/11/2008 11:15:32 PM UTC  #    Comments [0]

Monday, October 23, 2006
 

Kevin Hammond got back to me with a comment about how if a web project is the default (startup) project, then the OTC is not enabled.  The solution is to make some other project, including a class library, the startup project.  I find this odd, but I'm sure there's a good reason for it.

Geek Speak
10/23/2006 5:50:38 AM UTC  #    Comments [0]

Friday, October 20, 2006
 

I just heard of the Object Test Bench in Visual Studio 2005 (in Kevin Hammond's blog), and hurried to use it, but ran into a small problem, in that the context menu off the class diagram I don't have a "Create Instance" item!  Am I perhaps doing something wrong, or is this OTB tool only available in a higher version of VS2005 (I'm running VS2005 Professional)? 

Here's a picture of what I get, which does NOT include the Create Instance:

Anybody with any clue is invited to comment...


Geek Speak
10/20/2006 12:45:55 AM UTC  #    Comments [2]

Wednesday, October 18, 2006
 

Learning new things is almost always fun, and one must try to check one's assumptions at the door.  However, what if your brain assumes something and doesn't come right out and say so?  That's interesting.

Keeping in mind that I am new to ASP.NET 2.0...

I'm experimenting, and here I have a neat little master page with a hidden field on it that I want all the other pages to use, so one page puts data in the field and then transfers control to the next page.  The next page then checks that hidden field and doesn't find anything.  This had me wondering what the darned problem was, until suddenly it occurred to me how on earth I could expect anything to be there?  The master page is not stateful, and it is generated from scratch each time.  Doh!  Somehow it had gotten into my head that the master page was some sort of repository -- despite the fact that I know there is no state preservation or information passing beyond query strings, forms, and session/application variables.  Amazing what assumptions one can make with no justification whatsoever and contrary information and experience in rich abundance from past encounters.  Makes me feel like I just called up customer support with the complaint that my computer's cup holder had broken. 

Doh!


Geek Speak
10/18/2006 9:06:34 PM UTC  #    Comments [0]

Tuesday, September 26, 2006
 

Rory Blyth.  Neopoleon.  He's a geeky Microsoft guy who was formerly with the Microsoft MSDN Events team, and he was going on about leaving, possibly even leaving Microsoft, and finally the shoe dropped and <whew>, he's not leaving Microsoft, just moving to a different part of Microsoft.  Still part of Developer communications, but in the heart of The Beast, in Redmond itself.  He's joining the Channel 9 team.  Here's his "Exit Interview", so called:

http://channel9.msdn.com/showpost.aspx?postid=237876

 


Geek Speak
9/26/2006 5:13:17 PM UTC  #    Comments [0]