Re: CF and Oracle Function Issue

2007-03-29 Thread Craig Drabik
 You may have to rewrite the function so that it's a stored proc that
 uses a ref cursor for the return result, which you can then get with
 cfstoredproc.

You'll find this helpful...

http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_17938

~|
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:274094
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Method - Logging Database Changes?

2007-01-16 Thread Craig Drabik
What database are you using?


~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

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


Re: whats the purpose of an objectFactory?

2006-12-12 Thread Craig Drabik
Why would I want to load an object into the application scope just to
load more objects? This is one more piece of code that has to be ran,
maintained, suck up processes, suck up memory, to explain Wouldn't
it be best to just keep it simple and call right to the CFC?


It sounds to me like you're using CFCs more as code libraries and less as 
objects, or that your particular application(s) generally only use singletons 
(one instance of an object only), like an object that handles security.  In 
these cases factories are next to useless - as you noted why would you want to 
write a factory to build one instance of an object?

Factories build instances of objects for you.  And more than that, they may 
build instances of different objects depending on the input you send to the 
factory when you request an instance.

In the simpler case, elsewhere in this thread someone already pointed out the 
benefits of using a simple factory for instantiation of a single object type 
when you are creating lots of those objects - you consolidate initialization of 
the object in one place, simplifying your code and making maintenance easier.

Consider a hypothetical situation...  I work at a university.  So I might have 
objects that represent Faculty, Staff, and Students, all inhieriting from a 
Person class.  I could use the factory to decide for me whether I need to 
instantiate a Faculty, Staff, or Student at runtime, and to centralize that 
decision making activity for me.

Another example would be a factory that creates instance of objects that wrap 
remote services..  If you had a class that generically implemented access to 
various kinds of remote data (XML files, CFCs, web services, etc).  The 
implementation of those classes would be different for each type of call, but 
the interface - the properties and method definitions - would be the same.  At 
runtime the application wouldn't need to care if it was holding a RemoteCallCFC 
or a RemoteCallWebService.  A factory would determine which class was 
necessary, instantiate it, initialize it, and pass it back to the requesting 
program.

~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

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


Re: Determine database field type

2006-12-07 Thread Craig Drabik
The Oracle data dictionary contains pretty much everything.  The table you're 
looking for is ALL_TAB_COLUMNS in this case, assuming you're working with 
tables.

I'm not big on oracle so I don?t know if you have something similar to the
schema info tables in MSSQL but I believe that DESCRIBE will work in
Oracle... according to google anyway :-)

.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com
 

 


-Original Message-
From: daniel kessler [mailto:[EMAIL PROTECTED] 
Sent: Thursday, December 07, 2006 9:26 AM
To: CF-Talk
Subject: Re: Determine database field type

Oracle - I almost always say so, but forgot this time.  oops.

No one ever says what database they are using :-)
 

.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com

~|
Create robust enterprise, web RIAs.
Upgrade  integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

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


Re: ordering Poker hands

2006-11-08 Thread Craig Drabik
I am building a poker applicaiton. 

Has anyone dealt with determining the value of a hand? 

I have the feeling I am making it even more complicated than necessary.

Everybody seems to be advocating a database-based approach.  I wouldn't try to 
assign a value to each hand at all, you need a function that compares hands 
similar to the way humans do.

1.  tokenize the hand so you know what you're dealing with

for 9-9-10-J-2 you have a pair of 9s, a single J, a single 10, and a 
single 2 in that order

for K-K-K-10-10 you have a full house, K's over 10's (one token)

comparing those hands, the full house token beats the pair of 9's token.  If 
you had
9-9-J-J-2 vs 9-9-J-J-3, you'd compare the tokens in order - pair of J's vs pair 
of J's are equal, so check the next token..  pair of 9's vs pair of 9's are 
equal so check the next token..  Single 3 beats single 2.

I'd write a class with functions to compare two tokens and tell you which one 
is greater than the other, or if they're equal.  Then I'd write individual 
functions to compare like tokens (ie so the class can tell that a K high flush 
beats a 7-high flush).  You'll also obviously need a function to do the 
tokenization of the original hand.  Then you just compare tokens in descending 
order to determine which hand is better.

It actually sounds like a fun project.  

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

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


Re: Query Problem

2006-11-06 Thread Craig Drabik
Use select distinct on the original query to eliminate duplicate records.

I have a database of music CDs, something like:

album
-
albumid int(10) unsigned NOT NULL auto_increment,
albumtitle varchar(255),
year smallint(5) unsigned

track
-
trackid int(10) unsigned NOT NULL auto_increment,
tracktitle varchar(255),
tracknumber smallint(5) unsigned,
albumid int(10) unsigned

artist
-
artistid int(10) unsigned NOT NULL auto_increment,
name varchar(255)

artisttrack
-
artistid int(10) unsigned
trackid int(10) unsigned


There can multiple artists per track (e.g. the album Back to Back by 
Duke Ellington and Johnny Hodges).  For now, forget about albums that 
might have different artist lineups per track.  I'd like a listing that 
shows _all_ of the artists on an album.  Can this be done in a single 
query, and in SQL (MySQL) only, without any manipulation by CF after the 
query?

Here's what I have, but it can return only a single artist for the album:

SELECT ar.name,
   a.albumtitle,
   a.year
