From f0f12d0fa0cf4f20596b4cdb9ffdaa8cf97f1551 Mon Sep 17 00:00:00 2001 From: smack0007 Date: Sun, 28 Apr 2024 18:38:54 +0000 Subject: [PATCH] Add 2024/start-syncthing-background-windows.md --- .../start-syncthing-background-windows.html | 7 + blog/page10.html | 9 +- blog/page11.html | 11 +- blog/page12.html | 7 +- blog/page13.html | 7 +- blog/page14.html | 5 +- blog/page15.html | 11 +- blog/page16.html | 8 +- blog/page17.html | 35 +--- blog/page18.html | 71 ++++--- blog/page19.html | 36 +++- blog/page2.html | 20 +- blog/page3.html | 9 +- blog/page4.html | 8 +- blog/page5.html | 28 +-- blog/page6.html | 31 ++- blog/page7.html | 12 +- blog/page8.html | 7 +- blog/page9.html | 7 +- feed.rss | 27 +-- index.html | 24 +-- sitemap.xml | 189 +++++++++--------- tags/index.html | 2 +- tags/net/page7.html | 4 +- tags/opengl/index.html | 4 +- tags/syncthing/index.html | 7 + tags/windows/index.html | 8 +- 27 files changed, 313 insertions(+), 281 deletions(-) create mode 100644 blog/2024/start-syncthing-background-windows.html create mode 100644 tags/syncthing/index.html diff --git a/blog/2024/start-syncthing-background-windows.html b/blog/2024/start-syncthing-background-windows.html new file mode 100644 index 00000000..b6115b01 --- /dev/null +++ b/blog/2024/start-syncthing-background-windows.html @@ -0,0 +1,7 @@ +Start Syncthing in the Background on Windows

Start Syncthing in the Background on Windows

April 28, 2024syncthingwindows

Just a quick tip for myself (and anyone who is reading this) for the future. To start syncthing in +the background on Windows open up the startup apps folder via the run command (Win+R) with shell:startup amd then create +the following shortcut:

+
powershell.exe -c "Start-Process -FilePath 'syncthing' -ArgumentList '--no-browser' -WindowStyle Hidden"
+
+

This starts syncthing in the background after a short lived popup opens. --no-console doesn't seem to work for whatever reason.

+
\ No newline at end of file diff --git a/blog/page10.html b/blog/page10.html index d50d902e..7d582465 100644 --- a/blog/page10.html +++ b/blog/page10.html @@ -1,4 +1,6 @@ -The Blog of Zachary Snow

My Experience with OpenGL vs Direct3D

November 18, 2014graphicsopengldirect3D

I've struggled a lot with myself over whether I should use OpenGL or Direct3D. There is no blanket answer to this question that anyone can tell you. +The Blog of Zachary Snow

LINQ calls IEqualityComparer<T>.GetHashCode() before Equals()

November 24, 2014.netlinq

This is a problem that has bitten me more than a few times so I thought it was about time to write a blog post about it. It's one of those problems +that makes you scratch your head for a bit and then the light bulb goes on and you remember you've solved this one before. It occurs whenever you +use a LINQ extension method which takes an instance of IEqualityComaparer.

Read More

My Experience with OpenGL vs Direct3D

November 18, 2014graphicsopengldirect3D

I've struggled a lot with myself over whether I should use OpenGL or Direct3D. There is no blanket answer to this question that anyone can tell you. Both APIs have a very different feel and which one you prefer can only be decided on your own.

Read More

Code from when I was young and stupid and needed the money

June 18, 2014old-codec++

We have had 2 interns at work for the past few weeks and one of the tasks we gave them was to implement Quicksort. This got me to thinking about my youth and some of the code I wrote back then. I've decided to post it.

Read More

Adding assembly references in Roslyn

April 15, 2014.netc#roslyn

In the Roslyn preview that was released at Build 2014 the way references to global assmeblies are added was changed. Before the preview I could use code like this:

var compilation = Compilation.Create(assemblyName, new CompilationOptions(OutputKind.DynamicallyLinkedLibrary))
@@ -25,9 +27,4 @@
 

I ended up writing my own tool I call Gatsby to do it. I also set up the whole deploy process myself involving pushing to Github which then informs my website to pull from the Github repository. Hopefully that will be a blog post in the not too distance future.

Sorry for any inconvenience.

-

Using Component Glue to build your object graphs automatically

Component Glue is an IoC container and you use it of course to wire up your object graphs for you. Component Glue can also build your object graphs for you automatically if there are no interfaces involved. Take this example:

- - -

In After.cs, you can see that Component Glue is able to build the entire object graph for us. This will include all future dependencies as well so long as interfaces don't come into play. Should an interface be needed, you can just bind that single component.

-

This is a very powerful thing. If one component needs to take on a dependency, just ask for it in the constructor and Component Glue will handle it for you.

\ No newline at end of file diff --git a/blog/page11.html b/blog/page11.html index f10923b6..16c8379d 100644 --- a/blog/page11.html +++ b/blog/page11.html @@ -1,4 +1,9 @@ -The Blog of Zachary Snow

Component Glue v1.0

I finally brought Component Glue up to a state where I felt like the product was finished. You can get it via NuGet:

+The Blog of Zachary Snow

Using Component Glue to build your object graphs automatically

Component Glue is an IoC container and you use it of course to wire up your object graphs for you. Component Glue can also build your object graphs for you automatically if there are no interfaces involved. Take this example:

+ + +

In After.cs, you can see that Component Glue is able to build the entire object graph for us. This will include all future dependencies as well so long as interfaces don't come into play. Should an interface be needed, you can just bind that single component.

+

This is a very powerful thing. If one component needs to take on a dependency, just ask for it in the constructor and Component Glue will handle it for you.

+

Component Glue v1.0

I finally brought Component Glue up to a state where I felt like the product was finished. You can get it via NuGet:

`PM> Install-Package ComponentGlue`
@@ -42,6 +47,4 @@

Changelog:

503
I can't deal with this anymore.
-

Snowball is now modular

November 6, 2012.netgame-programming

The version of Snowball currently on GitHub under the "develop" branch has been split into multiple projects. There is now an assembly for each major piece of Snowball, such as Graphics, Input, Sound. Although this means having to reference more assemblies, the amount of code your project depends on is now smaller. This also makes code maintenance a bit easier as it's more clear now what parts of the library depend on other parts of the library.

-

The parts of the library which really make up a Game Framework has also been split out into their own library. This allows for using Snowball as a just a simple set of libraries or a full blown game framework, depending on what your situation calls for.

-
\ No newline at end of file +
\ No newline at end of file diff --git a/blog/page12.html b/blog/page12.html index 2b1a7499..74e8cf98 100644 --- a/blog/page12.html +++ b/blog/page12.html @@ -1,4 +1,6 @@ -The Blog of Zachary Snow

Using Themes in Visual Studio Express for Windows Desktop

September 15, 2012vsvs2012

I just want to post some information that took me while to find. Check out the original article here with pictures and more information.

+The Blog of Zachary Snow

Snowball is now modular

November 6, 2012.netgame-programming

The version of Snowball currently on GitHub under the "develop" branch has been split into multiple projects. There is now an assembly for each major piece of Snowball, such as Graphics, Input, Sound. Although this means having to reference more assemblies, the amount of code your project depends on is now smaller. This also makes code maintenance a bit easier as it's more clear now what parts of the library depend on other parts of the library.

+

The parts of the library which really make up a Game Framework has also been split out into their own library. This allows for using Snowball as a just a simple set of libraries or a full blown game framework, depending on what your situation calls for.

+

Using Themes in Visual Studio Express for Windows Desktop

September 15, 2012vsvs2012

I just want to post some information that took me while to find. Check out the original article here with pictures and more information.

1) First, download the zip file http://www.alinconstantin.net/download/VS2012Themes.zip – it contains the 7 pkgdef files defining the colors of the default themes from Matt’s extension. @@ -19,7 +21,4 @@

In order for shaders to work properly when using GraphicsBatch, the GraphicsBatch class must pass a few parameters to the shader. At the moment, this only includes a transform matrix but may include more parameters in the future. The GraphicsBatchEffectWrapper can be used to wrap custom effects which you write in order to work with GraphicsBatch correctly. GraphicsBatchEffectWrapper will pass the parameters to your shader by following a standard naming convention. For example, the transform matrix is passed to your shader through a parameter named "TransformMatrix". You can also write you own class which implements IGraphicsBatchEffect. See the sample for an example of using the wrapper class.

Snowball - Shaders in progress

June 22, 2012.netopen-source

It's been a long couple of months. I'm in the middle of switching jobs, been on vacation a bit, and have been playing around with OpenGL a bit to get a feel for how that API works compared to Direct3D. As of yesterday I started working on implementing shaders in Snowball.

