When window.location.href="..." doesn't work

by Jon 7/30/2008 9:12:00 PM

I got a strange "Access is denied" error on a site where I had used window.location.href as a way of redirecting a page. Here's the alternative solution I came up with, which seemed to work fine. (Ha!)

<script type="text/javascript" language="Javascript">

document.body.innerHTML="<form action=\"http://www.othersite.com\" method=\"get\"></form>";
document.forms[0].submit();

</script>

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Web Development

Community Server 2008: Nice Try, But It Still Leaves Us Hanging

by Jon 7/18/2008 7:04:00 PM

A couple years ago, we were starting to examine the need for a community / social networking solution, mainly forums and blogs, and my boss told me that I, as a senior engineer on the team, would be responsible for identifying our requirements, selecting and recommending a platform to build upon, and taking part in seeing it get tailored to the company's needs.

I always give my tasks 190%. Forget 110%. Identify requirements? Okay, let's have meetings and figure out our requirements. So a co-worker and I spent nearly a week mulling over ideas for the ultimate community system we could ask for, and documenting our brainstormed ideas as we saw fit. We started building up a rough draft. The plan was to take this rough draft and hand it over to the manager and executive and ask them to take a big, fat red pen and cross out the things that were beyond the scope of expectations. (Literally, I expected that about half of the requirements would be dropped. Incidentally, this strategy is not normal, requirements should come top-down, not bottom-up, but no actual requirements had been established so we had to come up with them.) Instead, my boss took the 3/4-written rough draft Word document we'd been exchanging around the office and sent it directly to telligent to basically ask them for a work order quote.

So first of all, that's not really what telligent does. At the time, they had no professional services team, and their closest equivalent primarily only handled themes and site integration. Second, we hadn't yet selected a technology platform, so, without explaining himself or his reasons, the boss apparently decided to cancel out on his word on making selecting a platform to build upon as a step in the process. Third, the extent of our requirements in our unrefined draft was so far beyond what any ASP.NET-based commercial community software / social networking solution delivers. The closest functional equivalents are closed systems like MySpace and Yahoo! Groups. Fourth, while begging and groaning on the phone with telligent, my boss pretty much insulted the entire team, and was overheard by me, mentioning me specifically in describing my previous job and how I was not focused on ASP.NET at the time, and how I therefore "have never done this sort of thing before". That occasion has haunted me every day since then because it was well explained that I not only have "done this sort of thing before" (software & web development, using ASP.NET et al), I actually built a rich and detailed community system from scratch in ASP Classic and SQL Server 7 all the way back in 1999 and explained all this in my interview.

