Re: SQL Quandary

2011-05-22 Thread Pete Jordan

What Russ wrote regarding your parameters table.

I've not got an SQL server box booted up to check, but the equivalent of 
the following sort of thing works fine in MySQL:

SELECT dbo.tbl_stock.stockID, dbo.tbl_stockItems.stockItemID,
dbo.tbl_stockItems.projected
FROM dbo.tbl_stock INNER JOIN
dbo.tbl_stockItems ON dbo.tbl_stock.stockID =
dbo.tbl_stockItems.stockID
INNER JOIN dbo.tbl_parameters ON dbo.tbl_parameters.someKey = 'some value'
where stockID > 0 AND
 (dbo.tbl_parameters.someField != '#thisValue#' OR stockitems.Projected > 0)

As long as your parameters table join condition only ever matches one 
record, you should be fine.


-- 
Pete Jordan
Horus Web Engineering Ltd
90 Belvoir Street
Hull HU5 3LR
p: 01482 446471
m: 07973 725120


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344817
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: scoping

2011-05-20 Thread Pete Jordan

Dave Watts wrote:
> This is a mistake, unless you've actually decompiled CF or used JVM
> instrumentation to verify this. It's easy to jump from interface (what
> you interact with) to a conclusion about implementation (how it works
> under the covers) but you really don't have enough evidence to do that
> (and if you did that, I'm pretty confident that you'd be wrong about
> this speculation, for reasons I'll explain shortly). What we call
> scopes are just another kind of namespace. Their only job is to
> control where and when we can refer to specific variables that they
> contain.
>   

Since I have it lying around, have a link:
http://www.skydancer.org.uk/namespaces.cfm

It's incomplete, and constructed way back in CF7, but I'd expect that
it's pretty much unchanged in CF8 and CF9.

-- 
Regards,

Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/
phone: +44 1482 446471
mobile: +44 7973 725120


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344747
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Recordcount not working????

2011-05-19 Thread Pete Jordan

Wil Genovese wrote:
> This sort of makes sense.  The DB rejected the request, somewhere in the 
> process the JDBC driver returned "nothing" or NULL or something not exactly 
> expected and closed the request. CF not getting a result set (not even an 
> empty results set) didn't set the query result set variable.  Thus you get an 
> error trying to reference the query.
>
> I've seen similar issues like this in the past where the JDBC didn't give CF 
> a response or maybe it was a null response and closed the request. CF 
> continues as if nothing happened and the query variable is never set.
>   

Specifically, it happens when underlying (Java) code sets something to
null. CF doesn't grok that and reports that the variable *containing*
the null isn't defined (which is, I suppose, actually correct for some
values of correct). You can get the same problem with, for example,
trying to access missing values in sparse arrays.

 is your friend, with its default set to something appropriate
(I have a Java object I treat as an ersatz null).

-- 
Regards,

Pete (jQuery-free) Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/
phone: +44 1482 446471
mobile: +44 7973 725120


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344704
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Using isDefined/StructKeyExists against a ,Net com object

2010-11-24 Thread Pete Jordan

Joanne Corless wrote:

