Click on the Play button to listen now.
Manuel Lemos: Hello, welcome to the Lately in PHP podcast. I'm the regular host Manuel Lemos, and I have here with me my regular co-host Ernani Joppert. Hello Ernani, how are you doing?
Ernani Joppert: Hello, Manuel, hello everyone, I'm doing great and glad to be here again.
PHP for Android project (0:44)
Manuel Lemos: Well, this month we have some very interesting PHP topics to talk about. I think it would be more interesting to start talking about the PHP for Android project.
I don't know if you have read already the article that I just published a few days ago with an interview with the lead developer of PHP for Android
. It is basically a project that allows to develop native applications for the Android devices using the PHP language. Ernani what do you think about this project?
Ernani Joppert: Yes, I've read about the article, I didn't go through everything, every detail, but this represents a very, very nice...
You can see that the mobile development market is growing very fast, and by doing in PHP abilities into Android market seriously represents a very good impact for PHP developers.
And as I've been through reading this article I saw that you can pretty much start developing any kind of applications based on Android, and this seems a very promising project. I hope to keep up with this and I will surely test it out eventually.
Manuel Lemos: Yes, from what I've heard, I do not have an Android phone, actually I do not even have a smart phone, I have a mobile phone but it is very basic, but from what I've heard there are many people developing applications for smart phones, for iPhone and now for Android, and then they publish those applications for sale in application stores. And I've heard that some people, at least, are making a lot of money from developing these applications.
Ernani Joppert: Right, yes, the mobile market is growing very fast and you can see the trends by Google and by Apple. That is a very, very substantial increase of competition, as well capabilities.
You see that developers can now promote their application not just by selling but also advertising, which is something that will most likely grow a lot.
And by bringing PHP into this area I wouldn't be afraid to see very useful applications for Android and hopefully there is support for other mobile platforms that will eventually tie together PHP based web sites as well as applications.
And you can see this evolving as Twitter has their user interfaces to interact with most on any mobile platform. But a few of those you see interacting with WordPress and other services, and in specific services as well, because some companies can pretty much use the mobility of their employees to interact with their relatives and areas and interact with communication and systems.
Basically all kinds of applications could perform such tasks right now. I don't see any kinds of restrictions on the mobile area.
And I own a Blackberry and I've been playing with it, and I've developed one basic application to interface with SoundCloud which is a service for music producers to share their content.
And it's a very nice way to interact with a service, but it has some restrictions. And I've been struggling a lot with some particularities. But it seems that the Android market is way more mature, as well as the iPhone one.
Manuel Lemos: Talking about your smart phone, what kind of tools do you use to develop your applications? Is it on Java or is there any SDK or IDEs to help developing those applications?
Ernani Joppert: Yes, Blackberry specifically has a Java background, so you're pretty much using the Java mobile API's, the MIDP which is the mobile... I don't remember the acronym, but it's basically Java, and they have Windows based development platform.
And I'm hopefully willing them to provide this for Mac users as well as I own a Mac now, I've changed, and hopefully eventually they will focus on this development market as well and provide the same kinds of development solutions for Mac users, and hopefully Linux as well because we never know.
Manuel Lemos: Yes, what seems to be interesting about this, the Android platform, is that originally they would only support developing applications in Java, but then they started opening a space for using scripting languages, not just PHP actually, they started with Python, I believe
And now they are making it easier for developing those applications with other languages that tend to be easier to develop because they are scripting languages.
From what I heard, actually the developer of the PHP for Android mentioned that developing applications for the mobile phones in Java is quite painful. I think that is probably due to because everything in Java is bureaucratic.
Ernani, you regularly develop applications in Java, do you agree?
Ernani Joppert: Yes, Java has too much specific requirements. So if you are developing a simple solution you would have to at least have a small amount of a structure in your code to achieve that. And by using scripting languages for simple purposes this would be a huge impact.
Java tends to be focused more on enterprise grade and multi-tiered applications, and sometimes you can reduce these kinds of specifics by using a simple way to interact with your users.
And sometimes this is what you see with the growth of PHP in the whole world. You see that most of the Open Source Web applications are tied with PHP because it's way easier to understand and it has not as much restrictions as Java does. Restrictions, sometimes helps and sometimes doesn't help.
I see I like PHP because you can write pretty much good code and not good code. And with Java this gets a little bit harder. They try to make you a strict way to develop your applications.
Manuel Lemos: Yeah, I think it's also the way you do things in Java tends to be more complicated. For instance in PHP you just... if you want to manipulate arrays, in Java it's quite bureaucratic, you have to create an object and then you have to call methods to populate the array.
And in PHP what you do with a single command, in Java you have to write a lot more lines of code with many commands to do the same. And I think this is just an example how bureaucratic Java can be. Basically this means that opening space for these scripting languages, not just PHP, will make the lives of developers much simpler.
Ernani Joppert: Well, yes, and assuming that you're using a scripting language, I feel that you can achieve faster sometimes the results that you expect, and you can also provide some prototypes. You don't have to compile lots of code, lots of design patterns, and make your application look very well structured in the beginning of your ideas, you can just make it simple.
Manuel Lemos: Yes, rapid development.
Ernani Joppert: Yeah, with scripting languages those kinds of restrictions that Java imposes makes the difference very, very high in that area.
Manuel Lemos: Right. And there are also other interesting aspects of this PHP for Android project. Basically the developer already provided, I think it is... I have not inspected the code, but from what I've seen in the examples they provide an object that you can make calls to the Android API to manipulate the user interface directly.
It's not like the regular web applications that you have to generate HTML. You actually perform calls that, for instance, if you want your device to vibrate, you have a call to make it vibrate. This is more optimized way, so to speak, to take advantage of the native capabilities of the Android project.
But other than that I think there is a lot of resentment about what developers in general, and also users that are not developers, think about the way Apple is conducting the access to the devices and all the requirements and restrictions of what you can do, what you cannot do, the language that it can use, the platforms that you can use there.
For instance, the famous restriction... actually they do not support Flash on the iPhone and also iPad. Well personally I don't mind much because I don't use Flash, but I know for instance you, Ernani, you are a big fan of Flash and you probably are a bit upset about this lack of support of Flash in the iPhone What do you think?
Ernani Joppert: Oh, yes, I don't mind Apple's decisions. I guess that they are will mature to decide if they will adopt Flash or not in their platform. But I guess they could provide a way for developers to migrate their existing Flash applications, or to make the Flash applications run well on their system.
Manuel Lemos: They say it's Adobe's job to make... One of the complaints is that Adobe never provided implementation of Flash that actually runs fast enough and without crashing on iPhones.
Do you think that is a fair claim? Is it really Adobe's responsibility to assure that, or do you think there may be not very good will from Apple's side to cooperate and really do the best to make it possible? What do you think?
Ernani Joppert: Yes, one point is I've seen a lot of Flash applications, specifically on gaming and basically on entertainment based Web sites. And those kinds of Web sites they are very heavy.
I've seen some friends playing Farmville, and that kind of application takes about 200 megabytes on your memory in a heartbeat, depending on the complexity and on your evolution on the game. And Flash on that specific area takes a lot of CPU and takes a lot of memory.
I don't feel that if you're planning to grow your gaming platform in that language is the best decision. But eventually I feel that Adobe will make some changes on the plug-in to make it run better and run more stable.
But Apple's decision to throw the fault in Adobe, it's not very fair. I mean Apple should provide on their own, their own implementation of Flash interpreter if they're concerned about this.
Manuel Lemos: Yes, I think that's a good point that you are mentioning because ultimately it's the user that paid for the phone that should decide what he wants to do.
If he wants to blow his phone, wants to burn the battery with resource consuming applications it's his problem. And this makes me wonder if Apple doesn't have other reasons to avoid Flash in the iPhone and iPad, that they are not really mentioning.
I'm wondering if Flash could be used to work around some limitations of their... some restraints of their platform. I wonder if for instance they've blocked Google voice, which is an application that Google developed that somehow competes with services provided with some mobile carriers. I wonder if a Flash application could work around those constraints.
Ernani Joppert: Yes, the Flash plug-in in PC has webcam facilities and streaming media as well.
And I've mentioned it on the previous podcast that I've been checking out Red5, which is a streaming server based on Java, an open source project. Red5 does basically the server side and a Flash application or a Flex application could do the client side.
By providing the Flash API on a mobile device, which is like say Android, like this instance, you could pretty much develop a voice over IP or a user to user video chat application in a second.
Manuel Lemos: And you could also download code. An application couldn't download more code that is not audited by Apple before they approve it in the App store, could that happen?
Ernani Joppert: Yes, this is one very big point that I've heard and I agree with most of the comments regarding this decision from Steve Jobs which is related to the policy and control of their platform.
If somehow you allow everyone to develop everything on your system then you don't have the control that you want or you wish to have on your system. I guess that these are some of the concerns of Steve Jobs, and I feel that he wants to make his development platform, his SDK, the only option and the option that they can audit and they can ensure that nothing is harming their system.
Manuel Lemos: Yes, that's another comment that the developer of the PHP for Android made regarding the tools.
Apple only allows their tools to be used for developing applications. And with this initiative of the Android organization, which is headed by Google but is not just Google, they allow to use scripting languages that basically could be languages that are not under the control of Google or any of the members of the Android organization.
And this is something that gives us developers and also users the freedom to run applications that could be developed in other languages, like PHP. So this ultimately is good for the developers and users of the Android devices.
And in the end it will be a disadvantage for those that don't use and develop applications for iPhone and iPad and so on. And this seems to be an important factor which the developer of the PHP for Android mentioned in the interview.
Ernani Joppert: Right, and also not mentioning the hacking world which is something, not hacking in the bad way, but hacking in the way that you could lose the control of some resources.
So let's say some kind of processing and capabilities of those mobiles, mobile platforms, like say an Android device or platform, you could easily perform some tasks that would drain the battery life or could do something that they don't want you to do.
Manuel Lemos: That always sounded to me like a bit of a forced excuse.
Ernani Joppert: Right, that's true.
Manuel Lemos: Like I just mentioned before, if the user of the phone wants to run an application that drains the battery, it's ultimately his problem.
And even if he complains to the company that developed the phone, it's ultimately his fault, but it should not be disallowed to do so because smart phones are not cheap devices. If you made a significant investment in the phone it should be his responsibility to run whatever he wants. And if that drains the battery too bad, but at least it would be possible.
Ernani Joppert: Yes, and when you have a... it's basically the computer problem we've had in the past, the PC war, right? And it's now coming again, and again, and again because you want to... if you are a vendor, and specifically Apple which designs their own hardware, they want to remain specific and controlling what should run in their machines.
They provide a way for running Windows on their system, but you need to have a special way of booting your hardware and then you can run your Windows. But it's not very... I mean it's easy because you can find it on the Web, but it's a choice.
I mean if I have an Apple laptop and I want to run Windows on it or if I want to run Linux on it, it's my decision. It's not Apple's decision because the device is of my own.
So if I somehow developed already an emulator of games and I want to make it available on my phone, and then if I have an excuse to build such an application by using C language or any kind of language, and I can port to address specific API requirements, then it's my decision. But it seems also a marketing strategy of Apple because they have their App store and the only way you can...
Manuel Lemos: That's right, to protect to their market, but I don't know. This seems to me that it's like 1984 is coming back. In 1984 Apple launched the Mac and it was a big deal that made a lot of noise about it and it got the attention of many people.
Apple was sort of the leader in personal computing then. And because their computer provided graphic user interface and it was available to everybody without having to expend many tens of thousands of dollars that powerful computers would cost by then.
But then later Windows came to provide also graphical user interface based environment for any PC, not just Apple, PC's running on Apple hardware.
So somehow what is happening now with Android and the iPhone and iPad, if you want to put them together, it seems to be happening all over again.
Apple comes with a platform that only runs on their own hardware, and then another company, this time Google and everybody else involved in the Android organization, that are building a platform that will run on many types of devices from many vendors, not just one particular vendor.
Personally I think it's very exciting, the Android project, I was not planning to buy a smart phone because I don't have a very mobile life. I do not have a great need for smart phones. But now with this support of PHP for Android I'm really considering buying an Android device.
Ernani Joppert: Right. Yes, it brings a lot of power to the end users. I mean imagine in a way you have a custom application specifically targeted to run on that device and you can gain some capabilities by achieving this.
And I'm not talking about of a..., I mean you have PHPClasses but you can interact with your users and their phone capabilities to, let's say, I'm in this area and I have some available time to be able to consult to provide consulting to some interested companies or even there will teach some users PHP while I'm here in this location.
You could easily gather this kind of API, these capabilities of the device through the API using PHP, which is a language that you are already familiar with, and easily interact with your own website so you can publish user's locations and make them aware that you have this social interaction between your own community which is basically PHP classes.
It's a community of PHP developers talking together and interacting together. And with a mobile world there is a whole new scenario coming through. I mean your creativity is what defines you, and if you have the capability to explore it more why not, right?
I've seen one particular idea that I wanted to share here is those coupons, those discount coupons. I guess it was an actor, a famous actor of Lost, he had the idea to develop an application based on iPhone. You could pretty much generate an electronic coupon using bar code, and I've seen a lot of classes that has the code ready for you to use under PHP classes.
So you can pretty generate coupons on your mobile and interact with a physical store. So if you want to buy let's say a book you can generate specific coupons on your mobile. You can buy a book with a special discount. So this is a whole new world coming through and PHP on the phone, I mean it's very, very nice.
Manuel Lemos: Yes, I think it was a clever initiative to add built-in support in the Android for running a scripting language, not just PHP. Ultimately that will bring millions of developers to the platform. I think the future is bright for the Android platform and PHP and other supported scripting languages.
But I think we already beat this subject quite extensively, so lets move on to another interesting subject.
PHP 6 cancelled and APC on PHP 5.4 (29:58)
Manuel Lemos: Something that I want you to talk about that is related to something that happened last month.
I realized that not everybody is aware of what exactly happened, but some time ago PHP 6 practically cancelled, cancelled in the sense that the plan to develop a new PHP version that has built-in support to Unicode text strings is basically cancelled because the project was too complicated and it seemed to never end.
Well, I'm not sure if this is accurate, but that was what I perceived. Ernani, did you realize that PHP 6 was cancelled or is it just my impression that most of the community did not realize that?
Ernani Joppert: Yes. My connections with PHP are really on the freelance area, and I now wasn't aware. I just heard about it a few days ago. I mean they probably had a reason for cancelling it.
Manuel Lemos: Yes, it was not something that was widely discussed. It was not so recent. It was not last month it was before.
What I wanted to mention that happened last month is that there were some discussions to include back features that were only planned for PHP 6 to include them in the PHP 5.4.
One of the things that was only planned for PHP 6 was to include the APC caching extension as to be shipped in the base of PHP because APC is an extension that is available in the PECL repository. If you want to use it you can just download, compile it and link it, install it in your PHP installation so you can use it.
But with this decision to ship it built-in, when you use pre-built PHP distributions, APC will be available. This is interesting because PHP initially shouldn't enable any caching extensions, it will run significantly slower.
With this caching extension many of the complaints of those that are often supporters of other languages that use that fact to claim that PHP is slow, and PHP is not slow, with this caching extension the overhead of compiling PHP to Zend ocodes will be practically removed.
It's just on the first compilation, on the first run there will compilation of PHP into opcodes, and then it will run smoother, it will not take so much CPU from the Web servers. Basically it will pass the idea that PHP is much faster. PHP will run at the same speed but you will not have that overhead.
Ernani Joppert: Right. And there are a lot of benefits from implementing those cache extensions, right?
Manuel Lemos: Right.
Ernani Joppert: Because you avoid disk I/O and there is a lot of bottleneck there which can cause if you have slow hard drives or if it fails somehow.
Manuel Lemos: It's not just for execution of PHP code, you can actually store variables, cache them in memory, in shared memory. So all instances, all processes of your web site will be able to use that cache. That is in your Web server shared memory, so it will be very fast. So it will not be just the regular PHP execution but will also be the access to data that can be cached more efficiently.
Ernani Joppert: Right. And with the amount of PHP hosting services that we have in the world right now, when they upgrade this, I'm not considering they are not aware of this, but with this being a built-in feature it should represent a significant amount of users adopting it and hosting services adopting it, and benefiting from it, right?
Manuel Lemos: Right. It will basically take a lot less CPU and consequently server resources, but there is one detail.
There was sort of a vote in the PHP internals list of whether APC should be included in PHP 5.4 or not. Most of the developers decided to include it, but there is a second question to be voted, is to whether APC should be enabled in PHP configuration or not.
And most developers voted against it, so the idea is to include APC in PHP 5.4, but it will be disabled. You have to change your php.ini to have it enabled. So basically it will be up to the Web server administrator to decide whether they can have APC enabled or not.
There were some discussions about the reasons for this, and some people claim APC is not perfectly stable. There are some cases that may cause it to crash or something like that from what I understood. So I think it is wise to not have it enabled by default and leave it to the systems administrators to decide whether it is safe to enable it or not.
Ernani Joppert: Oh, yes.
PHP Programming Innovation Award of May 2010 (37:15)
Manuel Lemos: And this is something that is very interesting to talk about, but we are going to move to the next section of our podcast which basically about the classes that were nominated to the PHP Innovation Award that happens every month. But this time we're going to talk a bit about the winners of the edition of May.
Ernani, are there any classes that you think that are worth mentioning?
Oh, yes, I've been reading about them. Two of those took my attention, and one is the PDF text extractor
, which seems to be a very useful class.
Even for personal development purposes, because you have a large amount of PDF files in your system and you want to search or organize it by ISBN code, you could pretty much write your own code to interact with those files and rename those files based off the ISBN code.
And this class has a lot of capabilities, I mean you can pretty much index your contents, your PDF contents, and share it among universities or colleges, for education purposes. It's a very nice solution, and it brings a lot of power, an easy way to interact with PHP files and PDF files. So a lot of users should benefit from this.
Manuel Lemos: Yes. One potential use of that class would be to extract the text for indexing purposes like, for instance, if you have a database with PDF documents, you want to search it for text that it contains, first you have to extract the text that is inside and then only then you can index it for searching purposes.
Then you could store it for instance in a regular SQL database and search the SQL database to find PDF documents that have the text you are searching for. So this could have that very interesting application.
Ernani Joppert: Oh, yes. And one of the points is based on the past of my career. I had some requests to index those files, and I had to do a lot of research and taking a lot of time consuming understanding custom PDF code and PDF libraries and having to write in modules in a C language or in the times of VisualBasic.
So right now if a company decides to provide their annual reports on PDF format, and index those files, should be a very useful way to distribute it in Internet or Intranet applications. So you have a vast usage of this class. This brought me a lot of attention here.
Manuel Lemos: Right. What other the classes...?
And the other one which took my attention is the Duplicates file finder
is one of the personal favorite ones.
Because as I've understood it, it does checksums, checks of the contents of a specific file and it compares with a lot of other files in different directories and this saves a lot of issues, especially when you don't have all the skills either on shell scripting or you have a limited resource to interact with a server and you have to quickly search for duplicate files or failed uploaded files. This could easily reduce your hard drive duplicated files. And I mean it's the very, very nice way to use PHP.
Manuel Lemos: Right. It seems simple and also clever the way this class was developed to provide this functionality.
Also I'd like to comment that the author, Rochak Chauhan
from India, is one of the top contributors of the PHPClasses site.
He contributed tens of classes over time. And particularly this month he had, let me count here... four classes that were nominated for the Innovation Award, which makes him the lead author, not just for the month of May, but also for the whole year.
So he's a serious candidate to win the Innovation Award of the year. And we'll see what other interesting classes he can bring up.
I don't know if you are familiar with Fast Fourier Transform, this is an interesting algorithm that basically allows you to compute the spectrum of frequencies of, for instance, a sound sample.
If you have a sound sample you want to analyze what frequencies it takes, if there high notes or low notes or whatever, you can use the Fast Fourier Transform.
You can use it for many purposes that apply this algorithm. For instance, lets say you want to filter frequencies on a specific range, you use the Fast Fourier Transform and then you change the resulting spectrum.
Also this package can perform the opposite operation, which is the inverse Fast Fourier Transform, which basically starts from the spectrum and computes the original sample.
So one thing that you can do with this class is to take a sound sample, apply a frequency based filter and take the resulting sample for some purpose. I think this is basically what was done, and now that the Soccer World Cup, has ended I'm sure you heard a lot of complaints about the vuvuzelas.
Ernani Joppert: Right, yes.
Manuel Lemos: I noticed that several TV channels around the world have applied a sort of frequency based filter to suppress or at least atenuate the sound of the vuvuzelas, as if they were not there.
Basically while this is done is to using some very fast system to take the sound of the recording from the soccer field and then apply a Fast Fourier Transform to compute the spectrum and eliminate the frequencies that correspond to the sound of the vuvuzela.
Then use the inverse Fast Fourier Transform calculation to restore the sound. The result is amazing. As I mentioned, it's practically as if the vuvuzelas are not there. This seems to be a very interesting application.
Ernani Joppert: Yes. And it's basically what equalizers are based of, right?
Manuel Lemos: Right. And equalizers apply whatever are the parameters that you define on each of the frequencies bars to adjust the sound that is coming in.
Ernani Joppert: Right. Each of those equalizer knobs are cross-faders, basically are tied to frequency gap and if you apply it, it will basically affect the current sample.
Yeah, it's very nice. And one of the other ideas that I wish to achieve, remember that I mentioned on the SoundCloud application that I was writing for Blackberry, is to apply Fourier transformation to gather all those frequencies and basically draw away for a specific track. So this would be a very useful example.
Manuel Lemos: Yes, for PHP, this is probably to do it natively in PHP not be very fast. So it is not quite viable to use it for real time filtering. But the principles are there, and if you want to develop an application that requires this sort of filtering that does not need to be performed in real time. I think this is quite a viable class for that purpose.
Ernani Joppert: Oh, yes. Yes, it's a very nice example.
Another class that I wanted to mention is this splx_graph
by Alessandro Vernazza
, also from Italy like Michele Andreoli that developed the Fast Fourier Transform class.
The splx_graph class renders polygons, triangles mainly, and then it can specialize to other shapes in using just HTML tags.
And this is very interesting because sometimes you want to render an image made of vectorial graphics, but for some reason you cannot use image files, GIF, JPEG or PNG. And with this class it generates HTML that renders polygons of many shapes using just HTML. It seemed to me a very interesting class.
Ernani Joppert: Oh, yes, specifically when you need to provide graphical explanations of a flow and basic drawing capabilities, right?
Manuel Lemos: Right. And I have not tried it, just analyzed, but I think in some cases it will generate a lot of HTML to render each pixel of the shapes, but it seemed to me very interesting nevertheless.
I think we pretty much covered the most interesting classes. There are many other classes that were nominated, but we don't have the time to comment on all of them, but I think this is a very interesting section of our podcast.
So given this I think that is all for now, and this episode was quite interesting due to the subjects that we covered.
And next month I hope to have a big announcement to make regarding a new site that I'm about to release. I think I will dedicate most of the time to that new site that is very correlated with the PHP classes site.
Ernani Joppert: Oh, yes, I'm looking forward for this one.
Manuel Lemos: So, if you don't have anything else to comment about I think that's all for now. Thank you, Ernani, for your participation again. I hope to see you again next month.
Ernani Joppert: Yes, thanks a lot Manuel.
And just a message to all you developers, keep checking the site and also send comments about the podcast. Suggestions are welcome, and we want to hear feedback from you guys. And if you have ideas and anything that you would like to hear here, or a comment or take some knowledge about, let us know.
We've seen that there are several classes here that could be used for ideas for your own project or for some specific requirements on your current job. And we want you to be familiarized with the site and with PHP and the whole scope of PHP.
And we are open to any kind of suggestions. I guess that's all.
Manuel Lemos: Yes, and if anybody has a PHP project or a project that could be of great interest to the PHP developers that would like to talk to us about it, feel free to contact us and we'll sure to find some time to fit you in the schedule of one of the next podcasts.
So I think that's all for now, bye.
Ernani Joppert: Bye, bye.