In order to implement shaders or Effect(s), there may have to be a few changes to the API / interface of the Renderer class. Nothing significant I don't think but mainly changes to the Begin() method overloads. Today I pushed the branch which contains my initial implementation.

-

Snowball now using SharpDX

For a little while, I was thinking about giving up on Snowball. When you're one guy working on a project that gets to a certain size, it can start to feel a little daunting. You find a bug, and you feel like you need to fix it asap. I don't know if anyone reading this has actually tried Snowball, but if you have, please comment to let me know. It would encourage me.

-

I decided to switch Snowball over to SharpDX. It's not that I was unhappy with SlimDX, it just seems like there is a lot more innovation happening on the SharpDX side. I also like the fact that I can include the DLLs in the repository so end users don't have to download another dependency in order to compile it. The Win8 stuff is also quite interesting, although the SlimDX guys say they are working on that.

-

I plan to set a road map soon for what I want to include the first release of Snowball. Music and Pixel Shaders are high the list. I've experimented with implementing a UI library but I think I want to push that back for a later release.

\ No newline at end of file diff --git a/blog/page13.html b/blog/page13.html index bef4abc5..8fa0afb3 100644 --- a/blog/page13.html +++ b/blog/page13.html @@ -1,4 +1,7 @@ -The Blog of Zachary Snow

Getting Started with Snowball

My game framework Snowball is far enough along that small games can be developed with it by now. The basic overall design is now laid out and not too much is likely to change as I'm now developing my own small games with it.

+The Blog of Zachary Snow

Snowball now using SharpDX

For a little while, I was thinking about giving up on Snowball. When you're one guy working on a project that gets to a certain size, it can start to feel a little daunting. You find a bug, and you feel like you need to fix it asap. I don't know if anyone reading this has actually tried Snowball, but if you have, please comment to let me know. It would encourage me.

+

I decided to switch Snowball over to SharpDX. It's not that I was unhappy with SlimDX, it just seems like there is a lot more innovation happening on the SharpDX side. I also like the fact that I can include the DLLs in the repository so end users don't have to download another dependency in order to compile it. The Win8 stuff is also quite interesting, although the SlimDX guys say they are working on that.

+

I plan to set a road map soon for what I want to include the first release of Snowball. Music and Pixel Shaders are high the list. I've experimented with implementing a UI library but I think I want to push that back for a later release.

+

Getting Started with Snowball

My game framework Snowball is far enough along that small games can be developed with it by now. The basic overall design is now laid out and not too much is likely to change as I'm now developing my own small games with it.

In order to create some kind of documentation on how to use Snowball, I created a Samples folder in the source. In the Samples folder is a WalkingWizard sample. I'm posting this source code here but it can also be viewed on GitHub here.

WinQuakeCon

I've always wanted a program that would allow me have a command line that I could slide in and out of view as needed like the console from Quake. I never could find one and so I finally got decided to write a tool myself. A picture is below and the source code is on GitHub.

I'm not putting a download here as I don't consider this finished just yet.

@@ -17,6 +20,4 @@

WMI - Converting datetime values to DateTime objects

July 12, 2011.netwmi

Just a quick post to hopefully save anyone who finds this some time. If you need to convert a datetime value from a WMI query to a native DateTime object in C#, you can use the method ToDateTime() on the ManagementDateTimeConverter class.

ManagementDateTimeConverter.ToDateTime(dmtfDate);
 
-

Snowball: A Slightly Different Direction

July 2, 2011.netcodeplex

At first, I had imagined Snowball, now located on Codeplex, to be a framework which would define how your game objects look. I.E. I had a class called GameEntity which I imagined would handle a lot of boiler plate code for you such as setting up Initialize(), Update(), Draw(), etc.

-

I've decided to move away from that and let Snowball purely focus on the subsystems of a game, such as Graphics, Sound, Input, etc. Extending from the Game class completely sets up these aspects of your game for you. I think I will include helper components, such as a collision detection system, but I will not force you to use them.

\ No newline at end of file diff --git a/blog/page14.html b/blog/page14.html index 3928b4a6..5d8597f9 100644 --- a/blog/page14.html +++ b/blog/page14.html @@ -1,4 +1,6 @@ -The Blog of Zachary Snow

XAudio2: Stop Currently Playing Sound

July 2, 2011.netslimdxxaudio2

Using SlimDX, if you want to stop a sound which is currently playing via XAudio2, use the following methods on the SourceVoice object:

+The Blog of Zachary Snow

Snowball: A Slightly Different Direction

July 2, 2011.netcodeplex

At first, I had imagined Snowball, now located on Codeplex, to be a framework which would define how your game objects look. I.E. I had a class called GameEntity which I imagined would handle a lot of boiler plate code for you such as setting up Initialize(), Update(), Draw(), etc.

+

I've decided to move away from that and let Snowball purely focus on the subsystems of a game, such as Graphics, Sound, Input, etc. Extending from the Game class completely sets up these aspects of your game for you. I think I will include helper components, such as a collision detection system, but I will not force you to use them.

+

XAudio2: Stop Currently Playing Sound

July 2, 2011.netslimdxxaudio2

Using SlimDX, if you want to stop a sound which is currently playing via XAudio2, use the following methods on the SourceVoice object:

sourceVoice.Stop();
 sourceVoice.FlushSourceBuffers();
 
@@ -6,5 +8,4 @@

This also means I'll be transitioning Snowball to Codeplex I think. I'll be moving it away from GitHub for sure just not 100% sure where.

Marker Interfaces

May 24, 2011design-patterns

In Snowball I was debating adding an empty interface to identify certain classes in my framework as components. I wasn't sure if this was code smell or not so I did some searching on Stackoverflow and found out this concept is actually called "Marker Interfaces". Learn something new every day.

ComponentGlue on GitHub

I moved the ComponentGlue repository to GitHub. I updated the example slightly and cleaned up some of the source code a little. Need to build a full blown app with it eventually.

-

Snowball and GitHub

April 12, 2011.netgithubsnowball

I started writing a 2D Game Engine on GitHub. I call it Snowball because I'm original like that.

\ No newline at end of file diff --git a/blog/page15.html b/blog/page15.html index 62c70bc9..3e6ee230 100644 --- a/blog/page15.html +++ b/blog/page15.html @@ -1,4 +1,5 @@ -The Blog of Zachary Snow

Using git-gui with Cygwin on Windows 7

April 7, 2011cygwingitwindows-7

I've started using git via cygwin and was running into trouble trying to pin it to my taskbar in Windows 7.

+The Blog of Zachary Snow

Snowball and GitHub

April 12, 2011.netgithubsnowball

I started writing a 2D Game Engine on GitHub. I call it Snowball because I'm original like that.

+

Using git-gui with Cygwin on Windows 7

April 7, 2011cygwingitwindows-7

I've started using git via cygwin and was running into trouble trying to pin it to my taskbar in Windows 7.

First I created a .bat file in the c:\cygwin folder which launches the app standalone:

@@echo off
 
@@ -90,7 +91,7 @@
     }
 }
 
-

OpenTK - Simple Movable Sprite

March 29, 2011.netopengl

I wrote my second OpenTK app. This time I'm drawing a sprite which you can move around the screen using the keyboard. I've included the source code after the jump or you can download it.

Read More

Getting started with OpenTK

March 29, 2011.netopengl

I started experimenting with OpenTK and I had to look in a few places to put this code together, so I'm posting it here for anyone who might be looking for an easy getting started lesson.

+

Getting started with OpenTK

March 29, 2011.netopengl

I started experimenting with OpenTK and I had to look in a few places to put this code together, so I'm posting it here for anyone who might be looking for an easy getting started lesson.

I've set up a window similar to what I've been used to in Xna (CornflowerBlue 4 life). I've also set up a 2D projection matrix and drawn a triangle in a 2D fashion. You'll need to add a reference to the OpenTK assembly for your project in Visual Studio.

using System;
 using System.Drawing;
@@ -143,8 +144,4 @@
     }
 }
 
-

Keeping SplitContainer SplitterDistance consistent

February 9, 2011.netwinforms

If you're having trouble keeping the SplitterDistance property of a SplitContainer consistent across app sessions, you can set the FixedPanel property of the splitter to FixedPanel.Panel1.

-
splitter.FixedPanel = FixedPanel.Panel1;
-
-

I guess this could also work with FixedPanel.Panel2 as well but I haven't given it a try. Credit this stackoverflow post.

-
\ No newline at end of file +

OpenTK - Simple Movable Sprite

March 29, 2011.netopengl

I wrote my second OpenTK app. This time I'm drawing a sprite which you can move around the screen using the keyboard. I've included the source code after the jump or you can download it.

Read More
\ No newline at end of file diff --git a/blog/page16.html b/blog/page16.html index bff15feb..b5284bd0 100644 --- a/blog/page16.html +++ b/blog/page16.html @@ -1,4 +1,8 @@ -The Blog of Zachary Snow