> I'm doing some .Net integration and the values of the .Net object returned 
> need to be inspected and then displayed if they are defined
>
> I've found that the conversion process brings everything back as 
> rootObject.Get_ObjectName().Get_Value() which blows up if the object is empty 
> throwing an undefined error - However if I try and use 
> isDefined("rootObject.Get_ObjectName") or 
> StructKeyExists(rootObject,"Get_ObjectName) - it just doesn't work - If I add 
> in the () at the end - it blows up Coldfusion
>
> I can't just display everything because there may be elements that are empty 
> - Has anyone else had this problem & have a solution? 
>   

An alternative to wrapping in a  block is , something like:

 

 
   
 
  
 

I use a similar mechanism to cope with accessing elements in sparse
arrays (though I default to #server.undefined#, which is a Java object I
create for just this sort of purpose); it should work for your problem too.

-- 
Regards,

Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/
phone: +44 1482 446471
mobile: +44 7973 725120


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339496
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Interesting results with setting variables - cfset vs. using a cfscript block

2008-07-02 Thread Pete Jordan
Stephane Vantroyen wrote:

> You should read this, quite interesting (CF8 vs CF7 etc) : 
> http://neilmiddleton.com/2007/07/01/cf-8-and-performance-comparisons/

My guess is that a lot (most?) of the runtime difference between CF7 and
8 is down to the JVM; Java 6 is faster than 5 and a *lot* faster than 4.

FWIW, we're running both CF7 and 8. and have run 7 with (Sun) Java 6
pretty much since it released, without any problems at all: I'd guess
that macradobe warnings on that are mostly to cover themselves.

-- 
Regards,

Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/
phone: +44 1275 543971
mobile: +44 7973 725120

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308463
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Another Regex ?

2008-07-02 Thread Pete Jordan
Will Tomlinson wrote:

> (if|for)+\s+\(|\)\s+\{

That's probably not quite what you want: it'll match multiple "if"s and
"for"s at the start, and I don't think you want the "|" inside the
parentheses - that means that the regexp will match either what's before
it or what's after it. You would get a match on "ififfor (" or ") {",
for example.

"(if|for)\s+\(.*\)\s+\{" is a minimal alternative that should do what
you want, though it doesn't do any checking of what might lie inside the
parentheses, or before or after the matched part of the string.

-- 
Regards,

Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/
phone: +44 1275 543971
mobile: +44 7973 725120

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308458
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Replace comma in replace list

2008-06-26 Thread Pete Jordan
Robert Harrison wrote:

> How do I indicate a comma in a replace list so I can replace the comma?
> 
> Example:
>,/,\,*,?,<,>,|,:,$,.,',&,@,#chr(44)#",
> "_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_")#">
> 
> chr(44) is the comma, but that doesn't work and neither does ,,.

You could use a different list delimiter, as suggested; a neater
solution might be to use rereplace.

<|:$.'&~,]", "_",
"ALL")/>

If (taking a wild guess) this is for generating something like part of a
permalink from a title string, you might want to squash multiple
matching characters to a single underscore:

<|:$.'&~,]+", "_",
"ALL")/>

You can simplify this even more if you actually want to hit all
non-alphanumerics:



-- 
Regards,

Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/
phone: +44 1275 543971
mobile: +44 7973 725120

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308173
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Java NULL in CF

2008-06-24 Thread Pete Jordan
Ach! It stripped it. Here's the class:

package horus.coldfusion;

// Java-end NULL-surrogate bits for ColdFusion
// Copyright © 2007-2008, Horus Web Engineering Ltd. All rights reserved.

public class undefined {
  private Class test=null;

  public undefined () {
this.test=this.getClass();
  }

  public String toString () {
return "␀";
  }

  public boolean assigned (Object arg) {
return arg==null || arg.getClass()!=this.test;
  }

  public boolean identitycheck (Object arg1, Object arg2) {
return arg1==arg2;
  }

  public Object check (Object arg, Object nullv) {
return arg==null ? nullv : arg;
  }

  public Object check (Object arg) {
return this.check(arg, this);
  }
}

-- 
Regards,

Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/
phone: +44 1275 543971
mobile: +44 7973 725120

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308067
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Java NULL in CF

2008-06-24 Thread Pete Jordan
Brad Wood wrote:

> What's the best way to test for a Java NULL in CF?

> Should I just set the output of each of those methods into a variable,
> and then check for the variables existence?

That'll work.


  

We use a little Java class to tidy this (amongst other things) up that
I've attached - with luck the houseoffusion mailing list software will
leave it intact.

There are a few bits glued into the server scope at the CF end:

 
  server.undefined=createobject('java',
'horus.coldfusion.undefined').init();

  function defined( value ) {
var argc=arguments.size();
value=server.undefined.assigned(value);
if (argc eq 1) return value;
if (value) return arguments[2];
if (argc gt 2) return arguments[3];
return '';
  }

  server.defined=defined;
 

Using your my_url object, you could then do:



or




 

 


It's worth noting that the "check" method must be called directly, with
the potentially-null-returning Java call as an argument; that's the only
way to bypass ColdFusion bleating about an undefined variable.

Having a NULL-surrogate value that can be used anywhere in ColdFusion is
*hugely* useful; I only wish that Macradobaire had seen fit to do it
properly in the first place.

-- 
Regards,

Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/
phone: +44 1275 543971
mobile: +44 7973 725120


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:308065
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: PDF to Image

2007-06-07 Thread Pete Jordan
Mark Lewis wrote:

> I am trying to convert the front page of a PDF doc to an image. My
> target server is Coldfusion 5 but if necessary Colfusion mx 7 can be
> used.
> 
> Is it possible for this to be done, if so could I have some
> directions on how to do this.

I second using ImageMagick, though we actually use a two-stage process 
here (convert PDF front page to a PPM in a cache directory using 
pdftoppm, then mangle the PPM to JPEG in whatever size &c. required) as 
ImageMagick's conversion is bereft of configurability and has been known 
to disappear up its own fundament.

Having said that, we don't actually *use* ColdFusion for this as such, 
as all our image processing, including PDF and MS-Word page snapshots, 
is done by a mod_perl Apache translation handler.

-- 
Regards,

Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/
phone: +44 1275 543971
mobile: +44 7973 725120

~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ 

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:280364
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: switch from siteObject to FCKEditor

2006-05-21 Thread Pete Jordan
Pete Ruckelshaus wrote:

> Really?  Is that in the documentation somewhere, or can you provide a
> code sample?  Also, any idea if it's possible to specify the image
> file upload path dynamically?  I'm building a simple blog app and want
> to allow users to upload to their own directories.

I'm not going to promise any sort of useful details here because I know, 
from past experience, that I'm not going to find the time to package 
code up in a form in which it can be usefully shared (I owe apologies to 
people here and elsewhere for promises unfulfilled in the past).

Anyhow, that said (and with the added proviso that due to tuit shortage 
we're still working on RC2 here), I really don't see where the issues 
lie with toolbar customisation: you can define as many toolbar sets as 
you like in fckconfig.js and both the supplied custom tag and CFC allow 
you to select the things per editor instance.

For image upload directories, you'll have to get your hands dirty to an 
extent. I've pretty much rewritten the connectors from scratch here as 
we've integrated fckeditor into our (mod_perl/PerlMagick based) image 
auto resizing and processing code, so our code isn't likely to be of 
much direct use to you, but the connectors are where you'll need to delve.

The standard (Application|Server).userFilesPath base isn't a lot of use. 
We've recoded that to (1) pick up userFilesPath more flexibly - we check 
Request, Session, Application, Client and Server in that order - and (2) 
allow userFilesPath to be a hash, keyed on connector type ('File', 
'Image' &c) so different media can live in entirely different places.

If that doesn't give you enough flexibility, then you're likely into 
more significant hacking - passing paths into the fckeditor js code and 
back out to the connectors in the xmlhttprequest. It's not rocket 
science, but you'll need to spend a bit of time sussing out how the 
protocols work as standard first. We've not needed to do this, but 
having crawled through the relevant code for other reasons, I don't 
think it would be difficult.

-- 
Regards,

Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/
phone: +44 1275 543971
mobile: +44 7973 725120

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241071
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Best Rich Text Editor

2005-08-11 Thread Pete Jordan
Claude Schneegans wrote:

> What for instance would you like to have?

You pretty much listed our requirements :)

> - a good CMS should NOT allow users to use HTML to fulfill all their 
> fantasies.
> So, users should not be able to define any color, font size and what 
> ever, instead, they
> should be able to select a style (or a class) the site designers have 
> designed for them.

That's why the toolbar configurability and (with our database-driven 
style selector hack) style control in fckeditor works for us.

> - a good HTML editor should be callable from several places in a form, 
> each instance
> having it's own set of tools and styles available to the user. For 
> instance when editing
> a News Release, I ask the user to fill a summary and the main content. I 
> don't want him
> to have access to all the tools for the summary, not even to bold, since 
> this is handled
> by the News Release template any way.

and again. We allow for user-created forms like this too, in a limited 
way: the form tag and submit/reset buttons are generated by the CMS; 
users can insert whatever form controls they like in between (and flag 
fields as mandatory). The only processing option we offer ATM is to 
email the form results to a pre-configured address, but that actually 
covers most people's requirements. FWIW, the form processor itself is 
one I wrote in mod_perl and is *very* paranoid for all the obvious reasons.

