212
I Use This!
Very Low Activity

News

Analyzed about 1 hour ago. based on code collected about 1 hour ago.
Posted about 14 years ago by Dj
Note that you have a bug. hash_map["'"] = '''; should only be added when quote_style is ENT_QUOTES, otherwise the single quote will be allways converted independent of the quote style specified
Posted about 14 years ago by Dj
A fix to my previous post: The last character in the last regexp should be an '*' instead of the '?': Replace: var str = (path + '').replace(/^[\/\\]+$/, '').replace(/^.*[\/\\]([^\/\\]+)[\/\\]?/g, '$1'); With: var str = (path + '').replace(/^[\/\\]+$/, '').replace(/^.*[\/\\]([^\/\\]+)[\/\\]*/g, '$1');
Posted about 14 years ago by Dj
Note that when the input ends with one or more slashes, PHP ignores them and returns the word before them. '///b///' result is 'b' '///\\//' result is '' (an empty string) To return values like PHP the code should be: function basename(path ... [More] , suffix) { var str = (path + '').replace(/^[\/\\]+$/, '').replace(/^.*[\/\\]([^\/\\]+)[\/\\]?/g, '$1'); if (typeof suffix === 'string' && str.substr(str.length - suffix.length) === suffix) { return str.substr(0, str.length - suffix.length); } return str; } [Less]
Posted about 14 years ago by Brett Zamir
@dude: OK!!!! :) (I also applied in Git to some other functions using PI or LN10.)
Posted about 14 years ago by Brett Zamir
Hello Everyone, If anyone has bugs to report, please report them at https://github.com/kvz/phpjs/issues (ideally labeled as "Bug" if the system lets you). The comments system has been great for inviting contributions, but with limited time for many ... [More] of us, it is hard to keep track of what has been resolved and what not, without a structured system. This is not a guarantee we will get to it, but it at least offers a better chance it can be found and addressed. We're sorry not to have stayed top of this ourselves, but it is hard to manage with other things going on. You can still post here, but again, there is less of a chance your question will get addressed. If anyone has questions about how to use the library or how our code does what it does, you can ask here, but you might also benefit from submitting questions to http://stackoverflow.com/questions/tagged/phpjs where a large community of programmers is trying to seek points by providing good answers to questions. Be sure to tag your question with "phpjs" if you do this, as well as possibly "php" and "javascript" so your question can be found by those in the know. This should also reward any question answerers here as well, as the points can be used (besides for a resume) for things such as offering a point bounty to get one's own questions answered more quickly. As far as your own modified versions of functions (e.g., if they do not follow the PHP API and therefore will not make it into phpjs, but may be helpful to others), feel free to add them t the wiki. As far as discussions about improving the library as a whole, feel free to join http://groups.google.com/group/phpjs or post a comment here. Kevin, feel free to correct, but I think that summarizes where we would like items to go, and where we can best process your items (assuming we have the time). [Less]
Posted about 14 years ago by Luke Scott
I don't know who added the "dec = this.utf8_decode(dec);" bit, but this is NOT correct. This line causes raw binary data to be mangled. Removing this line fixes the problem. Base64 does not, and should not, care about the charset. If you are ... [More] expecting utf8 you can use utf8_decode yourself. PHP does not do this: <?php $data = ''; for($i=0; $i < 100000; ++$i) { $data .= pack('V', rand(0, 999999999)); } header('Content-Type: text/plain'); print strlen($data) . "\n"; // ORIGONAL print strlen( base64_decode(base64_encode($data)) ) . "\n"; // GOOD print strlen( utf8_decode( base64_decode(base64_encode($data)) ) ) . "\n"; // WRONG!! ?> [Less]
Posted about 14 years ago by
Posted about 14 years ago by Brett Zamir
@Alberto Ruiz: You really should try posting in a help forum like StackOverflow (tagged with "PHP"), as this page is just about our JavaScript implementation. Try using "var_dump" instead of "echo" to ensure that the string is of the right length and not containing extra characters or something.
Posted about 14 years ago by Brett Zamir
@Pier Paolo Ramon: Good catch! Thanks--fixed in Git... (This function as with many others still needs to support reliably ordered associative arrays--see PHPJS_Array() in array().)
Posted about 14 years ago by Mike Speciner
This does not work for negative arg. It also suffers from poor precision for |arg| << 1. To fix the first problem, try return Math.log(Math.abs(arg) + Math.sqrt(arg * arg + 1))*(arg<0?-1:1); The second problem is much harder to fix; best ... [More] might be a rational function approximation for small args. If there were a builtin function log1p(x) := log(1+x), and similarly expm1(x) := exp(x)-1, things would be much simpler for all the hyperbolic functions and their inverses. [Less]