qid int64 4 8.14M | question stringlengths 20 48.3k | answers list | date stringlengths 10 10 | metadata list | input stringlengths 12 45k | output stringlengths 2 31.8k |
|---|---|---|---|---|---|---|
312,936 | <p>I am using C# and Windows Forms. I have a normal progress bar working fine in the program, but now I have another operation where the duration cannot be easily calculated. I would like to display a progress bar but don't know the best way to start/stop the scrolling marquee. I was hoping for something as simple as s... | [
{
"answer_id": 312943,
"author": "Asher",
"author_id": 38265,
"author_profile": "https://Stackoverflow.com/users/38265",
"pm_score": -1,
"selected": false,
"text": "<p>you can use a <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.timer.aspx\" rel=\"nofollow norefer... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25946/"
] | I am using C# and Windows Forms. I have a normal progress bar working fine in the program, but now I have another operation where the duration cannot be easily calculated. I would like to display a progress bar but don't know the best way to start/stop the scrolling marquee. I was hoping for something as simple as sett... | Use a progress bar with the style set to `Marquee`. This represents an indeterminate progress bar.
```
myProgressBar.Style = ProgressBarStyle.Marquee;
```
You can also use the [`MarqueeAnimationSpeed`](http://msdn.microsoft.com/en-us/library/system.windows.forms.progressbar.marqueeanimationspeed.aspx) property to se... |
312,957 | <p>Is there a way to use these operators to input and output binary data? The reason I want to do this is that it makes the code readable.
Ex: infile >> filedecrypter >> metadataparser >> audiodecoder >> effects >> soundplayer;</p>
| [
{
"answer_id": 312959,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 3,
"selected": true,
"text": "<p>Indeed that can be done, if the library or your code provides the overloads for <code>operator<<</c... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312957",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13760/"
] | Is there a way to use these operators to input and output binary data? The reason I want to do this is that it makes the code readable.
Ex: infile >> filedecrypter >> metadataparser >> audiodecoder >> effects >> soundplayer; | Indeed that can be done, if the library or your code provides the overloads for `operator<<` and `operator>>` for it to work. Simple example on how one could do it:
```
class transformer {
public:
virtual std::iostream& transform(std::iostream&) = 0;
};
class noise : public transformer {
public:
virtu... |
312,967 | <p>I am trying to fade in a <p> on mouseover and fade out on mouseout:</p>
<pre><code> $("p.follow").mouseover(function(){
$(this).fadeTo("slow", 1.00);
})
$("p.follow").mouseout(function(){
$(this).fadeTo("fast", 0.50);
})
</code></pre>
<p>If you go to ryancoughlin.com and on the right side, if you ... | [
{
"answer_id": 312975,
"author": "Shog9",
"author_id": 811,
"author_profile": "https://Stackoverflow.com/users/811",
"pm_score": 3,
"selected": true,
"text": "<p>Try this:</p>\n\n<pre><code>$(\"p.follow\").hover(function()\n {\n $(this).stop().fadeTo(\"slow\", 1.00);\n },\n fu... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to fade in a on mouseover and fade out on mouseout:
```
$("p.follow").mouseover(function(){
$(this).fadeTo("slow", 1.00);
})
$("p.follow").mouseout(function(){
$(this).fadeTo("fast", 0.50);
})
```
If you go to ryancoughlin.com and on the right side, if you go over it you will see what ... | Try this:
```
$("p.follow").hover(function()
{
$(this).stop().fadeTo("slow", 1.00);
},
function()
{
$(this).stop().fadeTo("fast", 0.50);
});
```
Two key differences: I use the jQuery [`hover`](http://docs.jquery.com/Events/hover) event to associate mouseover and mouseout event handlers suc... |
312,989 | <p>I have a HTML with the following content:</p>
<pre><code>... some text ...
<a href="file.aspx?userId=123&section=2">link</a> ... some text ...
... some text ...
<a href="file.aspx?section=5&user=678">link</a> ... some text ...
... some text ...
</code></pre>
<p>I would like to parse... | [
{
"answer_id": 313033,
"author": "John Nilsson",
"author_id": 24243,
"author_profile": "https://Stackoverflow.com/users/24243",
"pm_score": 3,
"selected": false,
"text": "<p>Why use regex to split it out?</p>\n\n<p>You could first extrct the query string. Split the result on & and th... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312989",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a HTML with the following content:
```
... some text ...
<a href="file.aspx?userId=123§ion=2">link</a> ... some text ...
... some text ...
<a href="file.aspx?section=5&user=678">link</a> ... some text ...
... some text ...
```
I would like to parse that and get a match with named groups:
**match 1**
gro... | Why use regex to split it out?
You could first extrct the query string. Split the result on & and then create a map by splitting the result from that on = |
313,001 | <p>I have some markup for a popup menu that works in firefox but not IE. The problem is that the popup pops under other elements and is impervious to the z-index value. A complete runnable example is below.</p>
<p>Now, I know that one fix is not to position the divs as relative, but I can't do that because, in the r... | [
{
"answer_id": 313011,
"author": "Scott Evernden",
"author_id": 11397,
"author_profile": "https://Stackoverflow.com/users/11397",
"pm_score": 2,
"selected": false,
"text": "<p>If you move the TABLEs outside of the DIVs it works. Hopefully this satisfies your needs? I think I would get c... | 2008/11/23 | [
"https://Stackoverflow.com/questions/313001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28565/"
] | I have some markup for a popup menu that works in firefox but not IE. The problem is that the popup pops under other elements and is impervious to the z-index value. A complete runnable example is below.
Now, I know that one fix is not to position the divs as relative, but I can't do that because, in the real code, I'... | The z-index is scoped to within the parent if the parent has position: relative or position: absolute.
The solution for your example is to add style="z-index: 2;" to the first "mydiv" and z-index: 1; to the second. |
313,006 | <p>Is there something similar to <code>sprintf()</code> in C#?</p>
<p>I would for instance like to convert an integer to a 2-byte byte-array.</p>
<p>Something like:</p>
<pre><code>int number = 17;
byte[] s = sprintf("%2c", number);
</code></pre>
| [
{
"answer_id": 313009,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": false,
"text": "<pre><code>string s = string.Format(\"{0:00}\", number)\n</code></pre>\n\n<p>The first 0 means \"the first argument\"... | 2008/11/23 | [
"https://Stackoverflow.com/questions/313006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23423/"
] | Is there something similar to `sprintf()` in C#?
I would for instance like to convert an integer to a 2-byte byte-array.
Something like:
```
int number = 17;
byte[] s = sprintf("%2c", number);
``` | It turned out, that what I really wanted was this:
```
short number = 17;
System.IO.BinaryWriter writer = new System.IO.BinaryWriter(stream);
writer.Write(number);
writer.Flush();
```
The key here is the Write-function of the BinaryWriter class. It has 18 overloads, converting different formats to a byte array which... |
313,030 | <p>I would like to do something like the following but can't seem to get the syntax for the Do method quite right.</p>
<pre><code>var sqr = new _mocks.CreateRenderer<ShapeRenderer>();
Expect.Call(sqr.CanRender(null)).IgnoreArguments().Do(x =>x.GetType() == typeof(Square)).Repeat.Any();
</code></pre>
<p>So ba... | [
{
"answer_id": 313080,
"author": "Cristian Libardo",
"author_id": 16526,
"author_profile": "https://Stackoverflow.com/users/16526",
"pm_score": 3,
"selected": true,
"text": "<p>Are you looking for this?</p>\n\n<pre><code>Expect.Call(sqr.CanRender(null)).IgnoreArguments()\n .Do((Func&l... | 2008/11/23 | [
"https://Stackoverflow.com/questions/313030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] | I would like to do something like the following but can't seem to get the syntax for the Do method quite right.
```
var sqr = new _mocks.CreateRenderer<ShapeRenderer>();
Expect.Call(sqr.CanRender(null)).IgnoreArguments().Do(x =>x.GetType() == typeof(Square)).Repeat.Any();
```
So basically, I would like to set up the... | Are you looking for this?
```
Expect.Call(sqr.CanRender(null)).IgnoreArguments()
.Do((Func<Shape, bool>) delegate(Agent x){return x.GetType() == typeof(Square);})
.Repeat.Any();
```
EDIT: The answer was correct in spirit bu the original syntax did not quite work. |
313,036 | <p>Am I doing something wrong or is it not possible to specify a generic class as a constraint to a generic method?</p>
<p>I have been playing around with generics and <a href="http://developer.db4o.com/" rel="nofollow noreferrer">db4o</a> (open source object database) and am writing a test program (see code below) to... | [
{
"answer_id": 313044,
"author": "Brian B.",
"author_id": 21817,
"author_profile": "https://Stackoverflow.com/users/21817",
"pm_score": 3,
"selected": true,
"text": "<p>Just follow the T:</p>\n\n<pre><code> // ...\n {\n //...\n MyCollection1 collection3 = GetCollectionF... | 2008/11/23 | [
"https://Stackoverflow.com/questions/313036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2645/"
] | Am I doing something wrong or is it not possible to specify a generic class as a constraint to a generic method?
I have been playing around with generics and [db4o](http://developer.db4o.com/) (open source object database) and am writing a test program (see code below) to store and retrieve some user defined generic c... | Just follow the T:
```
// ...
{
//...
MyCollection1 collection3 = GetCollectionFromDb<MyCollection1>(Collection1Name);
}
private static T GetCollectionFromDb<T>(string pCollectionName) where T : MyCollectionBase<T>
{
IList<T> queryResult = db.Query((T c) => c.CollectionName ... |
313,047 | <p>I've been frustrated by this for the entire weekend, plus a day or two, so any help would be significantly appreciated.</p>
<p>I'm trying to write a program that can programmatically go into a SharePoint 2007 doc library, open a file, change the contents of the file, then put the file back. I've gotten all but the ... | [
{
"answer_id": 313097,
"author": "Kasper",
"author_id": 23499,
"author_profile": "https://Stackoverflow.com/users/23499",
"pm_score": 0,
"selected": false,
"text": "<p>Yesterday I saw a webcast with Andrew Connell where he opened a doc from a doc library, added a watermark and saved the ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/313047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29227/"
] | I've been frustrated by this for the entire weekend, plus a day or two, so any help would be significantly appreciated.
I'm trying to write a program that can programmatically go into a SharePoint 2007 doc library, open a file, change the contents of the file, then put the file back. I've gotten all but the last part ... | You should use stream's to write back the changed OOXML into the SPFile.
I hope this example helps!
>
>
> ```
> Stream fs = mySPFile.OpenBinaryStream();
>
> using (WordprocessingDocument ooxmlDoc = WordprocessingDocument.Open(fs, true))
> {
>
> MainDocumentPart mainPart = wordDoc.MainDocumentPart;
> XmlDoc... |
313,049 | <p>This fails with 'X.m is not a function'...</p>
<pre><code>var Y = function () {
this.m = function () {
alert('this is m');
};
};
var X = new function () { };
X.prototype = new Y();
X.m();
</code></pre>
<p>It would certainly work if I skipped the new keyword in the X definition and then instantiat... | [
{
"answer_id": 313056,
"author": "Benry",
"author_id": 28408,
"author_profile": "https://Stackoverflow.com/users/28408",
"pm_score": 2,
"selected": false,
"text": "<p>No you cannot set the prototype and have that change effect previously existing instances. You can however, modify the p... | 2008/11/23 | [
"https://Stackoverflow.com/questions/313049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This fails with 'X.m is not a function'...
```
var Y = function () {
this.m = function () {
alert('this is m');
};
};
var X = new function () { };
X.prototype = new Y();
X.m();
```
It would certainly work if I skipped the new keyword in the X definition and then instantiated X before calling m() on... | No you cannot set the prototype and have that change effect previously existing instances. You can however, modify the prototype object to have the desired effect. But not the way you have attempted. This is because your instance X is an object, not a class. (This is because you used the "new" operator before the defin... |
313,054 | <p>(Django 1.x, Python 2.6.x)</p>
<p>I have models to the tune of:</p>
<pre><code>class Animal(models.Model):
pass
class Cat(Animal):
def __unicode__(self):
return "This is a cat"
class Dog(Animal):
def __unicode__(self):
return "This is a dog"
class AnimalHome(models.Model):
animal = models.Foreig... | [
{
"answer_id": 313102,
"author": "Ber",
"author_id": 11527,
"author_profile": "https://Stackoverflow.com/users/11527",
"pm_score": 2,
"selected": false,
"text": "<p>Django (and relational data bases in general) do not work this way. Even when using an ORM like Django's you don't work wit... | 2008/11/23 | [
"https://Stackoverflow.com/questions/313054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39396/"
] | (Django 1.x, Python 2.6.x)
I have models to the tune of:
```
class Animal(models.Model):
pass
class Cat(Animal):
def __unicode__(self):
return "This is a cat"
class Dog(Animal):
def __unicode__(self):
return "This is a dog"
class AnimalHome(models.Model):
animal = models.ForeignKey(Animal)
```
I ... | ForeignKey(Animal) is just that, a foreign key reference to a row in the Animal table. There's nothing in the underlying SQL schema that indicates that the table is being used as a superclass, so you get back an Animal object.
To work around this:
First, you want the base class to be non-abstract. This is necessary f... |
313,070 | <p>Hey having some trouble trying to maintain transparency on a png when i create a thumbnail from it, anyone any experience with this? any help would be great, here's what i am currently doing:</p>
<pre><code>$fileName= "../js/ajaxupload/tees/".$fileName;
list($width, $height) = getimagesize($fileName);
$newwidth =... | [
{
"answer_id": 313079,
"author": "Paul Fisher",
"author_id": 39808,
"author_profile": "https://Stackoverflow.com/users/39808",
"pm_score": 1,
"selected": false,
"text": "<p>See <a href=\"https://stackoverflow.com/questions/279236/how-do-i-resize-pngs-with-transparency-in-php#279310\">dyc... | 2008/11/23 | [
"https://Stackoverflow.com/questions/313070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40141/"
] | Hey having some trouble trying to maintain transparency on a png when i create a thumbnail from it, anyone any experience with this? any help would be great, here's what i am currently doing:
```
$fileName= "../js/ajaxupload/tees/".$fileName;
list($width, $height) = getimagesize($fileName);
$newwidth = 257;
$newheig... | I have had success doing it like this in the past:
```
$thumb = imagecreatetruecolor($newwidth, $newheight);
imagealphablending($thumb, false);
imagesavealpha($thumb, true);
$source = imagecreatefrompng($fileName);
imagealphablending($source, true);
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newhe... |
313,111 | <p>What is the equivalent of <code>/dev/null</code> on Windows?</p>
| [
{
"answer_id": 313115,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 10,
"selected": true,
"text": "<p>I think you want <code>NUL</code>, at least within a command prompt or batch files.</p>\n\n<p>For example:</p>\n\n<pr... | 2008/11/23 | [
"https://Stackoverflow.com/questions/313111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40145/"
] | What is the equivalent of `/dev/null` on Windows? | I think you want `NUL`, at least within a command prompt or batch files.
For example:
```
type c:\autoexec.bat > NUL
```
doesn't create a file.
(I *believe* the same is true if you try to create a file programmatically, but I haven't tried it.)
In PowerShell, you want `$null`:
```
echo 1 > $null
``` |
313,124 | <p>How do I expose the <code>ActualWidth</code> property of one of the components of my user control to users?</p>
<p>I have found plenty of examples of how to expose a normal property by creating a new dependency property and binding, but none on how to expose a read-only property like <code>ActualWidth</code>.</p>
| [
{
"answer_id": 313619,
"author": "ligaz",
"author_id": 6409,
"author_profile": "https://Stackoverflow.com/users/6409",
"pm_score": 0,
"selected": false,
"text": "<p><code>ActualWidth</code> is a public readonly property (coming from <code>FrameworkElement</code>) and is exposed by defaul... | 2008/11/23 | [
"https://Stackoverflow.com/questions/313124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36074/"
] | How do I expose the `ActualWidth` property of one of the components of my user control to users?
I have found plenty of examples of how to expose a normal property by creating a new dependency property and binding, but none on how to expose a read-only property like `ActualWidth`. | What you need is a ReadOnly dependency property. The first thing you need to do is to tap into the change notification of the `ActualWidthProperty` dependency on the control that you need to expose. You can do that by using the `DependencyPropertyDescriptor` like this:
```
// Need to tap into change notification of th... |
313,139 | <p>Pretty new to css and trying to make the tags on my page smaller on all sides. What are the best settings to modify? Margin doesn't seem to do what I want.</p>
<pre><code>.story .content .tags .tag
{
margin: 10px 5px 10px 5px;
background-color: #99FF33;
font-weight: 500;
color: #330099;
font-sty... | [
{
"answer_id": 313175,
"author": "Vincent Ramdhanie",
"author_id": 27439,
"author_profile": "https://Stackoverflow.com/users/27439",
"pm_score": 1,
"selected": false,
"text": "<p>This entirely depends on what you are trying to style. Is it a text component like paragraph? A Div?</p>\n\n<... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Pretty new to css and trying to make the tags on my page smaller on all sides. What are the best settings to modify? Margin doesn't seem to do what I want.
```
.story .content .tags .tag
{
margin: 10px 5px 10px 5px;
background-color: #99FF33;
font-weight: 500;
color: #330099;
font-style: inherit;
... | This entirely depends on what you are trying to style. Is it a text component like paragraph? A Div?
You can use width and height on a div.
```
width:200px;
height:20px;
```
etc.
But we need some html to recommend meaningful solutions. |
313,141 | <p>Why whenever I compile and run the following code in Visual Studio 2008:</p>
<pre><code>double value1 = 10.5;
double value2 = 15.5;
int whole_number = value1 + value2;
Console::WriteLine(whole_number);
</code></pre>
<p>I get an incorrect value of 26 while the answer is 25.</p>
<p>However when I use static casts o... | [
{
"answer_id": 313144,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 4,
"selected": true,
"text": "<p>It's absolutely right.</p>\n\n<pre><code>double value1 = 10.5;\ndouble value2 = 15.5;\nint whole_number =... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75350/"
] | Why whenever I compile and run the following code in Visual Studio 2008:
```
double value1 = 10.5;
double value2 = 15.5;
int whole_number = value1 + value2;
Console::WriteLine(whole_number);
```
I get an incorrect value of 26 while the answer is 25.
However when I use static casts on the doubles, I get the right an... | It's absolutely right.
```
double value1 = 10.5;
double value2 = 15.5;
int whole_number = value1 + value2; // int whole_number = 26.0;
Console::WriteLine(whole_number);
```
What would you expect instead? The compiler first evaluates the right side, and then implicitly converts to the int. Thus, `26.0` becomes `26`
... |
313,146 | <p>I'm running into a recurrent problem with git on windows (I'm running MSysGit from package Git-1.6.0.2-preview20080923.exe, i tried as well with Git-1.5.6.1-preview20080701.exe and the results are the same).</p>
<p>It happens very offen that some files are shown as changed when I didn't change them, and in git-gui ... | [
{
"answer_id": 313272,
"author": "Paul",
"author_id": 23356,
"author_profile": "https://Stackoverflow.com/users/23356",
"pm_score": 3,
"selected": false,
"text": "<p>You may have line-ending problems, if you haven't handled that either in your text editor or in the Git configuration.</p>... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38995/"
] | I'm running into a recurrent problem with git on windows (I'm running MSysGit from package Git-1.6.0.2-preview20080923.exe, i tried as well with Git-1.5.6.1-preview20080701.exe and the results are the same).
It happens very offen that some files are shown as changed when I didn't change them, and in git-gui it shows t... | You may have line-ending problems, if you haven't handled that either in your text editor or in the Git configuration.
To solve this in Git, set the autocrlf option in the Git config file:
```
$ git config --global core.autocrlf true
```
This causes git to convert the newlines to the system’s standard when checking... |
313,157 | <p>All the examples I see are for Java SE applications by passing your JAR file at the command line. Can JConsole attach to a WAR or EAR and monitor application performance?</p>
| [
{
"answer_id": 313207,
"author": "Vineet Reynolds",
"author_id": 3916,
"author_profile": "https://Stackoverflow.com/users/3916",
"pm_score": 3,
"selected": true,
"text": "<p>JConsole is for monitoring JVMs. I'm assuming that you would like to monitor the performance of your application s... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19875/"
] | All the examples I see are for Java SE applications by passing your JAR file at the command line. Can JConsole attach to a WAR or EAR and monitor application performance? | JConsole is for monitoring JVMs. I'm assuming that you would like to monitor the performance of your application server. To do so, you'll have to set the com.sun.management.jmxremote property, when initializing your application server.
For example, in Tomcat (I know this is not a complete Java EE container), you would... |
313,176 | <p>I am working on a project using rails 2.1.1. With the new release of 2.2.2 I want to migrate to the new version. Is there anything I need to change to migrate my 2.1.1 controllers, views, and models?</p>
| [
{
"answer_id": 313288,
"author": "gtd",
"author_id": 8376,
"author_profile": "https://Stackoverflow.com/users/8376",
"pm_score": 2,
"selected": false,
"text": "<p>There aren't any major changes in the way things are done. Here is the list of <a href=\"http://guides.rubyonrails.org/2_2_r... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5004/"
] | I am working on a project using rails 2.1.1. With the new release of 2.2.2 I want to migrate to the new version. Is there anything I need to change to migrate my 2.1.1 controllers, views, and models? | Don't forget to run the update Rake task
```
rake rails:update
```
That will go ahead and make sure it updates any scripts and configs to reflect 2.2.
Once you have 2.2 installed, issue:
```
rake -T
```
to view the available tasks, double check it's there and go ahead and fire it off and you'll be up and running... |
313,178 | <p>Question says it all, I've got a 500,000 line file that gets generated as part of an automated build process on a Windows box and it's riddled with <strong>^M</strong>'s. When it goes out the door it needs to <strong>*nix</strong> friendly, what's the best approach here, is there a handy snippet of code that could d... | [
{
"answer_id": 313192,
"author": "EvilTeach",
"author_id": 7734,
"author_profile": "https://Stackoverflow.com/users/7734",
"pm_score": 1,
"selected": false,
"text": "<p>Ftp it from the dos box, to the unix box, as an ascii file, instead of a binary file.\nFtp will strip the <strong>crlf<... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1030/"
] | Question says it all, I've got a 500,000 line file that gets generated as part of an automated build process on a Windows box and it's riddled with **^M**'s. When it goes out the door it needs to **\*nix** friendly, what's the best approach here, is there a handy snippet of code that could do this for me? Or do I need ... | Here is a Perl one-liner, taken from <http://www.technocage.com/~caskey/dos2unix/>
```
#!/usr/bin/perl -pi
s/\r\n/\n/;
```
You can run it as follows:
```
perl dos2unix.pl < file.dos > file.unix
```
Or, you can run it also in this way (the conversion is done in-place):
```
perl -pi dos2unix.pl file.dos
```
And h... |
313,188 | <p>I am running into a very strange issue with PHP 5.2.6 w/ IIS on Windows XP (have tried both CGI and ISAPI). I am running a fresh installation with the default php.ini settings. </p>
<p>First, assume the following (ugly, but effective) HTML code:</p>
<pre><code><form action="<?php echo $_SERVER['PHP_SELF']; ?... | [
{
"answer_id": 313214,
"author": "Polsonby",
"author_id": 137,
"author_profile": "https://Stackoverflow.com/users/137",
"pm_score": 2,
"selected": false,
"text": "<p>Well, if it's any consolation your code works as intended in PHP5 with Apache.</p>\n\n<p>A quick Google revealed a couple ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8215/"
] | I am running into a very strange issue with PHP 5.2.6 w/ IIS on Windows XP (have tried both CGI and ISAPI). I am running a fresh installation with the default php.ini settings.
First, assume the following (ugly, but effective) HTML code:
```
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<input ty... | Well, if it's any consolation your code works as intended in PHP5 with Apache.
A quick Google revealed a couple other people with the same problem but no definitive solution - closest thing was [this](http://bytes.com/archives/php/389664-_post-problem-php5-iis)...
>
> Check your IIS configuration and see what verbs ... |
313,199 | <p>I have an application that has many different types of objects that each persist themselves back to the db. This has worked fine so far without transactions and I'm not looking to go hog wild adding them. But there is an occasional need to start a transaction before a whole collection of the objects start updating t... | [
{
"answer_id": 313230,
"author": "Paul Kapustin",
"author_id": 38325,
"author_profile": "https://Stackoverflow.com/users/38325",
"pm_score": 0,
"selected": false,
"text": "<ol>\n<li>I would prefer declarative transactions over trying to do manual DB transactions.</li>\n<li>As Mitch Wheat... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3442/"
] | I have an application that has many different types of objects that each persist themselves back to the db. This has worked fine so far without transactions and I'm not looking to go hog wild adding them. But there is an occasional need to start a transaction before a whole collection of the objects start updating to e... | First, I wouldn't be handling the transactional logic in the page. Write a business class of some sort to do this - a service, a data utility class, something you can abstract away from ASP.Net.
Next, you might look at using the *TransactionScope* class (in System.Transactions namespace, reference System.Transactions... |
313,243 | <p>How to solve "Must be MarshalByRefObject" in a good but multiple-inheritance amputated language like C#?</p>
<p>The problem is very simple, in several cases you just have to inherit from this class (infrastructure requirements).
It does not matter here really, which cases.
So, what do you do if you've already inher... | [
{
"answer_id": 313274,
"author": "ctacke",
"author_id": 13154,
"author_profile": "https://Stackoverflow.com/users/13154",
"pm_score": 1,
"selected": false,
"text": "<p>It depends on how you need to get at it. Using a base class that derives from MarshalByRefObject might do it. Aggregati... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38325/"
] | How to solve "Must be MarshalByRefObject" in a good but multiple-inheritance amputated language like C#?
The problem is very simple, in several cases you just have to inherit from this class (infrastructure requirements).
It does not matter here really, which cases.
So, what do you do if you've already inherited from ... | In general you only want to make an object MarshalByRef if you're going to use it in a Remoting / WCF context. This is usually a special-enough case that it's not a pain.
Suppose you had a general type, and you wanted to derive from it and specialise it, and then remote the derived type - now you have a problem, becau... |
313,253 | <p>I have code like this to move the player in my game left, right, up, and down:</p>
<pre><code>keysSetRepeat(20, 5);
while (lives) {
scanKeys();
if (keysDownRepeat() & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN)) {
u8 new_x = x;
u8 new_y = y;
if (keysDownRepeat() & KEY_LEFT)... | [
{
"answer_id": 313255,
"author": "Paige Ruten",
"author_id": 813,
"author_profile": "https://Stackoverflow.com/users/813",
"pm_score": 3,
"selected": true,
"text": "<p>I had to find the libnds source code to figure this out. Look at the implementation of keysDownRepeat():</p>\n\n<pre><co... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/813/"
] | I have code like this to move the player in my game left, right, up, and down:
```
keysSetRepeat(20, 5);
while (lives) {
scanKeys();
if (keysDownRepeat() & (KEY_LEFT | KEY_RIGHT | KEY_UP | KEY_DOWN)) {
u8 new_x = x;
u8 new_y = y;
if (keysDownRepeat() & KEY_LEFT) {
new_x--... | I had to find the libnds source code to figure this out. Look at the implementation of keysDownRepeat():
```
uint32 keysDownRepeat(void) {
uint32 tmp = keysrepeat;
keysrepeat = 0;
return tmp;
}
```
It actually returns the keys then resets them back to 0. This wasn't documented. I solved this by storing... |
313,270 | <p>I know I can configure command line arguments in the Run configuration but I want to run a java file multiple times with different command line arguments. It's a pain to change the Run Configuration every time.</p>
<p>Is there a way I can make Eclipse prompt me for command line arguments every time I run the progra... | [
{
"answer_id": 313292,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https://Stackoverflow.com/users/8709",
"pm_score": 8,
"selected": true,
"text": "<p>Add <code>string_prompt</code> as a <code>Program Argument</code> in the <code>Run</code> configuration.</p>\n\n<pre><c... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24424/"
] | I know I can configure command line arguments in the Run configuration but I want to run a java file multiple times with different command line arguments. It's a pain to change the Run Configuration every time.
Is there a way I can make Eclipse prompt me for command line arguments every time I run the program? | Add `string_prompt` as a `Program Argument` in the `Run` configuration.
```
${string_prompt}
```
There are also a `file_prompt` and a `folder_prompt` if you want specifically files\folders.
These are available through the `Variables` button on the `(x)= Arguments` tab of the Run Configuration dialog. |
313,281 | <p>I am using the FlexiGrid jQuery plug in and I need to get a JSON object back form my MVC App, simple enough if the FlexiGrid took just the object but I need to add a few items to the response string for it to work properly with FlexiGrid.</p>
<p>So here is a portion of my controller code:</p>
<pre><code>If Request... | [
{
"answer_id": 313285,
"author": "Eric Schoonover",
"author_id": 3957,
"author_profile": "https://Stackoverflow.com/users/3957",
"pm_score": 4,
"selected": false,
"text": "<p><code>Json()</code> method in ASP.NET MVC is just using the <a href=\"http://msdn.microsoft.com/en-us/library/sys... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34548/"
] | I am using the FlexiGrid jQuery plug in and I need to get a JSON object back form my MVC App, simple enough if the FlexiGrid took just the object but I need to add a few items to the response string for it to work properly with FlexiGrid.
So here is a portion of my controller code:
```
If Request.QueryString("json") ... | I ended up modifiying the Codeproject example a bit:
```
Imports System.Web.Script.Serialization
Imports System.Reflection
Public Class FlexiGrid
Public Class FlexigridRow
Public id As String
Public cell As New List(Of String)()
End Class
Public Class FlexigridObject
Public page ... |
313,297 | <p>I'm trying to come up with a simple and efficient way to create a smooth surface which intersects a number of given "sample" points.</p>
<p>For any X,Y point on the surface, I identify up to 4 sample points in each of the 4 directions (the next higher and lower points on the X, and then the Y axes). Given this poi... | [
{
"answer_id": 313304,
"author": "Steve Vermeulen",
"author_id": 23213,
"author_profile": "https://Stackoverflow.com/users/23213",
"pm_score": 0,
"selected": false,
"text": "<p>Use catmull-rom patches</p>\n"
},
{
"answer_id": 313310,
"author": "strager",
"author_id": 3999... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16050/"
] | I'm trying to come up with a simple and efficient way to create a smooth surface which intersects a number of given "sample" points.
For any X,Y point on the surface, I identify up to 4 sample points in each of the 4 directions (the next higher and lower points on the X, and then the Y axes). Given this point, I want ... | You can do this by constructing patches from Catmull-Rom splines. These splines will hit each of the control points and they are continuous in the first derivative (though not the second). I also find them to be extremely easy to work with. The math is straightforward and they behave intuitively with slight changes in ... |
313,306 | <p>In T-SQL, SPACE() function is used to add spaces to a string. For e.g. </p>
<pre><code>@s = 'He' + space(5) + 'llo'
</code></pre>
<p>Output</p>
<pre><code>He llo
</code></pre>
<p>So is there any function in PL/SQL that is equivalent to SPACE()?</p>
<p>Thank you.</p>
| [
{
"answer_id": 313368,
"author": "IK.",
"author_id": 21283,
"author_profile": "https://Stackoverflow.com/users/21283",
"pm_score": 5,
"selected": true,
"text": "<p>You can use RPAD or LPAD functions</p>\n\n<pre><code>select 'He' || rpad(' ',5,' ') || 'llo'\nfrom dual;\n/\n</code></pre>\... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1602746/"
] | In T-SQL, SPACE() function is used to add spaces to a string. For e.g.
```
@s = 'He' + space(5) + 'llo'
```
Output
```
He llo
```
So is there any function in PL/SQL that is equivalent to SPACE()?
Thank you. | You can use RPAD or LPAD functions
```
select 'He' || rpad(' ',5,' ') || 'llo'
from dual;
/
```
or in PL/SQL it would be:
```
declare
x varchar2(20);
begin
x:= 'He' || rpad(' ',5,' ') || 'llo';
end;
/
``` |
313,324 | <p>How to declare a static dictionary object inside a static class? I tried</p>
<pre><code>public static class ErrorCode
{
public const IDictionary<string, string> ErrorCodeDic = new Dictionary<string, string>()
{
{ "1", "User name or password problem" }
};
}
</code></pre>
<p>But ... | [
{
"answer_id": 313328,
"author": "Craig",
"author_id": 27294,
"author_profile": "https://Stackoverflow.com/users/27294",
"pm_score": -1,
"selected": false,
"text": "<pre><code>public static class ErrorCode\n{\n public const IDictionary<string , string > m_ErrorCodeDic;\n\n pu... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3834/"
] | How to declare a static dictionary object inside a static class? I tried
```
public static class ErrorCode
{
public const IDictionary<string, string> ErrorCodeDic = new Dictionary<string, string>()
{
{ "1", "User name or password problem" }
};
}
```
But the compiler complains that "*A const ... | If you want to declare the dictionary once and never change it then declare it as readonly:
```
private static readonly Dictionary<string, string> ErrorCodes
= new Dictionary<string, string>
{
{ "1", "Error One" },
{ "2", "Error Two" }
};
```
If you want to dictionary items to be readonly (not just the r... |
313,332 | <p>How do I use <a href="http://www1.cs.columbia.edu/~lok/csharp/refdocs/System.Xml.XPath/types/XPathNavigator.html#Evaluate(System.String)" rel="nofollow noreferrer">XPathNavigator.Evaluate</a> ( or other methods in XPathNavigator) to obtain the ISBN value for the following xml input?</p>
<pre><code><?xml version=... | [
{
"answer_id": 313328,
"author": "Craig",
"author_id": 27294,
"author_profile": "https://Stackoverflow.com/users/27294",
"pm_score": -1,
"selected": false,
"text": "<pre><code>public static class ErrorCode\n{\n public const IDictionary<string , string > m_ErrorCodeDic;\n\n pu... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3834/"
] | How do I use [XPathNavigator.Evaluate](http://www1.cs.columbia.edu/~lok/csharp/refdocs/System.Xml.XPath/types/XPathNavigator.html#Evaluate(System.String)) ( or other methods in XPathNavigator) to obtain the ISBN value for the following xml input?
```
<?xml version="1.0"?>
<!-- a fragment of a book store inventory data... | If you want to declare the dictionary once and never change it then declare it as readonly:
```
private static readonly Dictionary<string, string> ErrorCodes
= new Dictionary<string, string>
{
{ "1", "Error One" },
{ "2", "Error Two" }
};
```
If you want to dictionary items to be readonly (not just the r... |
313,334 | <p>Reporting Services 2000 SP2</p>
<p>I've got a matrix displaying the number of employees </p>
<pre><code> Business1 Business2 Business3
StartBefore99 9 14 4
StartAfter99 30 20 34
</code></pre>
<p>I'd like to display percentages eg</p... | [
{
"answer_id": 313328,
"author": "Craig",
"author_id": 27294,
"author_profile": "https://Stackoverflow.com/users/27294",
"pm_score": -1,
"selected": false,
"text": "<pre><code>public static class ErrorCode\n{\n public const IDictionary<string , string > m_ErrorCodeDic;\n\n pu... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26086/"
] | Reporting Services 2000 SP2
I've got a matrix displaying the number of employees
```
Business1 Business2 Business3
StartBefore99 9 14 4
StartAfter99 30 20 34
```
I'd like to display percentages eg
```
Business1 ... | If you want to declare the dictionary once and never change it then declare it as readonly:
```
private static readonly Dictionary<string, string> ErrorCodes
= new Dictionary<string, string>
{
{ "1", "Error One" },
{ "2", "Error Two" }
};
```
If you want to dictionary items to be readonly (not just the r... |
313,344 | <p>StackOverflow, you're my only hope!</p>
<p>I am unfortunate enough to have inherited an ASP.NET 3.5 application roughly 3/4 in development. This project uses Crystal Reports Basic for VS 2008 to generate a PDF file from a data source. Pretty straightforward.</p>
<p>Anyway, this project compiles and runs fine on my... | [
{
"answer_id": 347043,
"author": "Pandincus",
"author_id": 2273,
"author_profile": "https://Stackoverflow.com/users/2273",
"pm_score": 0,
"selected": false,
"text": "<p>My 'solution' (if you can call it that) was to <strong>not</strong> use <strong>Crystal Reports Basic for VS 2008</str... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2273/"
] | StackOverflow, you're my only hope!
I am unfortunate enough to have inherited an ASP.NET 3.5 application roughly 3/4 in development. This project uses Crystal Reports Basic for VS 2008 to generate a PDF file from a data source. Pretty straightforward.
Anyway, this project compiles and runs fine on my development mach... | Have you tried installing the runtime for Crystal Reports Basic for VS 2008?
Check my post on runtime locations at <http://blog.aggregatedintelligence.com/2008/12/crystal-reports-basic-2008-runtime.html>
Remember that if you use the CR B for VS 2008 runtime, then you must update the dll versions from 10.2.x to 10.5.x ... |
313,374 | <p>hi i forgot the code which in a sample class you have to add so that it runs automatically?</p>
<p>is it wakeup or something?</p>
<p>like so:</p>
<pre><code>class something {
function automaticxxx_something_which_runs when class is created()
{
}
}
$s = new something();
</code></pre>
<p>-what do i create in ... | [
{
"answer_id": 313396,
"author": "Matthewd",
"author_id": 40159,
"author_profile": "https://Stackoverflow.com/users/40159",
"pm_score": 3,
"selected": true,
"text": "<p>You're after a constructor. In PHP4 the method has the same name as the class</p>\n\n<pre><code>class Foobar\n{\n f... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1345527/"
] | hi i forgot the code which in a sample class you have to add so that it runs automatically?
is it wakeup or something?
like so:
```
class something {
function automaticxxx_something_which_runs when class is created()
{
}
}
$s = new something();
```
-what do i create in the class file so that something runs al... | You're after a constructor. In PHP4 the method has the same name as the class
```
class Foobar
{
function Foobar()
{
echo "Hello World!\n";
}
}
new Foobar()
```
In PHP5 the above method still works, but the correct way is to use the \_\_construct() method
```
class Foobar
{
function __const... |
313,400 | <p>How exactly does <code>NSInvocation</code> work? Is there a good introduction?</p>
<p>I’m specifically having issues understanding how the following code (from <em>Cocoa Programming for Mac OS X, 3rd Edition</em>) works, but then also be able to apply the concepts independently of the tutorial sample. The code:</p>... | [
{
"answer_id": 313455,
"author": "e.James",
"author_id": 33686,
"author_profile": "https://Stackoverflow.com/users/33686",
"pm_score": 9,
"selected": true,
"text": "<p>According to <a href=\"http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSInvocation_Class/Re... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14048/"
] | How exactly does `NSInvocation` work? Is there a good introduction?
I’m specifically having issues understanding how the following code (from *Cocoa Programming for Mac OS X, 3rd Edition*) works, but then also be able to apply the concepts independently of the tutorial sample. The code:
```
- (void)insertObject:(Pers... | According to [Apple's NSInvocation class reference](http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSInvocation_Class/Reference/Reference.html):
>
> An `NSInvocation` is an Objective-C message rendered static, that is, it is an action turned into an object.
>
>
>
And, in a *little* mo... |
313,410 | <p>Try clicking on the "Print" button on the following page:
(link removed - consensus is that everything was working fine and the problem was my setup)
For debugging purposes, I've replaced a chunk of javascript with a simple alert("test"), and even that isn't showing up in IE7 for me. It works totally fine in Safari... | [
{
"answer_id": 313418,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 3,
"selected": false,
"text": "<p>Just tested it on IE7 Vista and it worked fine... Your code looks sound as well, so I think it might be an issue with your ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Try clicking on the "Print" button on the following page:
(link removed - consensus is that everything was working fine and the problem was my setup)
For debugging purposes, I've replaced a chunk of javascript with a simple alert("test"), and even that isn't showing up in IE7 for me. It works totally fine in Safari, FF... | Just tested it on IE7 Vista and it worked fine... Your code looks sound as well, so I think it might be an issue with your setup? |
313,417 | <p>We're writing a records management product for schools and one of the requirements is the ability to manage course schedules. I haven't looked at the code for how we deal with this (I'm on a different project at the moment), but nonetheless I started wondering how best to handle one particular part of this requireme... | [
{
"answer_id": 313428,
"author": "Nicholas Piasecki",
"author_id": 32187,
"author_profile": "https://Stackoverflow.com/users/32187",
"pm_score": 3,
"selected": false,
"text": "<p>A possible #4: Why does it need to be a single column? You could add 7 bit columns for each day of the week t... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17862/"
] | We're writing a records management product for schools and one of the requirements is the ability to manage course schedules. I haven't looked at the code for how we deal with this (I'm on a different project at the moment), but nonetheless I started wondering how best to handle one particular part of this requirement,... | I would avoid the string option for the sense of purity: it adds an extra layer of encoding/decoding that you do not need. It may also mess you up in the case of internationalization.
Since the number of days in a week is 7, I would keep seven columns, perhaps boolean. This will also facilitate subsequent queries. Th... |
313,422 | <p>Given two sets A and B, what is the common algorithm used to find their union, and what is it's running time?</p>
<p>My intuition: </p>
<pre><code>a = set((1, 2, 3))
b = set((2, 3, 5))
union = set()
for el in a:
union.add(el)
for el in b:
union.add(el)
</code></pre>
<p>Add checks for a collision, which i... | [
{
"answer_id": 313440,
"author": "Akusete",
"author_id": 40175,
"author_profile": "https://Stackoverflow.com/users/40175",
"pm_score": 3,
"selected": false,
"text": "<p>The complexity of add/find(collision), would depend on the implementation of union.</p>\n\n<p>If you are using some has... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] | Given two sets A and B, what is the common algorithm used to find their union, and what is it's running time?
My intuition:
```
a = set((1, 2, 3))
b = set((2, 3, 5))
union = set()
for el in a:
union.add(el)
for el in b:
union.add(el)
```
Add checks for a collision, which is O(1), and then adds the element... | This is very much implementation dependent. Others have mentioned sets based on comparables (have a less-than for sorting) or hashables (have a good hash function for hashing). Another possible implementation involved "union-find", which only supports a specialized subset of usual set operations but is very fast (union... |
313,432 | <p>I'm a C/Python programmer in C++ land working with the STL for the first time.</p>
<p>In Python, extending a list with another list uses the <code>.extend</code> method:</p>
<pre><code>>>> v = [1, 2, 3]
>>> v_prime = [4, 5, 6]
>>> v.extend(v_prime)
>>> print(v)
[1, 2, 3, 4, 5, 6... | [
{
"answer_id": 313444,
"author": "Dmitry Khalatov",
"author_id": 18174,
"author_profile": "https://Stackoverflow.com/users/18174",
"pm_score": 7,
"selected": true,
"text": "<p>From <a href=\"https://cplusplus.com/reference/vector/vector/insert/\" rel=\"nofollow noreferrer\">here</a></p>\... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3594/"
] | I'm a C/Python programmer in C++ land working with the STL for the first time.
In Python, extending a list with another list uses the `.extend` method:
```
>>> v = [1, 2, 3]
>>> v_prime = [4, 5, 6]
>>> v.extend(v_prime)
>>> print(v)
[1, 2, 3, 4, 5, 6]
```
I currently use this algorithmic approach to extend vectors ... | From [here](https://cplusplus.com/reference/vector/vector/insert/)
```
// reserve() is optional - just to improve performance
v.reserve(v.size() + distance(v_prime.begin(),v_prime.end()));
v.insert(v.end(),v_prime.begin(),v_prime.end());
``` |
313,434 | <p>I am having trouble setting the path to jquery in an mvc app. In my master page I have the script declared and jquery works at the root of my app. When I navigate to a content view page in my app jquery does not get loaded properly. Do I need to set the path in the content page as well or declare the path differentl... | [
{
"answer_id": 313449,
"author": "tsimon",
"author_id": 1685,
"author_profile": "https://Stackoverflow.com/users/1685",
"pm_score": 3,
"selected": true,
"text": "<p>The src on the masterpage is relative, which won't work on child pages. It should work if you declare the path as an absolu... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15059/"
] | I am having trouble setting the path to jquery in an mvc app. In my master page I have the script declared and jquery works at the root of my app. When I navigate to a content view page in my app jquery does not get loaded properly. Do I need to set the path in the content page as well or declare the path differently?
... | The src on the masterpage is relative, which won't work on child pages. It should work if you declare the path as an absolute path (e.g. "/Views/Scripts/jquery-1.2.6.min.js"); |
313,442 | <p>I have a website that can be accessed from www.blahblah.com and special.blahblah.com. The www site always works but occasionly I get a 'Content controls have to be top-level controls in a content page or a nested master page that references a master page' error on the special site.</p>
<p>It's exactly the same cod... | [
{
"answer_id": 3354347,
"author": "ewitkows",
"author_id": 382214,
"author_profile": "https://Stackoverflow.com/users/382214",
"pm_score": 2,
"selected": false,
"text": "<p>Look for an unclosed tag in one of your server controls, im running VS2010 and the IDE aspx validator didnt pick up... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10102/"
] | I have a website that can be accessed from www.blahblah.com and special.blahblah.com. The www site always works but occasionly I get a 'Content controls have to be top-level controls in a content page or a nested master page that references a master page' error on the special site.
It's exactly the same code running i... | If anyone gets this error message when dynamically switching master pages, make sure your code is
```
MasterPageFile = "TheMasterPage.master"
```
Not
```
this.master.MasterPageFile = "TheMasterPage.master"
``` |
313,462 | <p>I'm moving from Eclipse to Visual Studio .NET and have found all my beloved hotkeys except two:</p>
<ul>
<li>in Eclipse you can press <kbd>ALT</kbd>-<kbd>←</kbd> and <kbd>ALT</kbd>-<kbd>→</kbd> to visit recent changes you have made, something I use frequently to go back to where I was in some other file and then re... | [
{
"answer_id": 313471,
"author": "lomaxx",
"author_id": 493,
"author_profile": "https://Stackoverflow.com/users/493",
"pm_score": 0,
"selected": false,
"text": "<p>I don't know if VS supports the features you're talking about natively, but I know the resharper plugin allows you to go to ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | I'm moving from Eclipse to Visual Studio .NET and have found all my beloved hotkeys except two:
* in Eclipse you can press `ALT`-`←` and `ALT`-`→` to visit recent changes you have made, something I use frequently to go back to where I was in some other file and then return. Apparently in VS.NET the `CTRL`-`-` and `CTR... | The answers proposed work, but none of them are as nice as eclipse with regard to how they preserve the existing paste buffer, the currently selected characters, and they do not allow the user to operate upon a range of lines. Here is a solution I came up with that preserves the paste buffer, the current character sele... |
313,463 | <p>Is there any way to save the state of vim settings with a document?</p>
<p>To clarify: I'm editing a document and I change a bunch of settings. I don't necessarily recall which; and I don't want to use these settings again, except for the current document. I don't want to manually try to remember what I've changed;... | [
{
"answer_id": 313466,
"author": "ypnos",
"author_id": 21974,
"author_profile": "https://Stackoverflow.com/users/21974",
"pm_score": 7,
"selected": false,
"text": "<p>Yes, vim settings can be included within the document.</p>\n\n<p>They are mostly found within comments, so they don't mes... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31641/"
] | Is there any way to save the state of vim settings with a document?
To clarify: I'm editing a document and I change a bunch of settings. I don't necessarily recall which; and I don't want to use these settings again, except for the current document. I don't want to manually try to remember what I've changed; or what t... | You can use Vim's Session support:
```
:mksession
```
you can later load this by either running `vim -S Session.vim`, or using `source Session.vim`
There are also vim addons to automate session loading/saving |
313,467 | <p>I am using the rounded corners plugin for jquery and have it working rounding elements in my page. The only issue I have is that the elements appear on the page un-rounded and then round. What do I need to do so that the elements only appear rounded?</p>
<p>I originally put my script tags in the head element but sh... | [
{
"answer_id": 313466,
"author": "ypnos",
"author_id": 21974,
"author_profile": "https://Stackoverflow.com/users/21974",
"pm_score": 7,
"selected": false,
"text": "<p>Yes, vim settings can be included within the document.</p>\n\n<p>They are mostly found within comments, so they don't mes... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15059/"
] | I am using the rounded corners plugin for jquery and have it working rounding elements in my page. The only issue I have is that the elements appear on the page un-rounded and then round. What do I need to do so that the elements only appear rounded?
I originally put my script tags in the head element but should they ... | You can use Vim's Session support:
```
:mksession
```
you can later load this by either running `vim -S Session.vim`, or using `source Session.vim`
There are also vim addons to automate session loading/saving |
313,478 | <p>What's the best way to get a regular anchor (<code><a href="..."></code>) to submit the form it is embedded in when clicked?</p>
<pre><code><form>
<ul>
<li>
<p>
The link could be <span>embedded <a href="" onclick="?">at any level</... | [
{
"answer_id": 313480,
"author": "ypnos",
"author_id": 21974,
"author_profile": "https://Stackoverflow.com/users/21974",
"pm_score": 5,
"selected": false,
"text": "<p>Why don't you use an <code><input></code> or <code><button></code> element and just tweak it with CSS? Then i... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | What's the best way to get a regular anchor (`<a href="...">`) to submit the form it is embedded in when clicked?
```
<form>
<ul>
<li>
<p>
The link could be <span>embedded <a href="" onclick="?">at any level</a></span>
in the form, so "this.parentNode.parentNode.... | loop through parent nodes until you find an element with tagname that indicates it's a form!
```
<form>
<ul>
<li>
<p>
The link could be <span>embedded <a href="" onclick="get_form(this).submit(); return false">at any level</a></span>
in the form, so "this.parentN... |
313,483 | <p>I got my Xampp server running and can run my html in subdirectories now, as well (can't have spaces in the subdirectory names).</p>
<p><strong>SSI Includes or PHP Includes:</strong></p>
<p>Xampp says SSI is deactivated. Tried uncommenting the lines for includes, but it doesn't change the deactivation.</p>
<p>How ... | [
{
"answer_id": 313500,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "https://Stackoverflow.com/users/15880",
"pm_score": 1,
"selected": false,
"text": "<p>I don't know if Xampp has a special way of activating SSI or not, but the <a href=\"http://httpd.apache.org/docs/2.2/... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40091/"
] | I got my Xampp server running and can run my html in subdirectories now, as well (can't have spaces in the subdirectory names).
**SSI Includes or PHP Includes:**
Xampp says SSI is deactivated. Tried uncommenting the lines for includes, but it doesn't change the deactivation.
How do I activate SSI?
Then, how do I im... | I don't know if Xampp has a special way of activating SSI or not, but the [normal Apache way](http://httpd.apache.org/docs/2.2/howto/ssi.html#configuring) should work.
The normal way to include files in SSI is
```
<!--#include virtual="/something/file.html" -->
```
where the url to the file is actually <http://www... |
313,518 | <p>I have run into a bit of a desgin issue with some code that I have been working on:</p>
<p>My code basic looks like this:</p>
<p><strong>Main COM wrapper:</strong></p>
<pre><code>public class MapinfoWrapper
{
public MapinfoWrapper()
{
Publics.InternalMapinfo = new MapinfoWrapper();
}
pub... | [
{
"answer_id": 313617,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "<p>You are reducing the testability of your TableInfo class by not injecting the MapInfoWrapper into the class itself. ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6335/"
] | I have run into a bit of a desgin issue with some code that I have been working on:
My code basic looks like this:
**Main COM wrapper:**
```
public class MapinfoWrapper
{
public MapinfoWrapper()
{
Publics.InternalMapinfo = new MapinfoWrapper();
}
public void Do(string cmd)
{
//... | You are reducing the testability of your TableInfo class by not injecting the MapInfoWrapper into the class itself. Whether you use a global cache of these MapInfoWrapper classes depends on the class -- you need to decide whether it is necessary or not, but it would improve your design to pass a wrapper into TableInfo ... |
313,538 | <p>We are using shared hosting and the follow features are disabled.</p>
<pre><code>file_uploads = Off
allow_url_fopen = Off
allow_url_include = Off
</code></pre>
<p>We are unable to change hosting and need to figure out some workarounds. The hosting co is also not able/willing to enable these features. </p>
<p>Fo... | [
{
"answer_id": 313541,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Since you're looking to retrieve remote content the easiest way will be to write the functionality to fetch the content you... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | We are using shared hosting and the follow features are disabled.
```
file_uploads = Off
allow_url_fopen = Off
allow_url_include = Off
```
We are unable to change hosting and need to figure out some workarounds. The hosting co is also not able/willing to enable these features.
For example:
We are calling 1 server ... | Since you're looking to retrieve remote content the easiest way will be to write the functionality to fetch the content yourself with something like curl ([php.net/curl](http://php.net/curl)) |
313,567 | <p>I'm writing an application in PHP 5. I want to delete some rows in a SQLite v2 database file. I'm doing something like this:</p>
<pre><code>$sqliteConnection = new SQLiteDatabase('path/to/db');
$queryString = "DELETE FROM myTable WHERE status='not good'";
$result = $sqliteConnection->query($queryString);
</code>... | [
{
"answer_id": 313574,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 4,
"selected": true,
"text": "<p>The PHP function <a href=\"http://de2.php.net/sqlite_changes\" rel=\"noreferrer\"><code>sqlite_changes()</code></a> does... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9394/"
] | I'm writing an application in PHP 5. I want to delete some rows in a SQLite v2 database file. I'm doing something like this:
```
$sqliteConnection = new SQLiteDatabase('path/to/db');
$queryString = "DELETE FROM myTable WHERE status='not good'";
$result = $sqliteConnection->query($queryString);
```
how can I know how... | The PHP function [`sqlite_changes()`](http://de2.php.net/sqlite_changes) does this for you.
>
> Returns the numbers of rows that were changed by the most recent SQL statement executed against the `dbhandle` database handle.
>
>
>
Call it either in procedural-style:
```
echo 'Number of rows modified: ', sqlite_... |
313,570 | <p>Is there any Java library that supports hierarchical column?</p>
<p>For example (the first three row are columns) :</p>
<pre><code>------------------------------------------------
2008 |
------------------------------------------------
January | February ... | [
{
"answer_id": 313577,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 3,
"selected": true,
"text": "<p>May be a <a href=\"http://javadesktop.org/swinglabs/build/weekly/latest/swingx-HEAD/javadoc/org/jdesktop/swingx/JXTree.html\"... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there any Java library that supports hierarchical column?
For example (the first three row are columns) :
```
------------------------------------------------
2008 |
------------------------------------------------
January | February |
---------... | May be a [JXTree](http://javadesktop.org/swinglabs/build/weekly/latest/swingx-HEAD/javadoc/org/jdesktop/swingx/JXTree.html) from [SwingLab](https://swinglabs.dev.java.net/) could approach what you are looking for.
Illustration [here](http://avatar21.superihost.com/index.php?entry=entry060514-170809), from the [Swingx]... |
313,575 | <p>We are using OpenLDAP client library to conect to an LDAP server. The problem is that if there is no activity for some time, server (or firewall in the middle) drops TCP connection.</p>
<p>Our current implementation of "keep-alive" just does search for baseDN from time to time - any better ideas ? </p>
| [
{
"answer_id": 335368,
"author": "Dmitry Khalatov",
"author_id": 18174,
"author_profile": "https://Stackoverflow.com/users/18174",
"pm_score": 1,
"selected": true,
"text": "<p>The only alternative seems to be reconnect:</p>\n\n<pre><code>ldap_set_option( ld, LDAP_OPT_RECONNECT, LDAP_OPT_... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18174/"
] | We are using OpenLDAP client library to conect to an LDAP server. The problem is that if there is no activity for some time, server (or firewall in the middle) drops TCP connection.
Our current implementation of "keep-alive" just does search for baseDN from time to time - any better ideas ? | The only alternative seems to be reconnect:
```
ldap_set_option( ld, LDAP_OPT_RECONNECT, LDAP_OPT_ON );
``` |
313,581 | <p>I have a N-Ary non sorted in any way tree and each node can have 0-N children. Given the data structure below, how can I fill the tree view assuming you have an array of TermNodes and that array is the first level of the TreeView? I have not been able to come up with a recursive way to do this.</p>
<pre><code>class... | [
{
"answer_id": 313602,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 1,
"selected": false,
"text": "<p>Here is a bit of code to get you started with the recursion. It's not tested (I can't right now), but you should get th... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11100/"
] | I have a N-Ary non sorted in any way tree and each node can have 0-N children. Given the data structure below, how can I fill the tree view assuming you have an array of TermNodes and that array is the first level of the TreeView? I have not been able to come up with a recursive way to do this.
```
class TermNode
{
... | Thanks All I was getting confused because I did not realize that for a given TreeNode tn, tn.Nodes.Add would return the added TreeNode
Once you know that the solution is straight forward like so
```
private void /*TreeNode*/ RecursiveAdd(OntologyNode on, TreeNode tn)
{
if (on.Children.Count == 0)
{
re... |
313,611 | <p>Ok, I am new to JQuery, I have a modal that has a asp:Literal control in it. The literal is controled by whatever link is clicked to activate the modal. So, I had hoped it would be as easy as giving the literal value onClick of the link but that's not it. </p>
<p>I'm hoping: the value of the literal is set on the p... | [
{
"answer_id": 313646,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 0,
"selected": false,
"text": "<p>If you want the modal to change client-side when the link is clicked, you will need to set it in the onClick handler... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4140/"
] | Ok, I am new to JQuery, I have a modal that has a asp:Literal control in it. The literal is controled by whatever link is clicked to activate the modal. So, I had hoped it would be as easy as giving the literal value onClick of the link but that's not it.
I'm hoping: the value of the literal is set on the page load s... | Okay so you have a literal in your `<p>`. That means you have no direct selector/handle to it, like you would when it was a label with an ID.
But you can say it is the `<p>` inside the `<div class="modal-content">`, all part of the element with ID `landing-page-modal`:
```
"#landing-page-modal div.modal-content p"
`... |
313,622 | <p>Does anyone have a Powershell script to change the credentials used by a Windows service?</p>
| [
{
"answer_id": 313637,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 2,
"selected": false,
"text": "<p>Considering that whithin this class:</p>\n\n<pre><code>$class=[WMICLASS]'\\\\.\\root\\Microsoft\\SqlServer\\ComputerManageme... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7618/"
] | Does anyone have a Powershell script to change the credentials used by a Windows service? | Bit easier - use WMI.
```
$service = gwmi win32_service -computer [computername] -filter "name='whatever'"
$service.change($null,$null,$null,$null,$null,$null,$null,"P@ssw0rd")
```
Change the service name appropriately in the filter; set the remote computer name appropriately. |
313,639 | <p>I have two UIActionSheets and I am thinking that I will control them with one delegate (the UIViewController that instantiates them). The delegate will capture an actionSheet call and try to figure out which of the two threw the event.</p>
<p>I tried to get the modalView's title to differentiate, but it seems to b... | [
{
"answer_id": 313667,
"author": "Stephen Darlington",
"author_id": 2998,
"author_profile": "https://Stackoverflow.com/users/2998",
"pm_score": 5,
"selected": false,
"text": "<p>I think you need the <em>tag</em> property of the <em>UIActionSheet</em>.</p>\n\n<p>Something like:</p>\n\n<pr... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have two UIActionSheets and I am thinking that I will control them with one delegate (the UIViewController that instantiates them). The delegate will capture an actionSheet call and try to figure out which of the two threw the event.
I tried to get the modalView's title to differentiate, but it seems to be invalid..... | I think you need the *tag* property of the *UIActionSheet*.
Something like:
```
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle ... ];
actionSheet.tag = 10;
[actionSheet showInView:self.view];
```
Then in your delegate:
```
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NS... |
313,649 | <p>When I publish my ASP.NET site in RELEASE mode, and set compilation debug="false", will my ASP.NET and System.Diagnostics Tracing still work?</p>
| [
{
"answer_id": 313654,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": true,
"text": "<p>I believe that tracing is set separately from debugging in the configuration, so yes, if properly configured.</p>\n\n... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22702/"
] | When I publish my ASP.NET site in RELEASE mode, and set compilation debug="false", will my ASP.NET and System.Diagnostics Tracing still work? | I believe that tracing is set separately from debugging in the configuration, so yes, if properly configured.
```
<configuration>
<system.web>
<trace enabled="true" requestLimit="40" localOnly="false"/>
</system.web>
</configuration>
``` |
313,653 | <p>Is there a way to set "work offline" in TFS without having to try opening a solution, waiting for it to time out, and then having Visual Studio work out that it has failed?</p>
<p>It seems a touch ridiculous that I can't just tick a box to tell it myself, seeing as I'm probably the one most qualified to know when I... | [
{
"answer_id": 323925,
"author": "Ian Nelson",
"author_id": 2084,
"author_profile": "https://Stackoverflow.com/users/2084",
"pm_score": 1,
"selected": false,
"text": "<p>Team Foundation Server 2008 does support working offline.</p>\n\n<p><a href=\"http://msdn2.microsoft.com/en-us/teamsys... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192/"
] | Is there a way to set "work offline" in TFS without having to try opening a solution, waiting for it to time out, and then having Visual Studio work out that it has failed?
It seems a touch ridiculous that I can't just tick a box to tell it myself, seeing as I'm probably the one most qualified to know when I'm not in ... | Ben Ryan has the regkeys you seek on his blog:
* <http://blogs.msdn.com/benryan/archive/2007/12/12/when-and-how-does-my-solution-go-offline.aspx>
* <http://blogs.msdn.com/benryan/archive/2007/12/12/how-to-make-tfs-offline-strictly-solution-based.aspx>
Most of these controls are also built into the latest [Power Tools... |
313,729 | <ul>
<li>How can we implement the Builder
pattern of <a href="http://developers.sun.com/learning/javaoneonline/2006/coreplatform/TS-1512.pdf?" rel="noreferrer">Joshua's
Effective Java</a> in C#?</li>
</ul>
<p>Below is the code I have tried, is there a better way to do this?</p>
<pre><code> public class NutritionFa... | [
{
"answer_id": 313747,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": false,
"text": "<p>In Protocol Buffers, we implement the builder pattern like this (vastly simplified):</p>\n\n<pre><code>public sealed ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26036/"
] | * How can we implement the Builder
pattern of [Joshua's
Effective Java](http://developers.sun.com/learning/javaoneonline/2006/coreplatform/TS-1512.pdf?) in C#?
Below is the code I have tried, is there a better way to do this?
```
public class NutritionFacts
{
public static NutritionFacts.Builder Build... | In Protocol Buffers, we implement the builder pattern like this (vastly simplified):
```
public sealed class SomeMessage
{
public string Name { get; private set; }
public int Age { get; private set; }
// Can only be called in this class and nested types
private SomeMessage() {}
public sealed class Builder
... |
313,753 | <p>I have a incoming stream of bytes (unsigned char) from either a file or network. I need this data placed in a class, and is looking for a NET-way of doing this. </p>
<p>I bet some does this all the time, so I guess there is a better method to do this than using BitConverter. </p>
<p>I realize I supplied too litle ... | [
{
"answer_id": 313761,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 1,
"selected": false,
"text": "<p>It's not entirely clear what you mean, but if you're basically looking for a way to buffer the data so you can get at... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37583/"
] | I have a incoming stream of bytes (unsigned char) from either a file or network. I need this data placed in a class, and is looking for a NET-way of doing this.
I bet some does this all the time, so I guess there is a better method to do this than using BitConverter.
I realize I supplied too litle information. Let ... | As Jon mentioned, it's not clear, what you need. Maybe you are talking about maybe it is [Binary serialization](http://msdn.microsoft.com/en-us/library/72hyey7b(VS.71).aspx) what you are looking for? |
313,759 | <p>What does <code>STRAIGHT_JOIN</code> do in this code ?</p>
<pre><code>SELECT STRAIGHT_JOIN ClosingBalance
FROM Accounts
WHERE idAccounts = FidDebit;
</code></pre>
| [
{
"answer_id": 313770,
"author": "schnaader",
"author_id": 34065,
"author_profile": "https://Stackoverflow.com/users/34065",
"pm_score": 2,
"selected": false,
"text": "<p>From <a href=\"http://dev.mysql.com/doc/refman/5.0/en/join.html\" rel=\"nofollow noreferrer\">here</a>:</p>\n\n<block... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17560/"
] | What does `STRAIGHT_JOIN` do in this code ?
```
SELECT STRAIGHT_JOIN ClosingBalance
FROM Accounts
WHERE idAccounts = FidDebit;
``` | STRAIGHT\_JOIN is intended as an instruction to the MySQL query optimiser that the tables must be joined from left to right in the order they are listed in the query.
<http://dev.mysql.com/doc/refman/5.0/en/join.html>
As you only have one table in this query, it wouldn't appear to be doing anything. |
313,777 | <p>Port was filtered by ISP.</p>
<p>The problem is that HTTPS 443 port isn't accessible from internet, but it is open in our local network.
Our iSeries v5r4 is connected to inet via L2TP withot IPSec.
If no packet filters are active, nmap shows that ports 25, 80, 110 and even 10322 (WAS admin console) have state 'open... | [
{
"answer_id": 313783,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 0,
"selected": false,
"text": "<p>You should configure your firewall to open and close TCP/IP ports.</p>\n\n<p>Each firewall has a list of ports (or... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40228/"
] | Port was filtered by ISP.
The problem is that HTTPS 443 port isn't accessible from internet, but it is open in our local network.
Our iSeries v5r4 is connected to inet via L2TP withot IPSec.
If no packet filters are active, nmap shows that ports 25, 80, 110 and even 10322 (WAS admin console) have state 'open' on inter... | Some ISPs filter specific ports, like RoadRunner used to filter my webserver. It'd be odd since 80 isn't filtered, but it's a possibility. |
313,778 | <p>I have a project that has a makefile with broken dependencies. Is there any best known way to generate a list of dependencies for the project that I can use in the makefile, other than examining each source file by hand or with a hand written perl script?</p>
| [
{
"answer_id": 313780,
"author": "Barry Kelly",
"author_id": 3712,
"author_profile": "https://Stackoverflow.com/users/3712",
"pm_score": 3,
"selected": false,
"text": "<p>The GNU C preprocessor cpp has an option, -MM, which produces a make-suitable set of dependencies based on inclusion ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1084/"
] | I have a project that has a makefile with broken dependencies. Is there any best known way to generate a list of dependencies for the project that I can use in the makefile, other than examining each source file by hand or with a hand written perl script? | [GNU make](https://make.mad-scientist.net/papers/advanced-auto-dependency-generation/#combine)'s documentation provides a good solution.
Absolutely. `g++ -MM <your file>` will generate a GMake compatible list of dependencies. I use something like this:
```
# Add .d to Make's recognized suffixes.
SUFFIXES += .d
#We d... |
313,786 | <p>Hej, </p>
<p>assuming I have a code that looks like this:</p>
<pre><code>List<User> userList = GetUserByName (u => u.Name == name);
DoSomethingWithTheUsers (userList.ToArray ());
</code></pre>
<p>Now I want to know the type of the objects in the Array in the method <em>DoSomethingWithTheUsers (object[] m... | [
{
"answer_id": 313790,
"author": "Barry Kelly",
"author_id": 3712,
"author_profile": "https://Stackoverflow.com/users/3712",
"pm_score": 5,
"selected": true,
"text": "<p>The array type will be an array of User, i.e. User[]. Why not just use Type.GetElementType() on the GetType() of the a... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33111/"
] | Hej,
assuming I have a code that looks like this:
```
List<User> userList = GetUserByName (u => u.Name == name);
DoSomethingWithTheUsers (userList.ToArray ());
```
Now I want to know the type of the objects in the Array in the method *DoSomethingWithTheUsers (object[] myObjects)*
Simply done by *myObjects.First (... | The array type will be an array of User, i.e. User[]. Why not just use Type.GetElementType() on the GetType() of the array? I.e. using your example:
```
myObjects.GetType().GetElementType()
``` |
313,789 | <p>I want to redirect from an action in one controller to an action in a second controller. Normally I would use RedirectToAction("actionName", "controllerName", objects);
The method I want to redirect to has two overloads:</p>
<ul>
<li>One for HttpVerbs.Get that is used for direct linking</li>
<li>One for HttpVerbs.P... | [
{
"answer_id": 313836,
"author": "Eric Schoonover",
"author_id": 3957,
"author_profile": "https://Stackoverflow.com/users/3957",
"pm_score": 3,
"selected": true,
"text": "<p>You can not use RedirectToAction (or anything else) to cause the browser to redirect with a HTTP POST. You may be... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | I want to redirect from an action in one controller to an action in a second controller. Normally I would use RedirectToAction("actionName", "controllerName", objects);
The method I want to redirect to has two overloads:
* One for HttpVerbs.Get that is used for direct linking
* One for HttpVerbs.Post accepting referen... | You can not use RedirectToAction (or anything else) to cause the browser to redirect with a HTTP POST. You may be able to hack it with some JavaScript but it would be ugly.
If you can provide some more details about the target action that you would like to redirect the user to we can provide better answers for you. Pl... |
313,796 | <p>How can you get castle Windsor to choose the right implantation of a interface at run time when you have multiple implementations in the container.</p>
<p>For example lets say i have a simple interface called IExamCalc that does calculations to work out how someone did in that exam.</p>
<p>No we have several imple... | [
{
"answer_id": 313804,
"author": "kͩeͣmͮpͥ ͩ",
"author_id": 26479,
"author_profile": "https://Stackoverflow.com/users/26479",
"pm_score": 1,
"selected": false,
"text": "<p>The short answer is, you can't. This kind of choice is dependent on application code, so if you just did <code>conta... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1213936/"
] | How can you get castle Windsor to choose the right implantation of a interface at run time when you have multiple implementations in the container.
For example lets say i have a simple interface called IExamCalc that does calculations to work out how someone did in that exam.
No we have several implementation of this... | As David said, you can't, but IHandlerSelector will let you take control. Check out the tests to get an idea of how to use them: <https://svn.castleproject.org/svn/castle/trunk/InversionOfControl/Castle.Windsor.Tests/HandlerSelectorsTestCase.cs>
Basically, you would do something like:
```
public class WritenExamHandl... |
313,802 | <p>We host the .NET runtime as part of a Win32 program, and lately it has begun to consistently break at a specific address, in mscorwks.dll.</p>
<p>At the specified address, there is a 0xCC byte, which is a INT 3 instruction, which fires the debugger.</p>
<p>Has anyone else seen this?</p>
<p>I can't see enough info... | [
{
"answer_id": 313810,
"author": "schnaader",
"author_id": 34065,
"author_profile": "https://Stackoverflow.com/users/34065",
"pm_score": 3,
"selected": true,
"text": "<p>There's a discussion about a similar problem <a href=\"http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/d... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267/"
] | We host the .NET runtime as part of a Win32 program, and lately it has begun to consistently break at a specific address, in mscorwks.dll.
At the specified address, there is a 0xCC byte, which is a INT 3 instruction, which fires the debugger.
Has anyone else seen this?
I can't see enough information in the dll to kn... | There's a discussion about a similar problem [here](http://social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/d2a864b0-339b-49d3-9c15-5b918f4bf711). The most interesting part is this:
>
> Mscorwks.dll is just the messenger. It is telling you that it detected a loaderlock. It is your code that caused it.
>
>
> |
313,805 | <p>I don't want to have the user install Google Gears so I can show him his guessed location. Is there a way to get the location without having to use Google Gears?</p>
<p>I have found <a href="http://www.wipmania.com/de/blog/google-geolocation-api/" rel="noreferrer">http://www.wipmania.com/de/blog/google-geolocation-... | [
{
"answer_id": 313812,
"author": "Stefan Mai",
"author_id": 13257,
"author_profile": "https://Stackoverflow.com/users/13257",
"pm_score": 4,
"selected": true,
"text": "<p>This is typically called IP Geolocation.</p>\n\n<p>An example is <a href=\"http://www.geody.com/geoip.php\" rel=\"nor... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19929/"
] | I don't want to have the user install Google Gears so I can show him his guessed location. Is there a way to get the location without having to use Google Gears?
I have found <http://www.wipmania.com/de/blog/google-geolocation-api/> but it does not offer an example. | This is typically called IP Geolocation.
An example is [here](http://www.geody.com/geoip.php).
The thing is, most sites (if you plan on calling this as a web service) will charge you for it. Otherwise, throw together a web service that grabs a geolocation page, parses it for the address, and returns that piece of inf... |
313,813 | <pre><code><?php
class Box {
var $contents;
function Box($contents) {
$this-&gt;contents = $contents;
}
function get_whats_inside() {
return $this-&gt;contents;
}
}
?>
</code></pre>
<p>I am going through a OO tutorial. I am familiar with PHP and the concept of OO but... | [
{
"answer_id": 313816,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 4,
"selected": true,
"text": "<p>It should read $this->contents instead of $this-&gt;contents</p>\n"
},
{
"answer_id": 313817,
"... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31677/"
] | ```
<?php
class Box {
var $contents;
function Box($contents) {
$this->contents = $contents;
}
function get_whats_inside() {
return $this->contents;
}
}
?>
```
I am going through a OO tutorial. I am familiar with PHP and the concept of OO but it is still an uphill struggle m... | It should read $this->contents instead of $this->contents |
313,822 | <p>How do you modify a propertygrid at runtime in every way? I want to be able to add and remove properties and add "dynamic types", what I mean with that is a type that result in a runtime generated dropdown in the propertygrid using a TypeConverter.</p>
<p>I have actually been able to do both those things (add/remov... | [
{
"answer_id": 313868,
"author": "Vincent Van Den Berghe",
"author_id": 39259,
"author_profile": "https://Stackoverflow.com/users/39259",
"pm_score": 4,
"selected": true,
"text": "<p>What you do, is adding StatesList (a TypeConverter) as a property.<br>\nWhat you should do, is adding a p... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39636/"
] | How do you modify a propertygrid at runtime in every way? I want to be able to add and remove properties and add "dynamic types", what I mean with that is a type that result in a runtime generated dropdown in the propertygrid using a TypeConverter.
I have actually been able to do both those things (add/remove properti... | What you do, is adding StatesList (a TypeConverter) as a property.
What you should do, is adding a property with StatesList as its TypeConverter. |
313,824 | <p>all! Typing from Italy
This little piece of code works if the matrix size is less then 800 and fails with a segmentation fault for higher sizes....
I have tried it with gcc 4.3.2 compiler in linux and macosx and VisualStudio compiler in windows.
Seemsthe problem is in the stack size..... how can I increase it ?
How ... | [
{
"answer_id": 313828,
"author": "schnaader",
"author_id": 34065,
"author_profile": "https://Stackoverflow.com/users/34065",
"pm_score": 2,
"selected": false,
"text": "<p>Default stack size in OpenMP is 4-8 MB. There's an environment variable called STACKSIZE you can change (for example ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | all! Typing from Italy
This little piece of code works if the matrix size is less then 800 and fails with a segmentation fault for higher sizes....
I have tried it with gcc 4.3.2 compiler in linux and macosx and VisualStudio compiler in windows.
Seemsthe problem is in the stack size..... how can I increase it ?
How can... | Default stack size in OpenMP is 4-8 MB. There's an environment variable called STACKSIZE you can change (for example to 16384, which is 16 MB). See chapter 5-5 of [this PDF](http://dlc.sun.com/pdf/819-3694/819-3694.pdf). |
313,839 | <p>I recently had a problem during the deployment of a windows service. Four computers did not cause any problems, but on the fifth any attempt to start the service failed due to an exception. The exception stack trace is written to the event log, so I though it should be easy to identify the cause:</p>
<pre><code>pro... | [
{
"answer_id": 313860,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": false,
"text": "<p>Use log4net</p>\n<p>The advantage of using log4net is that you can check the logging and control it with far more flexibili... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22114/"
] | I recently had a problem during the deployment of a windows service. Four computers did not cause any problems, but on the fifth any attempt to start the service failed due to an exception. The exception stack trace is written to the event log, so I though it should be easy to identify the cause:
```
protected overrid... | I think logging exceptions is one of the rare cases where you are better off swallowing the exception. In most cases you don't want your app to fail on this.
But why are you writing your logging code yourself anyway? Use a framework like NLog or Log4Net! These also swallow exceptions like I just said but you can redir... |
313,848 | <p>I have a space delimited list of files names, where spaces in the file names are prefixed by '\'</p>
<p>e.g. "first\ file second\ file"</p>
<p>How can I get my regex to match each file name?</p>
| [
{
"answer_id": 313857,
"author": "Stefan Mai",
"author_id": 13257,
"author_profile": "https://Stackoverflow.com/users/13257",
"pm_score": 5,
"selected": true,
"text": "<pre><code>(\\\\ |[^ ])+\n</code></pre>\n\n<p>Everything except spaces, except when they're escaped. Should work, sorry... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/259/"
] | I have a space delimited list of files names, where spaces in the file names are prefixed by '\'
e.g. "first\ file second\ file"
How can I get my regex to match each file name? | ```
(\\ |[^ ])+
```
Everything except spaces, except when they're escaped. Should work, sorry for misunderstanding your question initially. |
313,859 | <p>Are there Windows API functions that allows reading what the current password policy is? For instance, minimum length, complexity etc.</p>
<p>If not reading, is there a way to verify a password against the policy programmatically?</p>
| [
{
"answer_id": 313907,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": 4,
"selected": true,
"text": "<p>See <a href=\"http://technet.microsoft.com/en-us/magazine/cc137749.aspx\" rel=\"nofollow noreferrer\">Security Watch... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10644/"
] | Are there Windows API functions that allows reading what the current password policy is? For instance, minimum length, complexity etc.
If not reading, is there a way to verify a password against the policy programmatically? | See [Security Watch Windows Domain Password Policies](http://technet.microsoft.com/en-us/magazine/cc137749.aspx). You can hit AD using [ADSI](http://msdn.microsoft.com/en-us/library/aa772170.aspx) or its wrappers. I found a [VBScript sample](http://www.activexperts.com/activmonitor/windowsmanagement/adsi/samples/). You... |
313,880 | <p>If you type</p>
<pre><code>nslookup -type=SRV _xmpp-server._tcp.gmail.com
</code></pre>
<p>(or use the dig command in OSX) you get some SRV records relating to google chat</p>
<p>I would like to replicate this functionality in PHP, does anyone have any good ideas how to do this?</p>
<p>I would like to avoid usin... | [
{
"answer_id": 313898,
"author": "Tom Haigh",
"author_id": 22224,
"author_profile": "https://Stackoverflow.com/users/22224",
"pm_score": 4,
"selected": true,
"text": "<p>You could use <a href=\"http://pear.php.net/package/Net_DNS\" rel=\"nofollow noreferrer\">Pear Net_DNS</a>. I managed ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33604/"
] | If you type
```
nslookup -type=SRV _xmpp-server._tcp.gmail.com
```
(or use the dig command in OSX) you get some SRV records relating to google chat
I would like to replicate this functionality in PHP, does anyone have any good ideas how to do this?
I would like to avoid using exec() as this does not return 100% st... | You could use [Pear Net\_DNS](http://pear.php.net/package/Net_DNS). I managed to get this to work on Linux, but haven't tested it on Windows or any others:
```
require_once('Net/DNS.php');
$resolver = new Net_DNS_Resolver();
$response = $resolver->query('_xmpp-server._tcp.gmail.com', 'SRV');
if ($response) {
forea... |
313,882 | <p>After creating a instance of a class, can we invoke the constructor explicitly?
For example</p>
<pre><code>class A{
A(int a)
{
}
}
A instance;
instance.A(2);
</code></pre>
<p>Can we do this?</p>
| [
{
"answer_id": 313883,
"author": "Michael Platings",
"author_id": 2651243,
"author_profile": "https://Stackoverflow.com/users/2651243",
"pm_score": 5,
"selected": true,
"text": "<p>You can use <a href=\"http://en.wikipedia.org/wiki/Placement_new\" rel=\"nofollow noreferrer\">placement ne... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40236/"
] | After creating a instance of a class, can we invoke the constructor explicitly?
For example
```
class A{
A(int a)
{
}
}
A instance;
instance.A(2);
```
Can we do this? | You can use [placement new](http://en.wikipedia.org/wiki/Placement_new), which permits
```
new (&instance) A(2);
```
However, from your example you'd be calling a constructor on an object twice which is very bad practice. Instead I'd recommend you just do
```
A instance(2);
```
Placement new is usually only used ... |
313,893 | <p>I need to get execution time in milliseconds.</p>
<blockquote>
<p>I originally asked this question back in 2008. The accepted answer then was to use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime" rel="noreferrer"><code>new Date().getTime()</code></a> However, ... | [
{
"answer_id": 313902,
"author": "Stefan Mai",
"author_id": 13257,
"author_profile": "https://Stackoverflow.com/users/13257",
"pm_score": 4,
"selected": false,
"text": "<p>Use Firebug, enable both Console and Javascript. Click Profile. Reload. Click Profile again. View the report.</p... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13370/"
] | I need to get execution time in milliseconds.
>
> I originally asked this question back in 2008. The accepted answer then was to use [`new Date().getTime()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime) However, we can all agree now that using the standard [`performan... | Using [**performance.now()**](https://developer.mozilla.org/en-US/docs/Web/API/Performance.now):
------------------------------------------------------------------------------------------------
```js
var startTime = performance.now()
doSomething() // <---- measured code goes between startTime and endTime
var endTi... |
313,900 | <p>Using ICU 4.0 regex library, I find that the following regex is exhibiting exponential time:</p>
<pre><code>actual: "[^<]*<\?"
C code: "[^<]*<\\?"
</code></pre>
<p>Aim: find "<?" where there is no other "<" before it</p>
<p>When running this regex on plain text with no "<" characters at all i... | [
{
"answer_id": 313925,
"author": "Markus Jarderot",
"author_id": 22364,
"author_profile": "https://Stackoverflow.com/users/22364",
"pm_score": 1,
"selected": false,
"text": "<p>The regex engine isn't that smart. It will try to match from <em>every</em> position, and <em>each</em> time se... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31423/"
] | Using ICU 4.0 regex library, I find that the following regex is exhibiting exponential time:
```
actual: "[^<]*<\?"
C code: "[^<]*<\\?"
```
Aim: find "<?" where there is no other "<" before it
When running this regex on plain text with no "<" characters at all it appears to take exponential time. If the text has at... | You will find an explanation at [Regular Expression Matching Can Be Simple And Fast](http://swtch.com/~rsc/regexp/regexp1.html "Regular Expression Matching Can Be Simple And Fast (but is slow in Java, Perl, PHP, Python, Ruby, ...)").
As MizardX said, if the match fails at position 0, the engine will try again at po... |
313,910 | <p>At the moment, I have some functions which look like this:</p>
<pre><code>private bool inFunction1 = false;
public void function1()
{
if (inFunction1) return;
inFunction1 = true;
// do stuff which might cause function1 to get called
...
inFunction1 = false;
}
</code></pre>
<p>I'd like to be a... | [
{
"answer_id": 313923,
"author": "Anthony",
"author_id": 5599,
"author_profile": "https://Stackoverflow.com/users/5599",
"pm_score": 1,
"selected": false,
"text": "<p>There is no such attribute predefined. You can make new attributes, but that won't help you. The issue is making the cust... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] | At the moment, I have some functions which look like this:
```
private bool inFunction1 = false;
public void function1()
{
if (inFunction1) return;
inFunction1 = true;
// do stuff which might cause function1 to get called
...
inFunction1 = false;
}
```
I'd like to be able to declare them like t... | Instead of using a bool and setting it directly, try using a long and the Interlocked class:
```
long m_InFunction=0;
if(Interlocked.CompareExchange(ref m_InFunction,1,0)==0)
{
// We're not in the function
try
{
}
finally
{
m_InFunction=0;
}
}
else
{
// We're already in the function
}
```
This w... |
313,916 | <p>I have a Java Swing application, developed on Mac OS X 10.5 using Java 1.5.</p>
<p>I'm trying to make a custom cursor appear when the user moves the mouse over some text in a dialog. The cursor never changes, though. </p>
<p>When I don't use a JFrame instead of a JDialog, the cursor does change. But then I'll have... | [
{
"answer_id": 313985,
"author": "PhiLho",
"author_id": 15459,
"author_profile": "https://Stackoverflow.com/users/15459",
"pm_score": 3,
"selected": true,
"text": "<p>Looks like it is a bug in Java 1.5: I first tried with Java 1.6.0_07 and it worked as expected (on Windows XP). Then I re... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2959/"
] | I have a Java Swing application, developed on Mac OS X 10.5 using Java 1.5.
I'm trying to make a custom cursor appear when the user moves the mouse over some text in a dialog. The cursor never changes, though.
When I don't use a JFrame instead of a JDialog, the cursor does change. But then I'll have to write all the... | Looks like it is a bug in Java 1.5: I first tried with Java 1.6.0\_07 and it worked as expected (on Windows XP). Then I recompiled with Java 1.5.0\_06 and indeed the cursor remains in default state.
Knowing the difficulties of Java 1.6 on MacOS, I see it will be hard to fix that...
[Bug ID: 5079694 JDialog doesn't re... |
313,917 | <p>I've got a 1-based array of four items which I need to traverse. For a given index in the array, I need to work out the index of the next item, and the index of the previous item. This sounds simple but the array needs to wrap around. So when you are at the beginning of the array, the previous item is considered to ... | [
{
"answer_id": 313928,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 3,
"selected": true,
"text": "<p>Since modulo always works better on 0-based ranges, you can turn it into one of these using <code>CurrentItem - 1</cod... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12277/"
] | I've got a 1-based array of four items which I need to traverse. For a given index in the array, I need to work out the index of the next item, and the index of the previous item. This sounds simple but the array needs to wrap around. So when you are at the beginning of the array, the previous item is considered to be ... | Since modulo always works better on 0-based ranges, you can turn it into one of these using `CurrentItem - 1`.
Then, with modulo 4, adding 3 is the same as subtracting 1 but has the advantage of never going negative (some modulo operators may not like negatives).
Then you once again add 1 to get back to a 1-based num... |
313,921 | <pre><code>class Score
{
var $score;
var $name;
var $dept;
var $date;
function Score($score, $name, $dept, $date)
{
$this->scores = ($score);
$this->name = ($name);
$this->dept = ($dept);
$this->date = ($date);
}
function return_score(){
... | [
{
"answer_id": 313936,
"author": "Davide Gualano",
"author_id": 28582,
"author_profile": "https://Stackoverflow.com/users/28582",
"pm_score": 2,
"selected": false,
"text": "<p>You can only return one value in each function or method.</p>\n\n<p>In your situation, you should have a method ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31677/"
] | ```
class Score
{
var $score;
var $name;
var $dept;
var $date;
function Score($score, $name, $dept, $date)
{
$this->scores = ($score);
$this->name = ($name);
$this->dept = ($dept);
$this->date = ($date);
}
function return_score(){
return $this->s... | You can't return more than once in a function. You *could* return a concatenated string:
```
return $this->scores.' '.this->name.' '.$this->dept.' '.$this->date;
//added spaces for readability, but this is a silly thing to do anyway...
```
I wouldn't recommend it though as you'd be mixing you presentation of the obj... |
313,935 | <p>I have a sql query that runs super fast, around one second, when not using variables, like:</p>
<pre><code>WHERE id BETWEEN 5461094 and 5461097
</code></pre>
<p>But when I have:</p>
<pre><code>declare @firstId int
declare @lastId int
set @firstId = 5461094
set @lastId = 5461097
...
WHERE id BETWEEN @firstId... | [
{
"answer_id": 313952,
"author": "Ben R",
"author_id": 27705,
"author_profile": "https://Stackoverflow.com/users/27705",
"pm_score": 5,
"selected": true,
"text": "<p>It's because when the values are hard coded, it can look up <a href=\"http://www.microsoft.com/technet/prodtechnol/sql/200... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21668/"
] | I have a sql query that runs super fast, around one second, when not using variables, like:
```
WHERE id BETWEEN 5461094 and 5461097
```
But when I have:
```
declare @firstId int
declare @lastId int
set @firstId = 5461094
set @lastId = 5461097
...
WHERE id BETWEEN @firstId and @lastId
```
... the query runs... | It's because when the values are hard coded, it can look up [the statistics](http://www.microsoft.com/technet/prodtechnol/sql/2005/qrystats.mspx) it has on the data in the table, and figure out the best query to run. Have a look at the execution plans of each of these queries. It must be scanning when your using variab... |
313,962 | <p>I'm currently using the following SQL for retrieving the last seven days worth of entries from a table:</p>
<pre><code>purchased >= date_sub(now() ,interval 7 day)
</code></pre>
<p>However, I need to change this so it retrieves the last full weeks worth of entries (midnight Saturday to midnight Saturday). So ba... | [
{
"answer_id": 313984,
"author": "acrosman",
"author_id": 24215,
"author_profile": "https://Stackoverflow.com/users/24215",
"pm_score": 0,
"selected": false,
"text": "<p>MySQL has a <a href=\"http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_week\" rel=\"nofoll... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39428/"
] | I'm currently using the following SQL for retrieving the last seven days worth of entries from a table:
```
purchased >= date_sub(now() ,interval 7 day)
```
However, I need to change this so it retrieves the last full weeks worth of entries (midnight Saturday to midnight Saturday). So basically, throughout the week ... | see the MySQL function [YEARWEEK()](http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_yearweek).
So you could do something like
```
SELECT * FROM table WHERE YEARWEEK(purchased) = YEARWEEK(NOW());
```
You can change the starting day of the week by using a second mode parameter
What migh... |
313,969 | <p>I have the the following html elements:</p>
<pre><code><tr>
<td> <label for="casenumber">Case:</label></td>
<td>
<%=Html.TextBox("casenumber", "", new Dictionary<string, object>
{
{"id", "casenumberID"}
})%>
</td>
</tr>
<tr>... | [
{
"answer_id": 314013,
"author": "Andrew Bullock",
"author_id": 28543,
"author_profile": "https://Stackoverflow.com/users/28543",
"pm_score": 3,
"selected": true,
"text": "<p>I use <a href=\"http://www.texotela.co.uk/code/jquery/select/\" rel=\"nofollow noreferrer\">this</a> for selectbo... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3834/"
] | I have the the following html elements:
```
<tr>
<td> <label for="casenumber">Case:</label></td>
<td>
<%=Html.TextBox("casenumber", "", new Dictionary<string, object>
{
{"id", "casenumberID"}
})%>
</td>
</tr>
<tr>
<td><label for="fogbugzUser">Users:</label></td>
<td>
<%=Html.DropDownL... | I use [this](http://www.texotela.co.uk/code/jquery/select/) for selectboxes in jquery |
313,970 | <p>I want to convert a <code>std::string</code> to lowercase. I am aware of the function <code>tolower()</code>. However, in the past I have had issues with this function and it is hardly ideal anyway as using it with a <code>std::string</code> would require iterating over each character.</p>
<p>Is there an alternative... | [
{
"answer_id": 313988,
"author": "Rob",
"author_id": 9236,
"author_profile": "https://Stackoverflow.com/users/9236",
"pm_score": 9,
"selected": false,
"text": "<p><a href=\"https://www.boost.org/doc/libs/1_70_0/doc/html/boost/algorithm/to_lower.html\" rel=\"noreferrer\">Boost provides a ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18664/"
] | I want to convert a `std::string` to lowercase. I am aware of the function `tolower()`. However, in the past I have had issues with this function and it is hardly ideal anyway as using it with a `std::string` would require iterating over each character.
Is there an alternative which works 100% of the time? | Adapted from [*Not So Frequently Asked Questions*](http://notfaq.wordpress.com/2007/08/04/cc-convert-string-to-upperlower-case/):
```
#include <algorithm>
#include <cctype>
#include <string>
std::string data = "Abc";
std::transform(data.begin(), data.end(), data.begin(),
[](unsigned char c){ return std::tolower(c... |
313,992 | <p>When I am single stepping through one thread of a multi threaded program, the debugger gets interrupted with:</p>
<pre><code>0x(some hex ref) : tdb_event_death : ret
dbx: thread has exited -- next aborted
</code></pre>
<p>My guess is a thread somewhere in the program I am debugging has stopped, but it's not t... | [
{
"answer_id": 314004,
"author": "Brian Genisio",
"author_id": 36687,
"author_profile": "https://Stackoverflow.com/users/36687",
"pm_score": 1,
"selected": false,
"text": "<p>Without seeing the input, it is hard to tell what the best approach is. You are probably going to need to use th... | 2008/11/24 | [
"https://Stackoverflow.com/questions/313992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24508/"
] | When I am single stepping through one thread of a multi threaded program, the debugger gets interrupted with:
```
0x(some hex ref) : tdb_event_death : ret
dbx: thread has exited -- next aborted
```
My guess is a thread somewhere in the program I am debugging has stopped, but it's not the one I'm debugging so I ... | Without seeing the input, it is hard to tell what the best approach is. You are probably going to need to use the RegExp class to parse out your keys and values. If you can get clean enough paths to the values, you might be able to get away with string.Split() to split the path into arrays of keys and walk the registry... |
314,008 | <p>This is a contrived example, but lets say I have declared objects:</p>
<pre><code>CustomObj fooObj;
CustomObj barObj;
CustomObj bazObj;
</code></pre>
<p>And I have an string array:</p>
<pre><code>string[] stringarray = new string[] {"foo","bar","baz"};
</code></pre>
<p>How can I programmatically access and insta... | [
{
"answer_id": 314010,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 6,
"selected": true,
"text": "<p>You need to be clear in your mind about the difference between an object and a variable. Objects themselves don't have... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35463/"
] | This is a contrived example, but lets say I have declared objects:
```
CustomObj fooObj;
CustomObj barObj;
CustomObj bazObj;
```
And I have an string array:
```
string[] stringarray = new string[] {"foo","bar","baz"};
```
How can I programmatically access and instantiate those objects using the string array, iter... | You need to be clear in your mind about the difference between an object and a variable. Objects themselves don't have names. Variable names are decided at compile-time. You can't access variables via an execution-time-determined name except via reflection.
It sounds like you *really* just want a `Dictionary<string, C... |
314,012 | <p>I have a function which searches an STL container then returns the iterator when it finds the position, however I am getting some funny error messages, can tell me what I am doing wrong?</p>
<p>Function:</p>
<pre><code>std::vector< CClass >::iterator CClass::SearchFunction( const std::string& strField )
... | [
{
"answer_id": 314018,
"author": "Ferruccio",
"author_id": 4086,
"author_profile": "https://Stackoverflow.com/users/4086",
"pm_score": 4,
"selected": true,
"text": "<p>Your search function is returning a const_iterator. You should either return the same type, i.e. <code>std::vector< C... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18664/"
] | I have a function which searches an STL container then returns the iterator when it finds the position, however I am getting some funny error messages, can tell me what I am doing wrong?
Function:
```
std::vector< CClass >::iterator CClass::SearchFunction( const std::string& strField )
{
...
return it;
...
}
``... | Your search function is returning a const\_iterator. You should either return the same type, i.e. `std::vector< CClass >::const_iterator`, or cast it to a `std::vector< CClass >::iterator` if you intend the caller to be able to modify the found item through the iterator.
EDIT: after seeing your update, it seems the pr... |
314,024 | <p>My understanding is that you have to write unit tests that isolate functionality. So given a repository class that has this method:</p>
<pre><code>Entity GetById(Guid id)
</code></pre>
<p>and a <em>fake</em> implementation (using a Dictionary for storage), how would you write a test without first <em>adding</em> a... | [
{
"answer_id": 314041,
"author": "Chris Kimpton",
"author_id": 48310,
"author_profile": "https://Stackoverflow.com/users/48310",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, you could use known test ids in your test - that is what I would do. Although I have become a fan of <a hre... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4830/"
] | My understanding is that you have to write unit tests that isolate functionality. So given a repository class that has this method:
```
Entity GetById(Guid id)
```
and a *fake* implementation (using a Dictionary for storage), how would you write a test without first *adding* an entity? Is it ok to use a known set of... | Yes, using a fake implementation of an object/interface with a fixed list of items that can be queried from the fake instance is a valid practice.
Obviously, without adding an entry first, one can only test what's returned when the Guid can't be found in the repository.
In C# allows it, one also can have the fake i... |
314,033 | <p>Why doesn't the designer work if you inherit from an own written genericform?</p>
<p>Suppose I've got the following genericform</p>
<pre><code>public class GenericForm<T> : System.Windows.Forms.Form
{
public T Test
{
get;
set;
}
}
</code></pre>
<p>When I go to the designer I get ... | [
{
"answer_id": 314035,
"author": "Guillaume",
"author_id": 23704,
"author_profile": "https://Stackoverflow.com/users/23704",
"pm_score": 2,
"selected": false,
"text": "<p>Disclaimer : I dont work all that much under Windows</p>\n\n<p>In the general case, you shouldnt mess with your OS ca... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37311/"
] | Why doesn't the designer work if you inherit from an own written genericform?
Suppose I've got the following genericform
```
public class GenericForm<T> : System.Windows.Forms.Form
{
public T Test
{
get;
set;
}
}
```
When I go to the designer I get errors.
The only workaround I made up ... | Disclaimer : I dont work all that much under Windows
In the general case, you shouldnt mess with your OS cache. It should be smart enough to cache data that are accessed often. If it isnt, you should use an application level cache. I dont know which language you are using, but most probably there is a good cache frame... |
314,055 | <p>I know there is <a href="https://stackoverflow.com/questions/63546/vs2005-c-programmatically-change-connection-string-contained-in-appconfig">some similar issue</a>.</p>
<p>But, still the question is not answered! I need to <strong>modify</strong> the connection string not add a new one.</p>
| [
{
"answer_id": 314060,
"author": "MysticSlayer",
"author_id": 28139,
"author_profile": "https://Stackoverflow.com/users/28139",
"pm_score": 3,
"selected": false,
"text": "<p>This will help you out!</p>\n\n<pre><code> /// <summary>\n /// Add a connection string to the ... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I know there is [some similar issue](https://stackoverflow.com/questions/63546/vs2005-c-programmatically-change-connection-string-contained-in-appconfig).
But, still the question is not answered! I need to **modify** the connection string not add a new one. | This will help you out!
```
/// <summary>
/// Add a connection string to the connection
/// strings section and store it in the
/// configuration file.
/// </summary>
/// <param name="csName">The name of the property.</param>
/// <param name="connectionString">T... |
314,058 | <p>Is there a way to get MVEL 2.0 ( <a href="http://mvel.codehaus.org/" rel="nofollow noreferrer">http://mvel.codehaus.org/</a> ) to work with functions with optional parameters?</p>
<p>I would like to be able to eval this:</p>
<p>trunc('blahblah',2)</p>
<p>but also</p>
<p>trunc('blahblah',2,'[...]');</p>
<p>Now i... | [
{
"answer_id": 4429797,
"author": "Kr1z",
"author_id": 513690,
"author_profile": "https://Stackoverflow.com/users/513690",
"pm_score": 1,
"selected": false,
"text": "<p>In java you can declare multiple methods with the same name, but a different arguments.\nThat way you can support (in a... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40254/"
] | Is there a way to get MVEL 2.0 ( <http://mvel.codehaus.org/> ) to work with functions with optional parameters?
I would like to be able to eval this:
trunc('blahblah',2)
but also
trunc('blahblah',2,'[...]');
Now i have tried:
def trunc(param1,param2,param3) { ... impl ... }
That gives an exception if i try to c... | In java you can declare multiple methods with the same name, but a different arguments.
That way you can support (in a limited way) optional parameters.
Eg.:
```
private void method(Object obj1) {
Object obj2 = new Object("Default");
method(obj1, obj2);
}
private void method(Object obj1, Object obj2) {
do... |
314,095 | <p><strong>Is there a way that I can configure Visual Studio 2008 to understand CamelCase?</strong> Specifically, I'd like to be able to get <code>Ctrl + right</code> or <code>left</code> cursor to take me to a subsection of a variable or type name.</p>
<p>i.e., if my cursor was at the start of this line:</p>
<pre cla... | [
{
"answer_id": 314102,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": -1,
"selected": false,
"text": "<p>I don't think Visual Studio supports this feature internally, as it seems to be using the normal way Ctrl+Right and Ctrl+L... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1853/"
] | **Is there a way that I can configure Visual Studio 2008 to understand CamelCase?** Specifically, I'd like to be able to get `Ctrl + right` or `left` cursor to take me to a subsection of a variable or type name.
i.e., if my cursor was at the start of this line:
```cs
LongNamedExampleClass longNamed = new LongNamedExa... | Thanks to those who suggested Resharper. This gives me another reason to love it even more. Just to be specific about where this lives - JetBrains call it [**CamelHumps**](http://www.jetbrains.com/resharper/features/navigation_search.html#CamelHumps) (cute) and you can switch it on using the menu:
>
> **Resharper -> ... |
314,100 | <p>I'm working with LINQ to objects and have a function where in some cases I need to modify the underlying collection before calling <code>Aggregate(...)</code> and then return it to its original state before the funciton returns the results of <code>Aggregate(...)</code>. My current code looks something like this:</p... | [
{
"answer_id": 314107,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think there is a problem with your approach if you'll always use the result (since your result set is not large, it... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4797/"
] | I'm working with LINQ to objects and have a function where in some cases I need to modify the underlying collection before calling `Aggregate(...)` and then return it to its original state before the funciton returns the results of `Aggregate(...)`. My current code looks something like this:
```
bool collectionModifie... | Just to check I understand you - you basically want to iterate through all of the results, just to force any side effects to take place?
Side effects are generally a bad idea precisely because things are harder to understand with this kind of logic. Having said that, the easiest way to do it and force full evaluation ... |
314,108 | <p>How can I make this java generic cast ?</p>
<pre><code>public interface IField {
}
class Field implements IField { // package private class
}
public class Form {
private List<Field> fields;
public List<IField> getFields() {
return this.fields;
}
}
</code></pre>
<p>The return statemen... | [
{
"answer_id": 314112,
"author": "Sunlight",
"author_id": 33650,
"author_profile": "https://Stackoverflow.com/users/33650",
"pm_score": 4,
"selected": false,
"text": "<p>As it happens, you can, because Java generics are just grafted on, not part of the type system.</p>\n\n<p>You can do</... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24028/"
] | How can I make this java generic cast ?
```
public interface IField {
}
class Field implements IField { // package private class
}
public class Form {
private List<Field> fields;
public List<IField> getFields() {
return this.fields;
}
}
```
The return statement throws a compiler error (I know the re... | A better solution, IMO, is to change the signature of your method to use a bounded wildcard:
```
public List<? extends IField> getFields()
```
This will let the caller treat anything coming "out" of the list as an IField, but it won't let the caller add anything into the list (without casting or warnings), as they d... |
314,109 | <p>With PHP, I can make numerous PHP websites locally and then upload each of them to its own sub-directory of my PHP hosting service. </p>
<p>However, with ASP.NET, it seems that I can only upload my ASP.NET to the root of my hosting service. If I upload to a sub-directory, I get an error in </p>
<pre><code>section ... | [
{
"answer_id": 314112,
"author": "Sunlight",
"author_id": 33650,
"author_profile": "https://Stackoverflow.com/users/33650",
"pm_score": 4,
"selected": false,
"text": "<p>As it happens, you can, because Java generics are just grafted on, not part of the type system.</p>\n\n<p>You can do</... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | With PHP, I can make numerous PHP websites locally and then upload each of them to its own sub-directory of my PHP hosting service.
However, with ASP.NET, it seems that I can only upload my ASP.NET to the root of my hosting service. If I upload to a sub-directory, I get an error in
```
section registered as allowDe... | A better solution, IMO, is to change the signature of your method to use a bounded wildcard:
```
public List<? extends IField> getFields()
```
This will let the caller treat anything coming "out" of the list as an IField, but it won't let the caller add anything into the list (without casting or warnings), as they d... |
314,132 | <p>I'd like to commit just a part of a file using TortoiseSVN, is there some way to do that?</p>
<p>I'll give an example to make it clearer why I want to do that.</p>
<p>I have a file with some defines that are replaced in the build process, something like this:</p>
<pre><code>#define SOME_PATH "[SOME_PATH]"
</code>... | [
{
"answer_id": 314135,
"author": "Corey Trager",
"author_id": 9328,
"author_profile": "https://Stackoverflow.com/users/9328",
"pm_score": 4,
"selected": false,
"text": "<p>No. Subversion works at the file level.</p>\n"
},
{
"answer_id": 314137,
"author": "Nic Wise",
"au... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/727/"
] | I'd like to commit just a part of a file using TortoiseSVN, is there some way to do that?
I'll give an example to make it clearer why I want to do that.
I have a file with some defines that are replaced in the build process, something like this:
```
#define SOME_PATH "[SOME_PATH]"
```
This [SOME\_PATH] tag is repl... | The top voted answer is out-of-date.
From the tortoiseSVN website: <http://tortoisesvn.net/docs/nightly/TortoiseSVN_en/tsvn-dug-commit.html>
>
> Commit only parts of files
>
>
> Sometimes you want to only commit parts of the changes you made to a
> file. Such a situation usually happens when you're working on
> ... |
314,152 | <p>Consider the following use of template template parameters...</p>
<pre><code>#include <iostream>
template <typename X>
class A
{
X _t;
public:
A(X t)
:_t(t)
{
}
X GetValue()
{
return _t;
}
};
template <typename T, template <typename T> class C >
... | [
{
"answer_id": 314177,
"author": "coryan",
"author_id": 33325,
"author_profile": "https://Stackoverflow.com/users/33325",
"pm_score": 1,
"selected": false,
"text": "<p>What is wrong with:</p>\n\n<pre><code>template <typename C >\nstruct B\n{\n C c;\n};\n\nint main()\n{\n B<... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39648/"
] | Consider the following use of template template parameters...
```
#include <iostream>
template <typename X>
class A
{
X _t;
public:
A(X t)
:_t(t)
{
}
X GetValue()
{
return _t;
}
};
template <typename T, template <typename T> class C >
class B
{
C<T> _c;
public:
B(T... | I assume you're after X, as well as A, in your code.
The usual pattern is to have
```
template<typename C>
struct B
{
C c;
};
```
and then, inside classes eligible for substitution:
```
template<typename X>
class A
{
typedef X type_name;
X t;
};
```
Then you can access the template parameter using `C::... |
314,176 | <p>A cancer CT picture is stored inside a unsigned short array (1-dimensional).</p>
<p>I have the location information of the cancer region inside the picture, but the coordinates (x,y) are in superpixel (128x128 unsigned short). My task is to highlight this region. </p>
<p>I already solved this one by converting su... | [
{
"answer_id": 314204,
"author": "unwind",
"author_id": 28169,
"author_profile": "https://Stackoverflow.com/users/28169",
"pm_score": 1,
"selected": false,
"text": "<p>This is difficult to answer, since it's rather vague.</p>\n\n<p>If you only mean \"how do I access a pixel at (x,y) give... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40260/"
] | A cancer CT picture is stored inside a unsigned short array (1-dimensional).
I have the location information of the cancer region inside the picture, but the coordinates (x,y) are in superpixel (128x128 unsigned short). My task is to highlight this region.
I already solved this one by converting superpixel coordinat... | From what I understand you have:
* A large image that is a CT scan
* A rectangular area within that image that is a cancer
Then it gets a bit harder to understand. I believe you want to create some sort of class so that you can effectively access 128x128 blocks of the image as if they were a single pixel.
So if the ... |
314,181 | <p>Is there a way of automatically generating a HTML-Map compatible list of coordinates of polygon-like objects (e.g. countries on a map) with very distinctive borders?</p>
<p>Example image:</p>
<p><a href="http://www.bankaustria.at/landkarten/CEE_2007_w524.jpg">Map of CEE countries http://www.bankaustria.at/landkart... | [
{
"answer_id": 314201,
"author": "Jonathan C Dickinson",
"author_id": 24064,
"author_profile": "https://Stackoverflow.com/users/24064",
"pm_score": 1,
"selected": false,
"text": "<p>I can give you one step of the process: you are going to need to use the Sobel filter (often called edge d... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/898/"
] | Is there a way of automatically generating a HTML-Map compatible list of coordinates of polygon-like objects (e.g. countries on a map) with very distinctive borders?
Example image:
[Map of CEE countries http://www.bankaustria.at/landkarten/CEE\_2007\_w524.jpg](http://www.bankaustria.at/landkarten/CEE_2007_w524.jpg)
... | Open the map in Inkscape. If it is a bitmap, use Path -> Trace Bitmap to trace the edges. Clean up the vector data to include only the paths that you want to appear in your imagemap. Save the document, I suggest to a POVRay file. Now you have a list of vertices (and plenty of markup or metadata that you don't care abou... |
314,203 | <p>Can I collapse those two "getFields" methods into one using generics (the second method is intended to package private access) or should I rename the second one into something ugly like "getFieldPackagePrivate"?</p>
<pre><code>public interface IField {
}
class Field implements IField { // package private class
... | [
{
"answer_id": 314208,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>You can write (as per my answer to your previous question):</p>\n\n<pre><code>public List<? extends IField> get... | 2008/11/24 | [
"https://Stackoverflow.com/questions/314203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24028/"
] | Can I collapse those two "getFields" methods into one using generics (the second method is intended to package private access) or should I rename the second one into something ugly like "getFieldPackagePrivate"?
```
public interface IField {
}
class Field implements IField { // package private class
}
public cla... | You can write (as per my answer to your previous question):
```
public List<? extends IField> getFields()
```
but you can't overload by return type, and you can't expose a package-private type in a public method.
EDIT: With the change of the question, the answer is a simple "no". You'll have to rename your other me... |