Somehow, telligent agreed to sign up for the tasks, refusing to use our specifications but indicating that they'd figure out their own subset, and after they took the boss's money they called him up and let him know that they would basically make all the changes in the actual product instead. He didn't get his money back, we basically just received ultimately useless alpha build drops of what would later become Community Server 2008 and did our own QA'ing for them (on top of their own QA'ing). By the time the features we had agreed upon were done, CS 2008 was just a couple months away from its first public beta, so the boss decided to scrap everything we had received from them in private, and wait for the final product.

CS 2008 is actually pretty extensive, and it has a lot more features in various places than we ourselves had asked for (it is, after all, their product, not ours). But we couldn't use it up front. In the process of adding features we didn't ask for, they added new support requirements that required us to resolve, and meanwhile there are still features we had been in need of.

I was again tasked to lead up the project of getting CS 2008 set up and out the door, but even before delving into documenting the specific tasks that would be required--tasks that I submitted for review 900 times and were never reviewed by management to detail for proper truncation and elimination--the MS Project gantt chart (using it as a calculation tool, not as a "BS to the boss" communication tool) showed truthfully and accurately that there was another half-year of functional customizations development involved, particularly considering that there were nine seperate web sites each in need of a community solution. In response, instead of the boss having the whole team go gung-ho and focus on the project to get it out of the way, instead the other team members were immediately pulled off the project and I was left on the project by myself. Not a single senior member of the team or manager bothered to read the tasks I had written up for the project, to detail, and to this day after about three months of full-time focus the tasks are only about one quarter finished, with the entire QA process dropped and close to zero theming comps or implementations by me, by the graphics designer, or by the cross-department magazine leadership.

I posted part of our change list on telligent's own forums, and they locked the thread as moderated so that people can't discuss it, hence the reason why I'm posting it here now (not that people would discuss it, but call it a mega-bump).

http://dev.communityserver.com/forums/t/500575.aspx

 

Features We Had To Implement, and Wish Were Already Implemented.

I wanted to share a list of things we have been having to make in order to make CS 2008 usable for our own purposes. We're still not there yet but we're getting close, and I'm sharing this because, in my opinion, there is no louder message of "please add these features into your product" than the willing efforts made by the customers to do it on a proprietary basis. (Note that these customizations are not being redistributed.) Most of these I had to do single-handedly, and so far it has taken months of SDK tweaking.

  1. Make the top navigation bar data-driven for sort order, data-driven for additional links to custom URLs, and administratable from the Control Panel. (We implemented.)
  2. Auto-generate a blog for each user, and make certain that no errors occur if there are no posts. (We implemented.)
  3. Auto-generate a media gallery for each user, and make certain that no errors occur if there are no posts. Note that the new "My Files" feature is not adequate for this purpose as it doesn't support ratings, comments, etc. (We implemented.)
  4. Hide inappropriate admin options in the control panel from "normal users" in their personal Media Gallery settings, such as e-mail notifications.
  5. Add a "My Blog Actions" component on the sidebar for the Blogs section, so that users can jump straight into managing their blog from the Blogs portal. (We implemented.)
    • Add A New Post
    • View All Posts
    • View Comments On My Posts
    • Manage My Blog
  6. Add a "My Gallery Actions" component on the sidebar for the Media section, so that users can jump straight into managing their media gallery from the Media portal. (We implemented.)
    • Add A New Gallery Item
    • View My Gallery
    • View Comments on My Gallery
    • Manage My Gallery
  7. Add a link to the user's blog from the user's profile. (We implemented.)
  8. Add a link to the user's media gallery from the user's profile. (We implemented.)
  9. Replace the general Media section on the user's page with a "My Media Gallery" section.
  10. Wanted (we have not implemented): Albums inside a gallery.
  11. Restore the drop-down menu for selecting what area to search. (Where'd this go?!)
  12. When searching for users, always assume a wildcard (*) on prefix/suffix. (We implemented.)
  13. Add prominent link to browse people from the user's portal. (We implemented. We added "Members" to the Welcome control on the top right, which links to ~/user/Members.aspx?search=1&t=&sb=1&so=1.)
  14. Make gallery RSS feed PicLens-compliant. (See PicLens.com)
  15. Replace the slide show with PicLens Lite.
  16. Aggregate the media with statistical roll-ups:
    • Highest Rated[in the ..]
      • Last 24 hours
      • Last 7 days
      • Last month
      • Last year
      • All time
    • Most Talked About ...
      • Last 24 hours
      • .. etc
    • Most Viewed
      (We are implementing.)
  17. Show randomized gallery items on sidebar based on statistical aggregate roll-up data. (We are implementing.)
  18. Add "Share with friend" functionality to media galleries. (We implemented.)
  19. Each group/hub gets an events calendar. (We are implementing.)
    • Users can "subscribe" to events to receive an e-mail reminder 24 hours prior to group events. (We are implementing.)
  20. Add the following options (and implement what they infer) to the Edit Profile page:
    • Share Friends (Yes/No)
    • Show Profile Comments (Yes/No)
    • Share Blog Link (Yes/No)
    • Share Gallery Link (Yes / No)
    • Share My Activity Logs (Yes / No)
    • Share My Files (Yes / No)
    • Share My Bio (Yes / No)
    • Show My Announcements (Yes / No)
    • Share My Groups (Yes / No)
      (We implemented.)
  21. Make profile comments and announcements distinct, so that the comments can be treated like a thread and the profile owner can actually respond to a comment without it being a broadcasted announcement. (Think FB 'wall'!!) (We implemented.)
  22. Flag new conversation messages as unread. Any unread messages enables a "new mail" icon to appear in the Welcome control on the top right. Mark the message as read by the recipient when the user accesses the actual conversation message, so the icon disappears. (We implemented.)
  23. Support site-wide survey questions that show up in the user's profile as an additional tab. (We implemented.) These questions are data-driven, and the site administrator can create questions that consist of:
    • Drop-down menus
    • Multi-select list box
    • Textbox
    • Textarea
    • Radio buttons
    • Checkboxes
  24. Support hub-wide survey questions that show up in the group as a Q/A or Polls section. These questions are data-driven, and the hub administrator can create questions of the same types that are supported in the site-wide survey (previous item). (We implemented.)
  25. Support multiple TOS agreements. Make TOS data-driven to point to either a URL or full text field, with a TOS modify date, display each of the TOS agreements in a seperate IFRAME with an "I agree to these terms" checkbox below each, and log the user agreeing to the TOS with timestamp, so that if a TOS modify date ever changes, and any member accesses any member-only section of the site (such as Add a New Post), the user must agree to the latest TOS. Same behavior as World of Warcraft. :) (We implemented.)
  26. Fully integrate live chat support, and link out to a chat room from groups/hubs. (Each group gets a chat room.) (We implemented.)
    • Log chat room activity such that a user can mark a chat room as a favorite and a "Recent chat rooms", "Favorite chat rooms", and "Group chat rooms" are aggregated on the user's portal page with a quick link into the chat room (We implemented.)
  27. Restore into Hawaii the statistical and history data for forums that was enjoyed in the Calypso theme. (We implemented.)
  28. "Write a New Post", "Mark All As Read", and "Reply" need glyphs! (We implemented.)
  29. Make the Control Panel themeable, and make the theme managed by the site theme directory. (We implemented.)
  30. Implement site aggregation in an alternate portal page, magazine-style.

Lots more, but these are enough to mention.

Makes me want to go and build a new community framework from scratch. It's still not too late, although it would take me at least a few years to catch up to telligent's product as it is today.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Software Development | Web Development

Social Load Testing?

by Jon 7/8/2008 3:58:00 PM

Five Runs (silly how many Ruby/Rails-oriented companies are named with two words and one with a number) developed a social load testing solution that appears to help you load test your site and trace bottlenecks in code, but instead of pounding on your own site using local automation, it allows live visitors -- fellow developers who need load tests done for their sites -- to pound on your site.

http://www.fiveruns.com/products/tuneup

Interesting concept. We even have social networking for load testing.. LOL..

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Computers and Internet | Software Development | Web Development

Opera Competes

by Jon 6/27/2008 2:28:00 AM

Opera is showing the world how to be fierce competitors but doing it fairly and in a good way.

http://ajaxian.com/archives/opera-gets-proactive-and-helps-you-fix-your-code

In the words of the judges on a TV show I've been watching, So You Think You Can Dance,

"Yeaaaaaahh!!!  YEAAAAHHH!!! WOOOOOO!!! That's competition!! That's what I'm talking about, YEAH!!"

Now if only Microsoft could comprehend the philosophy, they would stop making excuses for their corporate partners and start asking them to simply make their web sites compliant.

Oh, but oops, that would break their sites on IE... *sigh* .. Oh wait .. Ahh, got it .. they did understand it, they've been telling their customers to retain broken code that only works on IE and not to make it standards-compliant so that it keeps working on IE .. maybe they're not so stupid. Improper? Yes. Stupid? No.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Web Development

New York Times proves out Silverlight integration in a native Mac application

by Jon 5/24/2008 12:46:00 PM

New York Times has migrated their popular WPF-based New York Times Reader to the Mac, using Silverlight and native Cocoa windowing and application logic, and using the Safari / WebKit API as a Silverlight wrapper. (Darn it, I knew it was both doable and legal!)

http://firstlook.nytimes.com/?p=49 

It doesn't have the text flow feature that WPF was so fantastically good at, but being as text flow is rumored as "coming soon", either for NY Times' reader or for Silverlight, I'm pretty excited about the future of that. 

I blogged about the feasability of this (native, non-web cross-platform apps with Silverlight rendering) just days ago, motivating myself to outright buy a Mac since I didn't see anyone bothering to try. Now that someone has not only tried but succeeded and released a significant product based on it, I feel a little mixed -- part bummed that I didn't get to post first-discoveries, but part excited that Silverlight has potential for an Adobe AIR-like wrapper, both technically and legally.

The NY Times Reader for Mac sure isn't running on WPF, though, and it shows. The user experience is clunky and the lack of text flow is painful (try resizing the window or scaling the text). The whole thing is nothing like the WPF version, except only for the initial screenshot appearance (without interacting) and, perhaps, the actual content.

kick it on DotNetKicks.com

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , ,

Microsoft Windows | Web Development | Mac OS X | WPF

EntitySpaces and Silverlight Demo - Part 2

by Jon 5/23/2008 1:57:00 PM

Mike Griffin at EntitySpaces has posted Part 2 of my EntitySpaces + Silverlight tutorial.

http://www.entityspaces.net/blog/2008/05/24/EntitySpaces+And+Silverlight+Demo+Part+2.aspx  kick it on DotNetKicks.com

It barely touches on the purest basics of filtering and updating data with Silverlight, EntitySpaces, WCF, and LINQ.

Not a whole lot to it, there's SO MUCH more that ES (particularly), Silverlight 2, WCF, and LINQ have to offer, but it's good quick-and-dirty tutorial knowledge nonetheless.

And no, I haven't been slaving away at this second part of the tutorial all this time. I finished it a long while back, its posting was delayed for various reasons not related to the demo/tutorial. I might still yet get into some advanced tutorials but we'll see. 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Software Development | Web Development

Embeddable Cross-Platform Silverlight

by Jon 5/14/2008 5:02:00 PM

I've been wanting to start discovering cross-platform development with Mono, MonoDevelop, Gecko#, C++, XPCOM, XUL, XULRunner, WebKit, et al. I have a couple vaporware apps in mind and I have just purchased a Mac Mini and an iPhone mainly for this purpose. And meanwhile since Silverlight happens to be cross-platform as well, I was curious about its licensing. Theoretically, one can accomplish an Adobe AIR-like cross-platform application implementation using Silverlight and XUL or WebKit. Problem is, I had heard that Silverlight was explicitly written to disallow it from being used on anything but a standard HTML web browser (Safari, Firefox, Internet Explorer).

After spending an hour or so poking at the n00b tutorials on XUL and XPCOM, I went to the Silverlight site and spent several minutes looking everywhere for the darn EULA. (Sadly, after finding it, once I hopped on this blog editor I lost it and it took another 15 minutes to find it again.)

http://www.microsoft.com/silverlight/resources/LicenseWin.aspx and http://msdn.microsoft.com/en-us/silverlight/cc307279.aspx

I didn't see any such limitation there, nothing about "thou shalt only use Silverlight in a 'standard web browser', namely Internet Explorer, Firefox, or Safari".  There are some limitations, of course, such as perhaps redistribution, which theoretically if the app is a XUL app can be deal with using HTML+JS+XUL+XPI, getting Silverlight into thinking it's downloading and installing itself through and onto Firefox. (All theory, of course.)

On a side topic, if anyone out there is reading this, can someone tell me why there are almost no open discussions correlating XUL and XAML/WPF? They seem to attempt to do the same basic function--create apps using XML and components--albeit WPF is far more powerful and versatile in itself as a tool in its niche, whereas XUL is Javascript/HTML friendly and is cross-platform.

UPDATE: After discussing with a buddy who's done cross-platform .NET programming with Mono, apparently Glade + GTK# has an XML markup language that also meets the same objective.

On second thought, maybe I just wasn't searching hard enough. I see a lot of hits here: http://www.google.com/search?q=xul+vs+xaml

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , , ,

Pet Projects | Computers and Internet | Software Development | Linux | Cool Tools | Web Development

EntitySpaces on Silverlight 2: Part One

by Jon 5/4/2008 11:25:00 AM

I managed to get EntitySpaces running on Silverlight over WCF client proxies. I documented the steps as a tutorial and Mike Griffin at EntitySpaces posted it up on the EntitySpaces blog.

http://www.entityspaces.net/blog/2008/05/05/EntitySpacesAndSilverlightDemoPart1.aspx kick it on DotNetKicks.com 

Demo here: http://developer.entityspaces.net/ES2008/Demos/Silverlight/PartOne/

I retained my Word doc so I can retain my personal preference of formatting, fix typos, and add a few annotations and disclaimers here and there like, "So far these steps don’t lend themselves very well to an offline development workflow. Finding a more appropriate workflow pattern, though, is beyond the scope of this initiative. (Good luck.)" We can thank Microsoft for making WCF on IIS 7 such a pain in the behind for binding service endpoints, without any code generation or GUIfication. But enough whining, client-side business objects in Silverlight is a hawt approach to LOB RIAs.

http://www.jondavis.net/misc/EntitySpaces and Silverlight Demo - Part 1.doc

Part two will be short 'n sweet but much more focused on actually working with EntitySpaces. This part didn't give ES justice...

EntitySpaces RIA running in Safari 3.1 (on Windows) with just about 20 lines of hand-written client-server code and XAML markup:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Pet Projects | Computers and Internet | Software Development | Cool Tools | Web Development

WebKit Is Usable By End Users?

by Jon 5/3/2008 11:20:00 AM

I've been hearing a lot about WebKit being on the bleeding edge of staying up-to-date with performance and passing various tests like ACID 3. I was confused and concerned, though, because I had thought WebKit was only available to developers as a set of components (DLLs) and was not actually usable by end users.

I was sort of right, but mostly wrong. WebKit's nightly build, which is downloadable, runs on top of Safari (from a user perspective, that is .. technicaly, Safari sits on top of WebKit), replacing Safari's rendering engine with the latest "new and improved". After Safari 3.1 is fully installed, just download the latest nightly build of WebKit, run the batch file and go. (There were two batch files, I ran run-drosera.cmd and then I added a shortcut to run-nightly-webkit.cmd to my Quick Launch toolbar and changed the icon.)  WebKit does not kill off the official Safari renderer when Safari is launched in its normal fashion, it only overrides its renderer when launched from WebKit's .bat file.

Now I'm starting to think that Safari on the latest WebKit is the best browser. *gasp* Who'da thunk?

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Open Source | General Technology | Computers and Internet | Web Development

Trying To Get My Head In The Clouds ...

by Jon 4/28/2008 10:59:00 PM

Just when I was about to get super excited about the next New ThingTM from Microsoft, which is the big new Mesh initiative ..

http://www.mesh.com/

.. suddenly the Aptana team (creator of the Aptana Studio IDE, the best open source IDE for Javascript development, and creator of Jaxer, the first AJAX server) pulls another magic trick out of its hat and blows me away again!!

http://www.eweek.com/c/a/Application-Development/Aptana-to-Launch-Cloud-Platform/

What's intriguing is that about a year or so ago I was blogging about some distributed-database-over-the-web mesh ideas that I had, that no one except a couple people talked to me about to comment on my ideas. I set up a wiki at http://www.distributeddb.net/ (down) (.. it's back up). Frankly, it fulfilled at a technical level exactly what Microsoft is trying to achieve. But while I knew I was on the right track as to where things could go and will inevitably be going, I pulled the plug on the initiative and retracted my blog posts and wiki (but it's back up now) because, frankly, I was ashamed of my lack of qualifications. I open up distributed database theory books and cannot get past the first sentence or two, they are beyond my comprehension skills.

With regard to this mesh / cloud stuff, though, I'm just really glad that I was on the right track, even if I couldn't lay claim to fame on the ideas, try as I might have considered.

UPDATE: No.. no, no, no ..... I misunderstood what Microsoft's mesh was all about. I picked up from the MIX stuff, from articles such as I think one was in SD Times, and from blog posts, that Microsoft's mesh was about web developers. But now that they've given me an "invite", I only see the ability to connect devices, such as a PC and, later, a Mac or a mobile phone to the mesh, so that you can put files out on your own personal mesh. And I can't even use the "device" installer on my PC because it doesn't allow itself to be run in a Windows Vista environment where UAC is turned off.

I don't get it. Not what I had in mind after all. Besides, if I wanted Internet-accessible file storage, I have my choice of Groove or Subversion (the latter of which, by the way, is more handy and usable for synchronizing my files between home and than FTP or anything else I've used).

