Re: list help
cfdump var=#getUnusedIPs('192.29.22.2,192.29.22.6','192.29.22.0','192.29.22.10')# cffunction name=getUnusedIPs returntype=array cfargument name=ipList type=string required=true/ cfargument name=rangeStart type=string required=true/ cfargument name=rangeEnd type=string required=true/ cfscript var startDec= ipToDecimalValue(rangeStart); var endDec = ipToDecimalValue(rangeEnd); var ipStruct= StructNew(); var ipSectionSize = 2^8; var ipVal = ; var i = 0; var j = 0; var unusedIPs = ArrayNew(1); var ipAddr = ; var tmpVal = ; var tmpHex = ; // Find All used IP Addresses for( i = 1; i lte #ListLen(ipList)#; i = i + 1 ) { ipVal = ipToDecimalValue(ListGetAt(ipList,i)); ipStruct[ipVal] = true; } for( i = startDec; i lte endDec; i = i + 1 ) { if( not StructKeyExists(ipStruct,i) ) { ipAddr = ; tmpVal = i; for( j = 3; j gte 0; j = j -1 ) { tmpHex = int(tmpVal/ipSectionSize^j); tmpVal = tmpVal - tmpHex*ipSectionSize^j; ipAddr = ListAppend(ipAddr, tmpHex, .); } ArrayAppend(unusedIPs,ipAddr); } } return unusedIPs; /cfscript /cffunction cffunction name=ipToDecimalValue returntype=numeric cfargument name=ipAddr type=string required=true/ cfscript var ipDecVal= 0; var ipSectionSize = 2^8; var tmpIPVal= 0; var i = 0; for( i = 1; i lte 4; i = i + 1 ) { tmpIPVal = ListGetAt(ipAddr,i,.); ipDecVal = ipDecVal + tmpIPVal*ipSectionSize^(4-i); } return ipDecVal; /cfscript /cffunction cffunction name=isWithinRange returntype=boolean cfargument name=ipAddr type=string required=true/ cfargument name=rangeStart type=string required=true/ cfargument name=rangeEnd type=string required=true/ cfset var ipDec = ipToDecimalValue(ipAddr)/ cfreturn ipDec gte ipToDecimalValue(rangeStart) and ipDec lte ipToDecimalValue(rangeEnd)/ /cffunction On 11/6/07, Todd [EMAIL PROTECTED] wrote: 192.29.22 http://192.29.22.0/ is constant. 0 to 225 is not. Make an array? append 0-225 on the end of 192.29.22 and then do your checks/show the list of what's available? ~Todd On Nov 5, 2007 9:44 AM, Ben Nadel [EMAIL PROTECTED] wrote: Robert, I don't know how to do this offhand, but you can convert IP addresses to a single big integer number. What you could do is figure out the start IP and end IP numbers, then do a simple FOR loop. For each loop iteration, you could take that number and convert it back to an IP address and check it. Not 100% how that would work, but maybe this can point you in a good direction. .. Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ -Original Message- From: Orlini, Robert [mailto:[EMAIL PROTECTED] Sent: Monday, November 05, 2007 9:14 AM To: CF-Talk Subject: list help I would like to create a list of IP addresses, let's say, 192.29.22.0 to 192.29.22.255 and then with the list of IPs I already have of valid users in the same range, search through and find ones that don't match the range. For example, I would like the code to search through 192.29.22.0 to 192.29.22.255 and match IPs I have within this range and then list out IPs that are not there. If I have IP 192.29.22.122 in my list it should find a match within the range and do nothing, but if my list does not have IP 192.29.22.100 then it should flag this IP as available. Is there an easy way to do this without typing in the whole 192.29.22.0 to 192.29.22.255 range? Do I use a list function? Thanks. Robert O. HWW ~| Download the latest ColdFusion 8 utilities including Report Builder, plug-ins for Eclipse and Dreamweaver updates. http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:292657 Subscription:
Re: Why would this query not return the correct data?
Considering that your doing a select distinct, the correct output should be 1, 2, 4, 6 and not 1, 1, 1, 1, 2, 4, 6 as you first stated. So it looks like you're getting the very first value 4 times. Try to scope the output and see if that helps: cfloop query=get_days cfoutput#get_days.event_days#/cfoutput /cfloop Or better yet drop the cfloop all together and only use cfoutput cfoutput query=get_days#event_days#/cfoutput /Max On 10/14/07, Rick Faircloth [EMAIL PROTECTED] wrote: Follow-up: When I run the same query below in a query editor, the correct data, 1, 2, 4, 6 is returned. What wouldn't CF 8 return the same data with the same query? Rick -Original Message- From: Rick Faircloth [mailto:[EMAIL PROTECTED] Sent: Sunday, October 14, 2007 1:40 AM To: CF-Talk Subject: Why would this query not return the correct data? Hi, all. Here's the query: cfquery name=get_days datasource=#dsn# select distinct event_days from weekly schedule order by event_day /cfquery The data that should be returned if the query is looped is 1, 1, 1, 1, 2, 4, 6 However, when I run. cfloop query=get_days cfoutput#event_days#/cfoutput /cfloop .. all I get is 1, 1, 1, 1.four ones, and that's it. What could I be doing wrong? I knew transitioning from CF 4.5 to CF 8 would present some issues, but gee whiz. Rick ~| Create robust enterprise, web RIAs. Upgrade to ColdFusion 8 and integrate with Adobe Flex http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:291026 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Running an exe file without CFEXECUTE
Do they have CreateObject-Java also disabled? Otherwise you could execute using Java (java.lang.Runtime.exec). But I don't think I quite understand what you want to do though. You want to run a presentation exe file on the hosted webserver? Who will see that if it's running on the webserver? Don't you want to run it at the client machine? Anyway, if CreateObject Java is enabled, you could execute stuff on the server. /Max On 9/28/07, James Holmes [EMAIL PROTECTED] wrote: Is the demo supposed to execute for someone viewing the website, or execute on the server? On 9/28/07, Mike Kear [EMAIL PROTECTED] wrote: A client has asked me to set up their demo file on their web site. It's a self-running demonstration of the order process with instructions on what to click and what goes in which fields of the forms etc. The trouble is, the file they've given me is as 12MB .exe file. The site is hosted at Hostmysite.com who have CFEXECUTE blocked, and they wont be enabling it for us any time soon. The way things stand, I cant run this demo using coldfusion. We want it to run when you click on a menu button. Can anyone show me any options I have to get this thing enabled? So far, I have the following choices: 1. Re-do the demo using different software so it's a java or other file. 2. Move to a different host that allows CFEXECUTE or go to a VPS or colo server Both of these options arent very palatable because (1) they've gone to quite a lot of expense to get the demo made, I just wish we'd talked about it before they went ahead and got it made and (2) is a lot of disruption - moving a large site just for this one bit of functionality. Are there any other choices? -- Cheers Mike Kear Windsor, NSW, Australia Adobe Certified Advanced ColdFusion Developer AFP Webworks http://afpwebworks.com ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month ~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72catid=648 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289702 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Running an exe file without CFEXECUTE
Mike, I still don't understand how running a exe on the server where no user will be able to see anything will help? If you execute the file on the webserver (which cfexecute or the Java alternative will do) who will see the result/presentation. Certainly no one from the outside. So unless you're sitting in front of the webserver, you wont see anything that exe might produce. Cheers, Max On 9/28/07, Mike Kear [EMAIL PROTECTED] wrote: They have a quite confusing customising flash gizmo that lets customers specify a lot of options and see what the finished product is goign to be like before the order is committed. the exe file in question is to demonstrate how to use this gizmo properly. (lets not go towards asking whether it might be better to redesign the gizmo instead so a demo isnt needed! Been there. Seen the movie. Didn't like it!!) So the client proudly said here Mike. Just put this demo.exe up on the site for us and the indent section of the site's completed.. Ok . just put it up on the site. Now I have to figure out the best way to get it working. I dont really want to run it on the client machine because it's 12MB. thats a long time to download before anything happens on the user's screen, but if that's the only practical way to do it, I'll have to do that. I didnt know you could run exe files using java even if they're blocked in other ways. Worth checking out. Thanks Max. Cheers Mike Kear Windsor, NSW, Australia Adobe Certified Advanced ColdFusion Developer AFP Webworks http://afpwebworks.com ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month On 9/28/07, Maximilian Nyman [EMAIL PROTECTED] wrote: Do they have CreateObject-Java also disabled? Otherwise you could execute using Java (java.lang.Runtime.exec). But I don't think I quite understand what you want to do though. You want to run a presentation exe file on the hosted webserver? Who will see that if it's running on the webserver? Don't you want to run it at the client machine? Anyway, if CreateObject Java is enabled, you could execute stuff on the server. /Max ~| Enterprise web applications, build robust, secure scalable apps today - Try it now ColdFusion Today ColdFusion 8 beta - Build next generation apps Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:289711 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: File permission problem, java vs. coldfusion
And you can, just omit the filename from the path. A File object in Java doesn't have to be a file in the traditional sense, it could just as well be a directory. var myFileDir = THE PATH TO THE DIRECTORY var myFile = CreateObject(java, java.io.File).init(myFilePath) if( myFile.canWrite() ) { // Do stuff } Max http://anvilcreative.com On 8/19/07, Rick Root [EMAIL PROTECTED] wrote: On 8/18/07, Janet MacKay [EMAIL PROTECTED] wrote: I would guess its because the file doesn't exist. http://java.sun.com/j2se/1.5.0/docs/api/java/io/File.html#canWrite() Returns: true if and only if the file system actually contains a file denoted by this abstract pathname ... Shoot, I read that and it didn't occur to me that it would return false if the file didn't exist. I totally misread the use of that function, I was thinking that I could use it to determine if Java was able to create a file in that directory. Guess I'll keep movin' on ~| Check out the new features and enhancements in the latest product release - download the What's New PDF now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:286568 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Generate Random Number 1000 - No Duplicates
You don't actually need to use the StructKeyExists though I would take what Russ said and rewrite the function to this: function getRandomNumberArray(length, count) { var min = 1 + repeatString(0, length - 1); var max = repeatString(9, length); var uniquer = structNew(); while (structCount(uniquer) LT count) { uniquer[randRange(min, max)] = ; } return StructKeyArray(uniquer); } Or you could return the StructKeyList(uniquer), if you rather have the Random numbers in a list /Max On 7/26/07, Ben Nadel [EMAIL PROTECTED] wrote: Barney, I love the 1XYZ-N technique for the length constraint That's damn brilliant! .. Ben Nadel Certified Advanced ColdFusion MX7 Developer www.bennadel.com Need ColdFusion Help? www.bennadel.com/ask-ben/ -Original Message- From: Barney Boisvert [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 25, 2007 6:01 PM To: CF-Talk Subject: Re: Generate Random Number 1000 - No Duplicates I haven't tested this (just wrote it in the email), but it should be close: function getRandomNumberArray(length, count) { var min = 1 + repeatString(0, length - 1); var max = repeatString(9, length); var uniquer = structNew(); var result = arrayNew(1); var num = ; while (arrayLen(result) LT count) { num = randRange(min, max); if (NOT structKeyExists(uniquer, num)) { uniquer[num] = ; arrayAppend(result, num); } } return result; } cheers, barneyb ~| Check out the new features and enhancements in the latest product release - download the What's New PDF now http://download.macromedia.com/pub/labs/coldfusion/cf8_beta_whatsnew_052907.pdf Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284602 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: java unzip :: verify file
cftry cfset zipfile=CreateObject(java, java.util.zip.ZipFile).init(zipFileName) / cfcatch type=any cfdump var=#cfcatch# / /cfcatch /cftry That should throw a ZipException (and dump it) if the Zip file is corrupt /Max On 5/18/07, AJ Mercer [EMAIL PROTECTED] wrote: cffile does not crash when using cffile with read or readbinary On 5/17/07, Jake Churchill [EMAIL PROTECTED] wrote: Can't you just read the file as a file object inside a try/catch and if it fails, the file is assumed to be corrupt _ Jake Churchill CF Webtools 11204 Davenport, Ste. 200b Omaha, NE 68154 http://www.cfwebtools.com 402-408-3733 x103 -Original Message- From: AJ Mercer [mailto:[EMAIL PROTECTED] Sent: Thursday, May 17, 2007 1:32 AM To: CF-Talk Subject: java unzip :: verify file Hi, I have a cf script that is using java.util.zip.ZipFile to unzip - works great, except when... If the zip if corrupt it kills jRun. Does any one know if there is a way to verify / check the zip file to ensure it is not corrupt? Because it is dieing at the jRun level, I can not use cfcatch. ~| Macromedia ColdFusion MX7 Upgrade to MX7 experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278545 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: java unzip :: verify file
Then I would suggest find/writing a small Java ZipVerifier that will do this verification for you. I created a quick example of a verifier and it seems to do the job. !--- Start ZipVerifier.java --- import java.util.zip.ZipFile; import java.util.zip.ZipException; import java.io.IOException; public class ZipVerifier { public static String EXCEPTION_STR = ; public static boolean verifyZip(String filePath) { try { ZipFile zipFile = new ZipFile(filePath); return true; } catch( ZipException ze ) { EXCEPTION_STR = ze.getMessage(); } catch( IOException ioe ) { EXCEPTION_STR = ioe.getMessage(); } catch( SecurityException se ) { EXCEPTION_STR = se.getMessage(); } return false; } public static void main(String[] args) { if( args.length 0 ) { System.out.println( Valid Zip file?: + ZipVerifier.verifyZip(args[0]) ); System.out.println( EXCEPTION_STR ); } else { System.out.println( usage: java ZipVerifier zipfile path ); } } } !--- End ZipVerifier.java --- On 5/18/07, AJ Mercer [EMAIL PROTECTED] wrote: no, it is getting past that zipFile = createObject(java,java.util.zip.ZipFile); zipFile.init(zipFilePath); //Get Entry Objects for Entries in the ZIP File entryList = zipFile.entries(); //Create List of File Names from the ZIP File while(entryList.hasMoreElements()) { entry = entryList.nextElement(); == dies here if (not entry.isDirectory()) { fileList = ListAppend(fileList,entry.getName()); } } message = invalid LOC header (bad signature) This kills jRun so I can't catch it in ColdFusion On 5/18/07, Maximilian Nyman [EMAIL PROTECTED] wrote: cftry cfset zipfile=CreateObject(java, java.util.zip.ZipFile).init(zipFileName) / cfcatch type=any cfdump var=#cfcatch# / /cfcatch /cftry That should throw a ZipException (and dump it) if the Zip file is corrupt /Max On 5/18/07, AJ Mercer [EMAIL PROTECTED] wrote: cffile does not crash when using cffile with read or readbinary On 5/17/07, Jake Churchill [EMAIL PROTECTED] wrote: Can't you just read the file as a file object inside a try/catch and if it fails, the file is assumed to be corrupt _ Jake Churchill CF Webtools 11204 Davenport, Ste. 200b Omaha, NE 68154 http://www.cfwebtools.com 402-408-3733 x103 -Original Message- From: AJ Mercer [mailto:[EMAIL PROTECTED] Sent: Thursday, May 17, 2007 1:32 AM To: CF-Talk Subject: java unzip :: verify file Hi, I have a cf script that is using java.util.zip.ZipFile to unzip - works great, except when... If the zip if corrupt it kills jRun. Does any one know if there is a way to verify / check the zip file to ensure it is not corrupt? Because it is dieing at the jRun level, I can not use cfcatch. ~| Macromedia ColdFusion MX7 Upgrade to MX7 experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278548 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: java unzip :: verify file
FYI for the list. It turned out that the issue AJ got was a Java bug for ZipFile. It turns out that ZipFile doesn't handle corrupt zip files very well - It throws an InternalError which will just kill JRun. :S So, I updated my ZipVerifier to use ZipInputStream instead of ZipFile, which will correctly catch the corrupt ZipFile exception. /Max !--- START ZipVerifier.java --- import java.util.*; import java.io.*; import java.util.zip.*; public class ZipVerifier { public static String EXCEPTION_STR = ; public static boolean verifyZip(String filePath) { try { ZipInputStream zipin = new ZipInputStream(new FileInputStream(filePath)) ; while( zipin.available() == 1 ) { ZipEntry zipEntry = zipin.getNextEntry(); System.out.println(zipEntry); } return true; } catch( Exception e ) { EXCEPTION_STR = e.getMessage(); } return false; } public static void main(String[] args) { if( args.length 0 ) { System.out.println( Valid Zip file?: + ZipVerifier.verifyZip(args[0]) ); System.out.println( EXCEPTION_STR ); } else { System.out.println( usage: java ZipVerifier zipfile path ); } } } !--- END ZipVerifier.java --- ~| Create robust enterprise, web RIAs. Upgrade integrate Adobe Coldfusion MX7 with Flex 2 http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJP Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:278559 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: defeating offline form posts
But the only thing I have to do to get around that is to hit the live form, do a View source, get the hidden values and update my local form with those hidden value(s). On 5/9/07, Ken Wexel [EMAIL PROTECTED] wrote: When I ran into this problem previously, I'd set a value into the user session and set the same value as a hidden form field. On post, if the two didn't match, I knew the posting was invalid. Can be something as simple as a long numeric value.. On 5/8/07, Eric J. Hoffman [EMAIL PROTECTED] wrote: That's where I startedbut the thing is, I think they can spoof that variable? Or not? -Original Message- From: AJ Mercer [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 08, 2007 9:53 PM To: CF-Talk Subject: Re: defeating offline form posts Have a look at the CGI variables in particular CGI.HTTP_REFERER This is the page before the current one - it should have your server details in there, other wise discard. On 5/9/07, Eric J. Hoffman [EMAIL PROTECTED] wrote: Curious question here. If I think about this, if someone takes a form of ours for login, for example, and makes a local copy on their machineand they set the post action to be the live server authenticate filewhat is the best way to detect this and defeat it? Noone has ever gained access this way as of yet, but we are studying possibilities, and this seems to me to be an attack vector. Any thoughts?A check to see if the referrer was the domain name/login file name? Or can that be spoofed as well then? Thanks~! ~| ColdFusion MX7 and Flex 2 Build sales marketing dashboard RIAâs for your business. Upgrade now http://www.adobe.com/products/coldfusion/flex2?sdid=RVJT Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:277376 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4