instruction
stringlengths
0
30k
The question is simply answered by recognising that inheritance models an "IS-A" relationship, while membership models a "HAS-A" relationship. - An employee IS A user - An employeee HAS A userinfo Which one is correct? This is your answer.
The question is simply answered by recognising that inheritance models an "IS-A" relationship, while membership models a "HAS-A" relationship. - An employee IS A user - An employee HAS A userinfo Which one is correct? This is your answer.
Which class design is better?
|class-design|oop|
Which class design is better and why? public class User { public String UserName; public String Password; public String FirstName; public String LastName; } public class Employee : User { public String EmployeeId; public String Emplo...
|oop|class-design|
Neither one is good. Too much mutable state. You should not be able to construct an instance of a class that is in an invalid or partially initialized state. That said, the second one is better because it favours composition over inheritance.
I haven't heard of WikiML. I think your biggest obstacle is gonna be converting one wiki markup to another. For example, some wikis use markdown (which is what Stack Overflow uses), others use another markup syntax (e.g. BBCode, ...), etc.. The bottom line is - assuming the contents are databased it's not impossible...
I second Sphinx, but [Lucene][1] is also not so bad despite the Java. :) If you are not dealing with too much data spread out etc., then also look into MySQL's [FULLTEXT][2]. We are using it to search across a 20 GB database. [1]: http://lucene.apache.org/ [2]: http://dev.mysql.com/doc/refman/5.0/en/fulltext-...
For VS nothing beat Fixedsys.
If you are accessing the 'span' or whatever tag is giving you problems from the C# or VB code behind, then the runat="server" has to remain and you should use instead <span class="some_class" id="someID">. If you are not accessing the tag in the code behind, then remove the runat="server".
Java Open Source Workflow Engines
|java|open-source|workflow|
What is the best open source java workflow framework (e.g. OSWorkflow, jBPM, XFlow etc.)?
This isn't really reccomended, but if you must do it: 1. Use an explicit class constructor (Cannot use type Foo(args) = syntax) 2. Set the field to be static, mutable 3. Add the [<DefaultValue>] attribute type Foo = new() = { } [<DefaultValue>] static val mutable m_...
I rely on http://quirksmode.org/resources.html for information on HTML/CSS/JavaScript. This resource does a great job addressing cross-browser compatibility issues in a helpful table format.
Java and C# are pretty close in syntax and semantics. The real problem is the little differences. They will bite you when you dont expect it.
Sounds like you've got multiple projects in one repository. Splitting them up where appropriate will give you a big boost. Supposedly Git is much faster than Subversion due to the way it stores/processes changes, but I have no first-hand experience with it.
Could you keep two mirrored databases around? Write to one, keep the second as an archive. Switch every, say, 24 hours (or however long you deem appropriate). Into the database that was the archive, insert all of todays activity. Then the two databases should match. Use this as the new live db. Take the archived databa...
Search for "__VA_ARGS__" and va_list in MSDN!
A simple regular expresion will do but leave the quotation marks. e.g. `'foo bar "lorem ipsum" baz'.match(/("[^"]*")|([^\s"]+)/g) output: ['foo', 'bar', '"lorem ipsum"', 'baz']
A simple regular expression will do but leave the quotation marks. e.g. 'foo bar "lorem ipsum" baz'.match(/("[^"]*")|([^\s"]+)/g) output: ['foo', 'bar', '"lorem ipsum"', 'baz'] edit: beaten to it by shyamsundar, sorry for the double answer
I'm not sure why you need assembly for this. If you're on a machine that has the /proc filesystem, then running: > cat /proc/cpuinfo might give you what you need.
// a_RootKey is Microsoft.Win32.RegistryKey // DSN is a class not provided in this code sample - you can see what properties are needed from the usage below. List<DSN> DsnList = new List<DSN>(); Microsoft.Win32.RegistryKey SearchKey = a_RootKey.OpenSubKey("SOFTWARE\\ODBC\\...
Adding assemblies to the GAC
|installer|installation|uninstall|gac|
Until recently we were using Inno Setup for our installations, something I would like to continue doing, unless we can get an [uninstall option in the start menu][1] (thanks Giovanni Galbo), however we now need to GAC some external libraries, something I suspect is only doable (or at least only supported) though the .N...
|.net|gac|installation|
Adding assemblies to the GAC from Inno Setup
|.net|installation|gac|inno-setup|
Switching editors in Eclipse with keyboard, rather than switching Design/Source
|eclipse|
In Eclipse, I can switch through open editors using control-page up/down. This works great, except for editors like XML or JavaScript, where there are Design and Source tabs. For those editors, it just toggles between the different tabs. Is there any way to get Eclipse to ignore them? I know about alt-F6 for "Next Edit...
Where to save high scores in an XNA game?
|xna|data-storage|xbox|
I'm making a simple 2 player game in XNA and started looking into saving the player's high scores. I want the game to work on the XBox 360 as well as Windows, so I have to use the framework to save the data. It seems that you save data to a particular user's gamer tag - so my question is, what to do with high sco...
The .NET Framework 3.5 has added a SyndicationFeed Class which allows you to create and/or consume feeds in Atom 1.0 and RSS 2.0 formats. [SyndicationFeeds Class on MSDN][1] [1]: http://msdn.microsoft.com/en-us/library/system.servicemodel.syndication.syndicationfeed.aspx
I think it will be quite hard to do what you want. I presume that the real problem is that the new page takes too long to load. You should look at caching the page or doing partial caching on the static components such as pictures etc. to improve the load time or preloading the page and making it invisible. (see [Simpl...
UpdatePanels can be sensitive to malformed HTML. Do a View Source from your browser and run it through something like the W3C validator to look for anything weird (unclosed div or table being the usual suspects) If you use Firefox, there's a HTML validator Extension/AddOn available that works quite nicely.
add this: if page.isnotpostback { } around your code to bind the dropdownlist.
I guess it depends why you might be in a chroot, and whether any effort has gone into disguising it. I'd check <tt>/proc</tt>, these files are automatically generated system information files. The kernel will populate these in the root filesystem, but it's possible that they don't exist in the chroot filesystem. ...
Everytime you're doing a complex editing task, keep wondering if there is a more efficient way to do it. Most times, when it's something that you can describe in simple terms (like "swap paragraphs of text" or "delete everything after the X character in commented lines"), it's something you can do in just a couple of ...
Everytime you're doing a complex editing task, keep wondering if there is a more efficient way to do it. Most times, when it's something that you can describe in simple terms (like "swap paragraphs of text" or "delete everything after the X character in commented lines"), it's something you can do in just a couple of ...
Use the following in php.ini: error_reporting = E_ALL | E_STRICT Also you should install [Xdebug][1], it can highlight your errors in blinding bright colors and print useful detailed information. Never let any error or notice in your code, even if it's harmless. [1]: http://xdebug.org "Xdebug"
Years ago, Bruce Eckel's Thinking in C++ taught me a great deal about C++ but also the importance of isolating an issue to a small 'sandbox' for study/analysis. This technique has greatly impacted my career and routinely helps me troubleshoot problems both for myself and others. These days, I refer to Thinking in...
One trick that works well is to attach a debugger and then quit the debugger. On XP or Windows 2003 you can do this using ntsd that ships out of the box: ntsd -pn myapp.exe ntsd will open up a new window. Just type 'q' in the window to quit the debugger and take out the process. I've known this to work...
You can use ZModem to do exactly this. On your host, you'll need to use a client that understands zmodem. * If you use openssh, replace it with [zssh](http://zssh.sourceforge.net/), which is a wrapper over openssh. * If you use Putty, you can replace it with [Le Putty](http://leputty.sourceforge.net/). On t...
[zssh](http://zssh.sourceforge.net/) (a [ZMODEM](http://en.wikipedia.org/wiki/ZMODEM) wrapper over openssh) does exactly what you want. * Install [zssh](http://zssh.sourceforge.net/) and use it instead of openssh (which I assume that you normally use) * You'll have to have the [lrzsz](http://www.ohse.de/uwe/softw...
[zssh](http://zssh.sourceforge.net/) (a [ZMODEM](http://en.wikipedia.org/wiki/ZMODEM) wrapper over openssh) does exactly what you want. * Install [zssh](http://zssh.sourceforge.net/) and use it instead of openssh (which I assume that you normally use) * You'll have to have the [lrzsz](http://www.ohse.de/uwe/softw...
I don't know if it's in there, but there's a python distribution called [Enthought][1] that might have what you're looking for. It was designed specifically for data analysis has over 60 additional libraries. [1]: http://www.enthought.com/
Get two linux boxes talking over a serial port
|linux|virtualization|serial-port|kvm|qemu|
What is the best way to setup one linux box to listen on its serial port for incoming connections? I've done a lot of googling but I can't find the right combination of commands to actually get them to talk! My main objective is to provide a serial interface to running instances of kvm/qemu VMs which currently only hav...
**Flash** is a **Runtime Environment** - you use the Flash Authoring tool to make some Flash content, and the Flash player processes your content, executes the scripts, and draws the appropriate pictures onto the screen. **Flex** is a **Development Framework** - you use the Flex development tools to define how your ...
stringstream manipulators & vstudio 2003
|visual-studio|stl|
I am trying to use a stringstream object in VC++ (VStudio 2003) butI am getting an error when I use the overloaded << operator to try and set some manipulators. I am trying the following: int SomeInt = 1; stringstream StrStream; StrStream << std::setw(2) << SomeInt; This will not compile (error C25...
I see this as a basic understanding problem, which inevitably everyone goes through switching from one language to the next. A good reference to go through to understand how string's work in C when you've started familiarity with java is look at how string.h works. Where as in java string's are an Object and buil...
Optimizing code is an automated process that improves the runtime performance of the code while preserving semantics. This process can remove intermediate results which are unncessary to complete an expression or function evaluation, but may be of interest to you when debugging. Similarly, optimizations can alter the...
Hmmm, not sure if these will work specifically in a SP, but there are ENUM and SET datatypes in MySQL 5 which may do what you need. http://dev.mysql.com/doc/refman/5.0/en/enum.html http://dev.mysql.com/doc/refman/5.0/en/set.html
In my programming language of Choice, C#, I actually do this in the application itself because split() functions and loops are easier to program in C# then SQL, However! Perhaps you should look at [SubString_Index()][1] function. For example, the following would return google: SELECT SUBSTRING_INDEX(SUBSTR...
One thing that would really help is if the SharePoint team provided interfaces for the SP-specific workflow services needed to run SP workflows. This would allow you to mock those interfaces and run the workflows outside of SP proper. AFAIK, you can't do that today. I've personally found SharePoint extremely painful...
I guess you could use your favourite image editor and pick the colors from a screen grab.
Use something like this: class Tree < T > : Dictionary < T, IList< Tree < T > > > { } It's ugly, but I think it will give you what you want. Too bad KeyValuePair is sealed.
Use something like this: class Tree < T > : Dictionary < T, IList< Tree < T > > > { } It's ugly, but I think it will give you what you want. Too bad KeyValuePair is sealed.
Not showing Dialog when opening file in Acrobat Pro using Applescript
|macos|adobe|applescript|acrobat|
When opening Adobe Acrobat Pro, whether it be through Applescript or finder, the introductory dialog is shown. Is there a way to not show this dialog without already having checked the "Don't Show Again" option when opening a document using Applescript? Photoshop and Illustrator Applescript libraries have ways of...
Just one thing to add to this (although I do think you have already had your question answered by others). In the interests of extensibility (since we all know it will happen at some point) you may want to check out the [Composite Pattern](http://www.dofactory.com/Patterns/PatternComposite.aspx) This is ideal for worki...
I think what you might be after (as a literal implementation of you question) is: pubic class TokenTree { public TokenTree() { tree = new Dictionary<string, IDictionary<string,string>>(); } IDictionary<string, IDictionary<string, string>> tree; } ...
Can you modify text files when committing to subversion?
|svn|subversion|hook|
I want to ran the following script on text files that are being committed: # Send the commands H and w to ed # ed will append newline if the file does not end in one printf "%s\n" H w | ed -s $1 # Strip trailing whitespace sed -i 's/[ \t]*$//g' $1 # Convert tabs to 4 spaces ...
|svn|hook|
The easiest way to keep both languages straight is to do your thinking and code writing in Common Lisp. Common Lisp code can be converted into Scheme code with relative ease; however, going from Scheme to Common Lisp can cause a few headaches. I remember once where I was using a letrec in Scheme to store both variables...
I liked the <A HREF="http://compilers.iecc.com/crenshaw/">Crenshaw tutorial</A> too, because it makes it absolutely clear that a compiler is just another program that reads some input and writes some out put. Read it. Work it if you want, but then look at another reference on how bigger and more complete compil...
I liked the <A HREF="http://compilers.iecc.com/crenshaw/">Crenshaw tutorial</A> too, because it makes it absolutely clear that a compiler is just another program that reads some input and writes some out put. Read it. Work it if you want, but then look at another reference on how bigger and more complete compil...
Two-way password encryption without ssl
|encryption|javascript|passwords|
I am using the [twitter API][1] to [integrate twitter][2] with my blog's commenting system. The problem with the twitter API and many other web APIs out there is that they require the user's username and password to do anything useful. I don't want to deal with the hassle and cost of installing a SSL certificate, but...
Graphics card memory usage in linux
|linux|graphics|
What tools are available to monitor graphics card memory usage in linux?
Asp.Net Form DefaultButton Error in Firefox
|asp.net|firefox|textarea|webforms|
The .Net generated code for a form with the "DefaultButton" attribute set contains poor javascript that allows the functionality to work in IE but not in other browsers (Firefox specifcially). Hitting enter key does submit the form with all browsers but Firefox cannot disregard the key press when it happens inside ...
|asp.net|firefox|webforms|textarea|
The .Net generated code for a form with the "DefaultButton" attribute set contains poor javascript that allows the functionality to work in IE but not in other browsers (Firefox specifcially). Hitting enter key does submit the form with all browsers but Firefox cannot disregard the key press when it happens inside ...
I've [previously written][1] about why VSS is not a good idea. You might be able to gain some information from that. Also [this article][2] and [this one][3] contain further information. VSS 2005 has papered over some of the cracks in 6.0, but not in a particularly convincing way. The same brain-dead foundation r...
Is Visual Studio 2003 still available/supported
|.net|visual-studio|visual-studio-2003|
Pretty much what the title says really. We have some code that is .NET 1.1 based and no real desire to up-convert it. However, we are looking to add developers to the team and they will need copies of Visual Studio. My understanding is that they will need VS 2003 - as this is the only IDE that supports .NET 1.1 ...
I have this one pre-ordered: "Programming Silverlight 2" by Jesse Liberty and Tim Heuer. The authors are both employed by Microsoft working on Silverlight 2, and their blogs are great, so I expect the book (to be released after RTM) to be up to date.
If you keep writing stubs/mock/fake codes you risk doing unit testing on a class that has different behavior then when compiled on the main project. But if those includes are there and have no added behavior then it's Ok. I'd try not changing anything on the includes while doing the unit testing so you're sure (a...
I am not answering your question directly but I am afraid that unit testing just may not be the thing to do if you work with large amounts of legacy code. After leading an XP team on a green field development project I really loved my Unit tests. Things happened and a few years later I find myself working on a large...
How can I speed up SVN updates?
|svn|tortoisesvn|
We have a ratter large svn repository. Doing svn updates are taking longer and longer the more we add code. We added svn:externals to folders that were repeated in some projects like the FCKeditor in various websites. This helped but not that much. What is the best way to reduce update time and boost SVN speed?
We have a rather large svn repository. Doing svn updates are taking longer and longer the more we add code. We added svn:externals to folders that were repeated in some projects like the FCKeditor in various websites. This helped but not that much. What is the best way to reduce update time and boost SVN speed?
The best thing to do here is give it a unique class name.