{"id":957,"date":"2015-08-10T19:30:43","date_gmt":"2015-08-10T19:30:43","guid":{"rendered":"http:\/\/www.van-maanen.com\/?p=957"},"modified":"2015-08-10T19:30:43","modified_gmt":"2015-08-10T19:30:43","slug":"avro-getting-it-work","status":"publish","type":"post","link":"http:\/\/archief.van-maanen.com\/?p=957","title":{"rendered":"Avro &#8211; getting it work"},"content":{"rendered":"<p>When you read about Hadoop, you come across AVRO. This is a mechanism to exchange data via streams and it is named after the famous British aircraft industry that amongst many other types, delivered the Lancaster that helped to liberate Europe. AVRO can be implemented in many languages, amongst them PHP. Before continuing let us run a programme with AVRO included.<br \/>\nPHP can be run as a webpage. One could also run it from the command line, but running as a webpage is probably the easiest way around. One need to install PHP but this is abundantly described. I installed PHP as an executable that can be run from CGI with IIS. It can be verified that PHP runs smoothly is one is able to run a so-called phpinfo() command. Examples can be be found on the internet.This phpinfo() is often used as a &#8220;HelloWorld&#8221; application. It is easy to program and it allows the user to verify that PHP is working.<br \/>\nOne continues by installing AVRO which is a <a href=\"http:\/\/www.van-maanen.com\/wp-content\/uploads\/2015\/08\/avro-php-1.7.7.zip\">set of PHP programmes<\/a> that can be installed in the web root directory.<br \/>\nOther things must be changed as well before using PHP. One must include <a href=\"http:\/\/www.van-maanen.com\/wp-content\/uploads\/2015\/08\/php_gmp.dll\">a DLL<\/a> that must also be mentioned in the php.ini file. Somewhere in the PHP.ini, one must include a line like extension=php_gmp.dll to have it being used by PHP.<br \/>\nAs one need to write a file, the user priviliges need to be set accordingly.<a href=\"http:\/\/www.van-maanen.com\/wp-content\/uploads\/2015\/08\/Untitled.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.van-maanen.com\/wp-content\/uploads\/2015\/08\/Untitled.png\" alt=\"Untitled\" width=\"364\" height=\"495\" class=\"alignnone size-full wp-image-964\" \/><\/a><br \/>\nI think, one might give it a go. Try to run <a href=\"http:\/\/www.van-maanen.com\/wp-content\/uploads\/2015\/08\/index.php\">this page <\/a>. If one sees something like <\/p>\n<pre> from file: array ( 'member_id' => 1392, 'member_name' => 'Jose', ) array ( 'member_id' => 1642, 'member_name' => 'Maria', ) from binary string: array ( 'member_id' => 1392, 'member_name' => 'Jose', ) array ( 'member_id' => 1642, 'member_name' => 'Maria', )<\/pre>\n<p>, one is on the right track.<br \/>\nWhat does this programme do? First, it creates an avro file. This is a binary file that contains the structure and the data. This file looks like:<br \/>\n<a href=\"http:\/\/62.131.51.129\/wp-content\/uploads\/2015\/08\/Untitled-1.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/62.131.51.129\/wp-content\/uploads\/2015\/08\/Untitled-1.png\" alt=\"\" width=\"644\" height=\"218\" class=\"alignnone size-full wp-image-1438\" \/><\/a><br \/>\nIn a subsequent step, the file is then written to screen. This example shows that avro files are a nice alternative to ordinary textfiles as the files contain the definition of the attributes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>When you read about Hadoop, you come across AVRO. This is a mechanism to exchange data via streams and it is named after the famous British aircraft industry that amongst many other types, delivered the Lancaster that helped to liberate Europe. AVRO can be implemented in many languages, amongst them PHP. Before continuing let us [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":958,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-957","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-warehousing"],"_links":{"self":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/957","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=957"}],"version-history":[{"count":0,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/957\/revisions"}],"wp:attachment":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=957"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}