June 3rd 2009

SPL: a hidden gem

By a show of hands, how many people here ever heard of SPL? How many already used it? Chances are most of you didn’t raise your hands, and some might even have a confused look on their faces. Indeed that is the sad reality when it comes to SPL, but What is SPL?

SPL, or Standard PHP Library, is a set of classes and interfaces built in to PHP since version 5.0, and as of PHP 5.3 it cannot even be disabled, so its here and for good. Its actually hard to disable it when compiling, so 9.9 out of 10 changes that you have it. But why have you not used it? The answer begins at “poor documentation” and ends in “didn’t even know it existed”, SPL has not had the “bling” about that it deserves, but this is where this article comes in, time to turn this around. So what is in SPL?

SPL makes available a few hooks for overloading the PHP Engine, such as ArrayAccess, Countable and SeekableIterator interfaces, to make your objects work like arrays. You can also manipulate other stuuf using RecursiveIterator, ArrayObejcts and various other iterators. It even has classes for specific points such as Exceptions, SplObserver, Spltorage and helper functions to overload other aspects, like spl_autoload_register, spl_classes and iterator_apply. Overall its a swiss army knife of code that can be implemented in PHP but that because of its hooks will probably perform much faster in SPL. So, what can i actually do with it then?

Overloading autoloader

You are a by the book programmer, and after __autoload came around you rewrote all your sites and remove the endless stream os includes and requires in your code to make way for lazy loading, right? So once in a while you found yourself in a jam, you product’s classes use a specific naming/directory structure and the Zend Framework classes you use have a “_” to path approach, how do you solve this? Giant __autoload that includes all logic, trial and error style? Alter you directory structure to Zend’s? No! Overload it!

The process is simple, just create your own autoload function and overload it, that way the autoload procedure will run the class through Zend’s loader, if it does not find a class, it will then run yours, and keep on going down the line until one of them finds it.

    1 <?php
    2
    3 class MyLoader{
    4     public static function doAutoload($class){
    5         //autoload process
    6         //use file_exists please
    7     }
    8 }
    9
   10 spl_autoload_register( array('MyLoader', 'doAutoload') );
   11
   12 ?>

Iterators

Iterator is a design pattern, a generic solution to iterate over data in a consistent manner, a way to access elements of an object in a sequential way without exposing underlying representations. SPL has all the Iterators you ever need, and i’m not exagerating at all. This also includes iteratorfilters and so many other. You can use this for example in you database results, making the DbResult object implement the Iterator interface, thus making functions such as next(), prev() and other available so you can iterate results in a foreach. Another good example for Iterators is transversing a directory. In the usual manner you can iterate over scandir, the use if and elses to skip over “.”, “..” and any other files, say for example you want just the pictures from a directory. You can do all this using iterators and iterator filters, like in this example:

    1 <?php
    2
    3 class RecursiveFileFilterIterator extends FilterIterator
    4 {
    5     protected $ext = array('jpg','gif');
    6
    7     /**
    8     * Takes $path and creates a recursive iterator with a directory iterator
    9     * @param $path diretory to iterate
   10     */
   11     public function __construct($path)
   12     {
   13         parent::__construct(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)));
   14     }
   15
   16     /**
   17      * Checks extension names for files only.
   18      */
   19     public function accept()
   20     {
   21         $item = $this->getInnerIterator();
   22         if ($item->isFile() && in_array(pathinfo($item->getFilename(), PATHINFO_EXTENSION), $this->ext)) {
   23             return TRUE;
   24         }
   25     }
   26 }
   27
   28 // Using it
   29 foreach (new RecursiveFileFilterIterator('/path/to/something') as $item) {
   30     echo $item . PHP_EOL;
   31 }
   32
   33 ?>

You may argue that now you have much more code, I’ll reply: yes, but you have reusable and testable code!

