Archive for February, 2010

 

Bookakar.com Finally!

0

Finally, after long time of work, the first release of my own company: bookakar.com.

I have implemented lots of concepts widely spread throughout the Internet and I truly hope that they all work. Still, lot of work to do but as soon as I have spare time I will share with all of you guys lots of PHP and JS bits and pieces that I hope we, all together, could improve in order to make a great Open Source Resource for everybody to use.

For example, I have developed a set of PHP classes that help PHP programmers to implement GMaps without the need of Javascript knowledge.

I can wait to share…

Anyway, any feedback related to my site will be highly appreciated. One more thing and very important: I DO NOT SUPPORT INTERNET EXPLORER due to its security pitfalls on the bank payment gateway and its sillly way of understanding CSS rendering and styles -and I don’t mention its JS engine at all.

Bookakar.com works only on two Spanish areas: Alicante and Ibiza, but it will grow to other areas very soon.

Tweet this!Tweet this!
add-images-to-gallery

Visual Lightbox

0

This post is for those who wish to implement a beautiful Lightbox plugin on their site or blog and, unfortunately, do not have a clue about Javascript and/or jQuery and/or Html.

VisualLightBox is a free application that helps you easily generate online photo albums, lightbox gallery with a nice Lightbox-style overlay effect, in a few clicks without writing a single line of code.

Just drag&drop your photos to VisualLightBox wizard window, press “Publish” and your own css web site album with beautiful LightBox effects will open in the browser instantly!
No css, image editing, javascript, html coding, just a click to get your cool web page album ready.

It takes less than a minute to have your own image gallery.

For full documentation please go to http://lightbox2.com/

Newbies, now there is no excuse to have your featured lightbox on your site!

Tweet this!Tweet this!
PHP - Hip Hop

Hip Hop for PHP?

0

Guys, it seems that the days of breaking your head towards how to protect your PHP code is about to end. Following a great article from the Web explaining what happens nowadays with PHP Hip Hop Facebook’s approach.

The open source dynamic scripting language PHP is widely deployed across the Web, powering countless Web sites (including the Internet.com network). Now Facebook is aiming to change the game with today’s release of a major new PHP effort called HipHop.

With HipHop, Facebook is providing a new runtime that is intended to improve PHP use in large-scale deployments. The HipHop effort, which also includes a new Web server, has already been in use by Facebook for the past six months, though the project is just being made public today.

Facebook developers say the HipHop effort isn’t an attempt to fork the PHP community, but rather, a move to help PHP scale.

“There are two different pieces to keep in mind, one is the PHP language itself, then there is the runtime that actually goes and interprets the language and runs it,” David Recordon, Facebook’s senior open programs manager, told InternetNews.com. “What we’ve done is we’ve implemented the PHP 5.2 language with a few features removed. Our plan is to keep the language the same, but what we’ve changed is the underlying runtime and the process of going and transforming the source code into C++ and then compiling it and pushing out the compiled binary.”

Facebook said the results of using HipHop have been dramatic. CPU usage on Facebook servers has dropped by an average of 50 percent as the HipHop PHP engine reduced the load on Facebook’s infrastructure.

The results have proven to be compelling enough that Facebook now uses HipHop to deliver more than 90 percent of its production server traffic.

HipHop isn’t just a new code transformation tool, either. The overall effort also includes a new Web server to deploy PHP as well. Typically, in open source deployments, PHP is served with Apache Web servers.

“In general, Apache is a great Web server, but when we were looking at how we get the next half percent or percent of performance, we didn’t need all the features that Apache offers,” Recordon said. He added, however, that he hopes an open source project will one day emerge around making HipHop work with Apache Web servers.

The idea of optimizing the PHP runtime is not a new one, with multiple solutions in the market today including eAccelerator and commercial PHP products from Zend. Zend is one of the lead commercial sponsors behind PHP.

“HipHop looks like an interesting project,” Zend CEO Andi Gutmans told InternetNews.com. “We have been briefed by Facebook but will certainly take a closer look now. There have been other such projects but most have been targeting managed runtimes such as Java and .NET with various degrees of success. We welcome any innovation that will help PHP extend its leadership position in Web application development.”

Gutmans added that, as is the case with all runtimes, it is important to continue innovating and the PHP runtime has continued to evolve over the years.

“I think it is important to continue to fold in new ideas and innovations into the community-based runtime and it’ll be interesting to learn what HipHop concepts could be relevant to the existing PHP community,” Gutmans said.

With some PHP runtime optimization solutions, the optimization is often a simple matter of a module load and a line change in the php.ini configuration file.

It’s not quite that easy with HipHop.

“This is not an extension to PHP — this is pretty different,” Recordon said. “Right now, the process is once you build and compile HipHop, it comes with a tool that will go through the transformation process and output the binary, and that’s what you actually use to run it.”

With HipHop, Facebook said its aim is not to split the PHP community but rather to help grow it. According to Recordon, HipHop will help to solidify PHP’s position as a great language for doing Web site development.

“There is definitely the piece in there that HipHop is designed for larger PHP deployments and not necessarily for individuals hosting their own blog or small Web site,” Recordon said. “The proof of the effect of HipHop will be over the next year as we start to make deployment tools easier, and as we start to build a successful community around it and start working with others on its future development and solving problems for companies beyond just Facebook.”

Tweet this!Tweet this!
 

Handling Timeouts with PHP5 SoapClient Extension

0

I was breaking my head towards a silly thing around SoapClient Calls. My actual project requires Soap Calls to certain providers and everytime I was calling the external server, I had to wait for the server response (if any) and if the server failed to respond accordingly… damn… Warnings and/or Errors displayed and boom… My great application just looked like… well, forget it, I just used the try and catch statements for that… not big deal.

So I jump over Google’s horse and looked around implementing timeouts! because that was a true issue. Can you imagine? A user makes a request I looked around my DB and suddenly that single SOAP call takes me one minute to respond. No good, time for a solution.

Found the way to do it, by setting a hidden parameter (not documented) named ‘connection_timeout’:

//
// setting a connection timeout (five seconds on the example)
//
$client = new SoapClient($wsdl, array("connection_timeout"=>15));

The above says wait 15 seconds before returning a fault if you cannot connect properly to the host. The parameter ‘connection_timeout’ addresses the time it takes to wait to connect to your host.

As Jim Plush’s said:

You’d have two timeouts set in your application one for how long it should take to actually connect to your remote host and a timeout for how long the socket connection should wait for a response from the server.

So, now we need to set the time we wait for a server response with the following:

ini_set('default_socket_timeout', 180);

With these two configuration options we control the time to wait for a Soap host connection and the time waiting for a Soap Service response. Just perfect.

Tweet this!Tweet this!
Go to Top