<?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>SHARPOID</title>
	<atom:link href="http://sharpoid.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sharpoid.com</link>
	<description>create and share javascript code on your mobile device</description>
	<lastBuildDate>Fri, 09 Mar 2012 23:20:52 +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>Exit Festival Mobile App (part 1)</title>
		<link>http://sharpoid.com/2012/02/29/exit-festival-mobile-app-part-1/</link>
		<comments>http://sharpoid.com/2012/02/29/exit-festival-mobile-app-part-1/#comments</comments>
		<pubDate>Wed, 29 Feb 2012 08:30:49 +0000</pubDate>
		<dc:creator>Srdjan Dakic</dc:creator>
				<category><![CDATA[Fort Mobile]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://sharpoid.com/?p=198</guid>
		<description><![CDATA[<p>Originally posted at fortmobile.com This is the first post in the two part series. It points to some specific problems, and solutions I came up with, while making the mobile application for major event. I have been contracted to develop &#8230; <a href="http://sharpoid.com/2012/02/29/exit-festival-mobile-app-part-1/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
]]></description>
			<content:encoded><![CDATA[<p><em>Originally posted at <a title="Open Fort Mobile web site" href="http://fortmobile.com/2012/02/27/exit-festival-mobile-app-part-1/" target="_blank">fortmobile.com</a></p>
<p>This is the first post in the two part series. It points to some specific problems, and solutions I came up with, while making the mobile application for major event.</em></p>
<p>I have been contracted to <a title="Open Exit Festival App project page at Fort Mobile web site" href="http://fortmobile.com/projects/exit-festival/" target="_blank">develop mobile application</a> for one of the biggest music festivals in the Europe - EXIT festival in Novi Sad, Serbia. In the year 2009, mobile apps were still kind of a new thing, so I felt the job had to be done perfectly to promote the this technology, especially on such a major event.</p>
<p><img src="http://sharpoid.com/wp-content/uploads/2012/02/blog_exitfest.jpg" alt="Visit Exit Festival page at www.exitfest.org" width="100%" /></p>
<p>EXIT Festival app was developed for Java ME. Today this technology is below the radar and somewhat uncool, despite being the most widespread. Next year, Blackberry and Android phones were added and another team developed the iPhone version. All platforms used the solutions described later in this post.</p>
<p>Among many useful information about the event itself, venue and tourist information on Novi Sad, app shows info on performers and other "rich" documents. It downloads XML documents from the web service, containing artist name, bio, image, links to their website.</p>
<p>Event organizers were quite busy at the time, so they could not create separate set of data for mobile use. They let us pull existing documents and images from their Joomla-based web site and we had to figure out the way to "squeeze" them into small, constrained devices.</p>
<p>There were obvious problems. Back in 2009. there was no 3G and devices were constrained in terms of speed, memory and screen size. Most of the phones had 128x160 and 176x208 screens, some of which are present even today.</p>
<p>So, the loaded document pages and images had to load fast and had to be short. In the remainder of the document I will explain several server-based solutions* which we did to make the user experience on mobiles as good as possible.</p>
<h3>Getting proper image size and orientation</h3>
<p>Event website was full of hi-res images. But they were created with desktop browsers in mind, running on broadband internet and large screens. It is not practical (or possible) to download such images using mobile phones.</p>
<p>Further more, there are many different resolutions and screen layouts, and in order to get best results you have to properly scale and maybe rotate image. We created one routine called imgResize which handled all such cases and returned the adapted image. Every image was downloaded via this script.</p>
<p><font size="2"></p>
<pre class="brush: php; gutter: false; title: ; notranslate">$sourceURI = $_REQUEST[&quot;uri&quot;];
$width = $_REQUEST[&quot;width&quot;];
$height = $_REQUEST[&quot;height&quot;];

$result = imgResize($sourceURL, $width, $height);
imagejpeg($result);

// ...

function imgResize($AFileName, $ATargetWidth, $ATargetHeight)
{
  // get the image dimensions and mime type
  $size = getimagesize($AFileName);
  $srcWidth = $size[0];
  $srcHeight = $size[1];
  $srcType = $size['mime'];

  // read source image
  if ($srcType == &quot;image/jpeg&quot;)
    $srcImage = imagecreatefromjpeg($AFileName);
  else if ($srcType == &quot;image/png&quot;)
    $srcImage = imagecreatefrompng($AFileName);
  else if ($srcType == &quot;image/gif&quot;)
    $srcImage = imagecreatefromgif($AFileName);
  else
    return false;

  // check if image needs to be rotated to fit screen dimensions
  if ($ATargetWidth &lt; $ATargetHeight &amp;&amp; $srcWidth &gt; $srcHeight)
  {
    // screen is in portrait mode, and image in landscape mode
    $imgScreenAdjusted = imagerotate($srcImage, -90, 0);
    $temp = $srcWidth;
    $srcWidth = $srcHeight;
    $srcHeight = $temp;
    imagedestroy($srcImage);
  }
  else if ($ATargetWidth &gt; $ATargetHeight &amp;&amp; $srcWidth &lt; $srcHeight)
  {
    // screen is in landscape mode, and image in portrait mode
    $imgScreenAdjusted = imagerotate($srcImage, -90, 0);
    $temp = $srcWidth;
    $srcWidth = $srcHeight;
    $srcHeight = $temp;
    imagedestroy($srcImage);
  }
  else
  {
    // image matches the screen layout, no need to rotate
    $imgScreenAdjusted = $srcImage;
  }

  // calculate target dimensions, based on the canvas dimension and
  // real image size, while keeping aspect ratio
  $dW = $srcWidth / $ATargetWidth;
  $dH = $srcHeight / $ATargetHeight;
  if ($dW &gt; $dH)
  {
    // we have to scale using width ratio
    $resultWidth = $srcWidth / $dW;
    $resultHeight = $srcHeight / $dW;
  }
  else
  {
    // we have to scale using height ratio
    $resultWidth = $srcWidth / $dH;
    $resultHeight = $srcHeight / $dH;
  }

  // create a blank image
  $imgScaled = imagecreatetruecolor($resultWidth, $resultHeight);

  // resample the original image
  imagecopyresampled($imgScaled, $imgScreenAdjusted, 0, 0, 0, 0,
  $resultWidth, $resultHeight, $srcWidth, $srcHeight);

  // cleanup
  imagedestroy($imgScreenAdjusted);
  return $imgScaled;
}</pre>
<p></font></p>
<p>This may not be textbook PHP code, but I am not professional web developer. Still, this exact function has been used over and over again, for different apps and platforms. In the next part, I will share few other hacks which helped development of the EXIT festival app.</p>
]]></content:encoded>
			<wfw:commentRss>http://sharpoid.com/2012/02/29/exit-festival-mobile-app-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello World!</title>
		<link>http://sharpoid.com/2012/01/30/hello-world/</link>
		<comments>http://sharpoid.com/2012/01/30/hello-world/#comments</comments>
		<pubDate>Mon, 30 Jan 2012 01:32:07 +0000</pubDate>
		<dc:creator>Srdjan Dakic</dc:creator>
				<category><![CDATA[Sharpoid]]></category>

		<guid isPermaLink="false">http://sharpoid.com//?p=1</guid>
		<description><![CDATA[<p>Hello there! One my New Years&#8217; resolutions was not really all that original: to start blogging, at least every once in a while. So there it is! :) For one, I would like to improve my English writing skills but &#8230; <a href="http://sharpoid.com/2012/01/30/hello-world/">Continue reading <span class="meta-nav">&#8594;</span></a></p>
]]></description>
			<content:encoded><![CDATA[<p>Hello there!</p>
<p>One my New Years' resolutions was not really all that original: to start blogging, at least every once in a while. So there it is! :) For one, I would like to improve my English writing skills but also tackle my procrastination tendencies.</p>
<p>Since I spend most of my wake hours in front of the computer doing <a href="http://fortmobile.com" target="_blank">mobile development</a> , I figured this fun little side project could be the right place to share my thoughts on the mobile programming and some other interests in the "real life" such as music, travel, sports, etc.</p>
<p>So, after more than a year, practically an eternity in Android-time, I have decided to resume work on the Sharpoid app.</p>
<p>First version was a little bit rushed, created for local Android <a href="http://izazov3.vipmobile.rs/vai1" target="_blank">developer contest</a>. Although IMHO it was more technically complex than the competition, it failed to gain much interest among the non-geek population.</p>
<p>That was two years ago. Raising popularity of the Android platform in the meantime brought on board more geeks :) but also a lot of others interested in programming, aka <em>the citizen developers</em>, who may find Sharpoid useful in the everyday tasks.</p>
<p>In the meantime I have translated Sharpoid core from Java to C# and successfully ran some tests on Windows Phone and iPhone (<a href="http://xamarin.com/" target="_blank">Xamarin</a>, ex-MonoTouch). Windows Phone is really an awesome platform and it could run the next Sharpoid version. There are also unreleased Blackberry and Java ME versions of the runtime.</p>
<p>Stay tuned for more info. And, as every other unknown blogger, I would love to hear your comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://sharpoid.com/2012/01/30/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

