Categoria: Programmazione

  • Linq insight vs Linqpad

    Nessun confronto, Linq insight funziona male o non funziona, Linqpad fa quello che dice!

  • River crossing problem

    In the book From Bacteria to Bach and Back by Daniel Dennet there is this note: Four people come to a river in the night. There is a narrow bridge, and it can only hold two people at a time. They have one torch and, because it’s night, the torch has to be used when […]

  • XSD desigener error Visual Studio 2017

    Change targhet framework from Right Click the ProjectName/Property Pages/Build/Target Framework, to something different, example from 4.5 to 4.6 o 4.7.

  • Deep learning

    Keras è una libreria per il deep learning che può utilizzare TensorFlow, CNTK o Theano come motore di calcolo. CNTK è la libreria Cognitive Toolkit di Microsoft. Tutti i framework citati lavorano nativamente con Phyton.

  • Connection Pooling and the “Timeout expired” exception

    Consider this pseudocode: /* TData tabele of data to elaborate */ ConcurrentQueue<Exception> exceptions = new ConcurrentQueue<Exception>(); Parallel.ForEach(TData.AsEnumerable (),row => { try { using (WorItem p = new WorkItem(row,connectionstring)) { p.DoWork(); } } catch (Exception ex) { exceptions.Enqueue(ex); } }); Inside class WorkItem.DoWork, there are some database read with custom tableadapter and one finally write of […]

  • Scriver numeri in lettere ROMANE in C#

    Dop il ICustomFromatter per scrivere numeri in lettere, ecco un’altro FormatProvider per scrivere un numero intero da cifre arabe in cifre romane: public class RomanFormatProvider : IFormatProvider, ICustomFormatter { IFormatProvider _parent; public RomanFormatProvider() : this(CultureInfo.CurrentCulture) { } public RomanFormatProvider(IFormatProvider parent) { _parent = parent; } public object GetFormat(Type formatType) { if (formatType == typeof(ICustomFormatter)) return this; […]

  • Scrivere numeri in lettere in C#

    Il framework .Net offre diversi strumenti per scrivere o leggere in vari tipi dati da/verso stringhe. Una conversione molto particolare è quella di scrivere un numero invece che in cifre a parole, ad esempio 1234 in milleduecentotrentaquattro. Un modo per eseguire questa conversione in maniera integrata con il resto del framework è quella di implementare le […]

  • IIS 8 e Errore HTTP 404.17 – Not Found

    Tentando di installare un sito su IIS 8 su una macchina Windows 10, ottenevo l’errore: Errore HTTP 404.17 – Not Found Il contenuto richiesto sembra essere uno script e non verrà fornito dal gestore di file statici. Il sito è realizzato con Asp.Net 3.5, per cui ha bisogno del filtro Asp.Net 2.0, che evidentemente non […]

  • WMI e .NET

    Nel caso si debba utilizzare oggetti WMI da C# o altri linguaggi .NET, può essere utile conoscere MgmtClassGen.exe. Questo tool permette di ottenere una classe tipizzata per interagire con gli oggetti WMI. Ad esempio con l’esecuzione: MgmtClassGen.exe Win32_Service /L CS /O some.namespace /N root\cimv2 /P ServiceProxy.cs si otterrà una semplice classe che permette di interagire con […]

  • Karpersky Rescue Disk

    Un ottimo tool per qualsiasi crash di sistema Windows è Karpersy Rescue Disk. Controllare i file, eventuali virus, c’è anche un editor del registro di sistema, che vi può salvare in casi estremi.