You buy at discount stores and looking for the manufacturer’s?
To learn how to make mobile pages, I've prepared the mobile website to search for the original manufacturers of different products (cheap brands) sold in discount stores (Tesco, etc.).
Example: cheap chips "TOP chips" are actually manufactured by Lorenz Snack-World - manufacturer of brands such as Crunchips.
To find information on what the company stands behind the product, bar code must be entered and the page will show the name of the manufacturer. After installing the Barcode Scanner (for Android) instead of just write code to scan code.
Important: After you run Barcode Scanner enter the settings, then select "Custom Search URL 'and type http://www.skaruz.com/code/en/index.php?code=%s
Technical side:
- jQuery Mobile
- connecting to an external database
- handy cache in MySQL for processed products and the producers found
Within 2 days after the start and posting a link to Wykop.pl was over 9k searches.
Cufon IE delay
For many years it was not possible to attach arbitrary fonts for web pages so that they look identical in the leading browsers. Instead, you had to use images.
Then it was time Cufon library where everything was beautifully rendered. Everything, but not everywhere. In IE visible ugly gap (about half a second) when loading the page, but managed to find a solution.
To avoid this ugly effect, you must:
1. Right after
<style type="text/css"> .menu { visibility: hidden; } </style>
2. just before run cufon
<script type="text/javascript"> Cufon.replace(".menu"); Cufon.now(); </script>
3. show swapped elements
<style type="text/css"> .menu { visibility: visible; } </style>
MongoDB vs. MySQL (MyISAM and InnoDB) – performance comparison
As part of learning new tools for testing, I took the mongoDB database performance and comparing the results of a MySQL database, both in MyISAM and innoDB tables.
As a test platform I used only the local computer with 4 GB of RAM, i3 (2.4 GHz). The data source was a table of 217 thousands of records.
MySQL (MyISAM) - 5.1.49
MySQL (InnoDB) - 5.1.49
MongoDB - 2.0.2
PHP - 5.3.6
All times are in seconds, and each query is executed in a loop 10 times and the result presented is the average of theese 10 performances.
| MySQL (MyISAM) | MySQL (innoDB) | mongoDB | |
|---|---|---|---|
| WHERE field = ? | 3.631 | 21.911 | 0.016 |
| WHERE field zLIKE 'x%' | 3.755 | 19.562 | 0.040 |
The results speak for themselves - mongoDB is perfect for large databases, where the advantage over MySQL is the most visible.
How to parse large XML files in PHP?
Some time ago I was faced with the problem of parsing large XML files in PHP. While the small files are no problem and all is quickly parsed, an attempt to pare larger files often causes timeout or Internal Sever Error. Such large files, however, are often used for remote updates of offers (eg, published by the wholesalers).
This is because PHP has set a limit to use, a standard method for parsing files (such as DOMDocument) can be effectively use that limit.
The solution is to use the XMLReader class, by default, available in a standard configuration of PHP 5.1.0.
I did a quick comparison of the speed of action for DOMDocument and XMLReader using 4 different computers.
XML filesize: 208 MB
Number of entries: 148723
| DOMDocument | XMLReader | |
|---|---|---|
| Lokalny komnputer | 269 sek | 41 sek. |
| Serwer dedykowany / Hetzner | 264 sek. | 15 sek. |
| Serwer współdzielony / vipserv.org | error 500 / timeout | 15 sek. |
| Serwer współdzielony / IQ.pl | 277 sek. | 33 sek. |
As you can see the difference is enormous (about 10-20 times faster) and for large files we put on the XMLReader.
Piece of code responsible for parsing the DOMDocument:
$doc = new DOMDocument(); $doc->load($localurl); $items= $doc->getElementsByTagName("item"); $countItems = $items->length; foreach($items as $item) { $id = $item->getElementsByTagName("id")->item(0)->nodeValue; $url = $item->getElementsByTagName("url")->item(0)->nodeValue; $title = $item->getElementsByTagName("title")->item(0)->nodeValue; $author = $item->getElementsByTagName("author")->item(0)->nodeValue; $isbn = $item->getElementsByTagName("isbn")->item(0)->nodeValue; $image = $item->getElementsByTagName("image")->item(0)->nodeValue; $ean = $item->getElementsByTagName("ean")->item(0)->nodeValue; $published = $item->getElementsByTagName("published")->item(0)->nodeValue; $publisher = $item->getElementsByTagName("publisher")->item(0)->nodeValue; $pages = $item->getElementsByTagName("pages")->item(0)->nodeValue; $price = $item->getElementsByTagName("price")->item(0)->nodeValue; $description = $item->getElementsByTagName("description")->item(0)->nodeValue; $status = $item->getElementsByTagName("status")->item(0)->nodeValue; $count++; }
Piece of code responsible for parsing the XMLReader:
$reader = new XMLReader(); $reader->open($localurl); while($reader->read()) { if($reader->nodeType == XMLReader::ELEMENT) $nodeName = $reader->name; if($reader->nodeType == XMLReader::TEXT || $reader->nodeType == XMLReader::CDATA) { if ($nodeName == 'id') $id = $reader->value; if ($nodeName == 'url') $url = $reader->value; if ($nodeName == 'title') $title = $reader->value; if ($nodeName == 'author') $author = $reader->value; if ($nodeName == 'isbn') $isbn = $reader->value; if ($nodeName == 'image') $image = $reader->value; if ($nodeName == 'ean') $ean = $reader->value; if ($nodeName == 'published') $published = $reader->value; if ($nodeName == 'publisher') $publisher = $reader->value; if ($nodeName == 'pages') $pages = $reader->value; if ($nodeName == 'price') $price = $reader->value; if ($nodeName == 'description') $description = $reader->value; if ($nodeName == 'status') $status = $reader->value; $ean = ''; } if($reader->nodeType == XMLReader::END_ELEMENT && $reader->name == 'item') { $count++; } } $reader->close();
Change of NextGen gallery Gallery on Picasa

After several years of using the NextGEN Gallery plugin for Wordpres as a method for the publication of photos I decided to change it to PicasÄ™ Web Albums. Now a lot easier, better and faster I add newly taken pictures.
As a plugin for their publication in the gallery used the addition of PWA+PHP, which is a very convenient way to display always current albums aby API . The only problem was if you want to hide a few albums while keeping them in Picasa (such as albums automatically assumed to integrate with Google Plus). To do this, edit the file wp-content/plugins/pwaplusphp/dumpAlbumList.php<pre lang="php">
find the line
$pos = strlen(strpos($title,'_hide'));
and replace it with
$ALBUMS_TO_HIDE=array('Scrapbook Photos', 'Profile Photos'); if (in_array($title, $ALBUMS_TO_HIDE)) $pos = 1; else $pos = strlen(strpos($title,'_hide'));
Of course, we put in $ ALBUMS_TO_HIDE album names to hide.
This plugin is free, while its paid version includes the possibility of including the cache which loads a lot of faster pages with many albums.
Back after years
A more specifically after two. That time has passed since the last post.
During this time, a lot of changes happened in my life, both private and professional life. True love, new job (and thus new challenges), my resignation of conduction online stores and their sales. But let me say step by step.
I got engaged - after a year of meeting with the true chosen one heart, the future wife and mother of my children. With full confidence, awareness, constant and irresistible desire to be together. Those who have me in your contacts on NK could see a little picture of this occasion.
After 7 years of running my own business I decided to change the mode of one-man-army for a typical full-time job as a webmaster / Webdeveloper / programmer. Until now, small business owner, and the person dealing with issues associated with creating pages, business marketing, positioning, accounting, logistics, etc. Currently my responsibilities include only purely technical matters, allowing me to focus on further development and exploration of issues that interest me the most.
Also, after 7 years since the launch of the shop Mydlandia and 4 years of Kadoro store decided to sell them. The reasons for the decision were different. Not without regret, but the time has come when I had to go ahead and close behind a certain stage in my life. Running the shops from the bare essentials (starting from the concept name, appearance, parties to the negotiations with contractors), which taught me many aspects of doing business on the Internet. It was a very valuable lesson with the well passed an examination (the stores are still running).
On the occasion of major life changes I also sold my little translation agency Almand. Because of other responsibilities to deal with translations, I stopped some time ago, so there was no point in the domain block and inhibit the potential of the site. The website is owned by a person who is a professional translater.
These are the most important changes which have been in the last 2 years. I will try to keep you up to date, yet to return to more frequent posts loosely connected with what is happening in my life .