Favoring Composition over Inheritance

You may have heard the expression before "Favor Composition over Inheritance", but do you know what it means and how to apply it? Lets take this code for example:

+The Blog of Zachary Snow

Keeping SplitContainer SplitterDistance consistent

February 9, 2011.netwinforms

If you're having trouble keeping the SplitterDistance property of a SplitContainer consistent across app sessions, you can set the FixedPanel property of the splitter to FixedPanel.Panel1.

+
splitter.FixedPanel = FixedPanel.Panel1;
+
+

I guess this could also work with FixedPanel.Panel2 as well but I haven't given it a try. Credit this stackoverflow post.

+

Favoring Composition over Inheritance

You may have heard the expression before "Favor Composition over Inheritance", but do you know what it means and how to apply it? Lets take this code for example:

abstract class Car
 {
     public Color Color { get; protected set; }
@@ -64,4 +68,4 @@
 return Texture2D.FromFile(graphicsDevice, stream);
 

GetCallingAssembly() can be exchanged with GetExecutingAssembly() if needed. The name of the resource must be fully qualified with the app's namespace and folders. I usually keep my resources in a folder Resources so I would have: AppNamespace.Resources.font.bmp.

-

Implementing basic Dependency Injection using a Service Container

By extending your Service Container class, a very basic version of dependency injection can be implemented. We'll implement two forms of dependency injection: constructor and property injection.

Read More
\ No newline at end of file +
\ No newline at end of file diff --git a/blog/page17.html b/blog/page17.html index f8a14aa3..9ff3e9f4 100644 --- a/blog/page17.html +++ b/blog/page17.html @@ -1,4 +1,4 @@ -The Blog of Zachary Snow

500 Downloads of the Same Game

My little Xna game that I wrote nearly 2 years ago reached the 500 downloads mark (binaries and source) the other day. With that said, I'd like to say that I'm working on version 2.0.

+The Blog of Zachary Snow

Implementing basic Dependency Injection using a Service Container

By extending your Service Container class, a very basic version of dependency injection can be implemented. We'll implement two forms of dependency injection: constructor and property injection.

Read More

500 Downloads of the Same Game

My little Xna game that I wrote nearly 2 years ago reached the 500 downloads mark (binaries and source) the other day. With that said, I'd like to say that I'm working on version 2.0.

In version 2.0 I'm going to make the code more event driven. The old code uses the Xna Game class and in the new version I'll be making it WinForms based. Almost a complete rewrite.

My work so far is available through SVN on the project's Codeplex page.

Progress Bar in Windows 7 Taskbars

June 1, 2010.netc#windows-7

I decided to add progress bar to the Windows 7 Taskbar in my Timer app.

@@ -49,37 +49,4 @@ } } -

C# Extension Methods in your own Library

Normally I use extension methods in C# to extend a library that I did not write and therefore I have no control over. There are situations where it makes sense to use extension methods for a library that you yourself are writing.

-

For example, when you have interfaces in your library. You want to keep the number of methods in that interface as low as possible so that classes implementing the interface don't have to do a lot of heavy lifting. This means cutting out methods in an interface that are for the most part just syntactic sugar for another method in the interface.

-

-public interface IServiceContainer
-{
-    void AddService(Type type, Object provider);
-    object GetService(Type type);
-}
-
-public static class IServiceContainerExtensions
-{
-    public static void AddService&lt;T&gt;(this IServiceContainer services, object provider)
-    {
-        services.AddService(typeof(T), provider);
-    }
-
-    public static T GetService&lt;T&gt;(this IServiceContainer services) where T : class
-    {
-        return services.GetService(typeof(T)) as T;
-    }
-
-    public static T GetRequiredService&lt;T&gt;(this IServiceContainer services) where T : class
-    {
-        T service = services.GetService(typeof(T)) as T;
-
-        if(service == null)
-            throw new ServiceNotFoundException(typeof(T));
-
-        return service;
-    }
-}
-
-

All of the methods in IServiceContainerExtensions are just helper methods for method in IServiceContainer. By making them extension methods in our own library though, we've made the barrier to entry lower. Other people can implement the interface and in a sense "inherit" the helper methods as well.

\ No newline at end of file diff --git a/blog/page18.html b/blog/page18.html index bce8a065..862d0ab4 100644 --- a/blog/page18.html +++ b/blog/page18.html @@ -1,4 +1,37 @@ -The Blog of Zachary Snow

Creating and consuming services in your XNA Game

February 18, 2010.net

The GameServiceContainer implements the IServiceProvider interface and the MSDN documentation says about the IServiceProvider interface:

+The Blog of Zachary Snow

C# Extension Methods in your own Library

Normally I use extension methods in C# to extend a library that I did not write and therefore I have no control over. There are situations where it makes sense to use extension methods for a library that you yourself are writing.

+

For example, when you have interfaces in your library. You want to keep the number of methods in that interface as low as possible so that classes implementing the interface don't have to do a lot of heavy lifting. This means cutting out methods in an interface that are for the most part just syntactic sugar for another method in the interface.

+

+public interface IServiceContainer
+{
+    void AddService(Type type, Object provider);
+    object GetService(Type type);
+}
+
+public static class IServiceContainerExtensions
+{
+    public static void AddService&lt;T&gt;(this IServiceContainer services, object provider)
+    {
+        services.AddService(typeof(T), provider);
+    }
+
+    public static T GetService&lt;T&gt;(this IServiceContainer services) where T : class
+    {
+        return services.GetService(typeof(T)) as T;
+    }
+
+    public static T GetRequiredService&lt;T&gt;(this IServiceContainer services) where T : class
+    {
+        T service = services.GetService(typeof(T)) as T;
+
+        if(service == null)
+            throw new ServiceNotFoundException(typeof(T));
+
+        return service;
+    }
+}
+
+

All of the methods in IServiceContainerExtensions are just helper methods for method in IServiceContainer. By making them extension methods in our own library though, we've made the barrier to entry lower. Other people can implement the interface and in a sense "inherit" the helper methods as well.

+

Creating and consuming services in your XNA Game

February 18, 2010.net

The GameServiceContainer implements the IServiceProvider interface and the MSDN documentation says about the IServiceProvider interface:

Defines a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.

This article will "attempt" to describe how can you use the GameServiceContainer in your XNA game, in both your GameComponent(s) and your game's entity objects.

Read More

Changing the PlatformTarget in Visual C# Express

January 18, 2010.netmsbuild

Some project types in Visual C# Express (Empty Project) will not allow you to change the PlatformTarget from the UI. You can still change the target platform though by editing the .csproj file in a text editor. Close the project and open it up in your favorite text editor (I use Notpad++). The .csproj file is really just a XML file. You should see somewhere in the file something like:

@@ -46,38 +79,4 @@

The Game Show Host Problem, aka The Monty Hall Problem

February 12, 2009random

NOTE: This is a repost from my old blog.

So, me and my girlfriend went to see 21 last night and in the movie they make mention of The Game Show Host problem, aka The Monty Hall Problem.

The jist of the problem is this: You are on a game show. The host presents you with 3 doors, 1 of which has a car behind it, the other 2 have goats. The game show host tells you to pick a door. You do so, at which point the game show host opens up a door to show you a goat behind the door and then asks you if you would like to switch your choice to the other closed door. The question is then, should you switch your choice?

-

The correct answer is yes. More on why after the jump.

Read More

Drawing 2D Lines as Rotated Quads

February 7, 2009.net

I haven't had much time lately with work but one question I've seen asked many many times is how to draw lines of different widths. So, to cut to the chase I'll share the code I've used to do it.

-
public void DrawLine(Vector3 p1, Color c1, Vector3 p2, Color c2, int width)
-{
-    float distance = Vector3.Distance(p1, p2);
-    float halfDistance = distance / 2.0f;
-    float halfWidth = width / 2.0f;
-
-    Vector3 difference = p2 - p1;
-    Vector3 destination = new Vector3(p1.X + difference.X / 2.0f, p1.Y + difference.Y / 2.0f, p1.Z + difference.Z);
-
-    // Calculate angle between two points
-    float angle = (float)Math.Atan2(difference.Y, difference.X);
-
-    Vector3 v1, v2, v3, v4;
-
-    v1 = new Vector3(-halfDistance, -halfWidth, 0); // Top Left
-    v2 = new Vector3(halfDistance, -halfWidth, 0); // Top Right
-    v3 = new Vector3(halfDistance, halfWidth, 0); // Bottom Right
-    v4 = new Vector3(-halfDistance, halfWidth, 0); // Bottom Left
-
-    Matrix m =
-        Matrix.Identity *
-        Matrix.CreateRotationZ(angle) *
-        Matrix.CreateTranslation(destination);
-
-    v1 = Vector3.Transform(v1, m);
-    v2 = Vector3.Transform(v2, m);
-    v3 = Vector3.Transform(v3, m);
-    v4 = Vector3.Transform(v4, m);
-
-    DrawQuad(v1, c1, v2, c2, v3, c2, v4, c1);
-}
-
-

