Re: High school algebra problem

2012-05-15 Thread Andrei Kondrashev

The fastest formula would be:

1+BitAND(id-1, 255)


~|
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:351157
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Linkpoint Web Service API

2011-09-06 Thread Andrei Kondrashev

Post your contact email.

~|
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:347265
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Could not initialize class javax.media.jai.JAI

2011-08-20 Thread Andrei Kondrashev

Hi everybody,

A few days ago, one of our Web-sites that we have hosted by Yohost
started display error:

Could not initialize class javax.media.jai.JAI

when ImagePaste() function is executed.  The code was working for a
long time.  It still works correctly on my development server.  This is
CF8.  Host guys cannot figure out what's going on.

Does anybody have any insights on this error?  We need to fix this ASAP.

Thank you in advance.

Andrei Kondrashev
Adiabata, Inc.


~|
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:346873
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Problem with CF Execute

2011-06-25 Thread Andrei Kondrashev

If this software requires a registration, like entering serial number or 
activation code, most likely, it uses Windows registry to remember it.  When it 
starts up, it looks for this entry in registry, possibly in the profile of the 
current user.  When you run the program from CF under SYSTEM account, that 
profile is not available.  Therefore, your program exits, because it thinks it 
is not registered.

Some ideas.

(1)
In CF Service options (Control Panel - Services-Properties) check box Allow 
service to interact with desktop. Restart CF service.  Now, if you are on the 
server machine, you will be able to see that error message box that bips.

(2)
Run CF under account that you used to register the program.  Will work, but not 
recommended.

(3)
It might be possible to re-register it under SYSTEM.  For this, use (1) and 
CFEXECUTE the program in interactive mode (with GUI), while on the server 
computer.  Enter the registration number, as needed.  Try if it works.  If it 
does, you can now uncheck the Interact with desktop checkbox.  It will work 
in a normal way now.




 I think I might have narrowed the cause down to the account 
 permissions. When I ran cmd.exe as the Local System account and tried 
 to execute my command line arguments, I was actually able to see what 
 the error dialog mentioned. The third party application doesn't think 
 it's registered.
 
 So, I'm thinking this isn't a CF problem at all, but one with the 
 Windows account permissions. 
 
 Still don't know how to solve it, but that's what it looks like to me.
 
 
 Cheers,
 Mike 

~|
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:345727
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: scoping

2011-05-22 Thread Andrei Kondrashev

From my [private] point of view, the scoping of 100% variables is a 
programming extremism.  When some scope is implied, there is no reason to 
scope variables, unless it is absolutely necessary, like in CFQUERY-related 
loops, or using functions with side effect(s).  Or if this is a policy of your 
organization (strange places may have strange rules).
This is similar to requiring the use of parenthesizes in arithmetic expressions 
in all cases, instead of relying on defined functions precedence rules.  Or to 
prohibit the use of a++, allowing only the use of a=a+1 in C code for 
readability reasons.

Moreover, I always thought that for a default scope, there is no performance 
gain, if I use fully qualified references, because the default namespace is 
always checked first, regradless of what some people say that, if you don't use 
scoping, some overhead is aways involved.  So, I wrote a simple test below.  No 
functions, no CFCs, just plain page code:


cfset a=1
cfset b=2

!--- This is how most people would write this ---
cfset c=0
cfset stTime=GetTickCount()
cfloop index=i from=1 to=10
 cfset c=a+b
/cfloop
cfoutputNo scope: c=#c#, time=#GetTickCount()-stTime#br/cfoutput

!--- This suppose to be more readable and safe ---
cfset c=0
cfset stTime=GetTickCount()
cfloop index=i from=1 to=10
 cfset variables.c=variables.a+variables.b
/cfloop
cfoutputScope: c=#c#, time=#GetTickCount()-stTime#br/cfoutput


I would expect exactly the same or, at least, very close results.  But, results 
are so unexpected, that I was clicking the Refresh button of my browser for 10 
minutes, like crazy.  Non-scoped version ALWAYS runs 5-15 times FASTER than the 
scoped version!  This is on CF8, 32-bit, 4 CPU Dell Server, Windows 2003.  
Could somebody run this on CF9 32/64 bit?  Any ideas, how it can be?


Remembering scope precedence rules in CF8, I wrote another test for a function 
with a side effect.  Therefore, the explicit scoping of external references 
suppose to increase the performance.  Right?  So, this is the test:


cffunction name=test1
   cfset var i=0
   cfset var stTime=GetTickCount()
   cfloop index=i from=1 to=10
  cfset variables.c=a+b
   /cfloop
   cfoutputFunction no scope: #GetTickCount()-stTime#br/cfoutput
