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.

Thursday, March 10, 2016

Linux Networking Commands

netstat - shows you the state of all active sockets
ping - sends packets to another ip address
ifconfig - shows your computers networking information
traceroute - displays the route that a packet takes
hostname - set or display the current host/domain name
nslookup - query name servers directly
netcat - set up a connection between two computers, almost looks like a messaging application.

Wednesday, March 9, 2016

Networking

Networking, like onions, comes in layers. Unlike onions, networks have about 5 layers

layer 1: Physical. The lowest layer, the physical connection. This could be something like wifi, ethernet, radio connection. Learn physics.

layer 2: Link. Next to lowest, this layer contains information about the physical layer, and allows you to send bytes over it.

layer 3: Network. This layer assigns addresses to different communicating things on the network. Most people are familiar with IPv4 and IPv6, but there are less popular alternatives.

layer 4: Transport. This is what the T in TCP stands for. TCP basically guarantees that all your bytes have been transferred, and that they look like a single stream.

layer 5: Application. This is a two byte internal identifier that your computer uses to know which application made which request. (PORT number).

Tuesday, February 23, 2016

Sayre's Law

Here's something I read about recently, seems to apply pretty universally. I love it when little bits of wisdom like this are declared "such and such's law", "xyz's paradigm", "joe's theory of blank". I don't know why I find it funny.

Wednesday, February 10, 2016

PNG's and DPI's

PNG's are a web image format, and as such try to be independent of the device dpi so you can set the resolution and image size in your css or let the browser handle it. However, we use pngs for some desktop applications. Because of inconsistent dpi settings on different pngs we had some weird behavior where wpf was blowing up our save icons, but not our open file icons. The result in wpf was to set the width, height, and stretch attributes to our image element manually, as well as the SnapsToPixels to true for antialiasing (though at that image size I couldn't see the difference).

To be sure the png's had different dpi's and that was the problem, I had to install gimp, open the png, look at the image properties and the resolution. It would have been nice if this was just in the details tab of the properties window of the image, but if I'm right that png's don't worry about dpi it would make sense that dpi is excluded there.

Friday, February 5, 2016

My Favorite Math Joke!

A farmer has 100 ft of fencing and wants to enclose as large an area as possible, so he does the obvious thing, and hires an engineer, a physicist, and a mathematician to consult him. The engineer quickly pens in a square with the 100 ft and says voila! The physicist, knowing he can optimize this, goes to the blackboard and finds that a circle would enclose a larger area. The mathematician, after much deep thought, pulls out two feet of fencing, wraps it around his waist, and yells "I declare myself to be on the outside"!