So, um, nevermind what I said about distributed databases ( ?? ) .. garbage analogy, nothing to do with this.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , ,

Computers and Internet | Distributed Database | Web Development

MVC, TDD, ORM, WCF, OMG LOL

by Jon 4/23/2008 3:05:00 PM

Rob Conery, creator of the SubSonic ORM and scaffolding framework for ASP.NET, has been transparently publishing, in video format, what he understands TDD (Test Driven Development or Test Driven Design) in his presentations on the the reworking of the ASP.NET Storefront Starter Kit based on the ASP.NET MVC toolkit.

Surprisingly, the series has little to nothing to do with the storefront project. It's more of .. what I just said, Rob's transparent discovery process of TDD and keeping his process in check. That said, I thought it was a rarity among webcasts, something very much worth watching. Rob, who was recently brought into the Microsoft fold, has a way of making Microsoft look and feel human like the rest of us, using common sense and even humbly making adjustments of mindset and worldview according to the wise words of industry professionals as they give feedback. (This is something Microsoft has been getting good at lately, stepping out from their big Redmond city sized box and learning from a bit the rest of the planet, which is why I still root for them despite my relentless criticisms.)

Rob's discovery process is actually a very, very good opportunity for the rest of us to learn from. Rob came in prepared, he presented well, and the content and message are very good. While it was mostly review for me, TDD brings about such a different mindset to software that I feel like I need as many such "reviews" as I can find so that I can get it ingrained and rooted in my mental patterns.

That said, I am still greener than I want to be at ASP.NET MVC. This is just an issue of experiece; we're using it at work but I haven't been given the opportunity to implement, the other fellows have. Same with SubSonic.

I'm a big fan of SubSonic. I like its approach to ORM and its scaffolding.

Lately, though, I've been touching a bit with one of the software industry's best kept secrets among rediculously handy ORM solutions, and that is EntitySpaces. Mike Griffin's work with ORM tools has been around longer than Rob Conery's, and I've admired his work with both MyGeneration (a free, open source, and in many ways much better alternative to CodeSmith) and EntitySpaces for a couple years now. EntitySpaces is still pioneering in the ORM space, they've had a super-sweet ORM query object model that has been around and in production for much longer than SubSonic's recent "super-query" tweaks, which are still in beta. Makes us all wonder ...


Rob Conery

Mike Griffin
ROFLMAO.

Aside from the additional fact that ES works cleanly and happily on the Mac and on Linux with Mono, and aside from the additional fact that SubSonic is less about ORM and more about "building web sites that build themselves" (not everyone is building ASP.NET web sites, some people are writing software and just need a focused ORM solution), one thing I'm noticing recently about ES that makes it stand out from a lot of the other solutions out there is that an investment in ES on the server side is a really smooth and effortless transition to the client when you throw WCF in the mix, if all the client needs is the data models. The WCF proxy support in MyGen+ES makes client/server integration over WCF a snap. Part of this magic is also in Visual Studio, when you right-click References and add a Service Reference, the proxy objects are brought over from WSDL or a WSDL equivalent proxy definition, and you can begin coding on a seemingly rich object model on the client right away.

