In my UOW class I have the public property ProductRepository. Now my idea was instead of creating a public property for every repository that I have, I created the generic method GetRepository<T> to dynamically create repositories.
Do you think that this change will have bad side effects. I think that it will improve the maintainability of the code.
I am currently trying to send a x264 nal unit using WINSOCK with a reliable multicast socket. It isn't decoding properly, and my initial thought is I am not receiving all the bytes correctly. I was hoping some fresh eyes can provide insight on errors or any improvements. I have seen some topics about this subject, and they showed sending entire structs with the socket. However, I am concerned about endianess so I am trying to stay away from that approach. I have commented out the decoding part, until I am confident that I am receiving the nal unit properly.
Code: //needs to copy it so that if its a function call it only does it once #define assertNAN(type, one) { type val = (type)one; std::string lag(#one); lag += " not a number";
[Code] ...
I am compiling with -DNDEBUG -O3 -ffast-math -fexpensive-optimizations to simulate a production environment. Is there a way to test for NAN consistently?
I have function that returns historical data. I can access it, using file name. If I use file name, it reads that file and saves it to dictionary, so that in the future, if historical data is required for the same file, it does not read it again (it's lazy loading). If no file is supplied to the function, it tries to read file which is given in app settings.
However, for unit testing, I do not want to read any file. Instead, I want it to use small sample of hardcoded historical data. In order to do that, I think, I need to introduce interface to it. Then I can use some IoC to choose between different implementation for unit testing purpose and ordinary launch of application.
Function to get history is given as follows:
public static class Auxiliary { private static Dictionary<string, MyData> _myData; public static MyData GetData(string fileName = null) { // ... } }
I have created default Unit Test project with Visual Studio so, as far as I know, by default it uses MSTest as test runner and MSUnit as unit testing framework but it does not have any IoC container so I should manage NuGet packages for solution and install Unity.
As far as I know, MSUnit (aka Moles) can unit test static methods (it's unconstrained isolation framework, like Typemock Isolator, unlike NUnit) but still many people suggest not to use any static methods for unit testing.
Should I use shim or stub [URL] Stubs should be used for faking external dependencies and here it is not external library, but my own code.
I'm new to c++ and boost library also. I need to test a function of my library. For example
// Functions.hpp int add(const int x, const int y); //Functions.cpp int add(const int x, const int y) { return (x + y); }
Now i need to test add function using boost. I need the result or output in below style. What all settings do i need to do in VS 2010 and how i should include boost test in the project.
==== Run unit tests ==== Running 2 test cases... ./mytest.cpp(13): error in "SimpleTestInMainTestingModule": check 1 == 2 failed Test suite "Master Test Suite" failed with: 1 assertion out of 2 passed 1 assertion out of 2 failed 1 test case out of 2 passed 1 test case out of 2 failed
I am trying to write a unit convertor for converting temperatures Celsius, Kelvin and Fahrenheit.
Code: if (select_one == 't' || select_one == 'T'){// this one works perfectly... //This section does not tell you the use of variables. //The use of variables can be seen as comments in the main program
[Code].....
This part of code will be part of a larger Unit Converter program. Do you think this method of conversion is wise? The error codes are for debugging use only.
I convert all temperatures of all units, whether Celsius, Kelvin or Farhenheit into Celsius and then convert it into the units the user wants.
I need to sort this and I know how to do it. But I need to sort it again with the highest value in the first row and keep all information in that row paired with the name . So
Lincoln 120 300 400 Parks 100 500 250
Parks 100 500 250 Lincoln 120 300 400
I need so swap this whole rows. I'm using dynamic array. So my question is Do I have to do a bunch of temps to move them? Or is there a way to move the whole int array row as a single unit?
I've been working on this code that should be looking like
1 3 5 3 1 3 5 7 5 3 5 7 9 7 5 3 5 7 5 3 1 3 5 3 1
but mine appears like this
1 3 5 3 1 3 5 7 5 3 5 7 9 7 5 3 3 5 7 9 1 3 1 3 5
This is the code I've got for now, I just don't know which logic I need to fix
int main(){ int r; cout << "Rows?" << endl; cin >> r; for (int i = 1; i <= r; i+=2){ for (int j = i; j <= r+i; j+=2){ cout << j<< " "; } for (int k = i+2; k >= i-1; k-=2){
I'm trying to output a pattern using loops. The pattern is a plus symbol made of 3 rows of 5 x's followed by 3 rows of 15 x's and finally 3 rows of 5 x's.
I can get the program to output all 9 rows with 5 x's but I don't know how to do the 3 rows of 15 in the middle. I have tried a while loop and also an if statement but nothing seems to work.
i have a .txt file with a bunch of numbers(1...99), millions of them, and i would like to make a program that recognizes patterns(if exists, i don't know) of numbers in this file. What will be the starting point? How could i do that? I read i could do that with Neural Network. Is there other way?
I am looking to write a program that, given a particular word, looks at a plain text document and gives a list of words that appear within x words of the given word along with a count of how many times it appears.
Do I need to use regex to do the pattern matching here? Is there a particular data structure that I should use that is particularly suited to a task like this? I don't want to reinvent the wheel, it seems like there should be libraries that would already do this sort of thing but searches have turned up nothing.
So, I'm going to write a recursive function for a asterisk pattern but I'm stuck figuring out how to create a stopping case for it, better yet, I'm unable to describe the pattern completely.
* Every odd row has 1 * with 1 incremented white space
* Every "pair" of asterisks equals 8 total (EX. 8 one pair *'s, 4 two pair *'s, 2 four pair *'s)
Unfortunately, that's all I got. how I can represent this as I function. Once I figure out what my stopping case should be, I think I can do the coding on my own.
I am working on some coursework for university at the moment, and one of the questions asks me to 'write a function that will generate the following pattern using nested looping techniques.'
#include <stdio.h> #include <stdlib.h> #include <iostream> using namespace std; class singleTon {
[Code] ....
this is a singleton pattern first,it doesn't matter, why I could delete this pointer twice?because the gcc compiler?That mean in the surface, "delete pInstance1;" this movement just mark the memory pInstance1 has been deleted but not real?does any one encounter this phenomenon?