Friday roundup for April 25, 2008

ASP.Net, Browsers, JavaScript/Ajax, SQL, Silverlight, XHTML/CSS No Comments »

Here is what I liked this week. Enjoy!

Comparing Popular JavaScript/Ajax Frameworks
After four days of ASP.NET AJAX training with Stephen Walther I set out to learn more about my options in choosing a solution for a JavaScript/Ajax framework. If I realized days later I would be writing this comprehensive post on 7 of the most popular frameworks, I may have just went with the “Inny-Minny-Miney-Moe” method!

jQuery AJAX calls to a WCF REST Service
Since I’ve posted a few jQuery posts recently I’ve gotten a bunch of feedback to have more content on using jQuery in Ajax scenarios and showing some examples on how to use jQuery to cut out ASP.NET Ajax. In this post I’ll show how you can use jQuery to call a WCF REST service without requiring the ASP.NET AJAX ScriptManager and the client scripts that it loads by default. Note although I haven’t tried it recently the same approach should also work with ASMX style services.

SQL SERVER - Better Performance - LEFT JOIN or NOT IN?
First of all answer this question : Which method of T-SQL is better for performance LEFT JOIN or NOT IN when writing query? Answer is : It depends!

Video: Write Your First Silverlight Game
In this video, I demonstrate how to start writing your first Silverlight game. I show how to create a dramatic space scene, add a soundtrack, and associate movement with the mouse wheel. This is the first part of a two-part series.

Reading binary files using Ajax
But when it comes to binary files, helping hands from server-side technologies are often necessary.

So I googled around to see what I can do about binary files with Ajax and found this Marcus Granado’s post at http://mgran.blogspot.com/2006/08/downloading-binary-streams-with.html

What he posted there worked like a charm for FireFox and Safari but I couldn’t get it to work for IE.

But luckily, within the same page, someone had posted up a solution for IE as a comment, which is written in VBScript.

Safari CSS Masks
Webkit continues to impress with it’s early implementations of new standards. WebKit now supports alpha masks in CSS. Masks allow you to overlay the content of a box with a pattern that can be used to knock out portions of that box in the final display. In other words, you can clip to complex shapes based off the alpha of an image.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

ReadOnly and EnableViewState don’t play
nice

ASP.Net No Comments »

I ran into an interesting situation today. From what I read it an old issue as well. In ASP.Net 2.0 if you set EnableViewState equal to false and assign a text box as read only the value will be lost on post back.

Rick Strahl posted a nice article on this back in late 2005 which helped me get around this issue.

2005? What? Okay I have to admit that until today I have not been developing my web applications with view state turned completely off. I have turn individual controls on and off as performance required but view state has never been a real issue for me. Today I decided to bite the bullet and just get used to having view state off and it took less than an hour to run into this so here is how to get around it. Yeah I know you probably already know but on the off chance you don’t…then here it is.

Just place the following code in the Page_Load method.

TextBox1.Text = Request[TextBox1.UniqueID];
Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

Friday Roundup for April 18, 2008

JavaScript/Ajax No Comments »

It’s been a slow week for me as far as reading and blogging goes but here are a few bits from this week.

Javascript: Introducing Using (.js)
The goals of using.js are to:

  • Seperate script dependencies from HTML markup (let the script framework figure out the dependencies it needs, not the designer).
  • Make script referencing as simple and easy as possible (no need to manage the HTML files)
  • Lazy load the scripts and not load them until and unless they are actually needed at runtime

You’re Fat and I Hate You
It irritates the hell out of me that so much modern JavaScript development hinges on frameworks. Not because there’s anything wrong with that in pragmatic terms, but because I’m interested in the mechanics of things, and programming with frameworks obscures the mechanics.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

Top 10 Ways Websites Make Me Suffer

Software Design No Comments »

This was guest posted by Jason O’Connor, president of Oak Web Works, LLC www.oakwebworks.com where you can get a free webmaster newsletter and read many other original Web design and marketing articles.

