instruction
stringlengths
0
30k
|oop|liskov-substitution-principle|
I have heard that the Liskov Substitution Principle (LSP) is a fundamental principle of object oriented design. What is it and what are some examples of its use?
|oop|liskov-substitution-principle|
|oop|definition|liskov-substitution-principle|
The Liskov Substitution Principal (LSP) is a concept in Object Oriented Programming that states: > Functions that use pointers or > references to base classes must be > able to use objects of derived classes > with out knowing it. At it's heart LSP is about interfaces and contracts as well as how to decided wh...
Well that (the manager bit) I can certainly understand, and sympathize with. But whatever Microsoft calls it, I don't think a "new" definition is appropriate. It's complicated, because we don't live in a 100% managed world (even though Microsoft likes to pretend that we do, Microsoft itself does not live in such a w...
a good start point, could be this [maven pluggin][1], not for use it, or maybe yes, but this maven is build over ant task. If you see WAS5+Plugin+Mojo.zip\src\main\scripts\was5.build.xml Or as said "McDowell", you can use "WebSphere Application Server (WAS) Ant tasks" but directly as ANT task. <path id="class...
> Or should I just catch the SIGPIPE with a handler and ignore it? I believe that is right on. You want to know when the other end has closed their descriptor and that's what SIGPIPE tells you. Sam
Generally you'd set the SIGPIPE handler to SIG_IGN if you think your app will ever write to a broken socket/pipe. It's usually much easier to handle the error on write, than to do anything intelligent in a SIGPIPE handler.
The best way is to make the file input control **almost** invisible (by giving it a very low opacity - do not do "**visibility: hidden**" or "**display: none**") and absolutely position something under it - with a lower **z-index**. This way, the actual control will not be visible, and whatever you put under it will...
The best way is to make the file input control **almost** invisible (by giving it a very low opacity - do not do "**visibility: hidden**" or "**display: none**") and absolutely position something under it - with a lower **z-index**. This way, the actual control will not be visible, and whatever you put under it will...
The best way is to make the file input control **almost** invisible (by giving it a very low opacity - do not do "**visibility: hidden**" or "**display: none**") and absolutely position something under it - with a lower **z-index**. This way, the actual control will not be visible, and whatever you put under it will...
The correct VC Redist package for you is part of your Visual Studio installation. For VC 8, you can find it here: \Program Files\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\vcredist_x86
Since you mentioned MFC, I assumed you have an application that would be hard to get under an automated test harness. You'll observe best benefits of unit testing frameworks when you build tests as you write the code.. But trying to add a new feature in a test-driven manner to an application which is not designed to be...
Select 1 should be better to use in your example. Select * gets all the meta-data assoicated with the objects before runtime which adss overhead during the compliation of the query. Though you may not see differences when running both types of queries in your execution plan.
I believe x509 certs are tied to a particular user. Could it be invalid because in the code you are accessing it as a different user than the one for which it was created?
Proving SQL query equivalency
|sql|oracle-database|
How would you go about proving that two queries are functionally equivalent, eg they will always both return the same result set.
How would you go about proving that two queries are functionally equivalent, eg they will always both return the same result set. -------------- As I had a specific query in mind when I was doing this, I ended up doing as @dougman suggested, over about 10% of rows the tables concerned and comparing the results,...
Best container for double-indexing
|c++|containers|stl|
What is the best way (in C++) to set up a container allowing for double-indexing? Specifically, I have a list of objects, each indexed by a key (possibly multiple per key). This implies a multimap. The problem with this, however, is that it means a possibly worse-than-linear lookup to find the location of an object. I'...
|c++|stl|containers|
What is the best way (in C++) to set up a container allowing for double-indexing? Specifically, I have a list of objects, each indexed by a key (possibly multiple per key). This implies a multimap. The problem with this, however, is that it means a possibly worse-than-linear lookup to find the location of an object. I'...
How can I override an EJB 3 session bean method with a generic argument - if possible at all?
|java|generics|inheritance|ejb-3.0|jakarta-ee|
Suppose you have the following EJB 3 interfaces/classes: public interface Repository<E> { public void delete(E entity); } public abstract class AbstractRepository<E> implements Repository<E> { public void delete(E entity){ //... } } ...
If you are using ASP.NET then you could bundle that code into a nice little UserControl that will display all of the important information. Other platforms should allow you to bundle the logic into a class object, and display it using that. It really depends on the platform that you are using to deploy the appl...
Truthfully? If you're a Java developer too, I'd lead with that. A Java developer with some experience in .NET will generally make a better impression than a VB developer with experience with Java. If you can answer questions on the difference between .NET and Java you should be in good shape. I'd also recommend you...
Reading the RDTSC is not reliable in SMP systems, since each CPU maintains their own counter and each counter is not guaranteed to by synchronized with respect to another CPU. I might suggest trying **clock_gettime(CLOCK_REALTIME)**. The posix manual indicates that this should be implemented on all compliant systems...
The key difference is in the ViewState management IIRC. The DataGrid requires ViewState turned on in order to have edit and sort capabilities.
I love C# to death, but I envy VB.NET's optional parameters. Office automation in C# is so very, very painful.
TortoiseSVN & Putty very slow
How to change the location of the netbeans settings directory (~/.netbeans)
|netbeans|
By default netbeans stores it's settings in a directory called .netbeans under the user's home directory. Is it possible to change the location of this directory (especially under Windows)?
By default netbeans stores it's settings in a directory called .netbeans under the user's home directory. Is it possible to change the location of this directory (especially under Windows)? Thanks to James Schek I now know the answer (change the path in netbeans.conf) but that leads me to another question: Is ther...
By default netbeans stores it's settings in a directory called .netbeans under the user's home directory. Is it possible to change the location of this directory (especially under Windows)? Thanks to James Schek I now know the answer (change the path in netbeans.conf) but that leads me to another question: Is ther...
The simplest form of backgrounding is: if (fork() != 0) exit(0); In unix, if you want to background an disassociate from the tty completely, you would do: 1. Close all descriptors which may access a tty (usually 0 1 2). 2. if (fork() != 0) exit(0); 3. setpgroup(0,getpid()); /* Might be necessary to prevent a S...
The function 'getWords' is doing a lot of distinct actions that could be split out into other functions. There's a good chance that by splitting it up into it's individual parts, you would have found the bug yourself. From the basic structure, I think you could split the code into (at least): * getNextWord: R...
You might want to look into whether the gflags utility (in the Windows Debugging Tools) can do this. It can do a lot of other interesting things with the heap of native applications.
have a look at mootools
jquery. ( Vote )
Sometimes there is just a plain and simple way of finding out. If you look at the internet explorer help > about internet explorer, it will tell you the max cipher bits that it supports, and on IE6 its 128.
For Eclipse 3.4 at least: click on the class so the cursor is on the class line, right click, refactor, Convert Member type to top level. Or, click on class, Alt Shift T, V.
I'm sorry I gave the wrong answer before. I rechecked, and it didn't do quite want you want. I did find a solution for you though, again, in 3.4. Highlight the class, do a copy CTRL-C or cut CTRL-X, click on the package you want the class do go into, and do a paste, CTRL-V. Eclipse will auto generate the class for y...
I'm sorry I gave the wrong answer before. I rechecked, and it didn't do quite want you want. I did find a solution for you though, again, in 3.4. Highlight the class, do a copy CTRL-C or cut CTRL-X, click on the package you want the class do go into, and do a paste, CTRL-V. Eclipse will auto generate the class for y...
What's the best hashing algorithm to use on a stl string when using hash_map?
|c++|windows|stl|hash|
I've found the standard hashing function on VS2005 is painfully slow when trying to achieve high performance look ups. What are some good examples of fast and efficient hashing algorithms that should void most collisions?
|c++|windows|performance|stl|hash|
C# 3.0: string s = new Func<string>(() => { string result; try { result = string.Parse(null); } catch(ArgumentException) { Console.WriteLine("Failed."); } return result; })();
C# 3.0: string html = new Func<string>(() => { string webpage; try { using(WebClient downloader = new WebClient()) { webpage = downloader.DownloadString(url); } } catch(WebException) { Console.WriteLine("Download failed."); ...
How do you go about validating check boxes in ASP.NET MVC?
|asp.net-mvc|validation|checkbox|
Since you mentioned MFC, I assumed you have an application that would be hard to get under an automated test harness. You'll observe best benefits of unit testing frameworks when you build tests as you write the code.. But trying to add a new feature in a test-driven manner to an application which is not designed to be...
Use my tool [git\_remote\_branch][1] (you need Ruby installed on your machine). It's built specifically to make remote branch manipulations dead easy. Each time it does an operation on your behalf, it prints it in red at the console. Over time, they finally stick into your brain :-) If you don't want grb to run c...
|tortoisesvn|putty|
does anyone have a clue why the TortoiseSVN windows client (in Win32 XP and Vista) is so incredible slow when used with Putty and PAM? It seems it connects for each request since datatransfers (checkout) are not slow at all? Any ideas how to change it? Thanks! Okami
does anyone have a clue why the TortoiseSVN windows client (in Win32 XP and Vista) is so incredible slow when used with Putty and PAM? It seems it connects for each request since datatransfers (checkout) are not slow at all? Any ideas how to change it? Thanks! Okami Update: I had no problems with SSH before....
@DAC - VB now (in .net3.5) has support for lambdas: Function(x) x.ToString() In an interview I'd say that understanding the CLR and what the code's really doing is what's important, and that you're happy to code in either (assuming that you are).
I don't think there is anything wrong with it, and I've done some similar things with PHP. If the people that make the changes are comfortable with how they do it and they can do what they need to, I think you should stick with it. There could be some retraining involved and/or a fair amount of work involved for changi...
You may be interested in [Linux FAQ for clock_gettime(CLOCK_REALTIME)][1] [1]: http://juliusdavies.ca/posix_clocks/clock_realtime_linux_faq.html
If you're working in Visual Studio 2008 / .NET 3.5, you probably shouldn't use either. Use the ListView - it gives you the features of the GridView combined with the styling flexibility of a repeater.
Both FTP and HTTP seem sufficient for your needs, so I would definitely recommend choosing the *simplest* approach, which is either to leave things as they currently are or consolidate on HTTP. Personally, I would put everything on HTTP. If nothing else, it eliminates an extra server. There is no compelling reason...
I've used this small bit of js code in a few projects, it'll do date quickly and easily along with a few others. [Link][1] [1]: http://tetlaw.id.au/view/javascript/really-easy-field-validation/
@Adam: Are you changing the file version with each build? Are you using version control (SYN or VSS) and using that information to link source back to the binaries? Seems to make sense that the Assembly version stays the same. i.e. "2.0.0.0". That corresponds to the deployment of the product. The file version c...
Issues with DB after publishing via Database Publishing Wizard from MSFT
|sql|deployment|dotnetnuke|
I work on quite a few DotNetNuke sites, and occasionally (I haven't figured out the common factor yet), when I use the Database Publishing Wizard from Microsoft to create scripts for the site I've created on my Dev server, after running the scripts at the host (usually GoDaddy.com), and uploading the site files, I get ...
There are lots of security issues around the behavior you just described so Adobe put many sandbox restrictions around file modification behavior. Even with Flash Player 10, expect a requirement that the file manipulation require that the code be executing in response to a mouse event.
How do I make an HTML text box show a hint when empty?
|javascript|html|
I want the search box on my web page to display the word "Search" in gray italics. When the box receives focus, it should look just like an empty text box. If there is already text in it, it should display the text normally (black, non-italics). This will help me avoid clutter by removing the label. BTW, this is an ...
I've been hanging on to this link for more than a year, it's an article entitled "Five great programming fonts". The five are good fonts, but the article includes comments with a dozen more interesting answers. [http://forums.programming-designs.com/viewtopic.php?pid=3338][1] [1]: http://forums.programming-de...
I don't believe it is possible to do this without some type of 3rd party clip board manager that would prevent you from overwriting the clipboard content with the empty string.
Hibernate 3: unable to query PostgreSQL database
|java|postgresql|hibernate|database|jdbc|
|java|database|postgresql|hibernate|jdbc|
I am setting up a project using Hibernate 3.3.1 GA and PostgreSQL 8.3. I've just created a database, the first table, added one row there and now configuring Hibernate. However, even the simplest query: Criteria criteria = session.createCriteria(Place.class); List result = criteria.list(); could not b...
Have you run performance monitors on the client side to see what is going on, e.g. is there a bunch of memory swapping that is slowing things down or is it all network traffic that is the issue? Another thought is whether or not there are server logs that may be of some help in seeing the time of requests if there a...
Is there any connection between the values in the arrays? Are some bytes more likely to be the same then others? Might there be some intrinsic order in the values? Then you could optimize for the most probable case.
Is there a way from preventing other ReportViewers on the same webpage from refreshing?
|asp.net|reporting-services|reportviewer|
Currently I am working on a web page that has six [ReportViewer][1] controls that are using remote processing and that allow for drill-down. When a user clicks on one control the entire page refreshes and the other five reports all refresh as well. Users are currently requesting that the refreshing of the other control...
In the future, try compiling an app that uses both and then use Reflector (change the language to IL) to view the compiled output. You'll see there's no difference.
Take a look at tox, http://tox.sourceforge.net/. It is meant for use with Oracle, but you could use the include feature instead to retrieve the XML files. Like most of the other answers, when using tox, you will need to apply a view to your XML via XSLT. There are a couple of very simple examples included in the tox...
What is the best way to have synchronized a collection of objects between various threads in .Net?
|multithreading|
What is the best way to have synchronized a collection of objects between various threads in .Net?
What is the best way to have synchronized a collection of objects between various threads in .Net? I need to have a List<T> or Dictionary<T,K> accessed from different threads in a trhead safe mode. With Adds, Removes, Foreachs, etc.
wget --recursive --domains=www.mysite.com http://www.mysite.com Which indicates a recursive crawl should also traverse into frames and iframes. Be careful to limit the scope of recursion only to your web site since you probably don't want to crawl the whole web.
To followup on your edited question: > I was wondering if there was a way to put the EXISTING process into the background. In a Unix-like OS, there really is not a way to do this that I know of. The shell is blocked because it is executing one of the variants of a wait() call, waiting for the child process to exit....
The Liskov Substitution Principal (LSP) is a concept in Object Oriented Programming that states: > Functions that use pointers or > references to base classes must be > able to use objects of derived classes > with out knowing it. At it's heart LSP is about interfaces and contracts as well as how to decided wh...
The Liskov Substitution Principle (LSP) is a concept in Object Oriented Programming that states: > Functions that use pointers or > references to base classes must be > able to use objects of derived classes > with out knowing it. At it's heart LSP is about interfaces and contracts as well as how to decided w...
I am wondering what methods people are using for validating check boxes in ASP.NET MVC (both client and server side). I am using JQuery currently for client side validation but I am curious what methods people are using, ideally with the least amount of fuss (I am looking for a new solution). I should mention tha...
[prototype][1] FTW I do like JQuery, but prototype serves my needs most of the time. It may just be because I'm more familiar with it, but I seem to get stuff done faster in Prototype than in jQuery [1]: http://www.prototypejs.org/
The heap size depends on the allocator used. There might also be some Windows API call that limits the amount of memory a process can allocate, but I'm not aware of one and I don't feel like looking for it right now, sorry. But in general, if you write your own allocator (maybe just wrap around the compiler-provided `m...
I do not disable it, but there are some problems. Some applications don't work particularly well with it. For example, I believe I enabled smartd to try and keep track of my raid disks s.m.a.r.t. status, but selinux would get confused about the new /dev/sda* nodes created at boot (I think that's what the probl...