40 posts
Showing 20
| Next
(page 1 of 2)
Dreamweaver crash after time change
Posted Monday, November 05, 2007 11:45:00 AM by Tom Muck
We recently had one of these ridiculous time changes in the US for Daylight Savings Time, as if shifting the hours of the day 1 hour back or forward has any effect on anything beyond annoyance. Apart from being just silly, it also wreaks havoc with many computer functions -- especially on Windows 2000 and earlier, where the time change dates are not updated to the new dates mandated by our hard-working Congress last year.
Aside from that, Dreamweaver also has fits and crashes regularly after the time change. To fix the problem, the cache file in your local settings needs to be deleted. It will recreate itself automatically. Information on that is here.
Category tags: Adobe, ColdFusion, Dreamweaver
Posted by Tom Muck
Add comment |
View comments (6) |
Permalink
|
Trackbacks (0)
|
Digg This
Multiple languages in a web site
Posted Thursday, November 09, 2006 11:59:51 PM by Tom Muck
The last part of a 3-part series I wrote about building a multi-language site goes live today at Community MX. I've seen different ways of creating data-driven multi-language sites, but the method I used in the series uses an incredibly underused technique involving ColdFusion custom tags. Basically, the technique will turn any simple, well-formed HTML or XHTML page into a content management system with only one tag required on the page. Using <cfimport> you can create custom tags using any name you want -- including the names of HTML tags. What that essentially means is that your h1, h2, h3, p, a, td, th, and any other tag you want to use can become a custom tag with the full power of the ColdFusion language.
Maybe it's been done before, but I devised the system because I'm lazy -- I didn't want to have to rewrite pages and have to type content again. The system actually sucks the current content out of your site and puts it in the database -- and then from that moment on uses the content from the database instead. Also, the fact that you can use ColdFusion code in the custom tags allows you to insert things like administrative links to edit content.
The article series shows the construction of the base custom tag, the custom tags that take the place of the html tags, and the administrative page that allows you to edit and update content in 1 or more languages. The first part was a freebie, and part 2 and part 3 are free for subscribers and a small fee for non-subscribers.
Category tags: Adobe, ColdFusion, Community MX, Dreamweaver
Posted by Tom Muck
Add comment |
View comments (1) |
Permalink
|
Trackbacks (0)
|
Digg This
Life of a road musician
Posted Sunday, September 03, 2006 1:41:55 PM by Tom Muck
I wrote about harmonica virtuoso Jason Ricci on my blog a while back. It has always been amazing to me how some people can rise to the top and become successful while others more talented are often neglected or have to work like dogs to make a living. It has always been the case, unfortunately. A band I played with for over 10 years could never break out the grind of being a part-time local band. We all had day jobs because none of us had the willingness to take a chance on a shot that might never happen. A new article at Mercury News ( http://www.mercurynews.com/mld/mercurynews/entertainment/15421107.htm) talks about Ricci's trials and tribulations on the road playing 300-320 nights a year for little money:
"Everyone keeps telling me they know someone, or they can help me, but nothing ever happens. I'm going to play 320 nights this year for a few hundred dollars a night. I'm getting really tired of it. I don't think it's ever going to happen."
His playing is a revelation, and at times seems beyond human capacity, hitting notes that few other players can find. Sometimes he stretches out impossibly long blue notes. Then he fires off a machine-gun-fast, perfectly precise volley to get people dancing.
At one point, he does a tribute to great harmonica players, including Little Walter and Magic Dick, wrapping their hardest riffs inside even harder ones of his own, orchestrating a solo symphony of five songs simultaneously.
And he doesn't just do it for an hour or two, like most performers. He runs at top speed for four hours a night, playing and singing, with barely a break between songs.
"He is to the harmonica what Eddie Van Halen was to the guitar," said Robert Bonfiglio, one of the world's most respected classical harmonica players, who saw Ricci play for the first time in Denver last month at the 43rd annual convention of the Society for the Preservation and Advancement of the Harmonica. "He has changed the instrument. It will never be seen the same way again. Players after him will want to sound like that."
I finally saw Jason a couple months ago locally and was blown away, not only by the amazing virtuosity of his playing, but also by his willingness to hang out with the fans and talk shop. His band is hot, and the music is original and catchy. Hopefully the word will get out on Jason Ricci and New Blood. The times seem right:
At a time when harmonicas have been getting the most recognition in years -- from "American Idol" winner Taylor Hicks to "America's Got Talent" runner-up L.D. Miller -- Ricci has been packing blues clubs across the country. He's played more than 300 shows each of the past five years.
I've been focusing more and more recently on my own harmonica playing, but I do it strictly for fun and love of music. I have come to the realization a long time ago that I have neither the drive nor the talent to ever become a full-time musician. Still, listening to Jason's playing has only made my own playing stronger.
Jason's site is at http://www.jasonricci.com. Stop by and buy a CD, or check out the tour schedule for a show near you.
Cross-posted at tom-muck.com.
Category tags: ColdFusion, Music
Posted by Tom Muck
Add comment |
View comments (1) |
Permalink
|
Trackbacks (0)
|
Digg This
Trackback spam be gone!
Posted Wednesday, March 22, 2006 7:00:47 PM by Tom Muck
I think I have finally taken a bite out of trackback spam. When I instituted trackbacks on these blogs, it worked well. . .for a couple of months. The next time I looked, there were literally thousands of spams that had to be deleted. It seems once these spammers find you, they add you to their automated spammer machines and hit you relentlessly. Filtering by keywords was the first defense, and it worked on 90% of the spam. The problem is, every new spam contains some new spammer product or service. . .acne treatments, cricket blogs, disney vacations. I can't possibly keep up with all of it.
Rather than submit to these parasites or remove trackback functionality, I added functionality that automatically checks every link in the trackback post, goes out to each linked site, reads the site content, and checks for a reference to the post being trackback linked. If there is no reference to the post, the trackback is not legitimate. In those cases, I check the whois and grab the information in put it into my database. At that point, I can parse the email addresses of the domain holders and send them an automated bill for their trackback spam and send out an automated email to whoever I think the spam should be reported to.
I don't expect to ever get results from the measures, but at least now the trackback spam has dropped off from thousands to hundreds to dozens to zero. I deleted over 16,000 spams from Community MX over the last few months.
Cross posted at http://www.tom-muck.com/blog
Category tags: Blogs and Blogging, ColdFusion, Dreamweaver
Posted by Tom Muck
Add comment |
View comments (3) |
Permalink
|
Trackbacks (3)
|
Digg This
Community MX -- how to find content
Posted Tuesday, February 28, 2006 7:32:16 AM by Tom Muck
Community MX has grown over the years to the point where we will hit 1500 pieces of content tomorrow -- articles, tutorials, and extensions. The following is a list of various ways to keep track of new content and find existing content at Community MX:
Main list of CMX categories:
http://www.communitymx.com/categories.cfm
Main RSS feed
http://www.communitymx.com/services/cmxrss.cfm
Add CMX feed to Google feed reader:
http://www.google.com/ig/add?feedurl=http://www.communitymx.com/services/cmxrss.cfm
Full list of RSS feeds by author, category, most popular searched:
http://www.communitymx.com/services/cmx_opml.cfm
CMXTraneous blog RSS feed:
http://www.communitymx.com/blog/rss.cfm
CMXTraneous full post RSS feed:
http://www.communitymx.com/blog/fullrss.cfm
All CMXTraneous RSS feeds:
http://www.communitymx.com/blog/cmx_opml.cfm
Add CMXTraneous to Google feed reader:
http://www.google.com/ig/add?feedurl=http://www.communitymx.com/blog/rss.cfm
Free Community MXtra Central application:
http://www.communitymx.com/abstract.cfm?cid=EE860
Free Community MX sidebar for Firefox:
http://www.communitymx.com/abstract.cfm?cid=E0069
Free Context Help extension for Dreamweaver, including CMX search:
http://www.tom-muck.com/extensions/help/contexthelptoolbar/
Update: The calendar is a good way to see daily content (thanks Laurie):http://www.communitymx.com/calendar.cfm
Category tags: ColdFusion, Community MX, Dreamweaver, Fireworks, Search
Posted by Tom Muck
Add comment |
View comments (2) |
Permalink
|
Trackbacks (0)
|
Digg This
Context help extension updated for CF 7
Posted Wednesday, February 22, 2006 5:59:22 PM by Tom Muck
After much arm twisting, this past weekend I updated my Context Help extension for Dreamweaver for ColdFusion 7. I am a big fan of the Homesite-style help system -- put your cursor on a tag or function in code view and pull up the help file for that particular keyword. Dreamweaver has similar funtionality, however the help file comes up in the tiny little miniscule useless Reference Panel. Of all the development tools on the market, Dreamweaver and Flash have the worst reference/help systems. This extension attempts to rectify that. You have to be online to use the help system, but it will pull up Livedocs to the appropriate page. There are also buttons on the toolbar for a Google search, Google group search of the Macromedia forums, and a search of Community MX. I've also updated the version at the Exchange. I think this is the most useful extension I've ever done, which is why it is my most frequently updated extension. It also has PHP, ASP, and ASP.NET help, as well as HTML help.
Cross posted at my site.
Category tags: ColdFusion, Community MX, Dreamweaver
Posted by Tom Muck
Add comment |
View comments (0) |
Permalink
|
Trackbacks (0)
|
Digg This
Extracting Bounced Emails with ColdFusion
Posted Sunday, February 05, 2006 10:33:31 AM by Tom Muck
There was a question on the forum today about finding bounced emails in a mailing campaign after retrieving the results with CFPOP. The problem with email bounces is that you can't determine who the mail bounced from by looking at any of the headers: typically the mail server will respond with a message something like this:
----- Transcript of session follows -----
<jack@SOMEDOMAIN.COM>... Deferred: Connection timed out with mail.somedomain.com.
Message could not be delivered for 5 days
Message will be deleted from queue
The message is also frequently loaded with other email addresses, like MAILERDAEMON, or some random characters that seem like an email address (message IDs frequently resemble email addresses). The only way I've found to reliably extract bounced email addresses is to examine each message, extract ALL email addresses, then compare them to the original list. The following function will extract all email addresses from a string:
<cffunction name="getEmailAddresses">
<cfargument name="stringToParse" type="string" />
<cfargument name="emailArray" type="array" default="#ArrayNew(1)#" />
<cfif REFind("([a-zA-Z0-9_\.=-]+@[a-zA-Z0-9_\.-]+\.[[:alpha:]]{2,6})",stringToParse)>
<cfset sLenPos=REFind("([a-zA-Z0-9_\.=-]+@[a-zA-Z0-9_\.-]+\.[[:alpha:]]{2,6})",stringToParse,1,true) />
<cfset emailAddress = mid(stringToParse, sLenPos.pos[1], sLenPos.len[1]) />
<cfset arrayAppend(emailArray, emailAddress)>
<cfset stringToParse = Mid(stringToParse, sLenPos.pos[1] + sLenPos.len[1], len(stringToParse))>
<cfif REFind("([a-zA-Z0-9_\.=-]+@[a-zA-Z0-9_\.-]+\.[[:alpha:]]{2,6})",stringToParse)>
<cfset emailArray = getEmailAddresses(stringToParse, emailArray)>
</cfif>
</cfif>
<cfreturn emailArray />
</cffunction>
call it like this:
<cfset someString = "blah blah email@somedomain.com blah blah blah
morestuff<tom@somedomain.com> more blah blah blah 'test@test.com'">
<cfset emails = getEmailAddresses(someString)>
test it like this:
<cfdump var=#emails#>
What I would probably do is cycle through the emails, grabbing email addresses for each bounced email, then adding all addresses to a database. At the end of the session, compare the list to the original table to find the correct bounced addresses.
I have never used ColdFusion for this because I wrote a VB program that does it in bulk with thousands of emails daily as a scheduled task, but it was a good exercise to do something in CF.
Category tags: ColdFusion, Community MX, Dreamweaver
Posted by Tom Muck
Add comment |
View comments (5) |
Permalink
|
Trackbacks (0)
|
Digg This
Cheap Mac
Posted Friday, February 03, 2006 7:08:22 PM by Tom Muck
I finally broke down and bought a Mac, after many years of saying "I need a Mac." I got it mostly for testing web sites and extensions, but I think I'll be using it for a lot more than that. Microcenter had a deal where you buy a Mac Mini and get a keyboard, mouse, LCD monitor, scanner/printer for free. You can't beat that -- a whole Mac system for $499. I got the upgraded version with the faster processor and 80gig HD for $599.
I started my career using a Mac, but gave it up shortly thereafter to work exclusively on Windows machines (around the time of OS 7.5). I'm pretty amazed by the whole experience. . .I like it. I even downloaded a remote desktop connection so I can access my Windows server from the Mac. Very cool. I like the fact that everything is included in the box, and everything seems to work right out of the box -- wireless network, Bluetooth, etc. If you need a cheap Mac, head to Microcenter before they are all gone.
Category tags: ColdFusion, Dreamweaver
Posted by Tom Muck
Add comment |
View comments (7) |
Permalink
|
Trackbacks (0)
|
Digg This
Laptop: Final Chapter, or What Good is a Blog...
Posted Saturday, January 21, 2006 2:52:28 PM by Tom Muck
I've blogged about my various laptop problems (Toshiba Satellite Pro 6100), and have come to the conclusion over the years that a laptop cannot be depended on. My latest use of the laptop has been strictly using remote desktop to my main workstation, and for things like browsing the Internet and playing poker. Anything that requires storage dependability is not worth putting on a laptop. This includes things like running a web server with ColdFusion, PHP, SQL, etc, and also includes programs like Dreamweaver. After running numerous installs, it seems like I was getting at most a few weeks or months before having to do it all over again. Summing up the various repairs I've had in 3 years:
12 total repairs:
6/30/2003
No boot/video
Reseat VGA board
P000372720 VGA support assembly9/18/2003
Boot failure, no boot
HDD, LCD Hook, HDD Unit (60 GB)3/10/2004
HDD Failure, no boot, grinding HDD
HDD Unit (60 GB)5/7/2004
Cursor drifts every day, unit shorts out and shuts off when moved
Defective PCB Main Board5/12/2004
no boot, just had M/B and video card replaced
Reseat and Secured all internal connections6/4/2004
no boot
Main Board PCB Assembly6/18/2004
LCD goes grey, mouse only works on horizontal axis
Keyboard unit6/23/2004
Boot failure, no display
Power supply, CPU 2.0 GHZ P4 Processor9/14/2004
No boot, blue screen, DVD not working
Update Win DVD11/19/2004
HDD failure, no boot
HDD Unit 60gig12/2/2004
Unit gets extremely hot, fan not working
Main Board7/25/2005
HDD Failure, no boot, grinding HDD
HDD Unit (60 GB)10/30/2005
Unit dead, warranty expired. RIP.
Summing up: 4 hard drives, 4 motherboards, 2 video boards, one P4, one keyboard, and miscellaneous other parts. Luckily I had a 3 year extended warranty, so all repairs were free, but there was way too much time consumed with all this crap. It's not like I abused the machine. It sat on my table and I used it a few hours a night. Once in a while it would go into a bag and be taken to a hotel room where it would sit on a table. Here's the good part: after blogging about it a few times, one of the comments on my blog talked about a lawsuit against Toshiba for the faulty 6100:
The lawsuit alleges that the Satellite Pro 6100 contains a design defect that causes certain power-supply, display and related failures. The lawsuit further alleges that Toshiba knew of, and concealed the existence of, the alleged defect at the time it sold the Satellite Pro 6100. Toshiba denies any and all liability to Plaintiffs and the Class and has agreed to settle the actions for the sole purpose of avoiding the expense and time of further litigation.
Sounds like it applies to me! I signed up at the settlement site and should be getting a credit of $1500 for a new laptop (which I have to spend at Toshiba, unfortunately). The unit was about $2200 originally plus $300 for a warranty, but $1500 is better than nothing and will get me a new laptop. So who says blogging doesn't pay?
Category tags: Blogs and Blogging, ColdFusion, Dreamweaver
Posted by Tom Muck
Add comment |
View comments (10) |
Permalink
|
Trackbacks (0)
|
Digg This
New Years Resolutions
Posted Sunday, January 01, 2006 10:35:03 AM by Tom Muck
New Years Resolutions
Everyone has 'em, but I thought I'd make a list of 10 things I'd like to do this year:
10. Be nicer to people with cloven hoofs.
9. Maintain my 0:1 vomit:year ratio.
8. Scratch my butt less.
7. Spend more waking hours in bed and more sleeping hours at my desk.
6. Never open a bottle of beer with my eye socket.
5. Learn to fly without the use of my arms or legs.
4. Eat kumquats and boysenberrys without giggling.
3. Learn a new trade, like toaster repair or clown tickler.
2. Open a home for wayward midgets.
1. Stop making lists.
Category tags: ColdFusion, On the Personal Side
Posted by Tom Muck
Add comment |
View comments (3) |
Permalink
|
Trackbacks (0)
|
Digg This
New extension for file comparison
Posted Wednesday, November 23, 2005 7:01:14 AM by Tom Muck
In my last post I talked about Beyond Compare and using it to replace the Dreamweaver synchronization feature. It got me thinking about a missing feature in DW. I've been using file comparison programs for quite a while, but only recently discovered Beyond Compare. I used to use Windiff and had my own extension for Dreamweaver MX that allowed me to use Windiff to compare two files. Now that Dreamweaver 8 has the feature, the extension is no longer needed. . .or is it? Dreamweaver 8 has many cool file compare features, but lacks one I like to use: compare a file in your site with a file somewhere else on the system. I reworked the extension to address this. As an added bonus, it works back to Dreamweaver MX and DW MX 2004 (and maybe earlier.)
Find it in my list of extensions at http://www.tom-muck.com/extensions/. It's a free download. I have not tested on the Mac. If anyone runs into issues, please let me know.
Category tags: ColdFusion, Dreamweaver
Posted by Tom Muck
Add comment |
View comments (6) |
Permalink
|
Trackbacks (0)
|
Digg This
Dreamweaver file synchronization
Posted Tuesday, November 22, 2005 9:10:57 PM by Tom Muck
There was a discussion on a Dreamweaver list the other day about local/remote file synchronization in Dreamweaver 8. This is a touchy issue with Dreamweaver, because Dreamweaver has had an incredibly inconsistent history with the Synchronization feature. At one point, it simply did not work. For those who have not used it, you can find it in the semi-hidden Files menu when you click on the icon in the right corner of the Files panel under Site > Synchronize. For this to work semi-properly, you need to check the box in the site setup under the Remote Info tab that says "Maintain Synchronization Information". There are some problems with this feature and other site management features in DW:
- Checking this box also causes little files to be scattered all over your local site -- dwsync.xml. They are contained within the _notes folders that DW scatters all over your site. This causes problems when using source control software -- the software reports changes in these files. Dreamweaver is like a bad dog leaving little piles of poop all over your site.
- The extra DW-droppings also cause problems using the synchronization feature when you have "Show Hidden Files" checked in the Files menu -- you see many of the droppings showing up as files that are different between local and remote.
- When you change your clock settings, files will show as different. I made the mistake of leaving DW open the evening that the clock rolled back for Daylight Savings Time and when I did a synchronization the next day, Dreamweaver reported over 1000 files had changed. That made it quite difficult to find the 3 files that actually had changed.
- When using other programs to modify content, DW does not always seem to know about the change.
- DW's GET and PUT does not always work right, leaving you thinking that a file had been updated when in fact it has not.
There is a technote about the "Dreamweaver droppings" here, and one way to avoid them: http://www.macromedia.com/cfusion/knowledgebase/index.cfm?id=91b33859, however it also renders synchronization useless.
I have always been one to use DW for as much of my work as possible, because I hate to have too many programs open for simple day-to-day operations, but I have come to the realization that DW simply cannot be trusted to handle this seemingly simple operation. I now use Beyond Compare on Windows for this (there is probably a similar program for Mac). Beyond Compare is a file comparison program that will do a comparison of files or folders locally or over an FTP connection. The comparisons can be simple (using the file date) or more detailed (using a binary compare).
I did a simple synchronization preview in Dreamweaver this morning to test it out once more and DW reported 128 files had changed in my site. I knew this was not accurate, so I revved up Beyond Compare and did the same comparison -- it turns out only 14 files were different, and I also got the report that 3 files were newer on the remote server, 4 files newer on local server, 4 files were orphans on the local, and 3 files orphans on the remote. Much better than trying to wade through Dreamweaver's erroneous report that 128 files had changed.
As an added bonus, Dreamweaver 8 now contains file comparison, so Beyond Compare can be used directly from the files panel in Dreamweaver for quick local/remote comparisons. Beyond Compare is also great from the Desktop or file system because you can right-click a file, choose it for compare, and then right-click another file to compare to.
Maybe Dreamweaver 9 will address the problems with synchronization. If a $30 program called Beyond Compare can do it, Macromedia should be able to do it.
Category tags: ColdFusion, Dreamweaver
Posted by Tom Muck
Add comment |
View comments (7) |
Permalink
|
Trackbacks (0)
|
Digg This
Track browser resizing in your database using AJAX -- part 2
Posted Thursday, November 17, 2005 9:11:56 PM by Tom Muck
Part 1 of this post showed the server-side code for a browser resize tracker. This part will show the client-side script. This can go on any type of page -- php, coldfusion, html, etc. The scripts consist of several functions:
- getBrowserSize() -- called in the onload and onresize event to capture the browser size and pass to the server-side page
- getSize() -- gets the size of the browser window
- passFields() -- takes an array of fields (fieldname, value, fieldname, value, etc) and a URL and passes the fields to the URL as querystring variables
- resetSizeTimer() -- creates a timer so that when the browser is resized, only one event is recorded (browser resizing typically fires the onResize event numerous times in succession.)
In addition, we set a global variable to act as a flag for the resize timer. The code is pretty straightforward, and can be placed in the head of any file:
<script>
var size_timer = false;
// Subroutine to get the size of the window
function getSize() {
var myWidth = 0, myHeight = 0;
if(typeof(window.innerWidth) == 'number') {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
}else if(document.documentElement &&
(document.documentElement.clientWidth || document.documentElement.clientHeight)) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
return [myWidth, myHeight];
}
// Pass fields to server given a URL and fields in name/value pairs
function passFields(url,args) {
url += "?";
for(var i=0; i<args.length; i=i+2) {
url += args[i] + "=" + args[i+1] + "&";
}
//Set up the AJAX communication
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
try {
// Pass the URL to the server
req.open("GET", url, true);
req.send(null);
}catch(e) {
//nothing;
}
}
function resetSizeTimer() {
size_timer = false;
}
// Get the size and pass to the server
function getBrowserSize() {
if(size_timer)return;
size_timer = true;
self.setTimeout('resetSizeTimer()',1000);
var theArray = getSize();
var url = "getBrowserSize.php";
var args = new Array();
args.push("width");
args.push(theArray[0]);
args.push("height");
args.push(theArray[1]);
args.push("screenwidth");
args.push(screen.width);
args.push("screenheight");
args.push(screen.height);
args.push("pagename");
args.push(window.location);
passFields(url, args);
}
</script>
All you need to do is to add the getBrowserSize() function to the onload and onresize events of the <body> tag:
<body onload="getBrowserSize();" onresize="getBrowserSize();">
Now, when you browse the page, the server records the browser size upon load and upon resize. Typical information would look like this:
| Width | Height | Screen width |
Screen height |
IP | Page name |
|---|---|---|---|---|---|
| 856 | 788 | 1280 | 1024 | 192.168.1.2 | http://mysite.com/index.cfm |
| 766 | 625 | 1280 | 1024 | 192.168.1.2 | http://mysite.com/index.cfm |
| 948 | 751 | 1280 | 1024 | 192.168.1.2 | http://mysite.com/index.cfm |
| 1025 | 757 | 1280 | 1024 | 192.168.1.2 | http://mysite.com/index.cfm |
The technique is handy and can be used for any other situation where you need to pass client-side information to the server.
Cross posted at Tom-Muck.com
Category tags: ColdFusion, Dreamweaver, JavaScript, SQL Server
Posted by Tom Muck
Add comment |
View comments (4) |
Permalink
|
Trackbacks (0)
|
Digg This
Track browser resizing in your database using AJAX -- part 1
Posted Thursday, November 17, 2005 9:10:15 PM by Tom Muck
It's always interesting to find out about viewing habits of web visitors. One of the things that is hard to determine when building a web page is how big to make your pages. Do you assume the user has 1280x1024? Do you assume 800x600? Do you assume that the user will have a fully maximized browser? One way to find out this information is to read the properties via JavaScript and store them. AJAX gives a web developer a valuble tool that allows the server to communicate with the browser in real time based on client-side events (such as resizing). I wrote a little script that I can insert on a page to track the resizing made by a user in relation to his screen resolution. After getting this information from a variety of users, I can run queries on the data and get some insight into browsing habits and adjust my page designs accordingly (or have them adjusted by a designer, in my case.) The code will be presented for ColdFusion and PHP.
First, I create a table in my database to store the information. The following is for SQL Server:
CREATE TABLE BrowserSize (
browsersize_id int IDENTITY (1, 1) NOT NULL ,
browsersize_width int NULL ,
browsersize_height int NULL ,
browsersize_screenwidth int NULL ,
browsersize_screenheight int NULL ,
IP varchar (50) NULL ,
pagename varchar (255) NULL
)
The following is the equivalent for MySQL:
CREATE TABLE BrowserSize (
browsersize_id int AUTO_INCREMENT PRIMARY KEY NOT NULL ,
browsersize_width int NULL ,
browsersize_height int NULL ,
browsersize_screenwidth int NULL ,
browsersize_screenheight int NULL ,
IP varchar (50) NULL ,
pagename varchar (255) NULL
);
You could also add a timestamp field, if you want to track times.
Next, I create a server-side page to grab the information and pass it to the database. The information will be passed in the URL. The code is self-explanatory. Basically, we pass width, height, screenwidth, screenheight, and page location in the URL, and insert it into our database table, along with the IP address of the user. The following is for ColdFusion:
<cfparam name="url.width" default=0>
<cfparam name="url.height" default=0>
<cfparam name="url.screenwidth" default=0>
<cfparam name="url.screenheight" default=0>
<cfparam name="url.pagename" default="">
<cfset url.width = val(url.width)>
<cfset url.height = val(url.height)>
<cfset url.screenwidth = val(url.screenwidth)>
<cfset url.screenheight = val(url.screenheight)>
<cfset ip = cgi.REMOTE_ADDR>
<cftry>
<cfquery datasource="yourdsn">
INSERT INTO browserSize
(browsersize_width
, browsersize_height
, browsersize_screenwidth
, browsersize_screenheight
, IP
, pagename)
VALUES
(#url.width#
,#url.height#
,#url.screenwidth#
,#url.screenheight#
,'#ip#'
,'#url.pagename#')
</cfquery>
<cfcatch>
<!--- do nothing --->
</cfcatch>
</cftry>
The following is for PHP:
<?php
$_GET["width"] = isset($_GET["width"]) ? intval($_GET["width"]) : 0;
$_GET["height"] = isset($_GET["height"]) ? intval($_GET["height"]) : 0;
$_GET["screenwidth"] = isset($_GET["screenwidth"]) ? intval($_GET["screenwidth"]) : 0;
$_GET["screenheight"] = isset($_GET["screenheight"]) ? intval($_GET["screenheight"]) : 0;
$pagename = isset($_GET['pagename']) ? $_GET['pagename'] : "";
$ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : "";
$conn = mysql_connect("localhost", "username", "password");
$query_rs = sprintf("INSERT INTO browserSize
(browsersize_width
, browsersize_height
, browsersize_screenwidth
, browsersize_screenheight
, IP
, pagename)
VALUES (%s, %s, %s, %s, '%s', '%s')"
,$_GET["width"]
,$_GET["height"]
,$_GET["screenwidth"]
,$_GET["screenheight"]
,$ip
,$pagename);
mysql_select_db("cwtest");
$rs = mysql_query($query_rs);
?>
Both of the pages can be run in the browser to test (saved as getBrowserSize.cfm and getBrowserSize.php respectively). If the values of 0 are inserted in the database, everything is working. I'll post the client-side AJAX code in Part 2.
Category tags: ColdFusion, Dreamweaver, JavaScript, SQL Server
Posted by Tom Muck
Add comment |
View comments (1) |
Permalink
|
Trackbacks (0)
|
Digg This
Custom tag for RSS feed
Posted Wednesday, October 05, 2005 8:04:56 PM by Tom Muck
I wrote a simple ColdFusion custom tag last night that you might find useful. The tag will generate an RSS feed. You pass a recordset/query to the tag and it will spit out an RSS feed. It is based partly on the RSS feeds I built for this site and Tom-Muck.com, and also based on the custom tags I built for generating dynamic tables and csv files. Like the others, it is a rudimentary tag that you can build on.
Use the custom tag like this:
1. Put it in a directory where custom tags are stored. I usually just create a folder called tags and put all my tags inside. Save it as rss.cfm.
2. On the page that will become your RSS fed, add an import statement to the top of the file:
<cfimport prefix="mytag" taglib="tags">
3. Create your query:
<cfquery name="blah" datasource="#mydsn#">
SELECT NewsID, NewsDate, NewsTitle, NewsItem FROM MyTable
</cfquery>
4. Put the tag on the page, passing in the results of the query:
<mytag:rss rs=#blah#>
If you browse the page, the RSS should be visible.
There are several optional attributes, which are outlined below:
Attributes:
rs: Recordset/query to use for the RSS file (default: new query)
title: title tag in channel (default: RSS)
link: link tag in channel (default: http://#cgi.SERVER_NAME#)
description: description tag in channel (default: RSS feed for #attributes.link#)
webmaster: webmaster tag in channel (default: nobody@notavaliddomain.com)
items: Struct of item field names (default: structnew())
items.title: Field name for title of RSS item (default: title)
items.description: Field name for descriptionof RSS item (default: description)
items.link: Field name for link of RSS item (default: link)
items.pubdate: Field name for pubdate of RSS item (default: pubdate)
items.permalink: http address for link with ID from database (default: http://#cgi.SERVER_NAME#/?id=)
items.id: Primary key for picking record
striphtml: strip the html tags from the item (true/false, default: false)
wordcount: truncate item to number of words (default: empty string for no truncation)
maxrows: show x number of rows (default: empty string for all records)
debug: true/false value for debugging the feed (true turns of text/xml content type)
xslt: name of an XSL transformation file (default: empty string for no transformations)
If the query has the proper field names for an rss file (title, description, pubdate, link, and id for the primary key) you don't need to pass in field names. If your blog or news query uses completely different fieldnames, simply set them up in a struct before calling the tag, like this:
<cfsilent>
<!--- Create the query --->
<cfquery name="rsNews" datasource="#request.dsn#">
SELECT NewsID, NewsDate, NewsTitle, NewsItem FROM Blog
ORDER BY NewsDate DESC
</cfquery>
<!--- Set up the field name mapping --->
<cfset fieldmappings = StructNew()>
<cfset fieldmappings.pubdate = "NewsDate">
<cfset fieldmappings.id = "NewsID">
<cfset fieldmappings.title = "NewsTitle">
<cfset fieldmappings.description = "NewsItem">
</cfsilent>
<!--- Call the cf_rss tag --->
<mytag:rss rs=#rsNews# items=#fieldmappings#>
Alternatively, you can avoid the import statement and use old-style cf_ syntax:
<cf_rss rs=#blah#>
You can also pass in the name of an XSL transformation file. A sample file is included in the zip:
<mytag:rss rs=#rsNews# items=#fieldmappings# xslt="rss.xslt" >
I hope you find it useful. See it in action here. View the source here or download it here.
Cross posted at http://www.tom-muck.com/blog/
Category tags: ColdFusion, Dreamweaver
Posted by Tom Muck
Add comment |
View comments (0) |
Permalink
|
Trackbacks (0)
|
Digg This
Blues Vacation report
Posted Monday, August 29, 2005 6:45:56 PM by Tom Muck
I posted my belated blues vacation report earlier on my personal blog (way too long to include here.) How sad that many of the areas we just visited are now under water and/or badly damaged. I hope everyone in Mississippi, Alabama, and Louisiana is staying safe.
Category tags: ColdFusion, Dreamweaver, Music
Posted by Tom Muck
Add comment |
View comments (3) |
Permalink
|
Trackbacks (0)
|
Digg This
Blues vacation
Posted Saturday, August 06, 2005 2:17:51 PM by Tom Muck
Vacation time! I'll be out for about a week until August 15. If anyone needs to get in touch with me, the best place is via my contact form at http://www.tom-muck.com/contact.cfm. This is best because of the thousands of spams I get. On my vacation I doubt I'll be going through the mounds and mounds of email that I get, but I will be checking my contact ticket system for emergencies.
I'll be a blues traveler for a week -- heading to Mississippi to go on a tour of some of the sites down there -- and ending up at the Sunflower Blues Festival in Clarksdale, Mississippi to see some great blues. Little Milton was scheduled to play, but died this past week. RIP Milton. 92 year old Honey Boy Edwards will be playing. He was one of Robert Johnson's contemporaries in the 30s, and has numerous stories of Johnson. Also in town will be Charlie Musselwhite, Sam Carr, and Pinetop Perkins, who is also in his 90s. Also, there is a documentary filming all week at the Ground Zero blues club in downtown Clarksdale by the guy who did Deep Blues and Last of the Mississippi Jukes. Ground Zero is part owned by the actor Morgan Freeman.
In between blues we'll be playing some poker at the Horseshoe and also in Biloxi upon arrival. Wish me luck. ;-)
Category tags: Dreamweaver, Music
Posted by Tom Muck
Add comment |
View comments (1) |
Permalink
|
Trackbacks (0)
|
Digg This
Hit by the baton. . .
Posted Monday, August 01, 2005 8:48:08 AM by Tom Muck
Ah, another baton. How. . . .fun. Thanks Kim.
I suppose I should have more stuff than I do, as I've been in Team MM for years since they were called Evangelists, but I don't have much. The items I can remember include the following:
- 4 t-shirts
- 2 short sleeved Team MM shirts
- 1 Macromedia backpack
- 1 CD car visor
- 2 Flash drives
- Various posters (Central api, ColdFusion tags)
- 1 giant green Dreamweaver 4 foam finger
Favorite items are probably the Flash drives. They are actually useful, and I hate spending money on computer stuff so they came in real handy. I also like the latest ColdFusion 10th birthday t-shirt. I would have listed the birthday cake, but that's already gone.
The most unusual item is the giant foam finger, which sat around for years before finally disappearing during a recent move. I think my wife was probably sick of seeing it around. It was about 3 feet long and absolutely useless, unless you got in a boxing match with the Jolly Green Giant.
5 people I'm passing the baton to:
Category tags: ColdFusion, Dreamweaver
Posted by Tom Muck
Add comment |
View comments (2) |
Permalink
|
Trackbacks (0)
|
Digg This
Sniplet enhancement
Posted Wednesday, July 27, 2005 8:12:42 PM by Tom Muck
One of my more popular extensions has been the free extension Sniplets, which is handier in some ways than Dreamweaver's built-in Snippets panel. Sniplets are stored on your context menu from Code View, and in a short menu. I use them for short code snips that I need all the time. At the request of a customer, I added the ability to import export Sniplets from the extension dialog box. Now, you can move Sniplets from machine to machine, and more importantly, keep groups of Sniplets stored in folders. Sniplets export as regular Snippet files -- yes, compatible with regular Dreamweaver Snippets. What I am now doing is keeping my often-used code snips as Snippets in the Snippets panel, then depending on what I am working on (a ColdFusion site, PHP site, Dreamweaver extension, etc) I will clean out my Sniplet list and import a new set for the project. You can download it free from http://www.tom-muck.com/extensions/help/Sniplets/
Category tags: ColdFusion, Dreamweaver
Posted by Tom Muck
Add comment |
View comments (0) |
Permalink
|
Trackbacks (1)
|
Digg This
Cartweaver released for PHP
Posted Monday, July 25, 2005 6:23:16 AM by Tom Muck
The PHP version of Cartweaver was released yesterday, and if I do say so myself it's a great implementation of Cartweaver ;-). I joined the Cartweaver team a while ago to build the PHP version, and worked closely with the team to make it consistent with the ASP and ColdFusion versions. Anybody who has used Cartweaver for ASP or ColdFusion knows that it is a flexible shopping cart solution, easily customizable from within Dreamweaver, or from a code editor of your choice. The e-store is implemented as both a Dreamweaver extension and as a set of PHP files that can be copied directly into a site. The database setup is easy and the store can be used right away. Check out http://www.cartweaver.com/go/php/ for more details.
Category tags: Dreamweaver
Posted by Tom Muck
Add comment |
View comments (0) |
Permalink
|
Trackbacks (0)
|
Digg This
40 posts
Showing 20
| Next
(page 1 of 2)
See Community MX content by Tom Muck


Blog RSS feed













