duplication

Using the same test suite on various implementations of a repository interface.

I have been making a little toy web application in C# along the lines of Rob Connery's Asp.net MVC storefront. I find that I have a repository interface, call it IFooRepository, with methods, say IQueryable<Foo> GetFoo(); void PersistFoo(Foo foo); And I have three implementations of this: ISqlFooRepository, IFileFooRepostory, and IMo...

How to programmatically determine param name when constructing an ArgumentException?

When constructing an ArgumentException, a couple of the overloads take a string that is the invalid argument's parameter name. I figure it would be nice to not have to remember to update this ctor param whenever I change the method's param name. Is there a simple way to do this using reflection? Update: thanks to the 2 respondents so fa...

Is there some industry standard for unacceptable webapp response time?

There's a cots(commercial off-the-shelf) application that I work on customizing, where a couple of pages take an extremely long time to load for certain distributions of data. (I'm talking approximately 3 minutes for a page to load in this instance... and the time is growing exponentially). Clearly this is unacceptable but are there st...

How to choose colors in web development

When I build a site I tend to do a bit of graphic design (developer style) in Paint.NET, but how do I know the colors will all display properly on all browsers on different machines? What color depth to you generally code for? 16bit 256 colors etc. ...

How to detect duplicate text with some fuzzyness

Some thing ago, I write small script using Text::DeDupe to remove duplicates of blog posts before I have to lay my eyes on them. After reading Syntactic Clustering of the Web paper on which implementation is based, I would love to have ability to find overlapping documents (e.g. snippets of blogs as opposed to full text, maybe also quot...

Entire website hijacked! How to prevent from being hijacked?

The technical solution can be found here: Entire website hijacked! Part 2: How to configure name-based virtual hosting? The original domain is http://neteditr.com The offending copycat site is http://kitchen.co.jp After reading upon some articles it seems like this kind of website hijacking is done by proxy servers, but how in the wo...

What's the issue with vcard duplicates?

No software I've seen is able to synchronize contacts between Outlook and my cell without creating duplicates. One would think that someone had synchronization in mind when they thought up the format. Is it impossible for programmers to work around this problem? ...

Duplicate error message when validating a model

How is it possible that the model validation errors messages are getting duplicated in ruby on rails application? ...

Jquery Form field duplication

Hi there, I am new to jquery and consider myself a very novice coder at best, so please bare with me. But I think I am in need of your help! I have quite a long complicated php form, and a requirement to duplicate a set of fields. I am sure there must be a more efficient way of coding it, however I can't figure it out. There are 2 examp...

Reducing the recordset where a particular field has similar data. (MySQL)

I have two tables, 'discussion' and 'discussion_responses'. A unique ID from 'discussion' is used in 'discussion_responses' to identify the response to the original post in a forum. I created the following query to extract the posts that have NEW replies, but are NOT linked to new topics. Both tables have a field for the date added and '...

Duplicating an imported graphic in Flash

I'm loading a graphic via the Loader Class. Now I need to use it both as the original image and a thumbnail of that image. Alas, there is no "duplicateMovieClip" or anything like that in AS3 If I addChild it to the normal view and then to the thumbnail only the thumbnail is shown and vice versa. I google for this and found several solu...

Placing the same ASP.NET control in different areas of a page.

I have some code that I've inherited, and it's not the greatest in the world, but it works, with one small exception: This page is a directory search, it has controls identified by record ID, however there exists a situation where there can be more than one result with the same record ID, thus making .NET barf. I had originally impleme...

How can I recover formatting of application's info.plist in Xcode?

I duplicated default build target. Some code files are duplicated also. Problem is, duplicated info.plist file is not formatted by Xcode. I don't think this is normal. Any workaround? Or any way to specify formatting of plist? (which may format other type of .plist by my custom formatting rules) ...

Is SHA sufficient for checking file duplication? (sha1_file in PHP)

Suppose you wanted to make a file hosting site for people to upload their files and send a link to their friends to retrieve it later and you want to insure files are duplicated where we store them, is PHP's sha1_file good enough for the task? Is there any reason to not use md5_file instead? For the frontend, it'll be obscured using the...

DuplicateKeyException alternative for javax.persistence

Hi. Is there something like of DuplicateKeyException applicable to javax.persistence.*? I've found this exception for ejb lib only: DuplicateKeyException Thank you. ...

Problems using Lucene Highlighter

I am using Lucene Highlighter 2.4.1 for my application. I use the highlighter to get the best matching fragments, and display them. I make a call to a function String[] getFragmentsWithHighlightedTerms(Analyzer analyzer, Query query, String fieldName, String fieldContents, int fragmentsNumber, int fragmentSize). For example : String te...

Flash, ActionScript 3: using get/set properties to get values from other classes creates much duplicate code can it different?`

hi, i am using get and setters in my as3 code to edit values of an other class (because those variables are shared) i dont like to put stage.sharedVar.isScrabble in my code every time to change a variable so i used get/set functions see below private function get isScrabble(){return stage.sharedVar.isScrabble;} private function set i...

How can I copy clone/duplicate a folder on S3?

I want to make a copy of the folders and images on my s3 bucket for my development server. How can I do that? ...

Avoid duplication of function in jQuery

This function is written twice to save the checkbox state as well as the corresponding div text. How do I write the code in a function once and then call it twice on load and click events respectively? $(document).ready(function() { $("#bquote").load("quotes_in.php", function() { // a key prefix...

WSAEINVAL error from WSASocket on socket duplication

Hi. I'm trying to transfer socket from the one process to the another process constantly. I'm using WSADuplicateSocket on the master process which always works fine. Then I'm calling WSASocket on the child process. However, I do get WSAEINVAL error from WSASocket once in a while. I check lpWsaProtocolInfo parameter and it's always good....