Amazon regala 24 Kindle alla 4 D della scuola Pezzani

Un approccio corretto alle nuove tecnologie può far nascere l'amore per lo studio e la lettura. Per questo motivo il preside Giovanni Tiberi, alla guida della scuola elementare Pezzani di Piacenza, ha accettato con entusiasmo la proposta di Amazon di regalare 24 Kindle ai piccoli alunni della classe quarta D. La multinazionale del commercio on line non è nuova a iniziative di questo tipo, infatti nei mesi scorsi sono stati regalati supporti digitali anche alle scuole di Sarmato alla media Calvino.

Microsoft name games continue as 'universal apps' become 'Windows apps'

Microsoft has again changed the lexicon it wants others to use to describe the apps that run on Windows.

In a presentation last week at WinHEC, Don Box, a Microsoft distinguished engineer, spelled out the new labels: "Windows apps" and "Windows desktop applications".

"In Windows 10, we have this notion of a universal app platform," Box said. "And the apps that target it are called 'Windows apps.' Sometimes we say 'universal apps,' but we call them 'Windows apps.'"

Windows apps are those, Box added, that run on any of the numerous device categories that Windows 10 will support, ranging from smartphones and tablets to personal computers, the Xbox video game consoles and specialized "Internet of Things" hardware.

Meanwhile, Windows desktop applications is the moniker Microsoft will use to describe traditional personal computer programs.

"On PCs, we still continue to support the two decades-plus worth of Windows desktop applications, for running them on PCs," Box said. "And so sometimes in a technical session we will talk about a 'Windows app' and a 'Windows desktop app.' 'Windows app' runs on all devices. 'Windows desktop app,' PC only."

Microsoft announces Windows 10 release set for this summer in 190 countries


Microsoft plans to release Windows 10 this summer in 190 countries and 111 languages, the company announced today, though a specific date was not named.

In a blog post on the Windows website, Terry Myerson, head of Microsoft's operating systems team, didn't elaborate on the release time frame beyond saying it was shared at the Windows Hardware Engineering Community event in Shenzhen, China, today. The time frame aligns with an earlier Neowin report that the company is planning to finish the operating system in June to ready it for consumer consumption.

While specific territories weren't provided, the announcement of 190 countries likely means all major consumer markets will see a roughly simultaneous release.

Windows 10 will be a free upgrade for consumer devices with Windows 7, Windows 8.1 or Windows Phone 8.1 in its first year, though businesses will have to pay for enterprise operating system upgrades. Computer users can currently test the preview version of the operating system, while a select number of Lumia smartphones can test its mobile version, with support for more phones coming soon.

PSC.Search: a new implementation of Levenshtein distance algorithm

This article describes a simple implementation of the string search. It can be used for approximate string matching (for more information, see

Other algorithms for approximate string searching exist (e.g., Soundex), but those aren't as easy to implement. The algorithm in this article is easy to implement, and can be used for tasks where approximate string searching is used in an easy way.

The algorithm used the Levenshtein-distance for determining how exact a string from a word list matches the word to be found. Information about the Levenshtein-distance can be found at

C# implementation

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PSC.Search.Demo
    class Program
        static void Main(string[] args)
            string word = "Pure Source Code";
            List<string> wordList = new List<string>
                "Code Project",
                "Pure SourceCOde",
                "Source Kode",
                "Kode Project",
                "Other Source"

            List<wordrank> foundWords = 
                           FuzzySearch.Search(word, wordList, 0.30);

            foundWords.ForEach(i => Console.WriteLine(i.Word + 
                                          " (" + i.Rank.ToString() + 



A basic approach is shown. Instead of the Levenshtein-distance, a more optimized algorithm could be used - but here, a quite simple implementation is given for clarity reasons.

public static int LevenshteinDistance(string src, string dest)
    int[,] d = new int[src.Length + 1, dest.Length + 1];
    int i, j, cost;
    char[] str1 = src.ToCharArray();
    char[] str2 = dest.ToCharArray();

    for (i = 0; i <= str1.Length; i++)
        d[i, 0] = i;

    for (j = 0; j <= str2.Length; j++)
        d[0, j] = j;

    for (i = 1; i <= str1.Length; i++)
        for (j = 1; j <= str2.Length; j++)
            if (str1[i - 1] == str2[j - 1])
                cost = 0;
                cost = 1;

            d[i, j] =
                    d[i - 1, j] + 1,                    // Deletion
                        d[i, j - 1] + 1,                // Insertion
                        d[i - 1, j - 1] + cost));       // Substitution

            if ((i > 1) && (j > 1) && 
                (str1[i - 1] == str2[j - 2]) && 
                (str1[i - 2] == str2[j - 1]))
                d[i, j] = Math.Min(d[i, j], d[i - 2, j - 2] + cost);

    return d[str1.Length, str2.Length];

In the search process, for each word in the wordlist, the Levenshtein-distance is computed, and with this distance, a score. This score represents how good the strings match. The input argument fuzzyness determines how much the strings can differ.

public static List<wordrank> Search(string word, List wordList, 
                                    double fuzzyness)
    List<wordrank> foundWords = new List<wordrank>();

    foreach (string s in wordList)
        // Calculate the Levenshtein-distance:
        int levenshteinDistance = LevenshteinDistance(word, s);

        // Length of the longer string:
        int length = Math.Max(word.Length, s.Length);

        // Calculate the score:
        double score = 1.0 - (double)levenshteinDistance / length;

        // Match?
        if (score > fuzzyness)
            foundWords.Add(new WordRank() { Rank = score, Word = s });

    return foundWords;

SQL implementation

Also I've implemented a version for SQL.

CREATE FUNCTION edit_distance(@s1 nvarchar(3999), @s2 nvarchar(3999))
 DECLARE @s1_len int, @s2_len int
 DECLARE @i int, @j int, @s1_char nchar, @c int, @c_temp int
 DECLARE @cv0 varbinary(8000), @cv1 varbinary(8000)

  @s1_len = LEN(@s1),
  @s2_len = LEN(@s2),
  @cv1 = 0x0000,
  @j = 1, @i = 1, @c = 0

 WHILE @j <= @s2_len
  SELECT @cv1 = @cv1 + CAST(@j AS binary(2)), @j = @j + 1

 WHILE @i <= @s1_len
   @s1_char = SUBSTRING(@s1, @i, 1),
   @c = @i,
   @cv0 = CAST(@i AS binary(2)),
   @j = 1

  WHILE @j <= @s2_len
   SET @c = @c + 1
   SET @c_temp = CAST(SUBSTRING(@cv1, @j+@j-1, 2) AS int) +
    CASE WHEN @s1_char = SUBSTRING(@s2, @j, 1) THEN 0 ELSE 1 END
   IF @c > @c_temp SET @c = @c_temp
   SET @c_temp = CAST(SUBSTRING(@cv1, @j+@j+1, 2) AS int)+1
   IF @c > @c_temp SET @c = @c_temp
   SELECT @cv0 = @cv0 + CAST(@c AS binary(2)), @j = @j + 1

 SELECT @cv1 = @cv0, @i = @i + 1



 dbo.edit_distance('Fuzzy String Match','fuzzy string match'),
 dbo.edit_distance('Fuzzy String Match','fuzy string match'),
 dbo.edit_distance('levenshtein distance sql','levenshtein sql server'),

Happy coding!



Planet Xamarin

Planet Xamarin


<<  July 2017  >>

View posts in large calendar

Month List