> - a good HTML Editor should not be embeded in a textarea, instead, it 
> should open a new window
> which can be resized any sized to resemble the final page the text is 
> intended,
> otherwise it is not really WYSIWYG.

Here I disagree - the web isn't WYSIWYG anyhow, so giving users the 
illusion that it is does no good at all. We do use the target stylesheet 
in the fckeditor (or soeditor) iframe, though, so fonts, sizes and 
colours are as they should be.

> - a good HTML editor should not allow pasting from MS Word with no basic 
> cleaning.

I wrote a co-processor for soeditor to sanitise such crap when switching 
from source to html mode and when exiting; fckeditor has a "paste from 
word" function, though I haven't (yet) thrown much horror at it.

> Finally, the HTML editor should not allow users to upload any image anytime.
> The problem with HTML Editors is that they are completely independant 
> from the CMS system.
> Images should be managed by some tool in the CMS admin module, and 
> registered in the database,
> including image sizes, some title, description etc.
> Then, the CMS provides some tool  to select and display images from the 
> database, not the editor.

We have the option of allowing image uploads into any directory, 
configurable by directory. If the directory is managed by the CMS, the 
upload actually goes to that directory's raw image store and the CMS 
will autogenerate the appropriately sized, framed, annotated or 
otherwise mangled result into the directory the user *thinks* they're 
uploading to. At present, images newly uploaded this way are actually 
registered in the image table when an administrator next enters the 
image manager - I do a scan of the raw image directories and add any new 
images as uncategorised, flagging duplicates.

-- 
Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:214517
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Best Rich Text Editor

2005-08-10 Thread Pete Jordan
Connie DeCinko wrote:

> So what is the best Rich Text editor today, for those of who need to build
> our own simple CMS?  I keep hearing FCK lately, but until recently never
> heard of it.  Others I have heard about, seems no one talks about anymore.

We're moving from soeditor (having finally given up waiting for the new 
version) to fckeditor, which seems to be as good as any others we've 
evaluated. None of them do exactly what we want but fckeditor is as good 
as any, being open source, allows us to hack it as required.

Our changes will be sent back to them when they're remotely complete but 
FYI the changes to date are:

* allow available styles to be extracted from a database table

* enable the code (especially the image browser) to be easily shared in 
our linux hosting environment

* rewrite the image browser and its associated XMLHttpRequest connector 
to play nicely with our MySQL/mod_perl/ImageMagick image management system

* as I write, I'm rewriting the link browser to integrate with our CMS

The last two items won't likely be of direct interest to anyone but us, 
but will hopefully provide a template for anyone else wanting to do 
similar hacks.

-- 
Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/

~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:214416
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: ListAppend and delimiter question

2005-03-31 Thread Pete Jordan
Sam Farmer wrote:

> I'll leave it to others to classify it as a bug or a feature.

It's a feature (I think). Not that I've ever had reason to use or allow 
for alternative delimiters in CF yet...

> I get around it by doing this: 
> 
> and then when done with all my list appends:
> 

FWIW, I use listchangedelims(tmpWhere, ' AND ', '~') in similar 
circumstances; it's worth noting that arraytolist() also allows a 
multi-char delimiter - I often build query "where" clauses in arrays and 
glue them together that way.
-- 
Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200924
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


of ColdFusion, Linux, symlinks and template base paths

