Monthly Archives:

March 2008

Posted on March 27, 2008 by Patrick Force

XML Design in SQL Server 2005

Utilizing the XML data type in SQL Server 2005 can be a good way of creating a more flexible data model. Design of a SQL Server 2005 DB, however, should not discount the use of standard SQL data-type columns and the power of pure relational data. During the design phase, carefully think about what data SHOULD be in XML by identifying areas where the structure of the data could change frequently and/or drastically. Also assess whether particular pieces of data need to be strictly relational (belong in a standard SQL type column), or if they could benefit from a more flexible relational structure such as hierarchical XML elements (XML data type). Think about data placement and if something is a pivotal piece of data for the related system, such as whether it will be searched on often, or even retrieved in searches that will return larger data sets--these types of data are better candidates for standard SQL type columns.

Overall, the basic rule of thumb that I like to follow: if there's little reason to maintain a piece of data in a more flexible structure or relational structure, then don't put it in an XML data type.

In our next tip, we will explore using schema in SQL Server 2005 to define your data in order to more effectively hide the relational/XML split.

| Comments (0) | Technorati Tags :

Posted on March 26, 2008 by Chris Dary

MAMP MySQL Command Line Access

I love MAMP for local development on Mac OS X - it gives you a quick LAMP-style development environment on your machine with zero hassle - and it's free.

If you're a user who also likes using MySQL on the command line to manage your local databases though, it might be a little confusing, because after installing MAMP you can't do so. Just run this in terminal and you should be set:

sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/local/bin/mysql

What this does is add a symbolic link for the mysql binary from MAMP into your executable path - in this case, within /usr/local/bin/

Incidentally, /Applications/MAMP/Library/bin/ is where you'll also find all the other MySQL binaries, like mysqldump.

Warning: If you've installed MySQL manually as well, this may interfere with that installation, so don't do this if you have!

| Comments (3) | Technorati Tags :

Posted on March 26, 2008 by Andy Lewisohn

Posting XML as a parameter to a SOAP WebService Method

SOAP is an XML-based communication protocol, but you can't actually pass XML to a SOAP method without a little bit of finessing. The reason for this is straightforward: XML is not a native data type like int, uint, string, etc., and SOAP can be implemented in a number of languages, none of which implement XML in the same way. The ActionScript solution to this problem is simple, but hackish. Wrap the XML document in a CDATA tag and pass the whole thing as a string:
var stringifiedXML:String = "<![CDATA[" + xml.toXMLString() + "]]>"
Now you can pass a stringified XML document to your SOAP service without worrying about special characters.

| Comments (0) | Technorati Tags :

Posted on March 25, 2008 by Matt Williams

Unix Directory Creation

One of the most common inefficient habits of Unix users is iterative directory creation:

$ mkdir project
$ cd project
$ mkdir docs
$ cd docs
$ mkdir html

You may (or may not) already be aware of the -p flag, which allows you to create parent AND child directories in one command:

$ mkdir -p project/docs/html

Not many people are aware, however, that you can create arbitrarily complex directory trees using the -p flag and some curly braces:

$ mkdir -p proj/{bin,etc,docs/{html,txt,pdf},src}

If the example above represented a common project layout, you could add a quick alias to .bashrc in your home directory:

alias mkproj="mkdir -p proj/{bin,etc,docs/{html,txt,pdf},src}"

| Comments (1) | Technorati Tags :

Posted on March 20, 2008 by Avi Flax

Avi's REST Tip #1: Resources First

When designing a RESTful web application, many of us will frequently jump right to representations--what types should be offered, how their content should be structured. This is particularly true when the primary representation type of an application is XML - often we'll have something in mind, we can almost see the XML document structure needed to accomplish the goal, so why not just start with that?

Because you've got to define what it is that your representation is representing before you define the representation. The reason is simple: your representations will be better, because while you're crafting them, you'll have in mind the thing that you're representing

This may seem kind of obvious, and the truth is, I think I agree. It is obvious - but only if you're designing this application on your own. Once you're designing an application with one or more other people, there's a very good chance that you don't all have exactly the same conception of your resources - and the best way to obviate that is to clear that up from the get-go. Start with your resources.