Here are some more iterators:

  • RecursiveIterator
  • RecursiveIteratorIterator
  • OuterIterator
  • IteratorIterator
  • FilterIterator
  • RecursiveFilterIterator
  • ParentIterator
  • SeekableIterator
  • LimitIterator
  • GlobIterator
  • CachingIterator
  • RecursiveCachingIterator
  • NoRewindIterator
  • AppendIterator
  • RecursiveIteratorIterator
  • InfiniteIterator
  • RegexIterator
  • RecursiveRegexIterator
  • EmptyIterator
  • RecursiveTreeIterator
  • ArrayIterator

As of PHP 5.3 we have some other interesting tools, like SPLInt and other types you can use for type-casting (in PECL still). One class worth mencioning however is:

SplFixedArray

Why? Its faster! Why? aha! that’s the million dollar question. See to understand that we must dwell into the PHP internals for a regular array. In a regular array you can use diferent types of keys, i.e. numeric, strings and so forth. What PHP does is that it does not use that value as a key in the underlying C array, rather it hashes whatever it gets and uses that as a key, so hashing has a performance cost. SplFixedArray only accepts numeric keys, so no hashing happens! For those of you that cought up, yes, its a C array! So that explains why this is faster than regular arrays. (only php5.3!!)

This are just some examples of what you can do with SPL, unfortunatelly there is no “one place” to go and get a complete view of SPL, tou can hit the regular manual, but you should always trust in this documentation, done by the creators themselves, or you can hit Elizabeth’s Blog, most examples on this article belong to her.

Invitation

But there is no better way to get better at SPL than contributing to it! We need documentators! So if you want to be part of PHP and help out, check out the php.doc mailing list, or IRC your way to EFNet and join #php.doc and say “I want to help”, you will be given a task very fast!

1 Star2 Stars3 Stars4 Stars5 Stars (Sem votos registrados)
Loading ... Loading …

10 Comments »

June 1st 2009

php|tek 2009: The community in action

This year I was abel to attended the 2009 php|tek conference in Chicago. This conference is hosted by MTACon, the company behind php|architect magazine, one of the most influent PHP publications in the world. php|tek is a unique event in its overall “feel” and purpose – for those that read my post on ZendCon’08 you may be able to pickup this difference yourselves. Tek is a community oriented event, as opposed to ZendCon which is much more aimed at companies. Is this good you ask? Yes, its perfect, it in no way falls short of the content in ZendCon, but on the plus side it gives one many more opportunities to mingle and meet the central PHP Core Developer Team, and most importantly, it inspires attendees to work with and give back to PHP.

Same as last year, the conference was held in Chicago, IL in the Unites States at the Sheraton Hotel, a wonderful venue that helps keep everyone close by during the conference and during “off-time”. The conference ran for three days plus a tutorial day – from May 19th to May 22nd. The day before the start one could already see many of the most well known PHP developers arriving – it appeared that the Core team was arriving early to host a PHP Dev meeting held at Microsoft. And the topic of the conference .. ? PHP 5.3.

The sessions were great, and tutorials day featured particularly interesting sessions, of which I attended a security talk to complement my PHP Security skills,as well as a Code Review Session. This session, held by Sebastian Bergamann, Stefan Priebsch and Arne Blankerts was extremely interesting, we dove deep into the code of some major frameworks and apps, like Magento, Wordpress, Habari and found some incredible (not in a good sense) pieces of code. This talk showed me a different side of things especially for certain areas of coding where I can certainly do better. It also gave me a new perspective on code reviews, which have today a much bigger importance then before.

The rest of the sessions during the event were really good, some were inspiring (Security Centered Design), some made you wish PHP 5.3 was out (PHP 5.3 – Hot or not?), some made incredible associations to drive home the importance of a good development environment (The Knight Rider Methodology to Software Development), some showcased the more obscure but very useful parts of PHP (SPL to the Rescue), some even tried to point you in a good direction (Untestable Code). There really were sessions for every kind of developer, from the “regular joe” to the php expert – at times I wished I had the method __clone implemented on myself, so I could get to all sessions. Also, alongside the event we had great UnCon Sessions and an Hackathon organized and led on by the community, with some simple but great sessions.

