Tag Info

New answers tagged

3

The quality of speech recognition depends on many parameters: Microphone: as you noted, a headset microphone is better than the one in your laptop. Studio microphones will give the best results, I imagine. Environment: you'll have hard time making speech recognition work in a noisy environment compared to a quiet one (ideally a studio). Pronunciation: for ...


1

It depends if your versioning problem is a compile-time or run-time problem. For instance, you might want to be able to support a legacy message format in your API. That's a run-time problem because both code paths are still available within your application and can be called arbitrarily. It requires a run-time solution: DI, ifs, delegates, etc. They are ...


3

I'd avoid having separate code bases. All that branching and merging creates lots of unnecessary maintenance work. Even worse when they get out of sync it becomes hard to determine which differences were intentional and which by mistake. I prefer replacing #if preprocessor directives by ordinary if statements, that way all variants of the code need to ...


6

You original question seemed to reflect a misconception - one of top 10 false assumptions about OO: the belief that object orientation will imply more code reuse and less duplicated code. That is a fallacy! If you have devs who care for DRY code, care for reuse and who have learnt and understood OO principles, they can use the latter to build better, more ...


0

You might be best served by letting the apps pull the information rather than pushing it out -- that is a much simpler model as all you need to do is expose an API. The default choice in 2014 is probably an RESTful ASP.NET web api but there are tons of options depending on what you are doing. As for the push model, MSMQ is a pretty raw tool but it is ...


1

You don't need to specify the interface again since the base class already implements it, it is redundant to add it again but it shouldn't harm anything either. I also don't know why they are explicitly implementing the interface instead of overriding the existing virtual methods which already implement the interface.


5

IndexOutOfRangeException and NullReferenceException should be thrown by the runtime. If method, which includes an indexer, validates its parameters, it should throw ArgumentOutOfRangeException and ArgumentNullException instead. The built in collections, such as List<T> do this: Exceptions: ArgumentOutOfRangeException -- index is less than 0. ...


0

I think that you should separate enumerating over files and handing each particular file. There already is an interface in .Net for enumerating: IEnumerable<T>, so I would use that. That leaves working with a single file: that would look pretty much like your IFileEnumerator, except with the enumerator parts removed. I also don't think that opening ...


0

Typically, the DAL has no knowledge of the BLL. Think of it this way, a different application with a different BLL could use the same DAL. A Payables application/module and a Receivables app for the same company would share data (clients, charges, payments, etc.). Trying to have one DLL have knowledge of more than one BLL would be very difficult and ...


-1