I've left a lot of fluff code out. I usually check if the line is a width of 1 and draw a normal line. I also left out the code on how to draw a quad as that can be found many other places already.

-
\ No newline at end of file +

The correct answer is yes. More on why after the jump.

Read More
\ No newline at end of file diff --git a/blog/page19.html b/blog/page19.html index 4d315da0..69310edc 100644 --- a/blog/page19.html +++ b/blog/page19.html @@ -1,4 +1,38 @@ -The Blog of Zachary Snow

SpriteSheet Class

January 9, 2009.netxna

I've been talking with a guy on the creator forums lately about SpriteSheets and so I decided it might be a good idea to post my SpriteSheet class.

+The Blog of Zachary Snow

Drawing 2D Lines as Rotated Quads

February 7, 2009.net

I haven't had much time lately with work but one question I've seen asked many many times is how to draw lines of different widths. So, to cut to the chase I'll share the code I've used to do it.

+
public void DrawLine(Vector3 p1, Color c1, Vector3 p2, Color c2, int width)
+{
+    float distance = Vector3.Distance(p1, p2);
+    float halfDistance = distance / 2.0f;
+    float halfWidth = width / 2.0f;
+
+    Vector3 difference = p2 - p1;
+    Vector3 destination = new Vector3(p1.X + difference.X / 2.0f, p1.Y + difference.Y / 2.0f, p1.Z + difference.Z);
+
+    // Calculate angle between two points
+    float angle = (float)Math.Atan2(difference.Y, difference.X);
+
+    Vector3 v1, v2, v3, v4;
+
+    v1 = new Vector3(-halfDistance, -halfWidth, 0); // Top Left
+    v2 = new Vector3(halfDistance, -halfWidth, 0); // Top Right
+    v3 = new Vector3(halfDistance, halfWidth, 0); // Bottom Right
+    v4 = new Vector3(-halfDistance, halfWidth, 0); // Bottom Left
+
+    Matrix m =
+        Matrix.Identity *
+        Matrix.CreateRotationZ(angle) *
+        Matrix.CreateTranslation(destination);
+
+    v1 = Vector3.Transform(v1, m);
+    v2 = Vector3.Transform(v2, m);
+    v3 = Vector3.Transform(v3, m);
+    v4 = Vector3.Transform(v4, m);
+
+    DrawQuad(v1, c1, v2, c2, v3, c2, v4, c1);
+}
+
+

I've left a lot of fluff code out. I usually check if the line is a width of 1 and draw a normal line. I also left out the code on how to draw a quad as that can be found many other places already.

+

SpriteSheet Class

January 9, 2009.netxna

I've been talking with a guy on the creator forums lately about SpriteSheets and so I decided it might be a good idea to post my SpriteSheet class.

It's very simple. Only reads sprites from left to right and assumes all Sprites are the same width and height.

#region Using
 using System;
diff --git a/blog/page2.html b/blog/page2.html
index b0d189b6..d481c81b 100644
--- a/blog/page2.html
+++ b/blog/page2.html
@@ -1,4 +1,18 @@
-The Blog of Zachary Snow

Powershell time command

March 10, 2022powershell

I commbined the best parts of this StackOverflow answer and this +The Blog of Zachary Snow

Iterating thru an Object in JavaScript

For the longest time if I wanted to iterate thru an object +in JavaScript I would write code that looked something like +this:

+
const obj = { a: "foo", b: "bar" };
+for (const key of Object.keys(obj)) {
+    console.info(key, obj[key]);
+}
+
+

Since ES2017 there is a better way of doing this using Object.entries() +and destructuring:

+
const obj = { a: "foo", b: "bar" };
+for (const [ key, value ] of Object.entries(obj)) {
+    console.info(key, value);
+}
+
Read More

Powershell time command

March 10, 2022powershell

I commbined the best parts of this StackOverflow answer and this Super User answer to come up with this solution for a time function in Powershell:

function time {
@@ -21,8 +35,4 @@
 

The site is still a static site but the compiler is a now a custom TypeScript program. The size of the program is now considerably smaller but that isn't necessarily becuase C# was bad but rather that this is the 2nd implementation and I know what I did and did not need.

-

Windows Terminal fork command

I wanted a way to fork the current tab in Windows Terminal and -so I've come up with this PowerShell function:

-
function fork { wt -w 0 -d "$(Get-Location)" }
-
\ No newline at end of file diff --git a/blog/page3.html b/blog/page3.html index 182216da..5571484e 100644 --- a/blog/page3.html +++ b/blog/page3.html @@ -1,5 +1,8 @@ -The Blog of Zachary Snow

Convert TypeScript AST to JSON

January 13, 2021nodetypescript

I needed to convert a TypeScript AST (Abstract Syntax Tree) to json so that I can consume it in +The Blog of Zachary Snow

Windows Terminal fork command

I wanted a way to fork the current tab in Windows Terminal and +so I've come up with this PowerShell function:

+
function fork { wt -w 0 -d "$(Get-Location)" }
+
+

Convert TypeScript AST to JSON

January 13, 2021nodetypescript

I needed to convert a TypeScript AST (Abstract Syntax Tree) to json so that I can consume it in a C# application so I wrote a tiny node script to convert the AST to json.

Read More

Starting Redis and the Redis CLI with Docker

January 8, 2021dockerredis

If you'd like to get a Redis instance up and running to play with it's fairly easy via Docker.

Read More

NativeLibraryLoader for Assembly with ModuleInitializer

December 18, 2020c#c#9

In C# 9 the ModuleInitializer atrribute was introduced which makes it easy to implement loading of native assemblies in your library.

Read More

GitHub Actions

December 6, 2020github

My blog is now being generated via GitHub actions in ubuntu-latest. This allows me to rebuild my -blog everytime there is a pushed commit.

Read More

Use nginx in docker to serve static files

December 1, 2020dockernginx

Not sure how practical this really is but I thought it was neat. Run nginx and tell it to -serve some static content on your system.

Read More
\ No newline at end of file +blog everytime there is a pushed commit.

Read More
\ No newline at end of file diff --git a/blog/page4.html b/blog/page4.html index 63e57582..95ec80de 100644 --- a/blog/page4.html +++ b/blog/page4.html @@ -1,11 +1,9 @@ -The Blog of Zachary Snow

Add the current time to your command prompt

November 26, 2020cmd

I am someone who never made the jump to Powershell and to this day still use my +The Blog of Zachary Snow

Use nginx in docker to serve static files

December 1, 2020dockernginx

Not sure how practical this really is but I thought it was neat. Run nginx and tell it to +serve some static content on your system.

Read More

Add the current time to your command prompt

November 26, 2020cmd

I am someone who never made the jump to Powershell and to this day still use my cmd shell with pride. My cmd is very personalized at this point and is available on GitHub though I'm not sure how useful it is for anyone but me. I use git and GitHub to synchronize my cmd between my different machines.

Read More

Execute different commands in MSBuild depending on platform

November 20, 2020msbuild

Another quick snippet that shows how to change what command will be executed in MSBuild based on the OS the script is running on.

Read More

Filter ItemGroup by extension in MSBuild

November 4, 2020msbuild

Just a quick snippet that shows how to filter an exiting ItemGroup by an extension.

Read More

Use Newtonsoft.Json in .NET Core 3 Web Api

October 22, 2020.net.netcoreasp.net

This post is mostly just distilling information I got from .NET Core Tutorials to -revert back to Newtonsoft.Json in asp.net core WebApi.

Read More

Node script for syntax highlighting

I decided to switch my blog to use highlightjs instead of the mixture of my own library and -ColorCode. I still wanted everything to rendered statically -though so I decided to use highlight.js as it already offered instructions on how to use the -library from node.

Read More
\ No newline at end of file +revert back to Newtonsoft.Json in asp.net core WebApi.

Read More
\ No newline at end of file diff --git a/blog/page5.html b/blog/page5.html index 30dd5d4f..bbcea5ea 100644 --- a/blog/page5.html +++ b/blog/page5.html @@ -1,4 +1,7 @@ -The Blog of Zachary Snow

Angular in Visual Studio

October 8, 2020angularvs

Now that the Angular Language Service +The Blog of Zachary Snow

Node script for syntax highlighting

I decided to switch my blog to use highlightjs instead of the mixture of my own library and +ColorCode. I still wanted everything to rendered statically +though so I decided to use highlight.js as it already offered instructions on how to use the +library from node.

Read More

Angular in Visual Studio

October 8, 2020angularvs

Now that the Angular Language Service is available for Visual Studio working on Angular projects from inside Visual Studio is a viable option. The linked blog post mentions a couple of ways of adding the Angular project to Visual Studio but I felt the suggestions left something to be desired here is what I came up with.

Read More

Creating a asp.net web app with an Angular frontend

WebShell

We're going to create a what I call a "WebShell" application with asp.net core on the backend and Angular on the @@ -12,25 +15,4 @@ so I want to be able just to execute TypeScript files directly. There are npm packages like ts-node that do this already but I wanted to have a crack at implementing it -myself. So this is the batch file I've come up with so far.

Read More

Checking for uncommited git changes in a batch program

July 22, 2020batchgit

Sometimes it's helpful to exit out of a batch script if there are pending -changes to a repo. This is done in batch script in a non intuitive way.

-
@ECHO OFF
-PUSHD %~dp0
-
-SET __HAS_CHANGES=0
-
-REM The loop won't be executed if 'git status -s' doesn't produce any output.
-FOR /f "tokens=*" %%i IN ('git status -s') DO ( SET __HAS_CHANGES=1 )
-
-REM Check if the loop was executed and goto EXIT if it was.
-IF "%__HAS_CHANGES%" NEQ "0" (
-    ECHO There are currently uncommitted changes.
-    GOTO EXIT
-)
-
-REM Do the work you want to do here.
-
-:EXIT
-POPD
-
-
\ No newline at end of file +myself. So this is the batch file I've come up with so far.

Read More
\ No newline at end of file diff --git a/blog/page6.html b/blog/page6.html index ac61aca8..55cc8dae 100644 --- a/blog/page6.html +++ b/blog/page6.html @@ -1,4 +1,25 @@ -The Blog of Zachary Snow

Enum Extension Methods

Did you know you can create extension methods for enums?

Read More

Disable C# null checks for a field or property

January 2, 2020.netc#nrtnullable

The new nullable reference types in C# are great but sometimes you might need to disable it for a +The Blog of Zachary Snow

Checking for uncommited git changes in a batch program

July 22, 2020batchgit

Sometimes it's helpful to exit out of a batch script if there are pending +changes to a repo. This is done in batch script in a non intuitive way.

+
@ECHO OFF
+PUSHD %~dp0
+
+SET __HAS_CHANGES=0
+
+REM The loop won't be executed if 'git status -s' doesn't produce any output.
+FOR /f "tokens=*" %%i IN ('git status -s') DO ( SET __HAS_CHANGES=1 )
+
+REM Check if the loop was executed and goto EXIT if it was.
+IF "%__HAS_CHANGES%" NEQ "0" (
+    ECHO There are currently uncommitted changes.
+    GOTO EXIT
+)
+
+REM Do the work you want to do here.
+
+:EXIT
+POPD
+
+

Enum Extension Methods

Did you know you can create extension methods for enums?

Read More

Disable C# null checks for a field or property

January 2, 2020.netc#nrtnullable

The new nullable reference types in C# are great but sometimes you might need to disable it for a single field or property. You can do that by assigning the value to null and using the ! operator.

Read More

Use nameof() to set a string variable to its name

December 17, 2019.netc#

This is one of those things that should have just been obvious to me but once I saw it I wondered why I had never thought to use it myself. nameof() can be used when declaring a variable to set the value of the @@ -26,10 +47,4 @@ were placed in subdirectories again. This led me to believe that loading libegl.dll must be implicitly loading libglesv2.dll. Loading libglesv2.dll via LoadLibrary along with libegl.dll solved the problem.

-

Abusing IDisposable

August 27, 2019.netc#

In C# the interface IDisposable is usually used to indicate that an object -needs to dispose of unmanaged resources. C# provides the using syntax to -ensure that the Dispose method is called once the instance of the object is -no longer needed.

-

Dispose is just like any other method though and the using syntax can -be used quite nicely for other use cases as well. Let's create a class we -can use to collect some actions to be "deferred" until a later time.

Read More
\ No newline at end of file +
\ No newline at end of file diff --git a/blog/page7.html b/blog/page7.html index 70202257..3b9fae01 100644 --- a/blog/page7.html +++ b/blog/page7.html @@ -1,4 +1,10 @@ -The Blog of Zachary Snow

Generating string permutations for unit testing

February 11, 2019.netc#nunit

I needed to parse a string containing 6 characters. Each character should only +The Blog of Zachary Snow

Abusing IDisposable

August 27, 2019.netc#

In C# the interface IDisposable is usually used to indicate that an object +needs to dispose of unmanaged resources. C# provides the using syntax to +ensure that the Dispose method is called once the instance of the object is +no longer needed.

+

Dispose is just like any other method though and the using syntax can +be used quite nicely for other use cases as well. Let's create a class we +can use to collect some actions to be "deferred" until a later time.

Read More

Generating string permutations for unit testing

February 11, 2019.netc#nunit

I needed to parse a string containing 6 characters. Each character should only be one of 3 possibilities: '?' for null, '0' for false or '1' for true. The problem sounded easy enough to generate a whole bunch of unit tests for.

Read More

Functional Card Deck in C#

October 11, 2018c#fp

I've been inspired lately by Mark Seemann's series of posts about Applicative Functors. One of the latest posts is an example about creating a full deck of cards. Most of posts up to this @@ -34,6 +40,4 @@ // This will also print 5. Console.WriteLine(five());

-

Lambda Collection Wrappers

April 26, 2018c#fp

I've been reading a lot as of late about functional programming and I try to -incorperate as much as possible into my everyday programming. One trick that -I've definitely started using is wrapping collections in lambda functions.

Read More
\ No newline at end of file +
\ No newline at end of file diff --git a/blog/page8.html b/blog/page8.html index 1bbcab22..bf1559ab 100644 --- a/blog/page8.html +++ b/blog/page8.html @@ -1,4 +1,6 @@ -The Blog of Zachary Snow

string.Join Extension Method

April 19, 2018.netc#linq

Normally if want to do a string.Join on the result of a Linq query you end up with somthing looking like +The Blog of Zachary Snow

Lambda Collection Wrappers

April 26, 2018c#fp

I've been reading a lot as of late about functional programming and I try to +incorperate as much as possible into my everyday programming. One trick that +I've definitely started using is wrapping collections in lambda functions.

Read More

string.Join Extension Method

April 19, 2018.netc#linq

Normally if want to do a string.Join on the result of a Linq query you end up with somthing looking like this:

Console.WriteLine(string.Join(", ", numbers.Where(x => x % 2 == 0)));
 
@@ -37,5 +39,4 @@

This is documented here.

Git Quick Push

March 29, 2018gitbatch

Here's a quick one liner to quickly stage all your changes in the current git repo, commit them and then push -the commit to origin master branch.

Read More

Poor Man's Template Engine in C# Part 3

Include

In our last episode we implemeted the first -two helper funcitons HtmlEncode and If. Today we want to implement Include.

Read More
\ No newline at end of file +the commit to origin master branch.

Read More
\ No newline at end of file diff --git a/blog/page9.html b/blog/page9.html index bf1ce61d..170f9684 100644 --- a/blog/page9.html +++ b/blog/page9.html @@ -1,4 +1,5 @@ -The Blog of Zachary Snow

Poor Man's Template Engine in C# Part 2

HtmlEncode and If

In our last episode we laid the groundwork for our +The Blog of Zachary Snow

Poor Man's Template Engine in C# Part 3

Include

In our last episode we implemeted the first +two helper funcitons HtmlEncode and If. Today we want to implement Include.

Read More

Poor Man's Template Engine in C# Part 2

HtmlEncode and If

In our last episode we laid the groundwork for our simple template engine. In this episode we'll introduce our first 2 helper functions.

Read More

Poor Man's Template Engine in C# Part 1

Groundwork

If you're looking for a poor man's solution to a templating engine for .net and don't really need the overhead a complete template engine brings with it, I've come up with the following solution.

Read More

Snowball V2.0

February 23, 2018.netsnowballc#

I haven't written anything new here in a very long time and a lot has happened since then. I started a new job at BeumerGroup this year and now work mostly in TypeScript writing an html5 spa app.

@@ -9,6 +10,4 @@

The old repo is still available on my github at https://github.com/smack0007/Snowball_v1.

Using batch files as the task runner in Visual Studio Code

July 9, 2015vsvscodebatch

Visual Studio Code allows you specify tasks which can be in a task runner. Most examples I've seen show how to integrate with Javascript task runners such as Gulp. There is no reason why you can't simpley use -batch files though.

Read More

LINQ calls IEqualityComparer<T>.GetHashCode() before Equals()

November 24, 2014.netlinq

This is a problem that has bitten me more than a few times so I thought it was about time to write a blog post about it. It's one of those problems -that makes you scratch your head for a bit and then the light bulb goes on and you remember you've solved this one before. It occurs whenever you -use a LINQ extension method which takes an instance of IEqualityComaparer.

Read More
\ No newline at end of file +batch files though.

Read More
\ No newline at end of file diff --git a/feed.rss b/feed.rss index 55df108f..acc07e90 100644 --- a/feed.rss +++ b/feed.rss @@ -5,9 +5,22 @@ The Blog of Zachary Snow The Blog of Zachary Snow https://smack0007.github.io/ - Tue, 24 Oct 2023 00:00:00 GMT - Tue, 24 Oct 2023 00:00:00 GMT + Sun, 28 Apr 2024 00:00:00 GMT + Sun, 28 Apr 2024 00:00:00 GMT 1800 + + <![CDATA[Start Syncthing in the Background on Windows]]> + Just a quick tip for myself (and anyone who is reading this) for the future. To start syncthing in +the background on Windows open up the startup apps folder via the run command (Win+R) with shell:startup amd then create +the following shortcut:

+
powershell.exe -c "Start-Process -FilePath 'syncthing' -ArgumentList '--no-browser' -WindowStyle Hidden"
+
+

This starts syncthing in the background after a short lived popup opens. --no-console doesn't seem to work for whatever reason.

+]]>
+ https://smack0007.github.io/blog/2024/start-syncthing-background-windows.html + https://smack0007.github.io/blog/2024/start-syncthing-background-windows.html + Sun, 28 Apr 2024 00:00:00 GMT +
<![CDATA[Typing jest Spies]]> It often feels like TypeScript was an afterthought in jest. @@ -242,16 +255,6 @@ revert back to Newtonsoft.Json in https://smack0007.github.io/blog/2020/use-newtonsoft.json-in-.net-core-3-web-api.html Thu, 22 Oct 2020 00:00:00 GMT - - <![CDATA[Node script for syntax highlighting]]> - I decided to switch my blog to use highlightjs instead of the mixture of my own library and -ColorCode. I still wanted everything to rendered statically -though so I decided to use highlight.js as it already offered instructions on how to use the -library from node.

]]>
- https://smack0007.github.io/blog/2020/node-script-for-syntax-highlighting.html - https://smack0007.github.io/blog/2020/node-script-for-syntax-highlighting.html - Wed, 14 Oct 2020 00:00:00 GMT -
diff --git a/index.html b/index.html index 4f6ab6ec..103d9c18 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,10 @@ -The Blog of Zachary Snow