For me when I was tinkering with ES over WCF, being still green to ES, this brought TDD (actually integration testing) back into the picture. I found myself taking what I learned from Rob Conery on TDD and designing my services by executing tests--specifically, integration tests, which isn't pure TDD but I trusted WCF. I kind of had to; I needed to invoke the interfaces so that I could step through the debugger and introspect the objects and see what was going on under the covers as I was invoking code over the wire. This isn't pure TDD by principle but it is "test driven design" in the sense that I was finding myself writing tests that simulate real-world behavior in order to design how I want the code to function.

TDD, meanwhile, has made me think a lot about what I wrote half a year or so ago about Design Top-Down, Implement Bottom-Up. I didn't get much feedback on that post, but I, too, was being transparent with what I thought was a good idea. My word choice in that pattern seems foreign at first to TDD principles, if not contradictory, but the more I think about it the more I think it is actually very much complimentary.

  • In TDD, the tests simulate, by way of invocation, the top-down design and verify the bottom-up implementations, and
  • The implementations are kept in check by these simulations of top-down usage.

So I think TDD is really the glue, or a type of glue, that makes Top-Down-Bottom-Up work. I think the only big differences in perspective here are physical; TDD's perspective is a "I poke at you first, before you yelp", or forwards, perpective, Top-Down-Bottom-Up assumes that encapsulation is a layer, and the priority in the design process, over the implementation. (Or something.) It's all pretty much the same thing. And actually, while TDD validates the Top-Down-Bottom-Up process, TDBU validates TDD, too, because done right it uses TDD to prove out the stability and rock-solid implementation of an end product.

