profilingPHP

Intro to Xhprof and Xhgui

En Davey Shafik ens explica en dues entrades al web Engine Yard com fer profiling d’execucions PHP amb el profiler de Facebook Xhprof i com visualitzar les dades còmodament amb Xhgui.

 

Dos interessants articles que ens endinsa en les noves eines existents per conèixer detalladament que està fent els nostres scripts PHP quan s’executen: Ús de CPU, memòria, cops que s’ha cridat un mètode o funció i el graph de crides.

 

En la millora de la performance de les nostres aplicacions, també s’aplica el principi de Pareto, que ens diu que en molts casos el 80% dels efectes són conseqüència del 20% de les causes. Així doncs aquestes eines ens ajudaran a trobar fàcilment aquest 20% de codi que degrada el 80% de l’execució.

El problema rau que VirtualBox empra StartUp Items per arrencar processos de sistema de VirtualBox i aquesta opció ha estat deshabilitada a Mavericks.

Per sol·lucionar-ho de mentre VirtualBox treu una nova versió, caldrà executar des del terminal:

sudo /Library/StartupItems/VirtualBox/VirtualBox restart

Val a dir que els StartUp Items estaven deprecated des de la 10.4, molt abans de la primera versió de VirtualBox per a Mac.

Quan treballem amb màquines virutals dins un portàtil, tenir sempre la mateixa configuració de xarxa és molt complicat, així que sovint trobem aquest incòmode missatge

waiting up to more 60 seconds for network configuration

que fa etern (relativament, és clar) el procés d’IPL d’Ubuntu.

Podem modificar aquest temps d’espera a l’script: /etc/init/failsafe.conf I canviar els valors del paràmetre sleep per uns de menors.

Tothom sap que els canvis a les empreses costen molt d’aplicar, i escarmentades com estan, aguanten tot el que poden amb el semi-descontinuat Windows XP. If it ain’t broke, don’t fix it, que li diuen.

Doncs bé, si volem actualitzar Windows XP SP2 a SP3, el procés d’actualització peta amb l’error 0×80240036.

En aquesta URL podreu trobar el paquet SP3 de Windows XP per a descarregar fora del Windows Update.

http://www.microsoft.com/es-es/download/details.aspx?id=24

Table 9.1. Runlevels in Red Hat Enterprise Linux
Runlevel Description
0 Used to halt the system. This runlevel is reserved and cannot be changed.
1 Used to run in a single-user mode. This runlevel is reserved and cannot be changed.
2 Not used by default. You are free to define it yourself.
3 Used to run in a full multi-user mode with a command line user interface.
4 Not used by default. You are free to define it yourself.
5 Used to run in a full multi-user mode with a graphical user interface.
6 Used to reboot the system. This runlevel is reserved and cannot be changed.

PhalconPHP is a web framework delivered as a C extension providing high performance and lower resource consumption.

Install it is easy if you have experience building PHP. There is a port for FreeBSD if you disagree compilations :)

In this post: Instal·lant una màquina blava – 4) PHP 5.4 you can view the apt-get install’s mandatory to build PHP and other extensions.

The requirements are : sudo apt-get install php5-dev php5-mysql gcc make

As explained in the README file: Follow these instructions to generate a binary extension for your platform: git clone git://github.com/phalcon/cphalcon.git cd cphalcon/build export CFLAGS="-O2 -fno-delete-null-pointer-checks" phpize --clean phpize ./configure --enable-phalcon make sudo make install Add extension to your php.ini extension=phalcon.so Finally restart the webserver

To test it, you can install an example app: INVO https://github.com/phalcon/invo cd /var/www git clone git://github.com/phalcon/invo.git cd invo echo 'CREATE DATABASE invo' | mysql -u root -p cat schemas/invo.sql | mysql -u root -p invo vi app/config/config.ini [database] host = localhost username = root password = ***** name = invo

Really fast! Are good news

Darrerament s’ha publicat un webminar a la secció IBM i de Zend sobre l’adopció de PHP com a llenguatge de propòsit general per a la gestió de negocis i producció.

Es tracta de la implementació d’un ERP escrit en PHP per a Aalberts Industries.

Resulta força interessant l’arquitectura desplegada per integrar l’ERP i el MES amb la producció, tot en PHP amb algunes crides RPG a codi legacy.

L’ERP s’executa sobre l’IBM i i el MES sobre una Debian. El MES requeria accés des de fora de la companyia i interconnexió amb tota la maquinaria de la fàbrica.

Les conclusions resulten força interessants:

• PHP is a universal platform independend programming language
• It’s fast and comprehensive
• Beside WEB programming it can be used for interfaces and processes
• Even real time data analysis is possible
• Zend Server provides the same environment on all platforms
• It’s easy to develop, to trace and to maintain
• It makes fun and provides fast success

Podeu veure aquesta presentació en aquest enllaç

http://static.zend.com/topics/GroupMT-PHP-20120919.pdf

php-2B5.4.8

Fa uns dies es va començar a desenvolupar en la versió 5.4.8 a la branca master del repositori git de php:

Però ha sobtat que no s’hagi alliberat la versió 5.4.7 que si que ha estat tagejada al gitrepo el dia 29 d’agost.

La darrera notícia al web oficial de PHP és l’alliberament de la 5.4.6. Ves que no sigui de vacances que s’encarrega de les actualitzacions ;-)