This leads me to the biggest feature of php|tek, and one most commonly overlooked by developers and managers alike, namely the community. This was by far the biggest difference from ZendCon, a total focus on the community and hence, a focus on geting everyone active. The PHP comunity has been in focus during the last few months. Since the news of PHP 5.3 was released we have seen an increase in activity inside the PHP community: BugHuntDays, TestFest09, documentation, patches, you name it the community has done it this year. User Groups keep growing and popping up everywhere. Just in Brazil we have had at least 5 groups started since last year. The conference fosters the

The recipe for success in this sense is not clear, was it the community oriented sessions (A guide to using and understanding the community, User Group Meetup)? The after-hour programming (PechaKucha night, Retro Gaming Night, Hackathon)? Maybe it was the breakfasts and lunches where you shared tables with all the active members of the community? The discussions around a cup of wine? I’m guessing it was a combination of all this, the sheer exposion to all this is enough to get you into the “giving back” mood. The ingredients are pretty simple, knowing where you can help, who to ask, where to read about it and a touch of “karma”. Many moments at tek were based on this, the interaction with great names of the community and a clear picture of what PHP needs. The whole experience shows you clearly that not Zend, ibuildings, IBM or Microsoft are in the control of PHP, we are, the community has grown.

PHPdeveloper.org has talked about this and I can see it myself, PHP has matured, coming out of its teenage years of rebelty and strange changes, and moving now to its mature Adult years. But not only the language, the whole of the PHP Community has tagged along, the core developers show more leadership, the community no longer takes a step back, it now steps forward, opinating, working, committing, participating.. no longer a bystander. During the closing notes the crowd was asked to stand up, not all at once, but in an order of “community activity”, it was amazing to see how many people were standing up in the end, from Core developers, extension developers, translators, documentators, testers, UG leaders to the PHP teacher at his company’s office we had almost a full room standing, leaving maybe 10~15% of people that are not active present in the event.

This is the message that Tek brings with it, the maturity of a language we know for so long, which fits right into ZendCon’s message from last year, “Why not PHP?”. Another indication that community was in focus was that some session focused on making the developers life easier, with frameworks, version control techniques and so many orders. Different from other times, sessions did note revolve around asking if a framework is enterprise-ready, they revolved around comparing various frameworks, deemed enterprise-ready, and how you should choose your framework. One of the features displayed for each framework was the community behind it, showing us once more that the community does make a difference and not only for PHP but for all the pieces we use on a daily basis.

If tek leaves me with a message I can take back to fellow developers and UG members it is: “Step up, contribute to PHP, help out with what you can, any little thing you do will come back around to you, writing tests will make for a better 5.3 release, and that will surely make life easier for you, it does not take too much, even small things like writing documentation, just get active, wear you PHP shirt and go for it.”

As for the managers, deccision makers and leaders, i leave you with this message: “Believe in PHP, invest in the community and in your employees, growing the language will grow your business, giving back to PHP will eventually give back to you. Promote that message in your office, employees who invest in PHP gain more knowledge about it, giving your solution more quality.”

(most of the talks mentioned here and most of the ones presented at php|tek09, can be found on slideshare)

First published at: http://www.mihswat.com/2009/05/31/phptek-2009/

1 Star2 Stars3 Stars4 Stars5 Stars (Sem votos registrados)
Loading ... Loading …

1 Comment »

May 25th 2009

php|tek09 Day #4

And so comes the final day of the 2009 php|tek conference.