Typing jest Spies

October 24, 2023typescriptjest

It often feels like TypeScript was an afterthought in jest. +The Blog of Zachary Snow

Start Syncthing in the Background on Windows

April 28, 2024syncthingwindows

Just a quick tip for myself (and anyone who is reading this) for the future. To start syncthing in +the background on Windows open up the startup apps folder via the run command (Win+R) with shell:startup amd then create +the following shortcut:

+
powershell.exe -c "Start-Process -FilePath 'syncthing' -ArgumentList '--no-browser' -WindowStyle Hidden"
+
+

This starts syncthing in the background after a short lived popup opens. --no-console doesn't seem to work for whatever reason.

+

Typing jest Spies

October 24, 2023typescriptjest

It often feels like TypeScript was an afterthought in jest. Any time I need to type a variable that holds some data structure from jest it feels like I need to dust off my old book of spells in order to find the correct incantation to make eslint happy. A situation I finally figured @@ -47,18 +53,4 @@

On Windows though this will return a path with unix style path seperators and a leading /:

/D:/Code/deno-path-of-script/main.ts
-
Read More

Iterating thru an Object in JavaScript

For the longest time if I wanted to iterate thru an object -in JavaScript I would write code that looked something like -this:

-
const obj = { a: "foo", b: "bar" };
-for (const key of Object.keys(obj)) {
-    console.info(key, obj[key]);
-}
-
-

Since ES2017 there is a better way of doing this using Object.entries() -and destructuring:

-
const obj = { a: "foo", b: "bar" };
-for (const [ key, value ] of Object.entries(obj)) {
-    console.info(key, value);
-}
-
Read More
\ No newline at end of file +Read More
\ No newline at end of file diff --git a/sitemap.xml b/sitemap.xml index 8023565f..ab143422 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -4,286 +4,289 @@ https://smack0007.github.io/index.html - https://smack0007.github.io/about.html + https://smack0007.github.io/blog/2023/enums-considered-harmful.html - https://smack0007.github.io/blog/2009/calculating-an-angle-from-a-vector2.html + https://smack0007.github.io/blog/2023/typing-jest-spies.html - https://smack0007.github.io/blog/2009/the-game-show-host-problem-aka-the-monty-hall-problem.html + https://smack0007.github.io/blog/2019/use-nameof-to-set-string-variable-to-its-name.html - https://smack0007.github.io/blog/2009/spritesheet-class.html + https://smack0007.github.io/blog/2019/dynamically-loaded-dll-thows-accessviolationexception-on-first-function-call.html - https://smack0007.github.io/blog/2009/drawing-2d-lines-as-rotated-quads.html + https://smack0007.github.io/blog/2019/abusing-idisposable.html - https://smack0007.github.io/blog/2012/using-themes-in-visual-studio-express-for-windows-desktop.html + https://smack0007.github.io/blog/2019/generating-string-permutations-for-unit-testing.html - https://smack0007.github.io/blog/2012/http-status-codes-as-telephone-calls.html + https://smack0007.github.io/blog/2011/favoring-composition-over-inheritance.html - https://smack0007.github.io/blog/2012/id3dxeffectonlostdevice.html + https://smack0007.github.io/blog/2011/what-is-snowball-and-what-do-i-want-to-do-with-it.html - https://smack0007.github.io/blog/2012/snowball-is-now-modular.html + https://smack0007.github.io/blog/2011/switching-from-git-to-mercurial.html - https://smack0007.github.io/blog/2012/getting-started-with-snowball.html + https://smack0007.github.io/blog/2011/keeping-splitcontainer-splitterdistance-consistent.html - https://smack0007.github.io/blog/2012/snowball-now-using-sharpdx.html + https://smack0007.github.io/blog/2011/componentglue-on-github.html - https://smack0007.github.io/blog/2012/snowball-now-based-on-shaders.html + https://smack0007.github.io/blog/2011/using-git-gui-with-cygwin-on-windows-7.html - https://smack0007.github.io/blog/2012/snowball-shaders-in-progress.html + https://smack0007.github.io/blog/2011/snowball-a-slightly-different-direction.html - https://smack0007.github.io/blog/2021/windows-terminal-fork-command.html + https://smack0007.github.io/blog/2011/xaudio2-stop-currently-playing-sound.html - https://smack0007.github.io/blog/2021/convert-typescript-ast-to-json.html + https://smack0007.github.io/blog/2011/getting-started-with-opentk.html - https://smack0007.github.io/blog/2021/starting-redis-and-the-redis-cli-with-docker.html + https://smack0007.github.io/blog/2011/marker-interfaces.html - https://smack0007.github.io/blog/2021/use-bash-exe-to-run-scripts-in-windows.html + https://smack0007.github.io/blog/2011/getting-started-with-slimdx.html - https://smack0007.github.io/blog/2021/powered-by-typescript.html + https://smack0007.github.io/blog/2011/opentk-simple-movable-sprite.html - https://smack0007.github.io/blog/2021/practical-wasm.html + https://smack0007.github.io/blog/2011/snowball-and-github.html - https://smack0007.github.io/blog/2019/dynamically-loaded-dll-thows-accessviolationexception-on-first-function-call.html + https://smack0007.github.io/blog/2011/wmi-converting-datetime-values-to-datetime-objects.html - https://smack0007.github.io/blog/2019/abusing-idisposable.html + https://smack0007.github.io/blog/2011/winquakecon.html - https://smack0007.github.io/blog/2019/use-nameof-to-set-string-variable-to-its-name.html + https://smack0007.github.io/blog/2008/colors-and-hex.html - https://smack0007.github.io/blog/2019/generating-string-permutations-for-unit-testing.html + https://smack0007.github.io/blog/2008/zend_db_table-as-a-model.html - https://smack0007.github.io/blog/2011/switching-from-git-to-mercurial.html + https://smack0007.github.io/blog/2015/using-batch-files-as-task-runner-vs-code.html - https://smack0007.github.io/blog/2011/using-git-gui-with-cygwin-on-windows-7.html + https://smack0007.github.io/blog/2018/string-join-extension-method.html - https://smack0007.github.io/blog/2011/snowball-a-slightly-different-direction.html + https://smack0007.github.io/blog/2018/functional-card-deck-in-csharp.html - https://smack0007.github.io/blog/2011/favoring-composition-over-inheritance.html + https://smack0007.github.io/blog/2018/poor-mans-template-engine-3.html - https://smack0007.github.io/blog/2011/opentk-simple-movable-sprite.html + https://smack0007.github.io/blog/2018/git-quick-push.html - https://smack0007.github.io/blog/2011/xaudio2-stop-currently-playing-sound.html + https://smack0007.github.io/blog/2018/run-program-directly-after-building-vscode.html - https://smack0007.github.io/blog/2011/winquakecon.html + https://smack0007.github.io/blog/2018/snowball-2.html - https://smack0007.github.io/blog/2011/snowball-and-github.html + https://smack0007.github.io/blog/2018/a-neat-way-to-curry-in-csharp.html - https://smack0007.github.io/blog/2011/getting-started-with-opentk.html + https://smack0007.github.io/blog/2018/poor-mans-template-engine-2.html - https://smack0007.github.io/blog/2011/wmi-converting-datetime-values-to-datetime-objects.html + https://smack0007.github.io/blog/2018/merging-build-directory-props.html - https://smack0007.github.io/blog/2011/keeping-splitcontainer-splitterdistance-consistent.html + https://smack0007.github.io/blog/2018/poor-mans-template-engine-1.html - https://smack0007.github.io/blog/2011/marker-interfaces.html + https://smack0007.github.io/blog/2018/enabling-the-latest-version-of-csharp.html - https://smack0007.github.io/blog/2011/getting-started-with-slimdx.html + https://smack0007.github.io/blog/2018/lambda-collection-wrappers.html - https://smack0007.github.io/blog/2011/componentglue-on-github.html + https://smack0007.github.io/blog/2013/introducing-gldotnet.html - https://smack0007.github.io/blog/2011/what-is-snowball-and-what-do-i-want-to-do-with-it.html + https://smack0007.github.io/blog/2013/gldotnet-version-0-6-0.html - https://smack0007.github.io/blog/2014/my-experience-with-opengl-vs-direct3d.html + https://smack0007.github.io/blog/2013/component-glue-v1-0.html - https://smack0007.github.io/blog/2014/linq-calls-iequalitycomparer-gethashcode-before-equals.html + https://smack0007.github.io/blog/2013/using-component-glue-to-build-your-object-graphs-automatically.html - https://smack0007.github.io/blog/2014/all-the-cool-kids-are-static.html + https://smack0007.github.io/blog/2010/drawing-rectangles-with-spritebatch.html - https://smack0007.github.io/blog/2014/code-from-when-i-was-young-and-stupid.html + https://smack0007.github.io/blog/2010/visual-studio-move-referenced-dll-to-different-directory-after-build.html - https://smack0007.github.io/blog/2014/adding-assembly-references-in-roslyn.html + https://smack0007.github.io/blog/2010/component-glue.html - https://smack0007.github.io/blog/2015/using-batch-files-as-task-runner-vs-code.html + https://smack0007.github.io/blog/2010/xna-load-texture2d-from-embedded-resource.html - https://smack0007.github.io/blog/2020/filter-itemgroup-by-extension-in-msbuild.html + https://smack0007.github.io/blog/2010/creating-and-consuming-services-in-your-xna-game.html - https://smack0007.github.io/blog/2020/use-nginx-in-docker-to-serve-static-files.html + https://smack0007.github.io/blog/2010/changing-the-platformtarge-in-visual-c-express.html - https://smack0007.github.io/blog/2020/checking-for-uncommited-git-changes-in-a-batch-program.html + https://smack0007.github.io/blog/2010/winforms-and-mvc.html - https://smack0007.github.io/blog/2020/creating-a-asp.net-web-app-with-an-angular-frontend.html + https://smack0007.github.io/blog/2010/500-downloads-of-the-same-game.html - https://smack0007.github.io/blog/2020/add-the-current-time-to-your-command-prompt.html + https://smack0007.github.io/blog/2010/progress-bars-in-windows-7-taskbars.html - https://smack0007.github.io/blog/2020/use-newtonsoft.json-in-.net-core-3-web-api.html + https://smack0007.github.io/blog/2010/implementing-basic-dependency-injection-using-services-container.html - https://smack0007.github.io/blog/2020/execute-different-commands-in-msbuild-depending-on-platform.html + https://smack0007.github.io/blog/2010/csharp-extension-methods-in-your-own-library.html - https://smack0007.github.io/blog/2020/enum-extension-methods.html + https://smack0007.github.io/blog/2020/github-actions.html - https://smack0007.github.io/blog/2020/nativelibraryloader-for-assembly-with-moduleinitializer.html + https://smack0007.github.io/blog/2020/creating-a-tsexec-command.html - https://smack0007.github.io/blog/2020/angular-in-visual-studio.html + https://smack0007.github.io/blog/2020/disable-csharp-null-checks-for-a-field-or-property.html - https://smack0007.github.io/blog/2020/disable-csharp-null-checks-for-a-field-or-property.html + https://smack0007.github.io/blog/2020/node-script-for-syntax-highlighting.html https://smack0007.github.io/blog/2020/predictable-random-number-generation-in-typescript.html - https://smack0007.github.io/blog/2020/node-script-for-syntax-highlighting.html + https://smack0007.github.io/blog/2020/add-the-current-time-to-your-command-prompt.html - https://smack0007.github.io/blog/2020/creating-a-tsexec-command.html + https://smack0007.github.io/blog/2020/creating-a-asp.net-web-app-with-an-angular-frontend.html - https://smack0007.github.io/blog/2020/github-actions.html + https://smack0007.github.io/blog/2020/execute-different-commands-in-msbuild-depending-on-platform.html - https://smack0007.github.io/blog/2010/implementing-basic-dependency-injection-using-services-container.html + https://smack0007.github.io/blog/2020/angular-in-visual-studio.html - https://smack0007.github.io/blog/2010/component-glue.html + https://smack0007.github.io/blog/2020/use-newtonsoft.json-in-.net-core-3-web-api.html - https://smack0007.github.io/blog/2010/drawing-rectangles-with-spritebatch.html + https://smack0007.github.io/blog/2020/enum-extension-methods.html - https://smack0007.github.io/blog/2010/xna-load-texture2d-from-embedded-resource.html + https://smack0007.github.io/blog/2020/use-nginx-in-docker-to-serve-static-files.html - https://smack0007.github.io/blog/2010/csharp-extension-methods-in-your-own-library.html + https://smack0007.github.io/blog/2020/nativelibraryloader-for-assembly-with-moduleinitializer.html - https://smack0007.github.io/blog/2010/creating-and-consuming-services-in-your-xna-game.html + https://smack0007.github.io/blog/2020/filter-itemgroup-by-extension-in-msbuild.html - https://smack0007.github.io/blog/2010/changing-the-platformtarge-in-visual-c-express.html + https://smack0007.github.io/blog/2020/checking-for-uncommited-git-changes-in-a-batch-program.html - https://smack0007.github.io/blog/2010/winforms-and-mvc.html + https://smack0007.github.io/blog/2021/practical-wasm.html - https://smack0007.github.io/blog/2010/progress-bars-in-windows-7-taskbars.html + https://smack0007.github.io/blog/2021/starting-redis-and-the-redis-cli-with-docker.html - https://smack0007.github.io/blog/2010/visual-studio-move-referenced-dll-to-different-directory-after-build.html + https://smack0007.github.io/blog/2021/powered-by-typescript.html - https://smack0007.github.io/blog/2010/500-downloads-of-the-same-game.html + https://smack0007.github.io/blog/2021/convert-typescript-ast-to-json.html - https://smack0007.github.io/blog/2008/zend_db_table-as-a-model.html + https://smack0007.github.io/blog/2021/use-bash-exe-to-run-scripts-in-windows.html - https://smack0007.github.io/blog/2008/colors-and-hex.html + https://smack0007.github.io/blog/2021/windows-terminal-fork-command.html - https://smack0007.github.io/blog/2023/typing-jest-spies.html + https://smack0007.github.io/blog/2024/start-syncthing-background-windows.html - https://smack0007.github.io/blog/2023/enums-considered-harmful.html + https://smack0007.github.io/blog/2014/adding-assembly-references-in-roslyn.html - https://smack0007.github.io/blog/2022/deno-get-path-of-script.html + https://smack0007.github.io/blog/2014/linq-calls-iequalitycomparer-gethashcode-before-equals.html - https://smack0007.github.io/blog/2022/powershell-time-command.html + https://smack0007.github.io/blog/2014/all-the-cool-kids-are-static.html - https://smack0007.github.io/blog/2022/blog-now-runs-on-deno.html + https://smack0007.github.io/blog/2014/code-from-when-i-was-young-and-stupid.html - https://smack0007.github.io/blog/2022/iterating-thru-an-object-in-javascript.html + https://smack0007.github.io/blog/2014/my-experience-with-opengl-vs-direct3d.html - https://smack0007.github.io/blog/2018/run-program-directly-after-building-vscode.html + https://smack0007.github.io/blog/2022/powershell-time-command.html - https://smack0007.github.io/blog/2018/merging-build-directory-props.html + https://smack0007.github.io/blog/2022/deno-get-path-of-script.html - https://smack0007.github.io/blog/2018/git-quick-push.html + https://smack0007.github.io/blog/2022/blog-now-runs-on-deno.html - https://smack0007.github.io/blog/2018/string-join-extension-method.html + https://smack0007.github.io/blog/2022/iterating-thru-an-object-in-javascript.html - https://smack0007.github.io/blog/2018/a-neat-way-to-curry-in-csharp.html + https://smack0007.github.io/blog/2012/snowball-shaders-in-progress.html - https://smack0007.github.io/blog/2018/lambda-collection-wrappers.html + https://smack0007.github.io/blog/2012/id3dxeffectonlostdevice.html - https://smack0007.github.io/blog/2018/poor-mans-template-engine-1.html + https://smack0007.github.io/blog/2012/using-themes-in-visual-studio-express-for-windows-desktop.html - https://smack0007.github.io/blog/2018/enabling-the-latest-version-of-csharp.html + https://smack0007.github.io/blog/2012/snowball-now-based-on-shaders.html - https://smack0007.github.io/blog/2018/poor-mans-template-engine-2.html + https://smack0007.github.io/blog/2012/snowball-is-now-modular.html - https://smack0007.github.io/blog/2018/poor-mans-template-engine-3.html + https://smack0007.github.io/blog/2012/getting-started-with-snowball.html - https://smack0007.github.io/blog/2018/functional-card-deck-in-csharp.html + https://smack0007.github.io/blog/2012/snowball-now-using-sharpdx.html - https://smack0007.github.io/blog/2018/snowball-2.html + https://smack0007.github.io/blog/2012/http-status-codes-as-telephone-calls.html - https://smack0007.github.io/blog/2013/using-component-glue-to-build-your-object-graphs-automatically.html + https://smack0007.github.io/blog/2009/calculating-an-angle-from-a-vector2.html - https://smack0007.github.io/blog/2013/introducing-gldotnet.html + https://smack0007.github.io/blog/2009/the-game-show-host-problem-aka-the-monty-hall-problem.html - https://smack0007.github.io/blog/2013/component-glue-v1-0.html + https://smack0007.github.io/blog/2009/drawing-2d-lines-as-rotated-quads.html - https://smack0007.github.io/blog/2013/gldotnet-version-0-6-0.html + https://smack0007.github.io/blog/2009/spritesheet-class.html + + + https://smack0007.github.io/about.html diff --git a/tags/index.html b/tags/index.html index df9be92d..32b3d563 100644 --- a/tags/index.html +++ b/tags/index.html @@ -1 +1 @@ -The Blog of Zachary Snow \ No newline at end of file +The Blog of Zachary Snow \ No newline at end of file diff --git a/tags/net/page7.html b/tags/net/page7.html index fb11c063..70a8d420 100644 --- a/tags/net/page7.html +++ b/tags/net/page7.html @@ -72,7 +72,7 @@ } }
-