| Comments (0) | Technorati Tags :

Posted on March 20, 2008 by Tim Meaney

Trailblazers

I'm guessing that if you're reading this blog, you've previously encountered As We May Think, Vannevar Bush's essay in The Atlantic Monthly foretelling much of computing revolution, and importantly its effects on how we think and interact with information.  I read it years ago and found it amazing that someone contemplated this so long ago (mid-1940s.)

I'm reading The American Idea, a collection of some of the most influential essays printed in the Atlantic in its first 150 years of publication, and again encountered As We May Think.  It's stunning, imagine the context in 1945 in which he wrote this piece.  Most interesting was his observation that the collection of human knowledge was far out-pacing our ability to keep up with, and importantly, interact with, this knowledge.  His invention, manifest in a machine, the Memex, was hypertext media.  I won't do it justice to provide commentary, or pull out selected quotes, you should go and read it entirely.

When you're done reading this piece, also order the book, it's filled with similarly influential items which have driven all aspects of American society.

| Comments (0) | Technorati Tags :

Posted on March 19, 2008 by Javier Julio

Debugging Data Through the Console in ColdFusion 8

If you start the ColdFusion server by using the command line, you should note several of the enhancements made to the <cfdump> tag. One of them is a new attribute named "output" which can dump data to the browser (default), output to a file (set an absolute file path), or output to the server console. A simple example:

<cfdump var="#variables#" output="console">

I've been working on a Flex/ColdFusion project that makes remoting calls to CFCs. Debugging has become a breeze by simply setting the output attribute to "console" which then appropriately formats the data dumped to the console. Out of the many new features in CF8, this is the one I've used the most.

| Comments (0) | Technorati Tags :

Posted on March 17, 2008 by Corey Maass

Avoiding Repetitious Code in JQuery

A good tip in any coding language is to not repeat code. If you find yourself using a bit of code more than once, make it a separate function. In JQuery, you have the advantage of expanding the JQuery object to include your code. If you want to have the code process JQuery-selected items, use jQuery.fn.nameOfFunction. Otherwise, use jQuery.nameOfFunction. Finally, if you find yourself extending JQuery a lot, use jQuery.fn.extend and put all your code in one place.

1) JQuery extended function when you want to access a JQuery array of elements: Example use: 2) JQuery extended function: Example use:

| Comments (0) | Technorati Tags :

Posted on March 17, 2008 by Richard Ziade

Eliminate Interface Clutter With Arc90 Lab's Collapsible Panel! (As Seen On TV)

4 drawers base cabinetI'm one of those people that goes to great lengths to keep my visible workspace clean and uncluttered...at any cost. I revel in the clean, straight lines around my desk. Open up one of my drawers and it's a whole other story, though. Out of sight, out of mind. Yes, it borders on anal-retentive hypocrisy, but still.

It's not a whole lot different for user interfaces. Sometimes, an easy and familiar way to "put away" interface clutter is to give users the ability to "hide away" parts of the interface. The Flex interface library is really great. It has just about everything you need to build rich, slick interfaces...except a drawer to put all my junk in.

Our own Andy Lewisohn has changed all that. Today on the Lab, we're releasing a collapsible panel custom component for Flex. It's simple to implement and nicely fits into the existing Flex UI framework.

So get on over there and grab it...and start hiding that clutter!

| Comments (7) | Technorati Tags :

Posted on March 17, 2008 by Patrick Force

String Concatenation vs. StringBuilder

When developing applications, a common concern often creates a battle in the mind of the developer: How can I write this to make it easier to maintain, versus how can I optimize performance?

The debate of string concatenation via the + operator vs. StringBuilder in Java illustrates one tip on how to approach the higher level argument in this particular case:

String s = "";
for(i = 0; i <= 10000; i++)
{
    s += " word";
}

vs.

StringBuilder stringBuilder = new StringBuilder();
for(i = 0; i <= 10000; i++)
{
    stringBuilder.append(" word");
}

In most every case, using StringBuilder will prove faster than the string concatenation. Performing concatenations 5-10 times and above in a single operation may justify using StringBuilder for performance reasons, but never so much as to sacrifice clean code or the easier ability to manage what you've written. For instance, consider the following:

