Monday, August 15, 2016

C# .Net Utility in WPF

I very recently had the opportunity to develop a simple tool in wpf and C# .Net to execute some procedural actions necessary to quickly make copies of our application. Surely there is an "easier" way to do this with windows system scripting, but for the sake of education and usability (we don't want our clients running windows scripts) we chose to write an executable. 

Several things surprised me during the development. First, wpf has become much easier. The most useful resource I found was WPF MVVM In Depth by Brian Noyes. In his tutorial he builds WPF up from code-behinds and simple applications that take inputs and generate outputs. The most essential parts for me were the building blocks of implementing INotifyPropertyChanged and ICommand. This was good enough for my current application, but more complex applications meant to display and manipulate data will probably go into using ObservableCollections and defining sql server data sources. 

This project, along with other personal things kept me very busy the last few weeks, though I hope to return to posting more frequently. I've now changed the blog name from "Daily Blog" to simply "Blog".

Thursday, July 7, 2016

C# .NET and WPF

I recently had a terribly boring project in which I had to go through 27 pdf documents and compare copies word for word. That means reading a total of 54 documents and comparing for exact word for word copies. And no, they could not be done with pdf comparison tools, it was required that human eyes search through each document at some point.

In order not to burn out, I started a project in C#.NET and WPF on the side. What I found was that C# is one of the easiest languages there is. I was able to create classes and structures using the .NET toolset to model my data in about two hours. Then I tried to connect it to a WPF interface.

WPF is ridiculously difficult to "jump into". I found it really hard to get resources online, then half the resources said you need to use the prism library to do WPF correctly and encountered similar difficulty in finding prism examples. All the examples I found used code-behinds to bind data, which, from the Microsoft examples, are an antipattern. I really felt like there were more contradictory and dated examples of WPF and C#.NET code than there are of javascript (though I'm sure that isn't true).

Sunday, May 15, 2016

Python SimpleHTTPServer

I went and wrote the python simplehttpserver myself, just for kicks...

edit: here's the github

Friday, May 13, 2016

Simple Python Server

This is how you make a simple python server. It'll server index.html if you request the root, or whatever html file you request.

Wednesday, May 11, 2016

Node JS Static Server

I was interested to see how hard it was to write a static file server in pure node js, meaning without express.js. Turns out it's quite easy, but the real point of this was to familiarize myself further with using node and reading the node documentation.

Monday, April 18, 2016

Apply XSLT to XML in Visual Studio

With the XSLT file open, right click anywhere and go to file properties. Set the input to the file you'd like to apply your xslt to, and output to the file you'd like it to output to.

Simple as that, I just always forget the input option is in the right click > properties menu.

Wednesday, March 23, 2016

Sample Configuration File

Bittorrent sync is awesome. End of story. 

I am syncing different directories between my work computer, home computer, raspberry pi, and cell phone. Mostly the pi is the "source" of my files, and external backup in case one of my drives dies. 

One problem I ran into was that for some reason, if I ran btsync at startup of the pi it would "forget" all the directories I had shared. I don't know why. I decided instead to run with a config file containing all the directories I was syncing since that wouldn't change from shutdown to startup and such. However, I couldn't find any good examples online! So once I got mine working I posted it to my github.

I left the fields secret and dir, under shared folders blank. To generate a read-write secret, run ./btsync --generate-secret within the folder that the btsync executable is in. In the dir field, enter the directory you'd like to sync. Keep in mind that btsync cannot merge non-empty directories.

Go check it out for a decent example or starting point to bittorrent sync config files.