CMXtraneous: Dreamweaver

Right on the edge of useful

DW connections problem & solution

Posted Wednesday, June 29, 2005 11:29:47 AM by Heidi Bautista

Heidi Bautista

I recently installed SP1 on my Win2003 server box and discovered that DW could no longer introspect my databases. I'm not positive that the problem is due to SP1 but I can't think what else has changed from when it worked to when it didn't.

Symptoms: Connections test successfully and Live Data mode works fine but DW can't find the tables, views, and stored procedures when you expand the nodes in the Databases panel in the Application panel group. (Similar problem seen in the DataSet dialog, too.)

Solution: I tracked the problem to the MMHTTPDB.js file in the _mmServerScripts folder. This folder resides under the root of your site. Specifically, I modified the calls to OpenSchema by removing the 2nd, optional, parameter. Everything worked just fine then.

Old code:

return MarshallRecordsetIntoHTML(this.Connection.OpenSchema(adSchemaTables,VBVariant));

New code:

return MarshallRecordsetIntoHTML(this.Connection.OpenSchema(adSchemaTables));

As far as I can tell there are no adverse side effects when the optional argument is removed. Of course, the bad news is that you have to make this change for all websites that you're working on that are hosted on a Win2003 server that's been upgraded to SP1.

Anyone else out there experience this problem? If you try this fix, please write back and let me know if it works for you and if you see any problems with this solution.

Category tags: Dreamweaver

SQL function to chop a field by number of words

Posted Monday, June 20, 2005 6:37:59 PM by Tom Muck

Tom Muck

I was prompted by a question on the CMX forums today to finally break down and write a function to return a number of words from a database field, which I've been meaning to do for a long time. There are script examples on the web for ASP and ColdFusion code to truncate a specific database field to a certain number of words (split at the word rather than mid-word, as the LEFT function does), but there is no easy way to do it in SQL, unless you use a loop. The following function will truncate any field to a specific number of words. Pass in the string you want to parse, and the number of words to return.

CREATE FUNCTION fnGetNumberOfWords (
  @stringToSplit varchar(8000),
  @numberOfWords int
)

RETURNS varchar(8000) AS

BEGIN

DECLARE @currentword varchar(8000)
DECLARE @returnstring varchar(8000)
DECLARE @wordcount int
SET @wordcount = 0
SET @returnstring = ''
SET @currentword = ''
SET @stringToSplit = ltrim(rtrim(@stringToSplit))
Declare @index int

WHILE @wordcount < @numberOfWords AND len(@stringToSplit) > 0
  BEGIN
    Select @index = CHARINDEX(' ', @stringToSplit)
    if @index = 0
      BEGIN
        SELECT @currentword = ltrim(rtrim(@stringToSplit))
        SELECT @wordcount = @numberOfWords
      END
    else
      BEGIN
        IF (len(@stringToSplit) - @index > 0) BEGIN
        SELECT @currentword = ltrim(rtrim(LEFT(@stringToSplit, @index-1)))--the new shortened string
        SELECT @stringToSplit = RIGHT(@stringToSplit,LEN(@stringToSplit) - @index) -- the rest
      END
    END
  SELECT @returnstring = @returnstring + ' ' + @currentword
  SELECT @wordcount = @wordcount + 1
END

SET @returnstring = LTRIM(@returnstring)
RETURN @returnstring

END

Call it like this:

SELECT dbo.fnGetNumberOfWords(MyField, 10) FROM mytable

(returns first 10 words from MyField)

The advantage to doing it in the database rather than on the web page, is that you are only returning a small portion of the field to the web page, rather than the entire field. This can speed up the query. A few preliminary tests show that the smaller number of words you return, the quicker the query will execute. In other words, if your query returns a field that can contain up to 8000 characters in it (like a blog entry, for example) and you only need the first 50 words for a summary, the query to return the 50 words will be faster than a query that returns the whole field. Also, your scripted page will execute faster because it is simply displaying the field and not performing any further logic, looping, or parsing on the field.

I talked about user-defined SQL functions in one of my articles at Community MX as well:

Using CSV Strings in SQL Server: Part 2

Note that the function does not work on text or ntext data types. I hope you find it useful.

Category tags: ColdFusion, Community MX, Dreamweaver, SQL Server

When in Doubt, Grok It!

Posted Sunday, June 19, 2005 11:16:55 PM by Stephanie

Stephanie

I don't know how many of your tried Grokker in its first permutation (it had to be downloaded and installed and didn't work well for me on the Mac at all), but I got a note this week that they've relaunched. Since all my company just left and I'm exhausted, I thought I'd have a look. I was pretty impressed with the improvements.

I suppose I should have started, for those that don't know, by answering the question, "What the heck is Grokker?" Grokker reminds me a bit of my old favorite search engine, Northern Lights. I loved Northern Lights because it categorized my search results into folders. Thus, if there was a variety of subjects my search words could apply to, I could quickly see them, click the folder for the one closest to what I was looking for and drill down from there. It's a shame they went private.

Anyway, Grokker does similar, by showing the relationships generated by your search. You can customize it, but by default, it will show you orbs and squares inside circles (which represent the sites that fall into those subject/categories), labeled with the category name. You can drill/zoom down into these and see more. Hovering shows you the details of the link you're over. If a page appears in more than one circle, when you hover over it, it will light up in the other circle as well. I realize it's late, I'm tired, and this likely isn't making any sense at all. Hey, it's a visual tool -- have a look at the features yourself.

One of the main things I like now though, is that I don't have to download it as a stand alone. I can now use it on the web. There are advantages to downloading if you decide you really love it. You can share your map with a friend and Grokker will save it more than the 14 days it's saved in the web-based version. The free-standing "for purchase" version is much more full-featured and looks like it would be great for research and serious use, but the online search is excellent for simple searches and checking Grokker out.

I found that on a Mac, since Grokker is Java-based, Safari works very smoothly (Firefox didn't seem to know I had Java). The only negatives to me are, the results are pulled from the Yahoo! Search results (that's probably fine, I just prefer Google), and I can't do a text search for something specific within my results page (since it's a Java visual). But for certain types of searches, this is very cool. If you're a visual person, or doing a good deal of research on a specific subject, you owe it to yourself to view this cool little search tool.

Category tags: Dreamweaver, Mac, Search

Introducing CMX JumpStart Vegas

Posted Thursday, June 02, 2005 8:23:33 AM by Sheri German

Sheri German

Designed by Fireworks expert Linda Rathgeber-Stewart and coded by CSS guru Stephanie Sullivan, the new CMX JumpStart Vegas is sure to please with its long list of features, including sIFR and a Flash Slide Show. Originally created for TODcon attendees at the recent conference in Las Vegas, we are now making it available to CMX subscribers, as well as for independent purchase.

Having just attended TODcon in Vegas, I think I can accurately call Vegas a paragon of excess and glitz. Keeping that in mind, we created a JumpStart that is crammed with features: Flash slideshow, FlashObjects, sIFR, a complex form, the glitter of a golden design--it's all there, ready for you to adapt for your own sites. You can see my own adaption of the template for the redesign of the Stein Opera site, which follows and catalogs the creation of an opera based on the life of Gertrude Stein. "Gertrude Stein Gets a Jump Early On" premieres in New York City this month. Stein Opera Images

Like all of the CMX JumpStarts, the pages are constructed using valid XHTML 1.0 markup and formatted using valid CSS 2.1 styling. Vegas also follows the WAI and Section 508 accessibility guidelines to provide you with a solid foundation for your work.

Category tags: CSS, Dreamweaver, Flash