I believe some people create and publish websites for the sole purpose of tormenting their visitors. Browsing various websites and navigating the Web can often be like trying to read on an airplane while a kid kicks the back of your seat and the baby next to you alternates between screaming, crying and drooling on you. There are some excellent websites out there to be sure, but there are also a lot of dreadful ones too. The latter are the bane of so many people’s existence, especially those who use the Web regularly.

The Net continues to grow in popularity and importance for consumers and businesses alike. Therefore, the quality of sites needs to keep pace. Creating and maintaining high-quality websites is more important now than ever. Higher quality equals more revenue.

The following lists the top ten ways that a website misses the boat and contributes to hair loss and nervous breakdowns. Notice the common thread that runs throughout each of these. Namely, a bad website neglects to consider the site visitor’s experience in some fundamental ways.

1. Animation
Seven year-olds like watching animated cartoons on Saturday morning, business people, professionals and most other adults don’t. Sites that include showy Flash animations as an ‘Intro’, animated gifs on every page, or flying words are really annoying. They take away from the content and distract the visitor from achieving their goals. Unless your site is an entertainment site, try to avoid maddening motion. However, if your product or service can be better demonstrated using Flash, Quick Time, or other multimedia, which is common, offer your visitors the chance to click a link to view it. But don’t force them.

2. Too much scrolling
Once I scroll down a full screen’s worth, my eyes start to blur, I feel slightly lost, my head spins and my interest wanes. Computer monitors really aren’t the best medium for reading. The Net and many sites are so big that it’s important to always provide a clear frame of reference for your visitors at all times while they’re on your site. If a page requires two full screens of scrolling or more, simply split it up into multiple pages.

3. Long, text-heavy and blocky paragraphs of unbroken text
I really have to be into a topic or desperately need to glean the information to trudge through big chunks of unbroken text online. If I’m just shopping around for a product or service, you’ve lost me if I have to endure this kind of torture. Again, it is harder to read text on the Web than in other mediums such as books. Additionally, Web users are notoriously impatient, so make your content easy to read and non-intimidating. Use titles, sub-titles, small paragraphs, bullets and numbering.

4. No obvious ways to contact the company
If all you supply is an email on your website, your legitimacy may be questioned. Why can’t you answer the phone? Why hide behind an anonymous and cold email address? Make it easy for your existing and potential customers to talk with you.

5. Unchanging or out-dated content
If I start reading content on a site and soon discover that the content was written three years ago, I split. Since there’s so much information out there, my reasoning is there’s got to be comparable information online that’s more current. If you keep your content fresh your site will attract repeat visitors. And repeat visitors are more likely to turn into customers.

6. Long page downloads
It’s amazing that this is still a problem. When I click on to a site and have to sit there waiting for it to appear in my browser, I start sweating, picking my teeth, tapping my toes, rolling my eyes and soon want to throw my computer through my office window. I’m obviously a little impatient, but again, I know there are other sites out there with the same information that will download more quickly, so why wait? I’m gone.

7. “Me, me, me!” instead of “You, you, you”
Generally speaking, no one cares about you, your company or your thoughts. What they do care about is what you can do for them. So sites that show pictures of the company building or tout their deep philosophy on the way business should be conducted really don’t bode well for keeping the interest of site visitors. On the other hand, sites that speak directly to potential customers about how they can solve their problems, make their lives easier, safer, richer or more comfortable have a much better chance of keeping the eyeballs glued.

8. Non-explanatory buttons or links
Here are some examples of buttons that leave me dazed and confused: A wedding site with a button called ‘Blanks’, a boating site with a button named ‘The Lighthouse’, a book site with a button called ‘The Inside Story’, or a Web design site with a button called ‘Tea Time’. They sound like Jeopardy categories. Imagine trying to find your way on a highway where its various signs read ‘Over Here’, ‘Moon Beams’, and ‘Lollypops’. Good luck navigating your way through. It’s the same with navigating websites. Button and link names need to tell the visitor where the link leads to. Make it as easy as possible for a visitor to know where they’re going before they click. However, there are times when naming a link an ambiguous name may pique the curiosity of a user and get them to click on it. But as a general rule, keep your links and buttons as descriptive as possible.