I'm feeling now like haacking (pun intended, for those who know) together a SuperText blog engine using a mish-mash of funzy geek stuff I want to keep pushing myself with including ES, ASP.NET MVC, TDD, REST, WCF, VistaDB, Silverlight, Javascript/AJAX, and Internet Explorer. Just kidding, I won't use IE ...

... not that I haven't built a complete blogging solution before.

Javascript: Introducing Using (.js)

by Jon 4/12/2008 3:37:00 PM

I'm releasing v1.0 of using.js which introduces a new way of declaring dependency scripts in Javscript.

http://www.jondavis.net/codeprojects/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  

The way it works is simple. Add a <script src="using.js"> reference to the <head> tag:

<html>
  <head>
    <script type="text/javascript" language="javascript" src="using.js"></script>
    <script type="text/javascript" language="javascript">
      // your script here
    </script>
  </head>
  <body> .. </body>
</html>
 

Then in your script, register your potential dependencies. (These will not get loaded until they get used!) 

using.register("jquery", "/scripts/jquery-1.2.3.js"); 

Finally, when you need to begin invoking some functionality that requires your dependency invoke using():

using("jquery"); // loads jQuery and de-registers jQuery from using
$("a").css("text-decoration", "none");

using("jquery"); // redundant calls to using() won't repeat fetch of jQuery because jquery was de-registered from using
$("a").css("color", "green");

Note that this is only synchronous if the global value of using.wait is 0 (the default). You can reference scripts on external domains if you precede the URL in the using.register() statement with true and/or with an integer milliseconds value, or if you set the global using.wait to something like 500 or 1000, but then you must write your dependency usage scripts with a callback. (UPDATE: v1.0.1: Simply providing a callback will also make the load asynchronous.) No problem, here's how it's done:

using.register("jquery", true, "http://cachefile.net/scripts/jquery-1.2.3.js");
using("jquery", function() {
  $("a").css("text-decoration", "none"); //async callback
});

Oh, and by the way, using.register() supports multiple dependency script URLs.

using.register('multi', // 'multi' is the name
    '/scripts/dep1.js', // dep1.js is the first dependency
    '/scripts/dep2.js'  // dep2.js is the secon dependency
  );

UPDATE: I just mostly rewrote using.js. Now with v1.1 you can now add subdependencies, like so:

using.register('jquery-blockUI', true,
  'http://cachefile.net/scripts/jquery/plugins/blockUI/2.02/jquery.blockUI.js'
 ).requires('jquery');

Basically what the new .requires() functionality will do is when you invoke using('jquery-blockUI'); it will also load up jquery first.

UPDATE 2: With v1.2 I've added several new additional touches. Now you don't *have* to declare your subdependencies with using.register(), you can just say:

using('jquery', 'jquery-blockUI', function() {
  $.blockUI();
});

This assumes that jQuery and blockUI have both been registered, the latter without the .requires('jquery') invocation.

That said, though, you don't even have to call .register anymore if you don't want to:

using('url(http://cachefile.net/scripts/jquery/1.2.3/jquery-1.2.3.js)', function() {
  alert($.fn.jquery);
});

There are also two new features that *should* work but I haven't written tests yet:

  1. using.register([json object]); // see using.prototype.Registration
    • object members, and the arguments for the compatible using.prototype.Registration prototype function, are both:
      1. name (string)
      2. version (string, format "1.2.3")
      3. remote (boolean, true if external domain; invoke requires callback)
      4. asyncWait (integer, milliseconds for imposed async; invoke requires callback)
      5. urls (string array)
  2. Registration chaining:
    • using
        .register("myScript", "/myscript.js")
        .register("myOtherScript", "/myotherscript.js").requires('myScript')
        .register("bob's script", "/bob.js");

