.status-msg-wrap { display: none; }
Saturday, June 30, 2018
no image

Change App.config based on configuration build?

I have a console application that can be run against 3 different urls (dev, it, prod), I need to change certain settings based on the environment I’m running it in. My project currently has 4 config files (app.config, dev.config, it.config, prod.config), and obviously the only one that matters when I build is app.config. Currently I have to copy and paste from environment to app.config, I know such a complicated task.

Is there a way to set up 3 configurations and use the respective config file and automate this tedious task?

Change App.config based on configuration build? Click here
no image

Toolkit to improve .Net application performance

We have a massive WinForms project with pretty serious performance issues:

  1. Load times
  2. LINQ-to-SQL (potential abuse of)
  3. Etc.

If a mid/senior level developer on our team were to embark on a 3-6 month project to diagnose and potential tune the application, where would they start? Reading CLR for C# seems to be a good start, and maybe even using ReSharper's code analysis suite. Any papers, books, core CS topics to add to this toolkit would be helpful.

Toolkit to improve .Net application performance Click here
no image

Help converting Chrome request output to .NET POST using HttpClient

I am trying to post to a 4chan-like imageboard using .NET. Since the imageboard software offers no API, I want to build the POST manually using HttpClient.

To begin, I opened the Network tab through the dev console in Chrome. I then made my post through the web page like I normally would by entering the text in the textbox and clicking the submit button. The idea is that I can look at the request as sent through Chrome and then write .NET code to build new requests with parameters I pass in. However, it turns out to be more complicated than I thought.

Can anyone provide some starter code that builds the below request using System.Net.Http.HttpClient? I am not expecting anyone to do the entire request message, just the distinctly differently components. I could build the rest.

Here's the request message output as copied directly out of Chrome:

https://pastebin.com/14qVn2Pg

Had to use pastebin because Reddit's text formatting sucks.

Help converting Chrome request output to .NET POST using HttpClient Click here
no image

Dynamic Multiple GroupBy

Is it possible to use Expression Tree to build a group by and select like this?

var results= persons.GroupBy(n => new { n.PersonId, n.car}) .Select(g => new {label = g.Key.PersonId + g.Key.car, total = Sql.Count("*"))}).ToList(); 
Dynamic Multiple GroupBy Click here
no image

Fresh witness of useless complexity and over engineering.

Yesterday, I witnessed the introduction of useless complexity in a project at work.
I won't go into details. The initial intent was to eliminate the need of changing/adding multiple code pieces when adding a new project specific class.
The first idea was plain OOP but you had to manually "sync" the constructor declaration with what a method returned, in the same class.
In the desire to make it even more fool proof, in next half of hour we've thrown in enums, reflection, helper classes, explicitly resolving the dependencies using the DI container and at the end one still had to manually "sync" something in two places.
I voted for the first approach but the second was the chosen solution.
I remained calm. I still am. I just want to know if there are other devs that think the same of this, or I am not seeing stuff clearly.

Fresh witness of useless complexity and over engineering. Click here
no image

Databaseless CMS for dotnet. Is there such a thing?

Hello there,

I am looking to setup a basic website. For personal use. I am not all that experienced with websites. I have used and really like Umbraco, however I really don't want to go to the effort of maintaining a database and all the troubles of syncing production copies of databases and things like that....its just overkill complexity...

What I would really like is a flatfile cms similar to something like grav. But then I run into the complexity of getting PHP to work....

Any advice or thoughts would be appreciated Thank you

Databaseless CMS for dotnet. Is there such a thing? Click here
Friday, June 29, 2018
no image

AWS Elastic beanstalk with sqlite

I have made a couple of asp.net core 2.1 apps with sqlite DB's.

I needed a place to host them and am using ASW elastic beanstalk. It works, and its free. However I was told that when you update your site the sqlite db gets overwritten. What do I do with the db's not to lose the data in them?

How can I hold them outside of the container and access them?

Cheers

AWS Elastic beanstalk with sqlite Click here
no image

.NET Core 2.1 SDK - x64 or x86 installer?

My OS is x64 and deployment will be 64-bit, so the x64 installer seems obvious. However, since VS 2017 runs as an x86 app, I'm second guessing myself on which to install. Any guidance?