OpenTK - Simple Movable Sprite

March 29, 2011.netopengl

I wrote my second OpenTK app. This time I'm drawing a sprite which you can move around the screen using the keyboard. I've included the source code after the jump or you can download it.

Read More

Getting started with OpenTK

March 29, 2011.netopengl

I started experimenting with OpenTK and I had to look in a few places to put this code together, so I'm posting it here for anyone who might be looking for an easy getting started lesson.

+

Getting started with OpenTK

March 29, 2011.netopengl

I started experimenting with OpenTK and I had to look in a few places to put this code together, so I'm posting it here for anyone who might be looking for an easy getting started lesson.

I've set up a window similar to what I've been used to in Xna (CornflowerBlue 4 life). I've also set up a 2D projection matrix and drawn a triangle in a 2D fashion. You'll need to add a reference to the OpenTK assembly for your project in Visual Studio.

using System;
 using System.Drawing;
@@ -125,7 +125,7 @@
     }
 }
 
-

Keeping SplitContainer SplitterDistance consistent

February 9, 2011.netwinforms

If you're having trouble keeping the SplitterDistance property of a SplitContainer consistent across app sessions, you can set the FixedPanel property of the splitter to FixedPanel.Panel1.

+

OpenTK - Simple Movable Sprite

March 29, 2011.netopengl

I wrote my second OpenTK app. This time I'm drawing a sprite which you can move around the screen using the keyboard. I've included the source code after the jump or you can download it.

Read More

Keeping SplitContainer SplitterDistance consistent

February 9, 2011.netwinforms

If you're having trouble keeping the SplitterDistance property of a SplitContainer consistent across app sessions, you can set the FixedPanel property of the splitter to FixedPanel.Panel1.

splitter.FixedPanel = FixedPanel.Panel1;
 

I guess this could also work with FixedPanel.Panel2 as well but I haven't given it a try. Credit this stackoverflow post.

diff --git a/tags/opengl/index.html b/tags/opengl/index.html index 747ce9b1..1f7f684b 100644 --- a/tags/opengl/index.html +++ b/tags/opengl/index.html @@ -11,7 +11,7 @@

Changelog:

Introducing GLDotNet

Today I released a project I've been playing around with for a year or so on Codeplex. It's called GLDotNet. From the project description:

C# wrapper for OpenGL. Partially generated from the OpenGL spec and partially written by hand, the aim is to have a flexible and native feeling C# binding.

I have generated functions from the OpenGL spec excluding 1 or 2 but unfortunately of the generated code is untested. There is a demo project included in the source code. The Github repository is located here: https://github.com/smack0007/GLDotNet

-

OpenTK - Simple Movable Sprite

March 29, 2011.netopengl

I wrote my second OpenTK app. This time I'm drawing a sprite which you can move around the screen using the keyboard. I've included the source code after the jump or you can download it.

Read More

Getting started with OpenTK

March 29, 2011.netopengl

I started experimenting with OpenTK and I had to look in a few places to put this code together, so I'm posting it here for anyone who might be looking for an easy getting started lesson.

+

Getting started with OpenTK

March 29, 2011.netopengl

I started experimenting with OpenTK and I had to look in a few places to put this code together, so I'm posting it here for anyone who might be looking for an easy getting started lesson.

I've set up a window similar to what I've been used to in Xna (CornflowerBlue 4 life). I've also set up a 2D projection matrix and drawn a triangle in a 2D fashion. You'll need to add a reference to the OpenTK assembly for your project in Visual Studio.

using System;
 using System.Drawing;
@@ -64,4 +64,4 @@ 

Changelog:

} }
-
\ No newline at end of file +

OpenTK - Simple Movable Sprite

March 29, 2011.netopengl

I wrote my second OpenTK app. This time I'm drawing a sprite which you can move around the screen using the keyboard. I've included the source code after the jump or you can download it.

Read More
\ No newline at end of file diff --git a/tags/syncthing/index.html b/tags/syncthing/index.html new file mode 100644 index 00000000..2bbf4904 --- /dev/null +++ b/tags/syncthing/index.html @@ -0,0 +1,7 @@ +syncthing

Start Syncthing in the Background on Windows

April 28, 2024syncthingwindows

Just a quick tip for myself (and anyone who is reading this) for the future. To start syncthing in +the background on Windows open up the startup apps folder via the run command (Win+R) with shell:startup amd then create +the following shortcut:

+
powershell.exe -c "Start-Process -FilePath 'syncthing' -ArgumentList '--no-browser' -WindowStyle Hidden"
+
+

This starts syncthing in the background after a short lived popup opens. --no-console doesn't seem to work for whatever reason.

+
\ No newline at end of file diff --git a/tags/windows/index.html b/tags/windows/index.html index 31b70d7a..0bc753e3 100644 --- a/tags/windows/index.html +++ b/tags/windows/index.html @@ -1,4 +1,10 @@ -windows

Use bash.exe to run bash scripts in Windows

September 1, 2021windowswslbash

If you have the Windows Subsystem for Linux (WSL) installed then you can use wsl.exe to start +windows

Start Syncthing in the Background on Windows

April 28, 2024syncthingwindows

Just a quick tip for myself (and anyone who is reading this) for the future. To start syncthing in +the background on Windows open up the startup apps folder via the run command (Win+R) with shell:startup amd then create +the following shortcut:

+
powershell.exe -c "Start-Process -FilePath 'syncthing' -ArgumentList '--no-browser' -WindowStyle Hidden"
+
+

This starts syncthing in the background after a short lived popup opens. --no-console doesn't seem to work for whatever reason.

+

Use bash.exe to run bash scripts in Windows

September 1, 2021windowswslbash

If you have the Windows Subsystem for Linux (WSL) installed then you can use wsl.exe to start any linux distribution you have installed from the command prompt. What I recently learned about though is that there is a bash.exe as well which can be used to execute a bash script directly.

Read More

WinQuakeCon

I've always wanted a program that would allow me have a command line that I could slide in and out of view as needed like the console from Quake. I never could find one and so I finally got decided to write a tool myself. A picture is below and the source code is on GitHub.

I'm not putting a download here as I don't consider this finished just yet.