Ahmed's profileShreef in Life [ Shreef....PhotosBlogLists Tools Help

Blog


    May 24

    PHP6 and Unicode support for Identifiers

    Through the last week, I have been following what's happening in php|tek 2007: Chicago. many expert php developers have been there. you can read the conference's summary written by Cal Evans. also, listen to the Pro::PHP Newscast (May 31, 2007) (ps: there were an open bar, so don't be surprised of the funny things they say ;-) )

    There was session titled "PHP6 and Unicode" by Andrie Zmievski. an interesting thing to be mentioned is that in PHP6 the Unicode support will be also for Identifiers. didn't get it ? .. you will be able to write something like that :

    class إنسان {
    function إجرى ‎ ( ) ‎  { ... }
    }

    $‎ قائمة = array();
    $‎ قائمة‎ ['احمد'] = new إنسان();

    yea, it's cool, but please, don't use this feature in your new [PHP6] projects.

    days ago while I was on #phpc asking the guys/gals there about what they think about this feature, Ben Ramsey told me about a funny joke Sara Golemon said. "she wondered if we could use the unicode's snowman character (U+2603) as a namespace separator in PHP6" . I didn't get it at the first time as I didn't know how this character looks. after googling it, I got why this was funny :-) .

    January 29

    I'm not in PHP Throwdown

    I didn't succeed in getting in the PHP Throwdown 24 hours competition. I was already registered with my one man team under the name "Shreef". what happened in the day of the competition is that when I went to start up my computer, I found that the keyboard isn't working. instead of going to buy a new one, I waited till my younger brother "Mazen" comes back from library so I can give him money to get me a new keyboard (yea, it's what you do when you are too lazy). I was supposed to be starting coding on 2:00 pm [GMT+2] as I had registered in "Phase 3" of the competition which starts at this time. my brother came home at 4:30 pm [GMT+2]. I gave him money and he came with the new keyboard at 6:30 pm [GMT+2]. Hmm, the keyboard didn't work. my brother went to return it back and get another one which should be working (I told him that he should try it before taking it this time). he came back with another keyboard at 7:15 pm [GMT+2]. Hmm, this keyboard isn't working too. Oh .. the mouse isn't working too. both of them weren't working at the same time. I didn't believe that my sweet LG mouse isn't working (I love how this mouse looks). Mazen told me that he tried the keyboard before taking it, so the problem is in my computer. I don't love saying that, but it's true, my computer got a problem with its PS/2 ports. I didn't know what should I do to fix it. I didn't like the idea of taking the computer to one of those computer maintenance companies. they will ask me for allot of money for just changing this small part (some of them will tell me "change your mother board") . at this moment I got the message and I can see that I won't be able to do any thing regarding the competition. so I went to watch T.V. . my father was setting there too. I told him about the problem. he is electricity engineer [heavy electricity], so I thought that maybe he can help. my father went to check the problem him self. he didn't know how we can replace the bad mother board parts with new ones as this needs a specialized electronics guy. he phoned one of his work colleagues to see if they know any helpful idea. his colleague [mechanics engineer] told us about a cable called "2  in 1 UPS". this cable can be used to make an USB port work like a normal PS one. this looked like a good idea for us. I gave my brother money again to buy a cable like that. it worked this time, but it was 9:30 pm now. so 7 and half hours went since the start of my competition phase. one of the rules of this competition is that you should commit your code minimum every 6 hours through "subversion". I didn't do that, so I can see that even if I did succeed in finishing coding my application in this time, my code won't be approved.

    anyway, I didn't have enough luck to compete this time in PHP Throwdown, but maybe I will try to compete in the next times.
    you can check a web page which contains all the blog posts written by the competitors in PHP Throwdown. they were blogging how they are progressing through the 24 hours .. hour by hour.
    January 11

    Zend Debugger with PDT

    6 days ago, I have moved from using PHPEclipse to using PDT (aka PHPIDE). installing PDT took a long time as there were other dependencies had to be installed too to make it work. but the result was very good with some little bugs. PDT still sub-1.0 so I wasn't expecting every thing to be working well. the other interesting thing is the Zend executable Debugger. the ZendDebugger.dll for PHP5 that comes with it, supports PHP5.2 . I'm using PHP5.2 on virtual server on my machine for my experimental use only, but my main development now requires PHP5.1.4+ so I need another version of the ZendDebugger.dll file that works with PHP5.1.4 . till now I don't know from where I can get it. if you know any helpful information about that, it will be a great help :) .
     
    I was reading a post on Ben Ramsey's blog about the Zend executable Debugger. he updated his post with a link to another post by Patrick Mueller which contains some information and links about the XDebug support for PDT. from the links there, I got the required files and added it to my eclipse plugin folder and did all the required things, but it didn't work. I'm using a newer PDT version than the required by the plugin and maybe this is why it can't work.

    PHP crashes with XDebug2.0-rc2

    through the last days, I was working with Thomas and Gavin on the unit tests for Zend_Date. when I was trying to run the tests, PHP crashed every time at the same point of the test. after 2 days and doing more tests, I found that the cause of this crash was XDebug-2.0.0rc2-5.1.2 . PHP crashed only when trying running the following testbed.
     
        public function testAddArpa()
        {
            $this->markTestIncomplete();
            $locale = new Zend_Locale('de_AT');
            $date = new Zend_Date(1234567890,null,false,$locale);
            $d2   = new Zend_Date(1234567899,null,false,$locale);
            ......
            ......
        }
     
    notic the call for $this->markTestIncomplete() . if we remove it, every thing goes well, but if used, PHP craches. I'm now using the rc1 version of XDebug and every thing went ok.
     
    January 09

    PHP statistics for December 2006

    Nexen.net posted their PHP statistics for the end of 2006. I noticed that there is an increase in PHP5's market share in Egypt. while PHP4's market share in Egypt is still very low.

    the next graph shows PHP5's market share by country:


    Green: High  - Yellow : world average - Red : Low

    Arabic market share:
    United Arab Emirates (.ae) 19.52 %
    Saudi Arabia (.sa)             12.87 %
    Egypt (.eg)                      12.70 %
    Tunisia (.tn)                      5.47 %
    Bahreen (.bh)                   3.74 %
    Jordan (.jo)                       3.49 %
    Lebanon (.lb)                    2.99 %
    Libya (.ly)                         2.86 %
    Syria (.sy)                         2.40 %

    very good, I want to add more things to my PHP wish list:
    • Arabic PHP magazine (or maybe any Arabic software development related one).
    • PHP conferences in Arabic cities - preferred Alexandria, Egypt .. :P
    I hope to know how many companies in Egypt are adopting PHP in their development, and how they are adopting it??

    December 03

    Animated CAPTCHA

    I found today a very good class on phpclasses.org . it can generate animated CAPTCHA images. I didn't see thing like this idea before and it looks like a good technique to try.
    see the examples :

      and  

    I see that the first one is so complex to be read by robots but it's so friendly to be read by humans (color blinds can see this color simply, right?) .

    anyway, the class is nice and I'm planning to use it in my coming projects - In Sha' ALLAH -  after adding more effects and making sure that there is no problems with color blinds .

    the class can be found here. it's the winner of the October 2006 innovation award at phpclasses.org.

    November 28

    Links: Phalanger and SPL

    I found 2 good IRC presentations about Phalanger (PHP.NET compiler) [by zaemis] and SPL (Standard PHP Library) [by Davy Shafik]. check PHP.ThinkTank .

    Phalanger: the presentation was about some very basics of how .NET works and how we can include a .NET assemblies in our normal PHP code and use it and how you can write PHP applications in the .NET way using Phalanger.
    there were some Java guys said that they will say goodbye Java and move to .NET .. lol . they liked the idea of how you can write assemblies in C# for example and then consuming it in their PHP.NET code. I like this too.
    zaemis gave a basic example on how you can create a simple form (it's a Desktop one this time) and get some data from a MySQL database and display it in a data grid. if you are already a PHP developer, after seeing his code , you will feel  home :-). the code looks like a normal PHP code except the first lines where he is importing the required namespaces. notice the triple colons. till now there is no namespaces support in the normal PHP but what I remember is that it will be added in PHP6.

    notice that in PHP.NET you are still writing your lovely dynamic code. you can see this too in IronPython. (hell on static typing)

    SPL: Davey gave a nice presentation about the basics of SPL. he talked about the Iterator interface, IteratorAggregate, ArrayObject , ArrayAccess , RecursiveIteratorIterator and dynamic properties.
    what I like here more is the ArrayAccess interface. by implementing this interface in your class , you can create an instance of this class and save it in a variable for example called $Obj . then use this object like a normal array as you will be allowed of doing things like
    $Obj['foo'] = 'bar' ; //and
    print $Obj['foo'] ; // this results of printing 'bar'

    this is the same like using indexers in C#. but remember that you still can't iterate on this object using foreach f.e. else if you are implementing an iterator interface.