<?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</title>
	<atom:link href="http://tech.avivo.si/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.avivo.si</link>
	<description>Solving problems</description>
	<lastBuildDate>Thu, 26 Apr 2012 06:03:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>ReportQueue folder too big &#8211; is it safe to delete?</title>
		<link>http://tech.avivo.si/2012/04/reportqueue-folder-too-big-is-it-safe-to-delete/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=reportqueue-folder-too-big-is-it-safe-to-delete</link>
		<comments>http://tech.avivo.si/2012/04/reportqueue-folder-too-big-is-it-safe-to-delete/#comments</comments>
		<pubDate>Thu, 26 Apr 2012 06:03:08 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[System administration]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[optimizing Windows 2008 server]]></category>
		<category><![CDATA[ReportQueue too big]]></category>
		<category><![CDATA[what is ReportQueue]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1515</guid>
		<description><![CDATA[We have noticed extremely large folder on our server. It happens that Error logs are kept there. Folder is here: c:\users\%username%\appdata\local\Microsoft\Windows\WER\ReportQueue We have deleted its content completely and we also disabled Error logging. In order to do this you need to change group policy (as administrator): Start gpedit.msc to open the group policy editor Browse [...]]]></description>
			<content:encoded><![CDATA[<p>We have noticed extremely large folder on our server. It happens that Error logs are kept there.</p>
<p>Folder is here:<br />
<strong>c:\users\%username%\appdata\local\Microsoft\Windows\WER\ReportQueue</strong></p>
<p>We have deleted its content completely and we also disabled Error logging. In order to do this you need <a href="technobuff.wordpress.com/2009/09/16/install-and-configure-ftp-secure-ftps-or-ftp-ssl-using-filezilla/" target="_blank">to change group policy</a> (as administrator):</p>
<ol>
<li>Start gpedit.msc to open the group policy editor</li>
<li>Browse to computer settings/administrative templates/windows components/windows error reporting.</li>
<li>On the right hand side there will be a &#8220;Disable windows error reporting&#8221; setting that you can flip on to disable things altogether</li>
</ol>
<p>If you want to take a look at one of the erorr dumps the easiest way to do this is through the windows debuggers:</p>
<ol>
<li>Install the windows debuggers from <a href="http://www.microsoft.com/whdc/devtools/debugging/default.mspx">http://www.microsoft.com/whdc/devtools/debugging/default.mspx</a></li>
<li>Make sure the debugger machine has internet access, and copy one of the .hdmps across to it.</li>
<li>Run windbg.exe -z foo.hdmp to open up the dump in the gui debugger</li>
<li>From the command window that comes up type:
<ul>
<li>symfix c:\cache   &#8211; this fixes up the symbol paths so we can resolve stacks</li>
<li>reload -f ntdll.dll  &#8211; this loads symbols for one of the core os dlls and validates that we can do basic analysis</li>
<li>analyze -v     &#8211; this analyzes the dump and should give root cause analysis including the stack back trace from the crash etc.</li>
</ul>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2012/04/reportqueue-folder-too-big-is-it-safe-to-delete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simply what is JSON?</title>
		<link>http://tech.avivo.si/2012/03/simply-what-is-json/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=simply-what-is-json</link>
		<comments>http://tech.avivo.si/2012/03/simply-what-is-json/#comments</comments>
		<pubDate>Fri, 09 Mar 2012 10:45:22 +0000</pubDate>
		<dc:creator>developer</dc:creator>
				<category><![CDATA[HTML, Javascript and CSS]]></category>
		<category><![CDATA[Programming Techniques]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[sample]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1499</guid>
		<description><![CDATA[JSON is a way to store data like XML but in different form. Simple rules: { and } define class [ and ] define array values are written as key:value pairs and separated with comma (,) Example: { &#160;&#160;"id" : 123, &#160;&#160;"topic" : "meal", &#160;&#160;"today" : "kiwi", &#160;&#160;"fruits" : [ "apple", "banana", "cherry" ], &#160;&#160;"orange" [...]]]></description>
			<content:encoded><![CDATA[<p>JSON is a way to store data like XML but in different form.</p>
<p>Simple rules:</p>
<pre><tt>{ and } define class
[ and ] define array
values are written as key:value pairs and separated with comma (,)</tt></pre>
<p>Example:</p>
<pre><tt>{
&nbsp;&nbsp;"id" : 123,
&nbsp;&nbsp;"topic" : "meal",
&nbsp;&nbsp;"today" : "kiwi",
&nbsp;&nbsp;"fruits" : [ "apple", "banana", "cherry" ],
&nbsp;&nbsp;"orange" : { "color" : "orange", "shape" : "round" }
}</tt></pre>
</p>
<p>
Parsing JSON in Java (Android)</p>
<pre class="brush: java; title: ; notranslate">
String json = /* string from example */
JSONObject obj = new JSONObject(json);

int id = obj.getInt(&quot;id&quot;); //123
String topic = obj.getString(&quot;topic&quot;); //meal
String today = obj.getString(&quot;today&quot;); //kiwi

JSONArray fruits = obj.getJSONArray(&quot;fruits&quot;);
for (int i = 0; i &lt; fruits.length(); i++)
{
  String fruit = fruits.getString(i); //apple, banana or cherry
}

JSONObject orange = obj.getJSONObject(&quot;orange&quot;);
String color = orange.getString(&quot;color&quot;); //orange
String shape = orange.getString(&quot;shape&quot;); //round
</pre>
</p>
<p style="margin-top: 20px;">
Building JSON in Java (Android)</p>
<pre class="brush: java; title: ; notranslate">
JSONObject obj = new JSONObject();
obj.put(&quot;id&quot;, 123);
obj.put(&quot;topic&quot;, &quot;meal&quot;);
obj.put(&quot;today&quot;, &quot;kiwi&quot;);

JSONArray fruits = new JSONArray();
fruits.put(&quot;apple&quot;);
fruits.put(&quot;banana&quot;);
fruits.put(&quot;cherry&quot;);
obj.put(&quot;fruits&quot;, fruits);

JSONObject orange = new JSONObject();
orange.put(&quot;color&quot;, &quot;orange&quot;);
orange.put(&quot;shape&quot;, &quot;round&quot;);
obj.put(&quot;orange&quot;, orange);

String json = obj.toString();
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2012/03/simply-what-is-json/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DNS Recursive Queries problem</title>
		<link>http://tech.avivo.si/2012/03/dns-recursive-queries-problem/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dns-recursive-queries-problem</link>
		<comments>http://tech.avivo.si/2012/03/dns-recursive-queries-problem/#comments</comments>
		<pubDate>Fri, 09 Mar 2012 09:50:22 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[System administration]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[dns recursive queries]]></category>
		<category><![CDATA[domain is not accessible]]></category>
		<category><![CDATA[domain name servers]]></category>
		<category><![CDATA[domains]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1495</guid>
		<description><![CDATA[Great online tool http://www.intodns.com/ can check DNS records for your domain. After checking we got some error that was written like this: I could use the nameservers listed below to performe recursive queries. It may be that I am wrong but the chances of that are low. You should not have nameservers that allow recursive [...]]]></description>
			<content:encoded><![CDATA[<p>Great online tool <a href="http://www.intodns.com/">http://www.intodns.com/</a> can check DNS records for your domain.</p>
<p>After checking we got some error that was written like this:<br />
<span style="color: #ff0000;">I could use the nameservers listed below to performe recursive queries. It may be that I am wrong but the chances of that are low. You should not have nameservers that allow recursive queries as this will allow almost anyone to use your nameservers and can cause problems. Problem record(s) are:</span><br />
<span style="color: #ff0000;">xxx.xxx.xxx.xxx</span></p>
<p>Because we have primary, secondary and ternary DNS servers we needed to disable recursive queries on Windows servers.</p>
<p>To do this you will need to do this manual work:</p>
<ol>
<li>Open <strong>Regedit</strong></li>
<li>Find the key: <strong>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\DNS\Parameters</strong></li>
<li>Add new value: <strong>NoRecursion </strong>and set it to <strong>DWORD </strong>type and set value to <strong>1</strong></li>
<li>Restart <strong>DNS service </strong>on your Windows server</li>
</ol>
<p>After that warning error disappeared.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2012/03/dns-recursive-queries-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to trigger change event on HTML hidden field?</title>
		<link>http://tech.avivo.si/2012/02/how-to-trigger-change-event-on-html-hidden-field/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-trigger-change-event-on-html-hidden-field</link>
		<comments>http://tech.avivo.si/2012/02/how-to-trigger-change-event-on-html-hidden-field/#comments</comments>
		<pubDate>Mon, 27 Feb 2012 12:45:07 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[HTML, Javascript and CSS]]></category>
		<category><![CDATA[change javascript event]]></category>
		<category><![CDATA[hidden field]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[onchange]]></category>
		<category><![CDATA[trigger change event on hidden field]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1492</guid>
		<description><![CDATA[HTML hidden field change event does not fire when the value is programmatically changed. You can trigger this value manually after setting the new value for your hidden field, like this: $("#yourHiddenFieldId").val("some value").change();]]></description>
			<content:encoded><![CDATA[<p>HTML hidden field <code>change</code> event does not fire when the value is <strong>programmatically</strong> changed.</p>
<p>You can trigger this value manually after setting the new value for your hidden field, like this:</p>
<pre><code>$("#yourHiddenFieldId").val("some value").change();
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2012/02/how-to-trigger-change-event-on-html-hidden-field/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to restore administrator access to a SQL server</title>
		<link>http://tech.avivo.si/2012/02/how-to-restore-administrator-access-to-a-sql-server/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=how-to-restore-administrator-access-to-a-sql-server</link>
		<comments>http://tech.avivo.si/2012/02/how-to-restore-administrator-access-to-a-sql-server/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 11:05:37 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[System administration]]></category>
		<category><![CDATA[administrator can not login to ms sql server]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[microsoft sql server]]></category>
		<category><![CDATA[ms sql 2008]]></category>
		<category><![CDATA[ms sql server]]></category>
		<category><![CDATA[restore administrator access to a SQL server]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1485</guid>
		<description><![CDATA[We have found very good article that helped us a lot so we are spreading it&#8230; We got the CLOUD hosting that had SQL Server 2008 installed. Unfortunately, we got this error: CREATE DATABASE permission denied in database &#8216;master&#8217; Despite being an administrator on the box, AND having launched Management Studio in Administrator mode (on [...]]]></description>
			<content:encoded><![CDATA[<p>We have found <a href="http://mobydisk.com/softdev/techinfo/sqlserver.html" target="_blank">very good article </a>that helped us a lot so we are spreading it&#8230;</p>
<p>We got the CLOUD hosting that had SQL Server 2008 installed.</p>
<p>Unfortunately, we got this error:<br />
<span style="color: #ff0000;">CREATE DATABASE permission denied in database &#8216;master&#8217;</span></p>
<p>Despite being an administrator on the box, AND having launched Management Studio in Administrator mode (on Windows 2008R2).</p>
<p>Attempts to grant myself permissions, or to make any changes to SQL server resulted in:<br />
<span style="color: #ff0000;">User does not have permission to perform this action( Microsoft SQL Server, Error:15247)</span></p>
<p>This all happened because we were not the SQL Server administrators despite being an administrator on the machine itself.  This is a new situation in SQL Server 2008. In SQL Server 2005, the local Administrators group was part of the SQL Server administrators. It turns out that only the person who installed SQL Server is a SQL Server administrator. Since that person was not available, we were faced with either uninstalling and reinstalling, or getting into an argument with SQL Server.</p>
<p>Being stubborn, we chose to argue. We knew as an Administrator that we could do anything we wanted, it was just a matter of finding the right registry keys/files/whatever to add ourself to the group. The trick is to put SQL server into single-user maintenance mode so that it ignores authentication.</p>
<p>NOTE: In all of the examples below, you may have to change parameters or command-lines based on your server name and instance name.</p>
<p>Force SQL server to support mixed-mode authentication</p>
<ol>
<li>Run REGEDIT</li>
<li>Go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQLServer<br />
NOTE: This key wiil vary slightly based on the installed version and instance name.</li>
<li>Set &#8220;LoginMode&#8221; to 2. (Source: <a href="http://support.microsoft.com/kb/285097" target="_blank">http://support.microsoft.com/kb/285097</a>)</li>
<li>Restart SQL Server.</li>
</ol>
<p>Force SQL server to let you in temporarily</p>
<ol>
<li>Go to services.</li>
<li>Stop SQL Server.</li>
<li>Grab the SQL server command-line (right click the service &#8211; properties). Our is:<br />
&#8220;c:\Program Files (x86)\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER2008\MSSQL\Binn\sqlservr.exe&#8221; -sMSSQLSERVER2008</li>
<li>Open an administrative command prompt.</li>
<li>Run the command-line from step 3, but add -m -c for single-user maintenance mode command-line so the final command looks like<br />
&#8220;c:\Program Files (x86)\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER2008\MSSQL\Binn\sqlservr.exe&#8221; -sMSSQLSERVER2008 -m -c</li>
<li>Open another administrative command prompt.</li>
<li>Run &#8220;sqlcmd -S localhost\MSSQLSERVER2008&#8243; from that same directory (replace with your server and instance name)</li>
<li>Now you can do all the stuff everyone told you to do that didn&#8221;t work. For example, to create a <strong>hero </strong>user with administrative access:<br />
CREATE LOGIN hero WITH PASSWORD=&#8221;123&#8243;, DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF<br />
EXEC sys.sp_addsrvrolemember @loginame = &#8220;hero&#8221;, @rolename = &#8220;sysadmin&#8221;<br />
GO</li>
<li>QUIT and close the command-prompt</li>
<li>Go to the SQL Server command-line window and hit ctrl+C. It will prompt &#8220;Do you wish to shutdown SQL Server (Y/N)?&#8221; and enter Y.</li>
<li>Close the command-prompt (Source: <a href="http://msdn.microsoft.com/en-us/library/dd207004.aspx" target="_blank">http://msdn.microsoft.com/en-us/library/dd207004.aspx</a>)</li>
</ol>
<p>Finally, login using your hero</p>
<ol>
<li>Restart the SQL Server service</li>
<li>Login using SQL Server authentication as the user &#8220;hero&#8221; with password &#8220;123&#8243;</li>
<li>And *BOOM* now you are in. Enjoy in your data!</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2012/02/how-to-restore-administrator-access-to-a-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>Set IIS binding manually (add and remove IIS binding)</title>
		<link>http://tech.avivo.si/2011/12/set-iis-binding-manually-add-and-remove-iis-binding/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=set-iis-binding-manually-add-and-remove-iis-binding</link>
		<comments>http://tech.avivo.si/2011/12/set-iis-binding-manually-add-and-remove-iis-binding/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 14:22:57 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Silverlight/WPF]]></category>
		<category><![CDATA[adding binding to iis from command line]]></category>
		<category><![CDATA[bindings]]></category>
		<category><![CDATA[change iis bindings from asp.net mvc website]]></category>
		<category><![CDATA[iis 7]]></category>
		<category><![CDATA[iis bindings]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1422</guid>
		<description><![CDATA[We had an issue that we need to add or remove IIS 7 or IIS 7.5 additional bindings on one web application and we wanted to do this from one of our ASP.NET MVC applications. It is possible so you need to use IIS system program appcmd.exe (you can find it in C:\Windows\System32\inetsrv\ (we suggest [...]]]></description>
			<content:encoded><![CDATA[<p>We had an issue that we need to add or remove IIS 7 or IIS 7.5 <strong>additional bindings</strong> on one web application and we wanted to do this from one of our ASP.NET MVC applications.</p>
<p>It is possible so you need to use IIS system program <strong>appcmd.exe</strong> (you can find it in <strong>C:\Windows\System32\inetsrv\</strong> (we suggest you to put this into your PATH variable)</p>
<h3><strong>Adding additional bindings</strong></h3>
<p>You want to add <strong>your</strong><strong>-subdomain.your-domain.com</strong> binding to your IIS 7 app named <strong>your-domain.com</strong></p>
<p><span style="color: #ff0000;">C:\Windows\System32\inetsrv\appcmd set site /site.name: <strong>your-domain.com</strong> /+bindings.[protocol='http',bindingInformation='*:80:<strong>your-subdomain.your-domain.com</strong>']</span></p>
<h3><strong>Removing existing bindings</strong></h3>
<p>You want to <strong>remove </strong><strong>your</strong><strong>-subdomain.your-domain.com</strong> binding from your IIS 7 app named <strong>your-domain.com </strong>(please notice <strong>- sign</strong> in front of <strong>bindings </strong>word)<strong><br />
</strong></p>
<p><span style="color: #ff0000;">C:\Windows\System32\inetsrv\appcmd set site /site.name: <strong>your-domain.com</strong> /-bindings.[protocol='http',bindingInformation='*:80:<strong>your-subdomain.your-domain.com</strong>']</span></p>
<p>And that&#8217;s it but if you want to run it from ASP.NET you could try to use Process and ProcessInfo classes to run DOS command but there are some permissions problems (we didn&#8217;t investigated much).</p>
<p>Other (alternative way that we tried is directly from the code)<br />
You will need to reference this DLL: <strong>c:\Windows\System32\inetsrv\Microsoft.Web.Administration.dll </strong></p>
<pre>using (ServerManager serverManager = new ServerManager())
{
  if (serverManager.Sites == null)
    throw new SimpleException("There are no IIS applications!");

  var esponceApp = serverManager.Sites.FirstOrDefault(
x =&gt; x.Name == Settings.IISAppName);
  if (esponceApp != null)
  {
    BindingCollection bindingCollection = esponceApp.Bindings;
    Binding binding = bindingCollection.CreateElement("binding");
    binding["protocol"] = "http";
    binding["bindingInformation"] =
string.Format(@"{0}:{1}:{2}", "*", "80", this.DomainName);

    //Remove this binding if already exists.
    int oldBindingIndex = -1;
    int bindingIndex = -1;
    foreach (Binding currentBinding in esponceApp.Bindings)
    {
      if (currentBinding.BindingInformation ==
binding["bindingInformation"].ToString())
      {
        bindingIndex = esponceApp.Bindings.IndexOf(currentBinding);
      }
      if (!string.IsNullOrEmpty(oldDomainName) &amp;&amp;
      currentBinding.BindingInformation ==
string.Format(@"{0}:{1}:{2}", "*", "80", oldDomainName))
      {
        oldBindingIndex = esponceApp.Bindings.IndexOf(currentBinding);
      }
    }
    if (bindingIndex != -1)
    {
      esponceApp.Bindings.RemoveAt(bindingIndex);
    }
    if (oldBindingIndex != bindingIndex &amp;&amp; oldBindingIndex != -1)
    {
      esponceApp.Bindings.RemoveAt(oldBindingIndex);
    }

    //Add this bindings
    bindingCollection.Add(binding);
    serverManager.CommitChanges();
  }
}
}
catch
{
throw new SimpleException("Could not add binding into IIS application!");
}</pre>
<p>Important!<br />
Set identity of your app&#8217;s <strong>Application Domain</strong> from <strong>Advanced Settings &gt; Process Model &gt; Identity &gt; Change &#8220;ApplicationPoolIdentity&#8221; to &#8220;Local System&#8221;</strong></p>
<p>Investigate also security implications if you are not running this in Intranet&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/12/set-iis-binding-manually-add-and-remove-iis-binding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Increasing maximum request length for WCF REST Web Service with ASP .NET 4.0</title>
		<link>http://tech.avivo.si/2011/10/increase-maximum-request-length-for-wcf-rest-web-service-asp-net-4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=increase-maximum-request-length-for-wcf-rest-web-service-asp-net-4</link>
		<comments>http://tech.avivo.si/2011/10/increase-maximum-request-length-for-wcf-rest-web-service-asp-net-4/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 18:50:22 +0000</pubDate>
		<dc:creator>developer</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Web Services]]></category>
		<category><![CDATA[asp .net 4.0]]></category>
		<category><![CDATA[behavior]]></category>
		<category><![CDATA[binding]]></category>
		<category><![CDATA[request length]]></category>
		<category><![CDATA[rest]]></category>
		<category><![CDATA[wcf]]></category>
		<category><![CDATA[web service]]></category>
		<category><![CDATA[web.config]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1407</guid>
		<description><![CDATA[Recently we have extended a web service with method for uploading user&#8217;s profile image. So far the service was working fine with less amount of data, i.e. name, address and description. First image upload test with the new method resulted with 400 Bad Request. Breakpoints were set in WCF method but debugger did not stop [...]]]></description>
			<content:encoded><![CDATA[<p>Recently we have extended a web service with method for uploading user&#8217;s profile image. So far the service was working fine with less amount of data, i.e. name, address and description. First <strong>image upload test</strong> with the new method resulted with <strong>400 Bad Request</strong>. Breakpoints were set in <strong>WCF method</strong> but debugger did not stop there, not even entered the method.</p>
<h2>Default configuration</h2>
<p>WCF service had been configured for REST using default webHttpBinding configuration in web.config</p>
<pre>&lt;configuration&gt;
  ...
  &lt;system.serviceModel&gt;
    &lt;behaviors&gt;
      &lt;endpointBehaviors&gt;
        &lt;behavior name="ApiBehavior" /&gt;
      &lt;/endpointBehaviors&gt;
      &lt;serviceBehaviors&gt;
        &lt;behavior name="Avivo.Web.Services.ApiServiceBehavior"&gt;
         &lt;serviceMetadata httpGetEnabled="true" /&gt;
         &lt;serviceDebug includeExceptionDetailInFaults="false" /&gt;
         &lt;serviceTimeouts transactionTimeout="00:05:00" /&gt;
        &lt;/behavior&gt;
      &lt;/serviceBehaviors&gt;
    &lt;/behaviors&gt;

    &lt;services&gt;
      &lt;!-- API v1.0 --&gt;
      &lt;service behaviorConfiguration="Avivo.Web.Services.ApiServiceBehavior"
name="Avivo.Web.Services.ApiService"&gt;
        &lt;host&gt;
          &lt;baseAddresses&gt;
            &lt;add baseAddress="http://localhost:1234/api/v1" /&gt;
          &lt;/baseAddresses&gt;
        &lt;/host&gt;
        &lt;endpoint address="" binding="webHttpBinding"
contract="Avivo.Web.Services.IApiService" behaviorConfiguration="ApiBehavior" /&gt;
      &lt;/service&gt;
    &lt;/services&gt;

    &lt;serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true"&gt;
      &lt;baseAddressPrefixFilters&gt;
        &lt;add prefix="http://localhost:1234/api/v1"/&gt;
      &lt;/baseAddressPrefixFilters&gt;
    &lt;/serviceHostingEnvironment&gt;

  &lt;/system.serviceModel&gt;
  ...
&lt;/configuration&gt;</pre>
<h2>Identifying the problem</h2>
<p>Images can be quite large (few MB), especially when comparing with text size (few KB). At first it was assumed the web service call has <strong>exceeded maximum request length limit</strong>. To confirm the assumption we analyzed WCF traffic using <strong>SvcTraceViewer</strong>.</p>
<p>Enabling WCF tracing in web.config</p>
<pre>&lt;configuration&gt;
  ...
  &lt;!-- Use SvcTraceViewer for debugging WCF services --&gt;
  &lt;system.diagnostics&gt;
    &lt;trace autoflush="true" /&gt;
    &lt;sources&gt;
      &lt;source name="System.ServiceModel" switchValue="Information,
ActivityTracing" propagateActivity="true"&gt;
        &lt;listeners&gt;
          &lt;add name="sdt" type="System.Diagnostics.XmlWriterTraceListener"
initializeData="d:\temp\wcf-trace.svclog" /&gt;
        &lt;/listeners&gt;
      &lt;/source&gt;
    &lt;/sources&gt;
  &lt;/system.diagnostics&gt;
  ...
&lt;/configuration&gt;</pre>
<p>When the tracing is set each request to web service will write entry to d:\temp\wcf-trace.svclog in this case. The report file can be opened with <strong>SvcTraceViewer</strong> found in <strong>%ProgramFiles%\Microsoft SDKs\Windows</strong>, e.g. &#8220;c:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\SvcTraceViewer.exe&#8221;</p>
<p>Entries in SvcTraceViewer marked with red represents errors. The problematic request was logged with error message:</p>
<pre>The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota, use the MaxReceivedMessageSize property on the appropriate binding element.</pre>
<p>Identifying that assumption was right and the upload request exceeded <strong>default 65 KB limit</strong>.</p>
<h2>Increasing request limit quota</h2>
<p>Customizing <strong>webHttpBinding</strong> in web.config and referencing with <strong>bindingConfiguration</strong> in endpoint element</p>
<pre>&lt;configuration&gt;
        ...
  &lt;system.serviceModel&gt;
        ...
    &lt;bindings&gt;
      &lt;!-- Customizations for REST service --&gt;
      &lt;webHttpBinding&gt;
        &lt;!-- Limits set to 10 MB (specified value in bytes) --&gt;
        &lt;binding name="ApiQuotaBinding" maxReceivedMessageSize="10485760"
maxBufferPoolSize="10485760" maxBufferSize="10485760" closeTimeout="00:03:00"
openTimeout="00:03:00" receiveTimeout="00:10:00" sendTimeout="00:03:00"&gt;
          &lt;readerQuotas maxDepth="32" maxStringContentLength="10485760"
maxArrayLength="10485760" maxBytesPerRead="10485760" /&gt;
          &lt;security mode="None" /&gt;
        &lt;/binding&gt;
      &lt;/webHttpBinding&gt;
    &lt;/bindings&gt;

    &lt;services&gt;
      &lt;!-- API v1.0 --&gt;
      &lt;service behaviorConfiguration="Avivo.Web.Services.ApiServiceBehavior"
name="Avivo.Web.Services.ApiService"&gt;
        &lt;host&gt;
          &lt;baseAddresses&gt;
            &lt;add baseAddress="http://localhost:1234/api/v1" /&gt;
          &lt;/baseAddresses&gt;
        &lt;/host&gt;
        &lt;!-- Added attribute 'bindingConfiguration' --&gt;
        &lt;endpoint address="" bindingConfiguration="ApiQuotaBinding" binding="webHttpBinding"
contract="Avivo.Web.Services.IApiService" behaviorConfiguration="ApiBehavior" /&gt;
      &lt;/service&gt;
    &lt;/services&gt;

  &lt;/system.serviceModel&gt;
  ...
&lt;/configuration&gt;</pre>
<p>Additionally <strong>httpRuntime</strong> limits must also be set because web service is running in ASP .NET compatibilty mode. Note that maxRequestLength has value in kilobytes.</p>
<pre>&lt;configuration&gt;
  ...
  &lt;system.web&gt;
    &lt;httpRuntime maxRequestLength="10240" /&gt;
  &lt;/system.web&gt;
  ...
&lt;/configuration&gt;</pre>
<h2>Testing</h2>
<p>Finding the solution was not straightforward, it took some time searching the web and reading documentation. Finally after figuring out the described config in this post we solved the problem with success.</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/10/increase-maximum-request-length-for-wcf-rest-web-service-asp-net-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding stored JavaScript procedures to MongoDB using Windows Batch script</title>
		<link>http://tech.avivo.si/2011/10/adding-stored-javascript-procedures-to-mongodb-using-windows-batch-script/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=adding-stored-javascript-procedures-to-mongodb-using-windows-batch-script</link>
		<comments>http://tech.avivo.si/2011/10/adding-stored-javascript-procedures-to-mongodb-using-windows-batch-script/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 12:05:55 +0000</pubDate>
		<dc:creator>developer</dc:creator>
				<category><![CDATA[Database]]></category>
		<category><![CDATA[System administration]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mongo]]></category>
		<category><![CDATA[MongoDB]]></category>
		<category><![CDATA[Script]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Stored Procedure]]></category>

		<guid isPermaLink="false">http://tech.avivo.si/?p=1394</guid>
		<description><![CDATA[MongoDB can use stored procedures similar to MSSQL. To make a MongoDB procedure create a new file, name it like DoSomething.js, write a function and attach it to database. Guide through example Lets say we have a log of website visitors stored in visitors collection inside myweb database. Each visitors record contains date and time [...]]]></description>
			<content:encoded><![CDATA[<p>MongoDB can use stored procedures similar to MSSQL. To make a MongoDB procedure create a new file, name it like <strong>DoSomething.js</strong>, write a function and attach it to database.</p>
<h2>Guide through example</h2>
<p>Lets say we have a log of website visitors stored in <strong>visitors</strong> collection inside <strong>myweb</strong> database. Each <strong>visitors</strong> record contains date and time of a visit. Now we want to create monthly statistics &#8211; how many users visits website per month.</p>
<p><strong>visitors</strong> collection looks like:</p>
<pre>&gt; use myweb
&gt; db.visitors.findOne()
{
  "_id": ObjectId("4e0cb7e7da3ea11d18d841e7"),
  "timestamp": "Thu Jun 30 2011 19:52:39 GMT+0200 (Central Europe Daylight Time)"
}</pre>
<p>Most reusable way to get data is to create a stored procedure <strong>GetVisitsPerMonth()</strong> and call it on demand. Create a file <strong>GetVisitsPerMonth.js</strong> and copy-paste the following code inside. Note that file name is named by procedure.</p>
<pre>function ()
{
	var result = db.visitors.group(
	{
		keyf: function(doc)
		{
			return { //NOTE: Bracket must be in this line!!!
				month: doc.timestamp.getMonth(),
				year: doc.timestamp.getFullYear()
			};
		},
		initial: {count:0},
		reduce: function(doc, prev) { prev.count++ }
	});

	return result;
}</pre>
<h2>How to attach one procedure</h2>
<p>Stored procedure can be manually attached like this:</p>
<pre>db = connect("localhost:27017/myweb");
db.system.js.save({"_id":"GetVisitsPerMonth", "value": function() { ... });</pre>
<h2>How to attach multiple procedures</h2>
<p>Large sets of procedures should be well organized in files so you can quickly find a procedure and fix it if necessary. To insert or update all procedures at once use a simple batch script.</p>
<p>Create a new file, name it <strong>install.bat</strong> and copy-paste the following code inside:</p>
<pre>@echo off

:parameters
set DBCON=localhost:27017/myweb
set MONGO=c:\mongodb\bin\mongo.exe
set SCRIPT=script.js

:startup
if not exist %MONGO% goto error
if not "%1"=="" goto add

rem Append connection string
echo Adding connection string...
echo db = connect("%DBCON%"); &gt; %SCRIPT%
echo. &gt;&gt; %SCRIPT%

rem Append scripts
call %0 GetVisitsPerMonth
rem call %0 DoSomething
rem other procedures go here

goto install
rem goto end

:add
echo Adding script %1...
echo db.system.js.save({"_id":"%1", "value": &gt;&gt; %SCRIPT%
type %1.js &gt;&gt; %SCRIPT%
echo }); &gt;&gt; %SCRIPT%
echo. &gt;&gt; %SCRIPT%
goto end

:install
echo Running script...
%MONGO% %SCRIPT%
goto end

:error
echo Check if mongo is installed:
echo %MONGO%

:end</pre>
<p>Edit parameters according to your needs: path to mongo.exe, database name, and list of procedures.<br />
Simply run the script and it is done.</p>
<h2>Testing a stored procedure</h2>
<p>Log into mongo console:</p>
<pre>&gt; use myweb
&gt; db.eval("GetVisitsPerMonth()")
[
  {
    "month": 5,
    "year": 2011,
    "count": 28233,
  },
  {
    "month": 6,
    "year": 2011,
    "count": 48026,
  },
  {
    "month": 7,
    "year": 2011,
    "count": 92754,
  }
]</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2011/10/adding-stored-javascript-procedures-to-mongodb-using-windows-batch-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

