Skip to main content

Install your SD card with NOOBS

First of all I use a 32 GB class 10 to be sure I have enough space and speed for all my tests. HOW TO INSTALL NOOBS ON AN SD CARD Once you’ve downloaded the NOOBS zip file, you’ll need to copy the contents to a formatted SD card on your computer. To set up […]

Singleton

Multi threaded Singleton: using System; public sealed class Singleton { private static volatile Singleton instance; private static object syncRoot = new Object(); private Singleton() {} public static Singleton Instance { get { if (instance == null) { lock (syncRoot) { if (instance == null) instance = new Singleton(); } } return instance; } } }

Export DOCX to PDF

This is a simple code to convert any Word document to a PDF using the Word interop. using Word = Microsoft.Office.Interop.Word; … public Word.Document wordDocument { get; set; } public void ConvertWord2PDF() { var appWord = new Word.Application(); wordDocument = appWord.Documents.Open(@”D:\Tests\test.docx”); wordDocument.ExportAsFixedFormat(@”D:\Tests\test.pdf”, Word.WdExportFormat.wdExportFormatPDF); }  

Use a Dictionary

Here is a simple example of how to use a Dictionary with a Key-Value. var dico = new Dictionary<int, string>(); dico.Add(1, “Steeve”); dico.Add(2, “Morgan”); var result = dico.FirstOrDefault(x => x.Key == 1); var temp = result.Value; //temp = “Steeve”  

Tools For Angular

Different useful tools to develop AngularJS apps. Notepad++ simply the best free open source text editor. Sublime Text 3 Chrome developer tool – out of the box (just right click then Inspect Element). AngularJS Batarang Chrome extension: useful to debug our application. JetBrains Webstorm IDE: according to me the best JavaScript editor.

AJAX

AJAX (Asynchronous Javascript And Xml) = a methodology employing DOM in combination with techniques for retrieving data without reloading a page. <!DOCTYPE html> <html> <body> <div id=”demo”><h2>Let AJAX change this text</h2></div> <button type=”button” onclick=”loadDoc()”>Change Content</button> <script> function loadDoc() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (xhttp.readyState == 4 && xhttp.status == […]

WPF – SaveFileDiaglog

Here is a simple example of how to use the native SaveFileDialog in WPF: var sfd = new SaveFileDialog { Filter = “PDF Documents|*.pdf”, DefaultExt = “.pdf”, FileName = “converted.pdf” }; // Show save file dialog box var result = sfd.ShowDialog(); // Get the location of the file if (result != true) return; var fileName […]

Consume XML From A WebService

I will present two ways of getting an XML from a WebService and then read it as object(s). The first one will use validation. To validate an XML we generally use a XSD. This XSD can be provided in the XML it self as a reference or not (like in this case). The XSD is really usefull […]