And it starts just as usual with breakfast with PHP Peeps and off to see Sean Coates’ session on Tokens over RegExps. Which was a very interesting session showing diferent techniques to some usual problems we handle with regular expressions, and showing great stuff for handling PHP source code analysis, cool stuff. Following that it was a quick hop and Ben Ramsey was showing us the internals of the HTTP protocol. People should really know more about it and look more carefully at it, many of us misuse its codes and methods. I was also lucky and won a elePHPant at the end of the session by answering a question on the “100 Continue” status code.

Finally we got to the ending keynote, first listening to Marco and his amazing plans for Code Works, that will replace php|works and will travel through 7 cities in the US during a 2 week period, awesome time to life in the US. Following Marco Terry Chay took the stage, everyone was ready with their f-bomb counters up and waiting to see how Terry could blow us all away… and blow us away he did. Relating Chinese Proverbs (sort of) to modern culture and the future of PHP, Terry led us to think closely of the current crisis and how PHP can com through for us.

Now we had time for some lunch and i joined the great company of Cal Evans, Ligaya, Travis Swicegood, Clark Everetts, Frozen, well you get the picture, we had a great lunch going from politics to IDE, to OS wars.. lots of fun.

After lunch i grabbed a bit of all the unconf talks, like Skoop and Kerry, his myth-busting partner. But the highlight was getting in some great covnersations with everyone before leaving, great to see everyone’s interest in Brazil and our growing community (www.php.org.br). So it ended, got back to the room packed and moved bak to O’Hare, where i met Spoons and Eli White before catching my flight.

Overall result? Awesome conference, great for getting in touch with the PHP people and to find out how to give back to the community, hanging out with anyone of these guys can inspire you to be so much more than you are and givin back to the PHP community, the whole event was one big reunion of all diferent ways you can do it. It was an honor and pleasure to meet all of you, or see the ones I had already met again, each one of you has inspired me in a diferent way or given me an ideia or two, and i will be bogging about this later on.

Till next time! Tek-on! :P

1 Star2 Stars3 Stars4 Stars5 Stars (Sem votos registrados)
Loading ... Loading …

No Comments yet »

May 22nd 2009

php|tek09: Day #3

The beeping alarm begun another exciting day at php|tek09.

My usual breakfast buddies were around once again for a great meal to start it out right. The first session was High performance APC with Brian Shire from Facebook, and it was really interesting to see the APC improvements and what is in their roadmap, influenced by Facebook and their needs, working as a boost for APC development, defintively gonna kick our testing server into apc mode to run some tests. Parallel to this session Sara Golemon gave a PHP 5.3 session.. and from what i hear, those slides are golden! go find them! (i’ll post a link if i find them myself)

Next up Derick gave us a lesson on the K.I.S.S principle giving us tips on making the user’s life easy and getting sites done right. Leading up to a session on good OOP practices by Stefan Priebsch that got everyone think of objects and more objectsm driving the point of performance X maintanability for OOP code.

Lunch was loads of fun with the excelent (and fun) company if TetraBoy, LOLCode extrodinare, Spoons and Itrebal. All of a sudden KITT drives around for Eli White’s Development Methodolody talk, with plenty o’tools and Knight Rider references, a great overall look of the dev process. Afterwards Lorna and Skoop gave us an introduction to communities and showed us some examples of how to get it working for us, a great inspirational talk for user group leaders or enthusiasts. The regular sessions finished up with Chris Cornutt’s great overview of 4 big frameworks and how they should affect you life, and what you get with each of them, a great comparison presentation for people still lost on which framework to use.

I quickly stepped out for a conference call with the Brazilian Microsoft representatives and our user group leaders. As for user groups and Microsoft’s role and intentions… it was a great talk and we definativelly have good things to wait for. Some things could have been left out of the meeting and make it much more useful and quick, but I still had to get out before it finished, to go help out in DragonBe’s User group round table, which was awesome and inspiring, and will be detailed in later posts and UG actions.

This conversation went on for very long, so i missed out on testfest and skipped right to retro-gaming nite, which i can say was awesome! Xbox, card games… these guys know how to have fun! And i got to thanka new friend for giving me his prize (I suck with names, but i will update this post with his name), and congratulate the winners of all games and the big XBox elite winner!