(Also, why isn't this part of the VS 2017 update?)

.NET Core 2.1 SDK - x64 or x86 installer? Click here
no image

Any good .NET licensing solutions with a .NET Core license generator?

We have been using CryptoLicensing (and Crypto Obfuscator) with good success for our .NET WinForms based apps. However, we're looking to move to a serverless solution which requires the need for the generator to be moved into a .NET Core app. Unfortunately, the author of these libraries have no plans on moving to .NET Core (which I think is a big mistake).

Having said that, we are looking for a licensing solution that can still license full on .NET Framework WinForms apps, but that has a licensing generator component written in .NET Core.

Alternatively, we are open to a cloud based licensing solution, but we have so far been unimpressed with the features and pricing of existing services.

Any good .NET licensing solutions with a .NET Core license generator? Click here
no image

insert picture to SQL and display in gridview

Hi,

I hope this is the right subreddit for the question i'm about to ask.

I'm trying to make a webform site where i can manage my schools lockers to see which student who has a locker. The only problem i have is that i have no clue on how i can upload pictures into my SQL server and display it in the gridview.

I don't want the pictures pre added in the sql server and i should be able to delete the picture when the student does'nt have the locker anymore.

I know i'm missing somthing, but i don't know what.

I have tried google and i have no clue on how i can code it. I have pasted my SQL, .aspx, aspx.cs code in pastebin, if you want i can paste it here.

SQL: https://pastebin.com/qQ7P3Rba

aspx.cs: https://pastebin.com/EJiMzRsp

aspx: https://pastebin.com/xMbvuThN

I hope you can help me complete my project! Thanks

insert picture to SQL and display in gridview Click here
no image

VB.NET Online radio question

I created a simple online radio with VB.NET. I placed an Windows Media Player tool and load each url link on it. My issue is that couple of the links don't load

Working -> http://ample-02.radiojar.com/k0hua7u1yk5tv?

Not-working -> http://stream.radiojar.com/enlefko877

is there any difference between them? how do i steam the not working links? When i test them on Chrone, both work normally. On IE the not working url tries to download a streaming file (.partial)

any help?

VB.NET Online radio question Click here
Thursday, June 28, 2018
no image

Razor Pages and Json help

Hi! I created a simple project where a user fills a form and when she submits it, there is a logic that creates a URL that access an external API and obtains a list of items, that could go from 0 to over 250 items. That result is sent in JSON and I deserialize it to show in a different page. I am able to do that easily using ASP Net Core MVC.

Now, I am trying to update this project to learn Razor Pages, and it's not working.

That's the code I use in my MVC's controller:

[HttpPost] public async Task<ActionResult> Resultado(string urlJson, int ? precoMax) { HttpClient httpClient = new HttpClient(); var resultado = await httpClient.GetStringAsync(urlJson); Produto.Rootobject produtos = JsonConvert.DeserializeObject<Produto.Rootobject>(resultado); return View(produtos); } 

This is sort of what I think it should be in Razor Pages:

 public async Task<IActionResult> OnPostAsync(string urljson) { var httpClient = new HttpClient(); var resultado = await httpClient.GetStringAsync(urljson); Produto.Rootobject Produtos = JsonConvert.DeserializeObject<Produto.Rootobject>(resultado); return RedirectToPage("ListaSugestoes", Produtos); } 

It doesn't work, or, I am doing something wrong. Any help would be greatly appreciated.

If the conclusion is that Razor Pages is not ready for my project, fine, I can live with that!!

Razor Pages and Json help Click here
Wednesday, June 27, 2018
no image

Span & Memory Help! What Are The Pitfalls?

Been studying these new structs and experimenting with them.

Is there a simple list of common pitfalls when using these?

I've been converting a lot of my code to use them where it makes sense, but I feel very uncertain about the results.

When is it better to simply use an array instead?

Span<T> & Memory<T> Help! What Are The Pitfalls? Click here
no image

A cross-platform, fully-managed configuration file reader/writer

I have recently created a cross-platform, fully-managed configuration file reader / writer
It's still 0.2.x version, so pretty unstable, but it already has some great features (listed below)
I would like to have some feedback from the community. Feel free to open issues, create PRs etc

Customization

  • customizable encoding (most encodings can be auto-detected)
  • customizable culture
  • customizable number styles (e.g. currencies, exponential notation etc)
  • customizable line endings (usually auto-detected)
  • customizable true and false (e.g. "verum" / "falsum" )
  • customizable comment characters
  • customizable key/value separator (defaults to '=')

Read and preserved

  • file header comments
  • config files with no sections (like in this [SectionName]) or even mixed: first section has no header, just keys
  • comments in general
  • section comments
  • empty lines
  • indented sections
  • indented keys
  • indented values

Values

  • default values
  • multi-line values (both quoted and not)
  • quoted values
  • null values (value-less keys)
  • array values
  • fancy float / double
  • byte-encoded values
  • smart boolean values (0/1, on/off, enabled/disabled work of the box)
A cross-platform, fully-managed configuration file reader/writer Click here
Tuesday, June 26, 2018
no image

user management with Webforms

Hi,

Can anyone help me with a webforms project that includes SQL access, I want to create a webform project where I can create people and add pictures in a form. I should be able to edit, delete and be able to search for each individual. A login site should be the first thing I see when I access the webpage.

I don't expect it to be free so i'm willing to pay a little for the help :-)

user management with Webforms Click here
no image

How good you guys are in Javascript ? Do you feel threatened by JS in the backend ?

1) How good you guys considered yourself to be in Javascript compared a frontend JS engineer who do just that ?

2) Do you feel threatened by JS in the backend because you can use 1 language everywhere node etc

