<?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; Tips and Tricks</title>
	<atom:link href="http://tech.avivo.si/category/tips-and-tricks/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>Visual Source Safe Analyze and Repair tool problems</title>
		<link>http://tech.avivo.si/2011/12/visual-source-safe-analyze-and-repair-tool-problems/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=visual-source-safe-analyze-and-repair-tool-problems</link>
		<comments>http://tech.avivo.si/2011/12/visual-source-safe-analyze-and-repair-tool-problems/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 08:28:47 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Programming Techniques]]></category>
		<category><![CDATA[System administration]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[analyze and repair]]></category>
		<category><![CDATA[Cannot rebuild the database while Visual SourceSafe is being run. Make sure all users have exited SourceSafe and try again.]]></category>
		<category><![CDATA[microsoft visual sorce safe]]></category>
		<category><![CDATA[source safe]]></category>
		<category><![CDATA[version control software]]></category>
		<category><![CDATA[vss]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1438</guid>
		<description><![CDATA[This is the solution if you got this error message when trying to do Analyze and Repair some VSS database using does prompt command: C:\&#62;&#8221;C:\Program Files (x86)\Microsoft Visual SourceSafe\analyze.exe&#8221; -F -V3 -D &#8220;\\my_server\my_vss_database\data Error was: Database analysis in progress File ../data/status.dat is already open Cannot rebuild the database while Visual SourceSafe is being run. Make [...]]]></description>
			<content:encoded><![CDATA[<p>This is the solution if you got this error message when trying to do Analyze and Repair some VSS database using does prompt command:<br />
<strong>C:\&gt;&#8221;C:\Program Files (x86)\Microsoft Visual SourceSafe\analyze.exe&#8221; -F -V3 -D &#8220;\\my_server\my_vss_database\data</strong></p>
<p>Error was:</p>
<p><span style="color: #ff0000;">Database analysis in progress</span> <span style="color: #ff0000;"> File ../data/status.dat is already open</span> <span style="color: #ff0000;"> Cannot rebuild the database while Visual SourceSafe is being run. Make sure all users have exited SourceSafe and try again.</span></p>
<p><strong>Solution</strong></p>
<p>Make sure there are no users connected to the VSS database (running <strong>ssexp</strong>, <strong>ssadmin</strong>, etc), that users cannot connect to the database using the web service (they connect only for short times, so it&#8217;s hard to see them listed as logged in with <strong>ssadmin</strong>), and that <strong>VSS LAN Service is stopped</strong> (use <strong>net stop ssservice</strong>), as it may keep a connection open to the database.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/12/visual-source-safe-analyze-and-repair-tool-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to disable the Thunderbird new mail notification window?</title>
		<link>http://tech.avivo.si/2011/09/how-to-disable-the-thunderbird-new-mail-notification-window/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-disable-the-thunderbird-new-mail-notification-window</link>
		<comments>http://tech.avivo.si/2011/09/how-to-disable-the-thunderbird-new-mail-notification-window/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 07:31:01 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[disable e-mail notification]]></category>
		<category><![CDATA[disable thunderbird e-mail notification window]]></category>
		<category><![CDATA[e-mail]]></category>
		<category><![CDATA[mozilla Thunderbird]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1390</guid>
		<description><![CDATA[If you having a presentation and don&#8217;t want everybody to see e-mail popup with subject and message intro you can disable Thunderbird notification window that appears above System Tray (bottom right) by doing these steps Click Tools and select Options Select the General tab Click the Config Editor button Search for biff Set mail.biff.show_alert to [...]]]></description>
			<content:encoded><![CDATA[<p>If you having a presentation and don&#8217;t want everybody to see e-mail popup with subject and message intro you can disable Thunderbird notification window that appears above System Tray (bottom right) by doing these steps</p>
<ol>
<li>Click <strong>Tools </strong>and select <strong>Options</strong></li>
<li>Select the <strong>General </strong>tab</li>
<li>Click the <strong>Config Editor</strong> button</li>
<li>Search for <strong>biff</strong></li>
<li>Set <strong>mail.biff.show_alert</strong> to <strong>false</strong></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/09/how-to-disable-the-thunderbird-new-mail-notification-window/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows 7 &#8211; Fix if SLEEP mode does not work</title>
		<link>http://tech.avivo.si/2011/09/windows-7-fix-if-sleep-mode-does-not-work/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=windows-7-fix-if-sleep-mode-does-not-work</link>
		<comments>http://tech.avivo.si/2011/09/windows-7-fix-if-sleep-mode-does-not-work/#comments</comments>
		<pubDate>Sun, 11 Sep 2011 08:33:11 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[System administration]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[awakening]]></category>
		<category><![CDATA[fixing sleep mode on windows 7]]></category>
		<category><![CDATA[microsofts]]></category>
		<category><![CDATA[power management]]></category>
		<category><![CDATA[sleep mode]]></category>
		<category><![CDATA[windows 7]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1386</guid>
		<description><![CDATA[Check your network card properties through the device manager and disable the “Allow this devide to wake the computer” feature. Right click on your “My Computer” then select Properties. Click Device Manager on the left side of the Properties window. Check your Network card on the Network Adapters (Click on the + sign to expand). [...]]]></description>
			<content:encoded><![CDATA[<p>Check your network card properties through the device manager and disable the “Allow this devide to wake the computer” feature.</p>
<ol>
<li>Right click on your “My Computer” then select Properties.</li>
<li>Click Device Manager on the left side of the Properties window.</li>
<li>Check your Network card on the Network Adapters (Click on the + sign to expand).</li>
<li>Right click on your network card and select properties.</li>
<li>Go to the Power Management tab and untick the option there to prevent your network card from ever waking up your Windows.</li>
</ol>
<p><img class="alignnone size-full wp-image-1387" title="windows-7-sleep-mode-fix" src="http://tech.avivo.si/wp-content/uploads/2011/09/windows-7-sleep-mode-fix.jpg" alt="" width="414" height="461" /></p>
<h2>Find out what wakes up your Windows 7/Vista from its sleep</h2>
<p>To find out what event/device woke up your Windows from its sleep  state, go to command prompt (type cmd on the Run/Search box and press  ENTER), then type this:<br />
<strong>powercfg – lastwake</strong></p>
<div><ins><ins id="aswift_1_anchor"></ins></ins></div>
<p>&nbsp;</p>
<p>To get the most detailed info (and probably easiest) on the device that wakes your Windows up during the sleep, type:<br />
<strong>powercfg –devicequery wake_armed</strong></p>
<p>&nbsp;</p>
<p>There! You’ll find the culprit I clicked my mouse to wake my Windows up intentionally so that’s why  you see an HID compliant mouse on the screenshot above. Yours might be  different.</p>
<p>Hope this helps to prevent your computer wakes up from sleep by itself!</p>
<p><strong>If it still doesn’t work:</strong></p>
<ul>
<li>Check out your Power Management Options on your Control Panel  (Start, Control Panel, Power Settings, Change plan settings, Change  advanced power settings).<br />
-&gt; “Multimedia settings” option, “When sharing media.” -&gt;”Allow the computer to sleep.<br />
-&gt; Check other options one by one while you’re at it.</li>
</ul>
<p>Original article available <a href="http://www.cravingtech.com/fix-windows-vista7-sleep-mode-from-waking-up-by-itself.html" target="_blank&quot;">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/09/windows-7-fix-if-sleep-mode-does-not-work/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Seeing iTunes purchases and about 1$ credit card&#8217;s authorization holds</title>
		<link>http://tech.avivo.si/2011/08/seeing-itunes-purchases-and-about-1-credit-card-authorization-holds/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=seeing-itunes-purchases-and-about-1-credit-card-authorization-holds</link>
		<comments>http://tech.avivo.si/2011/08/seeing-itunes-purchases-and-about-1-credit-card-authorization-holds/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 13:46:31 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[apple store]]></category>
		<category><![CDATA[authorization holds]]></category>
		<category><![CDATA[credit card]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[purchase]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1355</guid>
		<description><![CDATA[In order to see all your iTunes purchases follow these steps: http://support.apple.com/kb/HT2727 When you sign up for your AppleID and provide your credit card information Apple will try to check validity of your credit card and will create few 1$ authorization holds on your credit cards: You might see such authorization requests on your online [...]]]></description>
			<content:encoded><![CDATA[<div style="margin-bottom:25px;">
In order to see all your iTunes purchases follow these steps: <a href="http://support.apple.com/kb/HT2727" target="_blank">http://support.apple.com/kb/HT2727</a>
</div>
<p>When you sign up for your AppleID and provide your credit card information Apple will try to check validity of your credit card and will create few 1$ authorization holds on your credit cards:</p>
<pre>
You might see such authorization requests on your online statement.
These requests are not actual charges; they are tests to confirm that your credit card
account is active and has credit available to accommodate transactions.
Authorization holds are removed by your financial institution shortly after
your purchase clears. The amount of time it takes to remove authorization requests
varies by financial institution.

To review the actual charges on your account, you may review your iTunes Purchase History.
You will be prompted to enter your iTunes account name and password.
Note that Mac App Store web order details can only be seen in the iTunes purchase history.
Your Purchase History will display your most recent purchases first.
To view details of any purchase, click the arrow to the left of the order date.

If you have questions about the way your financial institution handles authorization
requests, please contact their customer service department.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/08/seeing-itunes-purchases-and-about-1-credit-card-authorization-holds/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>LINQ Max and Min functions upgraded</title>
		<link>http://tech.avivo.si/2011/04/linq-max-and-min-functions-upgraded/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=linq-max-and-min-functions-upgraded</link>
		<comments>http://tech.avivo.si/2011/04/linq-max-and-min-functions-upgraded/#comments</comments>
		<pubDate>Fri, 01 Apr 2011 09:00:06 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Programming Techniques]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[datacontext]]></category>
		<category><![CDATA[first]]></category>
		<category><![CDATA[firstordefault]]></category>
		<category><![CDATA[linq]]></category>
		<category><![CDATA[linq min function throws an exception]]></category>
		<category><![CDATA[max]]></category>
		<category><![CDATA[min]]></category>
		<category><![CDATA[min linq function throws an exception]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1266</guid>
		<description><![CDATA[Classic LINQ Max and Min functions have the same problem as First function &#8211; exception can occur, so we use FirstOrDefault which returns null instead of exception. So, this is how you can extend Min and Max functions into MinOrDefault and MaxOrDefault; public static class IEnumerableExtensions { public static int MinOrDefault(this IEnumerable source, Func selector, [...]]]></description>
			<content:encoded><![CDATA[<p>Classic LINQ <strong>Max </strong>and <strong>Min </strong>functions have the same problem as <strong>First </strong>function &#8211; exception can occur, so we use <strong>FirstOrDefault </strong>which returns <strong>null </strong>instead of exception.</p>
<p>So, this is how you can extend <strong>Min </strong>and <strong>Max </strong>functions into <strong>MinOrDefault </strong>and <strong>MaxOrDefault</strong>;</p>
<pre class="csharp">
public static class IEnumerableExtensions
{
  public static int MinOrDefault<TSource>(this IEnumerable<TSource> source,
    Func<TSource, int> selector, int defaultValue)
  {
    if (source.Any<TSource>())
      return source.Min<TSource>(selector);

    return defaultValue;
  }

  public static int MaxOrDefault<TSource>(this IEnumerable<TSource> source,
    Func<TSource, int> selector, int defaultValue)
  {
    if (source.Any<TSource>())
      return source.Max<TSource>(selector);

    return defaultValue;
  }
}
</pre>
<p>&nbsp;</p>
<p><strong>Usage example:</strong></p>
<pre class="csharp">
  YourDataContext db = new YourDataContext();
  int maxVisits = db.SomeEntityTables.MaxOrDefault(x => x.SomeFieldYouSearchForMaximum, 0);
</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/04/linq-max-and-min-functions-upgraded/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to capture whole webpage into a single screenshot image?</title>
		<link>http://tech.avivo.si/2011/03/how-to-capture-whole-webpage-into-a-single-screenshot-image/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-capture-whole-webpage-into-a-single-screenshot-image</link>
		<comments>http://tech.avivo.si/2011/03/how-to-capture-whole-webpage-into-a-single-screenshot-image/#comments</comments>
		<pubDate>Fri, 25 Mar 2011 11:57:28 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[capture whole webpage]]></category>
		<category><![CDATA[screen capture]]></category>
		<category><![CDATA[screengrab]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[whole webpage to screenshot]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1244</guid>
		<description><![CDATA[Firefox has cool add-on named ScreenGrab It allows you to capture whole webpage (no matter how long it is) to PNG image (screenshot). This is how you use it: And this is the result (example of webpage: QR Code Generator)]]></description>
			<content:encoded><![CDATA[<p>Firefox has cool add-on named <a href="https://addons.mozilla.org/en-US/firefox/addon/screengrab/" target="_blank">ScreenGrab</a><br />
It allows you to capture whole webpage (no matter how long it is) to PNG image (screenshot).</p>
<p>This is how you use it:<br />
<img src="http://tech.avivo.si/wp-content/uploads/2011/03/qrcode.good-survey.com_-700x483.jpg" alt="" title="qrcode.good-survey.com" width="700" height="483" class="alignnone size-large wp-image-1245" /></p>
<div style="margin-top:40px;">And this is the result (example of webpage: <a href="http://qrcode.good-survey.com" target="_blank">QR Code Generator</a>)</div>
<p><img src="http://tech.avivo.si/wp-content/uploads/2011/03/QR-Code-Homepage-561x700.png" alt="" title="QR-Code-Homepage" width="561" height="700" class="alignnone size-large wp-image-1246" /></p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/03/how-to-capture-whole-webpage-into-a-single-screenshot-image/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash vs Silverlight</title>
		<link>http://tech.avivo.si/2010/12/flash-vs-silverlight/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=flash-vs-silverlight</link>
		<comments>http://tech.avivo.si/2010/12/flash-vs-silverlight/#comments</comments>
		<pubDate>Wed, 22 Dec 2010 16:51:32 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[Silverlight/WPF]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[pattern]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[superia]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1018</guid>
		<description><![CDATA[We at Avivo thought that we should post something about Silverlight vs. Flash as we use both technologies at our work. We always want to explore different techniques in production to bring out innovative approach for each project and to inspire our clients. This post is about choosing right technologies when dealing with interactive or [...]]]></description>
			<content:encoded><![CDATA[<table bgcolor="#efeded">
<tbody>
<tr>
<td style="padding: 7px; padding-bottom: 7px; font-family: Georgia; font-size: 15px; line-height: 21px;">We at Avivo thought that we should post something about Silverlight vs. Flash as we use both technologies  at our work. We always want to explore different techniques in production to bring out innovative approach for each project and to inspire our clients.</td>
</tr>
</tbody>
</table>
<div style="padding-top: 10px;"><img class="alignnone size-large wp-image-1025" title="flash-vs-silverlight" src="http://tech.avivo.si/wp-content/uploads/2010/12/flash-vs-silverlight-700x301.jpg" alt="" width="700" height="301" /></div>
<p>This post is about choosing right technologies when dealing with interactive or animated content on the web. It is a our test of Silverlight and Flash technology and we will describe our experience working with both of them. For the record: »HTML5 is not being part of experiment«.</p>
<h2>Adobe Flash</h2>
<p>Flash is well known as being the tool for animations and able to bring all kind of interactive content on web. Flash golden era of  last decade is coming to an end. Currently web site trends are banning Flash out for many different reasons. First was <a href="http://jquery.com/">jQuery</a> that started to replace Flash in many simple tasks and HTML5 will probably be the final executor. Then, also <a href="http://www.apple.com" target="_blank">Apple </a>announced that it will not support Flash on iPhone/iPad. Nevertheless Flash will stay around long time especially when you want to bring extremely good interactivity inside browser for smaller parts like games or banners and for such specifics tasks Flash is still without competition.</p>
<h2>Microsoft Silverlight</h2>
<p>On the other side Silverlight was many times quoted as <a href="http://www.lynnfredricks.com/2010/11/01/microsofts-silverlight-no-longer-a-flash-competitor/">Flash competitor but not any more</a> and lately is obvious that has many other advantages like delivering best video quality/performance and out of browser experience. And developing in C#/VB/other dynamic languages and reusing the code naturally with the project and through the projects. Speed, frame rate accuracy and low CPU usage give few good strengths to the Silverlight down the road. Nowadays that Silverlight is used also as platform for <a href="http://www.microsoft.com/windowsphone/en-gb/default.aspx">Windows Phone</a> we think Silverligt is more attractive then ever.</p>
<h2>Both are RIA</h2>
<p>We need to mentioned that also many Flash developers didn&#8217;t want to switch to Silverligt and many reasons why they didn&#8217;t are very clear to us. To say it in short: Silverlight demands new approach that Flash developers just can&#8217;t or not willing to adopt. When you converting you have to convert fully to have chance for success. Only then you are comfortable enough to work with Silverlight and you are on better position to decide what would be the best technology for specific given task.</p>
<p>Nice example is <a href="http://www.shinedraw.com/flash-vs-silverlight-gallery/ ">Shine Draw web site</a> where each animated example is done in both technologies.  Our task was to bring out animated effect as good as it is possible to be smooth and visual attractive. We decided that this can be good example to try both technologies out and at the same time we was also eager to test them both.</p>
<p><!-- Silverlight vs. Flash: Which technology are you using at your work?  --><br />
<!--<script src="http://www.good-survey.com/poll/e35aq46sw25r.js" type="text/javascript"></script>--></p>
<h2>Our project</h2>
<p>We wanted to create appealing visual effect of  changing triangular pattern animation as best as it gets with bit of 3D look and feel. We made grid out of triangles and we wanted to transform grid while changing images with seamless transitions.</p>
<div style="padding: 10px 0 3px 0;"><img class="alignnone size-large wp-image-1026" title="pattern" src="http://tech.avivo.si/wp-content/uploads/2010/12/pattern1-700x178.jpg" alt="" width="700" height="178" /></div>
<p><span style="color: #7f7f7f; font-size: 12px;">Design ready to animate. Skip reading and see final result <a title="Flash vs Silverlight - Superia pattern" href="http://labs.avivo.si/flash-vs-silverlight/" target="_blank">here</a>.<span> </span></span></p>
<h2>Pattern design ready to animate</h2>
<p>The goal was to animate 6 different pattern designs with seamless transformations with use of 3D on each triangular element.</p>
<div style="padding: 10px 0 3px 0;"><img class="alignnone size-large wp-image-1027" title="patterns" src="http://tech.avivo.si/wp-content/uploads/2010/12/patterns-700x397.jpg" alt="" width="700" height="397" /></div>
<h2>First try with Silverlight</h2>
<p>We had experience with Silverlight transitions while working on <a href="http://www.youtube.com/avivotube#p/u/7/-Mltdr75ecQ">Superia Player</a> and process was very natural and very quick from start to finished.  When we wanted to bring even more interesting 3D transformation on irregular triangles positioned grid parts we encounter issues and we decide is time to switch to Flash and repeat the process.</p>
<h3>Input parameters</h3>
<p>Using 'initParams' in HTML input parameters are passed to Silverlight application. Application collects the parameters on load and requests the specified pattern XML file and initial image from the hosting server. Each other image is loaded once on demanded and cached by browser.</p>
<h3>Mapping images to triangles</h3>
<p>Triangle vector objects were created dynamically by the pattern defined in XML and they fit to the container size. Application has been developed in Silverlight 3 which has no native 3D support but already supports graphic acceleration. So triangles are drawn in 2D space faking the 3D look, 2D is also used because of better performance. Images are mapped to triangles by calculating rotation and offset using ImageBrush that could be later replaced by VideoBrush allowing to map video frames. Lot of geometrical math was done to do this job.</p>
<h3>Flip animations</h3>
<p>Triangle flip animation was done in two ways: transforming around diagonal centre point or transforming vertically/horizontally. In either way front side hides and back side shows or vice versa resulting in image change. Since the triangles are drawn on 2D spaces animations are faking 3D transitions by scaling, skewing, rotating, translating and remapping image. Animation can flip triangles progressively from the top left corner towards the bottom right. Another more appropriate animation starts flipping random triangles progressively with short delays between phases.</p>
<h3>Hosting Silverlight</h3>
<p>Silverlight is embedded in HTML using 'object' tag and 'params'. Setting parameters is straightforward, no tricks or work-arounds. Additionally HTML content can be inserted into 'object' allowing user to view the alternative content in case Silverlight is not installed or plug-in not enabled in browser.</p>
<h3>The catch</h3>
<p>Working with 2D, drawing triangles and mapping parts of image may seem easy at the beginning but when it goes towards fake 3D rotations it can get complex. Having multiple layers, calculating offsets and transitions, mapping images, switching images (front/back) during animation, generating animations, generating delays between flip... Finally algorithms get too complex to continue in 2D space without real 3D engine.</p>
<h2>Making Flash pattern</h2>
<p>We knew that flash might be better shaping irregular transformation but one thing we need to know is that Flash until recently didn't have direct 3D support. Sure, you could make it your own 3D effect by using math to calculate 2D movement and rotation in such way that would resembles 3D feeling, also we need to mentioned that out there are many excellent package of 3D utilities and one is called <a href="http://blog.papervision3d.org/" target="_blank">Paper Vision 3D</a> that was and is still used to produce nice 3D effects in Flash. But we were up to try something (relatively) new and besides that, we wanted to see what can be done with Flash-only 3D in Flash CS4 version.     </p>
<p><strong>Creating our triangular pattern animation required a few critical parts of AS3 code:</strong></p>
<ul>
<li>Loading XML data for pattern definition</li>
<li>Loading images used to create pattern</li>
<li>Mapping images to triangles</li>
<li>Animating the actual transitions</li>
</ul>
<h3>Pattern XML data</h3>
<p>Since introduction of AS3, handling XML data in Flash has become much, much, less complicated, thanks to the adoption of ECMAScript for XML (E4X). Now XML acts as native data type, you don't need to create special objects to copy data from XML.   Now data from XML is directly accessible from XML object, using actual element and attribute names to select appropriate data form XML. Picture preloading is also now much more simple, although the "art-of-preloading" was conquered long ago, classes used to load external content are now better organized, and callback functions for various events that can happen during load are now handled by proper event listeners.</p>
<p>Another good thing in AS3 is that every DisplayObject is by default invisible until you explicitly add it to some other, visible or DisplayObject as it's child. So you can do any kind of manipulation of size, position, alpha, and so on, until you decide that your object is finally in a state you want it to appear on stage.  Sticking images on triangle parts Applying pictures to triangles was another task to perform even before we could use 3d effects. Although it takes a bit of math to draw triangles on proper locations, it is still a combination of well-known lineTo, moveTo, curveTo methods (if you want triangles with rounded corners) and even better in newer version of Flash, you can now use drawPath method. Performance in drawing should be better as well as precision.</p>
<h3>Using 3D in Flash</h3>
<p>With all this we had the basic setup completed, and we came to the funny parts, exploring 3d effects. Using 3d in Flash has become quite easy, you can set rotationX, rotationY, rotationZ, and x, y, z values for any visible objects. Tweening any of these properties will create 3d animation effect. Nice and easy.   Of course, some experimentation was needed, to get some idea how change z value effects the object, its appearance in the stack of objects. Any sudden and extreme change of z value will produce quite unnatural effect.     </p>
<p>Unfortunately, there must be a glitch, when 3d engine is activated (that is when you change any property that directly or indirectly changes z property of an object) the object itself is immediately blurred and this is bad for display animation. In fact, the object is bitmap-cached (to make animation easily to compute) with smoothing. Usually that is not a big deal, unless, as it was the case with our pattern, you need very precise positioning of some elements and crystal sharp edges.</p>
<p><img src="http://tech.avivo.si/wp-content/uploads/2010/12/patter-blur-edges-and-fixing-timers-700x220.jpg" alt="" title="patter-blur-edges-and-fixing-timers" width="700" height="220" class="alignnone size-large wp-image-1107" /><br />
<span style="color: #7f7f7f; font-size: 12px;">Blur edges and timers were pian in the ass.</span></p>
<h3>Solving problems with 3D to 2D world</h3>
<p>This has becomes a first major problem with our pattern project and solution isn't easily at least not in all circumstances. Luckily for our pattern, we struck such a layout that we could overcome this. To make elements clear, once you used 3d effect on an object it will be bitmap cached and blurred, and there's nothing you can do about it. But if your animation is such that in the end your object is in such position that any z-axes related property is zero-ed, you can bring you object back to the 2d world.</p>
<h3>How Flash is transforming</h3>
<p>The thing is, Flash uses two different transformation matrices to track 2d and 3d properties of an object. If 3d transformation matrix exist - than your object is blurred. But if you can get rid of it, your object will be returned to the crystal sharp realm of 2d transformations. All you need to do is to copy 2d properties (x, y position and xscale, yscale) from 3d transformation matrix, remove the 3d transformation matrix, and apply those x, y, xscale, yscale to your object. The only backdraw of this method is that you can not use it on objects that needs z-axes related properties to display themselves correctly.</p>
<h3>Timers and fine tuning</h3>
<p>One thing we've noticed after the pattern was created is that timers we've used to control the timing of the rotations are performing somewhat strange if the HTML page containing the Flash embedded object looses focus. For some reason, when Flash page looses focus, background priority obviously doesn't have not enough memory for Flash timers to work correctly. Flash timers do not guarantee perfect timing anyway, but in the background window it will probably drop out of sync completely. So we needed some quick fix, to detect when the page containing our Flash is loosing focus. Again AS3 have come to the rescue, with it's External interface, and ability to easy communicate with JavaScript, that is, on the other hand capable of detecting when the page has lost the focus. <!-- Silverlight vs. Flash: How would you rate final patterns. --><br />
<!--<script src="http://www.good-survey.com/poll/e35aq46st30o.js" type="text/javascript"></script>--></p>
<p>View final comparison solution between <a title="Flash vs Silverlight - Superia pattern" href="http://labs.avivo.si/flash-vs-silverlight/" target="_blank"> Flash and Silverlight pattern</a>.</p>
<h2>Conclusion</h2>
<p> We found that with Flash we succeed to create pattern transformation as we wanted with smooth transitions and nice 3d effect. Working with Silverlight was very quick and we might even explore it further but we run out of time and beside that we where happy with Flash result. When looking closely you will see that when you embed Silverlight object and Flash object to HTML site, Silverlight need little more time to appears in browser than Flash and this is something we don't know the answer yet.</p>
<p>What have we learned:</p>
<ul>
<li>Flash has "dirty" history and uses bad mix of 'object' and 'embed' tags.</li>
<li>Flash cannot display HTML content reliably if plug-in is missing while Silverlight can do that easily. If plug-in is missing we just display static content.</li>
<li>Flash has native 3D support while Silverlight has no native support for 3D at the time. Silverlight has some experimental libraries which are heavily under development and not for production use.</li>
<li>Calculating 2D to look like 3D is overkill for developers. Too much effort, too small output. Use 3D engine for serious 3D development.</li>
</ul>
<p>Share your thoughts in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2010/12/flash-vs-silverlight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to trim leading and trailing HTML spaces in C#</title>
		<link>http://tech.avivo.si/2010/12/how-to-trim-leading-and-trailing-html-spaces-in-c/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-trim-leading-and-trailing-html-spaces-in-c</link>
		<comments>http://tech.avivo.si/2010/12/how-to-trim-leading-and-trailing-html-spaces-in-c/#comments</comments>
		<pubDate>Mon, 13 Dec 2010 12:27:52 +0000</pubDate>
		<dc:creator>developer</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[remove trailing and leading html spaces]]></category>
		<category><![CDATA[trim]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=948</guid>
		<description><![CDATA[Some HTML WYSIWYG editors create &#8216;br&#8217; tags or leave &#8216;&#38;nbsp;&#8217; garbage spaces when no content is entered. Described TrimWhiteSpaces method is useful when you need to determine if user left blank content in WYSIWYG editor or if you just want to clean HTML code. TrimWhiteSpaces accepts raw HTML content and removes white spaces, tabs, new [...]]]></description>
			<content:encoded><![CDATA[<p>Some HTML WYSIWYG editors create &#8216;br&#8217; tags or leave &#8216;&amp;nbsp;&#8217; garbage spaces when no content is entered. Described <strong>TrimWhiteSpaces </strong>method is useful when you need to determine if user left blank content in WYSIWYG editor or if you just want to clean HTML code.</p>
<p><strong>TrimWhiteSpaces</strong> accepts raw HTML content and removes white spaces, tabs, new line characters, &#8216;br&#8217; tags and &#8216;&amp;nbsp;&#8217; chunks from before and after the actual content.</p>
<pre class=csharp>
public static string TrimWhiteSpaces(string html)
{
  string result = html;

  //Remove leading spaces
  result = Regex.Replace(result, @"<span style="color: red;">^(?&lt;leading&gt;(\s|\r|\n|\&lt;br\s*/?\&gt;|&amp;nbsp;)*)</span>", "",
RegexOptions.IgnoreCase);

  //Remove trailing spaces
  result = Regex.Replace(result, @"<span style="color: red;">(?&lt;trailing&gt;(\s|\r|\n|\&lt;br\s*/?\&gt;|&amp;nbsp;)*)$</span>", "",
RegexOptions.IgnoreCase);

  return result;
}
</pre>
<div style="margin-top:20px;">
<strong>Example:</strong>
</div>
<div style="margin-top:20px;">
<strong>Input:</strong></p>
<pre><span style="color: red;">&amp;nbsp;&lt;br /&gt;&lt;BR   &gt;&lt;BR&gt; &amp;nbsp;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;</span><span style="color: blue;">
&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/p&gt;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;p&gt;Pellentesque lorem neque, accumsan eget euismod ut, tristique et odio.&lt;/p&gt;</span>
<span style="color: red;">&amp;nbsp;&lt;br /&gt; &lt;br&gt;
&amp;nbsp;</span>
</pre>
</div>
<div style="margin-top:20px;">
<strong>Output:</strong></p>
<pre class=csharp>
<span style="color: blue;">
&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit.&lt;/p&gt;
&amp;nbsp;&amp;nbsp;&lt;br /&gt;
&lt;p&gt;Pellentesque lorem neque, accumsan eget euismod ut, tristique et odio.&lt;/p&gt;
</span>
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2010/12/how-to-trim-leading-and-trailing-html-spaces-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Transfer/Copy contacts from Nokia to Samsung Galaxy S</title>
		<link>http://tech.avivo.si/2010/11/transfercopy-contacts-from-nokia-to-samsung-galaxy-s/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=transfercopy-contacts-from-nokia-to-samsung-galaxy-s</link>
		<comments>http://tech.avivo.si/2010/11/transfercopy-contacts-from-nokia-to-samsung-galaxy-s/#comments</comments>
		<pubDate>Sat, 06 Nov 2010 23:14:52 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Mobile development]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[address book]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[Cannot create file: Olktmp.vcf. Right-click the folder...]]></category>
		<category><![CDATA[copy nokia contacts to android phone samsung galaxy s]]></category>
		<category><![CDATA[export nokia address book to samsung galaxy s]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[ms outlook]]></category>
		<category><![CDATA[phonebook]]></category>
		<category><![CDATA[samsung galaxy s i9000]]></category>
		<category><![CDATA[smartphone]]></category>
		<category><![CDATA[transfer contacts]]></category>
		<category><![CDATA[transfer or copy contacts from nokia to galaxy s]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=691</guid>
		<description><![CDATA[Technology should help people in their life not the opposite. Moving contacts from one phone to another should be an easy task &#8211; couple of minutes and that&#8217;s it. But&#8230; Nokia (model E51) using Nokia PC Suite can export contacts only to CSV or TXT format Android Samsung Galaxy S i9000 can read vcf (vCard) [...]]]></description>
			<content:encoded><![CDATA[<p>Technology should help people in their life not the opposite.<br />
Moving contacts from one phone to another should be an easy task &#8211; couple of minutes and that&#8217;s it.<br />
But&#8230;</p>
<ul>
<li> Nokia (model E51) using Nokia PC Suite can export contacts only to CSV or TXT format</li>
<li> Android Samsung Galaxy S i9000 can read <strong>vcf </strong>(vCard) format from its memory card</li>
</ul>
<p>That means not a happy marriage, or marriage that started with a divorce.</p>
<p><strong><span style="color: #993300;">The first task in resolving this conflict will be: </span></strong></p>
<h4>Use Nokia PC Suite to synchronize your phone with Microsoft Outlook so you will get all your Nokia contacts in MS Outlook</h4>
<p>OMG, MS Outlook can&#8217;t export contacts as vCards (it can import them from vCards, but no export).</p>
<p><strong><span style="color: #993300;">But, there is a way (and this will be second step): </span></strong></p>
<h4>(Outlook 2007 version) Go to your Contacts and select all of them and then click on<br />
Actions menu &gt; Send Full Contact &gt; In Internet Format (vCard)</h4>
<p><img class="alignnone size-full wp-image-692" title="outlook-export-vcf" src="http://tech.avivo.si/wp-content/uploads/2010/11/outlook-export-vcf.jpg" alt="" width="683" height="300" /></p>
<p>And if you have a lot of contacts your Outlook (2007 version) will give you this error message:</p>
<p><img class="alignnone size-large wp-image-694" title="outlook-vcf-exporting-error" src="http://tech.avivo.si/wp-content/uploads/2010/11/outlook-vcf-exporting-error-700x92.jpg" alt="" width="700" height="92" /></p>
<p>When you do some search you will find out that you should delete files in Temp Outlook folder and to check this folder permissions, there is also a <a href="http://www.howto-outlook.com/faq/securetemp.htm " target="_blank">small tool</a> to do this &#8211; but that didn&#8217;t help us out and we got the same message <strong>Cannot create file: Olktmp.vcf. Right-click the folder&#8230;</strong></p>
<p>We found out that number of contacts you want to export is important and you can&#8217;t export them all (if you have many contacts) but you need to pick smaller number of selected contacts.</p>
<p>It helped us only to choose a smaller amount of contacts &#8211; about 50 contacts and then click on:<br />
<strong>Actions &gt; Send Full Contact &gt; In Internet Format (vCard)</strong></p>
<p>New mail message will open so send it to one your email.</p>
<p>In this email you will get vCards as attachments, so save them all to the disk to one chosen folder.</p>
<p>After repeating this operation you will get all your contacts as vCards in one folder.</p>
<p>So, finally you are ready to copy them to Samsung Galaxy S smartphone, but it is problem because you will need (when importing copied contacts in your phone) to confirm ever contact and this can take a time if you have a lot of them.</p>
<p>There is a trick to combine/join/merge all vcf (vCard) contacts into on vcf (vCard) file (in Windows OS) by typing this DOS command:</p>
<h4>copy *.vcf AllMyContacts.vcf</h4>
<p>Now, upload <strong>AllMyContacts.vcf </strong>to your Android smartphone&#8217;s SD cartd and go to the Contacts &gt; Menu &#8220;More&#8221; &gt; Import/Export &gt;Import from SD card &gt; choose one file (<strong>AllMyContacts.vcf</strong>)</p>
<p>Finally, we have them <img src='http://tech.avivo.si/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2010/11/transfercopy-contacts-from-nokia-to-samsung-galaxy-s/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