This day was incredible, but we still have one morning to go… and a Terry Chay keynote, so day #4 should be a blast!

1 Star2 Stars3 Stars4 Stars5 Stars (Sem votos registrados)
Loading ... Loading …

No Comments yet »

May 21st 2009

php|tek09: Day #2

Ok, i might be a little “DUI” as I write this, but bear with me, i can get it done.

Day #2 kicked off well with a group breakfast again and off we went to the main ballroom for the keynote. Suddenly we get “news” jaws drop to the floor, girlish screams are heard .. Andrei has been kidnapped and Tabini has the picture to prove it. I guess you can ignore and obfuscate the guy behind php|arch and php|tek for so long before he flips! Tabini then went on to talk a bit on arch and tek and finally announced that Andrei was alive..

Andrei came out and delivered on an awesome keynote! Showing us the news in PHP 5.3 and giving us the word on PHP 6, with some fresh news from the PHP Dev Meeting, all with plenty internal jokes and funny pics, a keynote worth watching again! 

The day went on with great sessions, so i’ll mentions the ones i went to. First up was Eli White, Zend’s new goto guy, on scaling applications. An awesome talk that  showed interesting techniques and their evolution, an excelent way of showing you scaling so you realize the “incremental” nature of it. From that i jumped on the search train with Derick’s “Of needles and Haystacks” a peek into the world of search strategies and an introduction to Lucene and Solr.

Lunch as usual was really good and i got in some interesting conversation with Derick and Sara Golemon. After which i headed to Lig’s inaugural session on MySQL tuning, the first session I know of that looked into “settings” tuning, not just query/hardware techniques. Elizabeth followed up dwelling into the twilight zone.. the SPL Zone, showing us the wonderful land of iterators (iteratoriterator.. iterataaaaah) and giving a shout out to the community for help to get all this documented, this is where you com in!

I then moved on to the ballroom to see Sebastian teaching us to test untestable code, or rather, how to fix it and get it done, right! It was an excelent session and eye opening to get some unit testing problems i have had in the past. And that was followed by a surprising and very inspiring talk by Chris Shifflet. Security Driven Design was not a code talk, but a reflection point applying various techniques to web site security, making us all think of how to implement all these diferente things in the most diferent aspects of web development, aside from being a great guy Chris was very inspiring on this talk.

There was still time, so we got the UnCon session going, and i decided to get more info on how to use git to take svn offline with Zend Framework’s own Matthew, a short but very objective session that got me curious and interested in using git.

The evening events would begin later on, so we skipped the hotel to get some genuine out-of-mexico-mexican-food, which was really good. We got back just in time to hit the open bar and watch the Pecha Kucha sessions.. which were way too funny to describe here, suffice it so say Tetraboy won with his LOLCode presentation! Ah.. and I also brought down a genuine bottle of Aged Cachaça and it surely made some sucess.

Another awesome day ate tek, tomorrow more talks and retro-gaming night! Tek-on!

1 Star2 Stars3 Stars4 Stars5 Stars (Sem votos registrados)
Loading ... Loading …

No Comments yet »

May 20th 2009

php|tek09: Day #1

Tutorial day at php|tek! The day begun with a PHP Breakfast, where I met guys like Matthew Weier O’Phinney and saw the guys from yesterday as well. After that I moved on to registration and got my tek swag on!

The first session I attended was a Security Bootcamp by Christian Wenz (@chwenz)  where we analysed some security issues and sample applications, going over some of the basics of PHP security and look at some of the most active players today like XSS and CSRF. It was interesting and refreshing, an overall great tutorial for people looking for the light at the end of a security tunnel, or at least to learn what holes to look for in their applications.

