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 |
|---|---|---|---|---|---|---|
334,527 | <p>I have code that looks like the following, which works fine for displaying the message, but can't figure out any way to get a hold of the stack trace. </p>
<pre><code>try {
throw new RuntimeException("This is bad stuff!");
} catch (Exception e ) {
mainForm.append("Exception: " + e.getMessage());
}
</code><... | [
{
"answer_id": 334649,
"author": "Somatik",
"author_id": 42198,
"author_profile": "https://Stackoverflow.com/users/42198",
"pm_score": 3,
"selected": true,
"text": "<p>see this article:\n<a href=\"http://lwuit.blogspot.com/2008/12/redirecting-output-on-s60-devices.html\" rel=\"nofollow n... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8207/"
] | I have code that looks like the following, which works fine for displaying the message, but can't figure out any way to get a hold of the stack trace.
```
try {
throw new RuntimeException("This is bad stuff!");
} catch (Exception e ) {
mainForm.append("Exception: " + e.getMessage());
}
```
Calling e.printSt... | see this article:
<http://lwuit.blogspot.com/2008/12/redirecting-output-on-s60-devices.html>
too bad there is no System.setErr(PrintWriter) or Thread.getStackTrace()
I don't think there is a (generic) solution for this problem |
334,532 | <p>I'm generating a coupon based on dynamic input and a cropped image, and I'm displaying the coupon using ntml and css right now, the problem is, printing this has become an issue because of how backgrounds disappear when printing and other problems, so I think the best solution would be to be able to generate an imag... | [
{
"answer_id": 334549,
"author": "adam",
"author_id": 33604,
"author_profile": "https://Stackoverflow.com/users/33604",
"pm_score": 0,
"selected": false,
"text": "<p>There is a very powerful image creation library called <a href=\"http://www.boutell.com/gd/\" rel=\"nofollow noreferrer\">... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29445/"
] | I'm generating a coupon based on dynamic input and a cropped image, and I'm displaying the coupon using ntml and css right now, the problem is, printing this has become an issue because of how backgrounds disappear when printing and other problems, so I think the best solution would be to be able to generate an image b... | What you can do is create an aspx page that changes the response type to be in the format you want and then put the image into the stream. I created a barcode generator that does a similar thing. Excluding all the formalities of generating the image, you'll Page\_Load will look something like this:
```
Bitmap FinalBit... |
334,571 | <p>I have a legacy MS Access 2007 table that contains 52 fields (1 field for each week of the year) representing historical sales data (plus one field for the year actually). I would like to convert this database into a more conventional Time/Value listing.</p>
<p>Does anyone knows how to do that without writing queri... | [
{
"answer_id": 334583,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": 3,
"selected": true,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/ms177410%28SQL.90%29.aspx\" rel=\"nofollow noreferrer\">Using PIVO... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18858/"
] | I have a legacy MS Access 2007 table that contains 52 fields (1 field for each week of the year) representing historical sales data (plus one field for the year actually). I would like to convert this database into a more conventional Time/Value listing.
Does anyone knows how to do that without writing queries with 52... | [Using PIVOT and UNPIVOT](http://msdn.microsoft.com/en-us/library/ms177410%28SQL.90%29.aspx).
>
> `UNPIVOT` performs almost the reverse
> operation of `PIVOT`, by rotating
> columns into rows. Suppose the table
> produced in the previous example is
> stored in the database as `pvt`, and you
> want to rotate the ... |
334,626 | <p>When an item is clicked in the checkedlistbox, it gets highlighted. How can I prevent this highlighting effect? </p>
<p>I can hook into the SelectedIndexChanged event and clear the selection, but the highlighting still happens and you see a blip. In fact, if you hold down the mouse click, never releasing it after y... | [
{
"answer_id": 334672,
"author": "Hath",
"author_id": 5186,
"author_profile": "https://Stackoverflow.com/users/5186",
"pm_score": 5,
"selected": true,
"text": "<p>this will do it apart from you still get the dotted line bit.</p>\n\n<pre><code>this.checkedListBox1.SelectionMode = System.W... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30581/"
] | When an item is clicked in the checkedlistbox, it gets highlighted. How can I prevent this highlighting effect?
I can hook into the SelectedIndexChanged event and clear the selection, but the highlighting still happens and you see a blip. In fact, if you hold down the mouse click, never releasing it after you clicked... | this will do it apart from you still get the dotted line bit.
```
this.checkedListBox1.SelectionMode = System.Windows.Forms.SelectionMode.None;
```
although now you can't click the check boxes... so you'll have to do something like so:
```
private void checkedListBox1_Click(object sender, EventArgs e)
{
... |
334,628 | <p>Using the <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="nofollow noreferrer">jQuery Validation</a> plugin and AJAX, how can I validate the contents of say an input (textbox) but pass more than one parameter to a controller action?</p>
<p>A brilliant example of passing a single value ... | [
{
"answer_id": 334657,
"author": "adam",
"author_id": 33604,
"author_profile": "https://Stackoverflow.com/users/33604",
"pm_score": 0,
"selected": false,
"text": "<p>Something like this?</p>\n\n<pre><code>$(document).ready(function(){\n $(\"#form-sign-up\").validate( {\n rules: {\n ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5791/"
] | Using the [jQuery Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) plugin and AJAX, how can I validate the contents of say an input (textbox) but pass more than one parameter to a controller action?
A brilliant example of passing a single value via AJAX using the plugin can be found [here](h... | Looking at the code for jQuery Validation it looks like the post data can not be customized. So you'll have to stick with query parameters:
```
<script type="text/javascript">
$(document).ready(function(){
$("#form-sign-up").validate(
{
var param1 = $('#mytextbox').val();
rules:
{
login:
... |
334,630 | <p>I'm trying to open a folder in explorer with a file selected.</p>
<p>The following code produces a file not found exception: </p>
<pre><code>System.Diagnostics.Process.Start(
"explorer.exe /select,"
+ listView1.SelectedItems[0].SubItems[1].Text + "\\"
+ listView1.SelectedItems[0].Text);
</code></pre>... | [
{
"answer_id": 334644,
"author": "Paul",
"author_id": 41301,
"author_profile": "https://Stackoverflow.com/users/41301",
"pm_score": 3,
"selected": false,
"text": "<p>You need to put the arguments to pass (\"/select etc\") in the second parameter of the Start method.</p>\n"
},
{
"... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41291/"
] | I'm trying to open a folder in explorer with a file selected.
The following code produces a file not found exception:
```
System.Diagnostics.Process.Start(
"explorer.exe /select,"
+ listView1.SelectedItems[0].SubItems[1].Text + "\\"
+ listView1.SelectedItems[0].Text);
```
How can I get this command t... | Use [this method](http://msdn.microsoft.com/en-us/library/h6ak8zt5.aspx):
```
Process.Start(String, String)
```
First argument is an application (explorer.exe), second method argument are arguments of the application you run.
For example:
in CMD:
```
explorer.exe -p
```
in C#:
```
Process.Start("explorer.exe",... |
334,655 | <p>I'd like to call a function in python using a dictionary with matching key-value pairs for the parameters.</p>
<p>Here is some code:</p>
<pre><code>d = dict(param='test')
def f(param):
print(param)
f(d)
</code></pre>
<p>This prints <code>{'param': 'test'}</code> but I'd like it to just print <code>test</code>.... | [
{
"answer_id": 334661,
"author": "Patrick Harrington",
"author_id": 41165,
"author_profile": "https://Stackoverflow.com/users/41165",
"pm_score": 3,
"selected": false,
"text": "<p>Here ya go - works just any other iterable:</p>\n\n<pre><code>d = {'param' : 'test'}\n\ndef f(dictionary):\n... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1575281/"
] | I'd like to call a function in python using a dictionary with matching key-value pairs for the parameters.
Here is some code:
```
d = dict(param='test')
def f(param):
print(param)
f(d)
```
This prints `{'param': 'test'}` but I'd like it to just print `test`.
I'd like it to work similarly for more parameters:... | Figured it out for myself in the end. It is simple, I was just missing the \*\* operator to unpack the dictionary
So my example becomes:
```
d = dict(p1=1, p2=2)
def f2(p1,p2):
print p1, p2
f2(**d)
``` |
334,671 | <p>I need to create a trigger in every database on my sql 2005 instance. I'm setting up some auditing ddl triggers.</p>
<p>I create a cursor with all database names and try to execute a USE statement. This doesn't seem to change the database - the CREATE TRIGGER statement just fires in adventureworks repeatedly. Th... | [
{
"answer_id": 334711,
"author": "Timothy Khouri",
"author_id": 11917,
"author_profile": "https://Stackoverflow.com/users/11917",
"pm_score": 1,
"selected": false,
"text": "<p>You don't have to create a CURSOR...</p>\n\n<pre><code>sp_msforeachdb 'USE ?; PRINT ''Hello ?'''\n</code></pre>\... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37379/"
] | I need to create a trigger in every database on my sql 2005 instance. I'm setting up some auditing ddl triggers.
I create a cursor with all database names and try to execute a USE statement. This doesn't seem to change the database - the CREATE TRIGGER statement just fires in adventureworks repeatedly. The other optio... | When you use EXEC() each use is in its own context. So, when you do EXEC('USE MyDB') it switches to MyDB for that context then the command ends and you're back where you started. There are a couple of possible solutions...
You can call sp\_executesql with a database name (for example, MyDB..sp\_executesql) and it will... |
334,674 | <p>So I don't do a lot of Win32 calls, but recently I have had to use the <a href="http://msdn.microsoft.com/en-us/library/ms724320(VS.85).aspx" rel="nofollow noreferrer"><code>GetFileTime()</code></a> and <a href="http://msdn.microsoft.com/en-us/library/ms724933(VS.85).aspx" rel="nofollow noreferrer"><code>SetFileTime... | [
{
"answer_id": 334690,
"author": "Roland Rabien",
"author_id": 39138,
"author_profile": "https://Stackoverflow.com/users/39138",
"pm_score": 4,
"selected": true,
"text": "<p>If you call the functions directly, then your program will not load on Win98.</p>\n\n<p>What you can do is use <co... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1913/"
] | So I don't do a lot of Win32 calls, but recently I have had to use the [`GetFileTime()`](http://msdn.microsoft.com/en-us/library/ms724320(VS.85).aspx) and [`SetFileTime()`](http://msdn.microsoft.com/en-us/library/ms724933(VS.85).aspx) functions. Now although Win98 and below are not officially supported in my program pe... | If you call the functions directly, then your program will not load on Win98.
What you can do is use `LoadLibrary()` / `GetProcAddress()` to get a pointer to `GetFileTime()` / `SetFileTime()`. On Win98 this will fail, giving you a null pointer which you can test for and ignore. On 2000 and later you will get a pointer... |
334,686 | <p>I have Perl on Mac, Windows and Ubuntu. How can I tell from within the script which one is which? Thanks in advance.</p>
<p><strong>Edit:</strong> I was asked what I am doing. It is a script, part of our cross-platform build system. The script recurses directories and figures out what files to build. Some files are... | [
{
"answer_id": 334700,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 7,
"selected": true,
"text": "<p>Examine the <a href=\"http://perldoc.perl.org/perlvar.html#%24OSNAME\" rel=\"noreferrer\"><code>$^O</code></a> var... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6444/"
] | I have Perl on Mac, Windows and Ubuntu. How can I tell from within the script which one is which? Thanks in advance.
**Edit:** I was asked what I am doing. It is a script, part of our cross-platform build system. The script recurses directories and figures out what files to build. Some files are platform-specific, and... | Examine the [`$^O`](http://perldoc.perl.org/perlvar.html#%24OSNAME) variable which will contain the name of the operating system:
```
print "$^O\n";
```
Which prints `linux` on Linux and `MSWin32` on Windows.
You can also refer to this variable by the name [`$OSNAME`](http://perldoc.perl.org/perlvar.html#%24OSNAME)... |
334,691 | <p>I need the tool for graphical representing of work flow in a program (like electronic circuits are described with graphical representation). The representation has to be like the following: functions are boxes and arrows between boxes are "messages". Like this:</p>
<p><a href="http://img372.imageshack.us/img372/847... | [
{
"answer_id": 340052,
"author": "Kirill Osenkov",
"author_id": 37899,
"author_profile": "https://Stackoverflow.com/users/37899",
"pm_score": 2,
"selected": false,
"text": "<p>Check out Microsoft DSL Tools - <a href=\"http://msdn.microsoft.com/en-us/library/bb126259.aspx\" rel=\"nofollow... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20514/"
] | I need the tool for graphical representing of work flow in a program (like electronic circuits are described with graphical representation). The representation has to be like the following: functions are boxes and arrows between boxes are "messages". Like this:
[alt text http://img372.imageshack.us/img372/8471/functio... | What about using something like [Graphviz](http://www.graphviz.org/)? |
334,698 | <p>Is it possible to create a MySQL select statement that uses an expression as x then checks if the value for x is under a certain amount?</p>
<pre><code>SELECT (mytable.field1 + 10) AS x FROM `mytable` WHERE x < 50;
</code></pre>
| [
{
"answer_id": 334704,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 4,
"selected": true,
"text": "<p>no you have to actually do this</p>\n\n<pre><code>SELECT (mytable.field1 + 10) AS x FROM `mytable` WHERE (mytable.field1 ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is it possible to create a MySQL select statement that uses an expression as x then checks if the value for x is under a certain amount?
```
SELECT (mytable.field1 + 10) AS x FROM `mytable` WHERE x < 50;
``` | no you have to actually do this
```
SELECT (mytable.field1 + 10) AS x FROM `mytable` WHERE (mytable.field1 + 10) < 50;
``` |
334,702 | <p>I'm trying to get an object element from my webpage using getElementById (ultimately so I can replace it with a dynamically created object element) but it is returning <code>null</code> in IE6.</p>
<p>In the following code, the <code>byId()</code> function returns <code>null</code> in IE but an <code>[object HTMLOb... | [
{
"answer_id": 334784,
"author": "annakata",
"author_id": 13018,
"author_profile": "https://Stackoverflow.com/users/13018",
"pm_score": 3,
"selected": true,
"text": "<p>This is because of the way IE treats <object> nodes vis-a-vis the DOM.</p>\n\n<p>Since you're dynamically replaci... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40443/"
] | I'm trying to get an object element from my webpage using getElementById (ultimately so I can replace it with a dynamically created object element) but it is returning `null` in IE6.
In the following code, the `byId()` function returns `null` in IE but an `[object HTMLObjectElement]` in Firefox 3 and the `lengthOfByTa... | This is because of the way IE treats <object> nodes vis-a-vis the DOM.
Since you're dynamically replacing anyway I recommend you instead create a <div> where you need it and change the innerHTML to be the HTML for the object you require. |
334,705 | <p>I'm trying to create a css reset that targets only my control. So the HTML will look something like this:</p>
<pre><code><body>
<img class="outterImg" src="sadkitty.gif" />
<div id="container" class="container">
<img class="innerImg" src="sadkitty.gif" />
<div class="subContai... | [
{
"answer_id": 334763,
"author": "Joel Meador",
"author_id": 1976,
"author_profile": "https://Stackoverflow.com/users/1976",
"pm_score": 0,
"selected": false,
"text": "<p>I suspect this results in close to what you wanted. </p>\n\n<pre><code>img \n{ \n border: solid 3px red; \n wid... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7423/"
] | I'm trying to create a css reset that targets only my control. So the HTML will look something like this:
```
<body>
<img class="outterImg" src="sadkitty.gif" />
<div id="container" class="container">
<img class="innerImg" src="sadkitty.gif" />
<div class="subContainer">
<img class="innerImg" src="sa... | The selector
`.innerImg img`
refers to an img element *inside* an element with the class innerImg. There's nothing like that in your document.
What you probably want there is `img.innerImg` .
Beyond that, there is a short calculation for [selector specificity](http://www.w3.org/TR/css3-selectors/#specificity) that d... |
334,708 | <p>I know that codeIgniter turns off GET parameters by default. </p>
<p>But by having everything done in POST, don't you get annoyed by the re-send data requests if ever you press back after a form submission?</p>
<p>It annoys me, but I'm not sure if I want to allow GET purely for this reason.</p>
<p>Is it such a b... | [
{
"answer_id": 334716,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 0,
"selected": false,
"text": "<p>GET parameters are cached by the web browser, POST is not. So with a POST you don't have to worry about caching, so tha... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42106/"
] | I know that codeIgniter turns off GET parameters by default.
But by having everything done in POST, don't you get annoyed by the re-send data requests if ever you press back after a form submission?
It annoys me, but I'm not sure if I want to allow GET purely for this reason.
Is it such a big security issue to allo... | When I first started working with CodeIgniter, not using GET really threw me off as well. But then I realized that you can simulate GET parameters by manipulating the URI using the built-in [URI Class](http://codeigniter.com/user_guide/libraries/uri.html). It's fantastic and it makes your URLs look better.
Or if you r... |
334,748 | <p>If I give the input from Text Box like</p>
<blockquote>
<p>AaBbcdCDEb</p>
</blockquote>
<p>the output should be</p>
<blockquote>
<p>ABCDE or abcde</p>
</blockquote>
<p>only unique characters should be there, no repeated characters.</p>
<p>How do I do this?</p>
| [
{
"answer_id": 334761,
"author": "joegtp",
"author_id": 39431,
"author_profile": "https://Stackoverflow.com/users/39431",
"pm_score": 2,
"selected": false,
"text": "<p>Use the Distinct extention method on the array of characters then recombine them into a string.</p>\n\n<pre><code>new st... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42532/"
] | If I give the input from Text Box like
>
> AaBbcdCDEb
>
>
>
the output should be
>
> ABCDE or abcde
>
>
>
only unique characters should be there, no repeated characters.
How do I do this? | Use the Distinct extention method on the array of characters then recombine them into a string.
```
new string("AaBbcdCDEb".ToLower().Distinct().ToArray());
``` |
334,753 | <p>It's not uncommon for me to record a patch, pull it into my staging branch and then realize I've done something small and silly like a typo in a logging message, or something similarly trivial which doesn't require (to my mind) a whole new patch.</p>
<p>In these instances, I've been using:</p>
<pre><code>darcs ame... | [
{
"answer_id": 715925,
"author": "drewrichards",
"author_id": 86935,
"author_profile": "https://Stackoverflow.com/users/86935",
"pm_score": 3,
"selected": true,
"text": "<p>You could try first running darcs unpull on the staging branch then pulling in the amended patch.</p>\n"
},
{
... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7856/"
] | It's not uncommon for me to record a patch, pull it into my staging branch and then realize I've done something small and silly like a typo in a logging message, or something similarly trivial which doesn't require (to my mind) a whole new patch.
In these instances, I've been using:
```
darcs amend-record
```
To up... | You could try first running darcs unpull on the staging branch then pulling in the amended patch. |
334,770 | <p>I am trying to make a Kiosk application more accessible by increasing the size of fonts.<br>
No problem on the main Form.<br>
I'm having a problem replacing MessageBoxes (for which I believe there is no way to increase the font size) with small forms with the same message.</p>
<p>This is where I'm running into the ... | [
{
"answer_id": 334785,
"author": "Rob Prouse",
"author_id": 30827,
"author_profile": "https://Stackoverflow.com/users/30827",
"pm_score": 2,
"selected": false,
"text": "<p>You cannot access the ErrorForm as if it was static. That is just the class definition, you need to set the property... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42524/"
] | I am trying to make a Kiosk application more accessible by increasing the size of fonts.
No problem on the main Form.
I'm having a problem replacing MessageBoxes (for which I believe there is no way to increase the font size) with small forms with the same message.
This is where I'm running into the problem. The... | You cannot access the ErrorForm as if it was static. That is just the class definition, you need to set the property on an instance of the ErrorForm.
Somewhere in your app, you created a new ErrorForm. You need to take that variable and set your LblNotCheckedInBecause property on that.
Look for code like this;
```
E... |
334,786 | <p>Velocity DisplayTool has a useful method:</p>
<pre><code>$display.list($list)
</code></pre>
<p>That will format a collection or array into the form "A, B and C". </p>
<p>The problem is lets say I have an ArrayList of objects, how do I output a specific object field instead of the whole object?
For example the reg... | [
{
"answer_id": 347004,
"author": "Dov Wasserman",
"author_id": 26010,
"author_profile": "https://Stackoverflow.com/users/26010",
"pm_score": 2,
"selected": false,
"text": "<p>So you want to end up with a formatted string like \"title1, title2 and title3\", where each element is the title... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20128/"
] | Velocity DisplayTool has a useful method:
```
$display.list($list)
```
That will format a collection or array into the form "A, B and C".
The problem is lets say I have an ArrayList of objects, how do I output a specific object field instead of the whole object?
For example the regular loop would look like this:
... | You might consider extending the DisplayTool to support this. Take a look at the SortTool, it allows you to sort on properties. Copying code from there should give you a good start toward adding this to DisplayTool. And if you do this and feel like sharing, let us know over on the dev@velocity.apache.org list. Heck, if... |
334,813 | <p>If I have the code:</p>
<pre><code>int f(int a) { return a; }
double f(double g) { return g; }
int main()
{
int which = f(1.0f);
}
</code></pre>
<p>Which overload of <em>f</em> is called, and why?</p>
| [
{
"answer_id": 334819,
"author": "Mark Ransom",
"author_id": 5987,
"author_profile": "https://Stackoverflow.com/users/5987",
"pm_score": 4,
"selected": true,
"text": "<p>The return type is not considered for overload purposes at all, thus you'll get the double version.</p>\n"
},
{
... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42543/"
] | If I have the code:
```
int f(int a) { return a; }
double f(double g) { return g; }
int main()
{
int which = f(1.0f);
}
```
Which overload of *f* is called, and why? | The return type is not considered for overload purposes at all, thus you'll get the double version. |
334,827 | <p>I would like to do the equivalent off <a href="http://www.bigdumbdev.com/2007/08/build-better-skimmer-part-2.html" rel="nofollow noreferrer">this</a> (ruby code) in python for a Django project I am working on. I want to make a <a href="http://designvigilante.com/files/photoSkim/filmStrip.jpg" rel="nofollow noreferre... | [
{
"answer_id": 334876,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 2,
"selected": false,
"text": "<p>Do you mnean something like this? <a href=\"http://code.activestate.com/recipes/412982/\" rel=\"nofollow noreferrer\">U... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42546/"
] | I would like to do the equivalent off [this](http://www.bigdumbdev.com/2007/08/build-better-skimmer-part-2.html) (ruby code) in python for a Django project I am working on. I want to make a [filmstrip image](http://designvigilante.com/files/photoSkim/filmStrip.jpg) of X number of images in a folder. | Here is a function that wraps **the contact sheet** function [S.Lott](https://stackoverflow.com/users/10661/slott) mentioned.
```
#!/usr/bin/env python
import os, os.path
from contactsheet import make_contact_sheet
def make_film_strip(fnames,
(photow,photoh),
(marl,mart,marr,mar... |
334,836 | <p>I have a request that returns a JSON object with a single property which is an array. How can I test if the array is empty?</p>
<p>With jQuery code like:</p>
<pre><code> $.getJSON(
jsonUrl,
function(data) {
if (data.RoleOwners == [ ]) {
$('<tr><... | [
{
"answer_id": 334864,
"author": "Svante Svenson",
"author_id": 19707,
"author_profile": "https://Stackoverflow.com/users/19707",
"pm_score": 6,
"selected": true,
"text": "<pre><code>(data.RoleOwners.length === 0)\n</code></pre>\n"
},
{
"answer_id": 6911328,
"author": "Sadiks... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12459/"
] | I have a request that returns a JSON object with a single property which is an array. How can I test if the array is empty?
With jQuery code like:
```
$.getJSON(
jsonUrl,
function(data) {
if (data.RoleOwners == [ ]) {
$('<tr><td>' + noRoleOwnersText + '</td... | ```
(data.RoleOwners.length === 0)
``` |
334,842 | <p>I wrote a program using AutoIT to fetch information from a number of websites using Internet Explorer. AutoIT is capable of hiding the window so that it is not visible, however when I navigate to a new website on that hidden window I still get the IE navigation sounds (button click sound, etc.).</p>
<p>How can I di... | [
{
"answer_id": 334864,
"author": "Svante Svenson",
"author_id": 19707,
"author_profile": "https://Stackoverflow.com/users/19707",
"pm_score": 6,
"selected": true,
"text": "<pre><code>(data.RoleOwners.length === 0)\n</code></pre>\n"
},
{
"answer_id": 6911328,
"author": "Sadiks... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I wrote a program using AutoIT to fetch information from a number of websites using Internet Explorer. AutoIT is capable of hiding the window so that it is not visible, however when I navigate to a new website on that hidden window I still get the IE navigation sounds (button click sound, etc.).
How can I disable the ... | ```
(data.RoleOwners.length === 0)
``` |
334,844 | <p>I have a few users setup in the web.config of an asp.net site to handle authentication. Without getting into details I'm not using the full membership/role provider and would rather not have to implement it at the moment do to time constraints. However I do need the ability to assign a role to a user so that securit... | [
{
"answer_id": 334991,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 4,
"selected": true,
"text": "<p>This is not possible to do via the web.config, you will need to setup the membership provider, but using the .ex... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3747/"
] | I have a few users setup in the web.config of an asp.net site to handle authentication. Without getting into details I'm not using the full membership/role provider and would rather not have to implement it at the moment do to time constraints. However I do need the ability to assign a role to a user so that securityTr... | This is not possible to do via the web.config, you will need to setup the membership provider, but using the .exe to create the database tables, the whole process literally takes under 5 minutes to complete! |
334,846 | <p>I have a mx:Canvas element that contains several mx:Panel elements. I want to be able to draw a line connecting two such mx:Panel's in such a way that the line continues to connect the two mx:Panels when one or both get dragged around. It seems like something that should be trivial to do, but I haven't been able to ... | [
{
"answer_id": 334886,
"author": "Ben Throop",
"author_id": 27899,
"author_profile": "https://Stackoverflow.com/users/27899",
"pm_score": 0,
"selected": false,
"text": "<p>You'd want to override the UIComponent method updateDisplayList() on the Canvas and do your drawing in there. </p>\n... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/280/"
] | I have a mx:Canvas element that contains several mx:Panel elements. I want to be able to draw a line connecting two such mx:Panel's in such a way that the line continues to connect the two mx:Panels when one or both get dragged around. It seems like something that should be trivial to do, but I haven't been able to fig... | >
> *"I've tried overriding the
> updateDisplayList() method of the
> mx:Canvas component but that seems to
> only update the drawing after the
> dragging. I would like for the line to
> follow the mx:Panel as it is being
> dragged."*
>
>
>
You can listen to [`MoveEvent.MOVE`](http://livedocs.adobe.com/flex/... |
334,850 | <p>My post below asked what the curly quotation marks were and why my app wouldn't work with them, my question now is how can I replace them when my program comes across them, how can I do this in C#? Are they special characters?</p>
<p><a href="https://stackoverflow.com/questions/334119/curly-quotation-marks-vs-squar... | [
{
"answer_id": 334894,
"author": "Mark Ransom",
"author_id": 5987,
"author_profile": "https://Stackoverflow.com/users/5987",
"pm_score": 2,
"selected": false,
"text": "<p>According to the Character Map application that comes with Windows, the Unicode values for the curly quotes are 0x201... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | My post below asked what the curly quotation marks were and why my app wouldn't work with them, my question now is how can I replace them when my program comes across them, how can I do this in C#? Are they special characters?
[curly-quotation-marks-vs-square-quotation-marks-what-gives](https://stackoverflow.com/quest... | A more extensive listing of problematic word characters
```
if (buffer.IndexOf('\u2013') > -1) buffer = buffer.Replace('\u2013', '-');
if (buffer.IndexOf('\u2014') > -1) buffer = buffer.Replace('\u2014', '-');
if (buffer.IndexOf('\u2015') > -1) buffer = buffer.Replace('\u2015', '-');
if (buffer.IndexOf('\u2017') > -1)... |
334,851 | <p>I'd like to be able to print the definition code of a lambda function.</p>
<p>Example if I define this function through the lambda syntax:</p>
<pre><code>>>>myfunction = lambda x: x==2
>>>print_code(myfunction)
</code></pre>
<p>I'd like to get this output:</p>
<pre><code>x==2
</code></pre>
| [
{
"answer_id": 334961,
"author": "rebra",
"author_id": 2282296,
"author_profile": "https://Stackoverflow.com/users/2282296",
"pm_score": -1,
"selected": false,
"text": "<p>Why do you want to do this? </p>\n\n<p>I guess you could use the \"dis\" module to disassemble your code to python b... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28165/"
] | I'd like to be able to print the definition code of a lambda function.
Example if I define this function through the lambda syntax:
```
>>>myfunction = lambda x: x==2
>>>print_code(myfunction)
```
I'd like to get this output:
```
x==2
``` | *As long as you save your code to a source file* you can retrieve the source code of
an object using the inspect module.
example:
open editor type:
```
myfunction = lambda x: x==2
```
save as lamtest.py
open shell type python to get to interactive python
type the following:
```
>>>from lamtest import myfunc
>>>i... |
334,852 | <p>I'm trying to write a simple query involving two tables. The "person" table has a unique <code>person_id</code> and a <code>name</code>, and the "friends" table has a <code>person_id</code> and a <code>friend_id</code> which is a FK to a <code>person_id</code> in the person table.</p>
<pre><code>person:
<PK>... | [
{
"answer_id": 334869,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 3,
"selected": false,
"text": "<p>You want something like this:</p>\n\n<pre><code>SELECT p.name, f.friend_id\nFROM person AS p\nINNER JOIN friends AS f ON p... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to write a simple query involving two tables. The "person" table has a unique `person_id` and a `name`, and the "friends" table has a `person_id` and a `friend_id` which is a FK to a `person_id` in the person table.
```
person:
<PK> int person_id
varchar[45] name
friends:
<PK> int person_id
<PK> int frie... | You want something like this:
```
SELECT p.name, f.friend_id
FROM person AS p
INNER JOIN friends AS f ON p.person_id = f.person_id
WHERE p.person_id = 1
```
This joins the two tables together using `p.person_id = f.person_id`
If a person has no friends, you won't get any rows back - if you don't want this then use ... |
334,856 | <p>What are the benefits of passing by pointer over passing by reference in C++?</p>
<p>Lately, I have seen a number of examples that chose passing function arguments by pointers instead of passing by reference. Are there benefits to doing this?</p>
<p>Example:</p>
<pre><code>func(SPRITE *x);
</code></pre>
<p>with... | [
{
"answer_id": 334866,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 8,
"selected": false,
"text": "<h3>Passing by pointer</h3>\n\n<ul>\n<li>Caller has to take the address -> not transparent</li>\n<li>A 0 va... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20229/"
] | What are the benefits of passing by pointer over passing by reference in C++?
Lately, I have seen a number of examples that chose passing function arguments by pointers instead of passing by reference. Are there benefits to doing this?
Example:
```
func(SPRITE *x);
```
with a call of
```
func(&mySprite);
```
vs... | A pointer can receive a NULL parameter, a reference parameter can not. If there's ever a chance that you could want to pass "no object", then use a pointer instead of a reference.
Also, passing by pointer allows you to explicitly see at the call site whether the object is passed by value or by reference:
```
// Is my... |
334,879 | <p>I am running a program and want to see what its return code is (since it returns different codes based on different errors).</p>
<p>I know in Bash I can do this by running</p>
<blockquote>
<p>echo $?</p>
</blockquote>
<p>What do I do when using cmd.exe on Windows?</p>
| [
{
"answer_id": 334890,
"author": "DrFloyd5",
"author_id": 1736623,
"author_profile": "https://Stackoverflow.com/users/1736623",
"pm_score": 11,
"selected": true,
"text": "<p>A pseudo environment variable named <code>errorlevel</code> stores the exit code:</p>\n<pre><code>echo Exit Code i... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3218/"
] | I am running a program and want to see what its return code is (since it returns different codes based on different errors).
I know in Bash I can do this by running
>
> echo $?
>
>
>
What do I do when using cmd.exe on Windows? | A pseudo environment variable named `errorlevel` stores the exit code:
```
echo Exit Code is %errorlevel%
```
Also, the `if` command has a special syntax:
```
if errorlevel
```
See `if /?` for details.
Example
=======
```
@echo off
my_nifty_exe.exe
if errorlevel 1 (
echo Failure Reason Given is %errorlevel%
... |
334,882 | <pre><code>void some_func(int param = get_default_param_value());
</code></pre>
| [
{
"answer_id": 334883,
"author": "Sergey Skoblikov",
"author_id": 12151,
"author_profile": "https://Stackoverflow.com/users/12151",
"pm_score": 4,
"selected": false,
"text": "<p>They don't have to be! A default parameter can be any expression within certain limitations. It is evaluated e... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12151/"
] | ```
void some_func(int param = get_default_param_value());
``` | Default parameter can be a subset of the full set of expressions. It must be bound at compile time and at the place of declaration of the default parameter. This means that it can be a function call or a static method call, and it can take any number of arguments as far as they are constants and/or global variables or ... |
334,896 | <p>I am using a makefile system with the pvcs compiler (using Microsoft Visual C++, 2008 compiler) and I am getting several link errors of the form:</p>
<blockquote>
<p><code>error LNK2019: unresolved external symbol __imp__RegisterFilter@8 referenced in function _main</code></p>
</blockquote>
<p>This is happening ... | [
{
"answer_id": 334904,
"author": "Brian",
"author_id": 16457,
"author_profile": "https://Stackoverflow.com/users/16457",
"pm_score": 2,
"selected": false,
"text": "<p>Try turning on verbose output for your linker (typically a command-line switch). That will show you exactly how the link... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42552/"
] | I am using a makefile system with the pvcs compiler (using Microsoft Visual C++, 2008 compiler) and I am getting several link errors of the form:
>
> `error LNK2019: unresolved external symbol __imp__RegisterFilter@8 referenced in function _main`
>
>
>
This is happening DESPITE using the `extern "C"` declaration,... | I was creating a simple Win32 c++ application in VS2005 and I was getting this error:
```
LNK2019: unresolved external symbol __imp__somefunction
```
This application was using property sheets, hence it required this header (prsht.h).
The solution to my problem was as follows: in program **Properties→Configuration ... |
334,907 | <p>I want to match any line that does not end with 'CA' or 'CA[any number]'. How can I do that using rlike in MySQL? (Note it doesn't support ?! etc).</p>
<p>Here's the regex for a positive match, I just need a way to negate it: <code>'^.*[C][A][0-9]?$'</code></p>
<p>(Due to an embarrassing architecture limitation... | [
{
"answer_id": 335054,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>Well the regex is coming from a column\n in a table, and most of the patterns\n there already w... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13009/"
] | I want to match any line that does not end with 'CA' or 'CA[any number]'. How can I do that using rlike in MySQL? (Note it doesn't support ?! etc).
Here's the regex for a positive match, I just need a way to negate it: `'^.*[C][A][0-9]?$'`
(Due to an embarrassing architecture limitation, I don't want to use `not rlik... | The trick is turning it into a description of what you *do* want to match.
Something doesn't end in CA or CA(digit) when:
It ends with something other than A or digit, or
It ends with something other than A, then a digit, or
It ends with something other than C, then A, then a digit, or
It ends with something other ... |
334,919 | <p>I am attempting to insert a mass of records into SQL Server 2005 from Vb.Net. Although the insertion is working fine, I am doing my best to try to make it as fast as possible. Currently, it takes ~ 11 mins for 100,000 records. What would be the suggested approach to inserting a large number of records into SQL Se... | [
{
"answer_id": 334926,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 5,
"selected": true,
"text": "<p>Use the <a href=\"http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx\" rel=\"nofollow n... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5800/"
] | I am attempting to insert a mass of records into SQL Server 2005 from Vb.Net. Although the insertion is working fine, I am doing my best to try to make it as fast as possible. Currently, it takes ~ 11 mins for 100,000 records. What would be the suggested approach to inserting a large number of records into SQL Server f... | Use the [SqlBulkCopy](http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx) class, it will be able to run through those 100K rows much faster than individual inserts.
Oh, and if you can, I would urge you to implement a [IDataReader](http://msdn.microsoft.com/en-us/library/system.data.idatarea... |
334,928 | <p>I have been up and down this site and found a lot of info on the Screen class and how to count the number of monitors and such but how do I determine which montitor a form is currently in?</p>
| [
{
"answer_id": 334941,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 0,
"selected": false,
"text": "<p>Each Screen object has a <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.screen.bounds.aspx... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34514/"
] | I have been up and down this site and found a lot of info on the Screen class and how to count the number of monitors and such but how do I determine which montitor a form is currently in? | A simpler method than using the bounds is to use the Screen.FromControl() method. This is the same functionality that Windows uses.
```
Screen.FromControl(this)
```
will return the screen object for the screen that contains most of the form that you call it from. |
334,939 | <p>I'm working on a legacy application that has a C++ extended stored procedure. This xsproc uses ODBC to connect to the database, which means it requires a DSN to be configured.</p>
<p>I'm updating the installer (created using Visual Studio 2008 setup project), and want to have a custom action that can create the O... | [
{
"answer_id": 334958,
"author": "Rob Prouse",
"author_id": 30827,
"author_profile": "https://Stackoverflow.com/users/30827",
"pm_score": 2,
"selected": false,
"text": "<p>There is a <a href=\"http://www.codeproject.com/Articles/5862/An-ODBC-DSN-Driver-Manager-DLL-written-in-Csharp-V\" r... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26414/"
] | I'm working on a legacy application that has a C++ extended stored procedure. This xsproc uses ODBC to connect to the database, which means it requires a DSN to be configured.
I'm updating the installer (created using Visual Studio 2008 setup project), and want to have a custom action that can create the ODBC DSN entr... | I actually solved this myself in the end by manipulating the registry. I've created a class to contain the functionality, the contents of which I've included here:
```
///<summary>
/// Class to assist with creation and removal of ODBC DSN entries
///</summary>
public static class ODBCManager
{
private const string... |
334,940 | <p>I have a webapp being hosted with a public hosting company, the site is not live yet, and I am still doing some testing with it. I am using nHibernate with Windsor Castle Container for dependency injection and the site seems to be responding very slow from time to time. I've contacted support but they said that it'... | [
{
"answer_id": 334980,
"author": "epochwolf",
"author_id": 16204,
"author_profile": "https://Stackoverflow.com/users/16204",
"pm_score": 0,
"selected": false,
"text": "<p>Assuming you are using a shared hosting environment, it's probably not your app. I've seen perfectly fine code grind ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41508/"
] | I have a webapp being hosted with a public hosting company, the site is not live yet, and I am still doing some testing with it. I am using nHibernate with Windsor Castle Container for dependency injection and the site seems to be responding very slow from time to time. I've contacted support but they said that it's my... | You don't know how slow your application is when you don't measure it. I'm using a [timing http module](http://haacked.com/archive/2008/07/02/httpmodule-for-timing-requests.aspx) during development to notice big performance issues fast.
When one of your pages loads slow, you should use a profiler to find the exact bot... |
334,948 | <p>I am using slideDown animation to show some divs in a newly added table row:</p>
<pre><code>$("div", newRow).slideDown(10000, UpdateHours(response.d.Hours));
</code></pre>
<p>however the UpdateHours() function is called long before the divs are finished animating. This is causing me a problem because the Updated H... | [
{
"answer_id": 334982,
"author": "Tracy Hurley",
"author_id": 31240,
"author_profile": "https://Stackoverflow.com/users/31240",
"pm_score": 6,
"selected": true,
"text": "<p>I think it's trying to pass the result of the call UpdateHours(response.d.Hours) as the callback function, which wo... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18349/"
] | I am using slideDown animation to show some divs in a newly added table row:
```
$("div", newRow).slideDown(10000, UpdateHours(response.d.Hours));
```
however the UpdateHours() function is called long before the divs are finished animating. This is causing me a problem because the Updated Hours then get covered by t... | I think it's trying to pass the result of the call UpdateHours(response.d.Hours) as the callback function, which would explain why it is being called so soon. One solution would be to create an anonymous function that calls UpdateHours.
```
$("div", newRow).slideDown(10000, function () { UpdateHours(response.d.Hours) ... |
334,951 | <p>I'm writing a unit test for a method that packs boolean values into a byte. The various bit locations are determined by the value of an enum, which only has 5 values right now, but it's conceivable (though extremely unlikely) that this number could go to 9.</p>
<p>I'd like a simple test along the lines of:</p>
<p... | [
{
"answer_id": 334999,
"author": "asalamon74",
"author_id": 21348,
"author_profile": "https://Stackoverflow.com/users/21348",
"pm_score": 0,
"selected": false,
"text": "<p>In Java byte has fixed size (8 bits), so no need for sizeof.</p>\n"
},
{
"answer_id": 335000,
"author": ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42562/"
] | I'm writing a unit test for a method that packs boolean values into a byte. The various bit locations are determined by the value of an enum, which only has 5 values right now, but it's conceivable (though extremely unlikely) that this number could go to 9.
I'd like a simple test along the lines of:
private byte m\_m... | I think this test does what you want. It is probably a waste of your time to get more generic than this.
```
public void testEnumSizeLessThanOneByte() throws Exception
{
assertTrue("MyEnum must have 8 or less values.",
MyEnum.values().length <= 8);
}
``` |
334,952 | <p>I have a class that inherits QTreeWidget. How can I find the currently selected row?
Usually I connect signals to slots this way:</p>
<pre><code>connect(myButton, SIGNAL(triggered(bool)), this, SLOT(myClick()));
</code></pre>
<p>However, I can't find anything similar for <code>QTreeWidget->QTreeWidgetItem</code... | [
{
"answer_id": 335162,
"author": "Dusty Campbell",
"author_id": 2174,
"author_profile": "https://Stackoverflow.com/users/2174",
"pm_score": 1,
"selected": false,
"text": "<p>According to the documentation <a href=\"http://doc.trolltech.com/4.4/qtreewidget.html\" rel=\"nofollow noreferrer... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39339/"
] | I have a class that inherits QTreeWidget. How can I find the currently selected row?
Usually I connect signals to slots this way:
```
connect(myButton, SIGNAL(triggered(bool)), this, SLOT(myClick()));
```
However, I can't find anything similar for `QTreeWidget->QTreeWidgetItem`.
The only way I found is to redefine t... | Using the itemClicked() signal will miss any selection changes made using the keyboard. I'm assuming that's a bad thing in your case. |
334,992 | <p>I'm trying to make some types in Django that map to standard Django types. The <a href="http://docs.djangoproject.com/en/dev/howto/custom-model-fields/#howto-custom-model-fields" rel="nofollow noreferrer">custom model field documentation</a> goes into complicated cases; I just want to store a basic Django type from... | [
{
"answer_id": 335215,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 1,
"selected": false,
"text": "<p>Why can't you do something like the following?</p>\n\n<pre><code>class Card(models.Model):\n \"\"\" A playing card. ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/334992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1320510/"
] | I'm trying to make some types in Django that map to standard Django types. The [custom model field documentation](http://docs.djangoproject.com/en/dev/howto/custom-model-fields/#howto-custom-model-fields) goes into complicated cases; I just want to store a basic Django type from a class with a bunch of handy methods.
... | I'd do this with a subclass of Django's PositiveIntegerField:
```
from django.db import models
class Card(object):
"""The ``Card`` class you described."""
...
class CardField(models.PositiveIntegerField):
__metaclass__ = models.SubfieldBase
def get_db_prep_value(self, value):
"""Return the `... |
335,030 | <p>I've seen some variable declare in VB.net in several way like:</p>
<pre><code>print("dim _Foo as string");
</code></pre>
<p>and
print("dim m_Foo as string");
and
print("dim foo as string");</p>
<p>I will like to know what's the standard for VB.net coding.</p>
| [
{
"answer_id": 335053,
"author": "Bullines",
"author_id": 27870,
"author_profile": "https://Stackoverflow.com/users/27870",
"pm_score": 3,
"selected": true,
"text": "<p>It all depends on the scope. In the case of:</p>\n\n<pre><code>Private Dim m_Foo As String\n</code></pre>\n\n<p>That i... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28647/"
] | I've seen some variable declare in VB.net in several way like:
```
print("dim _Foo as string");
```
and
print("dim m\_Foo as string");
and
print("dim foo as string");
I will like to know what's the standard for VB.net coding. | It all depends on the scope. In the case of:
```
Private Dim m_Foo As String
```
That implies that m\_Foo is a member of a class. This also implies the same thing:
```
Private Dim _Foo As String
```
It's a matter of preference.
On the other hand, something like this:
```
Dim Foo As String
```
might refer to a... |
335,061 | <p>I wanted to add dynamic charts in the webpage. It goes like this...</p>
<p>I get the start and end date from user and draw separate charts for each date bewteen the start and end date.</p>
<p>I get the data from sql database and bind it with the chart like this:</p>
<pre><code> SqlConnection UsageLogConn = new ... | [
{
"answer_id": 335362,
"author": "Programmin Tool",
"author_id": 21691,
"author_profile": "https://Stackoverflow.com/users/21691",
"pm_score": 2,
"selected": false,
"text": "<p>Ok so I may have overdone this, but I tried to make this pretty dynamic. Yeah, the list names are a bit odd, b... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335061",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I wanted to add dynamic charts in the webpage. It goes like this...
I get the start and end date from user and draw separate charts for each date bewteen the start and end date.
I get the data from sql database and bind it with the chart like this:
```
SqlConnection UsageLogConn = new
SqlConnection(C... | Ok so I may have overdone this, but I tried to make this pretty dynamic. Yeah, the list names are a bit odd, but I used another example of mine to build this.
```
protected void Page_Load(object sender, EventArgs e)
{
Bench[] benchList;
FoodIntake[] foodIntakeList;
Panel panelChartHolder;
panelChartHold... |
335,073 | <p>I have an Array Collection with any number of Objects. I know each Object has a given property. Is there an easy (aka "built-in") way to get an Array of all the values of that property in the Collection?</p>
<p>For instance, let's say I have the following Collection:</p>
<pre><code>var myArrayCollection:ArrayColle... | [
{
"answer_id": 335362,
"author": "Programmin Tool",
"author_id": 21691,
"author_profile": "https://Stackoverflow.com/users/21691",
"pm_score": 2,
"selected": false,
"text": "<p>Ok so I may have overdone this, but I tried to make this pretty dynamic. Yeah, the list names are a bit odd, b... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31298/"
] | I have an Array Collection with any number of Objects. I know each Object has a given property. Is there an easy (aka "built-in") way to get an Array of all the values of that property in the Collection?
For instance, let's say I have the following Collection:
```
var myArrayCollection:ArrayCollection = new ArrayColl... | Ok so I may have overdone this, but I tried to make this pretty dynamic. Yeah, the list names are a bit odd, but I used another example of mine to build this.
```
protected void Page_Load(object sender, EventArgs e)
{
Bench[] benchList;
FoodIntake[] foodIntakeList;
Panel panelChartHolder;
panelChartHold... |
335,078 | <p>If there will be a small number of files it should be easy with a recursive function to pass through all the files and add the size but what if there are lots of files, and by lots i really mean lots of files.</p>
| [
{
"answer_id": 335105,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 4,
"selected": true,
"text": "<p>You mean something like this?</p>\n\n<pre><code>import os\nfor path, dirs, files in os.walk( root ):\n for f in files:... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9789/"
] | If there will be a small number of files it should be easy with a recursive function to pass through all the files and add the size but what if there are lots of files, and by lots i really mean lots of files. | You mean something like this?
```
import os
for path, dirs, files in os.walk( root ):
for f in files:
print path, f, os.path.getsize( os.path.join( path, f ) )
``` |
335,095 | <p>Is it possible to access JSTL's forEach variable via code from within the loop?</p>
<pre><code><c:forEach items="${elements}" var="element">
<% element.someMethod(); %>
</c:forEach>
</code></pre>
| [
{
"answer_id": 335140,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https://Stackoverflow.com/users/8709",
"pm_score": -1,
"selected": false,
"text": "<p>Edit following the correction of the example:</p>\n\n<p>Yes, it is possible to access the <code>var</code> inside the... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24396/"
] | Is it possible to access JSTL's forEach variable via code from within the loop?
```
<c:forEach items="${elements}" var="element">
<% element.someMethod(); %>
</c:forEach>
``` | Well, I believe "element" is stored in the page context.
```
<c:forEach items="${elements}" var="element">
<% ((Element) pageContext.getAttribute("elements")).someMethod(); %>
</c:forEach>
``` |
335,096 | <p>As a newbie I'm trying to implement a sorting function in C++, using the list-class.
However, running the code I get the error that the list iterator is not incrementable... However it seems very unlikely as it should be incrementable!</p>
<p>code: </p>
<pre><code>void shuffle (list<int> &list1)
{
l... | [
{
"answer_id": 335136,
"author": "Dusty Campbell",
"author_id": 2174,
"author_profile": "https://Stackoverflow.com/users/2174",
"pm_score": 0,
"selected": false,
"text": "<p>I was also able to compile the posted code with VS2008 after I commented out the calls to print() and added the fo... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | As a newbie I'm trying to implement a sorting function in C++, using the list-class.
However, running the code I get the error that the list iterator is not incrementable... However it seems very unlikely as it should be incrementable!
code:
```
void shuffle (list<int> &list1)
{
list<int> smaller;
list<int>... | Your call to list1.pop\_front() removes the element which the iterator is pointing to initially, invalidating it. And an invalid iterator can not be incremented. :)
It took a few minutes to find with the debugger. Just keep an eye on the value of 'it' as you step through the program. I don't know if you know how to us... |
335,133 | <p>Here's a short test program:</p>
<pre><code>sub foo($;@) {
my $sql = shift;
my @params = @_;
print "sql: $sql\n";
print "params: " . join(",", @params);
}
sub bar($;@) {
foo(@_);
}
bar("select * from blah where x = ? and y = ?",2,3);
print "\n";
</code></pre>
<p>Why is the output this:</p>
<pre><code... | [
{
"answer_id": 335152,
"author": "Tarski",
"author_id": 27653,
"author_profile": "https://Stackoverflow.com/users/27653",
"pm_score": 3,
"selected": false,
"text": "<p>get rid of <code>($;@)</code> after your function names and it works fine.</p>\n"
},
{
"answer_id": 335153,
... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91385/"
] | Here's a short test program:
```
sub foo($;@) {
my $sql = shift;
my @params = @_;
print "sql: $sql\n";
print "params: " . join(",", @params);
}
sub bar($;@) {
foo(@_);
}
bar("select * from blah where x = ? and y = ?",2,3);
print "\n";
```
Why is the output this:
```
sql: 3
params:
```
Rather than th... | It's because when you call `foo(@_)`, the prototype for `foo()` forces the first parameter (which is an array) to be converted into a scalar (which is the number of elements in `@_`).
See answers to my previous question asking "[Why are Perl Function Prototypes Bad](https://stackoverflow.com/questions/297034/why-are-p... |
335,135 | <p>A longwinded question - please bear with me!</p>
<p>I want to programatically create an XML document with namespaces and schemas. Something like</p>
<pre><code><myroot
xmlns="http://www.someurl.com/ns/myroot"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.so... | [
{
"answer_id": 335152,
"author": "Tarski",
"author_id": 27653,
"author_profile": "https://Stackoverflow.com/users/27653",
"pm_score": 3,
"selected": false,
"text": "<p>get rid of <code>($;@)</code> after your function names and it works fine.</p>\n"
},
{
"answer_id": 335153,
... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3099/"
] | A longwinded question - please bear with me!
I want to programatically create an XML document with namespaces and schemas. Something like
```
<myroot
xmlns="http://www.someurl.com/ns/myroot"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.someurl.com/ns/myroot http:... | It's because when you call `foo(@_)`, the prototype for `foo()` forces the first parameter (which is an array) to be converted into a scalar (which is the number of elements in `@_`).
See answers to my previous question asking "[Why are Perl Function Prototypes Bad](https://stackoverflow.com/questions/297034/why-are-p... |
335,137 | <p>We are trying to decide how to handle object persistence accross postbacks, to avoid getting the data from the database in every request, and I'm leaning towards using Session (it's an intranet application, there won't be thousands of users), but this is due to the fact that I suspect that only the reference to the ... | [
{
"answer_id": 335168,
"author": "Ben Aston",
"author_id": 38522,
"author_profile": "https://Stackoverflow.com/users/38522",
"pm_score": 2,
"selected": false,
"text": "<p>ASP.NET creates a GUID that is stored in a cookie by default (but you can specify the use of the querystring) to iden... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1782/"
] | We are trying to decide how to handle object persistence accross postbacks, to avoid getting the data from the database in every request, and I'm leaning towards using Session (it's an intranet application, there won't be thousands of users), but this is due to the fact that I suspect that only the reference to the rea... | I have tried this:
I have created a class and store an instance of this in session (session state mode: InProc). Instance lives in aspnet\_wp.exe proc.
Then, I changed session state to SQL Server (still without [Serializable] attribute) and I got the following error.
**Unable to serialize the session state. In 'Stat... |
335,158 | <p>Is there a sort of php script which will run a series of URLs and then direct the user to the final destination? the use of this is:
creating a checkout cart on a site that doesn't have a robust "wishlist" feature. </p>
<p>The script runs a series of "add item to cart" urls, and then the final destination takes the... | [
{
"answer_id": 335176,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 2,
"selected": false,
"text": "<p>See <a href=\"http://php.net/curl\" rel=\"nofollow noreferrer\">http://php.net/curl</a></p>\n\n<p><strong>edit:</st... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42589/"
] | Is there a sort of php script which will run a series of URLs and then direct the user to the final destination? the use of this is:
creating a checkout cart on a site that doesn't have a robust "wishlist" feature.
The script runs a series of "add item to cart" urls, and then the final destination takes the user to t... | Yes you can do this with ajax.
Use [jQuery](http://jquery.com) to do your ajax requests.
e.g
```
$.get("http://mywebsite.com/json/cart_add.php?pid=25");
$.get("http://mywebsite.com/json/cart_add.php?pid=27");
```
If you use sessions then it will be added to the current session providing it is on the same domain. |
335,192 | <p>I have this code</p>
<pre><code> protected void btnUpdateAddress_Click(object sender, EventArgs e)
{
sdsAddressComparison.Update();
}
</code></pre>
<p>that I'm using to update an oracle database. When I run the update sql code in SQL Navigator I have to type "Commit" or hit the commit button.<... | [
{
"answer_id": 335202,
"author": "Brian Schmitt",
"author_id": 30492,
"author_profile": "https://Stackoverflow.com/users/30492",
"pm_score": 2,
"selected": false,
"text": "<p>Normally, No you do not need the commit.</p>\n\n<p>However you can write the code to use a transaction, and at th... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have this code
```
protected void btnUpdateAddress_Click(object sender, EventArgs e)
{
sdsAddressComparison.Update();
}
```
that I'm using to update an oracle database. When I run the update sql code in SQL Navigator I have to type "Commit" or hit the commit button.
Do I have to code in a "Com... | Normally, No you do not need the commit.
However you can write the code to use a transaction, and at the completion of the transaction you can call commit.
**E.G. (Regular):**
```
try {
// Open connection
dbConn.Open();
//DB Update Code Here
}
catch (Exception ex) {
throw;
... |
335,205 | <p>In PHP you can access characters of strings in a few different ways, one of which is substr(). You can also access the Nth character in a string with curly or square braces, like so:</p>
<pre><code>$string = 'hello';
echo $string{0}; // h
echo $string[0]; // h
</code></pre>
<p>My question is, is there a benefit ... | [
{
"answer_id": 335213,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 7,
"selected": true,
"text": "<p>use <code>$string[0]</code>, the other method (braces) has been removed in PHP 8.0.</p>\n<p>For <a href=\"https://www.php.net... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In PHP you can access characters of strings in a few different ways, one of which is substr(). You can also access the Nth character in a string with curly or square braces, like so:
```
$string = 'hello';
echo $string{0}; // h
echo $string[0]; // h
```
My question is, is there a benefit of one over the other? What... | use `$string[0]`, the other method (braces) has been removed in PHP 8.0.
For [strings](https://www.php.net/manual/en/language.types.string.php):
>
> Accessing characters within string literals using the {} syntax has been deprecated in PHP 7.4. This has been removed in PHP 8.0.
>
>
>
And for [arrays](https://www... |
335,229 | <p>I have a search program that will be looking at a database from a database. If the date range is more than 3 weeks I want to alert them that it might take a while with all the data in the database. I have a confirm message box in a JavaScript function. I want to check the date range in the aspx.cs page. how do I... | [
{
"answer_id": 335239,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 0,
"selected": false,
"text": "<p>Why check the date range on the server side? If you have the date range on the client side, its considerably less work.</... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a search program that will be looking at a database from a database. If the date range is more than 3 weeks I want to alert them that it might take a while with all the data in the database. I have a confirm message box in a JavaScript function. I want to check the date range in the aspx.cs page. how do I totrig... | If the button is a submit button, then add this to the onclick(). A true return value will allow the page to continue submitting, and a false will stop the postback (submit).
EDIT: Just try it before you say that its not right. It looks complicated but its pretty simple. Get the first date, Get the second date, compa... |
335,231 | <p>I am writing a custom tag in Django that should output a value stored in a user session, but I cannot find a way to access the session object from within a custom tag function. Is there any way to do this, without manually assigning the session object to a context variable?</p>
| [
{
"answer_id": 335334,
"author": "Matthew Christensen",
"author_id": 2123,
"author_profile": "https://Stackoverflow.com/users/2123",
"pm_score": 2,
"selected": false,
"text": "<p>You can do this with custom context processors (see <a href=\"http://docs.djangoproject.com/en/dev/ref/templa... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34171/"
] | I am writing a custom tag in Django that should output a value stored in a user session, but I cannot find a way to access the session object from within a custom tag function. Is there any way to do this, without manually assigning the session object to a context variable? | You should be able to add the request context processor in your settings.py file:
```
TEMPLATE_CONTEXT_PROCESSORS = ("django.core.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
'django.core.context_processors.request',)
... |
335,232 | <p>I essentially want to spider my local site and create a list of all the titles and URLs as in:</p>
<pre>
http://localhost/mySite/Default.aspx My Home Page
http://localhost/mySite/Preferences.aspx My Preferences
http://localhost/mySite/Messages.aspx Messages
</pre>
<p>I'm running Windows. I'm open to any... | [
{
"answer_id": 335297,
"author": "Roalt",
"author_id": 26387,
"author_profile": "https://Stackoverflow.com/users/26387",
"pm_score": 0,
"selected": false,
"text": "<p>Ok, I'm not familiar with Windows, but to get you in the right direction: use a XSLT transformation with </p>\n\n<p><x... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337/"
] | I essentially want to spider my local site and create a list of all the titles and URLs as in:
```
http://localhost/mySite/Default.aspx My Home Page
http://localhost/mySite/Preferences.aspx My Preferences
http://localhost/mySite/Messages.aspx Messages
```
I'm running Windows. I'm open to anything that wor... | A quick and dirty Cygwin Bash script which does the job:
```
#!/bin/bash
for file in $(find $WWWROOT -iname \*.aspx); do
echo -en $file '\t'
cat $file | tr '\n' ' ' | sed -i 's/.*<title>\([^<]*\)<\/title>.*/\1/'
done
```
Explanation: this finds every .aspx file under the root directory $WWWROOT, replaces all new... |
335,244 | <p>I am using the jQuery Cookie plugin (<a href="http://plugins.jquery.com/project/cookie" rel="noreferrer">download</a> and <a href="http://stilbuero.de/jquery/cookie/" rel="noreferrer">demo</a> and <a href="http://plugins.jquery.com/files/jquery.cookie.js.txt" rel="noreferrer">source code with comments</a>) to set an... | [
{
"answer_id": 335254,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 2,
"selected": false,
"text": "<p>Another possible cause is the <code>path: \"/\"</code>, since you're not using a normal web URL, <code>/</code> probably d... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4376/"
] | I am using the jQuery Cookie plugin ([download](http://plugins.jquery.com/project/cookie) and [demo](http://stilbuero.de/jquery/cookie/) and [source code with comments](http://plugins.jquery.com/files/jquery.cookie.js.txt)) to set and read a cookie. I'm developing the page on my **local machine**.
The following code w... | Chrome doesn't support cookies for local files (or, like Peter Lyons mentioned, localhost\*) unless you start it with the --enable-file-cookies flag. You can read a discussion about it at <http://code.google.com/p/chromium/issues/detail?id=535>.
\*Chrome *does* support cookies if you use the local IP address (127.0.0.... |
335,250 | <p>Given the below XML snippet I need to get a list of name/value pairs for each child under DataElements. XPath or an XML parser cannot be used for reasons beyond my control so I am using regex.</p>
<pre><code><?xml version="1.0"?>
<StandardDataObject xmlns="myns">
<DataElements>
<EmpStatus... | [
{
"answer_id": 335255,
"author": "Alnitak",
"author_id": 6782,
"author_profile": "https://Stackoverflow.com/users/6782",
"pm_score": 1,
"selected": false,
"text": "<p>Is there any reason you're not using a proper XML parser instead of regex's? This would be trivial with the right librar... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3211/"
] | Given the below XML snippet I need to get a list of name/value pairs for each child under DataElements. XPath or an XML parser cannot be used for reasons beyond my control so I am using regex.
```
<?xml version="1.0"?>
<StandardDataObject xmlns="myns">
<DataElements>
<EmpStatus>2.0</EmpStatus>
<Expenditure>9... | This should work in Java, if you can assume that between the DataElements tags, everything has the form value. I.e. no attributes, and no nested elements.
```
Pattern regex = Pattern.compile("<DataElements>(.*?)</DataElements>", Pattern.DOTALL);
Matcher matcher = regex.matcher(subjectString);
Pattern regex2 = Pattern.... |
335,265 | <p>I am having trouble getting Silverlight 2.0 to lay out text exactly how I want. I want text with line breaks and embedded links, with wrapping, like HTML text in a web page.</p>
<p>Here's the closest that I have come:</p>
<pre><code><UserControl x:Class="FlowPanelTest.Page"
xmlns="http://schemas.microsoft.c... | [
{
"answer_id": 338243,
"author": "Tom",
"author_id": 31672,
"author_profile": "https://Stackoverflow.com/users/31672",
"pm_score": 0,
"selected": false,
"text": "<p>A very interesting question. You may need to create your own custom control to handle this type of layout. You could use Ru... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5599/"
] | I am having trouble getting Silverlight 2.0 to lay out text exactly how I want. I want text with line breaks and embedded links, with wrapping, like HTML text in a web page.
Here's the closest that I have come:
```
<UserControl x:Class="FlowPanelTest.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/prese... | Why cant you use runs?
Use runs to concatonate all of the values that arent' going to have events, then those that have events break out into thier own text block, rinse lather repeat.
It seems to me that you should be able to do this with RegEx and some looping.
Check out Jesse Liberty's post on wrap panel and see... |
335,267 | <p>I have a custom DataGridView column that uses an embedded control that pops up a search window for the value of that column. The important thing is that the databound column is a numeric ID, but the custom column cells display a text description. </p>
<p>How do I get the column to sort on the text description rat... | [
{
"answer_id": 335366,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 1,
"selected": false,
"text": "<p>What are you using as the data-source? a <code>DataTable</code>? The sort is most commonly provided by the list it... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/945/"
] | I have a custom DataGridView column that uses an embedded control that pops up a search window for the value of that column. The important thing is that the databound column is a numeric ID, but the custom column cells display a text description.
How do I get the column to sort on the text description rather than the... | You can use a technique described in the following article [Column Sort Modes](http://msdn.microsoft.com/en-us/library/95scxcdy.aspx)
```
private bool ascending;
private int sortColumn;
private void dgv_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
List<SomeObject> list = (List<SomeObj... |
335,271 | <p>I am writing a .NET assembly using C++/CLI (version 9.0), and I would like to use the PIMPL idiom to avoid putting unnecessary stuff in my public header. Unfortunately, when I try to forward declare a class, and then use a tracking handle to it, I get Linker warning 4248: </p>
<blockquote>
<p>warning LNK4248: unr... | [
{
"answer_id": 342087,
"author": "Brian Stewart",
"author_id": 3114,
"author_profile": "https://Stackoverflow.com/users/3114",
"pm_score": 1,
"selected": false,
"text": "<p>Upon further digging and reflecting I have discovered that in some respects .NET does not really need to support PI... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3114/"
] | I am writing a .NET assembly using C++/CLI (version 9.0), and I would like to use the PIMPL idiom to avoid putting unnecessary stuff in my public header. Unfortunately, when I try to forward declare a class, and then use a tracking handle to it, I get Linker warning 4248:
>
> warning LNK4248: unresolved typeref toke... | I think you're using two technologies which do not really sit together well:
The natural application for pimpl is to avoid having to make header file changes all the time thereby causing big recompilations on big C++ projects.
The natural application for C++/cli is to write skinny little interop pieces, and the defau... |
335,276 | <p><br />I have an application where I need the user to upload a photo. After the photo is uploaded to the server, which shouldn't take very long, the user should get back a response that's a regular HTML page saying "thanks...bla bla bla..."<br />
Now, after the the response is sent back to the client and he goes on h... | [
{
"answer_id": 335290,
"author": "Chris Lees",
"author_id": 1398981,
"author_profile": "https://Stackoverflow.com/users/1398981",
"pm_score": 1,
"selected": false,
"text": "<p>It seems to me like you need to spin off another process to do what you need to do. You might even want to build... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30725/"
] | I have an application where I need the user to upload a photo. After the photo is uploaded to the server, which shouldn't take very long, the user should get back a response that's a regular HTML page saying "thanks...bla bla bla..."
Now, after the the response is sent back to the client and he goes on his merry way... | We do this for a lightweight logging situation:
```
Action<object> d = delegate(object val)
{
// in this anonymous delegate, write code that you want to run
ProcessDataAndLog();
};
d.BeginInvoke(null, null, null); // this spins off the method asynchronously.
```
It's by no means robust. If you need a guaran... |
335,286 | <p>I have two classes, Foo and Bar, that have constructors like this:</p>
<pre><code>class Foo
{
Foo()
{
// do some stuff
}
Foo(int arg)
{
// do some other stuff
}
}
class Bar : Foo
{
Bar() : base()
{
// some third thing
}
}
</code></pre>
<p>Now I want to introd... | [
{
"answer_id": 335314,
"author": "Jim Anderson",
"author_id": 42439,
"author_profile": "https://Stackoverflow.com/users/42439",
"pm_score": 1,
"selected": false,
"text": "<p>Can't you have the Bar constructor that takes an int invoke the parameterless constructor?</p>\n"
},
{
"an... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28771/"
] | I have two classes, Foo and Bar, that have constructors like this:
```
class Foo
{
Foo()
{
// do some stuff
}
Foo(int arg)
{
// do some other stuff
}
}
class Bar : Foo
{
Bar() : base()
{
// some third thing
}
}
```
Now I want to introduce a constructor for Bar ... | No, this isn't possible. If you use Reflector to examine the IL that's generated for each constructor, you'll see why -- you'd end up calling both of the constructors for the base class. In theory, the compiler could construct hidden methods to accomplish what you want, but there really isn't any advantage over you doi... |
335,311 | <p>My question is about one particular usage of static keyword. It is possible to use <code>static</code> keyword to cover a code block within a class which does not belong to any function. For example following code compiles:</p>
<pre><code>public class Test {
private static final int a;
static {
... | [
{
"answer_id": 335339,
"author": "Alnitak",
"author_id": 6782,
"author_profile": "https://Stackoverflow.com/users/6782",
"pm_score": 6,
"selected": false,
"text": "<p>The <code>static</code> block is a \"static initializer\".</p>\n\n<p>It's automatically invoked when the class is loaded,... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33885/"
] | My question is about one particular usage of static keyword. It is possible to use `static` keyword to cover a code block within a class which does not belong to any function. For example following code compiles:
```
public class Test {
private static final int a;
static {
a = 5;
doSomethin... | The code block with the static modifier signifies a *class* initializer; without the static modifier the code block is an *instance* initializer.
Class initializers are executed in the order they are defined (top down, just like simple variable initializers) when the class is loaded (actually, when it's resolved, but... |
335,337 | <p>This could be a little off the ballpark, but a friend asked me about it and it's kind of bothering me. How do you figure out the current path in your address bar if the server redirects all requests to a default file, say, index.html.</p>
<p>Let's say you entered:</p>
<pre><code>www.example.com/
</code></pre>
<p>... | [
{
"answer_id": 335367,
"author": "Vincent Ramdhanie",
"author_id": 27439,
"author_profile": "https://Stackoverflow.com/users/27439",
"pm_score": 2,
"selected": false,
"text": "<p>If the redirect happens on the server then the browser is not aware of it and you cannot access the actual re... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32816/"
] | This could be a little off the ballpark, but a friend asked me about it and it's kind of bothering me. How do you figure out the current path in your address bar if the server redirects all requests to a default file, say, index.html.
Let's say you entered:
```
www.example.com/
```
And your server configuration aut... | The problem is that it's not actually a redirect. When you type `'www.example.com'` into your web browser, the browser generates an HTTP request like the following:
```
GET / HTTP/1.1
User-Agent: curl/7.16.3 (i686-pc-cygwin) libcurl/7.16.3 OpenSSL/
0.9.8h zlib/1.2.3 libssh2/0.15-CVS
Host: www.example.com
Accept: */*
... |
335,369 | <p>We've run into some problems with the <a href="http://www.parashift.com/c++-faq-lite/static-init-order.html" rel="noreferrer">static initialization order fiasco</a>, and I'm looking for ways to comb through a whole lot of code to find possible occurrences. Any suggestions on how to do this efficiently?</p>
<p>Edit:... | [
{
"answer_id": 335414,
"author": "Evan Teran",
"author_id": 13430,
"author_profile": "https://Stackoverflow.com/users/13430",
"pm_score": 3,
"selected": false,
"text": "<p>perhaps use valgrind to find usage of uninitialized memory. The nicest solution to the \"static initialization order... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10077/"
] | We've run into some problems with the [static initialization order fiasco](http://www.parashift.com/c++-faq-lite/static-init-order.html), and I'm looking for ways to comb through a whole lot of code to find possible occurrences. Any suggestions on how to do this efficiently?
Edit: I'm getting some good answers on how ... | Solving order of initialization:
================================
First off, this is just a temporary work-around because you have global variables that you are trying to get rid of but just have not had time yet (you are going to get rid of them eventually aren't you? :-)
```
class A
{
public:
// Get the... |
335,378 | <p>In C# I use the <code>#warning</code> and <code>#error</code> directives,</p>
<pre><code>#warning This is dirty code...
#error Fix this before everything explodes!
</code></pre>
<p>This way, the compiler will let me know that I still have work to do. What technique do you use to mark code so you won't forget about... | [
{
"answer_id": 335385,
"author": "Guge",
"author_id": 37771,
"author_profile": "https://Stackoverflow.com/users/37771",
"pm_score": 8,
"selected": true,
"text": "<p>Mark them with <code>// TODO</code>, <code>// HACK</code> or other comment tokens that will show up in the task pane in Vis... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/343/"
] | In C# I use the `#warning` and `#error` directives,
```
#warning This is dirty code...
#error Fix this before everything explodes!
```
This way, the compiler will let me know that I still have work to do. What technique do you use to mark code so you won't forget about it? | Mark them with `// TODO`, `// HACK` or other comment tokens that will show up in the task pane in Visual Studio.
See [Using the Task List](https://msdn.microsoft.com/en-us/library/txtwdysk.aspx). |
335,387 | <p>What's a nice way to merge two sorted arrays in ActionScript (specifically ActionScript 3.0)? The resulting array should be sorted and without duplicates.</p>
| [
{
"answer_id": 335942,
"author": "hasseg",
"author_id": 4111,
"author_profile": "https://Stackoverflow.com/users/4111",
"pm_score": 5,
"selected": false,
"text": "<p>To merge (concatenate) arrays, use <code>.concat()</code>.</p>\n\n<p>Below are two examples of how you can concatenate arr... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4127/"
] | What's a nice way to merge two sorted arrays in ActionScript (specifically ActionScript 3.0)? The resulting array should be sorted and without duplicates. | To merge (concatenate) arrays, use `.concat()`.
Below are two examples of how you can concatenate arrays and remove duplicates at the same time.
More convenient way: (you can use `ArrayUtil.createUniqueCopy()` from [as3corelib](http://code.google.com/p/as3corelib/))
```
// from as3corelib:
import com.adobe.utils.Arr... |
335,399 | <p>What I want to do is patch an existing Python module that uses urllib2 to run on App Engine, but I don't want to break it so it can be used elsewhere. So I'm looking for a quick solution to test if the module is imported in the App Engine environment or not. Catching ImportError on urllib2 might not be the best solu... | [
{
"answer_id": 335464,
"author": "chryss",
"author_id": 5169,
"author_profile": "https://Stackoverflow.com/users/5169",
"pm_score": 4,
"selected": false,
"text": "<p>You could simply use sys.modules to test if a module has been imported (I'm using unicodedata as an example):</p>\n\n<pre>... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7883/"
] | What I want to do is patch an existing Python module that uses urllib2 to run on App Engine, but I don't want to break it so it can be used elsewhere. So I'm looking for a quick solution to test if the module is imported in the App Engine environment or not. Catching ImportError on urllib2 might not be the best solutio... | You could simply use sys.modules to test if a module has been imported (I'm using unicodedata as an example):
```
>>> import sys
>>> 'unicodedata' in sys.modules
False
>>> import unicodedata
>>> 'unicodedata' in sys.modules
True
``` |
335,407 | <p>I have a web app with a web-based configuration UI. If the user accesses via HTTP, I want to alert the user that they should really use HTTPS and give them a link to click on to get to the HTTPS-prefixed URL.</p>
<p>Now, this is pretty straightforward if we're on the default ports, but often, we're not - for exampl... | [
{
"answer_id": 336016,
"author": "Loki",
"author_id": 39057,
"author_profile": "https://Stackoverflow.com/users/39057",
"pm_score": 1,
"selected": false,
"text": "<p>You could transfer them automatically to https by using configuration only.</p>\n\n<p>in your web.xml:</p>\n\n<pre><code>&... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33905/"
] | I have a web app with a web-based configuration UI. If the user accesses via HTTP, I want to alert the user that they should really use HTTPS and give them a link to click on to get to the HTTPS-prefixed URL.
Now, this is pretty straightforward if we're on the default ports, but often, we're not - for example, HTTP mi... | You could transfer them automatically to https by using configuration only.
in your web.xml:
```
<user-data-constraint>
<transport-guarantee>
CONFIDENTIAL
</transport-guarantee>
</user-data-constraint>
```
and in your server.xml in the HTTPConnector:
```
redirectPort="YOUR_SSL_PORT"
``` |
335,409 | <p>I'm getting a syntax error (undefined line 1 test.js) in Firefox 3 when I run this code. The alert works properly (it displays 'work') but I have no idea why I am receiving the syntax error.</p>
<p>jQuery code:</p>
<pre><code>$.getJSON("json/test.js", function(data) {
alert(data[0].test);
});
</code></pre>
<... | [
{
"answer_id": 335438,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 0,
"selected": false,
"text": "<p>Try renaming \"test.js\" to \"test.json\", which is what <a href=\"http://en.wikipedia.org/wiki/JSON\" rel=\"nofollow nor... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8320/"
] | I'm getting a syntax error (undefined line 1 test.js) in Firefox 3 when I run this code. The alert works properly (it displays 'work') but I have no idea why I am receiving the syntax error.
jQuery code:
```
$.getJSON("json/test.js", function(data) {
alert(data[0].test);
});
```
test.js:
```
[{"test": "work"}]... | I found a solution to kick that error
```
$.ajaxSetup({'beforeSend': function(xhr){
if (xhr.overrideMimeType)
xhr.overrideMimeType("text/plain");
}
});
```
Now the explanation:
In firefox 3 (and I asume only firefox THREE) every file that has the mime-type of "text/xml" is parsed and syntax-checked. ... |
335,427 | <p>I've found what seems to be the C# equivalent of a <a href="http://thedailywtf.com/Articles/The_FOR-CASE_paradigm.aspx" rel="nofollow noreferrer">FOR-CASE</a> structure in a project I'm working on:</p>
<pre><code>foreach (string param in params.Split(';'))
{
string[] parts = param.Split('=');
string key = p... | [
{
"answer_id": 335441,
"author": "Guge",
"author_id": 37771,
"author_profile": "https://Stackoverflow.com/users/37771",
"pm_score": 3,
"selected": false,
"text": "<p>I don't think the code in your question is anything like the code you linked to....</p>\n\n<p>The code in the question loo... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've found what seems to be the C# equivalent of a [FOR-CASE](http://thedailywtf.com/Articles/The_FOR-CASE_paradigm.aspx) structure in a project I'm working on:
```
foreach (string param in params.Split(';'))
{
string[] parts = param.Split('=');
string key = parts[0].Trim().ToLower();
string value = parts[... | I don't think the code in your question is anything like the code you linked to....
The code in the question looks like something I might do if I wrote a command line tool.
Am I stupid for not seeing whats wrong with the code in the question?
An alternative is to use reflection to fill parameter value variables. I'... |
335,448 | <p>I have written a console application that sets the size of the console and output buffer. My problem is that after the program ends I cannot resize my cmd.exe window the way I did before. After the program sets the size of the window it retains that size no matter what I do afterwards. </p>
| [
{
"answer_id": 335580,
"author": "David Norman",
"author_id": 34502,
"author_profile": "https://Stackoverflow.com/users/34502",
"pm_score": 1,
"selected": false,
"text": "<p>It works for me in C#. </p>\n\n<pre><code>namespace CSharpTest\n{\n class Program\n {\n static void ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4491/"
] | I have written a console application that sets the size of the console and output buffer. My problem is that after the program ends I cannot resize my cmd.exe window the way I did before. After the program sets the size of the window it retains that size no matter what I do afterwards. | It works for me in C#.
```
namespace CSharpTest
{
class Program
{
static void Main(string[] args)
{
System.Console.WindowHeight = 50;
System.Console.WindowWidth = 100;
System.Console.BufferHeight = 6000;
System.Console.BufferWidth = 100;
... |
335,451 | <p>I want to run a standalone ruby script in which I need my RoR environment to be used. Specifically, I need my models extending ActionMailer and ActiveRecord. I also need to read the database configuration from my database.yml.
How do I go about it?</p>
| [
{
"answer_id": 335489,
"author": "mat",
"author_id": 42083,
"author_profile": "https://Stackoverflow.com/users/42083",
"pm_score": 4,
"selected": true,
"text": "<p>The easiest way is to change the shebang of your script from :</p>\n\n<pre><code>#!/usr/bin/ruby\n</code></pre>\n\n<p>to</p>... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17494/"
] | I want to run a standalone ruby script in which I need my RoR environment to be used. Specifically, I need my models extending ActionMailer and ActiveRecord. I also need to read the database configuration from my database.yml.
How do I go about it? | The easiest way is to change the shebang of your script from :
```
#!/usr/bin/ruby
```
to
```
#!/path/to/your/rails/script/runner
```
Et voilà, your script will be run with the full rails environment loaded. You can also run your script as `./my_script -e production` to have it run with the production database. |
335,481 | <p>I have a form that has a public property</p>
<pre><code>public bool cancelSearch = false;
</code></pre>
<p>I also have a class which is sitting in my bll (business logic layer), in this class I have a method, and in this method I have a loop. I would like to know how can I get the method to recognise the form (thi... | [
{
"answer_id": 335501,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 1,
"selected": false,
"text": "<p>Your question is really not clear. You might want to edit it.</p>\n\n<h2>Advice</h2>\n\n<p>The form shouldn'... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41291/"
] | I have a form that has a public property
```
public bool cancelSearch = false;
```
I also have a class which is sitting in my bll (business logic layer), in this class I have a method, and in this method I have a loop. I would like to know how can I get the method to recognise the form (this custom class and form1 a... | When you are calling the business logic that needs to know the information pass a reference of the form to the method.
Something like.
```
public class MyBLClass
{
public void DoSomething(Form1 theForm)
{
//You can use theForm.cancelSearch to get the value
}
}
```
then when calling it from a For... |
335,487 | <p>My emacs (on Windows) always launches with a set size, which is rather small, and if I resize it, it's not "remembered" at next start-up. </p>
<p>I've been playing with the following:</p>
<pre><code>(set-frame-position (selected-frame) 200 2) ; pixels x y from upper left
(set-frame-size (selected-frame) 110 58) ;... | [
{
"answer_id": 335518,
"author": "siukurnin",
"author_id": 35273,
"author_profile": "https://Stackoverflow.com/users/35273",
"pm_score": 2,
"selected": false,
"text": "<p>Did you try this : emacs -geometry 110x58+200+2 &</p>\n\n<p>Found at :</p>\n\n<p><a href=\"http://web.mit.edu/ans... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38803/"
] | My emacs (on Windows) always launches with a set size, which is rather small, and if I resize it, it's not "remembered" at next start-up.
I've been playing with the following:
```
(set-frame-position (selected-frame) 200 2) ; pixels x y from upper left
(set-frame-size (selected-frame) 110 58) ; rows and columns w h
... | Here's what I use in my `~/.emacs`:
```
(add-to-list 'default-frame-alist '(left . 0))
(add-to-list 'default-frame-alist '(top . 0))
(add-to-list 'default-frame-alist '(height . 50))
(add-to-list 'default-frame-alist '(width . 155))
``` |
335,514 | <p>I wrote this small script to pull the office property from get-user by piping the exchange mailbox object. </p>
<pre><code>$server = "tms08"
$arrUser = get-mailbox -Server $server |Get-MailboxStatistics |select identity
foreach ( $id in $arrUuser)
{
$office = get-user -Identity $id.Identity |select office
$... | [
{
"answer_id": 335519,
"author": "Martin v. Löwis",
"author_id": 33006,
"author_profile": "https://Stackoverflow.com/users/33006",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://www.dcl.hpi.uni-potsdam.de/research/lego.NET/release.htm\" rel=\"nofollow noreferrer\">Lego.NE... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18853/"
] | I wrote this small script to pull the office property from get-user by piping the exchange mailbox object.
```
$server = "tms08"
$arrUser = get-mailbox -Server $server |Get-MailboxStatistics |select identity
foreach ( $id in $arrUuser)
{
$office = get-user -Identity $id.Identity |select office
$out += $id.Ide... | Check this out: <http://msdn.microsoft.com/en-us/library/6t9t5wcf.aspx>
And this: <http://www.xenocode.com/Products/Postbuild-for-NET/?AdGroup=Linking&gclid=CNGCo-7zopcCFSYMDQod0giG_A> |
335,516 | <p>I'm making a simple remove link with an onClick event that brings up a confirm dialog. I want to confirm that the user wants to delete an entry. However, it seems that when Cancel is clicked in the dialog, the default action (i.e. the href link) is still taking place, so the entry still gets deleted. Not sure what I... | [
{
"answer_id": 335549,
"author": "Stepan Mazurov",
"author_id": 40786,
"author_profile": "https://Stackoverflow.com/users/40786",
"pm_score": 4,
"selected": false,
"text": "<p>I use this, works like a charm. No need to have any functions, just inline with your link(s)</p>\n\n<pre><code>o... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22371/"
] | I'm making a simple remove link with an onClick event that brings up a confirm dialog. I want to confirm that the user wants to delete an entry. However, it seems that when Cancel is clicked in the dialog, the default action (i.e. the href link) is still taking place, so the entry still gets deleted. Not sure what I'm ... | There's a typo in your code (the tag **a** is closed too early).
You can either use:
```
<a href="whatever" onclick="return confirm('are you sure?')"><img ...></a>
```
note the **return (confirm)**: the value returned by scripts in intrinsic evens decides whether the default browser action is run or not; in case you... |
335,517 | <p>Does anyone know a good .NET dictionary API? I'm not interested in meanings, rather I need to be able to query words in a number of different ways - return words of x length, return partial matches and so on...</p>
| [
{
"answer_id": 335537,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>You might want to look for a <a href=\"http://en.wikipedia.org/wiki/Trie\" rel=\"nofollow noreferrer\">Trie</a> imple... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27805/"
] | Does anyone know a good .NET dictionary API? I'm not interested in meanings, rather I need to be able to query words in a number of different ways - return words of x length, return partial matches and so on... | Grab the flat text file from an open source spellchecker like ASpell (<http://aspell.net/>) and load it into a List or whatever structure you like.
for example,
```
List<string> words = System.IO.File.ReadAllText("MyWords.txt").Split(new string[]{Environment.NewLine}).ToList();
// C# 3.0 (LINQ) example:
// get... |
335,524 | <p>I have an SQL Server 2005 server, and I'd like to run a .Net CLR stored procedure on it. However, I'd like to use .NET Framework 3.5.</p>
<p>If I try this right now, I get this error:</p>
<pre><code>Error: Assembly 'system.core, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089.' was not found in t... | [
{
"answer_id": 335536,
"author": "James Orr",
"author_id": 41457,
"author_profile": "https://Stackoverflow.com/users/41457",
"pm_score": 3,
"selected": true,
"text": "<p>This might be a stupid question but... If system.core can't be found, do you have the framework 3.5 installed on the d... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2273/"
] | I have an SQL Server 2005 server, and I'd like to run a .Net CLR stored procedure on it. However, I'd like to use .NET Framework 3.5.
If I try this right now, I get this error:
```
Error: Assembly 'system.core, version=3.5.0.0, culture=neutral, publickeytoken=b77a5c561934e089.' was not found in the SQL catalog.
```
... | This might be a stupid question but... If system.core can't be found, do you have the framework 3.5 installed on the database server? |
335,530 | <p>How do you check that monkey patching has been done to a specific class in Ruby? If that is possible, is it also possible to get the previous implementation(s) of the attribute that's been patched?</p>
| [
{
"answer_id": 335787,
"author": "user37011",
"author_id": 37011,
"author_profile": "https://Stackoverflow.com/users/37011",
"pm_score": 3,
"selected": false,
"text": "<p>There are the hooks <code>method_added</code> and <code>method_undefined</code>. Garry Dolley has written an I<a href... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4883/"
] | How do you check that monkey patching has been done to a specific class in Ruby? If that is possible, is it also possible to get the previous implementation(s) of the attribute that's been patched? | I found this blog posting that touches on how to use method\_added to track monkey patching. It's not too hard to extend it to track the methods that were patched.
<http://hedonismbot.wordpress.com/2008/11/27/monkey-business-2/>:
>
> By using open classes, we can re-define method\_added for instances of Class and d... |
335,531 | <p>I am building a conditional navigation menu that has 3 levels (the 3rd level added today by business, no worries its not like I launch next week. Oh wait I do:)). I have a javascript var that contains the html for my first conditional level. I am now trying to insert another level inside of the first. </p>
<pre><co... | [
{
"answer_id": 335542,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 3,
"selected": false,
"text": "<p>You should write that this way (knowing little javascript myself, but i think this is right):</p>\n\n<pr... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27516/"
] | I am building a conditional navigation menu that has 3 levels (the 3rd level added today by business, no worries its not like I launch next week. Oh wait I do:)). I have a javascript var that contains the html for my first conditional level. I am now trying to insert another level inside of the first.
```
var myVar =... | You should write that this way (knowing little javascript myself, but i think this is right):
```
var myVar = '<ul class="linksUnit">';
myVar += '<li>Link 1';
if (myVar2) { // note != false means true
// insert a nested unordered list
myVar += '<ul>';
myVar += '<li>Link 2</li>';
myVar += '</ul>';
... |
335,535 | <p>I've been asked to develop a simple GUI application using Matlab and GUIDE, which will interact with a separate backend engine (also Matlab). I'm coming from a Java and .Net background.</p>
<p>The Matlab documentation is strong on how to technically do this, but says little about the "engineering" process, in parti... | [
{
"answer_id": 336872,
"author": "Jared",
"author_id": 14744,
"author_profile": "https://Stackoverflow.com/users/14744",
"pm_score": 0,
"selected": false,
"text": "<p>I don't have experience with creating GUI's in matlab but if your company will spend mony on it matlab for .net may be a ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21849/"
] | I've been asked to develop a simple GUI application using Matlab and GUIDE, which will interact with a separate backend engine (also Matlab). I'm coming from a Java and .Net background.
The Matlab documentation is strong on how to technically do this, but says little about the "engineering" process, in particular:
* ... | This is a perfectly reasonable question, and with a bit of care it is possible to write GUI code that is easy to maintain. Some suggestions:
* Put the GUI layout code and the "business logic" in different m-files. (see [this FileExchange submission](http://www.mathworks.com/matlabcentral/fileexchange/16403) for exampl... |
335,546 | <p>Is there a way to have two columns, that match each other in height, without using table cells, fixed heights or Javascript?</p>
<p><strong>Using a TABLE</strong></p>
<pre><code><table>
<tr>
<td style="background:#F00;">
This is a column
</td>
<td ... | [
{
"answer_id": 335603,
"author": "asleep",
"author_id": 29445,
"author_profile": "https://Stackoverflow.com/users/29445",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://www.xs4all.nl/~peterned/examples/csslayout1.html\" rel=\"nofollow noreferrer\">http://www.xs4all.nl/~pe... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17091/"
] | Is there a way to have two columns, that match each other in height, without using table cells, fixed heights or Javascript?
**Using a TABLE**
```
<table>
<tr>
<td style="background:#F00;">
This is a column
</td>
<td style="background:#FF0;">
This is a column<br />
... | <http://www.xs4all.nl/~peterned/examples/csslayout1.html>
this is the kind of thing you want, give them both a height of 100% (using this css trick) and they'll stretch out to the height of the containing div!
edit: forgot to mention, put them in a container div!
Edit:
```
<html>
<head>
<style>
html, b... |
335,585 | <p>How can I access a site configured in IIS 7 on the host machine from a guest OS in VMWare (Fedora 10). I have configured the VM to use "NAT"</p>
| [
{
"answer_id": 335623,
"author": "Sunny Milenov",
"author_id": 8220,
"author_profile": "https://Stackoverflow.com/users/8220",
"pm_score": 2,
"selected": false,
"text": "<p>Depends on your network configuration of vmware product you are using (player, server, workstation). If it is set f... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1443363/"
] | How can I access a site configured in IIS 7 on the host machine from a guest OS in VMWare (Fedora 10). I have configured the VM to use "NAT" | Depends on your network configuration of vmware product you are using (player, server, workstation). If it is set for a bridged mode, then you can do it as any other machine - by host machine's IP. If it is a "host only" or NAT mode - check what is the gateway IP for the guest (/sbin/route), and try using it:
```
# /s... |
335,597 | <p>I have a many-to-one relationship where the child table can have hundreds of thousands of records. In this case, calling Parent.ChildCollection.Count forces a lazy initialization of the child collection which is extremely expensive.</p>
<p>In Hibernate 3.0 there is a feature lazy="extra" which allows you to check ... | [
{
"answer_id": 335623,
"author": "Sunny Milenov",
"author_id": 8220,
"author_profile": "https://Stackoverflow.com/users/8220",
"pm_score": 2,
"selected": false,
"text": "<p>Depends on your network configuration of vmware product you are using (player, server, workstation). If it is set f... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30957/"
] | I have a many-to-one relationship where the child table can have hundreds of thousands of records. In this case, calling Parent.ChildCollection.Count forces a lazy initialization of the child collection which is extremely expensive.
In Hibernate 3.0 there is a feature lazy="extra" which allows you to check a subset of... | Depends on your network configuration of vmware product you are using (player, server, workstation). If it is set for a bridged mode, then you can do it as any other machine - by host machine's IP. If it is a "host only" or NAT mode - check what is the gateway IP for the guest (/sbin/route), and try using it:
```
# /s... |
335,600 | <p>I have two characters displayed in a game I am writing, the player and the enemy. defined as such:</p>
<pre><code>public void player(Graphics g) {
g.drawImage(plimg, x, y, this);
}
public void enemy(Graphics g) {
g.drawImage(enemy, 200, 200, this);
}
</code></pre>
<p>Then called with:</p>
<pre><code>play... | [
{
"answer_id": 335632,
"author": "asleep",
"author_id": 29445,
"author_profile": "https://Stackoverflow.com/users/29445",
"pm_score": 1,
"selected": false,
"text": "<p>Use a rectangle to surround each player and enemy, the height and width of the rectangles should correspond to the objec... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3609/"
] | I have two characters displayed in a game I am writing, the player and the enemy. defined as such:
```
public void player(Graphics g) {
g.drawImage(plimg, x, y, this);
}
public void enemy(Graphics g) {
g.drawImage(enemy, 200, 200, this);
}
```
Then called with:
```
player(g);
enemy(g);
```
I am able to m... | I think your problem is that you are not using good OO design for your player and enemies. Create two classes:
```
public class Player
{
int X;
int Y;
int Width;
int Height;
// Getters and Setters
}
public class Enemy
{
int X;
int Y;
int Width;
int Height;
// Getters and Sett... |
335,621 | <p>I have a class that after it does some stuff, sends a JMS message.
I'd like to unit test the "stuff", but not necessarily the sending of the message.
<br><br>When I run my test, the "stuff" green bars, but then fails when sending the message (it should, the app server is not running).
What is the best way to do this... | [
{
"answer_id": 335644,
"author": "tunaranch",
"author_id": 27708,
"author_profile": "https://Stackoverflow.com/users/27708",
"pm_score": 3,
"selected": false,
"text": "<p>You can inject a mocked jmsTemplate.</p>\n\n<p>Assuming easymock, something like </p>\n\n<pre><code>JmsTemplate mockT... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13143/"
] | I have a class that after it does some stuff, sends a JMS message.
I'd like to unit test the "stuff", but not necessarily the sending of the message.
When I run my test, the "stuff" green bars, but then fails when sending the message (it should, the app server is not running).
What is the best way to do this, is it to... | The simplest answer I would use is to stub out the message sending functionality. For example, if you have this:
```
public class SomeClass {
public void doit() {
//do some stuff
sendMessage( /*some parameters*/);
}
public void sendMessage( /*some parameters*/ ) {
//jms stuff
... |
335,624 | <p>Any idea how to <strong>return multiple variables</strong> from a function in ActionScript 3? </p>
<p>Anything like VB.NET where you can have the <strong>input argument's variable</strong> modified (ByRef arguments)?</p>
<pre><code>Sub do (ByRef inout As Integer)
inout *= 5;
End Sub
Dim num As Integer = 10
Debug... | [
{
"answer_id": 335693,
"author": "LiraNuna",
"author_id": 41983,
"author_profile": "https://Stackoverflow.com/users/41983",
"pm_score": 3,
"selected": true,
"text": "<p>Everything in AS3 is a reference aside from [u]ints. To generalize, everything that inherits <code>Object</code> will ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41021/"
] | Any idea how to **return multiple variables** from a function in ActionScript 3?
Anything like VB.NET where you can have the **input argument's variable** modified (ByRef arguments)?
```
Sub do (ByRef inout As Integer)
inout *= 5;
End Sub
Dim num As Integer = 10
Debug.WriteLine (num) '10
do (num)
Debug.Writ... | Everything in AS3 is a reference aside from [u]ints. To generalize, everything that inherits `Object` will be given to the function by a reference.
That being said, the only way I believe you can do it is use a container class like an `Array` or a `String` ("5" and do the conversion+math). |
335,645 | <p>How to enforce that developers writing XAML in Visual Studio should follow certain standards and validations need to be run and if invalid compile time errors are thrown.</p>
<p>For example, making sure that all the databinding expressions (some are real long) are written correctly as per 'a custom validation' I wo... | [
{
"answer_id": 336467,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 2,
"selected": false,
"text": "<p>There is no built-in way to do this. The best way you will be able to get this result is to run a custom tool on the ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1747/"
] | How to enforce that developers writing XAML in Visual Studio should follow certain standards and validations need to be run and if invalid compile time errors are thrown.
For example, making sure that all the databinding expressions (some are real long) are written correctly as per 'a custom validation' I would like i... | Sorry, the XAML language service can’t be extended this way either. The best way to do this today is to author a build task. I think you can hook it into the MarkupCompilePass1DependsOn target and it will be invoked automatically when the user saves or changes a XAML file. You still have to scan the file redundantly fr... |
335,648 | <p>I have several Google calendars that I'd like to merge and place on my windows desktop using <a href="http://www.samurize.com/" rel="nofollow noreferrer">Samurize</a>. I've tried using Samurize's Page Scraper plugin, but it doesn't appear to be up to the task.</p>
<p>I can get Samurize to run a script and place it'... | [
{
"answer_id": 336467,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 2,
"selected": false,
"text": "<p>There is no built-in way to do this. The best way you will be able to get this result is to run a custom tool on the ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2541/"
] | I have several Google calendars that I'd like to merge and place on my windows desktop using [Samurize](http://www.samurize.com/). I've tried using Samurize's Page Scraper plugin, but it doesn't appear to be up to the task.
I can get Samurize to run a script and place it's output on the desktop, but I'm not sure
what... | Sorry, the XAML language service can’t be extended this way either. The best way to do this today is to author a build task. I think you can hook it into the MarkupCompilePass1DependsOn target and it will be invoked automatically when the user saves or changes a XAML file. You still have to scan the file redundantly fr... |
335,659 | <p>For example, how can I run me.test below?</p>
<pre><code>myvar = 'test'
me.myvar
</code></pre>
<p>ASP looks for the method "myvar" and doesn't find it. In PHP I could simply say $me->$myvar but ASP's syntax doesn't distinguish between variables and methods. Suggestions?</p>
<p>Closely related to this, is there a ... | [
{
"answer_id": 335671,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>ASP does not support late binding in this manner. What are you trying to do, in a larger sense? Explain that, and... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26180/"
] | For example, how can I run me.test below?
```
myvar = 'test'
me.myvar
```
ASP looks for the method "myvar" and doesn't find it. In PHP I could simply say $me->$myvar but ASP's syntax doesn't distinguish between variables and methods. Suggestions?
Closely related to this, is there a method\_exists function in ASP Cl... | You can achieve this in VBScript by using the `GetRef` function:-
```
Function Test(val)
Test = val & " has been tested"
End Function
Dim myvar : myvar = "Test"
Dim x : Set x = GetRef(myvar)
Response.Write x("Thing")
```
Will send "Thing has been tested" to the client.
So here is your validate requirement using ... |
335,660 | <p>Finding a good way to do this has stumped me for a while now: assume I have a selection box with a set of points in it. By dragging the corners you can scale the (distance between) points in the box. Now for an axis aligned box this is easy. Take a corner as an anchor point (subtract this corner from each point, sca... | [
{
"answer_id": 335673,
"author": "shoosh",
"author_id": 9611,
"author_profile": "https://Stackoverflow.com/users/9611",
"pm_score": 2,
"selected": false,
"text": "<p>Any box is contained inside a circle.<br>\nYou find the circle which binds the box, find its center and do exactly the sam... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42635/"
] | Finding a good way to do this has stumped me for a while now: assume I have a selection box with a set of points in it. By dragging the corners you can scale the (distance between) points in the box. Now for an axis aligned box this is easy. Take a corner as an anchor point (subtract this corner from each point, scale ... | You pick one corner of the rectangle as the origin. The two edges connected to it will be the basis (`u` and `v`, which should be perpendicular to each other). You would need to normalize them first.
Subtract the origin from the coordinates and calculate the dot-product with the scaling vector (`u`), and with the othe... |
335,695 | <p>The typical ConfigParser generated file looks like:</p>
<pre><code>[Section]
bar=foo
[Section 2]
bar2= baz
</code></pre>
<p>Now, is there a way to index lists like, for instance:</p>
<pre><code>[Section 3]
barList={
item1,
item2
}
</code></pre>
<p>Related question: <a href="https://stackoverflow.com/ques... | [
{
"answer_id": 335717,
"author": "M. Utku ALTINKAYA",
"author_id": 40948,
"author_profile": "https://Stackoverflow.com/users/40948",
"pm_score": 2,
"selected": false,
"text": "<p>Only primitive types are supported for serialization by config parser. I would use JSON or YAML for that kind... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42636/"
] | The typical ConfigParser generated file looks like:
```
[Section]
bar=foo
[Section 2]
bar2= baz
```
Now, is there a way to index lists like, for instance:
```
[Section 3]
barList={
item1,
item2
}
```
Related question: [Python’s ConfigParser unique keys per section](https://stackoverflow.com/questions/2877... | There is nothing stopping you from packing the list into a delimited string and then unpacking it once you get the string from the config. If you did it this way your config section would look like:
```
[Section 3]
barList=item1,item2
```
It's not pretty but it's functional for most simple lists. |
335,719 | <p>I need to use an x509 certificate to get secure message level authentication from a rich client via the internet to a secure WCF Web Service.</p>
<p>Specifically, I am looking for a working step-by-step guide to setup, configuration, coding, and deployment, including creating a 'dev' certificate, installing it, and... | [
{
"answer_id": 335773,
"author": "ChrisCa",
"author_id": 17194,
"author_profile": "https://Stackoverflow.com/users/17194",
"pm_score": 3,
"selected": false,
"text": "<p>I'd recommend reading the WCF Security guidance from Microsoft</p>\n\n<p>This deals with this scenario as well as many ... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2918/"
] | I need to use an x509 certificate to get secure message level authentication from a rich client via the internet to a secure WCF Web Service.
Specifically, I am looking for a working step-by-step guide to setup, configuration, coding, and deployment, including creating a 'dev' certificate, installing it, and obtaining... | The following steps are a guide to get you started:
1) Firstly, you need a Root Authority to generate your client and server certificates. You can either use an external Authority Provider (e.g. Verisign) or you can generate your own using something like Microsoft Certificate Server.
To generate a development Root Au... |
335,732 | <p>I want to allow users to embed badges on their personal site or blogs with a snippet of javascript. The badge is customized on our site based on information in their profiles that at some point is "approved". </p>
<p>Is there a best practice to check what website the javascript is embedded on and if it does not mat... | [
{
"answer_id": 335763,
"author": "Pim Jager",
"author_id": 35197,
"author_profile": "https://Stackoverflow.com/users/35197",
"pm_score": 0,
"selected": false,
"text": "<p>You could check the top url using:</p>\n\n<pre><code>var topUrl = top.location.href;\n</code></pre>\n"
},
{
"... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42648/"
] | I want to allow users to embed badges on their personal site or blogs with a snippet of javascript. The badge is customized on our site based on information in their profiles that at some point is "approved".
Is there a best practice to check what website the javascript is embedded on and if it does not match the web... | Two methods come to mind immediately:
1. Configure your server to log the "Referer" header of all requests for the javascript
and even check it against a list of approved urls, and return an error code ([`403 Forbidden`](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.4) looks like a winner).
2. Have th... |
335,753 | <p>I need to know how to iterate through records in CR2008 and when it reaches a record that is NOT NULL, record that in a variable.</p>
<p>I have a formula called "frmAccum" that I drop in the details section and suppress it. I use this to gather information for each record that's processed. I also have a formula c... | [
{
"answer_id": 335762,
"author": "Matt Cruikshank",
"author_id": 8643,
"author_profile": "https://Stackoverflow.com/users/8643",
"pm_score": 2,
"selected": false,
"text": "<p><strong>Please don't do this.</strong> It's a really, really, really, really, really <em>bad idea</em>.</p>\n\n<... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38317/"
] | I need to know how to iterate through records in CR2008 and when it reaches a record that is NOT NULL, record that in a variable.
I have a formula called "frmAccum" that I drop in the details section and suppress it. I use this to gather information for each record that's processed. I also have a formula called frmRes... | **Please don't do this.** It's a really, really, really, really, really *bad idea*.
Maybe not as bad as deleting files randomly, if the hard drive runs out of room - but just about as bad. |
335,770 | <p>Example: </p>
<pre><code>$ svn copy foo.txt bar.txt
A bar.txt
</code></pre>
<ul>
<li>When would you use this technique, and why? </li>
<li>Will this command (taken from svn's "red book") creates a copy of <code><foo.txt></code> while preserving the history of it to be shared with <code><bar.txt><... | [
{
"answer_id": 335785,
"author": "Steve Jessop",
"author_id": 13005,
"author_profile": "https://Stackoverflow.com/users/13005",
"pm_score": 5,
"selected": false,
"text": "<blockquote>\n <p>When would you use this technique, and why?</p>\n</blockquote>\n\n<p>To create tags, and also to c... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10312/"
] | Example:
```
$ svn copy foo.txt bar.txt
A bar.txt
```
* When would you use this technique, and why?
* Will this command (taken from svn's "red book") creates a copy of `<foo.txt>` while preserving the history of it to be shared with `<bar.txt>`?
* If I'm changing `<bar.txt>`, what will happen to `<foo.txt>`?
... | Aside from branching/tagging, you can also use it when you split a file in two. In this case both new files will have history and you'll be able to look at the code before the split.
BTW: that's one of few features that SVN has, but Git doesn't (Git will try to guess origin of code after the fact, especially if you ad... |
335,774 | <p>I had some site templates designed for me recently. I got the final HTML code, which validates, but the structure of the document is laid out using DL-DD pairs:</p>
<pre><code><dl>
<dd class="some-class">
Some text.
</dd>
</dl>
</code></pre>
<p>I'm not especially familiar with those... | [
{
"answer_id": 335779,
"author": "Gavin Miller",
"author_id": 33226,
"author_profile": "https://Stackoverflow.com/users/33226",
"pm_score": 2,
"selected": false,
"text": "<p>From WC3: <a href=\"http://www.w3.org/TR/html401/struct/lists.html#h-10.3\" rel=\"nofollow noreferrer\">http://www... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39539/"
] | I had some site templates designed for me recently. I got the final HTML code, which validates, but the structure of the document is laid out using DL-DD pairs:
```
<dl>
<dd class="some-class">
Some text.
</dd>
</dl>
```
I'm not especially familiar with those tags as I've never used them much, but they don't... | You're right in that it shouldn't be used like that. The only reason I can think of for the designer using them is that the `<dd>` tag is indented in most browsers. If they're overriding the padding/margins on them, then your guess is as good as mine. |
335,781 | <p>We are in the process of converting our main build process from ant to maven. We use TeamCity for our Continuous Integration server (CI).</p>
<p>We'd like to use the CI server to kick off (nightly) builds whose version contain a build number, as in 1.0.0.build#. These builds would be installed in our local maven re... | [
{
"answer_id": 336080,
"author": "shek",
"author_id": 40618,
"author_profile": "https://Stackoverflow.com/users/40618",
"pm_score": 4,
"selected": true,
"text": "<p>Sounds like you want to build SNAPSHOT versions with unique versions.</p>\n\n<p>So, in your POM declare the version as:</p>... | 2008/12/02 | [
"https://Stackoverflow.com/questions/335781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4356/"
] | We are in the process of converting our main build process from ant to maven. We use TeamCity for our Continuous Integration server (CI).
We'd like to use the CI server to kick off (nightly) builds whose version contain a build number, as in 1.0.0.build#. These builds would be installed in our local maven repository t... | Sounds like you want to build SNAPSHOT versions with unique versions.
So, in your POM declare the version as:
```
<version>#.#.#-SNAPSHOT</version>
```
Then, in the *distributionManagement* section of your POM, enable unique versions for the *snapshotRepository* via (see Maven's [POM reference](http://maven.apache.... |