/cffunction


cffunction name=test2
   cfset var i=0
   cfset var stTime=GetTickCount()
   cfloop index=i from=1 to=10
  cfset variables.c=variables.a+variables.b
   /cfloop
   cfoutputFunction scope: #GetTickCount()-stTime#br/cfoutput
/cffunction


cfset a=1
cfset b=2

cfset c=0
cfset test1()
cfoutputc=#c#br/cfoutput

cfset c=0
cfset test2()
cfoutputc=#c#br/cfoutput


Non-scoped version ALWAYS runs 2-3 times FASTER than the scoped one.  So, at 
least on my server, the claim that scoping not only increases readability, but 
also gives a performance gain looks like not entirely accurate (c).

So, scope as less, as you can??!


~|
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:344818
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cfhttp response with non-english characters gets cut off

2011-05-20 Thread Andrei Kondrashev

I think, you gave up too early.  This is how I would do this.

Version 1.
Use another tool to get the stuff from the server.  Not a browser or cfhttp.
It must be able to save your stream, as an unchanged byte stream without any
conversion to a disk file.  So the number in the Content-Length would exactly
the same, as the length of the file.  Don't want to advertise anything on this 
list.
You can easily find such tools.  After that you can conduct clean experiments
using cffile.  Obviously, this must be the case, when cfhttp truncates
the data.

stPos=1
cfloop
- Use ASC() to find the first character with the code above 127, starting from 
stPos.
   cfloop
  - Go to some Web-site that has utf-8 table (like Wikipedia) and look 
whether this
is a valid escape character.  If not, break - it is not valid utf-8 
stream.  Report
error to your provider.
-  Get the code of the next character. See, if this is an escape or data 
char.
Consult the table above.  Break with utf-8 error, as before, if sequence
is not valid.
 - End this loop, if a data char was read.  Continue, if an escape char was 
read.
/cfloop
utf-8 sequence is valid.  Modify stPos to set it after the valid sequence.
Continue.
/cfloop
utf-8 stream is valid.  Report error here and to Adobe.

Version 2
Enforce some 8-bit encoding in your cfhttp call, like iso-8859-1.
Save result in a file using cffile with the same charset.  This suppose
to produce unchanged 8-bit stream, but I am not 100% sure (depends
on what exactly CFHTTP is doing).  Repeat process above.


~|
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:344789
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cfhttp response with non-english characters gets cut off

2011-05-19 Thread Andrei Kondrashev

Dump HTTP headers and look at Content-Type header.  There is a charset 
attribute that specifies the input stream encoding.

Most likely it is missing or incorrect.

If the charset is missing, CF assumes UTF-8.  However, in UTF-8 any char with 
the code higher than 127, is treated as an escape code that initiates multibyte 
sequence (up to 6 bytes).  Not all sequences are valid UTF-8 sequences.  When 
CF tries to convert not valid UTF-8 stream, the truncation or abort happens.  
Any 8-bit code that uses high codes, will not be converted correctly, unless 
the proper charset setting is used.  Looks like your case.

Same will happen, if HTTP header says UTF-8, but the stream is, actually, some 
8-bit national encoding.  MSXML does not make any conversion.  It assumes your 
default codepage (8-bit) and makes UTF-16 out of this.  This is why you get all 
characters, but not necessarily correct ones.

Resume.  Provide correct charset parameter in CFHTTP.  This might be tricky, 
since you may not always know how the original stream was encoded.


~|
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:344636
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: ColdFusion and AJAX choices

2011-05-19 Thread Andrei Kondrashev

Carrying 300K of JS code (min) just to do something that takes 10 lines (or 
less) of JS code is nonsense.  Not even speaking about its terrible performance.

jQuery + infinity



~|
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:344637
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cfhttp response with non-english characters gets cut off

2011-05-19 Thread Andrei Kondrashev

Andrei, one of my coworkers had much the same thought. The headers are
reporting utf-8, and I've created a test document containing an omega
character I've saved as plain text utf-8 encoded and it still truncates.

Just created a text file that contains the entire Greek alphabet plus crazy 
Scandinavian characters using Character Map and save it locally in UTF-8 
(notepad).  Everything works, as it should be.  I am 99% sure that your problem 
relates to charset encoding/decoding.  I have CF8 here.

If you post an actual URL that causes a truncation, it could help. 

~|
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:344703
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: ColdFusion and AJAX choices

2011-05-19 Thread Andrei Kondrashev

Didn't really wanted to start a discussion.  Just expressed my private opinion 
applied to this particular situation, not really trying to make any general 
claims.

 1) It's 90k minified