2005-03-30 Thread Pete Jordan
This posting is by way of information for anyone else running CF7MX 
under Linux (and, likely, permutations of Solaris and CF6MX though I 
don't have either installed for testing). If anyone can actually 
*explain* why CF behaves as it does, that would be an added bonus...

For context, we run shared servers with a subdirectory tree aliased in 
Apache to /common available to all vhosts. The (physical) directories 
are arranged thusly:

  /home/httpd/common/...
  /home/httpd/vhosts/the.domain.name/sitedocs/...

There are a few shared CF templates under /common (for our CMS and for 
both soeditor and fckeditor dhtml editors). Some of these need to know 
the vhost base directory that, for reasons unexplained, ColdFusion does 
not make available in any direct way so are accessed by symlinks from 
the individual vhosts' web space, so we can use GetBaseTemplatePath() to 
derive the vhost base path.

This works for some symlinked templates, but not for others: you either 
get the path to the symlink (what we want) or the path to the linked 
file (utterly useless). Experimentation shows that CF7MX is, at least, 
consistent in which you get, but the rules are odd:

For a symlink in a vhost's base directory, the target must be two or 
less directory levels under the "common" base directory. For every extra 
level of directory that the symlink is placed under the vhost's base 
directory, the target can be *two* levels deeper under "common". It 
makes no difference at all whether the symlink is relative or absolute.

I've no idea what difference changing the path depth of the vhosts' base 
directories would make; I've found out enough to work around our 
fckeditor image connector problem and I suspect that further 
investigation would just lead to madness...

Anyhow, hoping this will, one day, help someone else,
-- 
Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/

~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:200718
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: FCKeditor - Dynamic Browse and Upload Directory

2005-03-14 Thread Pete Jordan
Brad Roberts wrote:

> Anyone have a solution for setting the image browse and upload path
> in FCKeditor (version 2 with the default CF connector)?  I'd like to
> share the editor among several sites.

I'm actually (right now) in the middle of writing our own connector to 
cope with the virtual image directories we use for cached on-the-fly 
scaling and mangling of images, but the following should work fine with 
the standard connector unhacked.

You don't say if you're on a Windows or *ix server, but the basic 
solution we use here under Linux/Apache is to symlink the connector to 
somewhere within the vhost's directory tree (the top level image 
selection directory is a good place). If that's not possible on your 
platform, you can always actually copy the connector.

You'll need, of course, to put the fckeditor files themselves in a 
shared location and update the js config to reflect the new (symlinked) 
location of the connector.

FCKConfig.ImageBrowserURL = FCKConfig.BasePath + 
'filemanager/browser/default/browser.cfm?Type=Image&Connector=/images/connector.cfm';
 


for example.

This is all necessary because of ColdFusion's continuing bizarre failure 
to let an app know what the vhost's base directory actually is; there's 
no way to find out from a file that isn't (as far as ColdFusion is 
concerned) physically in that directory tree. Exposure of 
CGI.DOCUMENT_ROOT (if available) would make life *much* easier... There 
are other ways of doing this, of course: say, a database lookup on 
CGI.SERVER_NAME or just an application variable, but these would require 
changes to the default connector.

-- 
Pete Jordan
Horus Web Engineering Ltd
http://www.webhorus.net/


~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:198672
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: RegEx help

2005-02-21 Thread Pete Jordan
Ben Doom wrote:

> Oops.  It was mistyped!  That's what I get for Copy'N'Pasting.  Also, 
> for trying to answer questions on a Monday.  However, it is supported in 
> CFMX, which no longer uses a POSIX engine.
> 
> Non-greedy or lazy matching is supported in CFMX.  IIRC, lookahead is as 
> well, but not lookbehind.

Coo. I think that calls for a w00t! at least - thanks :)

For a variety of reasons, we skipped CF6MX and are only now working 
through migration issues for CF7MX: I hadn't picked up on the extended 
regexp facilities, only that the new engine seems to be some three times 
faster than CF5. Still far too slow, but any improvement is welcome.

Lookbehind is nasty to implement (Perl only got it in, IIRC, 5.6); 
lookahead is nice though.

-- 
Pete Jordan

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195781
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: RegEx help

2005-02-21 Thread Pete Jordan
Cedric Villat wrote:

> I get an error though, as it complains about the ?. What are they for?

It's a (mistyped :) Perl extension that POSIX (and CF) don't support: 
'?:' after the '(' stops the parenthesised section being treated as a 
referenceable subexpression: it's just used for grouping.

It's *possible* that a CF-compatible solution could be engineered like 
that, but without the '?'s you would have to work out what numbered 
backreferences your prefix and suffix ended up being... Always assuming 
that CF would assign the same numbers in all circumstances, which it 
wouldn't.

[ponders]

You *might* get away with:

  rereplace(text,"((.)\.([^0-9]))|(([^0-9])\.(.))", "\2\5 \3\6", "all");