UPDATE 3: v1.3 fixes the using('url(..')) functionality so that a script loaded this way is remembered so that is not fetched again if the same URL is referenced in the same way again. This is the reverse of the using.register() behavior, where if a script is loaded its registration is "forgotten". Also made sure that multiple script URLs listed in using('url(..)', 'url(..)'), function(){}); is supported correctly.

If for some strange reason you want the script at the same URL to be re-fetched, try this unsupported hack that might not be available tomorrow:

using.__durls['http://my/url.js'] = undefined;

UPDATE 3.1: V1.3.1 should hopefully fix the "not enough arguments" error that some Firefox users have been having. I was never able to reproduce this, but I did discover after doing some research that Firefox supposedly expects null to be passed into xhr.send(). I guess some systems suffered from this while I didn't. At any rate, I'm passing null now.

If you have bug reports or suggestions, please post comments here or e-mail me at jon@jondavis.net.

kick it on DotNetKicks.com

Currently rated 4.2 by 13 people

  • Currently 4.230769/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Software Development | Web Development

MVC On The Client In Javascript

by Jon 3/31/2008 9:30:00 PM

I stumbled across this over the weekend.

http://javascriptmvc.com/

I was actually very surprised by how closely it resembles what we've been working on at the office. Ours uses a controller to manage and control events and event propogation, track "view objects" (we call 'em "client controls" for drag-and-drop support in Visual Web Developer) and manage AJAX calls. And we've spec'd out to use RESTful URIs to manage data model retrieval and callbacks, and these are cacheable using Google Gears, Flash storage, or *shrug* cookies.

Theirs has a few additional features, though, some of which I think we can glean from, like:

  • script librarian ("Include"), which we don't need but I think we could accomplish using something like JSLoader
  • a complete ActiveRecord-like modeling pattern
  • a complete ASP-like templating system that executes on the client
  • "everything is a plug-in" philosophy

I like what I see, although our own framework goes further as it is built with ASP.NET, ASP.NET MVC, Visual Studio, and Expression Web all in mind. With ours, we enable our web designer, who is not an engineer, to create a complete, non-Flash RIA web pages without coding. Using Expression Web or Visual Web Developer, he can click on one of our controls in the Toolbox, drag it out to the page, absolutely position it, stylize it, give it a data source URI, and have it subscribe to other controls' events (think Flash video player, responding to the events of media playback controls). The entire multi-page web site will support executing in the rich execution environment of a single-page RIA application with a seamless user experience. And since the framework is not done in Flash (although Flash "client controls" are supported), it will support continuous extensions using the wonderfully universal languages of HTML and Javascript, both at design-time (creating new controls, customizing existing controls) and at runtime (RESTful fetches of web content, dynamic execution of JSON models, etc).

In some ways, ours is looking like http://www.wavemaker.com/, except that WaveMaker is based on Java and dojo, and the designer experience is in-page (which is way too much support overhead--why reinvent the designer when Visual Studio / Expression Web can do the job on its own?).

But I'd certainly recommend Javascript MVC (JavascriptMVC.com) as a skeleton foundation framework for someone to roll their own framework. We were thinking about open-sourcing our client bits once we are done with our prototype, but I think Javascript MVC comes close enough that it would do just as well to recommend that one instead. Mind you, I have never used it, I'm only suggesting it based on what I'm seeing at their web site.

kick it on DotNetKicks.com

WebToolkit.info Scripts Wrapped

by Jon 3/29/2008 7:59:00 PM

A buddy and I were poking around at the sample scripts at http://tide4javascript.com when my buddy noticed a crc32 implementation. I followed the trail and found a number of interesting utility scripts at webtoolkit.info.

I thought they were pretty worthy so I wrapped them up and packaged them as a utility library and posted it here:

http://cachefile.net/scripts/webtoolkit.info/ 

I also added a test page, which also makes for a decent quick and dirty demo page.

http://cachefile.net/scripts/webtoolkit.info/2008.03.30/test.html 

