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 |
|---|---|---|---|---|---|---|
268,153 | <p>I am writing code in VS2005 using its STL.
I have one UI thread to read a vector, and a work thread to write to a vector.
I use ::boost::shared_ptr as vector element.</p>
<pre><code>vector<shared_ptr<Class>> vec;
</code></pre>
<p>but I find, if I manipulate the vec in both thread in the same time(I can... | [
{
"answer_id": 268177,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 3,
"selected": true,
"text": "<p>When you're accessing the same resource from more than one thread, locking is necessary. If you don't, you have all sorts ... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25749/"
] | I am writing code in VS2005 using its STL.
I have one UI thread to read a vector, and a work thread to write to a vector.
I use ::boost::shared\_ptr as vector element.
```
vector<shared_ptr<Class>> vec;
```
but I find, if I manipulate the vec in both thread in the same time(I can guarantee they do not visit the same... | When you're accessing the same resource from more than one thread, locking is necessary. If you don't, you have all sorts of strange behaviour, like you're seeing.
Since you're using Boost, an easy way to use locking is to use the Boost.Thread library. The best kind of locks you can use for this scenario are reader/wr... |
268,180 | <p>Ok guys and gals, here is my problem:</p>
<p>I've built a custom control that uses a textbox to present data to the user. </p>
<p>When the user interacts with the control the <strong>value of that textbox is altered with client side javascript</strong>.</p>
<p>I also have a button on my page. When the user clicks... | [
{
"answer_id": 268297,
"author": "James",
"author_id": 7837,
"author_profile": "https://Stackoverflow.com/users/7837",
"pm_score": 2,
"selected": true,
"text": "<p>Ah ha! I've solved my own problem!</p>\n\n<p>Because I had set Readonly=\"True\" on the textbox control ASP.NET was not pick... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7837/"
] | Ok guys and gals, here is my problem:
I've built a custom control that uses a textbox to present data to the user.
When the user interacts with the control the **value of that textbox is altered with client side javascript**.
I also have a button on my page. When the user clicks the button I want to take the value ... | Ah ha! I've solved my own problem!
Because I had set Readonly="True" on the textbox control ASP.NET was not picking up it's value from the postback.
Instead I should have manually added the readonly attribute to the textbox during my user control construction.
eg.
```
this.textBox.Attributes.Add("readonly", "readon... |
268,182 | <p>We've just been given the following code as a solution for a complicated search query in a new application provided by offshore developers. I'm skeptical of the use of dynamic SQL because I could close the SQL statement using '; and then excute a nasty that will be performed on the database!</p>
<p>Any ideas on how... | [
{
"answer_id": 268190,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 2,
"selected": false,
"text": "<p>See this <a href=\"https://stackoverflow.com/questions/1973/what-is-the-best-way-to-avoid-sql-injection-attacks\">a... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5055/"
] | We've just been given the following code as a solution for a complicated search query in a new application provided by offshore developers. I'm skeptical of the use of dynamic SQL because I could close the SQL statement using '; and then excute a nasty that will be performed on the database!
Any ideas on how to fix th... | As an aside, I would not use `EXEC`; rather I would use `sp_executesql`. See this superb article, [The Curse and Blessings of Dynamic SQL](http://www.sommarskog.se/dynamic_sql.html), for the reason and other info on using dynamic sql. |
268,184 | <p>I have classX: </p>
<p>Sub New(ByVal item_line_no As String, ByVal item_text As String)</p>
<pre><code> ' check to ensure that the parameters do not exceed the file template limits
Select Case item_line_no.Length
Case Is > m_item_line_no_capacity
Throw New ArgumentOutOfRangeException(... | [
{
"answer_id": 268276,
"author": "kͩeͣmͮpͥ ͩ",
"author_id": 26479,
"author_profile": "https://Stackoverflow.com/users/26479",
"pm_score": 0,
"selected": false,
"text": "<p><s>The <code>ExpectedExceptionAttribute</code> is deprecated - i.e. you shouldn't use it at all. The best reference ... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11802/"
] | I have classX:
Sub New(ByVal item\_line\_no As String, ByVal item\_text As String)
```
' check to ensure that the parameters do not exceed the file template limits
Select Case item_line_no.Length
Case Is > m_item_line_no_capacity
Throw New ArgumentOutOfRangeException(item_line_no, "Line N... | Ok. Just run this.
The message for the exception is:
>
> **Line No exceeds 4 characters**
>
>
> **Parameter name: aaaaa**
>
>
>
(Including the line break)
You need to specify this all of this as the expected message:
```
<ExpectedException(GetType(ArgumentOutOfRangeException), ExpectedMessage="Line No exceed... |
268,208 | <p>I have a Windows Service written in Delphi which runs a number of programs. </p>
<p>On Stopping the service, I want to also close these programs. When the service was originally written, this worked fine, but I think I've updated the tProcess component and now - The subordinate programs are not being closed. </p>
... | [
{
"answer_id": 268314,
"author": "utku_karatas",
"author_id": 14716,
"author_profile": "https://Stackoverflow.com/users/14716",
"pm_score": 2,
"selected": false,
"text": "<p>I'd use <strong>TJvCreateProcess</strong> component of <a href=\"http://jvcl.sourceforge.net/\" rel=\"nofollow nor... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1726/"
] | I have a Windows Service written in Delphi which runs a number of programs.
On Stopping the service, I want to also close these programs. When the service was originally written, this worked fine, but I think I've updated the tProcess component and now - The subordinate programs are not being closed.
in tProcess - ... | You want to enumerate open windows that match your launched ProcessId and tell those windows to close. Here's some sample code for that:
```
uses Windows;
interface
function MyTerminateAppEnum(hHwnd:HWND; dwData:LPARAM):Boolean; stdcall;
implementation
function MyTerminateAppEnum(hHwnd:HWND; dwData:LPARAM):Bool... |
268,272 | <p>I have a dictionary where keys are strings, and values are integers.</p>
<pre><code>stats = {'a': 1, 'b': 3000, 'c': 0}
</code></pre>
<p>How do I get the key with the maximum value? In this case, it is <code>'b'</code>.</p>
<hr />
<p>Is there a nicer approach than using an intermediate list with reversed key-value t... | [
{
"answer_id": 268285,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 11,
"selected": true,
"text": "<p>You can use <code>operator.itemgetter</code> for that:</p>\n<pre><code>import operator\nstats = {'a': 1000, 'b': 3000, 'c':... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34598/"
] | I have a dictionary where keys are strings, and values are integers.
```
stats = {'a': 1, 'b': 3000, 'c': 0}
```
How do I get the key with the maximum value? In this case, it is `'b'`.
---
Is there a nicer approach than using an intermediate list with reversed key-value tuples?
```
inverse = [(value, key) for key... | You can use `operator.itemgetter` for that:
```
import operator
stats = {'a': 1000, 'b': 3000, 'c': 100}
max(stats.iteritems(), key=operator.itemgetter(1))[0]
```
And instead of building a new list in memory use `stats.iteritems()`. The `key` parameter to the `max()` function is a function that computes a key that i... |
268,289 | <p>I have a Nant build script which CruiseControl uses to build a solution on-demand.</p>
<p>However, we only recently got CruiseControl so our official build number is different from what is listed in CruiseControl.</p>
<p>I know CruiseControl injects some properties into build scripts so that I can access the CC bu... | [
{
"answer_id": 268319,
"author": "Vinzz",
"author_id": 28922,
"author_profile": "https://Stackoverflow.com/users/28922",
"pm_score": 1,
"selected": false,
"text": "<p>Did you try to use some environment variables? I believe CCNet can handle these.</p>\n\n<p>I'll dig a bit on this.</p>\n\... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18818/"
] | I have a Nant build script which CruiseControl uses to build a solution on-demand.
However, we only recently got CruiseControl so our official build number is different from what is listed in CruiseControl.
I know CruiseControl injects some properties into build scripts so that I can access the CC build number in the... | A custom build labeler is required for this. Perforce is our source control provider and we derive our version number from it. The code is as follows:
```
/// <summary>
/// Gets the latest change list number from perforce, for ccnet to consume as a build label.
/// </summary>
[ReflectorType( "p4labeller" )]
public cla... |
268,296 | <p>is there a way to have a mysql select statement return fully qualified column names like "table.field" without using AS for every single field?</p>
<p>like so:</p>
<pre><code>SELECT *
FROM table1
LEFT JOIN table2 on table1.f_ID = table2.ID
</code></pre>
<p>and the result would be:
"table1.ID", "table1.name"... | [
{
"answer_id": 268973,
"author": "user12861",
"author_id": 12861,
"author_profile": "https://Stackoverflow.com/users/12861",
"pm_score": 3,
"selected": true,
"text": "<p>Not really. You could write some dynamic SQL to accomplish this, but it wouldn't be simple. If you really want the d... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1427/"
] | is there a way to have a mysql select statement return fully qualified column names like "table.field" without using AS for every single field?
like so:
```
SELECT *
FROM table1
LEFT JOIN table2 on table1.f_ID = table2.ID
```
and the result would be:
"table1.ID", "table1.name", "table2.ID", "table2.name", ... | Not really. You could write some dynamic SQL to accomplish this, but it wouldn't be simple. If you really want the dynamic SQL, let me know and I could try to whip something up. |
268,321 | <p>I am looking for a generic, bidirectional 1 to 1 Dictionary class in C# (2), ie. a <code>BiDictionaryOneToOne<T, S></code> which is guaranteed to only contain one of each value and key (up to RefEquals anyway), and which can be searched using either key or value. Anyone know of one, or should I just implement ... | [
{
"answer_id": 268332,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": false,
"text": "<p>The question you refer to also shows a one-to-one implementation in <a href=\"https://stackoverflow.com/questions/255... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6091/"
] | I am looking for a generic, bidirectional 1 to 1 Dictionary class in C# (2), ie. a `BiDictionaryOneToOne<T, S>` which is guaranteed to only contain one of each value and key (up to RefEquals anyway), and which can be searched using either key or value. Anyone know of one, or should I just implement it myself? I can't b... | OK, here is my attempt (building on Jon's - thanks), archived here and open for improvement :
```
/// <summary>
/// This is a dictionary guaranteed to have only one of each value and key.
/// It may be searched either by TFirst or by TSecond, giving a unique answer because it is 1 to 1.
/// </summary>
/// <typeparam ... |
268,322 | <p>Why doesn't this work?</p>
<pre><code>DECLARE @temp table
(ShipNo int,
Supplier varchar(10)
)
INSERT INTO @temp VALUES (1,'CFA')
INSERT INTO @temp VALUES (1, 'TFA')
INSERT INTO @temp VALUES (2, 'LRA')
INSERT INTO @temp VALUES (2, 'LRB')
INSERT INTO @temp VALUES (3, 'ABC')
INSERT INTO @temp VALUES (4, 'TFA')
Decl... | [
{
"answer_id": 268367,
"author": "RB.",
"author_id": 15393,
"author_profile": "https://Stackoverflow.com/users/15393",
"pm_score": 1,
"selected": false,
"text": "<p>From Books Online:</p>\n\n<pre><code>CASE\nWHEN Boolean_expression THEN result_expression \n [ ...n ] \n[ \n ELSE els... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5055/"
] | Why doesn't this work?
```
DECLARE @temp table
(ShipNo int,
Supplier varchar(10)
)
INSERT INTO @temp VALUES (1,'CFA')
INSERT INTO @temp VALUES (1, 'TFA')
INSERT INTO @temp VALUES (2, 'LRA')
INSERT INTO @temp VALUES (2, 'LRB')
INSERT INTO @temp VALUES (3, 'ABC')
INSERT INTO @temp VALUES (4, 'TFA')
Declare @OrderBy v... | I am aware that this is old post but this is for any one who tumbles upon this issue and is looking for a solution:
```
SELECT ROW_NUMBER() OVER (ORDER BY
CASE @OrderBy
WHEN 'Supplier' THEN Supplier
END
CASE @OrderBy
WHEN 'ShipNo' THEN ShipNo
END
)
```
basically you are putting each field in its own case. Do ... |
268,338 | <p>Im trying to craft a regex that only returns <code><link></code> tag hrefs</p>
<p>Why does this regex return all hrefs including <a hrefs?</p>
<pre><code>(?&lt;=&lt;link\s+.*?)href\s*=\s*[\'\"][^\'\"]+
</code></pre>
<pre class="lang-html prettyprint-override"><code><link rel="style... | [
{
"answer_id": 268354,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 0,
"selected": false,
"text": "<pre><code>/(?<=<link\\s+.*?)href\\s*=\\s*[\\'\\\"][^\\'\\\"]+[^>]*>/\n</code></pre>\n\n<p>i'm a little shaky on t... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17211/"
] | Im trying to craft a regex that only returns `<link>` tag hrefs
Why does this regex return all hrefs including <a hrefs?
```
(?<=<link\s+.*?)href\s*=\s*[\'\"][^\'\"]+
```
```html
<link rel="stylesheet" rev="stylesheet" href="idlecore-tidied.css?T_2_5_0_228" media="screen">
<a href="anotherurl">Slash Boxes<... | Either
```
/(?<=<link\b[^<>]*?)\bhref=\s*=\s*(?:"[^"]*"|'[^']'|\S+)/
```
or
```
/<link\b[^<>]*?\b(href=\s*=\s*(?:"[^"]*"|'[^']'|\S+))/
```
The main difference is `[^<>]*?` instead of `.*?`. This is because you don't want it to continue the search into other tags. |
268,357 | <p>I have a couple of dropdown boxes on a normal ASP.Net page.</p>
<p>I would like the user to be able to change these and to have the page Pseudo-post back to the server and store these changes without the user having to hit a save button.</p>
<p>I don't really need to display anything additional as the dropdown its... | [
{
"answer_id": 268673,
"author": "Aaron Palmer",
"author_id": 24908,
"author_profile": "https://Stackoverflow.com/users/24908",
"pm_score": 3,
"selected": true,
"text": "<p>Add a reference to System.Web.Extensions and System.Web.Extensions.Design to your website. Then put a scriptmanage... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11356/"
] | I have a couple of dropdown boxes on a normal ASP.Net page.
I would like the user to be able to change these and to have the page Pseudo-post back to the server and store these changes without the user having to hit a save button.
I don't really need to display anything additional as the dropdown itself will reflect ... | Add a reference to System.Web.Extensions and System.Web.Extensions.Design to your website. Then put a scriptmanager on your page and wrap your ddl in an updatepanel. Do whatever you want on the back-end.
For example...
```
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runa... |
268,381 | <p>I am trying to make a copy of a database to a new database on the same server. The server is my local computer running SQL 2008 Express under Windows XP.
Doing this should be quite easy using the SMO.Transfer class and it almost works!</p>
<p>My code is as follows (somewhat simplified):</p>
<pre><code>Server serv... | [
{
"answer_id": 320877,
"author": "Rune Grimstad",
"author_id": 30366,
"author_profile": "https://Stackoverflow.com/users/30366",
"pm_score": 5,
"selected": true,
"text": "<p>Well, after contacting Microsft Support I got it working properly, but it is slow and more or less useless. Doing ... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30366/"
] | I am trying to make a copy of a database to a new database on the same server. The server is my local computer running SQL 2008 Express under Windows XP.
Doing this should be quite easy using the SMO.Transfer class and it almost works!
My code is as follows (somewhat simplified):
```
Server server = new Server("serv... | Well, after contacting Microsft Support I got it working properly, but it is slow and more or less useless. Doing a backup and then a restore is much faster and I will be using it as long as the new copy should live on the same server as the original.
The working code is as follows:
```
ServerConnection conn = new S... |
268,384 | <p>Why does the PRINT statement in T-SQL seem to only sometimes work? What are the constraints on using it? It seems sometimes if a result set is generated, it becomes a null function, I assumed to prevent corrupting the resultset, but could it's output not go out in another result set, such as the row count?</p>
| [
{
"answer_id": 268419,
"author": "David T. Macknet",
"author_id": 6850,
"author_profile": "https://Stackoverflow.com/users/6850",
"pm_score": 8,
"selected": true,
"text": "<p>So, if you have a statement something like the following, you're saying that you get no 'print' result?</p>\n\n<p... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | Why does the PRINT statement in T-SQL seem to only sometimes work? What are the constraints on using it? It seems sometimes if a result set is generated, it becomes a null function, I assumed to prevent corrupting the resultset, but could it's output not go out in another result set, such as the row count? | So, if you have a statement something like the following, you're saying that you get no 'print' result?
```
select * from sysobjects
PRINT 'Just selected * from sysobjects'
```
If you're using SQL Query Analyzer, you'll see that there are two tabs down at the bottom, one of which is "Messages" and that's where the 'p... |
268,391 | <p>I want to use Visual Studio snippets to generate SQL code, for example we have standard naming conventions for foreign keys etc and it would be great if I could just expand a snippet in my SQL script file. </p>
<p>However as far as I can tell the only languages that are supported by the Snippet manager are C#, VB J... | [
{
"answer_id": 268419,
"author": "David T. Macknet",
"author_id": 6850,
"author_profile": "https://Stackoverflow.com/users/6850",
"pm_score": 8,
"selected": true,
"text": "<p>So, if you have a statement something like the following, you're saying that you get no 'print' result?</p>\n\n<p... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28584/"
] | I want to use Visual Studio snippets to generate SQL code, for example we have standard naming conventions for foreign keys etc and it would be great if I could just expand a snippet in my SQL script file.
However as far as I can tell the only languages that are supported by the Snippet manager are C#, VB J# and XML
... | So, if you have a statement something like the following, you're saying that you get no 'print' result?
```
select * from sysobjects
PRINT 'Just selected * from sysobjects'
```
If you're using SQL Query Analyzer, you'll see that there are two tabs down at the bottom, one of which is "Messages" and that's where the 'p... |
268,421 | <p>Heres a tricky one . .</p>
<p>I have a webpage (called PageA) that has a header and then simply includes an iframe. Lets call the page within the iframe PageB. PageB simply has a bunch of thumbnails but there are a lot so you have to scroll down on PageA to view them all. </p>
<p>When i scroll down to the bottom... | [
{
"answer_id": 269428,
"author": "Dave Swersky",
"author_id": 34796,
"author_profile": "https://Stackoverflow.com/users/34796",
"pm_score": 1,
"selected": false,
"text": "<p>Javascript is your best bet. You can use the <a href=\"http://www.java2s.com/Code/JavaScriptReference/Javascript-... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | Heres a tricky one . .
I have a webpage (called PageA) that has a header and then simply includes an iframe. Lets call the page within the iframe PageB. PageB simply has a bunch of thumbnails but there are a lot so you have to scroll down on PageA to view them all.
When i scroll down to the bottom of the pageB and c... | @mek after trying various methods, the best solution I've found is this:
In the outer page, define a scroller function:
```
<script type="text/javascript">
function gotop() {
scroll(0,0);
}
</script>
```
Then when you define the iframe, set an onload handler (which fires each time the iframe source loads i... |
268,426 | <p>We're using Microsoft.Practices.CompositeUI.EventBroker to handle event subscription and publication in our application. The way that works is that you add an attribute to your event, specifying a topic name, like this:</p>
<pre><code>[EventPublication("example", PublicationScope.Global)]
public event EventHandler... | [
{
"answer_id": 268480,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "<p>Attributes are a compile-time feature (unless you are dealing with ComponentModel - but I suspect it is using refl... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] | We're using Microsoft.Practices.CompositeUI.EventBroker to handle event subscription and publication in our application. The way that works is that you add an attribute to your event, specifying a topic name, like this:
```
[EventPublication("example", PublicationScope.Global)]
public event EventHandler Example;
```
... | What you are trying to achieve is quite complicated, so I will try to provide something just to get you started. This is what I think you would need to combine in order to achieve something:
1. Define an abstract class `AbstractEventDebugger`, with a method `Search` that searches all of the `event` members, and regist... |
268,429 | <p>How to 'group by' a query using an alias, for example:</p>
<pre><code>select count(*), (select * from....) as alias_column
from table
group by alias_column
</code></pre>
<p>I get 'alias_column' : INVALID_IDENTIFIER error message. Why? How to group this query?</p>
| [
{
"answer_id": 268447,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 7,
"selected": true,
"text": "<pre><code>select\n count(count_col),\n alias_column\nfrom\n (\n select \n count_col, \n (select value from....) ... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3221/"
] | How to 'group by' a query using an alias, for example:
```
select count(*), (select * from....) as alias_column
from table
group by alias_column
```
I get 'alias\_column' : INVALID\_IDENTIFIER error message. Why? How to group this query? | ```
select
count(count_col),
alias_column
from
(
select
count_col,
(select value from....) as alias_column
from
table
) as inline
group by
alias_column
```
Grouping normally works if you repeat the respective expression in the GROUP BY clause. Just mentioning an alias is not possible, b... |
268,432 | <p>ASP.NET 3.5 SP1 adds a great new ScriptCombining feature to the ScriptManager object as demonstrated on <a href="http://www.asp.net/learn/3.5-SP1/video-296.aspx?wwwaspnetrdirset=1" rel="nofollow noreferrer">this video</a>. However he only demonstrates how to use the feature with the ScriptManager on the same page. I... | [
{
"answer_id": 269785,
"author": "TonyB",
"author_id": 3543,
"author_profile": "https://Stackoverflow.com/users/3543",
"pm_score": 3,
"selected": true,
"text": "<p>Give this a shot:</p>\n\n<pre><code> ScriptReference SRef = new ScriptReference();\n SRef.Path = \"~/Scripts/Script.js... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2756/"
] | ASP.NET 3.5 SP1 adds a great new ScriptCombining feature to the ScriptManager object as demonstrated on [this video](http://www.asp.net/learn/3.5-SP1/video-296.aspx?wwwaspnetrdirset=1). However he only demonstrates how to use the feature with the ScriptManager on the same page. I'd like to use this feature on a site wh... | Give this a shot:
```
ScriptReference SRef = new ScriptReference();
SRef.Path = "~/Scripts/Script.js";
ScriptManager.GetCurrent(Page).CompositeScript.Scripts.Add(SRef);
```
That will get the current scriptmanager (even if it is on a master page) and add a script reference to the CompositeScript properti... |
268,444 | <p>I'm hoping that someone has found a way of doing this already or that there is a library already in existence. It's one of those things that would be nice but is in no way necessary for the time being.</p>
<p>The functionality I'm looking for is something like <a href="http://www.datejs.com/" rel="nofollow noreferr... | [
{
"answer_id": 268457,
"author": "mmiika",
"author_id": 6846,
"author_profile": "https://Stackoverflow.com/users/6846",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/az4se3k1(VS.71).aspx\" rel=\"nofollow noreferrer\">http://msdn.microsoft... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35047/"
] | I'm hoping that someone has found a way of doing this already or that there is a library already in existence. It's one of those things that would be nice but is in no way necessary for the time being.
The functionality I'm looking for is something like [datejs](http://www.datejs.com/) in reverse.
Thanks,
Simon.
--... | Actually, what you really want is the Custom DateTime Format strings:
<http://msdn.microsoft.com/en-us/library/8kb3ddd4(VS.71).aspx>
```
DateTime.Now.ToString("ggyyyy$dd-MMM (dddd)")
```
will return "A.D.2008$06-Nov (Thursday)" if that's what you want.
And to get something closr to datejs ("in forward"), you can us... |
268,464 | <pre><code><form id="frm_1" name="frm_1" target="_self" method="GET" action="local_page.php" >
</form>
<form id="tgt_1" name="tgt_1" target="_blank" method="POST" action="http://stackoverflow.com/" >
</form>
<a onclick="test(event, '1'); " href="#" >Click Here</a>
<script>
... | [
{
"answer_id": 268477,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 1,
"selected": false,
"text": "<p>As far as I know, it's not possible to submit two forms at once. Since you're using PHP however, why not take a look at the... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24765/"
] | ```
<form id="frm_1" name="frm_1" target="_self" method="GET" action="local_page.php" >
</form>
<form id="tgt_1" name="tgt_1" target="_blank" method="POST" action="http://stackoverflow.com/" >
</form>
<a onclick="test(event, '1'); " href="#" >Click Here</a>
<script>
function test(event, id){
document.getEle... | ```
<form id="frm_1" name="frm_1" target="_self" method="POST" action="local_page.php" >
<input type="hidden" name="vital_param" value="<?= $something ?>">
</form>
<form id="tgt_1" name="tgt_1" target="_blank" method="POST" action="http://stackoverflow.com/" >
</form>
<button type="submit" onclick="test(event, '1'); ... |
268,468 | <p>I noticed that the ASP.NET cache items are inspected (and possibly removed) every 20 seconds (and oddly enough each time at HH:MM:00, HH:MM:20 and HH:MM:40). I spent about 15 minutes looking how to change this parameter without any success. I also tried to set the following in web.config, but it did not help:</p>
<... | [
{
"answer_id": 269368,
"author": "Dave Swersky",
"author_id": 34796,
"author_profile": "https://Stackoverflow.com/users/34796",
"pm_score": 2,
"selected": false,
"text": "<p>According to the <a href=\"http://msdn.microsoft.com/en-us/library/system.web.configuration.cachesection.privateby... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15716/"
] | I noticed that the ASP.NET cache items are inspected (and possibly removed) every 20 seconds (and oddly enough each time at HH:MM:00, HH:MM:20 and HH:MM:40). I spent about 15 minutes looking how to change this parameter without any success. I also tried to set the following in web.config, but it did not help:
```
<cac... | Poking around with Reflector reveals that the the interval is hardcoded. Expiry is handled by an internal `CacheExpires` class, whose static constructor contains
```
_tsPerBucket = new TimeSpan(0, 0, 20);
```
`_tsPerBucket` is `readonly`, so there can't be any configuration setting that modifies it later.
The timer... |
268,476 | <p>Take a very simple case as an example, say I have this URL:</p>
<pre><code>http://www.example.com/65167.html
</code></pre>
<p>and I wish to serve that content under:</p>
<pre><code>http://www.example.com/about
</code></pre>
<p><strong>UPDATE</strong>: Note that the 'bad' URL is the canonical one (it's produced b... | [
{
"answer_id": 268487,
"author": "Ignacio Vazquez-Abrams",
"author_id": 20862,
"author_profile": "https://Stackoverflow.com/users/20862",
"pm_score": 3,
"selected": true,
"text": "<p>Apache HTTPD's mod_rewrite can leave a browser showing a SEO-friendly URL in its location bar while redir... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5058/"
] | Take a very simple case as an example, say I have this URL:
```
http://www.example.com/65167.html
```
and I wish to serve that content under:
```
http://www.example.com/about
```
**UPDATE**: Note that the 'bad' URL is the canonical one (it's produced by a CMS which uses it internally for linking), so `"/about"` i... | Apache HTTPD's mod\_rewrite can leave a browser showing a SEO-friendly URL in its location bar while redirecting to a numeric URL on the server:
```
RewriteEngine on
RewriteRule ^/about$ /65167.html [L]
``` |
268,483 | <p>I'm currently in the process of writing a wizard and want to make each page validate before moving onto the next page.</p>
<p>I want to prevent the user from progressing by calling the Validate() method on every child control on the page and and stopping navigation if any of them fail.</p>
<p>The problem is that t... | [
{
"answer_id": 268514,
"author": "Jamey McElveen",
"author_id": 30099,
"author_profile": "https://Stackoverflow.com/users/30099",
"pm_score": 1,
"selected": false,
"text": "<p>If you are talking asp.net you can set the ValidationGroup attribute on the control then call <code>this.Validat... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4019/"
] | I'm currently in the process of writing a wizard and want to make each page validate before moving onto the next page.
I want to prevent the user from progressing by calling the Validate() method on every child control on the page and and stopping navigation if any of them fail.
The problem is that the Validate() met... | If the pages happen to be ContainerControl instances, you can just call ValidateChildren. If not, this seems to work on an individual control:
```
private void ValidateControl(Control control)
{
Type type = control.GetType();
type.InvokeMember("PerformControlValidation", BindingFlags.Instance | BindingFlags.NonPub... |
268,490 | <p>I'm refactoring some old JavaScript code and there's a lot of DOM manipulation going on.</p>
<pre><code>var d = document;
var odv = d.createElement("div");
odv.style.display = "none";
this.OuterDiv = odv;
var t = d.createElement("table");
t.cellSpacing = 0;
t.className = "text";
odv.appendChild(t);
</code></pre>
... | [
{
"answer_id": 268507,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 7,
"selected": false,
"text": "<p>Simply supplying the HTML of elements you want to add to a jQuery constructor <code>$()</code> will return a jQue... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4950/"
] | I'm refactoring some old JavaScript code and there's a lot of DOM manipulation going on.
```
var d = document;
var odv = d.createElement("div");
odv.style.display = "none";
this.OuterDiv = odv;
var t = d.createElement("table");
t.cellSpacing = 0;
t.className = "text";
odv.appendChild(t);
```
I would like to know if... | Here's your example in the "one" line.
```
this.$OuterDiv = $('<div></div>')
.hide()
.append($('<table></table>')
.attr({ cellSpacing : 0 })
.addClass("text")
)
;
```
---
*Update*: I thought I'd update this post since it still gets quite a bit of traffic. In the comments below there's so... |
268,496 | <p>The default output from Drupal's Form API is:</p>
<pre><code><input id="edit-submit" class="form-submit" type="submit" value="Save" name="op"/>
</code></pre>
<p>How do I theme that so I get:</p>
<pre><code><button id="edit-submit" class="form-submit" type="submit">
<span>Save</span>
<... | [
{
"answer_id": 271472,
"author": "FGM",
"author_id": 33991,
"author_profile": "https://Stackoverflow.com/users/33991",
"pm_score": 3,
"selected": true,
"text": "<p>The basic idea to themeing a form_foo if you're using a plain PHP theme (like Chameleon), is to write a function called them... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3842/"
] | The default output from Drupal's Form API is:
```
<input id="edit-submit" class="form-submit" type="submit" value="Save" name="op"/>
```
How do I theme that so I get:
```
<button id="edit-submit" class="form-submit" type="submit">
<span>Save</span>
</button>
```
I need the inner span-tag so I can use the slidin... | The basic idea to themeing a form\_foo if you're using a plain PHP theme (like Chameleon), is to write a function called theme\_form\_foo().
You can also theme one element (like this button) specifically, by declaring a theme function just for it. See [https://api.drupal.org/api/drupal/developer%21topics%21forms\_api\... |
268,499 | <p>I can use an bitmap in a menu</p>
<pre><code>CMenu men;
CBitmap b;
b.LoadBitmap(IDB_0);
men.AppendMenu( MF_ENABLED,1,&b);
</code></pre>
<p>I can draw an icon into a DC</p>
<pre><code> CImageList IL;
IL.Create(70, 14, ILC_COLOR16 | ILC_MASK, 1, 0);
IL.Add(AfxGetApp()->LoadIcon(IDI_0));
IL.Draw ( pDC... | [
{
"answer_id": 268703,
"author": "Roel",
"author_id": 11449,
"author_profile": "https://Stackoverflow.com/users/11449",
"pm_score": 2,
"selected": false,
"text": "<p>I asked the question you reference.</p>\n\n<p>The way to add (normal, 16-bit color) icons to menus is to make a toolbar wi... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16582/"
] | I can use an bitmap in a menu
```
CMenu men;
CBitmap b;
b.LoadBitmap(IDB_0);
men.AppendMenu( MF_ENABLED,1,&b);
```
I can draw an icon into a DC
```
CImageList IL;
IL.Create(70, 14, ILC_COLOR16 | ILC_MASK, 1, 0);
IL.Add(AfxGetApp()->LoadIcon(IDI_0));
IL.Draw ( pDC, 0, rcIcon.TopLeft(), ILD_BLEND50 );
``... | I asked the question you reference.
The way to add (normal, 16-bit color) icons to menus is to make a toolbar with the same resource id as the menu you want to have icons in. You then assign id's to each of the toolbar buttons, the same id's as the menu entries. Make a wizard-generated new MFC application and you'll s... |
268,501 | <p>On a Windows 2003 server I have a pure .NET 3.5 <code>C#</code> app (no unmanaged code). It connects to various other remote systems via sockets and acts like a data hub. It runs for 10-15 hours fine with no problem but from time to time it just disappears. If I watch the app using task manager the memory usage rema... | [
{
"answer_id": 268511,
"author": "kͩeͣmͮpͥ ͩ",
"author_id": 26479,
"author_profile": "https://Stackoverflow.com/users/26479",
"pm_score": 0,
"selected": false,
"text": "<p>If it's a Windows Forms application, you could try <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35055/"
] | On a Windows 2003 server I have a pure .NET 3.5 `C#` app (no unmanaged code). It connects to various other remote systems via sockets and acts like a data hub. It runs for 10-15 hours fine with no problem but from time to time it just disappears. If I watch the app using task manager the memory usage remains constant.
... | Try using the debugging tools from microsoft. You can download them from [here](http://www.microsoft.com/whdc/devtools/debugging/default.mspx).
Use adplus to capture the crash and then windbg to analyze it.
adplus -crash -pn your.exe -quiet
Lots of great info about debugging on windows on this [blog](http://blogs.ms... |
268,526 | <p>A site I am working on that is built using PHP is sometimes showing a completely blank page.
There are no error messages on the client or on the server.
The same page may display sometimes but not others.
All pages are working fine in IE7, Firefox 3, Safari and Opera.
All pages are XHTML with this meta element:</p>
... | [
{
"answer_id": 268571,
"author": "DOK",
"author_id": 27637,
"author_profile": "https://Stackoverflow.com/users/27637",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure if this exactly matches your experience. It depends on which specific version of IE (including service packs) is b... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18333/"
] | A site I am working on that is built using PHP is sometimes showing a completely blank page.
There are no error messages on the client or on the server.
The same page may display sometimes but not others.
All pages are working fine in IE7, Firefox 3, Safari and Opera.
All pages are XHTML with this meta element:
```
<m... | This is a content-type problem from IE.
It does not know how to handle application/xhtml+xml.
Although you write xhtml+xml, IE only knows text+html.
It will be the future before all agents know xhtml+xml
change your meta tag with content type to content="text/html; |
268,543 | <p>I have an application with a main form. In this form I have placed three TActionMainMenuBars, because the application essentially runs in three different modes. </p>
<p>The menu bars are all constructed from actions stored(proxied) in an TActionManager on the main form. The ActionManager actually references actionl... | [
{
"answer_id": 270547,
"author": "Francesca",
"author_id": 9842,
"author_profile": "https://Stackoverflow.com/users/9842",
"pm_score": 0,
"selected": false,
"text": "<p>Be sure that the actions you want to use are actually enabled.<br>\nIf you disable every action within an ActionMainMen... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an application with a main form. In this form I have placed three TActionMainMenuBars, because the application essentially runs in three different modes.
The menu bars are all constructed from actions stored(proxied) in an TActionManager on the main form. The ActionManager actually references actionlists on va... | Enabling/disabling or showing/hiding of a ActioneMenuBar has no consequences for the actions on the menu bar. If you want to make some actions not available in a certain context/situation, you need to implement the "OnUpdate" event of either the action itself or the action list or action manager it is part of.
For exa... |
268,548 | <p>I use CruiseControl.NET to automatically build my .NET 3.5 web applications, which works a treat. However, is there any way to automatically create a ZIP file of these builds, and put the ZIP's into a separate directory?</p>
<p>I have seen this is possible using NAnt but cannot find an example of how to get this w... | [
{
"answer_id": 268623,
"author": "kͩeͣmͮpͥ ͩ",
"author_id": 26479,
"author_profile": "https://Stackoverflow.com/users/26479",
"pm_score": 1,
"selected": false,
"text": "<p>If you're using Nant, then doesn't the <a href=\"http://nant.sourceforge.net/release/latest/help/tasks/zip.html\" re... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35064/"
] | I use CruiseControl.NET to automatically build my .NET 3.5 web applications, which works a treat. However, is there any way to automatically create a ZIP file of these builds, and put the ZIP's into a separate directory?
I have seen this is possible using NAnt but cannot find an example of how to get this working.
Ca... | I've just added such a Nant task to our CC machine.
See <http://nant.sourceforge.net/release/latest/help/tasks/zip.html>
Note when initially viewing the zip archive, it may appear as if all the files are at the same level, i.e no folders, but actually they folders are preserved.
Notice how you can exclude file types... |
268,574 | <p>What good ruby gem sources would you recommend, besides <a href="http://gems.rubyforge.org/" rel="noreferrer">http://gems.rubyforge.org/</a> and <a href="http://gems.github.com/" rel="noreferrer">http://gems.github.com/</a>? It seems that RubyForge is missing most of the gems I look for these days...</p>
| [
{
"answer_id": 268764,
"author": "Pistos",
"author_id": 28558,
"author_profile": "https://Stackoverflow.com/users/28558",
"pm_score": 4,
"selected": false,
"text": "<p>As far as I know, those two are it, with the primary being rubyforge, since that's the only source that a stock RubyGems... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7202/"
] | What good ruby gem sources would you recommend, besides <http://gems.rubyforge.org/> and <http://gems.github.com/>? It seems that RubyForge is missing most of the gems I look for these days... | This is now the official RubyGems source:
```
https://rubygems.org/
``` |
268,587 | <pre><code>
class C {
T a;
public:
C(T a): a(a) {;}
};
</code></pre>
<p>Is it legal?</p>
| [
{
"answer_id": 268591,
"author": "Brian R. Bondy",
"author_id": 3153,
"author_profile": "https://Stackoverflow.com/users/3153",
"pm_score": 7,
"selected": true,
"text": "<p>Yes it is legal and works on all platforms. \nIt will correctly initialize your member variable a, to the passed in... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12151/"
] | ```
class C {
T a;
public:
C(T a): a(a) {;}
};
```
Is it legal? | Yes it is legal and works on all platforms.
It will correctly initialize your member variable a, to the passed in value a.
It is considered by some more clean to name them differently though, but not all. I personally actually use it a lot :)
Initialization lists with the same variable name works because the syntax... |
268,595 | <p>I am trying to put version information to my C# GUI framework retrieved from the latest ClearCase label. This was originally done from Visual Soursafe as below. </p>
<pre><code>vssDB = new VSSDatabaseClass();
vssDB.Open( databaseName, "vssadmin", "vssadmin" );
VSSItem item = vssDB.get_VSSItem( @"$\BuildDCP.bat", ... | [
{
"answer_id": 269607,
"author": "Matt Cruikshank",
"author_id": 8643,
"author_profile": "https://Stackoverflow.com/users/8643",
"pm_score": 0,
"selected": false,
"text": "<p>I really wish that the COM interfaces had better documentation, or were more obvious. Or that the code to ClearC... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to put version information to my C# GUI framework retrieved from the latest ClearCase label. This was originally done from Visual Soursafe as below.
```
vssDB = new VSSDatabaseClass();
vssDB.Open( databaseName, "vssadmin", "vssadmin" );
VSSItem item = vssDB.get_VSSItem( @"$\BuildDCP.bat", false );
foreach... | I believe this could be better achieved through a script, which would be called from your C# program.
But you may be able to directly call some COM objects, through the [CAL interface](http://www.ibm.com/developerworks/rational/library/06/0207_joshi/index.html) provided with ClearCase.
The documentation for the inter... |
268,604 | <p>This code:</p>
<pre><code>#include <iostream>
int main( int, char **argv )
{
std::cout << 1.23e45 << std::endl;
}
</code></pre>
<p>prints </p>
<blockquote>
<p>1.23e+045</p>
</blockquote>
<p>when compiled with MS Visual Studio 2003, and</p>
<blockquote>
<p>1.23e+45</p>
</blockquote>
<p>on ... | [
{
"answer_id": 268650,
"author": "xtofl",
"author_id": 6610,
"author_profile": "https://Stackoverflow.com/users/6610",
"pm_score": -1,
"selected": false,
"text": "<p>Look into the iomanip header. It has a lot of width-precision etc... functionality.</p>\n"
},
{
"answer_id": 2686... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19863/"
] | This code:
```
#include <iostream>
int main( int, char **argv )
{
std::cout << 1.23e45 << std::endl;
}
```
prints
>
> 1.23e+045
>
>
>
when compiled with MS Visual Studio 2003, and
>
> 1.23e+45
>
>
>
on my Linux machine.
How can I specify the width of the exponent field (and why is there a difference i... | I don't think this is possible with standard manipulators. (if it is, I'd love to be corrected and learn how)
Your only remaining option is creating a streambuf yourself, and intercepting all exponent numbers that go to the stream, reformat them by hand, and pass them on to the underlying stream.
Seems a lot of work,... |
268,629 | <p>I am running my <code>HTTPServer</code> in a separate thread (using the threading module which has no way to stop threads...) and want to stop serving requests when the main thread also shuts down.</p>
<p>The Python documentation states that <code>BaseHTTPServer.HTTPServer</code> is a subclass of <code>SocketServer... | [
{
"answer_id": 268660,
"author": "Ali Afshar",
"author_id": 28380,
"author_profile": "https://Stackoverflow.com/users/28380",
"pm_score": 6,
"selected": true,
"text": "<p>I should start by saying that \"I probably wouldn't do this myself, but I have in the past\". The serve_forever (from... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2260/"
] | I am running my `HTTPServer` in a separate thread (using the threading module which has no way to stop threads...) and want to stop serving requests when the main thread also shuts down.
The Python documentation states that `BaseHTTPServer.HTTPServer` is a subclass of `SocketServer.TCPServer`, which supports a `shutdo... | I should start by saying that "I probably wouldn't do this myself, but I have in the past". The serve\_forever (from SocketServer.py) method looks like this:
```
def serve_forever(self):
"""Handle one request at a time until doomsday."""
while 1:
self.handle_request()
```
You could replace (in subcla... |
268,648 | <p>I'm scanning through a file looking for lines that match a certain regex pattern, and then I want to print out the lines that match but in alphabetical order. I'm sure this is trivial but vbscript isn't my background</p>
<p>my array is defined as</p>
<pre><code>Dim lines(10000)
</code></pre>
<p>if that makes any dif... | [
{
"answer_id": 268659,
"author": "Oskar",
"author_id": 5472,
"author_profile": "https://Stackoverflow.com/users/5472",
"pm_score": 7,
"selected": true,
"text": "<p>From <a href=\"http://www.microsoft.com/technet/scriptcenter/funzone/games/tips08/gtip1130.mspx#E4C\" rel=\"noreferrer\">mic... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5472/"
] | I'm scanning through a file looking for lines that match a certain regex pattern, and then I want to print out the lines that match but in alphabetical order. I'm sure this is trivial but vbscript isn't my background
my array is defined as
```
Dim lines(10000)
```
if that makes any difference, and I'm trying to exe... | From [microsoft](http://www.microsoft.com/technet/scriptcenter/funzone/games/tips08/gtip1130.mspx#E4C)
Sorting arrays in VBScript has never been easy; that’s because VBScript doesn’t have a sort command of any kind. In turn, that always meant that VBScript scripters were forced to write their own sort routines, be tha... |
268,651 | <p>How do you do your Hibernate session management in a Java Desktop Swing application? Do you use a single session? Multiple sessions?</p>
<p>Here are a few references on the subject:</p>
<ul>
<li><a href="http://www.hibernate.org/333.html" rel="noreferrer">http://www.hibernate.org/333.html</a></li>
<li><a href="htt... | [
{
"answer_id": 268784,
"author": "Vladimir Dyuzhev",
"author_id": 1163802,
"author_profile": "https://Stackoverflow.com/users/1163802",
"pm_score": 4,
"selected": true,
"text": "<p>Single session. Start transaction when you need to do a set of operations (like update data after dialog bo... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/407003/"
] | How do you do your Hibernate session management in a Java Desktop Swing application? Do you use a single session? Multiple sessions?
Here are a few references on the subject:
* <http://www.hibernate.org/333.html>
* <http://blog.schauderhaft.de/2008/09/28/hibernate-sessions-in-two-tier-rich-client-applications/>
* <ht... | Single session. Start transaction when you need to do a set of operations (like update data after dialog box OK button), commit the tx at the end. The connection though is constantly open (since it's the same session), and thus all opportunities for caching can be used by both Hib and RDBMS.
It may also be a good idea... |
268,652 | <p>I'm using java and referring to the "double" datatype.
To keep it short, I'm reading some values from standard input that I read in my code as doubles (I would much rather use something like BigInteger but right now it's not possible).</p>
<p>I expect to get double values from the user but sometimes they might inpu... | [
{
"answer_id": 268662,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": true,
"text": "<p>Most values entered by humans won't be exactly representable with a double.</p>\n\n<p>For instance, do you want to pre... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15225/"
] | I'm using java and referring to the "double" datatype.
To keep it short, I'm reading some values from standard input that I read in my code as doubles (I would much rather use something like BigInteger but right now it's not possible).
I expect to get double values from the user but sometimes they might input things l... | Most values entered by humans won't be exactly representable with a double.
For instance, do you want to prevent the user from entering 0.1? That's not exactly representable as a double.
To find the scale of the error, you could do something like:
```
BigDecimal userAsDecimal = new BigDecimal(userInput);
double user... |
268,656 | <p>I'm trying to control the main timeline of my flash application from a MovieClip that is a child of the main stage. Apparently, in ActionScript 2, you could do that using _root, but using root (since _root no longer exists) now gives an error:</p>
<pre><code>root.play();
</code></pre>
<p>"1061: Call to a possibly ... | [
{
"answer_id": 268777,
"author": "Randy Stegbauer",
"author_id": 34301,
"author_profile": "https://Stackoverflow.com/users/34301",
"pm_score": 2,
"selected": false,
"text": "<p>According to <a href=\"http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=665&am... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25280/"
] | I'm trying to control the main timeline of my flash application from a MovieClip that is a child of the main stage. Apparently, in ActionScript 2, you could do that using \_root, but using root (since \_root no longer exists) now gives an error:
```
root.play();
```
"1061: Call to a possibly undefined method play th... | You need to cast it to a MovieClip
```
(root as MovieClip).play()
``` |
268,671 | <p>I have a HQL query that can generate either an IList of results, or an IEnumerable of results. </p>
<p>However, I want it to return an array of the Entity that I'm selecting, what would be the best way of accomplishing that? I can either enumerate through it and build the array, or use CopyTo() a defined array.</p>... | [
{
"answer_id": 268699,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 8,
"selected": true,
"text": "<p>Which version of .NET are you using? If it's .NET 3.5, I'd just call <code>ToArray()</code> and be done with it.</p>\... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33663/"
] | I have a HQL query that can generate either an IList of results, or an IEnumerable of results.
However, I want it to return an array of the Entity that I'm selecting, what would be the best way of accomplishing that? I can either enumerate through it and build the array, or use CopyTo() a defined array.
Is there any... | Which version of .NET are you using? If it's .NET 3.5, I'd just call `ToArray()` and be done with it.
If you only have a non-generic IEnumerable, do something like this:
```
IEnumerable query = ...;
MyEntityType[] array = query.Cast<MyEntityType>().ToArray();
```
If you don't know the type within that method but th... |
268,674 | <p>I have this ListBox which is bound to an ObservableCollection. Each object in the list implements an interface called ISelectable </p>
<pre><code>public interface ISelectable : INotifyPropertyChanged
{
event EventHandler IsSelected;
bool Selected { get; set; }
string DisplayText { get; }
}
</code></pre>... | [
{
"answer_id": 268692,
"author": "Pondidum",
"author_id": 1500,
"author_profile": "https://Stackoverflow.com/users/1500",
"pm_score": 1,
"selected": false,
"text": "<p>Have you looked at the list box's SelectedItemChanged and SelectedIndexChanged events?</p>\n\n<p>These should be trigger... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143/"
] | I have this ListBox which is bound to an ObservableCollection. Each object in the list implements an interface called ISelectable
```
public interface ISelectable : INotifyPropertyChanged
{
event EventHandler IsSelected;
bool Selected { get; set; }
string DisplayText { get; }
}
```
I want to keep track ... | You could also accomplish this by data binding ListBoxItem.IsSelected to your Selected property. The idea is to set the binding for each of the ListBoxItems as they are created. This can be done using a style that targets each of the ListBoxItems generated for the ListBox.
This way when an item in the ListBox is selec... |
268,680 | <p>I would like to monitor the number of threads used by a specific process on Linux.
Is there an easy way to get this information without impacting the performance of the process?</p>
| [
{
"answer_id": 268705,
"author": "rhys keepence",
"author_id": 34676,
"author_profile": "https://Stackoverflow.com/users/34676",
"pm_score": 3,
"selected": false,
"text": "<p>JStack is quite inexpensive - one option would be to pipe the output through grep to find active threads and then... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I would like to monitor the number of threads used by a specific process on Linux.
Is there an easy way to get this information without impacting the performance of the process? | try
```
ps huH p <PID_OF_U_PROCESS> | wc -l
```
or [htop](http://htop.sourceforge.net/) |
268,698 | <p>This is somewhat of a follow-up question to this <a href="https://stackoverflow.com/questions/267045/is-there-a-benefit-to-having-both-an-abstract-class-and-an-interface">question</a>.</p>
<p>Suppose I have an inheritance tree as follows:</p>
<pre><code>Car -> Ford -> Mustang -> MustangGT
</code></pre>
<... | [
{
"answer_id": 268716,
"author": "Jean",
"author_id": 7898,
"author_profile": "https://Stackoverflow.com/users/7898",
"pm_score": 0,
"selected": false,
"text": "<p>I woudl create the first two levels, ICar and IFord and leave the second level alone until I need an interface at that secon... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/132931/"
] | This is somewhat of a follow-up question to this [question](https://stackoverflow.com/questions/267045/is-there-a-benefit-to-having-both-an-abstract-class-and-an-interface).
Suppose I have an inheritance tree as follows:
```
Car -> Ford -> Mustang -> MustangGT
```
Is there a benefit to defining interfaces for *each... | In my experience, interfaces are best used when you have several classes which each need to respond to the same method or methods so that they can be used interchangeably by other code which will be written against those classes' common interface. The best use of an interface is when the protocol is important but the u... |
268,750 | <p>I have a JFrame with a menu bar and a canvas covering all the remaining surface. When I click on the menu bar, the menu opens <strong>behind</strong> the Canvas and I can't see it. Has anyone experienced this? Other than resizing the Canvas (which I am reluctant to do) is there any solution?</p>
<p>Thanks,<br/>
Vla... | [
{
"answer_id": 268815,
"author": "basszero",
"author_id": 287,
"author_profile": "https://Stackoverflow.com/users/287",
"pm_score": 4,
"selected": true,
"text": "<p>You're experiencing heavyweight vs. lightweight issues.</p>\n\n<p>The quick fix: </p>\n\n<pre><code>// Call this sometime b... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1155998/"
] | I have a JFrame with a menu bar and a canvas covering all the remaining surface. When I click on the menu bar, the menu opens **behind** the Canvas and I can't see it. Has anyone experienced this? Other than resizing the Canvas (which I am reluctant to do) is there any solution?
Thanks,
Vlad | You're experiencing heavyweight vs. lightweight issues.
The quick fix:
```
// Call this sometime before you use your menus
JPopupMenu.setDefaultLightWeightPopupEnabled(false)
```
[Heavyweight vs. Lightweight](http://java.sun.com/products/jfc/tsc/articles/mixing/index.html) |
268,771 | <p>Ok, so I have this regex:</p>
<pre><code>( |^|>)(((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{2})(-)?( )?)?)([0-9]{7}))|((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{3})(-)?( )?)?)([0-9]{6}))|((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{1})(-)?( )?)?)([0-9]{8})))( |$|<)
</code></pre>
<p>It formats Dutch and Belgian ph... | [
{
"answer_id": 268810,
"author": "Pistos",
"author_id": 28558,
"author_profile": "https://Stackoverflow.com/users/28558",
"pm_score": 3,
"selected": false,
"text": "<p>Good Lord Almighty, what a mess! :) If you have high-level semantic or business rules (such as the ones you describe t... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16805/"
] | Ok, so I have this regex:
```
( |^|>)(((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{2})(-)?( )?)?)([0-9]{7}))|((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{3})(-)?( )?)?)([0-9]{6}))|((((((\+|00)(31|32)( )?(\(0\))?)|0)([0-9]{1})(-)?( )?)?)([0-9]{8})))( |$|<)
```
It formats Dutch and Belgian phone numbers (I only want those h... | First observation: reading the regex is a nightmare. It cries out for Perl's /x mode.
Second observation: there are lots, and lots, and lots of capturing parentheses in the expression (42 if I count correctly; and 42 is, of course, "The Answer to Life, the Universe, and Everything" -- see Douglas Adams "Hitchiker's Gu... |
268,778 | <p>I have a class called EventConsumer which defines an event EventConsumed and a method OnEventConsumed as follows:</p>
<pre><code>public event EventHandler EventConsumed;
public virtual void OnEventConsumed(object sender, EventArgs e)
{
if (EventConsumed != null)
EventConsumed(this, e);
}
</code></pre>
... | [
{
"answer_id": 268803,
"author": "TcKs",
"author_id": 20382,
"author_profile": "https://Stackoverflow.com/users/20382",
"pm_score": 0,
"selected": false,
"text": "<p>The using</p>\n\n<pre><code>public virtual void OnEventConsumed(object sender, EventArgs e)\n{\n if (EventConsumed != n... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] | I have a class called EventConsumer which defines an event EventConsumed and a method OnEventConsumed as follows:
```
public event EventHandler EventConsumed;
public virtual void OnEventConsumed(object sender, EventArgs e)
{
if (EventConsumed != null)
EventConsumed(this, e);
}
```
I need to add attribut... | Here's the IL from a sample app:
```
.method public hidebysig virtual instance void OnEventConsumed(object sender, class [mscorlib]System.EventArgs e) cil managed
{
.maxstack 8
L_0000: nop
L_0001: ldarg.0
L_0002: ldarg.1
L_0003: ldarg.2
L_0004: call instance voi... |
268,792 | <p>I have a class <code>isSearching</code> with a single boolean property in a 'functions' file in my webapp. On my search page, I have a variable <code>oSearchHandler</code> declared as a <code>Public Shared</code> variable. How can I access the contents of <code>oSearchHandler</code> on other pages in my webapp?</p... | [
{
"answer_id": 268811,
"author": "Vincent Ramdhanie",
"author_id": 27439,
"author_profile": "https://Stackoverflow.com/users/27439",
"pm_score": 0,
"selected": false,
"text": "<p>You probably need a table say tblItems that simply store all the primary keys of the two tables. Inserting it... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] | I have a class `isSearching` with a single boolean property in a 'functions' file in my webapp. On my search page, I have a variable `oSearchHandler` declared as a `Public Shared` variable. How can I access the contents of `oSearchHandler` on other pages in my webapp?
Code with Session....
```
'search.aspx
Public Fun... | sorry for the late answer, I've been struck with a serious case of weekenditis.
As for utilizing a third table to include PKs from both client and system tables - I don't like that as that just overly complicates synchronization and still requires my app to know of the third table.
Another issue that has arisen is th... |
268,802 | <p>In my Silverlight app I want a multi-line text box to expand every time the user hits Enter.</p>
<p>The difficult part is how to calculate the correct height based on the number of text lines.</p>
<p>I have tried the following but the textbox becomes too small:</p>
<pre><code>box.Height = box.FontSize*lineCount +... | [
{
"answer_id": 279606,
"author": "Bryant",
"author_id": 10893,
"author_profile": "https://Stackoverflow.com/users/10893",
"pm_score": 2,
"selected": false,
"text": "<p>This seems to be how the textbox works out of the box. Just make sure you set the <a href=\"http://msdn.microsoft.com/en... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30056/"
] | In my Silverlight app I want a multi-line text box to expand every time the user hits Enter.
The difficult part is how to calculate the correct height based on the number of text lines.
I have tried the following but the textbox becomes too small:
```
box.Height = box.FontSize*lineCount + box.Padding.Top + box.Paddi... | This seems to be how the textbox works out of the box. Just make sure you set the [AcceptsReturn](http://msdn.microsoft.com/en-us/library/system.windows.controls.textbox.acceptsreturn(VS.95).aspx)="True" on the textbox. Also make sure you don't set the height of the Textbox so that it is calculated for you. |
268,808 | <p>I have a need to determine what security group(s) a user is a member of from within a SQL Server Reporting Services report. Access to the report will be driven by membership to one of two groups: 'report_name_summary' and 'report_name_detail'. Once the user is executing the report, we want to be able to use their me... | [
{
"answer_id": 285601,
"author": "PJ8",
"author_id": 35490,
"author_profile": "https://Stackoverflow.com/users/35490",
"pm_score": 4,
"selected": true,
"text": "<p>You can add custom code to a report. <a href=\"http://msdn.microsoft.com/en-us/library/ms155798.aspx\" rel=\"noreferrer\">T... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1680/"
] | I have a need to determine what security group(s) a user is a member of from within a SQL Server Reporting Services report. Access to the report will be driven by membership to one of two groups: 'report\_name\_summary' and 'report\_name\_detail'. Once the user is executing the report, we want to be able to use their m... | You can add custom code to a report. [This link](http://msdn.microsoft.com/en-us/library/ms155798.aspx) has some examples.
Theoretically, you should be able to write some code like this, and then use the return value to show/hide what you want. You may have permissions problems with this method, though.
```
Public Fu... |
268,814 | <p>Consider this:</p>
<pre><code>public class TestClass {
private String a;
private String b;
public TestClass()
{
a = "initialized";
}
public void doSomething()
{
String c;
a.notify(); // This is fine
b.notify(); // This is fine - but will end in an exception
c.... | [
{
"answer_id": 268825,
"author": "user35094",
"author_id": 35094,
"author_profile": "https://Stackoverflow.com/users/35094",
"pm_score": 2,
"selected": false,
"text": "<p>The compiler can figure out that c will never be set. The b variable could be set by someone else after the construc... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24545/"
] | Consider this:
```
public class TestClass {
private String a;
private String b;
public TestClass()
{
a = "initialized";
}
public void doSomething()
{
String c;
a.notify(); // This is fine
b.notify(); // This is fine - but will end in an exception
c.notify(); // "... | The rules for definite assignment are quite difficult (read chapter 16 of JLS 3rd Ed). It's not practical to enforce definite assignment on fields. As it stands, it's even possible to observe final fields before they are initialised. |
268,820 | <p>I have a servlet that I would like to run within ColdFusion MX 7. I would like to make use of an existing ColdFusion DSN as a javax.sql.DataSource, if possible.</p>
<p>I thought something like </p>
<pre><code>coldfusion.server.ServiceFactory.getDataSourceService().getDatasource(dsname);
</code></pre>
<p>would wor... | [
{
"answer_id": 268912,
"author": "Chase Seibert",
"author_id": 7679,
"author_profile": "https://Stackoverflow.com/users/7679",
"pm_score": 1,
"selected": false,
"text": "<p>That code will work fine, you just don't have ServiceFactory in your classpath. Ie, Java can't load that class. Try... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32320/"
] | I have a servlet that I would like to run within ColdFusion MX 7. I would like to make use of an existing ColdFusion DSN as a javax.sql.DataSource, if possible.
I thought something like
```
coldfusion.server.ServiceFactory.getDataSourceService().getDatasource(dsname);
```
would work, but unfortunately the servlet ... | It seems the simplest way to do this is to add an additional JNDI datasource into jrun-resources.xml. This can then be accessed in the conventional way:
```
Context context = new InitialContext();
DataSource ds = (DataSource)context.lookup("mydatasource");
```
It does mean duplicating database connection configurat... |
268,824 | <p>We're working now on the design of a new API for our product, which will be exposed via web services. We have a dispute whether we should use strict parameters with well defined types (my opinion) or strings that will contain XML in whatever structure needed. It is quite obvious that ideally using a strict signature... | [
{
"answer_id": 268912,
"author": "Chase Seibert",
"author_id": 7679,
"author_profile": "https://Stackoverflow.com/users/7679",
"pm_score": 1,
"selected": false,
"text": "<p>That code will work fine, you just don't have ServiceFactory in your classpath. Ie, Java can't load that class. Try... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26039/"
] | We're working now on the design of a new API for our product, which will be exposed via web services. We have a dispute whether we should use strict parameters with well defined types (my opinion) or strings that will contain XML in whatever structure needed. It is quite obvious that ideally using a strict signature is... | It seems the simplest way to do this is to add an additional JNDI datasource into jrun-resources.xml. This can then be accessed in the conventional way:
```
Context context = new InitialContext();
DataSource ds = (DataSource)context.lookup("mydatasource");
```
It does mean duplicating database connection configurat... |
268,835 | <p>I am new to Hibernate and attempting to run a java/spring example that retrieves data from a table in MS SqlServer. Everytime I try to run the program, the data source loads ok. But when spring tries to load the session facotry it gets the following error:</p>
<pre><code>Exception in thread "main" org.springframew... | [
{
"answer_id": 268883,
"author": "toolkit",
"author_id": 3295,
"author_profile": "https://Stackoverflow.com/users/3295",
"pm_score": 4,
"selected": false,
"text": "<p>You are missing a JAR file containing the JTA API classes. You probably have one already when you downloaded Hibernate. I... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am new to Hibernate and attempting to run a java/spring example that retrieves data from a table in MS SqlServer. Everytime I try to run the program, the data source loads ok. But when spring tries to load the session facotry it gets the following error:
```
Exception in thread "main" org.springframework.beans.facto... | You are missing a JAR file containing the JTA API classes. You probably have one already when you downloaded Hibernate. It should be called something like:
```
jta-1.1.jar
```
Hope this helps. |
268,853 | <p>This is just to satisfy my own curiosity.</p>
<p>Is there an implementation of this:</p>
<pre><code>float InvSqrt (float x)
{
float xhalf = 0.5f*x;
int i = *(int*)&x;
i = 0x5f3759df - (i>>1);
x = *(float*)&i;
x = x*(1.5f - xhalf*x*x);
return x;
}
</code></pre>
<p>in C#? If it exis... | [
{
"answer_id": 268863,
"author": "Inisheer",
"author_id": 2982,
"author_profile": "https://Stackoverflow.com/users/2982",
"pm_score": 0,
"selected": false,
"text": "<p>I don't see why it wouldn't be possible using the <strong>unsafe compiler option</strong>.</p>\n"
},
{
"answer_i... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9825/"
] | This is just to satisfy my own curiosity.
Is there an implementation of this:
```
float InvSqrt (float x)
{
float xhalf = 0.5f*x;
int i = *(int*)&x;
i = 0x5f3759df - (i>>1);
x = *(float*)&i;
x = x*(1.5f - xhalf*x*x);
return x;
}
```
in C#? If it exists, post the code.
I guess I should have menti... | You should be able to use the StructLayout and FieldOffset attributes to fake a union for plain old data like floats and ints.
```
[StructLayout(LayoutKind.Explicit, Size=4)]
private struct IntFloat {
[FieldOffset(0)]
public float floatValue;
[FieldOffset(0)]
public int intValue;
// redundant ass... |
268,884 | <p>I am trying to convert an access datetime field to a mysdl format, using the following string:</p>
<pre><code>select str_to_date('04/03/1974 12:21:22', '%Y %m %d %T');
</code></pre>
<p>While I do not get an error, I do not get the expected result, instead I get this:</p>
<pre><code>+------------------------------... | [
{
"answer_id": 268932,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "https://Stackoverflow.com/users/15880",
"pm_score": 1,
"selected": false,
"text": "<p>First things first, the str_to_date shown doesn't work because the format doesn't match the string. '%Y %m %d %T' wo... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I am trying to convert an access datetime field to a mysdl format, using the following string:
```
select str_to_date('04/03/1974 12:21:22', '%Y %m %d %T');
```
While I do not get an error, I do not get the expected result, instead I get this:
```
+---------------------------------------------------+
| str_to_date(... | Your syntax for the function is off.
Try:
```
select str_to_date('04/03/1974 12:21:22', '%m/%d/%Y %T');
```
The second parameter is telling the function where the parts of the dates are located in your string.
For your access question:
```
select str_to_date('06.10.2008 14:19:08', '%m.%d.%Y %T');
``` |
268,885 | <p>What's the best way to write a LINQ query that inserts a record and then returns the primary key of that newly inserted record using C# ?</p>
| [
{
"answer_id": 268888,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 6,
"selected": true,
"text": "<p>The primary key value will be in that property after the SubmitChanges().</p>\n\n<pre><code>MyTable record = new My... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26809/"
] | What's the best way to write a LINQ query that inserts a record and then returns the primary key of that newly inserted record using C# ? | The primary key value will be in that property after the SubmitChanges().
```
MyTable record = new MyTable();
record.Name = "James Curran";
db.MyTable.InsertOnSubmit(record);
db.SubmitChanges();
Console.WriteLine("record inserted as ID : {0}", record.Id);
``` |
268,891 | <p>I've got this python dictionary "mydict", containing arrays, here's what it looks like :</p>
<pre><code>mydict = dict(
one=['foo', 'bar', 'foobar', 'barfoo', 'example'],
two=['bar', 'example', 'foobar'],
three=['foo', 'example'])
</code></pre>
<p>i'd like to replace all the occurrences of "example" b... | [
{
"answer_id": 269043,
"author": "jfs",
"author_id": 4279,
"author_profile": "https://Stackoverflow.com/users/4279",
"pm_score": 3,
"selected": true,
"text": "<pre><code>for arr in mydict.values():\n for i, s in enumerate(arr):\n if s == 'example':\n arr[i] = 'someot... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35100/"
] | I've got this python dictionary "mydict", containing arrays, here's what it looks like :
```
mydict = dict(
one=['foo', 'bar', 'foobar', 'barfoo', 'example'],
two=['bar', 'example', 'foobar'],
three=['foo', 'example'])
```
i'd like to replace all the occurrences of "example" by "someotherword".
While... | ```
for arr in mydict.values():
for i, s in enumerate(arr):
if s == 'example':
arr[i] = 'someotherword'
``` |
268,898 | <h3>Duplicate:</h3>
<blockquote>
<p><a href="https://stackoverflow.com/questions/263945/what-happens-if-you-call-erase-on-a-map-element-while-iterating-from-begin-to-e">What happens if you call erase on a map element while iterating from begin to end</a></p>
<p><a href="https://stackoverflow.com/questions/180516/how-to... | [
{
"answer_id": 268964,
"author": "Igor Semenov",
"author_id": 11401,
"author_profile": "https://Stackoverflow.com/users/11401",
"pm_score": 2,
"selected": false,
"text": "<pre><code>map<...>::iterator tmp(iter++);\nmap1.erase(tmp);\n</code></pre>\n"
},
{
"answer_id": 268979... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ### Duplicate:
>
> [What happens if you call erase on a map element while iterating from begin to end](https://stackoverflow.com/questions/263945/what-happens-if-you-call-erase-on-a-map-element-while-iterating-from-begin-to-e)
>
>
> [How to filter items from a stdmap](https://stackoverflow.com/questions/180516/how-... | You can post-increment the iterator while passing it as argument to erase:
```
myMap.erase(itr++)
```
This way, the element that was pointed by `itr` before the erase is deleted, and the iterator is incremented to point to the next element in the map. If you're doing this in a loop, beware not to increment the itera... |
268,899 | <p>Multistrings (double null-terminated string of null-separated strings) are common in the Windows API. What's a good method for converting a multistring returned from an API to a C# string collection and vice versa?</p>
<p>I'm especially interested in proper handling of character encoding (Windows XP an later).</p>
... | [
{
"answer_id": 268944,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": false,
"text": "<p>This might be naïve, but how about:</p>\n\n<pre><code>static string[] MultiStringToArray(string multiString)\n{\n ... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35090/"
] | Multistrings (double null-terminated string of null-separated strings) are common in the Windows API. What's a good method for converting a multistring returned from an API to a C# string collection and vice versa?
I'm especially interested in proper handling of character encoding (Windows XP an later).
The following... | This might be naïve, but how about:
```
static string[] MultiStringToArray(string multiString)
{
return multiString.TrimEnd('\0').Split('\0');
}
```
Also - aren't you missing the final `\0` (you state double-null-terminated) in `StringArrayToMultiString`? And it might be easier to call if the array was a `params... |
268,902 | <p>I have a few links that should all open in the same window or tab.
To accomplish this I've given the window a name like in this example code:</p>
<pre><code><a href="#" onClick='window.open("http://somesite.com", "mywindow", "");'>link 1</a>
<a href="#" onClick='window.open("http://someothersite.com"... | [
{
"answer_id": 268951,
"author": "Noah Goodrich",
"author_id": 20178,
"author_profile": "https://Stackoverflow.com/users/20178",
"pm_score": 4,
"selected": true,
"text": "<p>The window.open() function in Javascript is specifically designed to open a new window, please see: <a href=\"http... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24046/"
] | I have a few links that should all open in the same window or tab.
To accomplish this I've given the window a name like in this example code:
```
<a href="#" onClick='window.open("http://somesite.com", "mywindow", "");'>link 1</a>
<a href="#" onClick='window.open("http://someothersite.com", "mywindow", "");'>link 2</a... | The window.open() function in Javascript is specifically designed to open a new window, please see: [w3schools documentation](http://www.w3schools.com/HTMLDOM/met_win_open.asp). It actually sounds like IE is handling things in a non-standard way (which is hardly surprising).
If you want to relocate the existing locat... |
268,923 | <p>I'm building an application using the Supervising Controller pattern (Model View Presenter) and I am facing a difficulty. In my page I have a repeater control that will display each item of a collection I am passing to it. The reapeater item contains 2 dropdown list that allow the user to select a particular value. ... | [
{
"answer_id": 269040,
"author": "Mendelt",
"author_id": 3320,
"author_profile": "https://Stackoverflow.com/users/3320",
"pm_score": 1,
"selected": false,
"text": "<p>When controller-view interation get's too complex I usually split them up into subcontrollers and subviews.</p>\n\n<p>You... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/201997/"
] | I'm building an application using the Supervising Controller pattern (Model View Presenter) and I am facing a difficulty. In my page I have a repeater control that will display each item of a collection I am passing to it. The reapeater item contains 2 dropdown list that allow the user to select a particular value. Whe... | You can also make a 'widget' interface for the drop down. I'll give you an easy example of a some working code for a TextBox widget so you get the idea.
```
public interface ITextWidget
{
event EventHandler TextChanged;
string Text { get; set; }
}
public abstract class TextWidget<T> : ITextWidget
{
prote... |
268,929 | <p>I have two Java classes: B, which extends another class A, as follows :</p>
<pre><code>class A {
public void myMethod() { /* ... */ }
}
class B extends A {
public void myMethod() { /* Another code */ }
}
</code></pre>
<p>I would like to call the <code>A.myMethod()</code> from <code>B.myMethod()</code>. I ... | [
{
"answer_id": 268937,
"author": "Elie",
"author_id": 23249,
"author_profile": "https://Stackoverflow.com/users/23249",
"pm_score": 3,
"selected": false,
"text": "<p>call super.myMethod();</p>\n"
},
{
"answer_id": 268939,
"author": "unwind",
"author_id": 28169,
"autho... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26465/"
] | I have two Java classes: B, which extends another class A, as follows :
```
class A {
public void myMethod() { /* ... */ }
}
class B extends A {
public void myMethod() { /* Another code */ }
}
```
I would like to call the `A.myMethod()` from `B.myMethod()`. I am coming from the [C++ world](https://stackover... | The keyword you're looking for is `super`. See [this guide](http://java.sun.com/docs/books/tutorial/java/IandI/super.html), for instance. |
268,982 | <p>Please help!</p>
<p><em>Background info</em></p>
<p>I have a WPF application which accesses a SQL Server 2005 database. The database is running locally on the machine the application is running on.</p>
<p>Everywhere I use the Linq DataContext I use a using { } statement, and pass in a result of a function which r... | [
{
"answer_id": 268993,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": true,
"text": "<p>From <a href=\"http://msdn.microsoft.com/en-us/library/bb292288.aspx\" rel=\"noreferrer\">MSDN</a> (<code>DataConte... | 2008/11/06 | [
"https://Stackoverflow.com/questions/268982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31128/"
] | Please help!
*Background info*
I have a WPF application which accesses a SQL Server 2005 database. The database is running locally on the machine the application is running on.
Everywhere I use the Linq DataContext I use a using { } statement, and pass in a result of a function which returns a SqlConnection object w... | From [MSDN](http://msdn.microsoft.com/en-us/library/bb292288.aspx) (`DataContext Constructor (IDbConnection)`):
>
> If you provide an open connection, the
> DataContext will not close it.
> Therefore, do not instantiate a
> DataContext with an open connection
> unless you have a good reason to do
> this.
>
>
>... |
269,005 | <p>I'm trying to do a subselect in pgsql aka postgresql and the example I found doesn't work:</p>
<pre><code>SELECT id FROM (SELECT * FROM table);
</code></pre>
| [
{
"answer_id": 269033,
"author": "cfeduke",
"author_id": 5645,
"author_profile": "https://Stackoverflow.com/users/5645",
"pm_score": 1,
"selected": false,
"text": "<p>I think you need something like:</p>\n\n<pre><code>SELECT * FROM table WHERE id IN (SELECT id FROM table2);\n</code></pre... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35116/"
] | I'm trying to do a subselect in pgsql aka postgresql and the example I found doesn't work:
```
SELECT id FROM (SELECT * FROM table);
``` | I just needed to add an AS for the subselect, like so:
```
SELECT id FROM (SELECT * FROM table) AS aliasname;
``` |
269,010 | <p>I have created a proc that grabs all the user tables in a local DB on my machine. I want to be able to create a flat file of all my tables using BCP and SQL. Its a dummy database in SQL 2000 connecting through windows authentication. I have set my enviroment path variable in WinXP SP2. I have created new users to ac... | [
{
"answer_id": 272094,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 1,
"selected": false,
"text": "<p>Your brackets are extending over the entire qualified table name - only the individual components should be bracketed... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35109/"
] | I have created a proc that grabs all the user tables in a local DB on my machine. I want to be able to create a flat file of all my tables using BCP and SQL. Its a dummy database in SQL 2000 connecting through windows authentication. I have set my enviroment path variable in WinXP SP2. I have created new users to acces... | Your brackets are extending over the entire qualified table name - only the individual components should be bracketed:
```
bcp [HelpDesk-EasyPay].dbo.[customer] out d:\MSSQL\Data\customer.bcp -N -Utest -Ptest -T
```
should work, so you want:
```
SET @bcp = "master..xp_cmdshell 'BCP " + "[" + @db + "]..[" + @TableNa... |
269,017 | <p>So here is the simple code:</p>
<pre><code> [System.ComponentModel.DefaultValue(true)]
public bool AnyValue { get; set; }
</code></pre>
<p>I am sure I don't set AnyValue to false again (I just created it). This property is a property of a Page class of ASP.NET. And I am cheking the value in a button event h... | [
{
"answer_id": 269023,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 4,
"selected": true,
"text": "<p>DefaultValue does <strong>NOT</strong> set the value. </p>\n\n<p>What it does is tell VisualStudio what the defaul... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35012/"
] | So here is the simple code:
```
[System.ComponentModel.DefaultValue(true)]
public bool AnyValue { get; set; }
```
I am sure I don't set AnyValue to false again (I just created it). This property is a property of a Page class of ASP.NET. And I am cheking the value in a button event handling function. But some... | DefaultValue does **NOT** set the value.
What it does is tell VisualStudio what the default value is. When a visual element (Button, listbox etc) is selected on a form, and the Property panel is displayed, VS will **bold** the values of properties which are set to something besides the value given in DefaultValue.
H... |
269,026 | <p>How can I document a member inline in .Net? Let me explain. Most tools that extract documentation from comments support some kind of inline documentation where you can add a brief after the member declaration. Something like:</p>
<pre><code>public static string MyField; /// <summary>Information about MyField.... | [
{
"answer_id": 269038,
"author": "GeekyMonkey",
"author_id": 29900,
"author_profile": "https://Stackoverflow.com/users/29900",
"pm_score": 1,
"selected": false,
"text": "<p>Yep, just put it BEFORE the thing you want to comment</p>\n\n<pre><code>/// <summary>Information about MyFiel... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10688/"
] | How can I document a member inline in .Net? Let me explain. Most tools that extract documentation from comments support some kind of inline documentation where you can add a brief after the member declaration. Something like:
```
public static string MyField; /// <summary>Information about MyField.</summary>
```
Is ... | No, you can't. XML comments are only supported as a block level comment, meaning it must be placed before the code element you are documenting. The common tools for extracting XML comments from .NET code do not understand how to parse inline comments like that. If you need this ability you will need to write your own p... |
269,042 | <p>I´ve been looking for it yet in stackoverflow without success...</p>
<p>Is it posible a connection pooling in asp.net? Is it worthwhile? How?</p>
| [
{
"answer_id": 269056,
"author": "Dillie-O",
"author_id": 71,
"author_profile": "https://Stackoverflow.com/users/71",
"pm_score": 3,
"selected": true,
"text": "<p>It is actually really simple, simply add the following parameters to your connection string and (either in code or in the web... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34432/"
] | I´ve been looking for it yet in stackoverflow without success...
Is it posible a connection pooling in asp.net? Is it worthwhile? How? | It is actually really simple, simply add the following parameters to your connection string and (either in code or in the web.config) and ASP.NET will pick up the rest:
```
Min Pool Size=5; Max Pool Size=60; Connect Timeout=300;
```
*Note: The Connection Timeout is in seconds and is not required.* |
269,044 | <p><strong>Background:</strong> I have an HTML page which lets you expand certain content. As only small portions of the page need to be loaded for such an expansion, it's done via JavaScript, and not by directing to a new URL/ HTML page. However, as a bonus the user is able to permalink to such expanded sections, i.e.... | [
{
"answer_id": 269088,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 4,
"selected": false,
"text": "<p>Since you are controlling the action on the hash value, why not just use a token that means \"nothin... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34170/"
] | **Background:** I have an HTML page which lets you expand certain content. As only small portions of the page need to be loaded for such an expansion, it's done via JavaScript, and not by directing to a new URL/ HTML page. However, as a bonus the user is able to permalink to such expanded sections, i.e. send someone el... | As others have mentioned, [replaceState](https://developer.mozilla.org/en-US/docs/DOM/Manipulating_the_browser_history#The_replaceState%28%29.C2.A0method) in HTML5 can be used to remove the URL fragment.
Here is an example:
```
// remove fragment as much as it can go without adding an entry in browser history:
window... |
269,058 | <p>Lets say I have an array like this:</p>
<pre><code>string [] Filelist = ...
</code></pre>
<p>I want to create an Linq result where each entry has it's position in the array like this:</p>
<pre><code>var list = from f in Filelist
select new { Index = (something), Filename = f};
</code></pre>
<p>Index to be 0 ... | [
{
"answer_id": 269070,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 8,
"selected": true,
"text": "<p>Don't use a query expression. Use <a href=\"http://msdn.microsoft.com/en-us/library/bb534869.aspx\" rel=\"noreferrer\"... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28260/"
] | Lets say I have an array like this:
```
string [] Filelist = ...
```
I want to create an Linq result where each entry has it's position in the array like this:
```
var list = from f in Filelist
select new { Index = (something), Filename = f};
```
Index to be 0 for the 1st item, 1 for the 2nd, etc.
What shoul... | Don't use a query expression. Use [the overload of `Select` which passes you an index](http://msdn.microsoft.com/en-us/library/bb534869.aspx):
```
var list = FileList.Select((file, index) => new { Index=index, Filename=file });
``` |
269,060 | <p>I'm writing some mail-processing software in Python that is encountering strange bytes in header fields. I suspect this is just malformed mail; the message itself claims to be us-ascii, so I don't think there is a true encoding, but I'd like to get out a unicode string approximating the original one without throwin... | [
{
"answer_id": 269276,
"author": "jfs",
"author_id": 4279,
"author_profile": "https://Stackoverflow.com/users/4279",
"pm_score": 5,
"selected": false,
"text": "<p>+1 for the <a href=\"http://web.archive.org/web/20110709171259/http://chardet.feedparser.org/docs/faq.html\" rel=\"noreferrer... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5222/"
] | I'm writing some mail-processing software in Python that is encountering strange bytes in header fields. I suspect this is just malformed mail; the message itself claims to be us-ascii, so I don't think there is a true encoding, but I'd like to get out a unicode string approximating the original one without throwing a ... | As far as I can tell, the standard library doesn't have a function, though it's not too difficult to write one as suggested above. I think the real thing I was looking for was a way to decode a string and guarantee that it wouldn't throw an exception. The errors parameter to string.decode does that.
```
def decode(s, ... |
269,062 | <p>I want to use LabVIEW's Call Library Function Node to access a DLL function, and have this function return a string to displayed on my VI. How would I go about doing this? I am quite happy returning numbers from my DLL, but am really struggling to find any examples of how to return a string.</p>
| [
{
"answer_id": 269608,
"author": "Azim J",
"author_id": 4612,
"author_profile": "https://Stackoverflow.com/users/4612",
"pm_score": 3,
"selected": true,
"text": "<p>I assume from your question that you already have a DLL that can return numbers to Labview. To return a string from the DL... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1555/"
] | I want to use LabVIEW's Call Library Function Node to access a DLL function, and have this function return a string to displayed on my VI. How would I go about doing this? I am quite happy returning numbers from my DLL, but am really struggling to find any examples of how to return a string. | I assume from your question that you already have a DLL that can return numbers to Labview. To return a string from the DLL, I have created a DLL with the following C++ function
```
void returnString(char myString[])
{
const char *aString = "test string";
memcpy(myString, aString, 12);
}
```
In Labview I then us... |
269,063 | <p>After moving a project from .NET 1.1 to .NET 2.0, MsBuild emits lots of warnings for some COM objects.</p>
<p>Sample code for test (actual code doesn't matter, just used to create the warnings):</p>
<pre><code>using System;
using System.DirectoryServices;
using ActiveDs;
namespace Test
{
public class Class1
... | [
{
"answer_id": 1315018,
"author": "Joe Caffeine",
"author_id": 159770,
"author_profile": "https://Stackoverflow.com/users/159770",
"pm_score": -1,
"selected": false,
"text": "<p>You can stop the warnings with:</p>\n\n<pre>\n #pragma warning disable warning-list\n #pragma warning re... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23772/"
] | After moving a project from .NET 1.1 to .NET 2.0, MsBuild emits lots of warnings for some COM objects.
Sample code for test (actual code doesn't matter, just used to create the warnings):
```
using System;
using System.DirectoryServices;
using ActiveDs;
namespace Test
{
public class Class1
{
public st... | According to a comment in the [MDSN article about TLBIMP for 2.0](http://msdn.microsoft.com/en-us/library/tt0cf3sx(VS.80).aspx), you can't fix this problem w/o running TLBIMP yourself.
It was easy to reproduce your problem using VS. I also reproduced it running TLBIMP manually from a VS comment prompt:
```
tlbimp ... |
269,073 | <p>Is there a collection (BCL or other) that has the following characteristics:</p>
<p>Sends event if collection is changed AND sends event if any of the elements in the collection sends a <code>PropertyChanged</code> event. Sort of an <code>ObservableCollection<T></code> where <code>T: INotifyPropertyChanged</c... | [
{
"answer_id": 269113,
"author": "soren.enemaerke",
"author_id": 9222,
"author_profile": "https://Stackoverflow.com/users/9222",
"pm_score": 6,
"selected": true,
"text": "<p>Made a quick implementation myself:</p>\n\n<pre><code>public class ObservableCollectionEx<T> : ObservableCol... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9222/"
] | Is there a collection (BCL or other) that has the following characteristics:
Sends event if collection is changed AND sends event if any of the elements in the collection sends a `PropertyChanged` event. Sort of an `ObservableCollection<T>` where `T: INotifyPropertyChanged` and the collection is also monitoring the el... | Made a quick implementation myself:
```
public class ObservableCollectionEx<T> : ObservableCollection<T> where T : INotifyPropertyChanged
{
protected override void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
{
Unsubscribe(e.OldItems);
Subscribe(e.NewItems);
base.OnCollection... |
269,080 | <p>I am trying to write an interface between RSPEC (ruby flavoured BDD) and a Windows application. The application itself is written in an obscure language, but it has a C API to provide access. I've gone with Ruby/DL but am having difficulties getting even the most basic call to a DLL method to work. Here is what I... | [
{
"answer_id": 269645,
"author": "a2800276",
"author_id": 27408,
"author_profile": "https://Stackoverflow.com/users/27408",
"pm_score": 4,
"selected": true,
"text": "<p>The general consensus is you want to avoid DL as much as possible. The (english) documentation is quite sketchy and the... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32322/"
] | I am trying to write an interface between RSPEC (ruby flavoured BDD) and a Windows application. The application itself is written in an obscure language, but it has a C API to provide access. I've gone with Ruby/DL but am having difficulties getting even the most basic call to a DLL method to work. Here is what I have ... | The general consensus is you want to avoid DL as much as possible. The (english) documentation is quite sketchy and the interface is difficult to use for anything but trivial examples.
Ruby native C interface is MUCH easier to program against. Or you could use FFI, which fills a similiar niche to DL, originally comes ... |
269,081 | <pre><code>template <class M, class A> class C { std::list<M> m_List; ... }
</code></pre>
<p>Is the above code possible? I would like to be able to do something similar.</p>
<p>Why I ask is that i get the following error:</p>
<pre><code>Error 1 error C2079: 'std::_List_nod<_Ty,_Alloc>::_Node::_Myv... | [
{
"answer_id": 269095,
"author": "Harper Shelby",
"author_id": 21196,
"author_profile": "https://Stackoverflow.com/users/21196",
"pm_score": 2,
"selected": false,
"text": "<p>Yes. This is very common.</p>\n\n<p>As xtofl mentioned, a forward declaration of your parameter would cause a pro... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23528/"
] | ```
template <class M, class A> class C { std::list<M> m_List; ... }
```
Is the above code possible? I would like to be able to do something similar.
Why I ask is that i get the following error:
```
Error 1 error C2079: 'std::_List_nod<_Ty,_Alloc>::_Node::_Myval' uses undefined class 'M' C:\Program Files\Microsof... | My guess: you forward declared class M somewhere, and only declared it fully after the template instantiation.
My hint: give your formal template arguments a different name than the actual ones. (i.e. class M)
```
// template definition file
#include <list>
template< class aM, class aT >
class C {
std::list<M> m... |
269,093 | <p>I've a terrible memory. Whenever I do a CONNECT BY query in Oracle - and I do mean <em>every</em> time - I have to think hard and usually through trial and error work out on which argument the PRIOR should go.</p>
<p>I don't know why I don't remember - but I don't.</p>
<p>Does anyone have a handy memory mnemonic s... | [
{
"answer_id": 269122,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 2,
"selected": true,
"text": "<p>Think about the order in which the records are going to be selected: the link-back column on each record must match... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4003/"
] | I've a terrible memory. Whenever I do a CONNECT BY query in Oracle - and I do mean *every* time - I have to think hard and usually through trial and error work out on which argument the PRIOR should go.
I don't know why I don't remember - but I don't.
Does anyone have a handy memory mnemonic so I always remember ?
F... | Think about the order in which the records are going to be selected: the link-back column on each record must match the link-forward column on the PRIOR record selected. |
269,096 | <p>I'm trying to create a WSTransfer implementation (I realise Roman Kiss has written one already for WCF - but it doesn't actually meet the specifications)</p>
<p>I've ended up abandoning data contracts on the service contacts because WSTransfer is loosely coupled; so each the create message looks like Message Create... | [
{
"answer_id": 269122,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 2,
"selected": true,
"text": "<p>Think about the order in which the records are going to be selected: the link-back column on each record must match... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2525/"
] | I'm trying to create a WSTransfer implementation (I realise Roman Kiss has written one already for WCF - but it doesn't actually meet the specifications)
I've ended up abandoning data contracts on the service contacts because WSTransfer is loosely coupled; so each the create message looks like Message Create(Message r... | Think about the order in which the records are going to be selected: the link-back column on each record must match the link-forward column on the PRIOR record selected. |
269,101 | <p>I'm using the code below to save a password to the registry, how do I convert it back? The code below isn't mine but it encrypts well.</p>
<p>Thanks</p>
<pre><code>using System.Security.Cryptography;
public static string EncodePasswordToBase64(string password)
{ byte[] bytes = Encoding.Unicode.GetBytes(passwor... | [
{
"answer_id": 269114,
"author": "Lazarus",
"author_id": 19540,
"author_profile": "https://Stackoverflow.com/users/19540",
"pm_score": 3,
"selected": false,
"text": "<p>Take whatever the user enters as a password to gain access to the system, encrypt it the same way and then compare the ... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm using the code below to save a password to the registry, how do I convert it back? The code below isn't mine but it encrypts well.
Thanks
```
using System.Security.Cryptography;
public static string EncodePasswordToBase64(string password)
{ byte[] bytes = Encoding.Unicode.GetBytes(password);
byte[] dst ... | SHA1 is a *hash* algorithm, not an encryption algorithm. A hash algorithm is a one-way function which transforms data into a hash of that data, but the original data cannot be gotten back from the hash. An encryption algorithm is a two-way function which transforms data into encrypted data, and the encrypted data can t... |
269,124 | <p>I am reading a binary log file produced by a piece of equipment. </p>
<p>I have the data in a byte[]. </p>
<p>If I need to read two bytes to create a short I can do something like this:</p>
<pre><code>short value = (short)(byte[1] << 8);
value += byte[2];
</code></pre>
<p>Now I know the value is the corr... | [
{
"answer_id": 269142,
"author": "Grzenio",
"author_id": 5363,
"author_profile": "https://Stackoverflow.com/users/5363",
"pm_score": 1,
"selected": false,
"text": "<p>Did you try to use ushort (unsigned short)?</p>\n"
},
{
"answer_id": 269152,
"author": "Joe Corkery",
"au... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1048/"
] | I am reading a binary log file produced by a piece of equipment.
I have the data in a byte[].
If I need to read two bytes to create a short I can do something like this:
```
short value = (short)(byte[1] << 8);
value += byte[2];
```
Now I know the value is the correct for valid data.
How would I know if the fi... | `0xffff` (all bits equal to 1) is -1 for signed shorts, yes. Read up on [Two's complement](http://en.wikipedia.org/wiki/Two's_complement) to learn more about the details. You can switch to a larger datatype, or (as suggested by Grzenio) just use an unsigned type. |
269,164 | <p>I am looking for an elegant solution for removing content from an ASP.Net page if no data has been set. Let me explain this a little more.</p>
<p>I have some blocks of data on a page that contain some sub-sections with individual values in them. If no data has been set for one of the values I need to hide it (so it... | [
{
"answer_id": 269178,
"author": "DancesWithBamboo",
"author_id": 1334,
"author_profile": "https://Stackoverflow.com/users/1334",
"pm_score": 0,
"selected": false,
"text": "<p>Use recursion. Traverse the control tree in node first order. Use the visible property of the node as appropri... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11702/"
] | I am looking for an elegant solution for removing content from an ASP.Net page if no data has been set. Let me explain this a little more.
I have some blocks of data on a page that contain some sub-sections with individual values in them. If no data has been set for one of the values I need to hide it (so it does not ... | it may be possible to avoid recursive traversal if you can write functions to return true/false for each group, e.g.
```
<Panel id="block" runat="server" visible="<%=IsBlockVisible%>">
<Panel id="sub1" runat="server" visible="<%=IsSubVisible(1)%>">
<Panel id="value1-1">blah</Panel>
<Panel id="value... |
269,172 | <p>It appear that SQL Server like most other products Random Function really is not that random. So we have this nice little function to generate a 10 char value. Is there a better way to accomplish what the following does. I am betting there is.</p>
<pre><code>DECLARE @SaltCount INT;
SELECT @SaltCount = COUNT(*) F... | [
{
"answer_id": 269222,
"author": "Aleksandar",
"author_id": 29511,
"author_profile": "https://Stackoverflow.com/users/29511",
"pm_score": 1,
"selected": false,
"text": "<p>According to books-on-line for rand() function: If seed is not specified, the Microsoft SQL Server 2005 Database Eng... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24500/"
] | It appear that SQL Server like most other products Random Function really is not that random. So we have this nice little function to generate a 10 char value. Is there a better way to accomplish what the following does. I am betting there is.
```
DECLARE @SaltCount INT;
SELECT @SaltCount = COUNT(*) FROM tmp_NewLogin;... | Most programmers make a mistake of reinventing the randomization functionality and end up with something that is not random at all. I'd recommend you to stick with built-in RAND() function. Seed it once then fetch as many values as you need. |
269,193 | <p>I've got two ListBox'es that are databound to the same BindingList.</p>
<p>The issue is that when changing the selected item from the GUI it's changing the position in the BindingList and then the BindingList signals the other ListBox to change its selected item.</p>
<p>So I've got the two ListBoxes Selected Item ... | [
{
"answer_id": 270622,
"author": "tamberg",
"author_id": 3588,
"author_profile": "https://Stackoverflow.com/users/3588",
"pm_score": 2,
"selected": false,
"text": "<p>Declaring listBox1 and listBox2 to be of the following type seems to result in the desired behaviour.</p>\n\n<pre><code>c... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35139/"
] | I've got two ListBox'es that are databound to the same BindingList.
The issue is that when changing the selected item from the GUI it's changing the position in the BindingList and then the BindingList signals the other ListBox to change its selected item.
So I've got the two ListBoxes Selected Item also synchronized... | Add this line to `Form_Load`:
```
this.listBox1.BindingContext = new BindingContext();
``` |
269,207 | <p>I have implemented a SAX parser in Java by extending the default handler. The XML has a ñ in its content. When it hits this character it breaks. I print out the char array in the character method and it simply ends with the character before the ñ. The parser seems to stop after this as no other methods are called ev... | [
{
"answer_id": 269288,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 3,
"selected": true,
"text": "<p>What's the encoding on the file? Make sure the file's encoding decloration matches it. Your parser may be defaulting to as... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35140/"
] | I have implemented a SAX parser in Java by extending the default handler. The XML has a ñ in its content. When it hits this character it breaks. I print out the char array in the character method and it simply ends with the character before the ñ. The parser seems to stop after this as no other methods are called even ... | What's the encoding on the file? Make sure the file's encoding decloration matches it. Your parser may be defaulting to ascii or ISO-8859-1. You can set the encoding like so
```
<?xml version="1.0" encoding="UTF-8"?>
```
UTF-8 will cover that character, just make sure that's what the file actually is in. |
269,223 | <p>As I understand, the pimpl idiom is exists only because C++ forces you to place all the private class members in the header. If the header were to contain only the public interface, theoretically, any change in class implementation would not have necessitated a recompile for the rest of the program. </p>
<p>What I ... | [
{
"answer_id": 269239,
"author": "Luc Hermitte",
"author_id": 15934,
"author_profile": "https://Stackoverflow.com/users/15934",
"pm_score": 2,
"selected": false,
"text": "<p>May be because the size of the class is required when passing its instance by values, aggregating it in other clas... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32688/"
] | As I understand, the pimpl idiom is exists only because C++ forces you to place all the private class members in the header. If the header were to contain only the public interface, theoretically, any change in class implementation would not have necessitated a recompile for the rest of the program.
What I want to kn... | This has to do with the size of the object. The h file is used, among other things, to determine the size of the object. If the private members are not given in it, then you would not know how large an object to new.
You can simulate, however, your desired behavior by the following:
```
class MyClass
{
public:
// ... |
269,252 | <p>Is there an event for when a document is edited?
If not, does anyone know where I could find a list of the available VBA events?</p>
| [
{
"answer_id": 269323,
"author": "Fionnuala",
"author_id": 2548,
"author_profile": "https://Stackoverflow.com/users/2548",
"pm_score": 2,
"selected": false,
"text": "<p>Here are the events for the document object:</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/aa140279(offic... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5653/"
] | Is there an event for when a document is edited?
If not, does anyone know where I could find a list of the available VBA events? | Here are the events for the document object:
<http://msdn.microsoft.com/en-us/library/aa140279(office.10).aspx>
**Events**
```
DocumentBeforeClose : Immediately before any open document closes.
DocumentBeforePrint : Before any open document is printed.
DocumentBeforeSave : Before any open document is saved.
Docum... |
269,263 | <p>I have just been getting into low level programming (reading/writing to memory that sort of thing) and have run into an issue i cannot find an answer to.</p>
<p>The piece of information i want to read from has an address that is relative to a DLL loaded in memory e,g, it is at mydll.dll + 0x01234567. the problem im... | [
{
"answer_id": 269290,
"author": "Rob Walker",
"author_id": 3631,
"author_profile": "https://Stackoverflow.com/users/3631",
"pm_score": 1,
"selected": false,
"text": "<p>From a Win32 perspective you need to use the <a href=\"http://msdn.microsoft.com/en-us/library/ms683199(VS.85).aspx\" ... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35148/"
] | I have just been getting into low level programming (reading/writing to memory that sort of thing) and have run into an issue i cannot find an answer to.
The piece of information i want to read from has an address that is relative to a DLL loaded in memory e,g, it is at mydll.dll + 0x01234567. the problem im having is... | i tried the method Rob Walker suggested and could not get it to work (i think it did not work because the dll was loaded as part of another executable so it could not be found so easily).
I did however discover a solution that worked for me so here it is:
i created an object of type Process
```
String appToHookTo = ... |
269,267 | <p>Excel has a Conditional Formatting... option under the Format menu that allows you to change the style/color/font/whatever of a cell depending upon its value. But it only allows three conditions.</p>
<p>How do I get Excel to display say, six different background cell colors depending upon the value of the cell? (... | [
{
"answer_id": 269278,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 4,
"selected": true,
"text": "<p>You will need to write something in VBA.</p>\n\n<p>See example here: <a href=\"http://www.ozgrid.com/VBA/excel-condition... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35154/"
] | Excel has a Conditional Formatting... option under the Format menu that allows you to change the style/color/font/whatever of a cell depending upon its value. But it only allows three conditions.
How do I get Excel to display say, six different background cell colors depending upon the value of the cell? (IE Make the ... | You will need to write something in VBA.
See example here: [Get Around Excels 3 Criteria Limit in Conditional Formatting](http://www.ozgrid.com/VBA/excel-conditional-formatting-limit.htm):
```
Private Sub Worksheet_Change(ByVal Target As Range)
Dim icolor As Integer
If Not Intersect(Target, Range("A1:A10")) is ... |
269,285 | <p>I have this simple controller:</p>
<pre><code>public class OneController : Controller
{
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Create()
{
return View();
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(IList<TestModel> m)
{
return View(m);
}... | [
{
"answer_id": 269745,
"author": "Jeff Sheldon",
"author_id": 33910,
"author_profile": "https://Stackoverflow.com/users/33910",
"pm_score": 1,
"selected": false,
"text": "<p>Not sure I can answer without seeing more of the code and how your form is setup.\nBut, you could take a look at <... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7277/"
] | I have this simple controller:
```
public class OneController : Controller
{
[AcceptVerbs(HttpVerbs.Get)]
public ActionResult Create()
{
return View();
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Create(IList<TestModel> m)
{
return View(m);
}
}
```
And a very ... | I was already looking at that article, and found the bug I was having (subtle, yet critical).
If you render the hidden field with the index using Html.Hidden, the helper will "accumulate" the previous values, so you'll end up with a hidden saying index=1, and the next saying index=1,2.
Changing the helper call to a ma... |
269,308 | <p>I have the following autorun.inf</p>
<pre><code>[Autorun]
action="Blah, Inc."
open=marketing.exe
icon=blah.ico
label="Blah, Inc."
</code></pre>
<p>On Vista, the autorun dialog shows "Publisher not specified". How do I specify a publisher?</p>
| [
{
"answer_id": 269503,
"author": "Bogdan",
"author_id": 24022,
"author_profile": "https://Stackoverflow.com/users/24022",
"pm_score": 2,
"selected": false,
"text": "<p>You specify the publisher by signing your executable file, not by writing it in the autorun.inf file.</p>\n\n<p>How to d... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1490/"
] | I have the following autorun.inf
```
[Autorun]
action="Blah, Inc."
open=marketing.exe
icon=blah.ico
label="Blah, Inc."
```
On Vista, the autorun dialog shows "Publisher not specified". How do I specify a publisher? | Bogdan is right: You need to sign your executable.
You can use *SignTool* from Microsoft for this. Taken from the [MSDN](http://msdn.microsoft.com/en-us/library/aa387764.aspx):
>
> *SignTool tool is a command-line tool that digitally signs files, verifies signatures in files, or time stamps files. (...) The tool is i... |
269,326 | <p>I'm running Apache on Windows XP via Xampplite, and could use help configuring my virtual directory. Here's what I'm hoping to do on my dev box:</p>
<ol>
<li>I want my source files to live outside of the xampp htdocs dir</li>
<li>on my local machine I can access the project at <a href="http://myproject" rel="norefe... | [
{
"answer_id": 269378,
"author": "sprugman",
"author_id": 24197,
"author_profile": "https://Stackoverflow.com/users/24197",
"pm_score": 6,
"selected": true,
"text": "<p>Figured it out: use <strong>Alias</strong> for #3, instead of VirtualHost, thus:</p>\n\n<pre><code>Alias /myproject \"C... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24197/"
] | I'm running Apache on Windows XP via Xampplite, and could use help configuring my virtual directory. Here's what I'm hoping to do on my dev box:
1. I want my source files to live outside of the xampp htdocs dir
2. on my local machine I can access the project at <http://myproject>
3. others on my local network can acce... | Figured it out: use **Alias** for #3, instead of VirtualHost, thus:
```
Alias /myproject "C:/path/to/my/project"
<Directory "C:/path/to/my/project">
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
``` |
269,366 | <p>Until this morning, I have had Apache 2.0 running as a service using a local account which was configured with appropriate permissions. Sometime yesterday, someone must have changed something, and now Apache 2.0 won't start as a service under this account.</p>
<p>I made the account an Administrator temporarily, and... | [
{
"answer_id": 290764,
"author": "HitLikeAHammer",
"author_id": 35165,
"author_profile": "https://Stackoverflow.com/users/35165",
"pm_score": 3,
"selected": true,
"text": "<p>I have discovered the problem. After establishing the connection and the message listener the service went into ... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2273/"
] | Until this morning, I have had Apache 2.0 running as a service using a local account which was configured with appropriate permissions. Sometime yesterday, someone must have changed something, and now Apache 2.0 won't start as a service under this account.
I made the account an Administrator temporarily, and Apache 2.... | I have discovered the problem. After establishing the connection and the message listener the service went into a loop with Thread.Sleep(500). Dumb. I refactored the service to start everything up in OnStart and dispose of it in OnStop.
Since doing that, everything is running perfectly.
Classic ID-10-T error occurrin... |
269,367 | <p>I have a form which is used to <em>insert/display</em> and <em>update</em>. In the edit mode (<em>update</em>), when I pass my <code>BO</code> back to the Controller, what is the best possible way to check if any of the property values were changed, in order to execute the update to the datastore? </p>
<pre><code>t... | [
{
"answer_id": 269371,
"author": "vfilby",
"author_id": 24279,
"author_profile": "https://Stackoverflow.com/users/24279",
"pm_score": 3,
"selected": true,
"text": "<p>A good way is to have an IsDirty flag on the object and have all the setable properties update that flag if they are chan... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23667/"
] | I have a form which is used to *insert/display* and *update*. In the edit mode (*update*), when I pass my `BO` back to the Controller, what is the best possible way to check if any of the property values were changed, in order to execute the update to the datastore?
```
textbox1.text = CustomerController.GetCustomerI... | A good way is to have an IsDirty flag on the object and have all the setable properties update that flag if they are changed. Have the flag initialized to false when the object is loaded.
An example property would look like this:
```
public string Name {
get { return _name; }
set {
_name = value;
... |
269,373 | <p>I want to do something like this:</p>
<pre><code><MyTemplate>
<span><%# Container.Title %></span>
<MySubTemplate>
<span><%# Container.Username %></span>
</MySubTemplate>
</MyTemplate>
</code></pre>
<p>Assuming I have a list of Titles th... | [
{
"answer_id": 272940,
"author": "tsilb",
"author_id": 11112,
"author_profile": "https://Stackoverflow.com/users/11112",
"pm_score": 0,
"selected": false,
"text": "<p>You can do it this way. You can also use:</p>\n\n<ul>\n<li>Labels</li>\n<li>Span runat=\"server\" and add them programma... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18926/"
] | I want to do something like this:
```
<MyTemplate>
<span><%# Container.Title %></span>
<MySubTemplate>
<span><%# Container.Username %></span>
</MySubTemplate>
</MyTemplate>
```
Assuming I have a list of Titles that each have a list of Usernames.. If this is a correct approach how can I do this or ... | If you have a list of titles, that each have their own list of UserNames, it seems like you want to do something with nested repeaters (or other controls), not templates...
```
<asp:Repeater ID="rptTitle" runat="server" >
<ItemTemplate>
<%# Eval("Title") %>
<asp:Repeater ID="rptUser... |
269,384 | <p>I'm still getting used to the sizers in wxWidgets, and as such can't seem to make them do what I want.</p>
<p>I want a large panel that will contain a list of other panels/boxes, which each then contain a set of text fields</p>
<pre><code>----------------------
| label text box |
| label2 text box2 |
-------... | [
{
"answer_id": 269502,
"author": "Ralph",
"author_id": 23154,
"author_profile": "https://Stackoverflow.com/users/23154",
"pm_score": 2,
"selected": true,
"text": "<p>\"If theres too many to fit in the containing panel a vertical scroll bar is also required.\"</p>\n\n<p>You could have a l... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6266/"
] | I'm still getting used to the sizers in wxWidgets, and as such can't seem to make them do what I want.
I want a large panel that will contain a list of other panels/boxes, which each then contain a set of text fields
```
----------------------
| label text box |
| label2 text box2 |
----------------------
-----... | "If theres too many to fit in the containing panel a vertical scroll bar is also required."
You could have a look at wxScrolledWindow.
"additional added items are just a small box in the top left of the main panel"
I am not sure, but, maybe a call to wxSizer::Layout() will help.
"Also whats the best way to lay out ... |
269,390 | <p>At the moment I have setup a custom ok cancel dialog with a drop down in c#. The ok and cancel buttons use the DialogResult property so no code behind it. What I now need to do is validate the drop down to check it isn't left empty before posting back a dialogresult.</p>
<p>Is this possible?</p>
| [
{
"answer_id": 269396,
"author": "Burkhard",
"author_id": 12860,
"author_profile": "https://Stackoverflow.com/users/12860",
"pm_score": 3,
"selected": true,
"text": "<p>From <a href=\"http://www.functionx.com/vcsharp2003/Lesson06.htm\" rel=\"nofollow noreferrer\">here</a></p>\n\n<p>Doubl... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16989/"
] | At the moment I have setup a custom ok cancel dialog with a drop down in c#. The ok and cancel buttons use the DialogResult property so no code behind it. What I now need to do is validate the drop down to check it isn't left empty before posting back a dialogresult.
Is this possible? | From [here](http://www.functionx.com/vcsharp2003/Lesson06.htm)
Double-click the Closing field, and implement it as follows:
```
private void Second_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
// When the user attempts to close the form, don't close it...
e.Cancel = (dropdown.sel... |
269,402 | <p>I've been asked to add Google e-commerce tracking into my site. This tracking involves inserting some javascript on your receipt page and then calling it's functions. From my asp.net receipt page, I need to call one function (_addTrans) for the transaction info and then another (_addItem) for each item on the orde... | [
{
"answer_id": 269472,
"author": "stevemegson",
"author_id": 25028,
"author_profile": "https://Stackoverflow.com/users/25028",
"pm_score": 4,
"selected": true,
"text": "<p>Probably the easiest way is to build up the required Javascript as a string with something like </p>\n\n<pre><code>S... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3047/"
] | I've been asked to add Google e-commerce tracking into my site. This tracking involves inserting some javascript on your receipt page and then calling it's functions. From my asp.net receipt page, I need to call one function (\_addTrans) for the transaction info and then another (\_addItem) for each item on the order. ... | Probably the easiest way is to build up the required Javascript as a string with something like
```
StringBuilder sb = new StringBuilder()
sb.AppendLine( "<script>" );
sb.AppendLine( "var pageTracker = _gat._getTracker('UA-XXXXX-1');" );
sb.AppendLine( "pageTracker._trackPageview();" );
sb.AppendFormat( "pageTracker.... |
269,404 | <p>I have been reading about the differences between Table Variables and Temp Tables and stumbled upon the following issue with the Table Variable. I did not see this issue mentioned in the articles I pursued. </p>
<p>I pass in a series of PKs via a XML data type and successfully create the records in both temp table... | [
{
"answer_id": 269418,
"author": "TcKs",
"author_id": 20382,
"author_profile": "https://Stackoverflow.com/users/20382",
"pm_score": 0,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>CREATE PROCEDURE ExpenseReport_AssignApprover\n(\n @ExpenseReportIDs XML\... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30934/"
] | I have been reading about the differences between Table Variables and Temp Tables and stumbled upon the following issue with the Table Variable. I did not see this issue mentioned in the articles I pursued.
I pass in a series of PKs via a XML data type and successfully create the records in both temp table structures... | A quick test works when I literalize the table var reference in the last update:
```
UPDATE @ERTableVariable
SET ExpenseReportProjectID = (
SELECT TOP 1 ExpenseReportProjectID
FROM ExpenseReportItem
WHERE ExpenseReportID = [@ERTableVariable].ExpenseReportID
)
```
You could also... |
269,423 | <p><strong>Is there a tool to generate WiX XML given a .reg file?</strong></p>
<hr>
<p>In 2.0, you were supposed to be able to run tallow to generate registry XML:</p>
<pre><code>tallow -r my.reg
</code></pre>
<p>For what it's worth, the version of tallow I have is producing empty XML.</p>
<p>In 3.0, tallow has b... | [
{
"answer_id": 270442,
"author": "Adam Tegen",
"author_id": 4066,
"author_profile": "https://Stackoverflow.com/users/4066",
"pm_score": 5,
"selected": true,
"text": "<p>I couldn't find a tool, so I made one.</p>\n\n<p>The source code may not be elegant, but it seems to work:</p>\n\n<pre>... | 2008/11/06 | [
"https://Stackoverflow.com/questions/269423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4066/"
] | **Is there a tool to generate WiX XML given a .reg file?**
---
In 2.0, you were supposed to be able to run tallow to generate registry XML:
```
tallow -r my.reg
```
For what it's worth, the version of tallow I have is producing empty XML.
In 3.0, tallow has been replaced with heat, but I can't figure out how to ... | I couldn't find a tool, so I made one.
The source code may not be elegant, but it seems to work:
```
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Xml;
using System.Text.RegularExpressions;
namespace Reg2Wix
{
class Program
{
static void PrintUsage()... |