9. Inconsistent navigation
Imagine sitting down at a restaurant and the waiter comes over to you and hands you five different menus, one for the appetizers, one for the soups and salads, one for the entrees, one for the desserts, and one for the drinks. Annoying. Now imagine if each menu had a different format, layout and method for listing the items. Brutal. I really don’t want to work that hard at picking out my dinner, I’m hungry and I just want a meal. Don’t make your visitors work hard either by expecting them to re-learn your navigation system each time they enter another section of your site. They too are hungry; for useful information and they’re even more impatient.

10. Inconsistent look & feel
When the look & feel completely changes from one page to another in a website, I think I am visiting another site, another company, a partner or subsidiary. I get very confused. This screams poor planning and often results from tacking on new sections later after the original site was built. This can lead to design-drift. It may be tempting to stray from the original design; you may have a better design now. But wait till you do a complete next-generation re-design of the entire site before introducing a new look & feel. If not, lots of visitors will be scratching their heads with one hand and possibly clicking away with the other.

Finally, any site that employs a number of these notorious features is particularly painful to experience. When I click to a website that has five different fonts and colors, scrolls down to the core of the Earth, incorporates zinging words and big fat blocks of text, lists no phone number and has content written and dated in 1996, I scream and know deep down inside that pulling my fingernails out wouldn’t be as torturous as having to remain there a minute longer.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

Two tips to make you more productive

Personal No Comments »

Being productive can be hard sometimes, especially when you have stress from deadlines and loads of work. It is ironic that, generally, the more I stress and obsess over what I have to get done, I get less done. The opposite is true. When I am calm and enjoying working on a project I have few problems being productive and meeting the deadline.

So how can we have more of the stress-free, productive time and less obessing? I have discovered two things that work well for me.

The proper environment

First, place yourself in an environment that you feel comfortable in and can focus on the task at hand. Chances are if you work from home and have a family it can be hard to do this. You need a dedicated office space where you can close the door and focus on your work. Or perhaps sitting on a bench in the park or at a table at your favorite cafe, but find a spot that works for you. This is very important.

For me I am tied to my office at work. I don’t have a laptop and I suspect I would get a less than favorable response if I told my boss I was heading down to TIm Horton’s to work for the rest of the day :D. So if you are tied to a spot how can you make it better for working? Well, I bring my iPod everyday and put on the head phones and this helps me focus. The hall outside my office can get pretty busy with techs running back and forth to the server room and workshop so at these times I have to close my door even while wearing the head phones.

Small goals

This second, and final tip, has had the biggest impact on my productivity. I keep a list of tasks that I want to complete for the day. I may or may not complete everything on the list but crossing items off gives me a confidence boost and motivation to keep going.

If you don’t like to litter your desk with paper you can try some alternatives like Basecamp. You can sign up for a free account and track your progress online. This has some advantages. I can’t remember how many times I’ve gotten home and forgotten a list and wished I had been tracking it online instead.

Conclusion

In short, get out there and find yourself a space that can make you more productive and happy in your work. Also start keeping track of your goals and progress. You’ll be surprised by just how much it helps.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

Friday roundup for April 11, 2008

ASP.Net, News No Comments »

Here is what I liked this week.

Microsoft Sets Three Week Deadline for Yahoo! In Public Letter
In a letter sent today, Microsoft writes to Yahoo’s board of directors to tell them that they would like to ‘negotiate a definitive agreement on a combination of our companies.’ Their message is a combination of friend and foe: ‘If we have not concluded an agreement within the next three weeks, we will be compelled to take our case directly to your shareholders.’