FROM album a
 LEFT JOIN track t ON t.album = a.albumid
 LEFT JOIN artisttrack at ON at.trackid = t.trackid
 LEFT JOIN artist ar ON ar.artistid = at.artistid
GROUP BY a.albumid
ORDER BY a.albumtitle;

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

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


Embed an XML document into another?

2006-10-11 Thread Craig Drabik
I have an application that kicks around data about an event from function to 
function in an  XML document.  If I have an error I'm trapping with try/catch, 
I want to use wddx to serialize the cfcatch struct, parse it to XML, and embed 
it in the error element in my event XML.

if I try:


cfwddx action=cfml2wddx input=#cfcatch# output=errorXml /
cfscript
 xError = xmlparse(replace(errorXml, 'wddxPacket', 'wddx-packet', 'ALL')); 
//Stops CF fromseeing a wddx packet type
 structInsert(xEvent.event.error, wddx-packet, xError);
/cfscript

I get:

 The XML node [#document] has type [DOCUMENT] which cannot be added to the 
content of an element.

In order to get a node, not a document, if I replace:

 structInsert(xEvent.event.error, wddx-packet, xError);

with:

 structInsert(xEvent.event.error, wddx-packet, x[wddx-packet]);

I get:

WRONG_DOCUMENT_ERR: A node is used in a different document than the one that 
created it.



Anybody have any ideas?

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

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


Re: Framework

2006-09-15 Thread Craig Drabik
 As for stable ORMs, objectBreeze is the only one to reach a 1.0 
 milestone so far (and I have some pretty strong reservations about its 
 APIs). I don't know if Nic Tunney is on the list and wants to comment 
 on how widely downloaded objectBreeze is? My sense is that Reactor is 
 far and away the most popular ORM, followed by Transfer and then 
 objectBreeze.

After having a look at all three of the big ORMs I think ObjectBreeze is the 
easiest to dive right in with.  Like any of the ORMs there are things to like 
and dislike about it.  If someone is new to all of this (what's an ORM?!?) then 
I think ObjectBreeze is a great place to start.

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

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


Re: Bulk data loading

2006-09-06 Thread Craig Drabik
Does anyone have a tested method of uploading bulk data to a database?  I
have a need (annually) for the admin person to be able to take data from an
Excel spreadsheet and have it inserted into an Oracle database.  Any sample
code would be greatly appreciated.  I've played with a CFC that makes Java
calls but without success.

Thanks in advance,

-- 
Chris Tilley

With Oracle, 9i or newer your best bet is to set up an externally organized 
table.  It's basically stored SQL loader which allows you to access an external 
text file as you would any read-only oracle table via SQL.  You would export 
your Excel data into csv format, then set up the EOT to point to that file.  
You can then overwrite that file at any time with new data.  Here's an example 
of the PL/SQL to create one of these.  Most of it will be cut and paste - 
you'll need to create a directory in Oracle (pointer to the filesystem 
directory you will put the CSV in) and fill it in for MYDATA_DIR



CREATE TABLE EXT_ACCOUNT_BALANCE
(
  ACCOUNTVARCHAR2(20 BYTE),
  BEGIN_BAL  NUMBER
)
ORGANIZATION EXTERNAL
  (  TYPE ORACLE_LOADER
 DEFAULT DIRECTORY MYDATA_DIR
 ACCESS PARAMETERS 
   ( RECORDS DELIMITED BY 0x'0a' CHARACTERSET WE8ISO8859P9
LOGFILE 'beginbalance.log'
BADFILE 'beginbalance.bad'
READSIZE 1048576
FIELDS TERMINATED BY , 
OPTIONALLY ENCLOSED BY ''
LDRTRIM
REJECT ROWS WITH ALL NULL FIELDS
(
account 
CHAR(255) TERMINATED BY , OPTIONALLY ENCLOSED BY '',
begin_bal 
CHAR(255) TERMINATED BY , OPTIONALLY ENCLOSED BY ''
)
   )
 LOCATION (MYDATA_DIR:'beginbalance.csv')
  )
;


~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

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


Re: CRUD

2006-08-08 Thread Craig Drabik
 Let me first start off I am not an OO kind of guy.  I like things 
 linear and easy to read.  That is why I like CF.
 
 I have a few database tables that have hundreds of fields.
 
 Making forms and action pages to edit, insert and update the data into 
 the tables is cumbersome and tedious.
 
 What tools are available to me to basically attach a database query to 
 pages that edit, update and delete data?  
 
 Do I have to get into an entire framework?  Or are there a few 
 CFCs/Tags out there that only do CRUD?
 
 Thanks!

Cheap plug - have a look at my CFDJ article Building Generic Maintenance 
Interfaces at http://coldfusion.sys-con.com/read/230520.htm

A link to the complete source is in the feedback

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

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


Re: good Flash 8 book/tutorials?

2006-06-16 Thread Craig Drabik
I've gotten a lot of mileage out of the coursebook Macromedia's trainers use 
for the Flash Pro class.  It's called Flash MX Professional 2004 application 
development.  It's not really a reference but more of a how-to type of book.

I've seen the Flex 2 Beta presentation by Ben Forta, and I though it was
great.  The problem is as far as I understand, it can't do everything that
you can do in flash.  Also the reason I need this is I'm looking to make
small modifications to flash files that are done by consultants, but I can't
seem to make heads or tails of it. 

Russ



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:243840
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