Tag Info

New answers tagged

0

As it turns out, I was viewing it from the wrong perspective. I can build my webservice with any programming language I like, deploy it on some test server and test it with Fitnesse and RestFixture. No problems.


1

Exceptions have been created as a tool to signal exceptional non-fatal conditions up the call chain. That is, they are not designed as a debugging tool. If a null-pointer exception were a debugging tool, it would abort program execution right on the spot, allowing a debugger to connect, pointing it right at the incriminating line. This would give the ...


0

If you wanted to go with @stijn's answer and put null checks in your code, this code snippet should help. Here's some info about code snippets. Once you have this set up, just type argnull, hit tab twice, and then fill in the blank. <CodeSnippet Format="1.0.0"> <Header> <Title>EnsureArgNotNull</Title> ...


1

Every language has a runtime which connects your code with the outside world. In the case of Java and .NET, this runtime includes a security model. E.g. if a Java application wants to open a file, that request has to pass through the runtime. The runtime can then deny that request. Note that this is not implemented on a library level within the language, but ...


0

NuGet is still the best option at this point. The main issue with NuGet as a dependency manager is that it was envisioned to be a "development time" dependency manager, not a "build time" dependency manager. A developer would restore a NuGet package thru Visual Studio...and this could run a PowerShell script during the restore that modifies files in the ...


3

You could rewrite your code this way in a pure async/await paradigm. private async void button1_Click(object sender, EventArgs e) { int r = await longRunningWork(); textBox1.Text += (r.ToString()); } private async Task<int> longRunningWork() { await Task.Delay(15000); return (new Random()).Next(10); ...


-1

I wrote a pretty neat query object pattern for NHibernate here: https://github.com/shaynevanasperen/NHibernate.Sessions.Operations It works by using an interface like this: public interface IDatabases { ISessionManager SessionManager { get; } T Query<T>(IDatabaseQuery<T> query); T Query<T>(ICachedDatabaseQuery<T> ...


-3

Public properties and methods define an interface, a kind of contract on how the object is intended to be used. Non-public properties and methods are implementation details. You should always test the interface, and never the implementation details. Implementation may change during any refactoring, and your tests would render useless. The interface ...


0

The text appears to be centered. This approach slices the image vertically in pixel lines. Start in the horizontal middle (half the width) of the image. Convert black to 0, everything else to 1. For the convention of this answer, the left most bit shall be the one representing the top most pixel. middle vertical slice example: ...


3

Rough outline: scan your image horizontally, pixel-line wise each pixel line eithers contains only black pixels, or some white/yellow pixels: store this information in a boolean array. group the pixel line numbers together, each sequence of non-empty lines and each sequence of empty lines form a group. The non-empty line groups represent the word lines, ...


0

We're aiming to do something similar in our web-based UI project, so what you're trying to achieve makes perfect sense to me. The view model should be flat, so binding should be straightforward to achieve. In our case, we found that we are using lists of data all over our project, but there were only three use cases for the list: "select one of these ...


1

It depends. How is the result meant or expected to be used? If it should be a string (i.e. no associated json semantics), then return it as a string. If you wish to use of the facilities associated with the json data, then keep the JsonResult. If you are unsure, keep the JsonResult and let the client convert it if they require it to be just a string.


1

I recently made an implementation of the ASP.NET 5 Identity-framework which was a pain in the butt, it has its UserStore (and RoleStore) which is kind of annoying to implement. My implementation can be found here, it might give you a few ideas! This sounds sort of like the same thing. You need a base class where different type of profiles(?) can be ...


2

What should I do? Whatever you think is best. You know the requirements. You know the code. You seem to have reasonable views on what is good, what is bad, and what changes might get you. Should I use SOLID? Yes. Guidelines exist because they usually will make things better. You shouldn't adhere to it just to be "right" - you should apply the ...


3

The answer is of course "it depends," but given your use case, I would say no. Here's why: C# is a wonderful - scratch that, the best - object-oriented language around. It is so good, in fact, that I will sometimes get caught up trying to implement a fanatically purist vision of what began as a simple project. That doesn't happen to me so much when writing ...



Top 50 recent answers are included