If you get that kind of error:
ArgumentError (parent directory is world writable, FileUtils#remove_entry_secure does not work; abort: "/tmp/gitosis20121120-26282-1q9qa73" (parent directory mode 40777)):
Check for permissions for /tmp directory. remove_entry_secure accepts world-writable directory in a path only if it’s /tmp, but only if that directory has 1777 permissions.
Some time ago I was trying to install PEAR with default installation of Zend Server. To do that, you have to run a following command:
C:\Program Files (x86)\Zend\ZendServer\bin\go-pear.bat
That resulted in a problem with PHAR archive:
phar "C:\Program Files (x86)\Zend\ZendServer\bin\PEAR\go-pear.phar" does not have a signature PHP Warning: require_once(phar://go-pear.phar/index.php): failed to open stream: phar error: invalid url or non-existent phar "phar://go-pear.phar/index.php" in C:\Program Files (x86)\Zend\ZendServer\bin\PEAR\go-pear.phar on line 1236
To solve that problem, you have to either modify php.ini file, adding following directive:
phar.require_hash=0
Or, you can use it one-time only, setting that configuration option in command line:
C:\Program Files (x86)\Zend\ZendServer\bin\PEAR> php -d phar.require_hash=0 go-pear.phar
The latter form is preferred, as disabling checking signatures is considered a security flaw.
| Tags: | phar, php, require_hash, windows, zend, zend server. |
Your own Facebook User ID is required in many places, like setting admin ID on your page’s OpenGraph tags. Most of advice available on the web regarding getting your own Facebook ID suggest looking at links on your profile page, but that kind of advice is usually outdated and unusable if you have vanity URL (your username replaced user ID in URLs). You can look into the profile page source and bash through tons of code, and yes, you can find it looking for some strings inside the source code, like it’s pictured on a screenshot. But it’s a tedious job, and there are more elegant ways.
Specifically, you can use OpenGraph API Explorer, available here. Input field is already prepopulated with me value, that obviously tells the Explorer to show data for currently logged in user. But before this could work, you have to authorize API Explorer to access your data by clicking Get access token button, choosing minimal permissions (user_about_me is definitely enough – see this screenshot), and authorizing the application in a standard way, like any other with Facebook.
After granting permissions, Access Token field is populated automatically, and you can clickSubmit button to get information about your user. User ID will be the first field.
When you have your user ID, you can check if it’s a proper one on the same page – just enter your ID instead of me and hit Submit – you should see your basic data.
ZendCon 2011 Slides
Here are slides from ZendCon 2011 sessions. I’ll update the list as soon as I find missing slides or they are posted. I’ll try to add UnCon sessions too.
Monday, October 17th
- PHP Extensions, Why and What?
Derick Rethans
- Creating and Using Streams, Filters and Sockets
Elizabeth Marie Smith
- Doctrine 2
Juozas Kaziukenas
- PHP Components From Idea To Maturity
Stuart Herbert
- Zend PHP 5.3 Certification Boot Camp
Christian Wenz
- Learning CouchDB
Bradley Holt
- Design Patterns in Action
Stefan Priebsch
- Beware of the Dark Side, Luke!
Arne Blankerts
Tuesday, October 18th
- HTML5 WebSockets
Scott Mattocks
- Benchmarking Applications and Frameworks
Paul Jones - PHP Batch Jobs on IBM i
Alan Seiden
- Git for Subversion users
Stefan Koopmanschap
- Development in the 24th and a Half Century
Kevin Schroeder
- Cloud Based Application Performance Testing
Moris Chen - Xdebug
Derick Rethans
- PHP and IBM i Frequent Questions, FastCGI, DB2, etc.
Tony Cairns - Overview of Zend Framework 2
Matthew Weier O´Phinney
- Scaling PHP Applications with Redis
Josh Butts
- SQL Injection Myths and Fallacies
Bill Karwin
- The Future of PHP on IBM i
Tim Rowe - Profiling PHP Applications
Derick Rethans
- Change is Inevitable (Except from a Vending Machine)
Stefan Priebsch
- Event and Signal Driven Programming Techniques
Elizabeth Marie Smith
- Open Source PHP Toolkit for IBM i
Mike Pavlak, Tony Cairns - A Practical Look At Symfony2
Stefan Koopmanschap
- Skynet in ZF 2.0
Ralph Schindler
- Under the Hood
Ilia Alshanetsky
- Zend Studio Tips and Tricks
Roy Ganor - DB2 and PHP Best Practices on IBM i
Alan Seiden - Manage Cloud Infrastructures Using Zend Framework
Enrico Zimuel
- Deployment Without the Chaos
Eric Ritchie
Wednesday, October 19th
- Scaling in the Cloud
Kent Mitchell, Uri Budnik - Introduction to Adobe Flash Builder for PHP
Roy Ganor - MySQL — Whats New
Dave Stokes - Large-Scale Data Processing with Hadoop and PHP
David Zuelke
- Dependency Injection; Containers and Frameworks In PHP
Ralph Schindler
- Extending Open Source Solutions for Large Scale Federal Applications
Rakesh Kumar - The Contextual Experience of the Mobile Web
Jeff Carouth
- SOA with Zend Framework
Mike Willbanks
- Intro to Flex
Anna Filina
- Triggered: Zend Framework 2′s EventManager
Matthew Weier O´Phinney
- Couchbase Mobile, The database that talks sync.
Matt Ingenthron
- Adding Dependency Injection To Legacy Applications
Sam Hennessy - Big Server is Watching You
Maurice Kherlakian - Optimizing Zend Framework for use on High Traffic Volume Web Sites
Shawn Stratton
- Character Sets Suck
Ligaya Turmelle, Raymond DeRoo - Using SPL Tools in Your Code.
Elizabeth Marie Smith
- API Security
Rob Richards - Injecting Domain Expertise into Varchars
Jeff Kibler - jQuery Mobile: For Fun and Profit
Daniel Cousineau - Cryptography in PHP: Use Cases
Enrico Zimuel
- Getting to know Zend Studio 9
Gadi Goldbarg - “Cloudify” Your Application
Maurice Kherlakian - PHP Testing Tools
Sebastian Bergmann
- Performing Security Audits
Arne Blankerts
- PHP & MongoDB
Steve Francia
Thursday, October 20th
- Care and feeding of a MySQL Database
Dave Stokes - Optimizing Application Performance
Kevin Schroeder
- Puppet for Dummies
Joshua Thijssen
- Introducing Assetic: Asset Management for PHP 5.3
Kris Wallsmith
- Unit Testing Zend Framework Apps
Michelangelo van Dam
- Mobile Development with Adobe AIR, Flash Builder, and Flex
Mihai Corlan - Javascript Tools and Frameworks Faves
Anna Filina
- Taming the Cloud
Rob Richards - Implementing The Open/Closed Principle
Sam Hennessy - Powering Your Website with Realtime Data
Bert Van Hauwaert
- Using GitHub
Scott Chacon - Designing HTTP Interfaces and RESTful Web Services
David Zuelke
- Mobile: Push for Sync and Notifications
Mike Willbanks
- MySQL 5.5 InnoDB Tuning
Bill Karwin
UnCon
- 12/15 Pro Tips for MySQL Users
Joshua Thijssen - Making dynamic sites scale like static sites
Wim Godden - Domain-Driven Design: A Collaboration Between Domain Experts and Software Practitioners
Bradley Holt - Creating Fast, dynamic ACL’s in Zend Framework
Wim Godden - Introducing Modules in Zend Framework 2.0
Evan Coury, Ben Scholzen, Ralph Schindler - Optimization tricks & mistakes to avoid
Ilia Alshanetsky
- PHP in the Dark
Jeroen Keppens
Last updated: 31 Oct
| Tags: | conference, php, slides, zendcon, zendcon 2011. |
Today I tried to deploy a Virtual Appliance from Bitnami on my ESXi server using ovftool:
ovftool.exe bitnami-xxx.vmx vi://192.168.0.100
But each time I had an error:
Device ‘VirtualDisk’ uses a controller that is not supported. This is a general limitation of the virtual machine’s virtual hardware version on the selected host.
What was funny, it was perfectly fine if I converted the virtual machine to OVA format and started it using… VirtualBox.
I googled a bit and found out that some people had that similar problems and what they did was to upgrade virtual hardware from version 4 to 7. It wasn’t a solution for me because I already had version 7 – so maybe the problem was that I had “too new” virtual hardware? I opened bitnami-xxx.vmx file with a text editor and there I had:
virtualHW.version = "4"
I changed it to “7″ and voila – it worked!
| Tags: | ova, virtual appliance, virtual hardware, vmware, vmx. |
Let’s say you have XML like:
<clients>
<client>
<name>foo</name>
<address>...</address>
<email>...</email>
<orders>
<order>
<id>id1</id>
<items>...</items>
</order>
<order>
<id>id2</id>
<items>...</items>
</order>
</client>
<client>
...
</client>
</clients>
And now you’d like to get pairs order_id-client_name. And you’d like to make it in an elegant way, using xPath, not using DOM navigation, or worse, SAX parser. Getting all “client” nodes is easy:
import libxml2
doc = libxml2.parseFile('clients.xml')
ctxt = doc.xpathNewContext()
clients = ctxt.xpathEval('/clients/client')
# clean up nicely
doc.freeDoc()
ctxt.xpathFreeContext()
But now, how to run an xPath query on every node you found to get client name and orders? You have to tell the context object to change the scope of context, so the next query would be relative to the node you chose:
for client in clients:
ctxt.setContextNode(client)
client_name = ctxt.xpathEval('name')[0].getContent()
orders = ctxt.xpathEval('orders/order')
for order in orders:
ctxt.setContextNode(order)
orderId = ctxt.xpathEval('id')[0].getContent()
print orderId+" "+client_name
And that’s it. I’m writing it because documentation for libxml2′s python bindings is scarce, and it took me a while to get to know about setContextNode method.
Complete script:
import libxml2
doc = libxml2.parseFile('clients.xml')
ctxt = doc.xpathNewContext()
clients = ctxt.xpathEval('//client')
for client in clients:
ctxt.setContextNode(client)
client_name = ctxt.xpathEval('name')[0].getContent()
orders = ctxt.xpathEval('orders/order')
for order in orders:
ctxt.setContextNode(order)
orderId = ctxt.xpathEval('id')[0].getContent()
print orderId+" "+client_name
# clean up nicely
doc.freeDoc()
ctxt.xpathFreeContext()
Zend PHP Certification
For some time I’ve been thinking about passing the Zend PHP exam, and having possibility to attend to Zend PHP 5.3 Certification tutorial session during the recent PHP/Zend Conference 2010 was the thing that pushed me to finally do it. I enrolled for the conference too late to get a free voucher for the examination, so I bought it myself after coming back home, and on Dec 13th I finally got the ZCE title (yay for me!).
What does it test?
At the ZendCon it was said that the PHP 5.3 update of the exam was a huge leap forward in the meaning of quality and thoroughness of testing. Before this version, to pass the exam it was necessary to more or less memorize the manual — function names, arguments and return values. As I didn’t pass any previous version I can’t comment this statement, but I know that on my set of questions I didn’t have many questions that could be labeled as “manual questions” — I remember one “what is the output of the following code” question that was somehow related to the knowledge of function arguments, but it was enough to know the capabilities of the function rather than “is it ‘f($haystack, $needle)’ or ‘f($needle, $haystack)’”, and other about a name of a configuration option, but a very popular and important one.
I found the exam very interesting, as the questions were not only about “dry” PHP code, but also about broadly defined web-related technologies. Databases, web security, web services, HTTP protocol, etc. Zend’s training department strongly stated that the exam is not only about knowing the function names, but about assessing if the person has all what it takes to be a good programmer. And I might confirm that — without proper experience in the web development field it is very difficult to pass the exam. I mean, you can memorize all the definitions of what XSS, CSRF, SQL join et al. is, but the questions are not about definitions, but about a proper understanding of concepts, like “would X solve the problem of CSRF”.
Is it difficult?
It depends. Even if you work with PHP applications on a daily basis, it’s still necessary to check preparation guides. Why? For instance, I’ve been using PHP since PHP3, but I didn’t need to use web services at all. And from study guides and the tutorial I mentioned before I knew that even if web services is not the most important part of the examination, I need to know at least something about all the parts of the test.
Most of the questions are simply “either you know the answer or you don’t”, and that way you can call the test easy. There are also some analytical questions, where you have to force yourself to do some thinking — but if you know how PHP works, it’s only a matter of time to get the proper answer.
The test consists of 70 questions, for which you have 90 minutes – it’s a more than a minute for a question. It’s not much, but as I’ve said before, for most of the questions either you know the answer or you don’t. That way you can go through the easy questions while marking the other for review (the examination software allows that), not wasting time on things you can’t answer from the top of your head.
Watch out for trick questions. It’s especially important on “what does this code print” — one single character can totally change the meaning of the code. If everything seem obvious, usually it’s not. Look at return values, variable scope, function calls etc.
My strategy for this test was:
- First pass: easy questions, test questions (generally those which took me just a few seconds)
- Second pass: difficult, analytical questions
- Third pass: questions I didn’t know the answer for, but with the possibility of proper extrapolation/guessing (questions without any possibility of me answering other way than guessing fell into the first category).
With this method it took me about one hour to fill all the answers.
How to prepare
Zend offers courses preparing for the exam, but in my opinion it’s an overkill. If you only need to refresh and organize your knowledge, $1000 for the course (well, minus $195 for the included exam voucher) is a bit too much. If you need more training (e.g. you don’t have enough experience with PHP), this course wouldn’t help, as it is not designed to teach you PHP.
Everything you need to know about PHP to pass the exam can be found in the manual, which is great, but it contains knowledge organized in a way that is not very helpful while studying for the exam. After buying voucher for the examination you should receive PDF version of Zend Certification Study Guide, which can help you to plan your learning. Generally, I’d advise to read the whole basics section of the manual — variables, data types, control structures, OOP, new features of PHP 5.3 (LSB, namespaces), and to skim through index of some elementary functions (string, array) to know what is possible with PHP. Check the list of topics covered by the exam (to be found on Zend page) and make sure that you know at least basics of each entry.
One more word about the Study Guide provided by Zend – it’s poor. It’s poor mainly because it’s not finished and at some places you can find placeholders instead of some real information. It’s nice to get anything (especially if there are sample questions — and it’s very important to read them as they give you some outlook how the test looks like), but after a year that has passed since the test has been updated I’d expect something better.
What to focus on?
According to the rules of Zend Certification I can’t leak out any questions, but I can give some suggestions. Aside from the obvious, I’d recommend to review especially:
- references
- streams, contexts etc.
- XML processing
- OOP’s features like inheritance, static methods, LSB
- PDO
SQL-related questions are quite easy, so if you know how to do select, insert and how inner join works, you’re good.
Any benefits?
A value of the certificate itself is debatable. It’s hard to tell if a potential employer will take that paper into consideration or not. Still I think it wouldn’t do any harm. It’s a proof that you meet a certain level of PHP (and web development in general) skills. Exactly like an English language certificate is to be verified on the first interview, your PHP skills will be verified sooner or later, but if you don’t have a proper entries in the résumé, you might not even be invited to the interview.
Few days ago there was a discussion about that on Twitter, and one of the guys said that having ZCE title means that you are not creative and you are wasting your time which could be spent on open source projects otherwise. I think its a very radical opinion. Having ZCE doesn’t exclude being involved in OSS projects. Also OSS projects are long term involvement that can’t be compared to one evening spent on a short recap. My opinion is — don’t put all your eggs in one basket. You can’t rely on the certificate solely, just like you can’t rely on open source projects. Working on public projects can be beneficiary to your skills (but — looking at some of the high-profile projects — it doesn’t have to), and is a nice point on your CV, but just like with anything, employer might don’t give a crap about OSS (and saying “those companies that don’t take open-source into consideration are evil” is childish, recruitment procedures in big companies might be far away from the nearest person that knows anything about computers).
Preparation for the exam can be a value itself. It’s a motivation to look into subjects one didn’t need before (for me it was PDO – I was using abstraction layers, so I didn’t need that), and make a review of features and changes one possibly didn’t know about.
I decided to get the certification because I wanted to have some written proof of my skills, as even a list of prior projects does not say anything about the quality of those projects.
Should I re-test if I have PHP4/PHP5 cert?
Well, it’s up to you. If the certificate is for your better self esteem – go ahead. If it’s for improving your position on the market, it’s like with the value of the certificate in general — employer might value you better if you have the newest version of the document, but he doesn’t have to; he might don’t know the difference between PHP5 and PHP5.3 ;)
Conclusion
In my opinion, if you have some time and two hundred bucks to spare – go ahead :)
| Tags: | certificate, exam, examination, php, zce, zend. |
If you get this error on Redmine‘s email notification configuration page:
Email delivery is not configured, and notifications are disabled. Configure your SMTP server in config/email.yml and restart the application to enable them.
you did configure config/email.yml file, and you did restart the application, and this message is still showing in the administration panel, you can try placing the email.yml file in other directory. For me, it helped when I placed it in /etc/redmine/default/, where Debian keeps YAML configuration files for Redmine installation instances. If you run multiple instances on one host, you may have to change default subdirectory name to the instance name.
I’m writing this post because while the solution is trivial, I’ve noticed that many questions about this error on Redmine’s forum remains unanswered.
Today I wanted to give my users possibility to test their PHP scripts, but without all the fuss with creating virtual hosts for each one of them. My first and obvious choice was userdir – user creates public_html directory in his home dir, puts there files, and those files are accessible via http://servername/~username/ URL. To enable this behavior you only have to enable userdir module (a2enmod userdir), and remember to set correct permissions to the userdir (chmod +x $HOME) and public_html (chmod 755 $HOME/public_html). I did this, and everything was working fine, except PHP scripts – browser wanted to download them instead of displaying proper processed content. It appeared that apache in Debian has by default PHP disabled for userdirs. To enable scripting in this dirctory, open file /etc/apache2/mods-enabled/php5.conf, find that piece of code:
<IfModule mod_userdir.c>
<Directory /home/*/public_html>
php_admin_value engine Off
</Directory>
</IfModule>
and disable it, either by deleting or by commenting it out (precede each line with # sign). You can also change php_admin_value engine setting to On, but if you do that, you will be unable to turn off PHP engine in .htaccess files.
Few days ago I wanted to create VirtualBox image of Debian Squeeze (current testing release). I already had Debian Lenny (stable) image, so the whole process seemed relatively easy – dist-upgrade Lenny, switch to “testing” apt sources, then dist-upgrade. It appeared easy, but in fact there were some bumps on the road. Dist-upgrade broke on “udev” package. From what I’ve understood, udev didn’t want to be upgraded while working with old kernel, and kernel wouldn’t be upgraded because of some unmet dependencies. At first it seemed that the upgrade upgrade process broke down the dependency system and the easiest way was to install the system from scratch. But udev package has an “emergency rope”. When you pull it, you promise udev that before the next reboot you will upgrade kernel – and udev will believe you and install. To use that rope, create an empty file /etc/udev/kernel-upgrade and then manually install the udev package, which already resides in /var/cache/apt/archives directory. After this you can continue dist-upgrade, using -f switch. So the whole set of commands to upgrade the distribution is:
apt-get update apt-get dist-upgrade cat > /etc/apt/sources.list << ENDF deb http://ftp.us.debian.org/debian/ testing main deb-src http://ftp.us.debian.org/debian/ testing main deb http://security.debian.org/ testing/updates main contrib deb-src http://security.debian.org/ testing/updates main contrib ENDF apt-get update apt-get dist-upgrade touch /etc/udev/kernel-upgrade dpkg -i /var/cache/apt/archives/udev_151-3_i386.deb apt-get dist-upgrade -f
After that upgrade should finish. But be warned – after switching from lenny to squeeze I’ve experienced some problems like kernel not booting (I run previous version and regenerated initrd – it, or something else, helped), problems with VirtualBox guest additions (had to install kernel sources for guest additions to build themselves, then reinstalled virtualbox-ose-dkms package, and then reinstalled guest additions from the CD image attached to VirtualBox).
Upgraded system needs a few touches, but that’s not unusual. Don’t worry about “udevd : SYSFS{}= will be removed in a future udev version, please use ATTR{}= to match the event device” and similar messages while booting – it will be silenced in future versions of some packages. You can fix it if you want by replacing SYSFS with ATTR in /etc/udev/rules.d/* files, but other similar warnings will appear. You can also run upgrade-from-grub-legacy script, if you chose to chainload new grub from the old one during the upgrade. There is also significant amount of files in /var/cache/apt/archives, which can be safely deleted after successful upgrade (in my case it was 2.5GB of data).
Phew, now everything works and I have a proper VirtualBox image of Debian Squeeze.





Recent Comments: