instruction stringlengths 0 30k ⌀ |
|---|
The book 'Real-Time Collision Detection' by Christer Ericson (ISBN: 1-55860-732-3) is a recent (2005) and widely praised book which should give you some good answers.
It starts with a basic primer of some of the maths you will need to know, and then goes into various types of bounding volumes (spheres, axis-aligned ... |
One potential thing you can do is contain the object rather than extend from the other class. This will give you the most flexibility in terms of exposing what you want to expose, but if you absolutely need the object to be of that type it is not the ideal solution (however you could expose the object from a getter).
... |
Hiding inherited members in C# |
|c#|polymorphism|silverlight|dependencyproperties|wpf| |
I'm looking for some way to effectively hide inherited members. I have a library of classes which inherit from common base classes. Some of the more recent descendant classes inherit dependency properties which have become vestigial and can be a little confusing when using intellisense or using the classes in a visua... |
|c#|wpf|silverlight|polymorphism|dependencyproperties| |
I'm looking for some way to effectively hide inherited members. I have a library of classes which inherit from common base classes. Some of the more recent descendant classes inherit dependency properties which have become vestigial and can be a little confusing when using intellisense or using the classes in a visua... |
If you use Visual Studio you can use Visual C++ 2008 Feature Pack Release, this implements some of TR1, and includes regular expression parsing. [Get it][1]
[1]: http://www.microsoft.com/downloads/details.aspx?FamilyId=D466226B-8DAB-445F-A7B4-448B326C48E7&displaylang=en |
Some time ago I wrote a quick and dirty exe that would update the version #'s in an assemblyinfo.{cs/vb} - I also have used rxfind.exe (a simple and powerful regex-based search replace tool) to do the update from a command line as part of the build process. A couple of other helpfule hints:
1. separate the assembly... |
A better solution is to store the MD5 in the configuration file. But instead of the MD5 being just of the configuration file, also include some secret "key" value, like a fixed guid, in the MD5.
write(MD5(SecretKey + ConfigFileText));
Then you simply remove that MD5 and rehash the file (including your secret... |
A better solution is to store the MD5 in the configuration file. But instead of the MD5 being just of the configuration file, also include some secret "key" value, like a fixed guid, in the MD5.
write(MD5(SecretKey + ConfigFileText));
Then you simply remove that MD5 and rehash the file (including your secret... |
I'm looking for "unbreakable" watermarks, so data stored in exif or image metadata are out.
I have found some interesting stuff on the web while waiting for replies here:
http://www.cosy.sbg.ac.at/~pmeerw/Watermarking/
There is a master thesis that's fairly exhaustive about algorithms and their caracteristics (w... |
Adding an XML prolog before the doctype will throw IE6 into quirks rendering mode. ([See here.][1]) In fact, any space before the doctype will throw IE6 into quirks mode. This is not the case for IE7 and above.
I would generally recommend omitting the prolog and keeping the browser in standards mode.
[1]: ht... |
Adding an XML prolog before the doctype will throw IE6 into quirks rendering mode. ([See here.][1]) In fact, any space before the doctype will throw IE6 into quirks mode. This is not the case for IE7 and above. You can use `document.compatMode` ([example][2]) to have the browser tell you what mode it is using to do the... |
I have read about a class in .net 3.0 called <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx"target="_blank">Dispatcher</a> that allows you to put a thread in a loop and then call the method Invoke() using a delegate to execute a method using the thread. But this solution will ... |
I have read about a class in .net 3.0 called <a href="http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatcher.aspx">Dispatcher</a> that allows you to put a thread in a loop and then call the method Invoke() using a delegate to execute a method using the thread. But this solution will not work if you... |
Yeah, it is messy, I can't think of a way to avoid it though.
You could hide some of the messiness from the client by putting the temporary table creation in a stored procedure (and using "execute immediate" to create they table)
One thing you will need to watch out for is left over temporary tables (should somet... |
> @Danial Jennings I read through the rules there and found: "An enum type, provided it has public accessibility and the types in which it is nested (if any) also have public accessibility (Section 17.2).".
How does trying for Enum e in the constructor fail based on the quoted rule? Is it because being of type enum... |
These look very similar to extensions in Linq already:
//takes a function that matches the Func<T,R> delegate
listInstance.Aggregate(
startingValue,
(x, y) => /* aggregate two subsequent values */ );
//takes a function that matches the Action<T> delegate
listInstance.ForEach(... |
These look very similar to extensions in Linq already:
//takes a function that matches the Func<T,R> delegate
listInstance.Aggregate(
startingValue,
(x, y) => /* aggregate two subsequent values */ );
//takes a function that matches the Action<T> delegate
listInstance.ForEach(... |
I agree with Rob Cooper. Create a class to represent your configuration, and pass that into the constructor of your form. This will also allow you to define methods on your new "config" class like "saveSettings", "LoadSettings", etc. That in turn should keep the code more maintainable in general.
As an quick-and-... |
Phil, different parts of the application call each other using WCF. By "return exceptions serialized as XML," I meant that the return value of the function wold be an exception object. Success would be indicated by null.
I don't think that's the right option.
WCF fault contracts sound good, but I don't know a... |
It doesn't have a built-in way to do this, but it would be trivial to do using String.Split.
Simply split on ',' then you have a series of strings that represent either page numbers or ranges. Iterate over that series and do a String.Split of '-'. If there isn't a result, it's a plain page number, so stick it in you... |
|version-control|repository|plasticscm| |
You could also use a FULL OUTER JOIN and a CASE ... END statement on the diff_type column along with the aforementioned where clause in <http://stackoverflow.com/questions/30985/querying-2-tables-with-the-same-spec-for-the-differences#31043>
That would probably achieve the same results, but in one query. |
I rather liked elements from both Stu's and samjudson's solutions and worked them together into what I think is a usable combo:
public static string
Ordinal (this int number)
{
const string TH = "th";
var s = number.ToString ();
number %=... |
Following a [Google](http://www.google.co.uk/search?hl=en&safe=off&client=firefox-a&rls=org.mozilla%3Aen-GB%3Aofficial&hs=8ER&q=linebreak+in+varchar+sql&btnG=Search&meta=)...
Taking the code from the website:
CREATE TABLE CRLF
(
col1 VARCHAR(1000)
)
INSERT CRLF SELECT... |
1. Require SSL on the application
2. In a custom error page for the 403 redirect the browser to the incoming URL, changing http to https along the way. |
1. Require SSL on the application
2. In a custom error page for the 403 redirect the browser to the incoming URL, changing http to https along the way.
Note: Keep port 80 open for this - or there won't be a server to listen for requests to reidrect. |
1. Require SSL on the application
2. In a custom error page for the 403 redirect the browser to the incoming URL, changing http to https along the way.
Note: Keep port 80 open for this - or there won't be a server to listen for requests to redirect. |
Limiting traffic to SSL version of page only |
|iis|ssl|c#| |
We have an external service that is currently accessible via the http (port 80, non-SSL) and https (port 443, SSL) addresses.
What is the best way to limit connections to only the https address? Is it something we can do via IIS or does it have to be done via code.
Additional info: Regular ASP.NET web service (.a... |
What is the best way to send html/image email? |
|html|email| |
Do you attach the images?
Use absolute urls?
How do you best avoid getting flagged as spam? |
@Chris Miller - What you've stated in your answer is factually inaccurate.
Windows message-style async, as available through WSAAsyncSelect, is indeed largely a workaround for lack of a proper threading model in Win 3.x days.
.NET Begin/End, however, is **not** using extra threads. Instead, it is using overlapped... |
Well, this may not be very graceful... but you can retrieve the *current* focused control pretty easily. So you might consider setting up a timer that asks every 1/2 second or so "Where is the current focus?"... Then you can observe changes. Example Delphi code is below; it should be pretty easy to adapt, since the r... |
Well, this may not be very graceful... but you can retrieve the *current* focused control pretty easily. So you might consider setting up a timer that asks every 1/2 second or so "Where is the current focus?"... Then you can observe changes. Example Delphi code is below; it should be pretty easy to adapt, since the r... |
SSRS 2005 allows you to have multiple datasets for a report. Each dataset can refer to a different datasource, one can come from a SQL DB another can be a ODBC source etc.
In the report designer view in Visual Studio go to the "Data" tab and add new data sources pointing to your different databases. Once you are don... |
Check out [Canoo Web Test][1]. It is open source and built on the ANT framework.
I spent some time working with it for a graduate course on Software QA and it seems to be a pretty powerful testing tool.
[1]: http://webtest.canoo.com/webtest/manual/WebTestHome.html |
I still don't understand (probably because of my poor English).
You could try:
ROW_NUMBER() OVER (ORDER BY dbo.human_sort(field_name) ASC)
But it won't work for millions of records.
That why I suggested to use trigger which *fills* *separate* column with *human value*.
Moreover:
- built-in T-SQL... |
How did you configure networking when you configured the guest? The easiest way is to set the network adapter to NAT, if you don't need to access the vm from another pc. |
How did you configure networking when you created the guest? The easiest way is to set the network adapter to NAT, if you don't need to access the vm from another pc. |
@[Brad Wilson](http://beta.stackoverflow.com/questions/35317/why-does-vista-complain-about-a-dead-process-when-i-use-cygwin-ssh-and-how-do-i#35324)
What does unexpectedly mean in this context? Does it mean it core dumped or just exited non-zero?
Everything works as I expect, so I don't really care if some sub-pr... |
Signing is used to uniquely identify an assembly. More details here: http://msdn.microsoft.com/en-us/library/ms247123(VS.80).aspx
In terms of best practice, it's fine to use the same key as long as the assemblies have different names. |
You could try as alternative (from the command prompt) ...
> cygpath -m c:\some\path
c:/some/path
As you can guess, it converts backslashes to slashes. |
While using short-circuiting for the purposes of optimization is often overkill, there are certainly other compelling reasons to use it. One such example (in C++) is the following:
if( pObj != NULL && *pObj == "username" ) {
// Do something...
}
Here, short-circuiting is being relied upon to en... |
I've been there. I used to have a job where I wrote code, did all the infrastructure stuff, wore the DBA hat, did user support, fixed the electric stapler when it jammed, and whatever else came up that might be remotely associated with IT. It was great! I learned a little about everything.
As far as the care and ... |
Have you tried hard-coding the values just to see if background-colors are showing on the print-preview at all? I think it is a setting in the Browser. |
Is it not recommended to do this with stylesheets? You can change the media type in the LINK statement in your HTML, so when the page is printed, it will revert to the different style? |
> Since HTML is not a regular language
HTML isn't but HTML tags are and they can be adequatly described by regular expressions. |
Thread not waking up from Thread.Sleep() |
|.net|multithreading| |
We have a Windows Service written in C#. The service spawns a thread that does this:
private void ThreadWorkerFunction()
{
while(false == _stop) // stop flag set by other thread
{
try
{
openConnection();
doStuff();
closeConnection();
... |
We have a Windows Service written in C#. The service spawns a thread that does this:
private void ThreadWorkerFunction()
{
while(false == _stop) // stop flag set by other thread
{
try
{
openConnection();
doStuff();
closeConnection();
... |
Try this, it should work:
/<\/?([^p]|..+?)>/
Explanation: it matches either a single letter except “p” or multiple letters (at least two). |
Try this, it should work:
/<\/?([^p](\s.+?)?|..+?)>/
Explanation: it matches either a single letter except “p”, followed by an optional whitespace and more characters, or multiple letters (at least two).
/EDIT: I've added the ability to handle attributes in `p` tags. |
Just wondering, what do you feel your method leaves to be desired? You could replace the anonymous delegate with a.. named? delegate, something like
public delegate void IoOperation(params string[] parameters);
public void FileDeleteOperation(params string[] fileName)
{
File... |
Override them like Michael Suggests [above](http://stackoverflow.com/questions/1528/#1533) and to prevent folks from using the overridden (sp?) methods, mark them as obsolete:
[Obsolete("These are not supported in this class.", true)]
public override void dontcallmeanymore()
{
}
If the second ... |
I've tried Aquamacs and it's very usable and looks pretty good. Supports both traditional Mac OS style keyboard shortcuts (command-O, command-S) and the Control/Meta shortcuts for those raised on traditional Emacs. It is definitely more Mac-like than Carbon Emacs. It seems stable and fast, but I am not an Emacs guru... |
This has already been answered for Java, here's the C# answer:
"Integer" is not a valid type name in C# and "int" is just an alias for System.Int32. Also, unlike in Java (or C++) there aren't any special primitive types in C#, every instance of a type in C# (including int) is an object. Here's some demonstrative cod... |
[Xdebug][1], by Derick Rethans, is very good. I used it some time ago and found it was not so easy to install. Once you're done, you won't understand how you managed without it :-)
There is a good article on [Zend Developer Zone][2] (installing on Linux doesn't seem any easier) and even a [Firefox plugin][3], which ... |
Dir.glob('**/*.rb') perhaps? |
In Ruby itself:
Dir.glob('**/*.rb') perhaps? |
Campaign Monitor is a great resources for html email:
http://www.campaignmonitor.com/resources/#building
Also http://www.email-standards.org/, but seems down right now. |
One of the biggest causes, that I have found, for email to be flagged as spam is DNS. Make sure the domain / MX records from which you are sending the email actually resolve correctly back from the server used for sending.
As for images, you could attach them, but the most common way is to host them and use absolut... |
hah!
the answer if here:
http://forums.asp.net/p/1067527/1548528.aspx
I figured out the solution... the fix was simple change
OnClientClick="myOnClick()"
to
OnClientClick="return myOnClick()"
Here's the fully corrected code...
<html xmlns="http://www.w3.org/1999/xhtml" >
<he... |
I think you need to look at using a wrapper thread that handles all calls to the DLL, and deals with the serialization.
This thread is outside of the managed thread pool, so you control its lifetime. But even this would not be foolproof unless you can prevent IIS from restarting the app domain your web service is i... |
How to reference javadocs to dependencies in Maven's eclipse plugin when javadoc not attached to dependency |
|eclipse|maven-2|eclipse-plugin|maven-eclipse-plugin| |
I use Eclipse, Maven, and Java in my development. I use Maven to download dependencies (jar files and javadoc when available) and Maven's eclipse plug-in to generate the .project and .classpath files for Eclipse. When the dependency downloaded does not have attached javadoc I manually add a link for the javadoc in the ... |
Facebook does it, when you write on people's walls, but only resizes vertically.
Horizontal resize strikes me as being a terrible mess, due to word-wrap, long lines, and so on, but vertical resize would be pretty safe and nice
Facebook is inhabited by every idiot on the planet, and none of the facebook-using-idi... |
Since the bottleneck will generally be in the processing and not the reading when dealing with files I'd go with the [producer-consumer][1] pattern. To avoid locking I'd look at lock free lists. Since you are using C# you can take a look at Julian Bucknall's [Lock-Free List][2] code.
[1]: http://www.ddj.com/arch... |
I don't have access to SQL Server to test this, but how about:
DROP TABLE IF EXISTS table1, table2, table3 CASCADE; |
Pleae explain the use of java.math.MathContext |
|java| |
Recently I tried understanding the use of **java.math.MathContext** but failed to understand properly. Is it used for rounding in java.math.BigDecimal, if yes why does not it round the decimal digits but even mentissa part.
From API docs, I came to know that it follows the standard specified in ANSI X3.274-1996 and ... |
As far as I can tell you code is correct. Assuming exampleString is an std::string that has class scope like you describe, you ought to be able to initialize it like that. Perhaps there is some other issue? Maybe a snippet of actual code would help put it in context. |
As far as I can tell your code is correct. Assuming exampleString is an std::string that has class scope like you describe, you ought to be able to initialize/assign it that way. Perhaps there is some other issue? Maybe a snippet of actual code would help put it in context. |
I was actually just sprucing up a dialog today. Here are a few things to try:
1. Ensure adequate spacing between controls - don't cram them all together. Space is appealing. You might also trying flowing the controls a little differently when you have more space.
2. Put in some new 3D and glossing images. ... |
I was actually just sprucing up a dialog today. Here are a few things to try:
1. Ensure adequate spacing between controls - don't cram them all together. Space is appealing. You might also trying flowing the controls a little differently when you have more space.
2. ![GlyFX][2]Put in some new 3D and glossin... |
Having never developed a plugin myself, I'm not certain how this is typically done in plugins, but since plugin scripting is JavaScript, I can probably help out with the loading part. Assuming a variable named url containing the URL you want to request:
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("GET"... |
WCF uses SoapFaults as its native way of transmitting exceptions from either the service to the client, or the client to the service.
You can declare a custom SOAP fault using the FaultContract attribute in your contract interface:
For example:
[ServiceContract(Namespace="foobar")]
interface IContract... |
Why do I cannot jQuery my page under Internet Explorer |
|jquery|html| |
I have very strange problem. Under some elusive circumstances I fail to apply any jQuery selector on my pages under IE. It's OK under Firefox though. jQuery function simply returns empty array.
Any suggestions? |
|jquery|html|javascript|internet-explorer| |
|javascript|html|jquery|internet-explorer| |
I have very strange problem. Under some elusive circumstances I fail to apply any jQuery selector on my pages under IE. It's OK under Firefox though. jQuery function simply returns empty array.
Any suggestions?
Page is too complex to post it here. Practically any selector except #id -ones retur zero element arra... |
- locals() - No.
- globals() - Yes.
`window` is a reference to the global scope, like `globals()` in python.
globals()["foo"]
is the same as:
window["foo"] |
I was actually just sprucing up a dialog today. A lot of it depends on what kind of application you have, and what OS they are running on. A couple of these tips will certainly go a long way to jazzing things up.
1. Ensure adequate spacing between controls - don't cram them all together. Space is appealing. You... |
VB.net has two wonderful expression called "OrElse" and "AndAlso"
OrElse will short circuit itself the first time it reaches a True evaluation and execute the code you desire.
If FirstName = "Luke" OrElse FirstName = "Darth" Then
Console.Writeline "Greetings Exalted One!"
End If
AndAlso will s... |
The asp.net site has an article about [Managing Browser History and Back Button Support in ASP.NET AJAX][1]
[1]: http://quickstarts.asp.net/Futures/ajax/doc/history.aspx |
Many websites make use of a hidden iframe to do this, simply refresh the iframe with the new URL, which adds it to the browsing history. Then all you have to do is handle how your application reacts to those 'back button' events - you'll either need to detect the state/location of the iframe, or refresh the page using... |
Maybe not exactly what you request but checkout [DeltaCopy][1] which is a windows version of [rsync][2]. You can also read about another rsync solution [here][3]
[1]: http://www.aboutmyip.com/AboutMyXApp/DeltaCopy.jsp
[2]: http://en.wikipedia.org/wiki/Rsync
[3]: http://hype-free.blogspot.com/2007/02/using-... |
I'd look at either [Mercurial][1] or [Bazaar][2]. I'm told Git also works on windows, but I suspect the windows port is still a second class port at best.
You'll probably need to be able to run python scripts on your webserver to host either of them.
[1]: http://www.selenic.com/mercurial/wiki/
[2]: http://ba... |
I don't understand what you mean by "bring in the app" and "one turn drop it". By "bring in the app" do you mean deploy? As for "One turn drop", I totally don't understand it.
As for open betas, that depends on your audience, really. Counterstrike, for example, apparently run a few closed betas before doing open bet... |
I'll try to answer with the limited amount of details you've given.
1: Wether it's open or closed is really only an issue if you have great buzz, and a large group of users hammering down your door, trying toget in on the action.
If this is the case, I think you might get more loyalty and commitment from users in... |
This is my general approach to testing/launching.
How you test/launch depends mostly on:
1. What your application **is**.
2. Who your users **are**.
If you application is a technical application and is geared to the technically-minded, the word "beta" won't really scare them - but provide an opportunity to test... |