After that we had lunch, cortesy of MTACon. And the afternoon was ready for a kick off with a awesome session, PHP Code Review with Sebastan Bergmann, Arne Blankerts and Stefan Priebsch. This session was an eye opener and loads of fun. Basically we pickup php frameworks and apps, like Habari, Magento and such and look at the code to find the bad, the ugly and the down right down outrageous. The kid  of stuff we found in some apps was simply amazing, from major security issues in Habari to insanelly pointless code in magento. This session was very interactive and pointed out a whole bunch of things we should avoid on a daily basis.

After the sessions we headed over to get some official and famous Chicago Stuffed  Pizza at Giordano’s, it is definativelly aproved! So dinner with 40 PHPers ended up back in the hotel fomr some Hockey and Basketball surrounded by PHP talk.

Ready for the first oficial day of php|tek. By the way… we got some great shirt swag at the conf.. bring money! buy shirts!

Pictures on Flickr: http://www.flickr.com/search/?q=phptek+OR+tek09&m=tags&d=taken-20090515-20090525&ss=2&ct=0&w=all

Update: Seems the security issue is not major, as it occurs only during installation. It is however still a security issue and a violation of the “filter all input” mantra.

1 Star2 Stars3 Stars4 Stars5 Stars (Sem votos registrados)
Loading ... Loading …

6 Comments »

May 19th 2009

php|tek09: Day #0

First day in Chicago started out early, like 5 o’clock early! Getting to the hotel was a breeze after getting in touch with MTACon’s assistance hotline (thanks guys!), yah.. its a big airport.

The Check-in was awesome, no problems, great wi-fi (some form problems, like white and white not being really good coloring) a bath and off we go. Not before meeting some core guys, like Derick Rethans, Andrei Zmieski, Sara Golemon and so much more  on their way out to  internal dev meeting. The rest of the morning was a usual Brazilian vacation… denting the credit card as always.

Returning to the hotel i ran into a big group downstairs, including such names as Eli White, Keith Casey, Gregg, Sebastian and so many more. Talking led to a hop over to Shoeless Joe’s, or Shirtless Schmoe’s, whatever! Dinner and beers followed by scary developer drunk tactics with some more celebreties like Ben Ramsey, Elizabeth Smith, Michalangelo Van Dam, and various others, along with FAILS stickers, traded in the black market by Spoons.

Getting back to the hotel i had the luck of running into more people, featuring Lorna Jane and Chris Jones, “old buds”. The whole evening was great and really cool talks with lots of people, like Gregg and geolocation and other technolgies, Michelangelo and a great talk about communities and such topped of by a talk with the group back at the hotel on conferences and Brazil’s role in the whole game.

Preparation Day was awesome, new contacts, new friends, Let the conference begin in the morning!

1 Star2 Stars3 Stars4 Stars5 Stars (Sem votos registrados)
Loading ... Loading …

No Comments yet »

January 29th 2009

Languages and the Web

Answer me quick: “What is the language of the web?”

Ok, how many of you answered with the name of a programming language? How many shouted out PHP, Ruby, Python or something similar? This is not that kind of post – I am not trying to start a religious war amongst the supporters of our beloved languages (not in this post at least…)

What I mean is this – what is the real language of the web: is it English? French? German? Or the ever more important Chinese? This may seem to be a simple question, but let’s look at the implications of language on the web.

I’m writing this post after attending Campus Party ‘09, and I ended up reflecting a lot on this issue after watching Tim Berners-Lee’s presentation on the semantic web. This presentation had semi-simultaneous translation, and I must say I was not pleased with it. I have been working with the internet for over 9 years now, and over the years I have noticed the way in which languages such as Portuguese, Chinese and others started to invade a previously almost-pure-English environment.

