<?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>ProgTips</title>
	<atom:link href="http://tips.naivist.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://tips.naivist.net</link>
	<description>Kodējot radušās domeles</description>
	<lastBuildDate>Tue, 19 Jan 2010 14:46:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>String concatenation versus array.join() in JavaScript</title>
		<link>http://tips.naivist.net/2010/01/19/string-concatenation-versus-array-join-in-javascript/</link>
		<comments>http://tips.naivist.net/2010/01/19/string-concatenation-versus-array-join-in-javascript/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 14:46:12 +0000</pubDate>
		<dc:creator>Krišs Rauhvargers</dc:creator>
				<category><![CDATA[JScript]]></category>
		<category><![CDATA[Tīmeklis]]></category>

		<guid isPermaLink="false">http://tips.naivist.net/?p=154</guid>
		<description><![CDATA[To answer a question on StackOverflow, I made an experiment which actually qualifies for a separate blog post.

So, I compared the speed of str1+str2 concatenation  and array.push(str1, str2).join() methods.
The code I used was quite simple:

var iIterations =800000;
var d1 = (new Date()).valueOf();
str1 = "";
for (var i = 0; i&#60;iIterations; i++) str1 = str1 + Math.random().toString();
var [...]]]></description>
			<content:encoded><![CDATA[<p>To answer a question on <a href="http://stackoverflow.com/questions/2087522/does-javascript-have-a-built-in-stringbuilder-class/2087538#2087538">StackOverflow</a>, I made an experiment which actually qualifies for a separate blog post.</p>

<p>So, I compared the speed of <code>str1+str2</code> concatenation  and <code>array.push(str1, str2).join()</code> methods.
The code I used was quite simple:</p>

<pre><code>var iIterations =800000;
var d1 = (new Date()).valueOf();
str1 = "";
for (var i = 0; i&lt;iIterations; i++) str1 = str1 + Math.random().toString();
var d2 = (new Date()).valueOf();
log("Time (strings): " + (d2-d1));

var d3 = (new Date()).valueOf();
arr1 = [];
for (var i = 0; i&lt;iIterations; i++)arr1.push(Math.random().toString());
var str2 = arr1.join("");
var d4 = (new Date()).valueOf();
log("Time (arrays): " + (d4-d3));
</code></pre>

<p>I tested it in IE8 and FireFox 3.5.5, both on a Windows 7 x64.</p>

<p>In the beginning I tested on small number of iterations (some hundred, some thousand items). The results were unpredictable (sometimes string concatenation took 0 milliseconds, sometimes it took 16 milliseconds, the same for array joining).</p>

<p>When I increased the count to 50&#8242;000, the results were different in different browsers &#8211; in IE the string concatenation was faster (94 milliseconds) and join was slower(125 milliseconds), while in Firefox the array join was faster (113 milliseconds) than string joining (117 milliseconds).</p>

<p>Then I increased the count to 500&#8242;000. Now the <code>array.join()</code> was <strong>slower than string concatenation</strong> in both browsers: string concat 937ms in IE, 1155 ms in Firefox, array join 1265 in IE, 1207 in Firefox.</p>

<p>Maximum iteration count I could test in IE without having &#8220;the script is taking too long to execute&#8221; was 850&#8242;000. Then IE was 1593 for string concatenation and 2046 for array join, Firefox had 2101 for string concatenation and 2249 for array join.</p>

<p><strong>Results</strong> &#8211; if the number of iterations is small, you can try to use <code>array.join()</code>, as it might be faster in Firefox. When the number increases, the <code>string1+string2</code> method is faster.</p>

<p>UPDATE<br />
I performed the test on IE6 (WindowsXP). The process stopped to respond immediately and never ended, if I tried the test on more than 100&#8242;000 iterations. 
On 40&#8242;000 iterations the results were </p>

<pre><code>Time (strings): 59175 ms
Time (arrays): 220 ms
</code></pre>

<p>This means &#8211; if you need to support IE6, choose <code>array.join()</code> which is way faster than string concatenation.</p>
]]></content:encoded>
			<wfw:commentRss>http://tips.naivist.net/2010/01/19/string-concatenation-versus-array-join-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Restoring the top navigation bar of a SharePoint site</title>
		<link>http://tips.naivist.net/2009/12/01/restoring-the-top-navigation-bar-of-a-sharepoint-site/</link>
		<comments>http://tips.naivist.net/2009/12/01/restoring-the-top-navigation-bar-of-a-sharepoint-site/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 16:14:10 +0000</pubDate>
		<dc:creator>Krišs Rauhvargers</dc:creator>
				<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://tips.naivist.net/?p=149</guid>
		<description><![CDATA[It&#8217;s a known issue that if you delete the &#8220;Top Navigation&#8221; menu through the API in SharePoint 2007, you cannot restore it easily. I came across this problem in one of my development sites. When looking for a solution, I found this article, saying you have to do it through the database. 

The code below [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a known issue that if you delete the &#8220;Top Navigation&#8221; menu through the API in SharePoint 2007, you cannot restore it easily. I came across this problem in one of my development sites. When looking for a solution, I found <a href="http://statto1974.wordpress.com/2008/04/09/beware-of-deleting-global-navigation-nodes-in-spwebnavigationglobalnodes/">this article</a>, saying you have to do it through the database. </p>

<p>The code below solves the problem programmatically (and yes, it changes the database directly). Of course, it&#8217;s an unsupported solution &#8211; if you use it, you may get in trouble with Microsoft official support. 
<pre>
string sSiteUrl = "http://moss/sites/yoursite/";
//after the code gets executed, we have to dispose the 
//spweb object, since the Navigation object of the current SPWeb instance will contain wrong information
using (SPSite oSite = new SPSite(sSiteUrl))
{
    using (SPWeb oWeb = oSite.RootWeb)
    {
        //check if the top navigation bar is already there
        SPNavigationNode oTopnav = null;
        try
        {
            oTopnav = oWeb.Navigation.GetNodeById(1002);
        }
        catch (Exception)
        {
            oTopnav = null;
        }</p>

<pre><code>    if (oTopnav == null)
    {
        //we've found out there is no top navigation bar. Let's create one;

        //we create a temporary navigation node pointing back to web site root
        Microsoft.SharePoint.Navigation.SPNavigationNode oTempNode = new Microsoft.SharePoint.Navigation.SPNavigationNode("Navigation", oWeb.ServerRelativeUrl);
        //we add this node to the "global" collection (where quick launch and top nav bar normally live)
        oWeb.Navigation.GlobalNodes.AddAsLast(oTempNode);

        //now the dirty work - go to the database and change the ID of the navigation node
        System.Data.SqlClient.SqlConnection oConn = new System.Data.SqlClient.SqlConnection(oSite.ContentDatabase.DatabaseConnectionString);
        System.Data.SqlClient.SqlCommand oCmd = new System.Data.SqlClient.SqlCommand();
        oCmd.Connection = oConn;
        oCmd.CommandType = System.Data.CommandType.Text;
        //we only update the node which has the same ID as the one we just created, but, to be completely sure that 
        //nothing else gets changed, we add a requirement to have the same siteid and webid
        oCmd.CommandText = @"UPDATE NavNodes SET Eid=1002 WHERE (Eid=" + oTempNode.Id.ToString() + 
             @") AND (SiteId='" + oSite.ID.ToString("D") + "') AND (WebId='" + oWeb.ID.ToString("D") + "')"; ;
        oConn.Open();
        oCmd.ExecuteNonQuery();
        //closing the connection
        oConn.Dispose();
    }
}
</code></pre>

<p>}    //the oSite object is disposed here
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://tips.naivist.net/2009/12/01/restoring-the-top-navigation-bar-of-a-sharepoint-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;_vti_bin&#8221; folder defined</title>
		<link>http://tips.naivist.net/2009/09/11/vtibin-folder-defined/</link>
		<comments>http://tips.naivist.net/2009/09/11/vtibin-folder-defined/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 11:34:28 +0000</pubDate>
		<dc:creator>Krišs Rauhvargers</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Tīmeklis]]></category>

		<guid isPermaLink="false">http://tips.naivist.net/?p=137</guid>
		<description><![CDATA[Ever wondered why SharePoint &#8220;lists web service&#8221; (i.e., lists.asmx) lives in an interesting address of http://mossserver/sites/somesite/&#95;vti&#95;bin/lists.asmx ?

This is actually not the only place where you can see the magic &#95;vti&#95;something. I remember myself deleting such directories from &#8220;wwwroot&#8221; quite often back in the days &#8220;everyone&#8221; used MS FrontPage. FrontPage used to create the folders &#8220;&#95;vti&#95;bin&#8221;, [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wondered why SharePoint &#8220;lists web service&#8221; (i.e., <em>lists.asmx</em>) lives in an interesting address of http://mossserver/sites/somesite/<strong>&#95;vti&#95;bin</strong>/lists.asmx ?</p>

<p>This is actually not the only place where you can see the magic &#95;vti&#95;<em>something</em>. I remember myself deleting such directories from &#8220;wwwroot&#8221; quite often back in the days &#8220;everyone&#8221; used MS FrontPage. FrontPage used to create the folders &#8220;&#95;vti&#95;bin&#8221;, &#8220;&#95;vti&#95;cnf&#8221; on your computer locally as you developed a website .. and also on the server, if you used &#8220;Frontpage Extensions&#8221; for publishing. The <em>&#95;bin</em> folder would normally contain executables required for FP server components (as far as I understand, something like <em>cgi&#95;bin</em>).</p>

<p>So, even though FP is <a href="http://office.microsoft.com/en-us/frontpage/HA101205221033.aspx">announced dead</a>, guys from the SharePoint team apparently like the idea of puting executables in the <em>&#95;vti&#95;bin</em> folder which was used by FrontPage Extensions. </p>

<p>Anyway, the question is, what does the acronym &#8220;VTI&#8221; mean. Apparently, Microsoft did not develop MS FrontPage from scratch, they <a href="http://www.seoconsultants.com/frontpage/history/">acquired</a> &#8220;<strong>V</strong>ermeer <strong>T</strong>echnologies <strong>I</strong>nc&#8221;. Thus the name of &#8220;bin&#8221; folder in FrontPage. Thus the URL for <em>lists.asmx</em> in SharePoint. </p>
]]></content:encoded>
			<wfw:commentRss>http://tips.naivist.net/2009/09/11/vtibin-folder-defined/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shooting yourself in the foot</title>
		<link>http://tips.naivist.net/2008/10/08/shooting-yourself-in-the-foot/</link>
		<comments>http://tips.naivist.net/2008/10/08/shooting-yourself-in-the-foot/#comments</comments>
		<pubDate>Wed, 08 Oct 2008 18:26:07 +0000</pubDate>
		<dc:creator>Krišs Rauhvargers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tips.naivist.net/?p=133</guid>
		<description><![CDATA[Ideja no &#8220;labās prakses&#8221; prezentācijas


C: You shoot yourself in the foot
PHP: You shoot yourself in the foot with a gun made from pieces taken from 300 other guns
Ruby on Rails: You want to shoot yourself in the foot, but the convention is to shoot yourself in the head


(pievienošu no sevis)


SharePoint: You want to shoot yourself [...]]]></description>
			<content:encoded><![CDATA[<p>Ideja no <a href="http://laurat.blogs.com/talks/best_practices.pdf">&#8220;labās prakses&#8221; prezentācijas</a></p>

<ul>
<li>C: You shoot yourself in the foot</li>
<li>PHP: You shoot yourself in the foot with a gun made from pieces taken from 300 other guns</li>
<li>Ruby on Rails: You want to shoot yourself in the foot, but the convention is to shoot yourself in the head</li>
</ul>

<p>(pievienošu no sevis)</p>

<ul>
<li>SharePoint: You want to shoot yourself in the foot, but first you have to &#8220;IISRESET /noforce&#8221;</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tips.naivist.net/2008/10/08/shooting-yourself-in-the-foot/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MOSS &amp; custom master pages</title>
		<link>http://tips.naivist.net/2008/08/05/moss-custom-master/</link>
		<comments>http://tips.naivist.net/2008/08/05/moss-custom-master/#comments</comments>
		<pubDate>Tue, 05 Aug 2008 07:19:22 +0000</pubDate>
		<dc:creator>Krišs Rauhvargers</dc:creator>
				<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://tips.naivist.net/?p=128</guid>
		<description><![CDATA[I just found an interesting &#8220;feature&#8221; in MOSS publishing infrastructure. We&#8217;re designing a custom master page for our MOSS portal solution. If I recall correctly, we started with Heather Solomon&#8217;s minimal master page, but I&#8217;m not really sure.

We swiped out all of the built-in styles and layouts to achieve maximum flexibility and stylability of MOSS [...]]]></description>
			<content:encoded><![CDATA[<p>I just found an interesting &#8220;feature&#8221; in MOSS publishing infrastructure. We&#8217;re designing a custom master page for our MOSS portal solution. If I recall correctly, we started with Heather Solomon&#8217;s <em><a href="http://www.heathersolomon.com/blog/archive/2007/01/26/6153.aspx">minimal</a></em> master page, but I&#8217;m not really sure.</p>

<p>We swiped out all of the built-in styles and layouts to achieve maximum flexibility and stylability of MOSS infrastructure. I believe this is the best choice when you have to adapt your portal to custom tailored design layout.</p>

<p>Well, the result was, the portal worked fine with our master page, BUT the content query web part failed. It failed every time we enabled the RSS feed feature. Instead of seeing the actual content, it showed only an error message (in Latvian, since we&#8217;re using the latvian language pack) &#8220;Šo Web daļu nevar parādīt. Lai novērstu problēmu, atveriet šo Web lapu ar Windows SharePoint Services saderīgā HTML redaktorā, piemēram, Microsoft Office SharePoint Designer. Ja problēma netiek novērsta, sazinieties ar Web servera administratoru.&#8221;</p>

<p>No traces could be found in the ULS log nor in the event log of the server. After setting the diagnostic logging of all categories to <em>verbose</em>, finally an exception was written to the logfile:</p>

<pre><code> Error while executing web part: System.Xml.Xsl.XslTransformException: An error occurred during a
 call to extension function 'RegisterFeedUrl'. See InnerException for a complete description of the error. ---&gt; 
 System.Web.HttpException: The control collection cannot be modified during DataBind, 
 Init, Load, PreRender or Unload phases.     at System.Web.UI.ControlCollection.Add(Control 
 child)     at Microsoft.SharePoint.Publishing.WebControls.WebPartRuntime.RegisterFeedUrl(String url, String type)    
 --- End of inner exception stack trace ---     at ....
</code></pre>

<p>When looking at the RegisterFeedUrl in .Net Reflector, we found out that the code actually accesses the <em>Header</em> property of the <em>Page</em> object that is being rendered and adds HtmlLink control to the collection. It gave us a hint that probably there is something wrong with the <em>page</em> and <em>header</em> objects. And &#8211; yes, we had left out the <code>runat="server"</code> part of the HTML and HEAD tags.  So, this is the absolute minimum you must have:</p>

<pre><code>&lt;HTML runat="server"&gt;
    &lt;HEAD runat="server"&gt;
....
</code></pre>

<p>.. and, of course, the name space references and other stuff you usually put in the HTML element tag.</p>
]]></content:encoded>
			<wfw:commentRss>http://tips.naivist.net/2008/08/05/moss-custom-master/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Closed or open?</title>
		<link>http://tips.naivist.net/2008/06/08/closed-or-open/</link>
		<comments>http://tips.naivist.net/2008/06/08/closed-or-open/#comments</comments>
		<pubDate>Sun, 08 Jun 2008 16:10:36 +0000</pubDate>
		<dc:creator>Krišs Rauhvargers</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://tips.naivist.net/?p=127</guid>
		<description><![CDATA[No šiem abiem vismaz man mazliet skaidrāks kļuva, ko viņi saprot ar &#8220;open world approach&#8221;. Un, ka man to vajag.
http://www.cs.man.ac.uk/~drummond/presentations/OWA.pdf
http://www.betaversion.org/~stefano/linotype/news/91/
]]></description>
			<content:encoded><![CDATA[<p>No šiem abiem vismaz man mazliet skaidrāks kļuva, ko <em>viņi</em> saprot ar &#8220;open world approach&#8221;. Un, ka man to vajag.<br />
<a href="http://www.cs.man.ac.uk/~drummond/presentations/OWA.pdf">http://www.cs.man.ac.uk/~drummond/presentations/OWA.pdf</a><br />
<a href="http://www.betaversion.org/~stefano/linotype/news/91/">http://www.betaversion.org/~stefano/linotype/news/91/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tips.naivist.net/2008/06/08/closed-or-open/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>&#8220;Uz dullo&#8221;</title>
		<link>http://tips.naivist.net/2008/04/02/uz-dullo/</link>
		<comments>http://tips.naivist.net/2008/04/02/uz-dullo/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 06:40:07 +0000</pubDate>
		<dc:creator>Krišs Rauhvargers</dc:creator>
				<category><![CDATA[matemātika]]></category>

		<guid isPermaLink="false">http://tips.naivist.net/2008/04/02/uz-dullo/</guid>
		<description><![CDATA[Nesen gadījās izmantot dr.Viļņa Detlova lietoto izlozes metodi un te ir tās īss apraksts.

Dots 


n elementu saraksts, no kura uz labu laimi jāizlozē viens ieraksts (piemēram, 25 cilvēku vārdi)
viens vai vairāki subjektīvi gadījuma skaitļu ģeneratori (piemēram, 2 cilvēki)
kalkulators (vēlami)


Izloze


sanumurē apskatāmā saraksta rindiņas sākot ar 0 un beidzot ar n-1
katrs skaitļu ģenerators iedomājas un paziņo citiem [...]]]></description>
			<content:encoded><![CDATA[<p>Nesen gadījās izmantot <a href="http://lv.wikipedia.org/wiki/Vilnis_Detlovs">dr.Viļņa Detlova</a> lietoto izlozes metodi un te ir tās īss apraksts.</p>

<p>Dots </p>

<ul>
<li><em>n</em> elementu saraksts, no kura uz labu laimi jāizlozē viens ieraksts (piemēram, 25 cilvēku vārdi)</li>
<li>viens vai vairāki subjektīvi gadījuma skaitļu ģeneratori (piemēram, 2 cilvēki)</li>
<li>kalkulators (vēlami)</li>
</ul>

<p>Izloze</p>

<ul>
<li>sanumurē apskatāmā saraksta rindiņas sākot ar 0 un beidzot ar <em>n-1</em></li>
<li>katrs skaitļu ģenerators iedomājas un paziņo citiem skaitli, kas par pārsniedz <em>n</em> (piemēram, viens dalībnieks paziņo skaitli 4842, otrs &#8211; 9222) </li>
<li>sasummē iegūto skaitļu kvadrātus, iegūstot kopīgu gadījuma lielumu K (K=48421^2+922103^2= 23444964+85045284= 108490248)

<ul>
<li>aprēķina (<em>K mod n</em>) un iegūst uzvarētāja kārtas numuru (108490248 mod 25 == 23, tātad uzvar priekšpēdējais dalībnieks)</li>
</ul></li>
</ul>

<p>Risinājuma pamatojums</p>

<ul>
<li>Visiem saraksta elementiem ir līdzīga laba varbūtība kļūt par uzvarētājiem (neesmu mēģinājis pierādīt, bet šķiet labāka nekā ja mēģinātu izvēlēties skaitli no 0 līdz <em>n-1</em>)</li>
<li>Rezultāta izvēlē var iesaistīties pēc patikas daudz dalībnieku</li>
<li>Tā kā sākotnēji katrs dalībnieks nezina citu izvēlētos skaitļus, tas nevar iespaidot rezultātu ar subjektīvi izvēlētu gadījuma vērtību</li>
<li>Pat ja pēdējais dalībnieks redz iepriekšējo izvēlētos skaitļus, subjektīvi izvēlēta gadījuma skaitļa aprēķināšana ir apgrūtināta, jo skaitļi tiek kāpināti kvadrātā, tādēļ &#8220;prātā&#8221; jādarbojas ar nepatīkami lieliem skaitļiem.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tips.naivist.net/2008/04/02/uz-dullo/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ko pasaule zina par Storm Worm?</title>
		<link>http://tips.naivist.net/2008/02/28/ko-pasaule-zina-par-storm-worm/</link>
		<comments>http://tips.naivist.net/2008/02/28/ko-pasaule-zina-par-storm-worm/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 09:39:03 +0000</pubDate>
		<dc:creator>Krišs Rauhvargers</dc:creator>
				<category><![CDATA[Tīmeklis]]></category>

		<guid isPermaLink="false">http://tips.naivist.net/2008/02/28/ko-pasaule-zina-par-storm-worm/</guid>
		<description><![CDATA[Ievadam &#8211; apnika lasīt par jauniem gadždetiem. Jāuzlabo LV blogu kultūra reportējot arī par citiem jaunumiem.

IEEE izdotā žurnāla &#8220;Computer&#8221; februāra numurā ir ļoti interesants raksts par Storm Worm. IEEE bibliotēkas lasītājiem šis raksts ir pieejams arī tiešsaistē: &#8220;A Storm (Worm) Is Brewing&#8221;.

Īsumā &#8211; kopš 2006. gada rudens IT drošības pasaule ir iepazinusi jaunu ienaidnieku, kurš [...]]]></description>
			<content:encoded><![CDATA[<p><em>Ievadam &#8211; apnika lasīt par jauniem gadždetiem. Jāuzlabo LV blogu kultūra reportējot arī par citiem jaunumiem.</em></p>

<p>IEEE izdotā žurnāla &#8220;<a href="http://www.computer.org">Computer</a>&#8221; <a href="http://csdl2.computer.org/persagen/DLAbsToc.jsp?resourcePath=/dl/mags/co/&amp;toc=comp/mags/co/2008/02/mco02toc.xml">februāra numurā</a> ir ļoti interesants raksts par <a href="http://en.wikipedia.org/wiki/Storm_botnet">Storm Worm</a>. IEEE bibliotēkas lasītājiem šis raksts ir pieejams arī tiešsaistē: <a href="http://csdl2.computer.org/dl/mags/co/2008/02/mco2008020020.htm">&#8220;A Storm (Worm) Is Brewing&#8221;</a>.</p>

<p>Īsumā &#8211; kopš 2006. gada rudens IT drošības pasaule ir iepazinusi jaunu ienaidnieku, kurš ticis pie vārda <em>Storm</em>, pirmo reizi īsti par sevi liekot manīt 2007. gada 19. janvārī, kad dienas laikā tika izsūtīts apmēram 20 reižu lielāks surogātpasta daudzums nekā citās dienās. Citi šī ienaidnieka nosaukumi ir Nuwar, Peacomm, Zhelatin. Pēdējais nosaukums vislabāk parāda šī kiber-ienaidnieka dabu, jo tieši mainīguma dēļ IT drošības kompānijām ir tik grūti izstrādāt pretlīdzekļus <em>Storm</em>-am.</p>

<p><em>Storm</em> ir milzīgs attālināti kontrolējamu (&#8220;<a href="http://en.wikipedia.org/wiki/Zombie_computer">zombiju</a>&#8220;) datoru tīkls, ar kura palīdzību tiek veikti kibernoziegumi, vienlaicīgi arī inficējot jaunus datorus un tos piesaistot <em>storm</em> tīklam. Drošības ekspertiem ir izdevies noteikt, ka tīkla darbības kontrolei tiek izmantoti austrumeiropā (tātad &#8211; arī Latvijā?) un Krievijā esošas IP adreses. Krievijas valdība <a href="http://www.strategypage.com/htmw/htiw/articles/20080204.aspx">atsakās sadarboties</a> ar ASV spēkiem, lai likvidētu <em>Storm</em> tīklu. </p>

<p>Ir izteikti minējumi, ka 2007. gada pavasara DDoS uzbrukumi Igaunijas serveriem tikuši veikti no <em>Storm</em> tīkla. Tāpat <em>Storm</em> tiek pielietots naudas pelnīšanai, izsūtot surogātpastu, kas reklamē organizācijas, kuru akcijas pieder <em>Storm</em> īpašniekiem. Joe Stewart, SecureWorks pētnieks norāda, ka pastāv aizdomas, ka kāda Kanādas kompānija savulaik izīrējusi daļu tīkla resursu, lai izsūtītu surogātpastu.</p>

<p>Daži fakti par <em>Storm</em>:</p>

<ul>
<li>Izplatās, izmantojot sociālās inženierijas ceļus. Izsūta e-pasta vēstules, ar tēmām &#8220;Milzīga vētra Eiropā&#8221;, &#8220;Nogalinājis 11 gados, 21 gada vecumā atkal brīvs un dodas nogalināt&#8221;, &#8220;Britu genocīds pret musulmaņiem&#8221;, &#8220;Krievu raķete notriekusi ASV satelītu&#8221;. Tāpat tiek izsūtītas e-pasta vēstules, kas satur saiti uz <em>it kā</em> <a href="http://www.youtube.com&quot;">Youtube</a> esošām filmām. Vēl vienu klikšķi tālāk lietotāja neprasmīgi aizsargātais dators tiek inficēts ar <a href="http://en.wikipedia.org/wiki/Trojan_horse">Trojas zirgu</a>. </li>
<li>Pēc datora inficēšanas sistēma var uzstādīt klaviatūras signālu pārķeršanas draiverus un šo informāciju pārsūtīt tīkla īpašniekiem. Protams, tiek izveidota <a href="http://en.wikipedia.org/wiki/Backdoor">&#8220;lūka&#8221;</a>, caur kuru <em>Storm</em> īpašnieki var nodot komandas datoram</li>
<li>Programmatūra slēpjas. Tā instalē <a href="http://en.wikipedia.org/wiki/Rootkit">rootkit-us</a>, lai izpildāmie faili nebūtu redzami datora lietotājam, tā modificē API, kas parāda aktīvos procesus, tā dzēš rīkus, kas ļautu identificēt <em>Storm</em> klātesamību. </li>
<li>Inficētie datori uzvedas gluži normāli un ir lietojami ikdienas darbam.</li>
<li>Decentralizēts &#8211; savstarpējai saziņai un izplatīšanai izmanto <a href="http://en.wikipedia.org/wiki/Peer-to-peer">P2P</a> tīklus, izmantojot savus protokolus un arī standarta rīkus kā ICQ un IRC</li>
<li>Izmanto t.s. <a href="http://en.wikipedia.org/wiki/Fast_flux">fast flux</a> principu, lai paslēptu web vietnes, kas satur inficējošo kodu. DNS ieraksti tiek mainīti ik pa dažām minūtēm, kas sevišķi apgrūtina izsekošanu.</li>
<li>Izplatīšanai vienlaicīgi izmanto tikai nelielu daļu no tīklā esošajiem datoriem, bet šī daļa regulāri mainās</li>
<li>Šifrē visu saziņu starp tīklā esošajiem datoriem, izmantojot vismaz 40 bitu atslēgas (<a href="http://en.wikipedia.org/wiki/Symmetric-key_algorithm">simetriskās kriptosistēmās</a> tas ir pietiekami daudz)</li>
<li>Izplatīšanās mehānisms tiek regulāri mainīts, tai skaitā mainot arī modificējot izpildāmo kodu līdz pat 10 reizēm stundā</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tips.naivist.net/2008/02/28/ko-pasaule-zina-par-storm-worm/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>UTF8 adreses</title>
		<link>http://tips.naivist.net/2008/01/06/utf8-adreses/</link>
		<comments>http://tips.naivist.net/2008/01/06/utf8-adreses/#comments</comments>
		<pubDate>Sun, 06 Jan 2008 11:49:07 +0000</pubDate>
		<dc:creator>Krišs Rauhvargers</dc:creator>
				<category><![CDATA[Tīmeklis]]></category>

		<guid isPermaLink="false">http://tips.naivist.net/2008/01/06/utf8-adreses/</guid>
		<description><![CDATA[Lietojot wikipediju, vienmēr meklēto vārdu rakstu uzreiz adresē (http://en.wikipedia.org/wiki/&#60;vajadzīgais vārds>). 

Līdzīgu pieeju mēģināju lietot arī latviešu wikipēdijā, bet secināju, ka vārdos ar latviešu diakritiskajiem simboliem tas nedarbojas. Piemēram, mēģinot atrast skaidrojumu vārdam &#8220;Māra&#8221;, atveras lapa &#8220;Mâra&#8221; (kur, protams, nekāda satura nav).

Kā noskaidroju, Firefox lietotāji to var labot ar slēdža Network.standard-url.encode-utf8 palīdzību. Uzstādot šo slēdzi uz [...]]]></description>
			<content:encoded><![CDATA[<p>Lietojot wikipediju, vienmēr meklēto vārdu rakstu uzreiz adresē (http://en.wikipedia.org/wiki/&lt;<em>vajadzīgais vārds</em>>). </p>

<p>Līdzīgu pieeju mēģināju lietot arī <a href="http://lv.wikipedia.org">latviešu wikipēdijā</a>, bet secināju, ka vārdos ar latviešu diakritiskajiem simboliem tas nedarbojas. Piemēram, mēģinot atrast skaidrojumu vārdam &#8220;Māra&#8221;, atveras lapa &#8220;<a href="http://lv.wikipedia.org/wiki/M%C3%A2ra">Mâra</a>&#8221; (kur, protams, nekāda satura nav).</p>

<p>Kā noskaidroju, Firefox lietotāji to var labot ar slēdža <a href="http://kb.mozillazine.org/Network.standard-url.encode-utf8">Network.standard-url.encode-utf8</a> palīdzību. Uzstādot šo slēdzi uz &#8220;true&#8221;, Firefox sāk darboties atbilstoši <a href="http://www.ietf.org/rfc/rfc3987.txt">RFC 3987</a> un visi nestandarta burti tiek kodēti ar URLencode. </p>

<p>Tas gan man nedarīja saprotamu, kāpēc pirmajā gadījumā teksts nokodējās uz<br />
http://lv.wikipedia.org/wiki/M%C3%A2ra (Mâra)<br />
bet otrajā uz<br />
http://lv.wikipedia.org/wiki/M%C4%81ra (Māra)</p>

<p><strong>Upd: Izskatās, ka šeit aprakstītā problēma nepastāv citos datoros kā tikai man mājās pieejamajos.</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://tips.naivist.net/2008/01/06/utf8-adreses/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Tulkošanas makrosi</title>
		<link>http://tips.naivist.net/2008/01/02/tulkosanas_makrosi/</link>
		<comments>http://tips.naivist.net/2008/01/02/tulkosanas_makrosi/#comments</comments>
		<pubDate>Wed, 02 Jan 2008 21:11:46 +0000</pubDate>
		<dc:creator>Krišs Rauhvargers</dc:creator>
				<category><![CDATA[Datorlietas]]></category>

		<guid isPermaLink="false">http://tips.naivist.net/2007/12/31/tulkosanas_makrosi/</guid>
		<description><![CDATA[Divi Word makrosi, kas varētu noderēt tiem, kam nav instalēta Tildes vārdnīca, bet ir pieejams internets.

Lai lietotu, makrosu projektiem referencēs jāpieliek Microsoft XML (es liku V 6.0, bet derēs jebkurš). Pēc tam atliek uzbindēt klaviatūras saīsni. Piemēram, es ieliku Shift+Ctrl+Alt+E tulkojumam uz angļu valodu un Shift+Ctrl+Alt+L tulkojumam uz latviešu valodu.
Pēc tam, kad vajag tulkojumu, iezīmējam [...]]]></description>
			<content:encoded><![CDATA[<p>Divi Word makrosi, kas varētu noderēt tiem, kam nav instalēta Tildes vārdnīca, bet ir pieejams internets.</p>

<p>Lai lietotu, makrosu projektiem referencēs jāpieliek Microsoft XML (es liku V 6.0, bet derēs jebkurš). Pēc tam atliek uzbindēt <a href="http://www.timeatlas.com/mos/5_Minute_Tips/General/Assigning_Word_Commands_to_Keyboard_Shortcuts/">klaviatūras saīsni</a>. Piemēram, es ieliku Shift+Ctrl+Alt+E tulkojumam uz angļu valodu un Shift+Ctrl+Alt+L tulkojumam uz latviešu valodu.
Pēc tam, kad vajag tulkojumu, iezīmējam tulkojamo  vārdu un izpildām klaviatūras maģiju.</p>

<p>Uzskatu, ka SIA &#8220;Tilde&#8221; tiesības ar šo neesmu pārkāpis, jo esmu tikai vienkāršojis piekļuvi datiem, kas ir publiski pieejami.</p>

<p>Rezultāts izskatās šādi: </p>

<p><img src='http://tips.naivist.net/wp-content/translator.png' alt='translator.png'  border='1' /></p>

<p><span id="more-121"></span></p>

<pre><code>'tulko iezīmēto tekstu uz angļu valodu
Sub TranslateToEn()
    Dim sRes As String
    sRes = Translate("L", GetSelection())
    If TrimEnd(sRes) &lt;&gt; "" Then MsgBox sRes
End Sub

'tulko iezīmēto tekstu uz angļu valodu
Sub TranslateToLV()
    Dim sRes As String
    sRes = Translate("E", GetSelection())
    If TrimEnd(sRes) &lt;&gt; "" Then MsgBox sRes
End Sub
'ielasa iezīmēto vārdu vai vārdu pirms kursora
Public Function GetSelection() As String
        Dim sTran As String
    If TrimEnd(Selection.Text) &lt;&gt; "" Then
        sTran = Trim(Selection.Text)
    Else
        Selection.MoveLeft Unit:=wdWord, Count:=1, Extend:=wdExtend
        sTran = Trim(Selection.Text)
        Selection.MoveRight Unit:=wdCharacter, Count:=1
    End If
    GetSelection = sTran
End Function

'izpilda tulkošanas darbu
Function Translate(ByVal spDirection As String, ByVal spText As String) As String
  Dim oXML As New XMLHTTP
  Dim sPost As String
  Dim sResponse As String

  If TrimEnd(spText) = "" Then Exit Function

  sPost = "MfcISAPICommand=Translate" &amp; spDirection &amp; _
         "&amp;ApostrofeMode=0&amp;DictionaryView=1&amp;WholeWordsCheckBox=1&amp;EditLine=" &amp; _
         URLEncode(spText)

  'nolasa rezultātus no servera
  Call oXML.Open("POST", "http://dictionary.tilde.lv/idiction.dll?", False)
  Call oXML.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
  Call oXML.setRequestHeader("Encoding", "Windows-1257")
  oXML.send (sPost)

  sResponse = ToChars(oXML.responseBody)

  'vairāk nevajadzēs
  Set oXML = Nothing

  'iespējams, vārds nebūs vispār atrasts
  If InStr(1, sResponse, "images/not_found_text.gif") Then
    sResponse = spText &amp; ": " &amp; vbCrLf &amp; "Vārds nav atrasts"
  End If


  Dim iNum As Integer
  iNum = InStr(1, sResponse, "&lt;B&gt;")
  If Not iNum &gt; 0 Then
   iNum = 1
  End If
  sResponse = Mid(sResponse, iNum)
  Dim sRemoves() As String
  Dim i As Integer
  sRemoves = Split("&lt;b&gt;,&lt;/b&gt;,&lt;i&gt;,&lt;/i&gt;,&lt;strong&gt;,&lt;/strong&gt;," &amp; _
                   "&lt;u&gt;,&lt;/u&gt;,&lt;script&gt;,&lt;/script&gt;,&lt;p&gt;,&lt;/p&gt;,&lt;i&gt;," &amp; _
                   "&lt;/i&gt;,&lt;big&gt;,&lt;/big&gt;,&lt;small&gt;,&lt;/small&gt;,&lt;/body&gt;,&lt;/html&gt;", _
                   ",", , vbTextCompare)

  sResponse = Replace(sResponse, spText &amp; "&lt;/B&gt;&lt;SMALL&gt;&lt;P&gt;", _
                      spText &amp; vbCrLf, , , vbTextCompare)
  'izvācam visādus tagus
  For i = 0 To UBound(sRemoves, 1)
      sResponse = Replace(sResponse, sRemoves(i), "", , , vbTextCompare)
  Next i

  'atstarpes vajag
  sResponse = Replace(sResponse, "&amp;nbsp;", " ")
  sResponse = Replace(sResponse, "&lt;br&gt;", vbCrLf)

  'atgriežamajai vērtībai novāc beigās enterus
  Translate = TrimEnd(sResponse)
End Function


Function URLEncode(EncodeStr As String) As String
    Dim i As Integer
    Dim erg As String

    erg = EncodeStr

    ' *** First replace '%' chr
    erg = Replace(erg, "%", Chr(1))

    ' *** then '+' chr
    erg = Replace(erg, "+", Chr(2))

    For i = 0 To 255
        Select Case i
            ' *** Allowed 'regular' characters
            Case 37, 43, 48 To 57, 65 To 90, 97 To 122

            Case 1  ' *** Replace original %
                erg = Replace(erg, Chr(i), "%25")

            Case 2  ' *** Replace original +
                erg = Replace(erg, Chr(i), "%2B")

            Case 32
                erg = Replace(erg, Chr(i), "+")

            Case 3 To 15
                erg = Replace(erg, Chr(i), "%0" &amp; Hex(i))

            Case Else
                erg = Replace(erg, Chr(i), "%" &amp; Hex(i))

        End Select
    Next

    URLEncode = erg

End Function

'no ResponseBody izveido normālu stringu
Function ToChars(ByVal opBody) As String
    Dim i As Integer
    Dim sChar As String
    Dim sReturn As String
    For i = 0 To Len(opBody) * 2 - 1
      sChar = (Chr(opBody(i)))
      sReturn = sReturn &amp; sChar
    Next i
    ToChars = sReturn
End Function

'novāc lieko beigās - tabus, enterus
Function TrimEnd(ByVal spText As String) As String
  Dim i As Integer
  Dim sChar As String

  For i = Len(spText) To 1 Step -1
     sChar = Mid(spText, 1, 1)
      If sChar &lt;&gt; vbCr And sChar &lt;&gt; vbLf And _
         sChar &lt;&gt; " " And sChar &lt;&gt; vbTab Then
        TrimEnd = Left(spText, i)
        Exit Function
      End If
  Next i
End Function
</code></pre>

<p>Instrukcija tiem, kam šīs lietas nav diez ko pazīstamas:</p>

<ul>
<li>Iekopējam visu šeit redzamo kodu (to, kam kreisajā malā oranža svītra)</li>
<li>Dodamies uz Wordu</li>
<li>Spiežam uz klaviatūras Alt+F11</li>
<li>Atrodam brīvu vietiņu, spiežam &#8220;Paste&#8221; </li>
<li>Ejam uz menu: tools->references. Ieliekam ķeksīti pie &#8220;Microsoft XML, v. 6.0&#8243; </li>
<li>Veram ciet šo papildus logu</li>
<li>Izveicam augstāk minēto <a href="http://www.timeatlas.com/mos/5_Minute_Tips/General/Assigning_Word_Commands_to_Keyboard_Shortcuts/">klaviatūras saīsnes veidošanu</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://tips.naivist.net/2008/01/02/tulkosanas_makrosi/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