String s = "<Customers>" +
               "<Customer>" +
                    "<Name>Steven Jones</Name>" +
                    "<Address>123 Greenwich St.</Address>" +
               "</Customer>" +
               "<Customer>" +
                    "<Name>Gary Hall</Name>" +
                    "<Address>54 Rector St.</Address>" +
               "</Customer>" +
          "</Customers>";

For this particular case, I'd drastically prefer to write and work with the above piece of code before having to deal with the alternative w/ StringBuilder:

StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("<Customers>");
stringBuilder.append("<Customer>");
stringBuilder.append("<Name>Steven Jones</Name>");
stringBuilder.append("<Address>123 Greenwich St.</Address>");
stringBuilder.append("</Customer>");
stringBuilder.append("<Customer>");
stringBuilder.append("<Name>Gary Hall</Name>");
stringBuilder.append("<Address>54 Rector St.</Address>");
stringBuilder.append("</Customer>");
stringBuilder.append("</Customers>");
String s = stringBuilder.toString();

In fact, I can't believe I even finished the StringBuilder example because it felt like such a waste of time, not to mention for this particular case of an XML string, it's not nearly as friendly to traverse through with StringBuilder.

Basically StringBuilder can produce performance gains (somewhat noticeable at very large iterations), but a developer should base his decision of whether to use + concatenation or StringBuilder primarily on ease of implementation and maintenance.

| Comments (0) | Technorati Tags :

Posted on March 14, 2008 by Chris Dary

Emphasize Selected Radio Options with jQuery

I've always felt like selected radio options didn't really have enough weight by default. A mere filled in circle seems to be a throwback to our paper based origins, and reminds me of the days of standardized testing.

To give your radio buttons a little extra oomph, I like this little jQuery script that emboldens the currently selected label.

Continue reading "Emphasize Selected Radio Options with jQuery" »

| Comments (2) | Technorati Tags :

Posted on March 13, 2008 by Avi Flax

WizTools.org RESTClient 2.1 Released, Lauds Yours Truly

RESTClient is an excellent GUI app for RESTful usage of HTTP; kind of like a GUI cURL. It's very useful for testing RESTful web applications, particularly for testers who aren't used to cURL and don't want to learn its syntax for only occasional usage.

Link

| Comments (0) | Technorati Tags :

Posted on March 11, 2008 by Tim Meaney

Memory Lane

For you flickr fans out there -- a really simple and well-executed idea:

Every few weeks, Photojojo's PhotoTimeCapsule will send you an email with your most interesting pictures from a year ago, and allow you to 'store away' a comment for next year.

I find it really interesting to get an email with a few shots from a year ago, maybe you will too.

| Comments (0) | Technorati Tags :

Posted on March 11, 2008 by Ben Sgro

Inserting a PDF Into MSSQL Via PHP

Ever try inserting a pdf in a MSSQL database?

Its not just a simple INSERT. In fact, you have to jump through a number of hoops to get it to work. The included script is invoked with a single argument, the name of the pdf. The script should be edited prior to use so that your database credentials and field names can be set. 

Once it is setup, its as easy as running the script:

chmod x+ insertPDF.php
./insertPDF.php -f fileToInsert.pdf
That's it!

Here's a link to the script:

http://www.arc90.com/_assets/insertPDF.txt

| Comments (0) | Technorati Tags :

Posted on March 11, 2008 by Richard Ziade

100 Calorie Snack-Sized Bites Of Knowledge

HOSTESS-100calories Yeh, big thick heavy technology books are nice and all, but sometimes you want to take in just a bit of knowledge here and there. It's always good to learn a little somethin' as you're wading your way through that mass of content that washes over you in Google Reader.

Well the kids at Arc90 have just the treats for you: Quick Tips. Little mini blog posts that pass along a hint, trick or tip about a particular technology or platform. Here's what the menu looks like:

  • Ben and Matt's PHP Quick Tips
  • Avi and Patrick's Java Quick Tips
  • Javi's Coldfusion Quick Tips
  • Chris and Corey's JQuery Quick Tips
  • Javi and Joel's Javascript Quick Tips
  • Avi's REST Quick Tips
  • Alex and Corey's CSS Quick Tips
  • Joel's .Net Quick Tips
  • Chris and Matt's Unix Quick Tips
  • Andy and Javi's Actionscript and AIR Quick Tips
  • Joel and Patrick's XML Quick Tips
  • Joel and Mike's Database Quick Tips