3) Do you think .Net still can compete or its "behind the curve" compared all the JS frameworks ? cutting-edge, features, speed etc that kind of things

4) Do you guys see yourself programming different things in 5-10 years in another field outside of webdev like database or using another language like Java, Js or even going native with C++ ?

How good you guys are in Javascript ? Do you feel threatened by JS in the backend ? Click here
Monday, June 25, 2018
no image

Use entity framework 6 with asp.net core mvc?

We are working on migrating an ASP.NET MVC 5 app to ASP.NET Core MVC, and I'm wondering if we can simplify by continuing to use Entity Framework 6, for now. Will this cause problems when using Identity?

Should we instead convert to entity framework core first, then later migrate ASP.NET MVC to Core?

Use entity framework 6 with asp.net core mvc? Click here
no image

Metro UI

Could anyone recommend some good tutorials or sites where I can get more help with designing good looking modern UI? Thank you

Metro UI Click here
no image

Compiling to MSIL and Native code?

Is there a programming language compiler that compiles both to MSIL (.NET bytecode) and to native code. The customer wants me to write a .NET application for Windows and native applications for Linux and Mac OSX. And I want to share as much code as possible. The native code compiler should generate native standalone executables without some hard to install dependencies.

In the perfect situation I want something like Kolin (which compiles to Java bytecode as the first class platform, but also have native code backend which is called Kotlin Native).

What I found so far: 1) Haxe (compiles to C# and C++) - it may work, but has a very small standard library. 2) RemObject Oxygen (compiles to MSIL and native code) - cool take on Pascal language family, but not free and not opensource. 3) F* (compiles to F# and OCaml) - seems to be interesting language with a lot of features I don't think I need.

What other options do I have?

Compiling to MSIL and Native code? Click here
no image

Help with google search API

I want to use google's API. I got a key and a custom ID, but i don't know how to use them. I have not found any example on vb.net, could someone guide me through?

Thanks a lot

Help with google search API Click here
no image

Best way to handle high CPU requirement?

I have a process which checks and processes a large number of domains for various stats. It involves http calls and is run multithreaded. The bottleneck is clearly CPU, the IO is not the bottleneck.

I am using Task.Run() and SemaphoreSlim to manage the threading. Each thread makes a http call and then awaits the response before carrying on processing which keeps threads open a while, in some cases up to 60 secconds.

The process takes about 30 days to run. I want to get that down under 7 days so I need to improve my code but also balance the load across several servers.

Can anyone suggest a pattern I should be following?

I am not sure if .net automatically optimizes the async/await threads or if what I am doing is poor performance and there is ways to gain performance boosts.

I need to get this process running over multiple servers but I am really not sure how to do that. Only way I can think to do it is to duplicate my API on multiple servers and share a database. These feels messy though and more work to maintain. I realise I could use App Services and scale up the instance but that would be outside of my budget.

Is there some way to setup some sort of .net core processing cluster that I can hook up a load of servers to? I feel like it must exist I just lack the terminology to find it on Google.

Any help appreciated.

Best way to handle high CPU requirement? Click here
no image

DllImport in Dot Net Core

I've been looking into using DllImport in Dot Net Core and it seems that it does not as of yet support resolving the native library automatically. I did find this issue that's been covering the problem: https://github.com/dotnet/coreclr/issues/930

But the suggested solution to use an assembly load context seems like it won't work with assemblies that are loaded automatically, and there are no examples that show it being used for anything like this.

Does anybody know if there has been discussion about this problem outside of that issue, and if a solution is being developed?

DllImport in Dot Net Core Click here
no image

Custom url shortener for .net

Hi guys, do you know any libraries that shortens url/customize short url for .net? I want something like: `https://son.ny/arg1/arg2\` then redirect this in the specified web page.

If there's nothing you can recommend for .net, feel free to suggest any libraries like javascript.

Custom url shortener for .net Click here
Sunday, June 24, 2018
no image

Asp.Net Core - gather data from Partial Views

Hi everyone,

I have complex object with multiple nested objects that I want to display to user and let him fill the data. It looks something like this:

  • frequency (int)
  • requester (object)
    • name (string)
    • age (int)
  • ...

I created controller and added view -> it has only the frequency field (becuase other fields are objects). This works, editing frequency sends data back to controller. I've added other partial views and included them into the main view - but data from partial views do not send back into controller (or I'm unable to get the data). I've asked on Stack Overflow, but I've got no response. Could you please look at it? I have more details and code in there.

Thank You!

Tl;Dr: I have view. I can get data from it. I have nested partialView in that view. I cannot get data from it. How can I get data from it?

Asp.Net Core - gather data from Partial Views Click here
Saturday, June 23, 2018
no image

Encrypt & Compress

Hello all,

I currently compress some data and then encrypt it and the result is ok, but I was wondering if anyone knows of a specific library or logic where you do a unified action of encrypting and compression, where the encryption takes into considering the concept of the compression?

Thanks!

Encrypt & Compress Click here
The webdev Team