How to Impress at Your Next Interview
I have had the opportunity to interview a lot of prospective developers. In that time I have come to understand more clearly what it is that impresses me most. And it might not be what you expect.

Google Takes Down HuddleChat After Complaints
The App Engine team was looking for some sample apps to help kick the tires on their new system, so we invited Googlers to build some as side projects. A couple of our colleagues here built HuddleChat in their spare time because they wanted to share work within their team more easily and thought persistent web chat would do the trick. We’ve heard some complaints from the developer community, though, so rather than divert attention from Google App Engine itself, we thought it better to just take HuddleChat down.”

Yahoo’s Big Day of Fun
It’s been a busy few days for Yahoo. With scorned love letters being passed back and forth with Microsoft, to adding video to Flickr, buying a Web analytics company and now testing out Google ads, you have to give Yahoo credit. We haven’t seen this much excitement coming out of the number two engine in quite some time.

How Much Is Our Blog Worth?
If we’d go by these rules, we wouldn’t sell our blog for anything less then: $344,236! Shocking amount isn’t it? And we haven’t even calculated the value of the brand you’d be selling. The “status” and numerous new networking opportunities that would come knocking when you buy an established blog.

The War Against Blog Commentors Who Use Keywords as Names
A couple months ago, I followed an interesting discussion at Remarkablogger related to a new comment policy that Michael Martine posted for his blog. It seems that Michael had become frustrated with the increasing number of comments on his blog that appeared to be more interested in plugging their websites keywords than adding to the dialogue. After some very interesting and thoughtful comments from his readers on the new policy change, Michael posted a slightly modified policy.

The empty try block mystery
I had used .NET Mass Downloader tool to download .NET 2.0 Framework sourcecode some time ago. While reading Timer.cs (System.Windows.Forms.Timer) and a couple of other classes I noticed something interesting.

Does the following piece of code look odd to you? Notice the empty “try” block and all processing being done in the “finally” block.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

The importance of proper error logging

Software Design No Comments »

I may be preaching to the choir on this one but I feel that it is important enough to mention incase it turns a light on for some of you or just simply re-enforces an already solid part of your development cycle.

What I am talking about is error logging. At first glance it may not seem all that important but if you have been in the middle of even a semi-complex development project you know that it can be hard sometimes to track down bugs.

I have been working with the Model View Presenter (MVP) pattern for a while now and have grown to appreciate it’s modularization and ease of testing. Despite these great things my code still contains the odd bug, go figure!

Now if you are not logging errors and exceptions it can be tough to even now why a bug is happening. but if you are logging every exception, custom ones too, then it makes your life that much easier since you at least know where to start looking.

I warned you that this might be a little “well duh”. It is a basic and simple concept with meaningful and significant rewards.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

Friday roundup for April 4, 2008

ASP.Net, Browsers, JavaScript/Ajax, SEO/Marketing, XHTML/CSS No Comments »

Here are some interesting stories from this week.

IE 8 strict mode doesn’t allow for CSS opacity?
So the fact that this has been labeled as by design suggests that IE8 will be the only browser produced in the last 10 or so years that will not support opacity in its strictest mode. Thats rediculous.

Google Will Sell Performics, SEOs Exhale
Exciting news from The Official Google blog today that reveals Google will stop scaring SEOs everywhere and will sell off Performics, the search marketing company that they accidentally acquired when they bought DoubleClick last year. To avoid the conflict of interest that comes when you’re a search engine selling search engine optimization services, Google will split Performics into two companies – an affiliate marketing company and a search marketing company – and then sell the search marketing half.

Webforms is dead. Long live MVC!
Scott Hanselman’s fourth screencast *confirms* that the interfaces and abstractions made as part of the MVC (HttpContextBase, IHttpRequest, IHttpResponse, etc.) will not be put into the existing Webforms model. That means that once MVC is released, the old HttpContext object in WebForms will *not* inherit from HttpContextBase, nor will the WebForms versions of HttpRequest and HttpResponse objects implement the interfaces.