if the subexpressions are numbered sanely and CF treats ones that aren't 
assigned as empty strings (I haven't tried it). Even if that worked, 
you'd still not get repeated periods treated correctly though.

There are a number of Perl RE extensions I *really* miss in CF - that's 
one of them, but lazy matching is the big one (ie. take the first, as 
opposed to the longest, match for an RE fragment). Lookahead and 
lookbehind assertions are nice too, and would provide another potential 
solution to your problem.

-- 
Pete Jordan

~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195774
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: RegEx help

2005-02-21 Thread Pete Jordan
Cedric Villat wrote:

> I want to remove all periods ( . ) that do not appear between 2 numbers. For 
> instance, I would want to keep this period:
> 
> 5.5
> 
> But not these:
> 
> www.domain.com
> 
> I want the periods to be replaces with a space in the second example. 
> Anyone?

I don't think there's any sane way to do this with a single POSIX regexp 
(I think I could do it in one with a Perl RE, but it would be ugly); I'd 
love to be proved wrong though. .

bar=rereplace(foo, "([^0-9])\.([^0-9])", "\1 \2", "ALL")

would be safe, but would miss (say) "a.5"; you don't say what you want 
to do with multiple periods either...

My inclination would be to do it in three bites: replace the periods you 
*want* to keep with a character guaranteed not to be in your string, say 
SOH, (you can always do a zero'th pass to strip such out), replace all 
remaining periods with spaces and finally restore the periods you want:

temp=rereplace(foo, "([0-9])\.([0-9])", "\1#chr(1)#\2", "ALL");
temp=replace(temp, ".", " ", "ALL");
bar=replace(temp, chr(1), ".", "ALL");

It's not what you asked for, but it *is* only one regexp :)

-- 
Pete Jordan

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195719
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Getting IPTC data into a database

2005-02-20 Thread Pete Jordan
Warren Parsons wrote:

> I'm trying to find a way to extract IPTC information from a JPG and insert
> that data into a database (MySQL in this case).

This is probably of the same order of usefulness as a suggestion as "use 
a Mac", but we do this using a custom tag that shells out to a Perl 
script that does both the EXIF extraction (using Image::EXIF) and the 
MySQL database update. A couple of EXIF fields (date, camera) go 
straight in; the rest (barring thumbnail/datadump chunks) gets encoded 
as WDDX and goes into a single table field so ColdFusion can get at it 
easily if it's ever needed.

-- 
Pete Jordan

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195629
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Gzip compression and caching system

2005-02-20 Thread Pete Jordan
Jochem van Dieten wrote:

> That server has a broken HTTP implementation, it sends the full 
> page when I use a HEAD request.

That's the responsibility of the ColdFusion programmer; I confess that I 
rarely bother to code for it myself, but it's up to you to put in:

  

(after the , if there is one)

-- 
Pete Jordan

~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195628
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Gzip compression and caching system

2005-02-20 Thread Pete Jordan
gabriel l smallman wrote:

> Issue is that this causes the browser to pop up a dialog how you want to
> handle this file type. So the browser appears to not automatically unpack
> ..gz extensions.

That's a browser-end issue if you're sending the MIME type correctly. 
You may need to force a .gz on the end of the URL for IE/Win though, as 
it has a nice habit of thinking it can guess what's wanted better than 
the server.

> If you want to see what I mean: http://icc.getfused.com:8300/gzip/test1.cfm

That does nowt here as of right now - empty document.

Pete Jordan


~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195624
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Gzip compression and caching system

2005-02-19 Thread Pete Jordan
>Im working on a tag to wrap around content and then save it to a file, gzip
>it and serve it out. Expanding on the cf_GZipPage custom tag.
>
>But trying to take is a step further. I would like to save the gzip'd binary
>data in the db. Main reason is the expected amount of gzipped files could be
>well over 100k. I would prefer to not let the file system handle finding and
>reading the data.

The following is untried but should work... I'm assuming you have a name field 
in your table that can be supplied as a suggested filename to the user.


 SELECT name, content FROM table WHERE id=#id#





#foo.content#




Pete Jordan

~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble 
Ticket application

http://www.houseoffusion.com/banners/view.cfm?bannerid=48

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:195547
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54