Posts

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 program's start. 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: <target xsi:type="Database" connectionString="${gdc:item=defaultConnection}" /> Rather than using GDC, which is for global static data and fails on concurrent logging, it is better to use  EventProperties-Layout-Renderer  which allows to pass of custom  properties specific to the

CSharp Cheatsheet

Owin & Katana An Overview of Project Katana | Microsoft Docs Understanding OWIN and Katana - CodeProject Data Access ASP.NET Data Access - Recommended Resources | Microsoft Docs async and parallel programming with .NET 4+ (TPL) String Modifying http://stackoverflow.com/questions/444798/case-insensitive-containsstring Entity Framework c# - Dynamic filtering and sorting with Entity Framework entity framework - Code-first vs Model/Database-first Entity Framework Code-Based Configuration (EF6 onwards) Performance Improving http://stackoverflow.com/questions/30816496/why-do-local-variables-require-initialization-but-fields-do-not c# - Will using 'var' affect performance? http://blog.slaks.net/2015-01-12/linq-count-considered-occasionally-harmful Miscellaneous: (will clean up later) https://msdn.microsoft.com/en-us/library/bb964711.aspx?f=255&MSPPError=-2147217396 concepts https://stackoverflow.com/questions/2220134/displaying-a-pdf-file-from-winf

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

Image
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. Notes -  https://www.gamasutra.com/view/feature/131565/building_an_advanced_particle_.php Using the correct enable property -  https://docs.unity3d.com/ScriptReference/ParticleSystem.EmissionModule-enabled.html Max and Min Particles Seems to be gone -  http://answers.unity3d.com/questions/1136597/changing-particle-emission-rate-via-c-script.html I believe the fields move to MinMaxCurve -  http://answers.unity3d.com/questions/1395242/particlesystem-does-not-contain-a-definition-for-m.html -  https://docs.unity3d.com/ScriptReference/ParticleSystem.MinMaxCurve.html ParticleSystem.startLife Instead of this field on the particle system it is on

My Orchard CMS Experience

Image
Introduction This post is just to document my experiences with Orchard CMS and to list some of the resources that I used while developing a orchard module. I will go back through later and clean this post up but for now here is the code that I created with a previous employer. Github Resources sadomovalex's blog: Hide content type fields in Orchard CMS Orchard Project - View Discussion orchardcms - Orchard CMS: Right way to get field value from view? - Stack Overflow orchardcms - Orchard CMS module that uses HTTP session state - Stack Overflow Dynamically switching the theme in Orchard - Tales from the Evil Empire Let’s Install an Orchard “Module” | Ponderings - Various Topical  Thoughts by Brad Kingsley Custom Orchard Module that Plays HTML5 Video with Flash Fallback - Orchard CMS Development Accessing and rendering shapes - Orchard Documentation Packaging and sharing themes - Orchard Documentation Creating custom content type

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? - C redential.RequestAccessTokenAsync Querying 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 172.217.1.77:443" and  “requested service '…' could not be activated” the first time it's accessed ".   <system.net>     <defaultProxy useDefaultCredentials="

Asp.net: 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 http://www.robtennyson.us/post/dynamic-sitemaps-with-aspnet-mvc  - Example http://blog.divergencehosting.com/2009/04/01/dynamic-create-google-sitemap-aspnet/  - Another example Create a Google Site Map with ASP.NET ASP.NET MVC: Get all controllers - Stack Overflow http://msdn.microsoft.com/en-us/library/yy2ykkab(v=vs.100).aspx Maybe create a atom feed instead of a sitemap.xml? http://weblogs.asp.net/seanmcalinden/create-rss-and-atom-feeds-using-custom-asp-net-mvc-action-results-and-the-microsoft-syndicat

Diving Back into Selenium and Getting Somewhere!

Image
     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

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. Alternatives http://filehelpers.sourceforge.net/ https://github.com/MarcosMeli/FileHelpers 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. Resources Returning in the middle of a using block - A question for the code examples I saw. asp.net - Response Content type as CSV Back to Basics - Keep

Asp.net 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 asp.net 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. Resources Using partial views in ASP.net MVC 4 - Stack Overflow How to get the list of properties of a class? - Stack Overflow How to get data to my view that comes from more than one object? - Stack Overflow When To Use Templates vs When to Use Partial Views - Stack Overflow ASP.NET MVC 3 Partial View Template - Stack Overflow

Popular posts from this blog

UI-Bootstrap Collapsible Sticky Footer

Installing Windows on Acer chromebook 15 cb3-532

Aspetcore: NLog with Postgresql