Sunday, August 21, 2011

Repost

I thought I'd find my top 2 articles (based on traffic hits) and repost them here:

  1. Menu Click Instead of Hover: uncontended taking the first spot, it is a method (using only javascript) to tweak the default ASP.Net menu to respond to clicks instead of the default behavior of responding to mouse hover. Here is the full article.
  2. Dynamic Image Map: one of my favorites since it contains some pretty keen javascript and utilization of a js drawing library. It is an extension to the know HTML image map where now the hotspots are interactive. And here is the full article.
 Enjoy!

kick it on DotNetKicks.com

Wednesday, August 11, 2010

Pro ASP.NET MVC 2 Framework - Questions [1]

Since I have been reading this book by Steven Sanderson, and since I have been submitting errata for the book on http://www.apress.com/book/errata/1415 and not getting any feedback, I decided it might be a good idea to start documenting my notes here, this is the first post and others might follow:


Chapter 12; Pages [472 to 476]
Page 472:
"Repetition: You have to duplicate your rules in each view model to which they
apply. Like any violation of the don’t-repeat-yourself (DRY) principle, it creates
extra work and opens up the possibility of inconsistencies.
"
I cannot see how this duplication happens and how the proposed solution defeats it.

Page 476:
"What About Client-Side Validation?
Just because your model layer enforces its own rules doesn’t mean you have to stop using ASP.NET
MVC’s built-in validation support. I find it helpful to think of ASP.NET MVC’s validation mechanism as a
useful first line of defense that is especially good at generating a client-side validation script with
virtually no work. It fits in neatly with the view model pattern (i.e., having simple view-specific models
that exist only to transfer data between controllers and views and do not hold business logic): each view
model class can use Data Annotations attributes to configure client-side validation.
But still, your domain layer shouldn’t trust your UI layer to enforce business rules. The real
enforcement code has to go into the domain using some technique like the one you’ve just seen.
"

Is that not against DRY, we are repeating validation rules in both the "Appointment" class and the "AppointmentService":

"[Required(ErrorMessage = "Please enter your name")]"

"if (string.IsNullOrEmpty(appt.ClientName))
                errors.ErrorFor(x => x.ClientName, "Please specify a name");"

kick it on DotNetKicks.com

Thursday, July 29, 2010

NHibernate.MappingException: No persister for: XXX

Came across this error yesterday. Although it looks like a problem in my mapping files, it wasn't. Such an error could be caused by one of multiple reasons (at least that is what my googling about it keeps giving). In my case it was something like the following query:

session
.CreateSQLQuery("select whatever from AClass where AProperty = :AParameter")
.SetEntity("AParameter", 1)
.List();

apparently, I used SetEntity where I should have used a simple SetParameter (yes I used copy paste!). My actual exception was

NHibernate.MappingException: No persister for: System.Int32

and such an error could have been caused by any such mistake when setting Binding Parameters for a query.
Hope this helps someone in despair.

kick it on DotNetKicks.com

Thursday, July 8, 2010

Confusing Text # 6 (MOSS 2007 - Complete Reference - McGraw Hill)

Page: 599

Focus of text: The different attributes of the Module element

Quote:
"List This is the actual ID number of the list where the file will be stored; for
example, 116 indicates the Master Page and Page Layout Gallery.
"

The Huh?!
This guy is confused, I have tried using the List attribute and it does not seem to cause anything to be stored there. Moreover, the way I understand it is that this is the ID of the TYPE of List Template and not the ID of an actual List. I think this is only meaningful if we are creating a list as a feature.

kick it on DotNetKicks.com

Thursday, April 29, 2010

Confusing Text # 5 (MOSS 2007 - Complete Reference - McGraw Hill)

Page: 285

Focus of text: Explaining about Portal Site and Team Site models (or trying to)

Quote:
"In the Portal Site model (Collaboration and Publishing), there is a top site (the portal/
parent), and all sites below it are considered sub sites. In the Team Site model (basically all
others), there is a top site then all sites below it are considered sub sites
"

The Huh?!
Wow, now I can see the difference between the 2 , thanks a lot, may I shoot you now, pretty please!!!

kick it on DotNetKicks.com

Confusing Text # 4 (MOSS 2007 - Complete Reference - McGraw Hill)

Page: 522

Focus of text: Explaining the "actual components that make up a site"

Quote:
"When adding, editing, or deleting content (items) from lists and libraries, each use
their own set of editing pages (these are not part of the site).
"
 
The Huh?!
What does the author really mean by "these are not part of the site" and what makes these editing pages so separate and special?

kick it on DotNetKicks.com

Friday, January 22, 2010

The importance of work culture

Ever woke up on a work day, and "dreaded getting out of bed in the morning and was hitting that snooze button over and over again"? Well, it happened to me more than once and apparently it also happened to Tony Hsieh, CEO of Zappos.com (as he mentions in this interview). I really related to that quote from the interview and consequently, the interview itself, a very interesting read, made me ask myself the question: Is it a normal part of work to loose that enthusiasm you had on your first day and isn't it part of the responsibilities of the company to keep you hooked and excited enough to jump (instead of drag yourself) out of bed on a work day? Is it like "OK, we signed the contract, now you're an employee here, horray, we're done here" with companies? At least Tony seems in that interview like someone who appreciates the importance of culture at work and seems like culture is his number one priority. The guy even sold his company when he felt it had not enough culture to make him (the co-founder) enthusiastic enough to go to work.
I also liked how "Toni Bowers" describes that feeling of achievement and accomplishment that is more available in a small company than in a big one:
"I once worked for a publishing startup that had us working all hours — not because long hours were required but because we all felt a great sense of accomplishment at, say, getting a book to the printer seconds before a deadline. But the larger the company is, the less an individual employee can see how his or her contribution directly affects the company. And the result is a less passionate environment."
 I don't really think that this attribute (the feeling of no accomplishment) is restricted to larger companies, in fact, it can and does appear in small companies due to the invasion of routine jobs and maintenance especially in fields like software development.

PS: I reached Tony's interview by reading Toni's article (yes they seem to rhyme ;) )

kick it on DotNetKicks.com