<?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>Avivo Tech Blog &#187; Java</title>
	<atom:link href="http://tech.avivo.si/tag/java/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.avivo.si</link>
	<description>Solving problems</description>
	<lastBuildDate>Tue, 24 Jan 2012 14:46:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>The easiest way to generate a QR Code for software developers</title>
		<link>http://tech.avivo.si/2012/01/the-easiest-way-to-generate-a-qr-code-for-programmers/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=the-easiest-way-to-generate-a-qr-code-for-programmers</link>
		<comments>http://tech.avivo.si/2012/01/the-easiest-way-to-generate-a-qr-code-for-programmers/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 14:46:11 +0000</pubDate>
		<dc:creator>developer</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[HTML, Javascript and CSS]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[Silverlight/WPF]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[qr code generators]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[web service]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1445</guid>
		<description><![CDATA[So you want to simply generate a QR Code image without diving into the technical specifics? This blog post contains a few simple examples. Just copy-paste where you need it. Idea is to build a URL, make an HTTP request and download the QR Code image. Result is the following image: HTTP Request URL looks [...]]]></description>
			<content:encoded><![CDATA[<p>So you want to simply generate a QR Code image without diving into the technical specifics? This blog post contains a few simple examples. Just copy-paste where you need it.</p>
<p>Idea is to build a URL, make an HTTP request and download the QR Code image. Result is the following image:</p>
<pre><img src="http://www.esponce.com/api/v3/generate?content=your%20content%20goes%20here&#038;format=png" alt="your content goes here" /></pre>
<h2>HTTP Request</h2>
<p>URL looks like<strong> http://www.esponce.com/api/v3/generate?content={content}&amp;format={format}</strong> where <strong>{content}</strong> is URL encoded content to be embedded in QR and <strong>{format}</strong> is output image format. Available formats are <strong>png, jpg, bmp, tif, xaml, svg, eps, txt, html, zip</strong> (containing all listed formats)</p>
<p>List of other parameters like color and size can be found <a href="http://www.esponce.com/help/api-v3/generate#parameters">here</a>.</p>
<h2>C# Sample</h2>
<p>This code can be used in <strong>.NET 2.0</strong> including ASP.NET and WPF or <strong>Silverlight</strong> for web or <strong>WP7</strong></p>
<pre class="brush: csharp; title: ; notranslate">
using System;
using System.IO;
using System.Web;
using System.Net;

public class Program
{
  public static void Main(string[] args)
  {
    //Generate a QR Code and save it to file &quot;sample.png&quot;
    Generate(&quot;your content goes here&quot;, &quot;png&quot;, &quot;sample.png&quot;);
  }

  public static void Generate(string content, string format, string path)
  {
    string encoded = HttpUtility.UrlEncode(content);
    Uri uri = new Uri(&quot;http://www.esponce.com/api/v3/generate?content=&quot; + encoded + &quot;&amp;format=&quot; + format);
    WebClient client = new WebClient();
    client.DownloadFile(uri, path);
  }
}
</pre>
<h2>Java Sample</h2>
<p>This code can be used in a classic <strong>Java</strong> application or web <strong>applet</strong> or <strong>Android</strong> application</p>
<pre class="brush: java; title: ; notranslate">
import java.io.*;
import java.net.*;

public class qrcode
{
  public static void main(String args[])
  {
    //Generate a QR Code image and save it to file &quot;sample.png&quot;
    generate(&quot;your content goes here&quot;, &quot;png&quot;, &quot;sample.png&quot;);
  }

  public static void generate(String content, String format, String path)
  {
    try
    {
      String encoded = URLEncoder.encode(content, &quot;UTF-8&quot;);
      String url = &quot;http://www.esponce.com/api/v3/generate?content=&quot; + encoded + &quot;&amp;format=&quot; + format;
      BufferedInputStream ins = new BufferedInputStream(new URL(url).openStream());
      FileOutputStream fos = new FileOutputStream(path);
      BufferedOutputStream bos = new BufferedOutputStream(fos, 1024);

      int size = 0;
      byte data[] = new byte[1024];
      while ((size = ins.read(data, 0, 1024)) &amp;gt; 0)
      {
        bos.write(data, 0, size);
      }

      bos.close();
      fos.close();
      ins.close();
    }
    catch (Exception e)
    {
    }
  }
}
</pre>
<h2>Python Sample</h2>
<p>Using Python 2.7</p>
<pre class="brush: python; title: ; notranslate">
#!/usr/bin/env python
# -*- coding: UTF-8 -*-

import urllib
import httplib

def generate(content, format = &quot;png&quot;):
    query = urllib.urlencode({ &quot;content&quot;: content, &quot;format&quot;: format })
    con = httplib.HTTPConnection(&quot;www.esponce.com&quot;)
    con.request(&quot;GET&quot;, &quot;/api/v3/generate?&quot; + query)
    response = con.getresponse()
    image = response.read()
    con.close()
    return image

image = generate(&quot;your content goes here&quot;)
file = open(&quot;sample.png&quot;, &quot;wb&quot;)
file.write(image)
file.close()
</pre>
<h2>JavaScript Sample</h2>
<p>JavaScript in combination with HTML</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;img id=&quot;qrcode&quot; src=&quot;&quot; alt=&quot;QR Code&quot; /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
    function generate(content)
    {
        var url = &quot;http://www.esponce.com/api/v3/generate?content=&quot; + encodeURI(content) + &quot;&amp;format=png&quot;;
        var img = document.getElementById(&quot;qrcode&quot;);
        img.src = url;
    }
    generate(&quot;your content goes here&quot;);
&lt;/script&gt;
</pre>
<h2>PHP Sample</h2>
<pre class="brush: php; title: ; notranslate">
&lt;img src=&quot;&lt;?php echo generate(&quot;your content goes here&quot;); ?&gt;&quot; alt=&quot;QR Code&quot; /&gt;

&lt;?php
function generate($content, $format = &quot;png&quot;)
{
    $encoded = urlencode($content);
    $url = &quot;http://www.esponce.com/api/v3/generate?content=$encoded&amp;format=$format&quot;;
    return $url;
}
?&gt;
</pre>
<h2>There is more</h2>
<p>Download all samples with <em>make</em> script <a href="http://tech.avivo.si/wp-content/uploads/2012/01/generate-qr-code-samples-src.zip">here</a>.</p>
<p>Other QR Code related methods like decoding (reverse process of generating) and tracking scans can be found at <a href="http://www.esponce.com/help">esponce.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2012/01/the-easiest-way-to-generate-a-qr-code-for-programmers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts on android mobile development</title>
		<link>http://tech.avivo.si/2010/06/thoughts-on-android-mobile-development/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=thoughts-on-android-mobile-development</link>
		<comments>http://tech.avivo.si/2010/06/thoughts-on-android-mobile-development/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 13:04:12 +0000</pubDate>
		<dc:creator>developer</dc:creator>
				<category><![CDATA[Mobile development]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[android development]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[issues]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[mobile develpment]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=516</guid>
		<description><![CDATA[Intro We like the taste of MVC in ASP .NET and have some practical experiences in coding Java applets, J2ME and Silverlight applications. Lately our team decided to build a simple application for Android phone to try the platform. Story begins with an idea and motivation, installing and setting Eclipse + Android SDK, and like [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Intro</strong><br />
We like the taste of MVC in ASP .NET and have some practical experiences in coding Java applets, J2ME and Silverlight applications.</p>
<p>Lately our team decided to build a simple application for Android phone to try the platform. Story begins with an idea and motivation, installing and setting Eclipse + Android SDK, and like always, a sketch, todo list, etc.</p>
<p><strong>Issues</strong></p>
<ul>
<li>For each property in layout xml the &#8220;android:&#8221; namespace is needed. Of course it can be replace with &#8220;a&#8221; but it still annoying to write it every time. Example &lt;LinearLayout android:id=&#8221;@+id/pnlSomething&#8221; /&gt;   There is more advanced graphical xml standard &#8211; SVG</li>
<li>oops, I tried (miss-clicked) to run android as classic Java application but it returns an error (like build error),<br />
next time I try running as android application this error wont go away even if the code is fine<br />
solution: delete error from the error list and it should work fine <img src='http://tech.avivo.si/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </li>
<li>sometimes I run a debug and don&#8217;t notice the tiny icon in the far right bottom corner of eclipse<br />
that shows the application is launching and it&#8217;s stuck&#8230; and I try to launch it again, and again<br />
and applications are trying to launch parallel&#8230; solution: close eclipse and start again</li>
<li>connection refused on localhost? is this a joke? is only google.com allowed?<br />
firefox opens it normally, firewall is off, same on IIS and apache, permissions are set in manifest.xml<br />
reason: &#8216;localhost&#8217; means the internal loopback of device (emulator) not the PC,<br />
solution: use your LAN IP<br />
//solution: edit hosts and set something like 127.0.0.1   pc-localhost //does not work<br />
<a href="http://groups.google.com/group/android-developers/browse_thread/thread/801645febf0523ea/9e779925e9570828" target="_blank">http://groups.google.com/group/android-developers/browse_thread/thread/801645febf0523ea/9e779925e9570828</a></li>
<li>when a crash occurs it is just a crash, without detailed message or tip, developer should guess the error<br />
* and, BTW, emulator shows wrong time on windows (7:04 PM while the real time is 21:04 on GMT+1 timezone<br />
or 5:07 PM when the time is 19:07)</li>
<li>Record breaker among IDEs: 1.131 GB of RAM taken by Eclipse</li>
<li>A lot of features: social media, web, google maps, sqlite, bluetooth,</li>
<li> gestures, camera, speech recognition, 3D, processing&#8230;</li>
<li>s it easy to learn? theory yes, it is logical and quite simple, well documented;<br />
but dealing with basic practical issues is a pain</li>
</ul>
<p>What really annoys us is that when we write layout in xml and we are confidant with it schema is right, works in theory, draws a preview but just don&#8217;t work in emulator Eclipse won&#8217;t tell what is the problem it just says &#8220;Source Not Found.&#8221;</p>
<p><strong>Comparison: C# vs Java</strong></p>
<p>A good programming language uses less code and effort to complete a task. What makes Silverlight (C#) coding easier and Android (Java) coding harder? Advantages of C# over Java or what is missing in Java:</p>
<ul>
<li> <strong>lambda expression and Linq</strong> make handling data, arrays, xml easy</li>
<li><strong> properties</strong></li>
<li><strong> partial types</strong> when dealing with large files</li>
<li><strong> preprocessor directives (#if, #region)</strong> to bring visual focus on the particular part of code that is being developed and hide the other code</li>
<li><strong> verbatim string</strong>, like @&#8221;C:\Program Files\android\sdk.exe&#8221; without escape characters</li>
<li><strong> nullable types</strong>, like int? that can be -n&#8230;0, 1, 2&#8230;n or null</li>
<li><strong> &#8216;yield&#8217; keyword</strong></li>
<li><strong> &#8216;??&#8217; operator</strong></li>
<li><strong> enumerations</strong> that are avoided in Android (Android uses constants, requires documentation to locate a constant)</li>
</ul>
<p>* comparing to Silverlight you need to write more code in a more complex way for same features (ie. async, binding,<br />
db, events)</p>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">* nullable types, like int? that can be -n&#8230;0, 1, 2&#8230;n or null</div>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2010/06/thoughts-on-android-mobile-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JAR and JAD installation problems: Compulsory attributes missing</title>
		<link>http://tech.avivo.si/2010/01/jar-and-jad-installation-problems-compulsory-attributes-missing/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=jar-and-jad-installation-problems-compulsory-attributes-missing</link>
		<comments>http://tech.avivo.si/2010/01/jar-and-jad-installation-problems-compulsory-attributes-missing/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 15:02:22 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Mobile development]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[Compulsory attributes missing]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[JAR and JAD installation problems]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[mobile devices]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=273</guid>
		<description><![CDATA[If you have something like this in your JAD file MIDlet-Description: Your application MIDlet-Icon: /res/p1/icon.png MIDlet-Jar-Size: 273904 MIDlet-Jar-URL: http://someurl.com/application.jar MIDlet-Name: AppName MIDlet-Vendor: VendorName MIDlet-Version: 0.9.33 MicroEdition-Configuration: CLDC-1.1 MicroEdition-Profile: MIDP-2.0 Be careful and check if you have some empty lines in your JAD file because this is causing this error! Just delete empty lines.]]></description>
			<content:encoded><![CDATA[<p>If you have something like this in your JAD file</p>
<pre class="text">MIDlet-Description: Your application
MIDlet-Icon: /res/p1/icon.png
MIDlet-Jar-Size: 273904
MIDlet-Jar-URL: http://someurl.com/application.jar
MIDlet-Name: AppName
MIDlet-Vendor: VendorName
MIDlet-Version: 0.9.33
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0</pre>
<p>Be careful and check if you have some empty lines in your JAD file because this is causing this error!<br />
Just delete empty lines.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2010/01/jar-and-jad-installation-problems-compulsory-attributes-missing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

