Posts

design - What is the use/advantage of function overloading? -

फ़ंक्शन ओवरलोडिंग का उपयोग / लाभ क्या है? उदाहरण के लिए ओवरलोड: (अच्छा) फ़ंक्शन व्यक्ति [] FindPersons (स्ट्रिंग नेमऑफ़र्स) {...} फ़ंक्शन व्यक्ति [] FindPersons (तिथि की तारीख OfBirth) {...} फ़ंक्शन व्यक्ति [] FindPersons ( Int age, string dogsName) {...} 'विशिष्ट नाम' फ़ंक्शन के लिए बेहतर है: (खराब) फ़ंक्शन व्यक्ति [] FindPersonsByName ( {...} फ़ंक्शन व्यक्ति [] FindPersonsByDOB (तिथि की तारीख OfBirth) {...} फ़ंक्शन व्यक्ति [] FindPersonsByAgeAndDogsName (int age, string dogsName) {...} इस तरह से सांकेतिक शब्दों में बदलनेवाला एक क्लाइंट लिख रहा है जो इन कार्यों को कॉल / खपत करता है एक उच्च स्तर की वैचारिक सोच ("> स्थिर टाइपिंग के साथ, उपयोग पैरामीटर के आधार पर लागू अधिभार से मेल करने के लिए कंपाइलर को छोड़ दिया जाएगा। डायनामिक टाइपिंग के लिए, यह समान मैच अप रन टाइम पर होगा, संभवत: असफल हो जाने पर कोई उचित मिलान नहीं मिलता है।

c# - Multiple cleanup actions on VS2008 Unit Testing -

The questions are very easy and I should know how many cleaning tests should be prepared. I have some tests, and each test creates a separate file, I want to bind the cleaning action for each, so I can delete the specified files for each test. Example: [TestMethod] Public Zero TestMethodA () {// do stuff} [TestMethod] Public Zero TestMethodB () {// do stuff} [TestCleanup] Public Zero CleanUpA () {// Clean A} [TestCleanup] Public Zero CleanUpB () {// Clean B} Any ideas? Potentially, there are some options that I can see. A simple solution that can work for you, should be a class-level variable in your unit test class that stores the path of the file used by the current performance test. Each test provides that current file path to that variable. Then you can use a cleanup method that uses that variable to clean the file. There is another idea, but a significant refactoring may be required, instead of using a dependency-injection approach, your code from the abstract...

C optimization question -

I think the fastest way is to write some code I have a loop that connects in ints is. The loop will be executed several times, and so I have tried to compare it to check whether any operx is zero, so they should not be added as they are: If (work1 == 0) {if (work2 == 0) tempAnswer = toCarry; Else tempAnswer = work2 + toCarry; } And if (work2 == 0) tempAnswer = work1 + toCarry; Else tempAnswer = work1 + work2 + toCarry; I believe that if the nested is already an optimization on the top, then it & amp; Amp; Amp; Amp; Amp; Amp; And compared with writing a series of comparisons, because I (task 1 == 0) more than once. Unfortunately, I will not be able to say how many times the work 1 and work2 are zero, then assume that it can be balanced distribution of every possible outcome of the IF statement. So, in that light, the above code is more than just written tempAnswer = work1 + work2 + toCarry or because of all comparisons, there are many drages? Thanks This is ...

javascript - embedding a website inside a modal box on a different domain -

I need to embed an iframe on a different domain, when click on a model box that opens using the fancy box . This will do something like this. The user clicks the image once loads a model box (FCBOX) which holds the iframe I need to do this because the faxbox needs to be taken on the screen 960x700 in majority How do I do this? Some should like it to see how to use it for more information & lt; Html & gt; & Lt; Top & gt; & Lt; Script type = "text / javascript" src = "http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" src = "http://fancybox.net/js/fancybox/jquery.fancybox-1.3.1.pack.js" & gt; & Lt; / Script & gt; & Lt; Link rel = "stylesheet" type = "text / css" href = "http://fancybox.net/js/fancybox/jquery.fancybox-1.3.1.css" media = "screen" /> & Lt; ...

c# - Shorthand for instantiation and initialization using an extension method -

Is there any cloak to use the extension method to instantiate and start an object? My goal is Example: // ... Completely code the code needed to cover the appropriate code for the client It is necessary to start and get started. Code - I want to avoid the construction of tap example MyType t = null; T = t. Gate test instances (); // ... // extension method public stable class MyTypeExtensions {public static MyType GetTestInstance (this MyTypeT) {var ctorInjectedDependency = blah; Return the new MyType (ctorInjectedDependency); }} Perhaps something similar will be to your needs: Public Class MyType {Public MyType (string S) {property = s; } Public String Property {Received; Set; }} Public stable class MyTypeExtensions {Public static object GetTestInstance (thus type) {var ctorInjectedDependency = "blah"; Var ctorInfo = t.GetConstructor (new [] {typef (string)}); Return ctorInfo.Invoke (new object [] {ctorInjectedDependency}); } GetStateInstance Public Relat...

What does container invalidation in C++ mean? -

I have learned about the term invalidation in the context of C ++ Containers Can explain what that means? It seems that while looping over the container, the elements of any container are not allowed to be modified. Thanks, Boda Sido "itemproc =" text "> Containers are not invalidated - Iterators that refer to container elements are invalid. / P> An Iterator A special item is the Iterator valid within a container, as long as the item stays inside the container and the container does not rearrange itself internally, when one of two things happens , Then an Iterator becomes invalid, because the left The medicinal Iterator is no longer valid as a handle in the container. The most obvious way to invalidate an erratator is by removing its referenced item from the collection, example: std :: set & lt; int> s.insert (4); s.insert (2); std :: set & lt; int & gt; :: iter itr = s.find (4 ); // IRR 4 Stud :: COAT and LT; A more subtle way ...

c# - How can I Insert/Update into two related tables in one command? -

Data_t: DataID is the primary key that identifies 1, A database exists with two tables Data_t: 1. Apart from this, another field is 'LEFT' TINYINT Data_Link_t: DataID PK and FK where DataId exists in data_t. Apart from this, another field 'Right' Smallling Coming from the Microsoft Access Environment to C # and SQL Server I am looking for a good method to import a record in this relationship. . is included in the record, which is included in both sides of this conjunction (possibly up to 5000 records to be put up / update at a time) in any type of LINQ list type order the whole batch is processed Bonus to do, but even if it is recorded by record, the main goal is that both parties of this record should be processed in one step. Countless approaches and I am seeing a lot of people how should I go so that I thought faster to ask ordinary people. Is LINQ the option to add / update a large list of LINQ to SQL? Should I record by record? What approach shoul...