The next chapter of the Internet starts here.

Google Fiber starts with Internet speeds 100 times faster than what most Americans have today. In this video, we see the evolution of the Internet represented in three different stages. It started with Dial-Up, grew with Broadband — and with Google Fiber, the possibilities are endless. Pre-register now at http://www.google.com/fiber … if you live in Kansas City, Kansas or Kansas City, Missouri :)

Developer Tools

⌥-⌘-I Opens Developer Tools.
⌥-⌘-J Opens Developers Tools and bring focus to the Console.
⌥-⌘-C Toggle Inspect Element mode.

Tab and window shortcuts

⌘-N Opens a new window.
⌘-T Opens a new tab.
⌘--N Opens a new window in incognito mode.
Press ⌘-O, then select file. Opens a file from your computer in Google Chrome.
Press and click a link. Or click a link with your middle mouse button (or mousewheel). Opens the link in a new tab in the background .
Press ⌘- and click a link. Or press and click a link with your middle mouse button (or mousewheel). Opens the link in a new tab and switches to the newly opened tab.
Press and click a link. Opens the link in a new window.
⌘--T Reopens the last tab you’ve closed. Google Chrome remembers the last 10 tabs you’ve closed.
Drag a tab out of the tab strip. Opens the tab in a new window.
Drag a tab out of the tab strip and into an existing window. Opens the tab in the existing window.
Press ⌘- and the right arrow together. Switches to the next tab.
Press ⌘- and the left arrow together. Switches to the previous tab.
⌘-W Closes the current tab or pop-up.
⌘--W Closes the current window.
Click and hold either the Back or Forward arrow in the browser toolbar. Displays your browsing history in the tab.
Press or ⌘-[ Goes to the previous page in your browsing history for the tab.
Press - or ⌘-] Goes to the next page in your browsing history for the tab.
Press while clicking the + button in the top left corner of the window. Maximizes the window.
⌘-M Minimizes the window.
⌘-H Hides Google Chrome.
⌘-⌥-H Hides all other windows.
⌘-Q Closes Google Chrome.

Google Chrome feature shortcuts

⌘--B Toggles the bookmarks bar on and off.
⌘-⌥-B Opens the bookmark manager.
⌘-, Opens the Preferences dialog.
⌘-Y Opens the History page.
⌘--J Opens the Downloads page.
⌘-- Opens the Clear Browsing Data dialog.
⌘--M Switch between multiple users.

Address bar shortcuts

Use the following shortcuts in the address bar:

Type a search term, then press . Performs a search using your default search engine.
Type a search engine keyword, press Space, type a search term, and press . Performs a search using the search engine associated with the keyword.
Begin typing a search engine URL, press when prompted, type a search term, and press . Performs a search using the search engine associated with the URL.
Type a URL, then press ⌘-. Opens the URL in a new background tab.
⌘-L Highlights the URL.
⌘-⌥-F Places a ‘?’ in the address bar. Type a search term after the question mark to perform a search using your default search engine.
Press and the left arrow together. Moves your cursor to the preceding key term in the address bar
Press and the right arrow together. Moves your cursor to the next key term in the address bar
Press - and the left arrow together. Highlights the preceding key term in the address bar
Press - and the right arrow together. Highlights the next key term in the address bar
⌘- Deletes the key term that precedes your cursor in the address bar
Select an entry in the address bar drop-down menu with your keyboard arrows, then press-Fn-. Deletes the entry from your browsing history, if possible.
Press Page Up or Page Down in the addess bar menu. Selects the previous or next entry in the menu.


Webpage shortcuts

⌘-P Prints your current page.
⌘--P Opens the Page Setup dialog.
⌘-S Saves your current page.
⌘--I Emails your current page.
⌘-R Reloads your current page.
⌘-, Stops loading of your current page.
⌘-F Opens the find bar.
⌘-G Finds the next match for your input in the find bar.
⌘--G or - Finds the previous match for your input in the find bar.
⌘-E Uses selection for find
⌘-J Jumps to selection
⌘-⌥-I Opens Developer Tools.
⌘-⌥-J Opens the JavaScript Console.
⌘-⌥-U Opens the source of your current page.
Press and click a link. Downloads the target of the link.
Drag a link to the bookmarks bar. Saves the link as a bookmark.
⌘-D Saves your current webpage as a bookmark.
⌘--D Saves all open tabs as bookmarks in a new folder.
⌘--F Opens your page in full-screen mode. Press ⌘--Fagain to exit full-screen.
⌘-+ Enlarges everything on the page.
⌘ and - Makes everything on the page smaller.
⌘-0 Returns everything on the page to normal size.
⌘--H Opens your home page in your current tab.
Space bar Scrolls down the web page.
⌘-⌥-F Searches the web.

Text shortcuts

⌘-C Copies highlighted content to the clipboard.
⌘-⌥-C Copies the URL of the page you’re viewing to the clipboard.
⌘-V Pastes content from the clipboard.
⌘--⌥-V Pastes content without source formatting.
⌘-X or - Deletes the highlighted content and copies it to the clipboard.
⌘-Z Reverts your last action.
⌘--Z Repeats your last action.
⌘-X Deletes highlighted content and saves it to your clipboard (cut).
⌘-A Selects all the text on your current page.
⌘-: Opens the Spelling and Grammar dialog.
⌘-; Checks your current page for spelling and grammar