<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Kristo Vaher &#187; Web Development</title>
	<atom:link href="http://waher.net/archives/category/web-development/feed" rel="self" type="application/rss+xml" />
	<link>http://waher.net</link>
	<description>inventas vitam iuvat excoluisse per artes</description>
	<lastBuildDate>Fri, 13 Apr 2012 19:07:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WWW Framework v2.0.7 has been released!</title>
		<link>http://waher.net/archives/1065</link>
		<comments>http://waher.net/archives/1065#comments</comments>
		<pubDate>Mon, 12 Mar 2012 21:04:50 +0000</pubDate>
		<dc:creator>Kristo Vaher</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[www-framework]]></category>

		<guid isPermaLink="false">http://waher.net/?p=1065</guid>
		<description><![CDATA[WWW is a PHP micro-framework that is built loosely on model-view-control architecture and factory method design pattern. It is made for web services, websites and info-systems and is built around a native API architecture, caching and smart resource management. WWW is a compact framework that does not include libraries and bloated features and is developed [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1052" class="wp-caption alignright" style="width: 250px"><a href="http://waher.net/wp-content/uploads/2012/02/wlogo1.jpg"><img class="size-full wp-image-1052" title="WWW Framework" src="http://waher.net/wp-content/uploads/2012/02/wlogo1.jpg" alt="WWW Framework" width="240" height="240" /></a><p class="wp-caption-text">WWW Framework</p></div>
<p>WWW is a PHP micro-framework that is built loosely on model-view-control architecture and factory method design pattern. It is made for web services, websites and info-systems and is built around a native API architecture, caching and smart resource management. WWW is a compact framework that does not include libraries and bloated features and is developed keeping lightweight speed and optimizations in mind.</p>
<p><em><strong>Note that WWW Framework is currently in BETA and it is not recommended for production use yet.</strong></em></p>
<p><strong>Latest version of WWW Framework can be grabbed <a title="WWW Framework" href="https://sourceforge.net/projects/www-php/" target="_blank">here</a>.</strong></p>
<p><span id="more-1065"></span></p>
<p><strong>Feature list of WWW Framework 2.0.7:</strong></p>
<ul>
<li>Modern API-focused framework</li>
<li>Secure API requests with input and token and key-based authentication</li>
<li>Dynamically loaded Hierarchical MVC objects through Factory pattern</li>
<li>API returns XML, CSV, JSON, HTML, native PHP and other data formats</li>
<li>Compressed data output with Deflate and Gzip</li>
<li>Input and output data is fully UTF-8</li>
<li>PDO-specific database controller for general-use database connections</li>
<li>Smart Index gateway that handles all HTTP requests</li>
<li>Full cache control for all types of dynamic and static requests</li>
<li>View and URL controllers that support multiple languages and clean URL&#8217;s</li>
<li>On-demand dynamic image resizer and basic image editor</li>
<li>On-demand resource compressing, unifying and minifying</li>
<li>jQuery JavaScript framework supported</li>
<li>Automatic sitemap.xml and robots.txt generation</li>
<li>Optional 256bit Rijndael CBC data communication encryption</li>
<li>Installation-specific MVC class and resource overrides</li>
<li>API wrapper classes that make server to server API communication easy</li>
<li>Request limiter that can block HTTP requests under various conditions</li>
<li>Request logger that can be used for detailed performance grading of HTTP requests</li>
<li>Backup, update and filesystem maintenance tools</li>
<li>Compatibility script that tests support for server setup</li>
<li>Supports Apache and Nginx servers in Linux and Windows environments</li>
<li>Licensed under GNU Lesser General Public License Version 3</li>
</ul>
<p><strong>Documentation and repositories</strong></p>
<p>Documentation about how to set up a system and use the API, as well as tutorials are available <a href="https://sourceforge.net/p/www-php/wiki/Home/" target="_blank">here</a>. Tutorial about how to build a basic web service is already available and tutorial about how to build a simple website will be released soon.</p>
<p>Mercurial and Git repositories are available for developers who are interested in following the development at <a href="https://sourceforge.net/p/www-php/www-php/" target="_blank">SourceForge</a>, <a href="https://github.com/kristovaher/WWW-Framework" target="_blank">GitHub</a>, <a href="http://code.google.com/p/www-framework/" target="_blank">Google Code</a> and <a href="https://bitbucket.org/kristovaher/www-framework" target="_blank">BitBucket</a>. All repositories are updated as new versions are released. It is also a good idea to follow latest development and news of WWW Framework at <a href="http://plus.google.com/106969835456865671988" target="_blank">Google+</a>, <a href="http://www.facebook.com/WWWFramework" target="_blank">Facebook</a> and <a href="http://www.twitter.com/WWWFramework" target="_blank">Twitter</a>.</p>
<p><strong>Is WWW Framework fast?</strong></p>
<p>Micro-framework has its benefits! The following chart shows the performance of frameworks with and without APC extension supported. Also note that the chart has a no-cache version of WWW framework listed, which basically has WWW Framework running without internal optimizations. It was included to test the difference between WWW Framework&#8217;s internal optimizations.</p>
<div id="attachment_1084" class="wp-caption aligncenter" style="width: 310px"><a href="http://waher.net/wp-content/uploads/2012/03/www-benchmark.jpg"><img class="size-medium wp-image-1084" title="www-benchmark" src="http://waher.net/wp-content/uploads/2012/03/www-benchmark-300x134.jpg" alt="" width="300" height="134" /></a><p class="wp-caption-text">Benchmark chart (click to see full chart)</p></div>
<p>&nbsp;</p>
<ul>
<li>Benchmark was run on a dual-core WAMP setup over the period of two nights</li>
<li>WAMP setup was <a href="http://www.easyphp.org/">EasyPHP 5.3.8.1</a> and <a href="http://uniformserver.com/" target="_blank">The Uniform Server 8.3.1</a></li>
<li><a href="http://pylot.org/" target="_blank">Pylot</a> was used to do the HTTP load benchmarking</li>
<li>Framework setup and installation for known frameworks was provided by <a href="http://code.google.com/p/phpmark/">PHPMark</a></li>
<li>Tested frameworks <a href="https://sourceforge.net/projects/www-php/" target="_blank">WWW Framework 1.9.6</a>, <a href="http://www.yiiframework.com/" target="_blank">Yii Framework 1.1.4</a>, <a href="http://codeigniter.com/" target="_blank">CodeIgniter 1.7.2</a>, <a href="http://kohanaframework.org/" target="_blank">Kohana 3.2.0</a>, <a href="http://cakephp.org/" target="_blank">CakePHP 1.3.4</a> and <a href="http://framework.zend.com/" target="_blank">Zend Framework 1.10.8</a></li>
<li>Every benchmark-run was 20 seconds long, every framework was tested ten times with both APC turned on and off</li>
<li>Apache was reset before each benchmark run and log files were deleted</li>
<li>Sessions and output compression by Apache was not used</li>
<li>The results below show averaged results from EasyPHP and The Uniform Server for non-APC tests and APC tests were only done on The Uniform Server</li>
<li>Benchmark scores varied most when APC was on. Without APC each benchmark run was within 1% of other scores of the same benchmark</li>
<li>While PHPMark includes Symfony 1.4.8, it was unable to be tested due to it crashing the testing environments Apache when run</li>
<li>WWW Framework running without internal cache (&#8216;no cache&#8217; on the chart) means that it does do any internal optimization and was used for testing purposes</li>
</ul>
<div><strong>Latest version of WWW Framework can be grabbed <a title="WWW Framework" href="https://sourceforge.net/projects/www-php/" target="_blank">here</a>.</strong></div>
]]></content:encoded>
			<wfw:commentRss>http://waher.net/archives/1065/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why should you encode images in web applications as base64?</title>
		<link>http://waher.net/archives/1058</link>
		<comments>http://waher.net/archives/1058#comments</comments>
		<pubDate>Fri, 09 Mar 2012 09:58:08 +0000</pubDate>
		<dc:creator>Kristo Vaher</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[essay]]></category>

		<guid isPermaLink="false">http://waher.net/?p=1058</guid>
		<description><![CDATA[A skilled young developer posted this recently on Twitter: Well, yes, base64-encoding and embedding the image into HTML is one way to reduce HTTP requests, but honestly, why would anyone do this? This article will describe briefly how base64 encoding is done and what benefits it might have. By base64 encoding images, he means inserting [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1061" class="wp-caption alignright" style="width: 250px"><a href="http://waher.net/wp-content/uploads/2012/03/useful.jpg"><img class="size-full wp-image-1061" title="Website weight loss?" src="http://waher.net/wp-content/uploads/2012/03/useful.jpg" alt="" width="240" height="121" /></a><p class="wp-caption-text">Website weight loss?</p></div>
<p>A skilled young developer posted <a href="https://twitter.com/#!/AndoRoots/status/177825664060227586" target="_blank">this</a> recently on Twitter:</p>
<p><em><strong>Well, yes, base64-encoding and embedding the image into HTML is one way to reduce HTTP requests, but honestly, why would anyone do this?</strong></em></p>
<p>This article will describe briefly how base64 encoding is done and what benefits it might have.</p>
<p><span id="more-1058"></span>By base64 encoding images, he means inserting HTML images like this:</p>
<blockquote><p>&lt;img src=&#8221;data:image/png;base64,<em>[BASE64]</em>&#8220;/&gt;</p></blockquote>
<p>Where [BASE64]  is a base64 string generated from the file with a tool like <a href="http://www.opinionatedgeek.com/dotnet/tools/base64encode/" target="_blank">this here</a>.</p>
<p>What this effectively does is that it embeds the entire content of the image into the HTML itself. This means that the browser that visits the website has to do one less HTTP request that it would otherwise do to get the file. HTML file itself would be larger as a result since it also includes the image file. The reason why the question is asked though is because if the HTML itself is not cached, then every time user requests the page they have to re-download the entire content, defeating the purpose, since browsers would otherwise cache the image and make subsequent requests on the websites faster if the same image is displayed in HTML again.</p>
<p>So why should you do it?</p>
<p>Reducing the amount of HTTP requests is a seriously important issue. If your website includes a lot of different files (JavaScript, CSS, fonts and images) and has a lot of users (especially new users) at the same time, then your site will slow down very quickly and might even cause problems for the server. To help with this, a lot of frameworks combine CSS and JavaScript files automatically and it is recommended to do this yourself as well even if you don&#8217;t use a framework. But images still make a huge chunk of an average website request, so encoding some images in base64 can give you quite a bit of performance gain should your site become suddenly popular.</p>
<p>But  can I back up my claim?</p>
<p>First of all, it is not recommended to use base64 encoded images in inline HTML, unless browser is able to cache this information in any way. <strong>But there is an alternative: you can embed images and fonts inside CSS file, effectively making your entire web &#8216;design&#8217; into a single CSS file.</strong> It&#8217;s not useful to do this right away and not for all files and debugging will be rather difficult once you do this, but you should do it only once you&#8217;re not &#8216;developing&#8217; the site anymore and don&#8217;t need to change font or graphics files around. Basically when you are ready to deploy your website and go live. It&#8217;s useful for all little parts of your code, like custom bulletins, some repeatable background images and so on.</p>
<p>As a result, single images in HTML (like galleries and other content pictures) will still make their own requests while website design will be stored in a single CSS file.</p>
<p>Anyways, just because I was curious, I made a little test since I was worried about how this might affect the situation when Gzip is used to compress CSS (usually it is not recommended to Gzip image content since they are already compressed). I built two examples on my <a href="https://sourceforge.net/projects/www-php/" target="_blank">WWW framework</a> which automatically Gzips non-image output sent to the browser:</p>
<p>Test A was done with base64 encoding used in images and Test B was done without base64 encoding. HTML of both tests were the same:</p>
<blockquote><p>&lt;div id=&#8221;div1&#8243; style=&#8221;width:240px;height:240px;&#8221;&gt;&lt;/div&gt;<br />
&#8230; and #div2-#div10 just like above &#8230;</p></blockquote>
<p>Test A had a CSS as follows <em>([BASE64] again was the long custom string generated with the tool shown above)</em>:</p>
<blockquote><p>#div1 { background-image:url(&#8220;data:image/png;base64,[BASE64]&#8220;); }<br />
&#8230; and #div2-#div10 just like above &#8230;</p></blockquote>
<p>Test B had CSS like:</p>
<blockquote><p>#div1 { background-image:url(&#8220;image1.jpg&#8221;); }<br />
&#8230; and #div2-#div10 just like above &#8230;</p></blockquote>
<p>Both examples included ten JPEG images of 240&#215;240 pixels in size. This is far more picture content than you&#8217;d expect from an average website design, but works really well as an extreme example for current tests.</p>
<p><strong>Results:</strong></p>
<p>Test A does 8 HTTP requests, including HTML, three CSS files and four JavaScript files. Test B does 18 HTTP requests, including all of what was in Example A, but also 10 JPEG image files. In both cases, JavaScript and CSS and HTML are Gzip encoded. I did 12 tests on both scripts without cache being used. I then removed 2 tests from both sets that were the slowest, since sometimes server lags and would throw off the averages. Tests were done and measured by Google Chrome.</p>
<p>Test B, where base64 encoding was not used to include image files in CSS, had the average time to render the page as <strong>668ms</strong>.</p>
<p>Test A, where images were encoded in base64, had the average time to render the page as <strong>463ms</strong>, almost<strong> 30% faster while also making 10 HTTP requests less</strong> on the web server.</p>
<p>So the benefits are certainly there, but the benefits are there only for cases where content can be cached. As I said above, there&#8217;s no point to base64 images into HTML that is not cached. If HTML is not cached, do not use base64. No point using base64 for embedding galleries and other content pictures. But for website design? Yes. 30% victory in processing time and a lot less HTTP requests after all.</p>
<p>Hopefully this helped a little.</p>
]]></content:encoded>
			<wfw:commentRss>http://waher.net/archives/1058/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>WWW Framework released!</title>
		<link>http://waher.net/archives/1050</link>
		<comments>http://waher.net/archives/1050#comments</comments>
		<pubDate>Wed, 08 Feb 2012 21:11:43 +0000</pubDate>
		<dc:creator>Kristo Vaher</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[www-framework]]></category>

		<guid isPermaLink="false">http://waher.net/?p=1050</guid>
		<description><![CDATA[I am proud to present the first complete release of WWW Framework. Goal of the project has been to create an API (Application Programming Interface) focused framework which can be used to build user-interface independent software which can be controlled from any type of interface required (be it a simple website or a mobile app). [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1052" class="wp-caption alignright" style="width: 250px"><a href="http://waher.net/wp-content/uploads/2012/02/wlogo1.jpg"><img class="size-full wp-image-1052" title="WWW Framework" src="http://waher.net/wp-content/uploads/2012/02/wlogo1.jpg" alt="WWW Framework" width="240" height="240" /></a><p class="wp-caption-text">WWW Framework</p></div>
<p>I am proud to present the first complete release of <a href="https://sourceforge.net/projects/www-php/" target="_blank">WWW Framework</a>. Goal of the project has been to create an API (Application Programming Interface) focused framework which can be used to build user-interface independent software which can be controlled from any type of interface required (be it a simple website or a mobile app). The result is this, an API-focused web and infosystems PHP micro-framework.</p>
<p><span id="more-1050"></span></p>
<p>Project has been launched with <a href="https://sourceforge.net/p/www-php/wiki/Home/" target="_blank">full documentation</a> as well as <a href="https://sourceforge.net/p/www-php/wiki/How%20to%20set%20up%20a%20simple%20web%20service%20with%20WWW%20Framework/" target="_blank">first tutorial</a> that explains how to build a simple web service with WWW.</p>
<p>You can follow news related to the project on various social media channels <a href="http://plus.google.com/106969835456865671988" target="_blank">Google+</a>, <a href="http://www.facebook.com/WWWFramework" target="_blank">Facebook</a>, <a href="http://twitter.com/WWWFramework" target="_blank">Twitter</a> and source code is officially published at <a href="https://sourceforge.net/projects/www-php/" target="_blank">SourceForge</a>, <a href="http://code.google.com/p/www-framework/" target="_blank">Google Code</a> as well as <a href="https://bitbucket.org/kristovaher/www-framework" target="_blank">BitBucket</a>. Repository that is used is Mercurial and you can easily subscribe to it or pull the latest version.</p>
<p>Summary description of the project:</p>
<blockquote><p>WWW is a PHP micro-framework that is built loosely on model-view-control architecture and factory method design pattern. It is made for web services, websites and info-systems and is built around a native API architecture, caching and smart resource management. WWW is a compact framework that does not include libraries and bloated features and is developed keeping lightweight speed and optimizations in mind.</p>
<p>The package comes by default with a view controller and a gateway intended for website functionality with clean URLs. Framework also incorporates a front-end JavaScript controller.</p>
<p>Please make sure to read documentation about how to set up a system and use the API. Complete documentation with detailed tutorials are available here at <a href="https://sourceforge.net/p/www-php/wiki/Home/">https://sourceforge.net/p/www-php/wiki/Home/</a></p>
<p>Mercurial repository is available for developers who are interested in following the development.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://waher.net/archives/1050/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Notepad++ theme and style for developers</title>
		<link>http://waher.net/archives/1013</link>
		<comments>http://waher.net/archives/1013#comments</comments>
		<pubDate>Thu, 29 Sep 2011 17:25:13 +0000</pubDate>
		<dc:creator>Kristo Vaher</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[user interface]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://waher.net/?p=1013</guid>
		<description><![CDATA[If you are using Windows and use Notepad++ as one of your main source-code editors and happen to be a web developer then you might just love this.  I originally developed this for personal use for I was unhappy with other themes or found them a little inconsistent across different web development languages. By now [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1014" class="wp-caption alignright" style="width: 250px"><a href="http://www.waher.net/blog/waher-style.jpg"><img class="size-full wp-image-1014" title="Waher-style Theme" src="http://waher.net/wp-content/uploads/2011/09/theme.jpg" alt="Waher-style Theme" width="240" height="200" /></a><p class="wp-caption-text">Waher-style Theme</p></div>
<p>If you are using Windows and use <a href="http://notepad-plus-plus.org/" target="_blank">Notepad++</a> as one of your main source-code editors and happen to be a web developer then you might just love this.  I originally developed this for personal use for I was unhappy with other themes or found them a little inconsistent across different web development languages. By now I have used this theme in Notepad++ for more than a year now.</p>
<p><em>Thanks to this being shared in <a href="http://www.reddit.com/r/programming/comments/kvpld/reddit_encouraged_me_to_release_this/" target="_blank">reddit</a>, <a href="http://twitter.com/#!/search/%22http%3A%2F%2Fwaher.net%2Farchives%2F1013%22" target="_blank">Twitter</a> and Facebook, it has been downloaded more than ten thousand times in one day.</em></p>
<p><span id="more-1013"></span>It is recommended to use this theme with <a href="http://www.microsoft.com/download/en/details.aspx?id=17879" target="_blank">Consolas</a> font.</p>
<p>You can download the theme archive <a href="http://www.waher.net/blog/waher-style.rar" target="_blank">HERE</a> <em>(*.rar archive)</em> or the theme XML directly <a href="http://waher.net/blog/Waher-style.xml">HERE</a> <em>(right click and save-as)</em>. Preview is available <a href="http://www.waher.net/blog/waher-style.jpg" target="_blank">here</a>.</p>
<p><strong>Features:</strong></p>
<ul>
<li>Comfortable color scheme with a dark background and eye-friendly colors for working long hours</li>
<li>The styles used are intended for a web developer and cover most common files associated with web development</li>
<li>Supports Notepad++ styles for following languages and files: <strong>CSS</strong>, <strong>HTML</strong>, <strong>*.ini</strong> files, <strong>JavaScript</strong>, <strong>PHP</strong>, <strong>SQL</strong> and <strong>XML</strong>.</li>
<li>Covered by <a href="http://www.gnu.org/licenses/fdl.html" target="_blank">GNU Free License</a>, you can modify and redistribute it in however way you like.</li>
<li>Some support for Java and Python files <em>(recently added, might require some testing)</em></li>
</ul>
<p><strong>Install:</strong></p>
<ol>
<li>Unpack the *.rar archive into your <strong>Notepad++</strong> installation directory under subfolder <em>/themes/</em></li>
<li>Open <strong>Notepad++</strong></li>
<li>Go to <em>Settings -&gt; Style Configurator</em></li>
<li>Select <strong>Waher-style</strong> from <em>Select Theme</em> dropdown</li>
<li>Click <em>Save &amp; Close</em></li>
</ol>
<p>I hope this theme will serve you as well as it has served me!</p>
]]></content:encoded>
			<wfw:commentRss>http://waher.net/archives/1013/feed</wfw:commentRss>
		<slash:comments>33</slash:comments>
		</item>
		<item>
		<title>Open source &#8216;WebViewApp v1.12&#8242; for Android released!</title>
		<link>http://waher.net/archives/989</link>
		<comments>http://waher.net/archives/989#comments</comments>
		<pubDate>Sun, 28 Aug 2011 11:48:17 +0000</pubDate>
		<dc:creator>Kristo Vaher</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://waher.net/?p=989</guid>
		<description><![CDATA[I have only recently become curious about developing for Android phones. As a web developer the most important thing for me was to provide a way to bridge the gap between web applications and native applications. Free and open source WebViewApp application is a simple base setup for developing Android applications that communicate with web [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_990" class="wp-caption alignright" style="width: 250px"><a href="http://waher.net/wp-content/uploads/2011/08/primitive.jpg"><img class="size-full wp-image-990" title="WebViewApp" src="http://waher.net/wp-content/uploads/2011/08/primitive.jpg" alt="" width="240" height="241" /></a><p class="wp-caption-text">WebViewApp</p></div>
<p>I have only recently become curious about developing for Android phones. As a web developer the most important thing for me was to provide a way to bridge the gap between web applications and native applications.</p>
<p>Free and open source WebViewApp application is a simple base setup for developing Android applications that communicate with web services. WebViewApp is released as open source and developers can use this base application to build their own fully functional web applications in Android.</p>
<p><span id="more-989"></span>This application is as bare bones as possible and includes commented code and some examples.</p>
<p>Following features are included:</p>
<ul>
<li>Cookie management (application stores cookies)</li>
<li>Cache management (application stores cache based on web service cache lifetime and maintains it when user is not using the app)</li>
<li>Javascript interface (Web service can execute commands in Java and vice versa, such as for scripting hardware keys or executing alerts from web service, displayed in Android.)</li>
<li>Contained URL&#8217;s (Web service only opens its own URL&#8217;s in app, every other URL is launched in browser.)</li>
<li>Online Checks (App checks if user is online, if not then shows an offline page with an option to continue and reload where user left off once internet is back)</li>
<li>Sending custom user agent string to web service for testing if web service is used through Android app. Also includes a (possibly) unique device ID and application version for update checks.</li>
<li>Can load local HTML pages that uses local resources</li>
<li>Can be installed on SD card.</li>
<li>Can save settings and preferences</li>
<li>Can set background services and timed services</li>
<li>Can start a service at boot time</li>
<li>Can make HTTP connections to online API&#8217;s</li>
<li>Can use private and public file system, read and write files</li>
<li>Can use SQLite database</li>
</ul>
<p>This application shows that it is possible to create very extensive Android applications while relying mostly on HTML and JavaScript user interface, which makes it much easier to port to other systems or create a counterpart to browser version of a website.</p>
<p>Please note that there is no ‘guide’ on how to change the base application into your own new application, but source package does include a short overview of all the necessary modifications. Basic knowledge of Android and web development is recommended.</p>
<p>The bare-bones application can be downloaded from Android Market with its name &#8216;WebViewApp&#8217; or from <a href="https://market.android.com/details?id=com.webviewapp.app" target="_blank">Android Market</a>.</p>
<p>Source code can be downloaded from <a href="http://webviewapp.waher.net/webviewapp-source.rar" target="_blank">here</a>. This includes source code for both the Android app as well as the web service.</p>
<p>VERSION HISTORY:</p>
<blockquote><p>v1.12 Database and file system examples, HTTP request examples<br />
v1.11 Starting service at boot time<br />
v1.10 Background services and timed services<br />
v1.09 Notifications, settings and preferences<br />
v1.08 Local image test for local HTML<br />
v1.07 Activity checks and local file support<br />
v1.06 Better examples and descriptions<br />
v1.05 Possibility to keep previous scroll position<br />
v1.04 Back button now works with POST variables<br />
v1.03 Fix for back button in certain conditions<br />
v1.02 Reload page now uses Javascript interface<br />
v1.01 Fix for no-internet reload page<br />
v1.00 Release</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://waher.net/archives/989/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Estonian e-payments solution for PHP released (updated 1.4 stable 20.04.2011)</title>
		<link>http://waher.net/archives/852</link>
		<comments>http://waher.net/archives/852#comments</comments>
		<pubDate>Tue, 11 Jan 2011 18:10:08 +0000</pubDate>
		<dc:creator>Kristo Vaher</dc:creator>
				<category><![CDATA[Web Business]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://waher.net/?p=852</guid>
		<description><![CDATA[E-payment systems and bank services are everyday and common in Estonia, but both developers and companies, who implement e-payments to websites, tend to ask large sums of money for solutions that should be relatively simple. Having developed e-payment systems for years, I had not put together a single solution for this very common problem until [...]]]></description>
			<content:encoded><![CDATA[<div class="mceTemp"></div>
<div id="attachment_853" class="wp-caption alignright" style="width: 324px"><a href="http://waher.net/wp-content/uploads/2011/01/epayment.jpg"><img class="size-full wp-image-853" title="Electronic Payments" src="http://waher.net/wp-content/uploads/2011/01/epayment.jpg" alt="Electronic Payments" width="314" height="206" /></a><p class="wp-caption-text">Electronic Payments</p></div>
<p>E-payment systems and bank services are everyday and common in Estonia, but both developers and companies, who implement e-payments to websites, tend to ask large sums of money for solutions that should be relatively simple. Having developed e-payment systems for years, I had not put together a single solution for this very common problem until now, when Estonia has adopted Euro as its main currency. This solution is released open source, under <a href="http://www.gnu.org/licenses/lgpl-3.0.txt" target="_blank">LGPL</a> license.</p>
<p><span id="more-852"></span>Please note that while this e-payment system is now considered stable and has not run into major problems ever since it was released, some of the connections have been tested more often than others and it is still recommended to test the implementation and make sure it works accordingly before going live.</p>
<p><strong>E-payment systems and Bank e-services that are supported with this solution:</strong></p>
<p>Swedbank (<em>Estonia</em>)<br />
SEB (<em>Estonia</em>)<br />
Sampo (<em>Estonia &amp; Finland</em>)<br />
Nordea (<em>Estonia &amp; Finland</em>)<br />
Estcard (<em>Estonian credit card web service, Mastercard, Visa, etc</em>)</p>
<p><strong>Requirements:</strong></p>
<p>Solution is built with PHP and requires PHP support. The website or service that implements this solution should be modern and utilize UTF-8 for data encoding. This e-payment system assumes that it gets its data as UTF-8 and acts accordingly. This system may not work properly if website is not encoded in UTF-8. OpenSSL support is also required from the web server for some epayment profiles. Multibyte String extension support is required for certain UTF-8 calculations.</p>
<p><strong>Files descriptions:</strong></p>
<p><em>config.epay.php &#8211; </em>Configuration file for each profile. This also includes testing environment access informatin, if that profile has it (read the comments). Whenever setting up a e-payment link, this file should be configured accordingly.</p>
<p><em>class.epay.php</em> &#8211; Main class, this file also calls the configuration file and expects the file to be in the same directory as the <em>class.epayments.php</em> file. This file should not be edited, unless necessary for some reason.</p>
<p><em>gate.epay.php</em> &#8211; This is gateway file that is used to submit data to the bank service or parse the result from the service.</p>
<p><em>example-submit.php</em> &#8211; This is example file, which generates the form that submits order data to gateway and gateway then submits it to the bank.</p>
<p><em>example-return.php</em> &#8211; This is example return page, which receives returned information from bank.</p>
<p><strong>Example:</strong></p>
<p>This package has a working example that is easy and quick to set-up. Package includes SEB bank e-service testing environment. The only thing you have to do, to get the example up and running, is download the package below and upload it to your website under root or subfolder. For example, if you upload the files to:</p>
<p><em>http://www.example.com/epayment/</em></p>
<p>Then you have to change only two configuration settings in<em> example-submit.php</em> file, related to order information and return URL. Using the previous example, the lines should be changed accordingly:</p>
<p><em>line 22. $config['gateway-url']=&#8217;http://www.example.com/epayment/gate.</em><em>epay</em><em>.php&#8217;;<br />
line 23. $config['return-url']=&#8217;http://www.example.com/epayment/example-return.php&#8217;;</em></p>
<p>Don&#8217;t forget to change the <em>example.com</em> website address to your own website address. Nothing else needs to be changed to test if the class works.</p>
<p><strong>From example to Live implementation:</strong></p>
<p>The example runs on &#8216;seb-est&#8217; (SEB Estonia) profile. To use another bank, such as Swedbank, you need to assign correct payment-type before generating the form (like in <em>example-submit.php</em> file). Then you also need to assign proper values to<em> config.</em><em>epay</em><em>.php</em> to the profile. The settings in configuration file are commented and self-explanatory. It is important to note though that some e-payment services offer no testing environments and other epayment services cannot even be tested without the testing environment being set up by the other side first (such as the case with Estcard solutions).</p>
<p><strong>Download:</strong></p>
<p><a href="http://waher.net/waher-net-epayments.rar">waher.net e-payments solution 1.4 stable</a><strong><br />
</strong></p>
<p><strong>Other notes:</strong></p>
<p>As BETA, this solution does not check for errors in every location and there may be quirks as a result. These will be ironed out in future versions. Please report any bugs or problems you find either here in comments or personally to my e-mail kristo@waher.net</p>
<p><em><strong>Version history:</strong></em></p>
<p><em>1.4 stable<br />
20.04.2011<br />
Minor change for Nordea, switching the language keyword (estonian and english were switched)</em><strong><em> </em></strong></p>
<p><em>1.3 beta<br />
04.03.2011<br />
</em>VK_AUTO requests did not work with some banks, gateway now attempts a cURL request to remedy that, if cURL is enabled.<em><strong><br />
</strong></em></p>
<p><em>1.2 beta</em><em><strong><br />
</strong>31.01.2011</em><em><strong><br />
</strong></em>VK_AUTO assigned for ipizza profiles (Sampo, SEB and Swedbank) for automatic pings on success URL<em><strong></strong></em></p>
<p><em>1.1 beta<br />
13.01.2011</em><br />
Sampo profile now works properly, taking into account UTF-8 characters</p>
<p><em>1.0 beta</em><br />
<em>11.01.2011</em><br />
<em>First release</em></p>
]]></content:encoded>
			<wfw:commentRss>http://waher.net/archives/852/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Movie about making a few enemies</title>
		<link>http://waher.net/archives/492</link>
		<comments>http://waher.net/archives/492#comments</comments>
		<pubDate>Fri, 08 Oct 2010 21:00:38 +0000</pubDate>
		<dc:creator>Kristo Vaher</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Web Business]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[movies]]></category>
		<category><![CDATA[opinion]]></category>
		<category><![CDATA[review]]></category>

		<guid isPermaLink="false">http://waher.net/?p=492</guid>
		<description><![CDATA[Please note that this is not review of the movie, but an opinion piece about its topics. For a review, I recommend a review from one of my most trusted reviewers, Roger Ebert of Chicago Sun-Times. David Fincher&#8217;s &#8216;The Social Network&#8217; really is more of a movie about making enemies, than making those 500 million [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_493" class="wp-caption alignright" style="width: 186px"><img class="size-full wp-image-493" title="socialnetwork" src="http://waher.net/wp-content/uploads/2010/10/socialnetwork.jpg" alt="The Social Network" width="176" height="260" /><p class="wp-caption-text">The Social Network</p></div>
<p><em>Please note that this is not review of the movie, but an opinion piece about its topics. For a review, I recommend a <a href="http://rogerebert.suntimes.com/apps/pbcs.dll/article?AID=/20100929/REVIEWS/100929984">review</a> from one of my most trusted reviewers, Roger Ebert of Chicago Sun-Times.</em></p>
<p>David Fincher&#8217;s &#8216;The Social Network&#8217; really is more of a movie about making enemies, than making those 500 million friends. But what the <a href="http://www.youtube.com/watch?v=lB95KLmpLR4">trailer</a> depicts is not what the movie is really about. After seeing the trailer, I expected something entirely different. I expected what I guess Mark Zuckerberg  &#8211; one of the creators of The Facebook &#8211; expected, a movie that paints him as a monster. Instead it was a movie about our dreams, hopes and aspirations and how, at times, we exploit, manipulate and so completely cause self-conflict because of those things we like and want to achieve. The older generation will never understand and we can only hope that our experiences will be able to serve our children better. No one was holding our hand when the internet took over the world.</p>
<p><span id="more-492"></span></p>
<p>The movie focuses primarily on relationships and on the business side of  things, it is intertwined with internet and development of applications  for the internet. I loved the subtle nuances about the role that  software developers play in this world and how it so strongly conflicts  with the way your traditional business used to work. By creating these  castles in the air, from air, a developer is in a unique position that  no other job has shared in the history of the world. There are no rules  to follow, you simply need a good idea and an even better execution. A symbiosis of art and science. What the movie displays very well is that web business does not even require huge investments and resources to become a success: merely couple of  thousand of dollars and a passionate codewriter were needed to push things off to a running start. Even some of the smarter business strategies were covered, which explain  why Facebook did not run into problems that Friendster did (which was  the first very popular Facebook-style social network).</p>
<p>These years media still wonders if Zuckerberg stole the idea for  Facebook or not. David Fincher, being a smart director that he is, never  lets that take over the role of characters in the movie. In fact, it  does not even answer the question for the viewer. But in all honesty, this was not what the movie was  about, it simply tied everything and everyone neatly together.</p>
<p>It helps that the movie takes the perspective of the most known flawed hero of this generation to carry what otherwise might end up being a cluttered movie. Zuckerberg found his creative stride during the years this so-called Web 2.0 (or simply Social Web) was catching on. Smart &#8211; but not popular. Ambitious &#8211; but not charming. He was not driven by clichèd motivations of common biographical movies, such as father issues or chase for perfection or becoming better than your competition. He wanted to become accepted and he wanted to prove to people that hurt him &#8211; and tragically himself &#8211; that making something great and popular can become something he can excuse his shortcomings with. Instead of fixing his problems, he was looking for ways to mask and excuse them.</p>
<p>&#8216;I wish I was special,&#8217; say the lyrics of the song in the trailer. So did Mark Zuckerberg and so do all of us.</p>
]]></content:encoded>
			<wfw:commentRss>http://waher.net/archives/492/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX controller also released as a class</title>
		<link>http://waher.net/archives/331</link>
		<comments>http://waher.net/archives/331#comments</comments>
		<pubDate>Sun, 20 Jun 2010 09:54:57 +0000</pubDate>
		<dc:creator>Kristo Vaher</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://waher.net/?p=331</guid>
		<description><![CDATA[For phpclasses.org purposes I also converted the Smart AJAX Controller into a class, it is available here. While there aren&#8217;t big differences between the two, class structure makes the backend script more seamless and easy to use. Another improvement is the ability to return the result from the server compressed with GZip, thus making the [...]]]></description>
			<content:encoded><![CDATA[<p>For phpclasses.org purposes I also converted the Smart AJAX Controller into a class, it is available <a href="http://www.phpclasses.org/package/6276-PHP-Generate-AJAX-request-responses-in-JSON-format.html" target="_blank">here</a>. While there aren&#8217;t big differences between the two, class structure makes the backend script more seamless and easy to use. Another improvement is the ability to return the result from the server compressed with GZip, thus making the whole communication very lightweight.</p>
]]></content:encoded>
			<wfw:commentRss>http://waher.net/archives/331/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smart AJAX/JSON/PHP solution with jQuery</title>
		<link>http://waher.net/archives/319</link>
		<comments>http://waher.net/archives/319#comments</comments>
		<pubDate>Tue, 01 Jun 2010 21:45:57 +0000</pubDate>
		<dc:creator>Kristo Vaher</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[user interface]]></category>

		<guid isPermaLink="false">http://waher.net/?p=319</guid>
		<description><![CDATA[I have seen a number of complicated solutions for front-end AJAX development and it has become quite clear such solutions are difficult thing to grasp for someone not that experienced with AJAX. Today I am offering a very simple and easy to extend solution that not only is less than two hundred lines of code [...]]]></description>
			<content:encoded><![CDATA[<p>I have seen a number of complicated solutions for front-end AJAX development and it has become quite clear such solutions are difficult thing to grasp for someone not that experienced with AJAX. Today I am offering a very simple and easy to extend solution that not only is less than two hundred lines of code in total &#8211; together with detailed comments &#8211; but also gives the ropes to jQuery AJAX development and using JSON as the preferred type of returned data from the server. Fear not, this is actually easier than it sounds.</p>
<p><span id="more-319"></span></p>
<p>For those of you looking for the files directly, they can grab them <a title="smart-json-ajax-solution.rar" href="http://waher.net/blog/smart-json-ajax-solution.rar">here</a>. Individual source code can be viewed here: <a href="http://waher.net/blog/smart-ajax/index.htm.txt">index.htm</a>, <a href="http://waher.net/blog/smart-ajax/javascript.js.txt">javascript.js</a>, <a href="http://waher.net/blog/smart-ajax/ajax.php.txt">ajax.php</a>. Note that jquery.js file is also required (1.4.2), should you copy-paste from the source code instead of downloading the archive.</p>
<p>The code is licensed under LGPL, so you can use it for personal as well as commercial purposes. All files are commented and a working example is provided within. You do not need a firm grasp of jQuery in order to understand this example and you do not need experience with JSON data format. PHP and jQuery handle the conversions for you. I will not explain everything step by step &#8211; for that refer to the files and the example provided &#8211; but I will give a general overview of what is happening here.</p>
<p>Front-end user-interface has the various actions built through a uiAction() javascript function. This is a general-use function that takes two variables, an &#8216;action&#8217; that acts as an action identifier, and &#8216;data&#8217; variable. Data variable can be whatever you want, it can be a string, integer, array or an object, depending on your needs. Since you will control how the &#8216;data&#8217; variable will be used, it is entirely up to you. In the example files I am calling the uiAction() on a &lt;button&gt; element like this:</p>
<p><em>uiAction(&#8216;alertLowercaseString&#8217;,$(&#8216;#example&#8217;).val());</em></p>
<p>For those of you who know jQuery, know that I am sending the value of an input field with an id of &#8216;example&#8217; to the function. Action&#8217;s name itself is &#8216;alertLowercaseString&#8217; in that case. Then, within uiAction() function in the &#8216;action&#8217;-switch I am executing the function that sends data to AJAX, like this:</p>
<p><em>input['string']=data;<br />
executeAjaxAction(action,input);</em></p>
<p>Action is, by default, the same as action identifier used to call uiAction(). executeAjaxAction() is a function that submits data to PHP backend (but you can customize it, such as have different uiAction() calls execute same function in back-end). &#8216;input&#8217; is an uiAction() specific javascript object. This is defined at the start of the uiAction() function and is used for convenience in order to send specific data to AJAX. &#8216;executeAjaxAction()&#8217; expects &#8216;input&#8217; to be an object or an array, since this is what will be sent to PHP backend. After submitting data to executeAjaxAction() the front-end will connect PHP back-end with AJAX. In this case I am sending an &#8216;action&#8217; of alertLowercaseString. PHP backend will solve the &#8216;input&#8217; into a variable named $inputVariables and again &#8211; as it was in front-end, within a switch you can define what you want to take place in the back-end and what will be returned. In this example it is:</p>
<p><em>$return['action']=&#8217;alert&#8217;;<br />
$return['message']=&#8217;Your string lowercased: &#8216;.strtolower($inputVariables['string']);</em></p>
<p>&#8216;$return&#8217; is an array that is used to create a JSON object from. &#8216;action&#8217; for &#8216;$return&#8217; needs to be always defined, but every other variable can be whatever you want, since &#8211; as before &#8211; you get to decide what data you need to use later on in front end. Basically everything you want to return to front-end should be placed in &#8216;$return&#8217; array. PHP then creates a JSON string of the &#8216;$return&#8217; array and returns it to the browser. executeAjaxAction() function will then call a javascript function parseAjaxReturn(), which will check what action PHP defined for callback (if any) and then &#8211; in this example of &#8216;alert&#8217; as the action &#8211; does the following:</p>
<p><em>alert(json['message']);</em></p>
<p>And this alerts to the user the lowercased string.</p>
<p>This quick explanation may be difficult to understand at first, but I strongly suggest that you take a look at the fully working examples provided within. Files are fully commented and examples provided within are minimal, so you can take this into production use right away should you want.</p>
<p><a title="smart-json-ajax-solution.rar" href="http://waher.net/blog/smart-json-ajax-solution.rar">Download fully working example files here</a></p>
<p>If you have any questions, go ahead and contact me directly or comment this article. I will get back to you as soon as possible.</p>
<p>All the best!</p>
]]></content:encoded>
			<wfw:commentRss>http://waher.net/archives/319/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A simple PHP pathfinder class &#8211; as promised</title>
		<link>http://waher.net/archives/313</link>
		<comments>http://waher.net/archives/313#comments</comments>
		<pubDate>Tue, 25 May 2010 20:55:58 +0000</pubDate>
		<dc:creator>Kristo Vaher</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://waher.net/?p=313</guid>
		<description><![CDATA[I recently shared a simple PHP and jQuery animated pathfinding tech-demo through my Twitter account and promised to share the simple pathfinding class used for pathfinding calculations. The example shared in Twitter is still available here. This example has a few limits, that is you can easily confuse it by clicking on two tile locations [...]]]></description>
			<content:encoded><![CDATA[<p>I recently shared a simple PHP and jQuery animated pathfinding tech-demo through my Twitter account and promised to share the simple pathfinding class used for pathfinding calculations. The example shared in Twitter is still available <a href="http://waher.net/pathfinder/" target="_blank">here</a>.</p>
<p><span id="more-313"></span></p>
<p>This example has a few limits, that is you can easily confuse it by clicking on two tile locations in a row. But in general it works and what I will be using this for will be something a bit different, so this limitation was of no concern to me. However the entire pathfinding calculation takes place on PHP backend. Each map is essentially a square (currently a limitation of pathfinder, but can easily be tweaked) and stored as an associative array, every tile in that array like this:</p>
<p><strong>$map['1x1']['weight']=1.0;</strong></p>
<p>The first key is the coordinate of the single map tile and the weight key is used to store weight of this map tile for calculations. Nothing else is needed (and an example is provided in the files below). For actual game purposes or whatnot you can store additional information on that very map as long as the coordinate and weight are assigned as shown in the example. For example, in my own tech-demo I also store the graphic tile used in the map array.</p>
<p>Finding the actual path is just as simple:</p>
<p><strong>$map=getMap();<br />
require(&#8216;class.pathfinder.php&#8217;);<br />
$path=new PathFinder(); </strong><em>//Create new pathfinder object</em><strong><br />
$path-&gt;setOrigin(1,1); </strong><em>//Set the start location</em><strong><br />
$path-&gt;setDestination(20,20); </strong><em>//Set the destination</em><strong><br />
$path-&gt;setMap($map); </strong><em>//Assign the map to use for calculations</em><strong><br />
$result=$path-&gt;returnPath(); </strong><em>//Returns an array of all the walked steps</em></p>
<p>Working example, as well as commented pathfinder class is available below:<em><br />
</em></p>
<p><a href="http://www.waher.net/blog/pathfinder.rar">Download the class and example file here</a></p>
<p>Please note that this is not a definitive pathfinder. It only takes into account one square ahead and on very large maps I am sure there are more ideal solutions. But for your basic browser based game this is a good starting point and I learned a lot by creating it. This is also easy to expand based on your needs.</p>
<p>If you have any other questions, let me know.</p>
<p>The code is shared entirely free for personal or commercial use.</p>
<p>Cheers!</p>
]]></content:encoded>
			<wfw:commentRss>http://waher.net/archives/313/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