UPDATE: I stumbled upon a blog post called "Top Ten Javascript Functions of All Time" (http://www.dustindiaz.com/top-ten-javascript/). I decided to append these functions. I quickly deprecated the webtoolkit.info URL and made it just "webtoolkit".

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Web Development

Oliver Steele, Javascript, and Data Models

by Jon 3/29/2008 7:48:00 PM

Ugh, just when I was getting all smug about our progres with CRUD operations and how we've designed a rediculously simplistic yet powerful approach to our new Javascript framework at the office, my co-worker finds this and asks, "Hey, why aren't we doing it this way?"

http://osteele.com/archives/2008/02/synchronizing-client-models

And then I realize we're just not doing enough. Good blog post, though.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Web Development

Highlighting a TR (HTML Table Row) With A Border

by Jon 3/29/2008 8:44:00 AM

Here's another workaround to fix another elementary problem in Internet Explorer. Again, this isn't anything new, but if anyone is coming across this blog looking for an answer to this problem, here's the solution.

(And by the way, yeah, this is really elementary. I should be focusing on real problems.)

Someone in a local technology mailing list asked for help on how one highlights a table row in Javascript. He tried the following function, but it did not work for him.

function OutlineTableRow(RowID,BColor,BWidth,BStyle)
{
 var TableRow = document.getElementById(RowID);
 if(TableRow)
 {
  TableRow.style.borderColor = BColor;
  TableRow.style.borderStyle = BStyle;
  TableRow.style.borderWidth = BWidth;
 }
}

So how to you border-highlight a row in HTML? Internet Explorer doesn't support CSS on the TR like it should. You have to do it on the cells themselves. You also have to be careful not to divide the cells with borders; the leftmost and rightmost cells should be the only cells to get left or right borders, respectively. Finally, you must also set the border-collapse CSS property on the table to "collapse", otherwise the border itself will have seperation points on the inner edges of each cell.

Here's my workaround in Javascript, feel free to copy:

<html>
    <body>
        <table>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
            </tr>
            <tr id="aa">
                <td>1</td>
                <td>2</td>
                <td>3</td>
            </tr>
            <tr>
                <td>1</td>
                <td>2</td>
                <td>3</td>
           </tr>
        </table>
        <script type="text/javascript" language="javascript" >
            function outlineTableRow(rowId, borderColor, borderWidth, borderStyle){
                var tableRow = document.getElementById(rowId);
                if (tableRow) {
                    var table = tableRow.parentNode;
                    while (table.tagName.toLowerCase() != "table") {
                        table = table.parentNode;
                    }
                    table.style.borderCollapse = "collapse";
                    var tableCells = tableRow.getElementsByTagName('td');
                    if (tableCells.length > 0) {
                   
                        for (i = 0; i < tableCells.length; i++) {
                            if (i == 0) {
                                tableCells[i].style.borderLeftColor = borderColor;
                                tableCells[i].style.borderLeftStyle = borderStyle;
                                tableCells[i].style.borderLeftWidth = borderWidth;
                            }
                            else
                                if (i == tableCells.length - 1) {
                                    tableCells[i].style.borderRightColor = borderColor;
                                    tableCells[i].style.borderRightStyle = borderStyle;
                                    tableCells[i].style.borderRightWidth = borderWidth;
                                }
                            tableCells[i].style.borderTopColor = borderColor;
                            tableCells[i].style.borderTopStyle = borderStyle;
                            tableCells[i].style.borderTopWidth = borderWidth;
                            tableCells[i].style.borderBottomColor = borderColor;
                            tableCells[i].style.borderBottomStyle = borderStyle;
                            tableCells[i].style.borderBottomWidth = borderWidth;
                           
                        }
                    }
                }
            }
           
            window.onload = function(){
                outlineTableRow('aa', '#f00', '2px', 'outset');
            }
        </script>
    </body>
</html>

Result:
1 2 3
1 2 3
1 2 3

But one should use CSS for this. Rather than explicitly setting [element].style.[cssproperty], instead one should set the className property, then define the details in CSS. If you really want to pass arbitrary styles to a function, jQuery would also be essential for doing this. Come to think of it, jQuery would be essential, regardless.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Web Development

JSON and XML View Engines in ASP.NET MVC

by Jon 3/28/2008 11:28:00 AM

I posted earlier that we're working on a client-side MVC framwork that compliments the ASP.NET MVC framework. It's actually not formally MVC on the client, but it comes close. The view side is entirely controller-driven, even the event model. The "model" side of it is the ASP.NET server itself. So the server spits out both templated markup for the client-side controls, as well as the AJAX'd data models. These data models are models to the client but they are views to the server, or at least that's the way we're designing it.

So my co-worker posted his solution to XML and JSON callbacks, since ASMX is not MVC-friendly. It's a JSON view engine for MVC.

"I recently saw Scott Guthrie at a local .NET User Group event, and he mentioned that the ASP.NET MVC Framework was completely "pluggable", and you could easily replace the built-in View Engine.  So, I immediately searched for examples, found one ... tossed it out and whipped together a really quick and simple 'JsonViewEngine' class. Here's the code ..."

http://www.fragmentedcode.com/2008/03/27/jsonviewengine-for-aspnet-mvc-framework/

kick it on DotNetKicks.com

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , , ,

Software Development | Web Development

XHTMLJS Moved To CodePlex

by Jon 3/27/2008 5:24:00 PM

XHTMLJS has a new home on CodePlex!

http://www.codeplex.com/xhtmljs

Would be nice to get some community support (i.e. feedback, bug reports, code editors) going.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Open Source | Web Development

jQuery Flexigrid

by Jon 3/27/2008 5:17:00 AM

Ooohh.. I was digging the grid at http://www.extjs.com/ but we're already using jQuery, and wow this is really nice. http://webplicity.net/flexigrid/

I love the excellent pagination implementation at the bottom. And I love how little code it takes to make it "go". I love jQuery!

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Web Development