Its better that you make DllCustomer be the superclass of BllCustomer to solve your connundrum So here is how your code would look like: class DllCustomer { //Database CRUD Operations } class Customer extends DllCustomer { //All the customer related logic } So you can pass around the Customer object around c = Customer.find_by_id(1) //method ...


0

No, it is not better than casting to int (in my opinion). In your specific example, dr["DiskGroupNum"] returns type object, which means that your second example: int field1 = (int)dr["DiskGroupNum"]; You are actually unboxing the object to type int, which will give you an InvalidCastException if it's not exactly of type int (Int32 specifically). Why I ...


1

Actually, I would go with a third option. Retrieve the column ordinal up-front and use the ordinal overloads. In any case where you have multiple rows, it saves work: var ord_field1 = dr.GetOrdinal("field1"); while(dr.Read()) { ... var field1 = dr.GetInt32(ord_field1); ... }


7

There is a fundamental difference here. In one case you say, "I'm going to just assume this is an int", and in the former, you ask the reader to give you an int. If the value is already an int, I would not expect any difficulty. However, what happens when the value is a Int64? You're casting it to an int which is only 4 bytes long. You may get ...


0

Using Nuget for library dependencies goes a long way toward dependency declaration and isolation. The packages.config associated to each project can be read as a dependency declaration. If those package references are marked 'private', they are bundled into the bin folder of your build outputs, and are presumably bundled for deployment. This avoids the ...


0

What if instead of using an interface I create an abstract class with abstract methods of each of these steps which concrete classes have to implement Yes. An interface does not tell how the methods interact or how to process. That is just one technique for dependency injection. Part of the problem is acquiring the list of files can be a long ...


1

Okay, in the meantime I've invested additional time and made my own study on the topic. Findings: checking through Object inspector how properties containing word "Items" are declared in existing libraries reveals somewhat a surprise – I found every form: array, collection, list and custom types dominant types are these two: collections (generic or ...


3

With modern .NET / C# we try to use generics. Check out System.Collections.Generic namespace I recommend List<T> until you find something it doesn't do for you. If you need random access of more than 3 values, go with a Dictionary<K,T> For a small number of values where you always know where they are, you can use Tuples (such as a 3D ...


5

For a property that with string values like that, I would have: List<string> KnownHidScanners = new List<string>(); However, if you're going to expose this property externally as an API, there is: ICollection<string> KnownHidScanners = new List<string>(); or more appropriately is to create your own type that inherits from ...


3

SignalR might be a good candidate if you don't need guaranteed delivery, and you're simply looking to periodically send relatively small amounts of data to/from N* clients and servers (e.g. real-time dashboard, instant messaging, multiplayer game, etc...). It can also scale quite well using backplanes (currently supports Redis, Azure Service Bus, SQL Server, ...


1

I've been using Rebus which makes it pretty simple to push messages between applications. It is a .NET library that sits as a layer on top of an underlying transport layer, which could be MSMQ, RabbitMq, or something else. It does support publish/subscribe. In the case of MSMQ, this is simply implemented that Rebus handles publishing the message to multiple ...


0

For windows .net processes to pipe data between themselves they can do so in different ways using WCF using transport layers such as http or named pipes. Good tutorial for this: http://tech.pro/tutorial/855/wcf-tutorial-basic-interprocess-communication Another question you may find helpful: ...


3

One solution would be to publish the information via UDP. Open a specific port for broadcasting, send your data. There is nothing else to do on the provider/server side. On the client side, open the same port for receiving. The only downside that I am aware of with this method is that if you miss the broadcast message, you will never see it again. There is ...


4

You might be best served by letting the apps pull the information rather than pushing it out -- that is a much simpler model as all you need to do is expose an API. The default choice in 2014 is probably an RESTful ASP.NET web api but there are tons of options depending on what you are doing. As for the push model, MSMQ is a pretty raw tool but it is ...


1

Whether it's applicable to your specific scenario is a different question entirely, but writing to a text file and reading it from the other applications is probably the 'simplest' way to transfer data.


3

What about approaching the problem from the other side. You have a class, that represents that nice flow diagram of yours and this flow diagram creates "events" based on transitions. Those events then can be represented as either an interface or events: public interface IFileProcessor { void HandleFile(string fileName, Stream data); void ...


5

If you have a lot of options, figure out if you can: reduce the number. How about making an assumption instead of making something configurable? group the options together. See this answer to Is a single config object a bad idea?: If you need to change the config class you may have to visit every instance in which it is used and check that you haven't ...


0

You could use a BitArray in conjunction with static fields to provide labels for the bits: static class Flags { public static int WorkProperly = 0; public static int CompileFaster = 1; public static int AutoImproveCodeQuality = 2; } class FlagTest { static void Main(string[] args) { BitArray bits = new BitArray(100); // > 64 ...


-2

Well, Views in ASP.NET MVC are not compiled by default as part of the build process, so they remain as plain text on the server, exactly as they appear on your local. For example, if you have a view with something like: @{ Model.FirstName } Then if you open up that View file (*.cshtml) on the server, that is exactly what you will see. And changing it ...


2

The RouteConfig.cs file isn't required for Web API. It is included by default in new Web API projects because that template also includes an MVC webpage (for the index page that appears when you open the project in a browser). If you delete both the RouteConfig.cs and the HomeController.cs file (as well as modify Global.asax.cs to not call ...



Top 50 recent answers are included