Only 90?  Great!

2) Those 10 lines will inevitably be 1 line of jQuery
No, my custom line will be 11th one.

3) Those 10 lines will work in your favorite browser; then you find
that IE x has some quirk you didn't count on, etc
XMLHTTPRequest is the only thing (thanks Computer God!) that works the same way 
everywhere.  All browsers employ MS XMLHTTP interface.  Only difference is in 
the initialization process, and this is why it requires 10 lines of code, not 1 
or 2.

4) You and Claude S will best friends, I can tell
Does it mean I am blacklisted now?

 jQuery core is only 229K uncompressed...
This, of course, is much better than 300.

Do those 10 lines of code enable you to write different handlers
depending on the status code and success of the http call without any
fuss? Do they translate common response formats into plain js objects
for you?
Yes, I could, but I don't need to, and I don't want to.  I am calling MY 
Web-site, I know EXACTLY what to expect.  I don't want library function to 
perform checks for situations, which will never happen. I want to have my own 
interface that fits my needs better. Unless I forced to do so, I will make 
entire HTML cooking on the server-side (this is why we use ColdFusion) and just 
dump results to the browser, to avoid annoying freezes of client's browser, 
while it processes JS objects, JSONs, XMLs, and created HTML on the fly.  If 
you move server-side processing to the client side, than yes, you might need 
something like jQuery to help you with this.  But, from my point of view, this 
is some different programming concept that significantly differs from the 
client-server paradigm that assumes that client must be as stupid and as 
simple, as possible.


To be clear, even on Edge or 56K dial-up, non-cached Jquery, with all its
built-in goodness, arrives in less than a second...so...I really can't
imagine why rolling your own just-enough JS would be better.  At least
when it comes to speed/performance
This is because you think that 1 sec is a short time and can be ignored.  I 
have a different vision of this.  I would fight for this 1 sec.  As well as for 
the size of browser's working set.


Clearly, use whatever you like...but...wrt your harvester analogy: when
the harvester is free, doesn't impact speed/performance, and will handle
the 10 square feet of grass and the 10 hectares of grass...I'm not seeing
the drawback of using it for both
No, this is a wrong example.  The correct one is when you try to build a car 
that simultaneously can be used as a truck, limo, and participate in Formula-1. 
 And yes, it must be electrical.  Convertible?  Please...  Perhaps, you could 
build something like this, but in reality it is much better to have 3 or 4 
DIFFERENT cars for different purposes.  The only place where you can find a 
piece of free cheese is a mousetrap...

jQuery (and other libraries) is well tested, well maintained, hugely
popular and well thought out. All these things will have an impact on
the speed of development and quality of code, especially for someone
who wasn't coding before these things were commonplace.
Andrei's assertion that using jQuery in this case would be 'nonsense'
ignores these pertinent benefits and is itself nonsense.
My definition of library is something that contains millions of books, but I 
can come there and borrow a SINGLE book I need, rather than carry back home all 
millions books.  jQuery is a great exercise in JS programming.  Never could 
imagine that so many things could be done in the browser!  All those flying 
DIVs and popping images are amazing and REALLY require significant amount of 
efforts to create and maintain, especially considering the browsers war.  But 
what it has to do with my simple task of dynamic update of the application 
screen?  Therefore, my word nonsense should be applied to THIS situation ONLY 
and should NOT be used in any other context.



Again, I did not try to offend anybody.  The best language/tool/browser/etc. 
is the one you know.  For example, we all reading this post because we all love 
ColdFusion and think it is the best.  Want to learn an alternative point of 
view?  Go to PHP or .NET forums.  So, if you like jQuery, you comfortable with 
it, you totally trust and rely on it, could quickly produce desired results, or 
just because it is an internal standard of your company - USE IT.  But don't 
tell me this how EVERYBODY should program, because this is the best, 
everybody use it, this is a common standard, it increases (??) the code 
quality, and so on, and so on. By the way, if people who created jQuery would 
think the same way, they would never created it in the first place, since it 
wasn't a common standard and not everybody used it.  

There are always attempts in the programming 

Re: Batch Website Screen Captures

2011-03-31 Thread Andrei Kondrashev

http://www.cftagstore.com/tags/cfxwebthumb.cfm


~|
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:343454
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Problem with getting cfhttp to do a post

2010-09-16 Thread Andrei Kondrashev

If POST from a browser works AND it is NOT an authetication issue, you should 
be able
successuly POST using CFHTTP or CFX_HTTP5.

Wondering, why do you have encoded=no set?  Browsers, do URL-encoding of 
values before POST.
So, you might be rejected, because some values you are posting are not decoded
properly on their side.


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