News for hackers. Stuff that matters.

yuri41

Re:PHP Annotations Are a Horrible Idea on Wednesday October 17, 2012 @08:19AM (#4664030)
Closures inside property initializations inside the class body don't work. Not even in an array.

So this code throws up a "Parse error: syntax error, unexpected 'function' (T_FUNCTION)"

    class User
    {
        public static $mapping = array(
            'username' => array(
                'type' => 'string',
                'length' => 32,
                'unique' => true,
                'nullable' => function() {
                    // Some logic to determine value.  
                }
            )
        );  
    }
Re:Packages: The Way Forward for PHP on Tuesday March 06, 2012 @02:57PM (#3672569)
I don't think that everything must be object oriented in the standard library, though I'm not a big fan of the functions in global namespace either.

The structure of Go's standard library could be a good inspiration for restructuring PHP's standard library.

Re:Packages: The Way Forward for PHP on Tuesday March 06, 2012 @02:53PM (#3672545)
I don't think that shared hosting needs to be fixed before you can benefit from a good package manager.

Composer and Pyrus both are able to install packages local to the project.

So just grab the dependencies before and then upload the "damn thing" to the server to deploy and this will work on every shared host out there.

Re:On XML Abuse, a rant on Wednesday December 14, 2011 @04:10AM (#3351166)
Exactly that was my point.
Re:Php-build, Compile and Install PHP on Friday November 25, 2011 @03:07AM (#3276548)
Currently it does not solve the problem of the sh*tload of dependencies, though I'm filing an issue for now.

php-build currently solves mainly the problem of configuring PHP correctly, so the build is isolated to the prefix it's installed in (it also sets up PEAR or Pyrus correctly).

Re:Php-build, Compile and Install PHP on Friday November 25, 2011 @03:05AM (#3276540)
Currently I'm using it with Linux (Ubuntu, Fedora) and on my OSX Lion powered Macbook Air.
Re:Php-build, Compile and Install PHP on Friday November 25, 2011 @03:04AM (#3276538)
Re:Php-build, Compile and Install PHP on Friday November 25, 2011 @03:03AM (#3276536)
The mission of php-build is to reduce my workflow of testing new PHP versions to one command I can run. php-build also provides a opinionated default configuration, which you can build on and extend.

Without php-build I have to do this when I want to test, for example PHP 5.4.0RC1:

1. Find a tarball 2. Extract Tarball 3. Configure it 3a. If I already have a script to configure this version go to 4. 3b. Pick configure options (PHP has a sh*tload of them) 3c. See if it works 4. make && make install 5. install Pyrus 6. install XDebug 7. install PHPUnit

So with php-build (and php-build-plugin-phpunit): 1. php-build -i development 5.4.0rc1 ~/.phpenv/versions/5.4.0rc1 2. ? 3. Profit

Re:Whe Power users are going to be the 80 percent on Friday November 04, 2011 @07:26AM (#3195643)
First, a tablet doesn't let you just do those things.

I made the "80%" up, but the list should only capture what most of the people most of the time do with their computers. If you want to do the one more thing, there will always be more software for that, also for your tablet.

My point is that Tablets are the new _personal_ computer and what we knew as PC before is now going to be the _workstation_.

Re:Whe Power users are going to be the 80 percent on Friday November 04, 2011 @07:15AM (#3195622)
I talked about simple office tasks like writing a letter, writing a CV, or a simple handout. These are all things that are at most one page, which can be done with a tablet without much pain.
Re:Closure Object Binding in PHP 5.4 on Thursday October 27, 2011 @03:11AM (#3161951)
If you look at the RFC (https://wiki.php.net/rfc/closures/object-extension) it's in there.

But it ain't present in the current builds of 5.4, AFAIK. Don't know what's happened there...

Re:Closure Object Binding in PHP 5.4 on Thursday October 27, 2011 @03:04AM (#3161934)
The Point is, that I want my closures to have access to the context (the application) without messing with the arguments or "use".

The next thing is, that the Silex Framework binds route parameters as arguments to the closure. Additionally the user could forget to declare the $app argument in the passed closure.

Re:Ask HN: Alternatives to GMail? on Thursday October 20, 2011 @10:18AM (#3134921)
I was once at GMX. They insert Advertisements into your emails and offer to less space for the buck.

Older »