Showing posts with the label C#

Custom Logging with Personal Fields in Nlog

Setting the database string via
var databaseTarget =(DatabaseTarget)LogManager.Configuration.FindTargetByName("database"); databaseTarget.ConnectionString= connectionString;LogManager.ReconfigExistingLoggers(); The above didn't work but I used the example below where I set it via the the start of the program.

var defaultConnection = Configuration.GetConnectionString("DefaultConnection"); NLog.GlobalDiagnosticsContext.Set("defaultConnection", defaultConnection); var logger = LogManager.LoadConfiguration("nlog.config").GetCurrentClassLogger(); Then you can use ${gdc:item=defaultConnection} in your nlog.config:

CSharp Cheatsheet

Unity Editor freezing After Initial Start

For about three month now I've been working on a little project in unity3d. The project is simple I have a udp socket in c++ and I want to communicate with it in my game. Currently it works great going out to my server. I can see all the requests and the speed is awesome! However here comes the big issue, unity after its first run freezes. Hard nothing is responding and the editor is completely useless until I close it and open it back up. For two weeks I stopped programming because of this, it was a stopping point for me until I figured out what was happening. At first I thought it was the game and after doing some reading messed around with the settings. With my issue it had nothing to do with rending/lighting.
    It just happening to come to me last week after reading an article on threading. It was the last bit of code they gave as an example about proper closing a thread. Which got me thinking about my issue, I think unity is holding on to the upd connection and cause …

Updating to ParticleSystems In Unity3D

This article loosely based on a service I want created and hopefully will soon be published. I just thought it would be beneficial for some to know. Since I like to keep on top of things this is one of the many issue I run into when adapting other people's code. This is a huge jump from 2016 to the 2017 version of unity3d.


Using the correct enable property

Max and Min Particles
Seems to be gone

I believe the fields move to MinMaxCurve

Instead of this field on the particle system it is on the main module, so use someth…

My Orchard CMS Experience


Google Service Account with Aspnet MVC Behind A Proxy

Recently I had a fun project to attach google analytics data to an internal site which took longer complete than I thought intial thought but now I could complete in just a day. My biggest issue was finding out the issue was related to the company's proxy. Which I quickly fixed by just added the following snippet at the bottom of this article. For everything else this is just my notes and things I found to help me drill down into the queries for grabbing the data. 

Questions How to get the Access Token for GA? - Credential.RequestAccessTokenAsyncQuerying example - Use Google Analytics API to show information in C# - Stack Overflow
Behind a Company Firewall
    Both errors I encountered were "No connection could be made because the target machine actively refused it" and “requested service '…' could not be activated” the first time it's accessed".   <>     <defaultProxy useDefaultCredentials="true">       … Dynamic Sitemap.xml

This is an article I started to working for the project: rustkickers, which for now I'm putting on hold. What I was trying to do was kill two birds with one stone. If you need a good sitemap to submit to google or to create a "site map" for you users then this would do it. I haven't finished making it but there is where my notes are.

Generating dynamic XML Sitemaps in ASP.NET MVC - Ben Foster
ASP.NET MVC: Get all controllers - Stack Overflow

Resource - Example - Another example
Create a Google Site Map with ASP.NET
ASP.NET MVC: Get all controllers - Stack Overflow

Maybe create a atom feed instead of a sitemap.xml?

Diving Back into Selenium and Getting Somewhere!

Recently I've gone back to using Selenium and started to really get comfortable using it. One of the problems that I constantly face when using Selenium is not having good example and looking at Selenium as a whole in whether it is worthwhile. My problems only get work when I have to ask me whether to use the Selenium IDE or the server package.  Which is more scalable to do? Which one is better to give to a team QA that non-technical? Some of these questions can be answered on the Selenium site but some of them depend on your work environment and how much time you want to spend on creating a system of some kind to do all that.      What you really want for all project is something that you can automate across popular browsers not just a single one. Plus avoid doing a dry run every time to correct your UI tests. So the IDE which really a plugin is not going to do that for you but even if I gave it to a QA non-technical team I don't think it would be used effectively. Instea…

NPOI Does Not Support CSV

I've been using NPOI for sometime now and was recently asked to create a process to output some data in a csv for better support. I was hoping to bring NPOI in the mix but I had to ask myself does NPOI support CSV/TSV?, simply put no.


Library Version - Reading/Writing
Project Version - Server/Storage Features included.

And... There just doing it my way. Personally speaking I didn't like jumping into FileHelpers, I felt was much more overhead than what I need so I looked at creating a small snippet of code for myself. Unlike with NPOI, I also didn't like from what I could see was examples that needed a model to be passed in. Either way, I will try to post an update when I have finished that piece of the puzzle.

Returning in the middle of a using block - A question for the code examples I saw. - Response Content type as CSV
Back to Basics - Keep it Simple and Develop Yo… MVC: Partial View to handle Multiple Models

I was working on this idea a few years back and the idea was to make two partial views in an MVC more scalable. I was looking the down road for something that could handle whatever the object was and display it. What I later discovered thanks to a colleague was that I should just do a reflection of the object but I feel the better longer term solution could be found in third link of resources. Rather than spend anymore time on this idea I simply kept the two partial views and wrote this down as I have bigger plans with this strategy in mind for a project.

ResourcesUsing partial views in MVC 4 - Stack OverflowHow to get the list of properties of a class? - Stack OverflowHow to get data to my view that comes from more than one object? - Stack OverflowWhen To Use Templates vs When to Use Partial Views - Stack OverflowASP.NET MVC 3 Partial View Template - Stack Overflow