As you can see, this is all an under-handed scheme to showcase the broad diversity of knowledge here at Arc90 (as well as, you know, share knowledge and stuff). Since all the Quick Tips are just blog posts, feel free to chat with us about them via comments or email.

So have at it kids. It's snack time!

| Comments (0) | Technorati Tags :

Posted on March 4, 2008 by Avi Flax

NIN at the Cutting Edge of Music Distribution

With the release of their new album Ghosts I-IV, Trent Reznor's Nine Inch Nails have raised the bar of music distribution to the next notch.

The first order page :

NIN_Ghosts_Screen_1.png

A great set of options, ranging the gamut from free to $300, from digital downloads to CDs to vinyl to Blue-Ray. I really like that the options are selectable with check boxes, so, for instance I could order the $5 download and the $10 2-CD set, with a single transaction, without having to add them to a "shopping cart" and then "check out".

If you click the "more info" link under the $5 download option, this graphic pops up:

Again, a great set of options, covering a full range of convenience, quality, and ideology. The rest of the ordering process is straightforward and effective. I didn't think of getting screen shots, but the screen where you choose which file format you want - which smartly appears during the "pickup" phase, after payment - is clear and - again - effective.

I actually like that the non-free download option has a fixed price of $5 - there's less to decide than a name-your-own-price scheme such as Radiohead used for In Rainbows, and it means that I know that the musician is good with the price. Plus it's just a bargain - 36 CD-quality DRM-free tracks for $5!

ReadWriteWeb has some good background about Reznor's previous attempt at digital music distribution. The Wall Street Journal's Business Technology blog laughably describes BitTorrent as an "underground filing-trading service." (And who wrote that post anyway? It's anonymous! Lame.)

Tip: Downloaded the album, and wondering where to keep that nice PDF booklet? If you use iTunes, you can just drop it in to your library, right next to the tracks themselves. I even set the Artist and Album fields so that the booklet shows up in the track listing.

| Comments (0) | Technorati Tags :

Posted on March 4, 2008 by Chris LoSacco

Searching for the Right Mouse

I use (and love) a MacBook Pro at work and home. At work, my desk setup centers around an external monitor, so I wanted an external keyboard and mouse. Early on, I tried Apple's Wireless Keyboard, on a recommendation from Avi, and it was great. Very easy to type, very comfortable and, best of all, wireless via Bluetooth.

But finding a good mouse was a different story. At first, I stayed with a wired mouse, for two reasons: (1) weight -- wireless mice are typically heavy with battery weight -- and (2) lag. I sometimes do design work, and I can't have the mouse pointer lagging even a little bit. The wired mouse was okay for a long while, but the wire started to bug me, and just like that, I started looking around for good wireless mice.

At first, I was looking only at Bluetooth mice. Rich let me try his Microsoft Wireless Notebook Presenter Mouse 8000, which worked well for a few weeks, but lagged every so often, and was bordering on being too small. It also didn't reliably wake up my computer, because the radio would shut off automatically. That was annoying.

I was telling Rich about this and he suggested that I try Logitech's VX Revolution. I've always liked Logitech's mice, and he said this one specifically was very nice. It uses a USB dongle, but it has a storage mechanism inside to hide it away when not in use, and since I don't regularly use all of my USB ports, I gave it a shot.

Long story short: it's pretty awesome. Very smooth, very lightweight, no lag whatsoever, scroll wheel that switches between click and no-click styles, and a comfortable, not-too-big-but-not-too-small size. There are also a bunch of little touches, like the fact that when you store the dongle in the mouse, it turns off; when you eject it, the mouse turns back on, so it's instantly ready to go. Awesome.

I'd highly recommend it to anyone who is looking for a high quality wireless mouse.

| Comments (2) | Technorati Tags :

February 2008 | Main | April 2008