But I’m not moving my mouse!
The IE team reacted correctly: the bug has been solved in IE8b1. When the mouse does not move any more the mousemove event stops firing, as it should.

However, this same bug was recently introduced in Safari (Windows) and Opera!

Safari 3.0 and Opera 9.26 support mousemove correctly, but Safari 3.1 and Opera 9.5b have copied the IE bug.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

SqlDateTime.TryParse, almost

ASP.Net, SQL 4 Comments »

kick it on DotNetKicks.com

I talked about an issue I ran into between DateTime.MinValue and SqlDateTime.MinValue in a previous post. One other point I noticed while researching the topic was that, unlike almost all other types, SqlDateTime doesn’t have a TryParse method.

I really like the TryParse method because it helps me write code that is more terse and clean. I can easily use the TryParse methed as the condition for an if statement to handle the outcome without have to resort to ugly try catch blocks all over the place.

On Ian’s suggestion in the comments to my previous article I decided to take a stab at writing an extension method to implement this functionality. Now I said almost in the post title because I couldn’t get the TryParse method attached to the SqlDateTime native class. Now this could be due to this being my first attempt at an extension method so if anyone has any advice or suggestions on making this solution better feel free to leave them in the comments and I’ll update the code.

The solution

As I said I couldn’t get the method attached to the native type so this is the next best thing. I have declared a XSqlDateTime type that contains the TryParse method.

public static class XSqlDateTime {
	public static bool TryParse(string str, out SqlDateTime output) {
		try {
			output = SqlDateTime.Parse(str);
			return true;
		}
		catch {
			output = SqlDateTime.MinValue;
			return false;
		}
	}
}

This is easily used like so.

SqlDateTime date;
XSqlDateTime.TryParse("1/1/1953 12:00 AM", out date);

Just like all other implementations of TryParse on other types, if this method returns false it will assign the default type value to the output variable. In this case it is SqlDateTime.MinValue.

Hope this is useful to someone. I know it is for me. Cheers.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.

Stored procedures are better then dynamic sql

SQL 5 Comments »

kick it on DotNetKicks.com

There are many arguments to whether stored procedures or dynamic sql is best when developing applications. I don’t think there is a cut and dry “best”. As with most things in programming, it boils down to what is best in your current situation.

A case for stored procedures

I have worked with stored procedures and dynamic sql extensively on several different platforms. When working in C# or ASP.Net I like to use stored procedures for most of my database access. However with all technologies there are limitations and times when a different approach is required. When a stored procedure cannot easily complete the task I look to dynamic sql.

I like stored procedures for a couple of reasons. Firstly, any values I pass in are automatically parameterized and sanitized for me so I don’t have to worry about special characters (like ‘) or sql injections (for the most part). Second, all the sql code is in one repository and I know exactly where to look when faced with an sql error and the procedures are easily reused saving on duplication if I had used dynamic sql.

A case for dynamic sql

When I am working in PHP and MySQL I always use dynamic sql. I do this also for a couple of reasons. My PHP applications tend to be on a much smaller scale then when I work in C#. This is because I use C# at work where we build enterprise applications and I use PHP at home for personal projects. I also use dynamic sql when working in PHP because my hosting is on CPanel which gives me access to my MySQL database with phpMyAdmin which does have a nice interface for stored procedures like SQL Server. Dynamic sql is just easier here. Although there are a few more things to deal with when generating dynamic sql it is very flexible and is only limited by your platforms implementation of SQL. Flexibility is always a huge plus.

Conclusion

So I stand currently on stored procedures as my favorite method right now. Perhaps I’ll get ambitious and look more closely at stored procedures in MySQL. I have played a bit with NHibernate and LINQ for C# which have solid benefits that may sway my opinion once I have used them more.

Did you like this post? Be sure to grab my RSS feed so you don't miss out on more great articles.
WP Theme & Icons by N.Design Studio
Entries RSS Login