<?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; development</title>
	<atom:link href="http://tech.avivo.si/tag/development/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>Visual Studio 2008 and Windows Service project and setup</title>
		<link>http://tech.avivo.si/2009/10/visual-studio-2008-and-windows-service-project-and-setup/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=visual-studio-2008-and-windows-service-project-and-setup</link>
		<comments>http://tech.avivo.si/2009/10/visual-studio-2008-and-windows-service-project-and-setup/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 13:19:06 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[manual installation windows service]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[window service in visual studio 2008 Standard]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=178</guid>
		<description><![CDATA[Problem is that Visual Studio 2008 does not have Windows Service project and you can not add it and create a setup for this project. To override this use manual approach: 1. Create your service class manually: using System; using System.Diagnostics; using System.ServiceProcess; namespace WindowsService { class WindowsService : ServiceBase { /// /// Public Constructor [...]]]></description>
			<content:encoded><![CDATA[<p>Problem is that Visual Studio 2008 does not have Windows Service project and you can not add it and create a setup for this project.</p>
<p>To override this use manual approach:</p>
<p>1. Create your service class manually:</p>
<pre class="c-sharp">using System;
using System.Diagnostics;
using System.ServiceProcess;

namespace WindowsService
{
    class WindowsService : ServiceBase
    {
        ///
        /// Public Constructor for WindowsService.
        /// - Put all of your Initialization code here.
        ///
        public WindowsService()
        {
            this.ServiceName = "My Windows Service";
            this.EventLog.Log = "Application";

            // These Flags set whether or not to handle that specific

            //  type of event. Set to true if you need it, false otherwise.

            this.CanHandlePowerEvent = true;
            this.CanHandleSessionChangeEvent = true;
            this.CanPauseAndContinue = true;
            this.CanShutdown = true;
            this.CanStop = true;
        }

        ///
        /// The Main Thread: This is where your Service is Run.
        ///
        static void Main()
        {
            ServiceBase.Run(new WindowsService());
        }

        ///
        /// Dispose of objects that need it here.
        ///
        ///
Whether
        ///    or not disposing is going on.
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
        }

        ///
        /// OnStart(): Put startup code here
        ///  - Start threads, get inital data, etc.
        ///
        ///

        protected override void OnStart(string[] args)
        {
            base.OnStart(args);
        }

        ///
        /// OnStop(): Put your stop code here
        /// - Stop threads, set final data, etc.
        ///
        protected override void OnStop()
        {
            base.OnStop();
        }

        ///
        /// OnPause: Put your pause code here
        /// - Pause working threads, etc.
        ///
        protected override void OnPause()
        {
            base.OnPause();
        }

        ///
        /// OnContinue(): Put your continue code here
        /// - Un-pause working threads, etc.
        ///
        protected override void OnContinue()
        {
            base.OnContinue();
        }

        ///
        /// OnShutdown(): Called when the System is shutting down
        /// - Put code here when you need special handling
        ///   of code that deals with a system shutdown, such
        ///   as saving special data before shutdown.
        ///
        protected override void OnShutdown()
        {
            base.OnShutdown();
        }

        ///
        /// OnCustomCommand(): If you need to send a command to your
        ///   service without the need for Remoting or Sockets, use
        ///   this method to do custom methods.
        ///
        ///
Arbitrary Integer between 128 &amp; 256
        protected override void OnCustomCommand(int command)
        {
            //  A custom command can be sent to a service by using this method:
            //#  int command = 128; //Some Arbitrary number between 128 &amp; 256
            //#  ServiceController sc = new ServiceController("NameOfService");
            //#  sc.ExecuteCommand(command);

            base.OnCustomCommand(command);
        }

        ///
        /// OnPowerEvent(): Useful for detecting power status changes,
        ///   such as going into Suspend mode or Low Battery for laptops.
        ///
        ///
The Power Broadcast Status
        /// (BatteryLow, Suspend, etc.)
        protected override bool OnPowerEvent(PowerBroadcastStatus powerStatus)
        {
            return base.OnPowerEvent(powerStatus);
        }

        ///
        /// OnSessionChange(): To handle a change event
        ///   from a Terminal Server session.
        ///   Useful if you need to determine
        ///   when a user logs in remotely or logs off,
        ///   or when someone logs into the console.
        ///
        ///
The Session Change
        /// Event that occured.
        protected override void OnSessionChange(
                  SessionChangeDescription changeDescription)
        {
            base.OnSessionChange(changeDescription);
        }
    }
}</pre>
<p>2. Add installer class:</p>
<pre class="c-sharp">using System;
using System.ComponentModel;
using System.Configuration.Install;
using System.ServiceProcess;

namespace WindowsService
{
    [RunInstaller(true)]
    public class WindowsServiceInstaller : Installer
    {
        ///
        /// Public Constructor for WindowsServiceInstaller.
        /// - Put all of your Initialization code here.
        ///
        public WindowsServiceInstaller()
        {
            ServiceProcessInstaller serviceProcessInstaller =
                               new ServiceProcessInstaller();
            ServiceInstaller serviceInstaller = new ServiceInstaller();

            //# Service Account Information
            serviceProcessInstaller.Account = ServiceAccount.LocalSystem;
            serviceProcessInstaller.Username = null;
            serviceProcessInstaller.Password = null;

            //# Service Information
            serviceInstaller.DisplayName = "My New C# Windows Service";
            serviceInstaller.StartType = ServiceStartMode.Automatic;

            //# This must be identical to the WindowsService.ServiceBase name
            //# set in the constructor of WindowsService.cs
            serviceInstaller.ServiceName = "My Windows Service";

            this.Installers.Add(serviceProcessInstaller);
            this.Installers.Add(serviceInstaller);
        }
    }
}</pre>
<p>3. Use Framework 2.0 <strong>instalutil.exe</strong> to create Installation:</p>
<p><strong>Install.bat</strong></p>
<pre class="c-sharp">@ECHO OFF

REM The following directory is for .NET 2.0
set DOTNETFX2=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727
set PATH=%PATH%;%DOTNETFX2%

echo Installing WindowsService...
echo ---------------------------------------------------
InstallUtil /i WindowsService.exe
echo ---------------------------------------------------
echo Done.</pre>
<p><strong>Uninstall.bat</strong></p>
<pre class="c-sharp">@ECHO OFF

REM The following directory is for .NET 2.0
set DOTNETFX2=%SystemRoot%\Microsoft.NET\Framework\v2.0.50727
set PATH=%PATH%;%DOTNETFX2%

echo Installing WindowsService...
echo ---------------------------------------------------
InstallUtil /u WindowsService.exe
echo ---------------------------------------------------
echo Done.</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/10/visual-studio-2008-and-windows-service-project-and-setup/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hosting ASP.NET MVC on IIS7 and &#8220;Could Not Load Type&#8221; error</title>
		<link>http://tech.avivo.si/2009/09/hosting-aspnet-mvc-on-iis7-and-could-not-load-type-error/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hosting-aspnet-mvc-on-iis7-and-could-not-load-type-error</link>
		<comments>http://tech.avivo.si/2009/09/hosting-aspnet-mvc-on-iis7-and-could-not-load-type-error/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 15:15:42 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[.net framework 3.5 sp1]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[asp.net mvc on iis]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Could Not Load Type]]></category>
		<category><![CDATA[development]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=165</guid>
		<description><![CDATA[If you want to host ASP.NET MVC on IIS7 don&#8217;t forget to copy also MVC DLLs to bin directory when publishing. If you have ASP.NET 3.5 SP1 installed on server copy only System.Web.Mvc If you don&#8217;t have ASP.NET 3.5 SP1 installed on server copy System.Web.Mvc System.Web.Routing System.Web.Abstractions You need to copy also web.config that is [...]]]></description>
			<content:encoded><![CDATA[<ol>
<li>If you want to host ASP.NET MVC on IIS7 don&#8217;t forget to copy also MVC DLLs to bin directory when publishing.
<ul>
<li>If you have ASP.NET 3.5 SP1 installed on server copy only <strong>System.Web.Mvc</strong></li>
<li>If you don&#8217;t have ASP.NET 3.5 SP1 installed on server copy<br />
<strong>System.Web.Mvc<br />
System.Web.Routing<br />
System.Web.Abstractions</strong></li>
</ul>
</li>
<li>You need to copy also <strong>web.config</strong> that is under directory where your <strong>Views </strong>are &#8211; it is not included in your project by default so it will not be published. Copy this manually or include this web.config in your project and then Publish.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/09/hosting-aspnet-mvc-on-iis7-and-could-not-load-type-error/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0</title>
		<link>http://tech.avivo.si/2009/06/syswebformspagerequestmanagerservererrorexception-an-unknown-error-occurred-while-processing-the-request-on-the-server-the-status-code-returned-from-the-server-was-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=syswebformspagerequestmanagerservererrorexception-an-unknown-error-occurred-while-processing-the-request-on-the-server-the-status-code-returned-from-the-server-was-0</link>
		<comments>http://tech.avivo.si/2009/06/syswebformspagerequestmanagerservererrorexception-an-unknown-error-occurred-while-processing-the-request-on-the-server-the-status-code-returned-from-the-server-was-0/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 18:48:24 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ajax error]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[PageRequestManagerServerErrorException]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=87</guid>
		<description><![CDATA[If you get an error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0 just add this code in HEAD section of your page/masterpage: &#60;script language="javascript" type="text/javascript"&#62; Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest); function endRequest(sender, args) { // Check to see if there's an error on this request. [...]]]></description>
			<content:encoded><![CDATA[<p>If you get an error:</p>
<p><strong>Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 0</strong></p>
<p>just add this code in <strong>HEAD </strong>section of your page/masterpage:</p>
<pre>&lt;script language="javascript" type="text/javascript"&gt;
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);
function endRequest(sender, args)
{
	// Check to see if there's an error on this request.
	if (args.get_error() != undefined)
	{
	  //$get('Error').style.visibility = "visible";
	  // Let the framework know that the error is handled,
	  // so it doesn't throw the JavaScript alert.
	  args.set_errorHandled(true);
	}
}
&lt;/script&gt;</pre>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/06/syswebformspagerequestmanagerservererrorexception-an-unknown-error-occurred-while-processing-the-request-on-the-server-the-status-code-returned-from-the-server-was-0/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ArrayOfXElement not recognized by Silverlight 2.0</title>
		<link>http://tech.avivo.si/2009/03/arrayofxelement-not-recognized-by-silverlight-20/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=arrayofxelement-not-recognized-by-silverlight-20</link>
		<comments>http://tech.avivo.si/2009/03/arrayofxelement-not-recognized-by-silverlight-20/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 19:26:54 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[ArrayOfXElement]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[interactive]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[multimedia]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[silverlight 2]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=40</guid>
		<description><![CDATA[Last weekend I was working on a Silverlight 2.0 game that loads and saves scores to an external database. Database is accessed via web service which has two methods: GetScore and SaveScore. GetScore returns DataSet and SaveScore returns nothing. Web service proxy is generated as usual &#8211; right click on the project node in VS2008, [...]]]></description>
			<content:encoded><![CDATA[<p>Last weekend I was working on a Silverlight 2.0 game that loads and saves scores to an external database. Database is accessed via web service which has two methods: GetScore and SaveScore. GetScore returns DataSet and SaveScore returns nothing.</p>
<p>Web service proxy is generated as usual &#8211; right click on the project node in VS2008, &#8220;Add Service Reference&#8230;&#8221;, enter url, proxy class is generated and the methods are accessible in the code. But when I tried to build the project an error occured: <em>&#8220;The type or namespace name &#8216;ArrayOfXElement&#8217; does not exist in the namespace&#8221;</em> which means that <strong>ArrayOfXElement is unrecognized</strong> class for the compiler. Searching on the Google reveals that this happens when service method returns DataSet, so <strong>ArrayOfXElement is actually DataSet</strong> and <strong>DataSets are not supported in Silverlight 2.0</strong>.</p>
<p>A quick solution is to replace all &#8216;ArrayOfXElement&#8217; words with &#8216;object&#8217;. Project would build that way but the data would have no meaning.</p>
<p>Another solution is to change the web service return type but this is not always editable by the client side developer.</p>
<p>Finally, workaround idea is to<strong> get DataSet schema and convert it to a class</strong>. How to do this?<br />
1. Create a dummy WPF project.<br />
2. Add web service reference to the WPF project. Return type is DataSet instead of ArrayOfXElement.<br />
3. Write some code to call a web service methods that returns DataSet then extract xsd schema and save it to the disk. Build and run. Sample:<br />
<span>GameServiceClient client = new GameServiceClient();</span><br />
<span>DataSet ds = client.GetScore(1, &#8220;abc&#8221;, &#8220;&#8221;, DateTime.Now);</span><br />
<span>ds.WriteXmlSchema(@&#8221;C:\Temp\Score.xsd&#8221;);</span><br />
4. So you have the xsd file. Now find &#8216;xsd.exe&#8217; which is located in the same directory as &#8216;svcutil.exe&#8217; (e.g. <em>C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin</em>). Run it with arguments:<br />
<span>xsd C:\Temp\Score.xsd /c</span><br />
5. xsd tool generates Score.cs file which contains tables as classes and columns as properties. Include the generated file in the Silverlight project.<br />
6. Replace all &#8216;ArrayOfXElement&#8217; words with &#8216;NewDataSet&#8217; or other class name, depends on the retrieved DataSet name and generated code.</p>
<p>Note that this is just an idea. So far the sample project builds fine but there is a problem with cross-domain security. Another story.</p>
<p>Url to the web service in this example:<br />
<a href="http://www.silverlightclub.com/apps/GameService.asmx">http://www.silverlightclub.com/apps/GameService.asmx</a></p>
<p>References:<br />
<a href="http://silverlight.net/forums/t/60518.aspx">http://silverlight.net/forums/t/60518.aspx</a><br />
<a href="http://blogs.msdn.com/suwatch/archive/2009/01/21/wcf-silverlight-exception-and-serialization.aspx">http://blogs.msdn.com/suwatch/archive/2009/01/21/wcf-silverlight-exception-and-serialization.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/03/arrayofxelement-not-recognized-by-silverlight-20/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Project for European parlament</title>
		<link>http://tech.avivo.si/2009/02/hello-world/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=hello-world</link>
		<comments>http://tech.avivo.si/2009/02/hello-world/#comments</comments>
		<pubDate>Sat, 07 Feb 2009 14:49:18 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[competition]]></category>
		<category><![CDATA[creative]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[european parlament]]></category>
		<category><![CDATA[european union]]></category>
		<category><![CDATA[evrosola]]></category>
		<category><![CDATA[evrosola.si]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flash game]]></category>
		<category><![CDATA[prize]]></category>
		<category><![CDATA[school]]></category>
		<category><![CDATA[trip]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=1</guid>
		<description><![CDATA[After we created the best scenario for interactive Flash game for competition in knowledge about European Union, we got this interesting project from European parlament. We developed the game, organized precontest and contest among Slovenian high school grades and best 5 grades got a main prize &#8211; free touristic trip to Strasbourgh. We will publish [...]]]></description>
			<content:encoded><![CDATA[<p>After we created the best scenario for interactive Flash game for competition in knowledge about European Union, we got this interesting project from European parlament.</p>
<p>We developed the game, organized precontest and contest among Slovenian high school grades and best 5 grades got a main prize &#8211; free touristic trip to Strasbourgh.</p>
<p>We will publish the results on Monday &#8211; 9th February 2009.</p>
<p>Url to our game is: <a title="Evrošola - nagradna igra za srednješolce" href="http://www.evrosola.si/" target="_blank">www.evrosola.si</a></p>
<p>Here are some screenshots of our game:</p>

<a href='http://tech.avivo.si/2009/02/hello-world/evrosolasi01/' title='Evrošola homepage'><img width="150" height="150" src="http://tech.avivo.si/wp-content/uploads/2009/02/evrosolasi01-150x150.jpg" class="attachment-thumbnail" alt="Evrošola homepage" title="Evrošola homepage" /></a>
<a href='http://tech.avivo.si/2009/02/hello-world/evrosolasi02/' title='Evrošola loading game'><img width="150" height="150" src="http://tech.avivo.si/wp-content/uploads/2009/02/evrosolasi02-150x150.jpg" class="attachment-thumbnail" alt="Evrošola loading game" title="Evrošola loading game" /></a>
<a href='http://tech.avivo.si/2009/02/hello-world/evrosolasi03/' title='Evrošola starting screen'><img width="150" height="150" src="http://tech.avivo.si/wp-content/uploads/2009/02/evrosolasi03-150x150.jpg" class="attachment-thumbnail" alt="Evrošola starting screen" title="Evrošola starting screen" /></a>
<a href='http://tech.avivo.si/2009/02/hello-world/evrosolasi04/' title='Evrošola playing'><img width="150" height="150" src="http://tech.avivo.si/wp-content/uploads/2009/02/evrosolasi04-150x150.jpg" class="attachment-thumbnail" alt="Evrošola playing" title="Evrošola playing" /></a>

]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/02/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

