“Zend_Db_Select” tricks

Posted by admin | Gadgets | Monday 5 October 2009 4:45 am

More recently, when writing code in a regular model in front of me faced with the task of the subquery (for example to join). Thus for quite some time, I try as little as possible to write queries “in the raw” form, using OOP wrapper for the Zend Framework. However, looking at the manuals, API, I, to my surprise, did not find the necessary funds. But after the treatment directly to the code, it became clear that the subquery can be very simple!

The presence of internal code method _join (file Zend / Db / Select.php) the next line, made it clear that not everything is hopeless:
773. ) Else if ($ name instanceof Zend_Db_Expr | | $ name instanceof Zend_Db_Select) (

* This source code was highlighted with Source Code Highlighter.

Banal based on the fact that for $ name instanceof Zend_Db_Select laid some logic, try the following:
$ firstQuery = $ db-> select ()
-> from (array ( ‘u’ => ‘user’),
array ())
-> join (array ( ’s2u’ => ’site2user’),
’s2u.userId = u.id’,
array ( ’siteId’))
-> columns (array ( ‘userCount’ => ‘count (*)’))
-> group ( ’s2u.siteId’);

$ secondQuery = $ db-> select ()
-> from (array ( ’s’ => ’site’),
array ( ’siteId’ => ‘id’,
’site’ => ‘title’))
-> join (array ( ‘n’ => $ firstQuery),
‘n.siteId = s.id’,
array ( ‘userCount’));

echo $ secondQuery-> assemble ();

* This source code was highlighted with Source Code Highlighter.

And as a result of the script we get:
SELECT `s`. `Id` AS `siteId`, `s`. `Title` AS `site`, `n`. `UserCount` FROM `site` AS `s`
INNER JOIN (SELECT `su`. `SiteId`, count (*) AS `userCount` FROM `user` AS `u`
INNER JOIN `site2user` AS `su` ON s2u.userId = u.id GROUP BY `s2u`. `SiteId`) AS `n` ON n.siteId = s.id

* This source code was highlighted with Source Code Highlighter.

Voila! Plucked absolutely correct query.

This is a very important feature, because Untying the hands when writing more abstract models. For example, create a few methods that do not simply return any data and queries as objects Zend_Db_Select. Then these queries can be modified, embedded in the other, ie avoid writing the same SQL code in different places, and this is a big plus with the support and modify the code.

P.S. This feature has been working for quite a long time and why it has not yet been made to the manual, PHPDoc, which received API, I honestly do not understand at all.


Check out the analysis of delfi.lv, sagepub.com, widgetbox.com, flickr.com, zonamusical.net, webhost4life.com, jugem.jp, adserverplus.com, rurubu.com, home.ne.jp - and much more

Turbo fast browser - Opera 10

Posted by admin | Gadgets | Saturday 3 October 2009 7:15 am

September 1 - Oslo, Norway - The company Opera Software today released the final version of the Opera 10. The company introduced a browser with an elegant interface that includes a number of innovative technologies. Opera 10 is available in 43 languages in versions for operating systems Windows, Linux and Mac. It can be downloaded at www.opera.com

Three innovations Opera 10, which is certainly worth a try

1. Opera Turbo - data compression technology that solves the problem of slow data downloads at work on low-speed channels. Come whether you are in network with 3G-modem in the road or use the overloaded Wi-Fi hotspot at the airport - Opera Turbo speed data transfer and “unfreeze” the Internet.

If you’re tired of waiting for loading Web sites, including built-in browser technology Opera Turbo and work at speeds close to broadband Internet. Opera Turbo automatically determines the data rate and, in the case of its reduction, is able to compress the contents of Web pages for faster loading. Under laboratory conditions, technology has provided the acceleration up to eight times compared with other browsers.

Scandinavians, obsessive wrapping www.youtube.com/watch?v=tYEUFwJXVvw

2. Excellent interface
The Opera browser has never looked so elegant. For Opera 10, we have developed a new interface with a convenient and logical arrangement of menus and buttons, the call options.

3. Improved tab
Opera is a pioneer in the use of tabs. Opera 10 can change their size by stretching the lower boundary, or by double-clicking the mouse. The new browser capable of displaying thumbnails of open tabs for websites.

By default, rendered tab Opera 10 are placed at the top of the screen, but they can move down or side panels, which is especially useful when using widescreen monitors.

Opera 10, and includes other improvements that increase productivity and improve the efficiency of the Internet:

- Custom Express panel
Express panel Opera 10 already recognized the Internet community. Now it has become the custom in accordance with the personal preferences of users. You have a large monitor? Set in the Express-panel 5×5 sites for quick access. Furthermore, now your favorite picture or photo can be done in the background Express panel.

- Quick access to Russian-language services
“Yandex”. In addition to search capabilities of your browser, now “Yandex” has become the default search in the Express-panel.
“VKontakte”. Now from the search bar Opera 10 can send requests in RuNet largest social network “VKontakte.
«Mail.Ru». Favorite browser by default includes a link to the main page of Russia’s largest Internet communications portal Mail.Ru. From Express your browser with one click you can go to the draft Games.Mail.Ru,. Search for information through Poisk@Mail.Ru possible directly from the browser search bar.
«OZON.Ru». Search for books, music, videos and other goods to Russia’s biggest online store even easier. Now it can be done from the search bar Opera 10, and load OZON.ru - with the help of bookmarks and Express-panel, which links to the home page installed by default.

- Automatic update for greater security
Opera 10 is now updated automatically, so you can always work with the latest version of your browser. Thus, users benefit from all the new browser, and a powerful registration system failures is intended to make it more stable.

More information about the security of browsers available at www.secunia.com

- Check your spelling
No more typos! The spelling system is based on open dictionary Hunspell supports 51 languages, including Russian, Ukrainian and Belarusian.

- Improved e-mail
Built-in browser Opera 10 e-mail client gives you access to e-mail at any time. Opera Mail has broad capabilities to organize email messages and contacts, as well as search for them. Monitor the progress of discussions, it became more comfortable with the option sorting in the form of wood, and built-in spell checker eliminates errors and misspellings in the recruitment of text messages.

- How to become the fastest Internet
The high speed of the browser - a combination of several factors. First of all, we have improved the overall performance of the kernel and accelerated loading pages with large amounts of data (such as, eg, Gmail). According to our measurements, the speed of the Opera 10 was 40% higher than Opera 9.6, and this is before you turn on the Opera Turbo! However, this is not all. The Opera browser is not only easy and quick, but smart. Adaptive control system allows the best to expend resources with little computer memory and, conversely, to utilize more resources to a PC with lots of free to use RAM.

- “Toy” for web developers
Web developers will appreciate the newest version of the application for debugging and optimizing Web sites Opera Dragonfly, Opera browser, available in 10. Opera Dragonfly, available in 36 languages, now you can edit the Document Object Model (Document Object Model, DOM) and check the HTTP-headers. In addition, Opera 10 to 100% being tested for compatibility with web standards and supports ACID3 Web fonts for CSS3.

“We are in Opera are constantly working on new ways to improve online experience for everyone and for everyone - said Jon von Tetzchner (Jon von Tetzchner), CEO of Opera. - Each of us is faced with the slow channels of access to the Network, and I think that Opera Turbo will be useful to all users, regardless of how often and at what speed they are working in the web. Now the problem of slow Intenet is a solution, and it is absolutely free. We are pleased to present the final version of Opera 10, and hope that it will attract more users, in addition to the 40 million that have already opted for our browser safe, fun and easy online experience. ”


Check out the analysis of zdnet.co.uk, 10010.com, tapuz.co.il, alfoo.org, milfgf.com, mmo-champion.com, myvouchercodes.co.uk, sportsbook.com, catcatforum.com, akinator.com - and much more