Tuesday, June 14, 2016

PowerShell: SecureString - Save password (encrypted) to file and read them back

Very useful script when you want to save passwords but not leaving them as plain text

Wednesday, August 27, 2014

Arduino: send command through C#

I recently started to get interested in Arduino.
Among the many projects that I made using the Starter kit, I have not found a good example on how to communicate with Arduino using C#. The Arduino program send on the LCD strings received through the serial port.
(See Project 11 of Project Book of starter kit for more info)

Arduino Sketch

C# code

Monday, April 21, 2014

GAC Paths

Starting with the .NET Framework 4 the paths of GAC are changed, here a brief summary.

.NET 2


.NET 4


Saturday, April 19, 2014

Sharepoint feature list instance

When you add more than one list to a feature we need to change the Type and the TemplateType from elements.xml files, otherwise the second list get the first template.

In this example I haved changed the default to 10001

and the other file


Wednesday, April 9, 2014

Linq to Sharepoint 2010 RunWithElevatedPrivileges don't work

Execution of Sharepoint Linq code with elevated privilege didn't work because Linq classes internally use the current context. I has written this simple method to override this behavior.

app.config for Office Addin

When you are developing a plugin office our settings should be saved in the app.config, but unfortunately this results in Excel.exe.config, Winword.exe.config, etc..

To solve this problem simply create a new .config file with the following name:

Visual Studio will create a new file called <pluginname>.dll.config and this is what our plugin will read, as evidenced by the following statement

Remember to set up file property to "Copy to output directory"

See MSDN page

Monday, June 17, 2013

ASP.NET send/read JSON array via HiddenField

To send a JSON array in a postback, via hidden field, you can write this simple function. On the postback event you can read your HiddenField like this: Remember to reference the System.Web.Extensions.dll.
GridResponse class is declared as same structure of the JSON: