Floating point numbers - what else can be done?
242266
Avoiding errors In a recent article here in The Register we saw some of the problems that result when floating point numbers are misused or chosen inappropriately.â¦
690828
Asymptote (http://asymptote.sourceforge.net) is a powerful descriptive vector graphics language for technical drawing, inspired by MetaPost but with an improved C++-like syntax. Asymptote provides for figures the same high-quality level of typesetting that LaTeX does for scientific text.   Problems with loading LaTeX packages and slide presentations were fixed. Non-static variables in every loop iteration are now allocated anew. Formatting under locales with nonperiod decimal separators was fixed, along with logarithmic tick labels near the machine epsilon.  Concatenation of nullpaths was fixed. New path markers were added and the perpendicular symbol in the geometry module was improved. The skeleton routines in the solids module were split to provide finer control.  Routines to facilitate drawing 3d contours were added. Reading portable XDR binary data into arrays works again; functions for reading and writing also in native binary formats were added. The TeX preamble is no longer output in inline mode. The TeX pipe is now aware of a previously generated aux file. Memory leaks were fixed. An inline limit is now imposed on old compilers to speed up compilation. Setlocale warnings are disabled unless debugging is on. A colorspace command for extracting the colorspace of a pen was added. An Asymptote introductory slide presentation was added and a user-written Asymptote tutorial is now cited in the manual.
470829
In response to this previous post, Ben Ramsey has relayed some of this thoughts on the benchmarks that were done by Jonathan Street comparing functions and their aliases:   Mmy first reaction was something like: "Egads! These benchmarks are stupid and misleading! These functions are simply aliases of each other. There should be no discernible difference, and any buffoon should realize this fallacy!" This was before I clicked through from PHPDeveloper.org to read his post.   After reading his data and going on to the Better Benchmarks post that followed it, he found that most of the results of additional testing came out negligible and that there was almost no difference between the two.    Ben illustrates the proof of this with a few lines pasted from the "ext/standard/basic_functions.c" in PHP's source showing that the code is shared via a PHP_FALIAS function call.
246639
In his continuing effort to redesign his blog, Shiflett.org, he's been working on one of the things that really makes a blog useful - the commenting system. Specifically, he wants site visitors to be able to add their own code listings to the comments they post. He gives more detail in this new post.   I've been playing with this tonight. Feel free to follow along as I go. The first thing you want to do is create an ordered list from the code you want to format ($code in these examples).   He gives an example of a listing using his system and explains how it all works. It's a mixture of:  PHP for parsing the data inside the 'code' tags CSS to correctly style the information, whitespace and all Some ini settings to set parameters for... ...the use of highlight string on the PHP code contents  A little str_replace magic later and you have list items styled as code blocks on your page. Check out his demo for an example.
464596
PHP isn't exclusively for Web pages. You can use it like Perl for cron jobs and other tasks.
117129
WebReference.com has a new tutorial that looks at the difference sorts of operators that PHP has to offer - unary, binary and ternary - to help you with the logic in your applications.   An operator is a special character or combination of characters that operates on variables.  There are 3 types of operators in PHP: unary, binary and ternary. They can be used to manipulate a variable with up to 3 arguments at a time.  This article wasn't written to discuss the meaning and usage of each operator in PHP, but rather to explain the differences between these types of operators and to give examples about how each functions.   They look at the different types of operators (and include examples for each) - unary (like ! or ++), binary (things like + / == and &&) and a special case - ternary. This uses two characters in conjunction (the question mark and colon) to replace a simple sort of If statement.
240551
I was wondering today how many terabytes could have been saved over the years if URLs would automatically base64 their integer values.  2^32 is 2147483647  Which is 10 bytes.    Of course if you base64 encode those values this leaves you with:  f____w  Which is only 6 bytes.  Thats a 40% savings!
322217
Sara Golemon brings us some news from the front about PHP6 in her latest blog entry today.   While everyone else has been busily gearing up for the release of PHP 5.2 and the new features that are going to come with it, Andrei and his small band of merry babelonians (yours truly included) have been making inroads on preparing PHP6 for a preview release. In the past week we've managed to roughly double the number of builtin functions (those which are part of the main distribution) that have been reviewed for unicode safety, either flagging them as good or upgrading their functionality   She also talks about what kinds of functions this entailed and how far along they are total (around 22%). She also encourages anyone that wants to get involved to help to jump right in.
675296
According to this new post on the Inside Open Source blog from APress, Andi Gutmas has made a  for a new syntax to be added to the existing array functionality in PHP.   The suggestion involves the use of brackets ([ and ]) to declare the initial array, similar to the way other languages (even Javascript) work.   The current split among the big players in PHP development looks to be about 50/50. The general thought of the opposition is that it is an unnecessary change that will only lead to confusion in the future. Why create two ways of doing the same thing?
320728
In an earlier post John Lim pointed out an interesting issue with how certain numbers are handled in PHP - ones starting with a zero:   That's because any number preceded by 0 is treated as an octal number, and 9 is an invalid octal number. [...] The silly thing is that hardly anyone uses octal nowadays, but it continues to be part of the C, C++, Java and PHP standards. The mistake is also very common.   There's not much way around it, he notes - the format's been in use for a long time now and is so ingrained in just about every C-based language out there that it's "too deeply imprinted in modern compiler DNA" to take out.
154133
Tony Freixas has posted a new article covering his thoughts on high-performance debugging with PHP5:   In this article, I will show you how to use PHP 5 input filters to support debug, trace and assert statements so that a one-line change disables these statements and restores your script to full production performance.   He makes a custom solution, a simple method for just outputting simple debug statements via his own custom debugging classes - thDebug, theTrace and thAssert. He wraps all of these in a thDebugManager class to make them all play nice together.   With these in place, he moves on to the real key to the debugger, using the input filter extension that comes with PHP5. He makes a thAbstractStreamFilter abstract class to base the filtering on and, using this interface, makes his thDebugFilter class to handle the various debugging outputs. He uses the __autoload functionality to load it correctly into each page that needs it.
249019
Excel 2007 has troubles with multiplication when the result is 65,535--a number familiar to those who've dealt with binary numbers.
573906
In a new blog entry today, Matthew O'Phinney talks about updates (and refactoring) that he's done to a PEAR package he's developed, File_Fortune.   Over the past few evenings, I've refactored File_Fortune to have it implement Iterator, Countable, and ArrayAccess -- basically allowing it to act like an array for most intents and purposes. As a result, I've eliminated the need for the File_Fortune_Writer package, and greatly simplified the usage.   The package is designed to make an interface between the casual PHP user and the fortune files common on most *nix machines. To illustrate he update, he includes some code that grabs the fortune file, parses it to grab a random one and echoes them out. Also included is the save() method so you can add your own to the list easily.
400984
Ed Finkler has a little PHP6-related humor posted to his blog today - some things he's looking forward to in PHP6:  His tongue-in-cheek list includes things like:  Punctuation-only variable names HDMI outputs ASCII-art generators added to core (once CLAs are signed) Improved elegance   Looking for something a bit more realistic? Check out our posts tagged with php6 to get details on what's to come and some discussion about these new features.
700792
Brian Moon has posted some thoughts about "the post" that Terry Chay recently wrote including comments on smart versus intelligent, object nonense, and funky function names.    So, if you are not smart, then stop coding PHP.  Its a good thing that C developers are smart.  They have to remember all those functions.  Assembly language developers donât have to remember functions.  I guess they are not smart?   Ok, that last paragraph was tongue in cheek.  Knowing 3000+ functions does not make you smart.  It means you have a good memory.  I will take intelligence over smart or a good memory any day.     His comments on the "object nonsense" makes note of the difference between functions and methods and the function naming issue - well, he has "no solid defense" as they do make it difficult to learn the language and send some developers running back to the manual to make sure the parameter order is right each time.
199233
In the last part of this series, we look at creating constants with the define() function, the constant() function, predefined and "magic" constants. By Ellie Quigley. 0129
619712
Excel 2007 has a bug with the display of floating-point values, a Microsoft developer confirmed on his team's blog yesterday. BetaNews confirmed the bug's existence, which leads to some values in floating-point multiplication to be "rounded" to incorrect values.