Someone very wise once told me that knowing English means that you have access to a great deal more more content, and you have that access before someone that does not know English have it – that is the difference English makes on your resume (no wonder he is now my boss). And that is actually our current reality, most of the content on the Internet is first generated in English, and then it makes its way to other languages through the various translations made by local bloggers and such. This is not always the case of course – I also post in Portuguese and must say I do the opposite by translating into English from Portuguese. Nevertheless I have seen blogposts in English attract far more attention. During my first year of blogging one of my posts written in Portuguese and then translated to English proved this point. While the original post got lots of attention and comments, the English post rapidly made it to the first page of Digg and made me suffer from the “Digg-effect”. My blog has never since reached close to that peek number of visits – so hypothesis proved, English does go a long way.

This of course is not just because of the number of English readers out there, but also because of the number of tools available to English content generators, tools such as Digg and so many others. The rule seems not to apply itself only to user generated content, but also to applications, since an application has a much larger chance of gaining traction if it is in English. Of course this opens up a new door, the “localized version” door. If applications do not localize themselves to certain countries, a natural evolution of the web and the vacuum left by this application might generate local sites, developed by local people with local cultures. Take a look at BlogBlogs, based on Technorati but for a Brazilian audience.

Globalization, or whatever you want to call it, is changing this picture, more and more references are popping up in different languages, new bloggers and new sites. This is turning the web into a truly multi-language environment, which means content is now being generated in various languages, and then making its way to English speakers, no longer exclusively the other way around.

This is positive, but it also weakens the unified language pattern and has a second side effect, very negative in my opinion, and which inspired this reflection. New internet enthusiasts and content creators are actually feeling as if though learning English is not important anymore. “Hey, I have that in Portuguese” or “I can just google-translate it” are phrases heard more and more often these days, and this is bad. People begin to get locked up in little box, an expanding box, true, but a box anyway. Poorly translated material and lack of “knowing better” precipitates this chain reaction. And this ultimately is reflected at technology events like the Campus Party event in Sao Paulo.

Tim’s session was a embarrassment in my opinion. In order to accommodate the segment of the crowd that did not speak English, the session was presented with a translator being present. If it was done with simultaneous translation this might not have been as bad, but it was a ping-pong style translation. This gave Tim some problems, having his line of though interrupted by the translator, who could not let him go ahead with too many phrases before she translated it, and finally, she was not a technical translator making quite a few translation mistakes, and losing some technical terms all-together, such as the very complex “HTTP”.

This is the point where globalization really annoys me. These high level events and sessions, directed at high level developers and internet professionals, should not need translation from English, since it is such a widespread and globally accepted language, especially in the world of technology. This would act like a filter and solve other problems of these sessions, raising the bar on quality of attendees, avoiding some of the questions that were asked, for example where Tim (the creator of the web) was asked how we could make the transition from the web to the web 2.0 and 3.0…the only thing not added to the question was “where can i download the patch?”

So my final suggestion to you is, spread out, make yourself available to more content, learn English and if you have a chance, learn at least one of the other big 5 languages other than your mother-tongue. The content is out there, go after it.

[first published on the SWAT Blog]

1 Star2 Stars3 Stars4 Stars5 Stars (Sem votos registrados)
Loading ... Loading …

1 Comment »

January 26th 2009

Review: Essential PHP Security

phpseccover

Even having being published in 2005, the book “Essential PHP Security” addresses a very up-to-date topic even today. Written by Chris Shiflett the book goes through various security aspects associated with a PHP application, for that reason even to today its content can be considered updated and applicable to various day to day situations faced by developers.

The book has a very easy going and exemplified approach to expose the various aspects presented. Aspects which are very clearly exposed and separated in chapters, going all the way from forms to includes and security in shared hosting environments. Each topic is analyzed in detail and internally divided into exploits and attack strategies for that security flaw, that way the book also becomes a easy to access reference book where its possible to go directly to the chapter that addresses the specific aspect you are coding right now, allowing you to know which flaws to look for. Further the introduction chapter presents Principles and Practice os Security which can be applied in any application and any language, like for example “Defense in Depth”, allowing you to glimpse the fact that security is much bigger than analyzing specific points of you application.

Even having a few years on it, the book addresses topic like XSS that play a important role in the AJAX driven web we observe nowadays. Also old friends like Session Hijacking and SQL Injection are analyzed from various points of view, aligned to the various segments of an application. This structure makes for a very light and enjoyable reading experience which can easily fit into these moments of relaxation or in the waiting room of the occasional visit to the doctor’s office (it worked for me anyway).

This book deserves to be part of any developers history (or shelf), at least to serve as a reminder and inspiration for reflection, even in a world where more and more Frameworks internalize all aspects of security, but as I always say, we developers should always know what goes on behind the curtains.

 

 

Essential PHP Security A Guide to Building Secure Web Applications

By Chris Shiflett
October 2005
Pages: 124
ISBN 10: 0-596-00656-X | ISBN 13: 9780596006563

1 Star2 Stars3 Stars4 Stars5 Stars (Sem votos registrados)
Loading ... Loading …

No Comments yet »

January 4th 2009

Seven Things you might not know about me

Cool, I think this is my first English meme/tag, so let’s go.

 

This one has been making rounds on the PHP Community, and for some weird reason Ben Ramsey elected me to a spot on that list. So here goes, let me dig deep into my past and bring up some weird and unknown stuff. 

I was also tagged by Luke Crouch

  1. I played Basketball in High School. Before I became this “slight” overweight programmer, I was a lean basketball machine for 3 years straight in my High School in Brazil — Mackenzie.
  2. I’m a apprentice Globe Wanderer. I have lived in 3 states in Brazil (DF, RS and SP) and in 3 countries, Brazil (most of my life), Germany (the early years 1-3) and St. Lucia in the Caribbean (where I learnt english and basketball, from 12 to 16)
  3. At some point my nickname became White Mike. Yeah.. that was during my St. Lucia years, but I was never sure if it carried a sarcastic weight or admiration…. I guess both.
  4. My first program was written in GBASIC. Ok, it was a copy paste from a magazine to write up a “lookup dictionary” for the collection (it was called Descobrir), from there I dabbled in Pascal, C and Java in university, and finally PHP in my first job. Oh… and my first shot at a programmed website was using Coldfusion (sorry.. sorry!)… 
  5. Back home I was the Pizza Guy. Back in Brasília, DF before I moved here to São Paulo I enjoyed getting everyone together for Pizzas. I had a brick pizza oven and I was the official pizza operator, man.. i miss those days.. and those pizzas!
  6. I’m a mutating dictionary. I have a knack for creating new words and getting a hard time for doing so, especially from my Wife who does not miss the opportunity to point out my mistake and make fun of me.
  7. I met my wife do to Vodka and the Internet. Two of men’s best inventions got me married, vodka to get her drunk and the Internet so she could find me on fotolog and add me on MSN. Also we had our first kiss during a play of Disney’s Songs, the background music was The little Mermaid’s “Kiss the Girl” song… hey… I was just following orders :)

 

So now I have to tag some new guys, let me hit up a few friends and also try to spread this inside Brazil

 

  • Augusto Pascutti – Co-founder of the PHPSP group and someone who looks like he has a few surprises
  • Guilherme Blanco – who need to blog a little more between solving bugs in Doctrine
  • Adler Medrado – old buddy from PHPDF
  • Ivo Nascimento – cause if the guy is using PHP in neural systems… he must have some cool things we should know about
  • Chris Jones - Who I met in ZendCon and has been in Brazil for a visit recently
  • Marcelo Araujo – if he has a sober minute to do this
  • Chester – the weirdest guy I know that does not scare me

 

Rules are simple guys:

 

  • Link your original tagger(s), and list these rules on your blog.
  • Share seven facts about yourself in the post—some random, some weird.
  • Tag seven people at the end of your post by leaving their names and the links to their blogs.
  • Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.
1 Star2 Stars3 Stars4 Stars5 Stars (Sem votos registrados)
Loading ... Loading …

1 Comment »

Next »