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 |
|---|---|---|---|---|---|---|
396,280 | <p>Starting to build web applications for mobile devices (any phone). <br/>
What would be the best approach using ASP.NET 3.5/ASP.NET 4.0 and C#?
<br/></p>
<p>UPDATE (feb2010) <br/>
Any news using windows mobile 7?<br/></p>
| [
{
"answer_id": 396366,
"author": "splattne",
"author_id": 6461,
"author_profile": "https://Stackoverflow.com/users/6461",
"pm_score": 5,
"selected": true,
"text": "<p>It depends if you really want to <strong>support every cell phone</strong> or only high end or new phone like the iPhone ... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49544/"
] | Starting to build web applications for mobile devices (any phone).
What would be the best approach using ASP.NET 3.5/ASP.NET 4.0 and C#?
UPDATE (feb2010)
Any news using windows mobile 7? | It depends if you really want to **support every cell phone** or only high end or new phone like the iPhone which don't have many limitations rendering web pages. If you could ask for real **HTML rendering, Javascript and cookies support on the phone as requirement**, then the real constraint is the **limited size of t... |
396,281 | <p>I'm fairly new to C# programming.</p>
<p>I am making a program for fun that adds two numbers together, than displays the sum in a message box. I have two numericUpDowns and a button on my form. When the button is pushed I want it to display a message box with the answer. </p>
<p>The problem is, I am unsure how to ... | [
{
"answer_id": 396290,
"author": "lc.",
"author_id": 44853,
"author_profile": "https://Stackoverflow.com/users/44853",
"pm_score": 4,
"selected": true,
"text": "<p><code>this.numericUpDown1.Value + this.numericUpDown2.Value</code> is actually evaluating properly to a number, so you're ac... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49549/"
] | I'm fairly new to C# programming.
I am making a program for fun that adds two numbers together, than displays the sum in a message box. I have two numericUpDowns and a button on my form. When the button is pushed I want it to display a message box with the answer.
The problem is, I am unsure how to add the twp value... | `this.numericUpDown1.Value + this.numericUpDown2.Value` is actually evaluating properly to a number, so you're actually very close. The problem is that the `MessageBox.Show()` function, needs a string as an argument, and you're giving it a number.
To convert the result to a string, add `.ToString()` to it. Like:
```... |
396,296 | <p>I need to find a path or paths down a complicated graph structure. The graph is built using something similar to this:</p>
<pre><code>class Node
{
public string Value { get; set;}
public List<Node> Nodes { get; set;}
public Node()
{
Nodes = new List<Node>();
}
}
</code></pr... | [
{
"answer_id": 396409,
"author": "Brann",
"author_id": 47341,
"author_profile": "https://Stackoverflow.com/users/47341",
"pm_score": 0,
"selected": false,
"text": "<p>I don't know exactly what you want to achieve, but this circular reference problem is usually solved by tagging already v... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42620/"
] | I need to find a path or paths down a complicated graph structure. The graph is built using something similar to this:
```
class Node
{
public string Value { get; set;}
public List<Node> Nodes { get; set;}
public Node()
{
Nodes = new List<Node>();
}
}
```
What makes this complicated is t... | If you're issue is related to Pathfinding, you may want to google for "A star" or "A\*".
Its a common and efficient pathfinding algorithm. See [this article](http://www.gamedev.net/reference/articles/article2003.asp) for an example directly related to your problem.
You may also want to look at the [Dijsktra Algorithm]... |
396,324 | <p>I am tying to make comments in a blog engine XSS-safe. Tried a lot of different approaches but find it very difficult.</p>
<p>When I am displaying the comments I am first using <a href="http://www.codeplex.com/AntiXSS" rel="nofollow noreferrer">Microsoft AntiXss 3.0</a> to html encode the whole thing. Then I am try... | [
{
"answer_id": 396349,
"author": "PEZ",
"author_id": 44639,
"author_profile": "https://Stackoverflow.com/users/44639",
"pm_score": 1,
"selected": false,
"text": "<p>Have you considered using Markdown or VBCode or some similar approaches for the users to mark their comments up with? Then ... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33349/"
] | I am tying to make comments in a blog engine XSS-safe. Tried a lot of different approaches but find it very difficult.
When I am displaying the comments I am first using [Microsoft AntiXss 3.0](http://www.codeplex.com/AntiXSS) to html encode the whole thing. Then I am trying to html decode the safe tags using a whitel... | Your problem is that C# is missinterpretating your regexp. You need to escape the #-sign. Without the escape it matches too much.
```
private static Regex _whitelist = new Regex(@"
^&\#60;(&\#47;)? (a|b(lockquote)?|code|em|h(1|2|3)|i|li|ol|p(re)?|s(ub|up|trong|trike)?|ul)&\#62;$
|^&\#60;(b|h)r\s?(&\#47;)?&\#6... |
396,327 | <p>The following code prints 20, i.e. sizeof(z) is 20.</p>
<pre><code>#include <iostream.h>
class Base
{
public:
int a;
};
class X:virtual public Base
{
public:
int x;
};
class Y:virtual public Base
{
public:
int y;
};
class Z:public X,public Y
{
};
int m... | [
{
"answer_id": 396331,
"author": "Ana Betts",
"author_id": 5728,
"author_profile": "https://Stackoverflow.com/users/5728",
"pm_score": 2,
"selected": false,
"text": "<p>The extra size is probably because of the extra VTables (<a href=\"http://en.wikipedia.org/wiki/Vtable\" rel=\"nofollow... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49560/"
] | The following code prints 20, i.e. sizeof(z) is 20.
```
#include <iostream.h>
class Base
{
public:
int a;
};
class X:virtual public Base
{
public:
int x;
};
class Y:virtual public Base
{
public:
int y;
};
class Z:public X,public Y
{
};
int main()
{
Z z;
cout <<... | Let's look at the class layout of the two cases.
Without the virtual, you have two base classes ("X" and "Y") with an integer each, and each of those classes have integrated into them a "Base" base class which also has an integer. That is 4 integers, 32-bits each, totalling your 16 bytes.
```
Offset Size Type Scop... |
396,337 | <p>Is there a framework that supports generating some standard unit tests from annotations? An example of what I have in mind would be:</p>
<pre><code>@HasPublicDefaultConstructor
public class Foo {
}
</code></pre>
<p>This would obviously be used to automatically generate a unit test that checks whether Foo has a de... | [
{
"answer_id": 396354,
"author": "Ray Tayek",
"author_id": 51292,
"author_profile": "https://Stackoverflow.com/users/51292",
"pm_score": 0,
"selected": false,
"text": "<p>this might be what you are looking for: <a href=\"http://developer.spikesource.com/wiki/index.php/Projects:testgen4j\... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46450/"
] | Is there a framework that supports generating some standard unit tests from annotations? An example of what I have in mind would be:
```
@HasPublicDefaultConstructor
public class Foo {
}
```
This would obviously be used to automatically generate a unit test that checks whether Foo has a default constructor. Am I th... | The question is whether "polluting" the production code with Unit Testing information in the form of additional annotations is really such a good idea.
Personally I'd vote against it. |
396,369 | <p>When an application crashes on Windows and a debugger such as Visual Studio is installed the following modal dialog appears:</p>
<blockquote>
<p>[Title: Microsoft Windows]</p>
<p>X has stopped working</p>
<p>A problem caused the program to stop
working correctly. Windows will close
the program and n... | [
{
"answer_id": 396387,
"author": "Stefan",
"author_id": 48003,
"author_profile": "https://Stackoverflow.com/users/48003",
"pm_score": 2,
"selected": false,
"text": "<p>You have to implement an unhandled exception filter which simply quits your application, then set that filter function w... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/322/"
] | When an application crashes on Windows and a debugger such as Visual Studio is installed the following modal dialog appears:
>
> [Title: Microsoft Windows]
>
>
> X has stopped working
>
>
> A problem caused the program to stop
> working correctly. Windows will close
> the program and notify you if a
> solution... | To force Windows Error Reporting (WER) to take a crash dump and close the app, instead of prompting you to debug the program, you can set these registry entries:
```
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting]
"ForceQueue"=dword:00000001
[HKEY_LOCAL_MA... |
396,385 | <p>I have a reference-type variable that is <code>readonly</code>, because the reference never change, only its properties. When I tried to add the <code>volatile</code> modifier to it the compiled warned me that it wouldn't let both modifiers apply to the same variable. But I think I need it to be volatile because I d... | [
{
"answer_id": 396389,
"author": "nbevans",
"author_id": 41475,
"author_profile": "https://Stackoverflow.com/users/41475",
"pm_score": 1,
"selected": false,
"text": "<p>A readonly field can only be written when the object is first constructed. Therefore there won't be any caching issue o... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48465/"
] | I have a reference-type variable that is `readonly`, because the reference never change, only its properties. When I tried to add the `volatile` modifier to it the compiled warned me that it wouldn't let both modifiers apply to the same variable. But I think I need it to be volatile because I don't want to have caching... | Neither the `readonly` nor `volatile` modifiers are penetrative. They apply to the reference itself, not the object's properties.
The `readonly` keyword asserts—and enforces—that a *variable* cannot change after initialization. The variable is the small chunk of memory where the reference is stored.
The `volatile` ke... |
396,391 | <p>It's quite some time that I'm trying to figure out this problem and from googling around many people have similar problems.</p>
<p>I'm trying to model a User in a Social Network, using Hibernate, and what is more basic to a social network than to map a friendship relation?
Every user in the system should have a lis... | [
{
"answer_id": 396401,
"author": "Ole",
"author_id": 49540,
"author_profile": "https://Stackoverflow.com/users/49540",
"pm_score": 1,
"selected": false,
"text": "<p>The <code>ManyToMany</code> annotation has a mappedBy parameter. I guess something like</p>\n\n<pre><code>@ManyToMany(mappe... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49561/"
] | It's quite some time that I'm trying to figure out this problem and from googling around many people have similar problems.
I'm trying to model a User in a Social Network, using Hibernate, and what is more basic to a social network than to map a friendship relation?
Every user in the system should have a list of it's ... | The fact about Many to Many is that it needs a little more configuration, because its imperative that Hibernate generates a relation table.
Try this:
```
@Entity
@Table(name="users")
public class User {
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
@Column(name="userid")
protected Long id = null;
@... |
396,394 | <p>When I reading source code of Beast, I found a lot of code like this:</p>
<pre><code><%= 'Password'[:password_title] %>
</code></pre>
<p>It seems like a call to [] method with Symbol as input parameter to a String to me, but I didn't find such type of parameter of String [] method in the ruby API. What is th... | [
{
"answer_id": 396419,
"author": "eric2323223",
"author_id": 44512,
"author_profile": "https://Stackoverflow.com/users/44512",
"pm_score": 1,
"selected": false,
"text": "<pre><code>str[fixnum] => fixnum or nil\nstr[fixnum, fixnum] => new_str or nil\nstr[range] => new_str or nil\... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44512/"
] | When I reading source code of Beast, I found a lot of code like this:
```
<%= 'Password'[:password_title] %>
```
It seems like a call to [] method with Symbol as input parameter to a String to me, but I didn't find such type of parameter of String [] method in the ruby API. What is this means?
thanks in advance. | It's a method added by the "Gibberish" plug-in Beast uses, for internationalization. Remember, classes in Ruby are open, so you can't always count on the standard API in cases like this! |
396,421 | <p>I'm checking if two strings <code>a</code> and <code>b</code> are permutations of each other, and I'm wondering what the ideal way to do this is in Python. From the Zen of Python, "There should be one -- and preferably only one -- obvious way to do it," but I see there are at least two ways:</p>
<pre><code>sorted(a... | [
{
"answer_id": 396430,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 3,
"selected": false,
"text": "<p>I think the first one is the \"obvious\" way. It is shorter, clearer, and likely to be faster in many cases beca... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49559/"
] | I'm checking if two strings `a` and `b` are permutations of each other, and I'm wondering what the ideal way to do this is in Python. From the Zen of Python, "There should be one -- and preferably only one -- obvious way to do it," but I see there are at least two ways:
```
sorted(a) == sorted(b)
```
and
```
all(a.... | heuristically you're probably better to split them off based on string size.
Pseudocode:
```
returnvalue = false
if len(a) == len(b)
if len(a) < threshold
returnvalue = (sorted(a) == sorted(b))
else
returnvalue = naminsmethod(a, b)
return returnvalue
```
If performance is critical, and string siz... |
396,425 | <p>I have a service that returns a collection of MyClass objects.
If all of the MyClass instances have null in MyClass2Reference then everything works fine.
Otherwise, I get a "Connection reset" error on the client side.
What am I doing wrong?</p>
<pre><code>[DataContract]
public MyClass
{
[DataMember]
int ID;
[DataMe... | [
{
"answer_id": 396430,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 3,
"selected": false,
"text": "<p>I think the first one is the \"obvious\" way. It is shorter, clearer, and likely to be faster in many cases beca... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19956/"
] | I have a service that returns a collection of MyClass objects.
If all of the MyClass instances have null in MyClass2Reference then everything works fine.
Otherwise, I get a "Connection reset" error on the client side.
What am I doing wrong?
```
[DataContract]
public MyClass
{
[DataMember]
int ID;
[DataMember]
MyClass2... | heuristically you're probably better to split them off based on string size.
Pseudocode:
```
returnvalue = false
if len(a) == len(b)
if len(a) < threshold
returnvalue = (sorted(a) == sorted(b))
else
returnvalue = naminsmethod(a, b)
return returnvalue
```
If performance is critical, and string siz... |
396,439 | <p>What is the cleanest way to align properly radio buttons / checkboxes with text? The only reliable solution which I have been using so far is table based:</p>
<pre><code><table>
<tr>
<td><input type="radio" name="opt"></td>
<td>Option 1</td>
</tr>
<tr>
... | [
{
"answer_id": 396476,
"author": "Keith Donegan",
"author_id": 37418,
"author_profile": "https://Stackoverflow.com/users/37418",
"pm_score": 3,
"selected": false,
"text": "<p>I wouldn't use tables for this at all. CSS can easily do this. </p>\n\n<p>I would do something like this:</p>\n\n... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15716/"
] | What is the cleanest way to align properly radio buttons / checkboxes with text? The only reliable solution which I have been using so far is table based:
```
<table>
<tr>
<td><input type="radio" name="opt"></td>
<td>Option 1</td>
</tr>
<tr>
<td><input type="radio" name="opt"></td>
<td>Option 2</td>
</... | I think I have finally solved the problem. One commonly recommended solution is to use vertical-align: middle:
```
<input type="radio" style="vertical-align: middle"> Label
```
The problem, however, is that this still produces visible misalignments even though it should theoretically work. The CSS2 specification say... |
396,449 | <p>I found the "always stop on error (dbstop if error)" to be very useful when I debug MATLAB code. <br>
However, closing matlab also resets it to "Never stop if error"</p>
<p>How can I make this setting persist?</p>
| [
{
"answer_id": 396464,
"author": "cschol",
"author_id": 2386,
"author_profile": "https://Stackoverflow.com/users/2386",
"pm_score": 3,
"selected": false,
"text": "<p>You could use the <em>startup.m</em> file to recreate your settings at startup. See <a href=\"http://www.mathworks.com/acc... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28772/"
] | I found the "always stop on error (dbstop if error)" to be very useful when I debug MATLAB code.
However, closing matlab also resets it to "Never stop if error"
How can I make this setting persist? | This is the solution indeed - further digging in Mathworks brought up the exact details:
In the default folder typing
```
edit startup.m
```
And then writing
```
dbstop if error
```
Thanks Schroeder! |
396,455 | <p>I am currently analyzing a wikipedia dump file; I am extracting a bunch of data from it using python and persisting it into a PostgreSQL db. I am always trying to make things go faster for this file is huge (18GB). In order to interface with PostgreSQL, I am using psycopg2, but this module seems to mimic many other ... | [
{
"answer_id": 396824,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 0,
"selected": false,
"text": "<p>\"When my script detects such a non-UNIQUE INSERT, it connection.rollback() (which makes ups to 1000 rows everytime, and... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am currently analyzing a wikipedia dump file; I am extracting a bunch of data from it using python and persisting it into a PostgreSQL db. I am always trying to make things go faster for this file is huge (18GB). In order to interface with PostgreSQL, I am using psycopg2, but this module seems to mimic many other suc... | just copy all the data into a scratch table with the psql \copy command, or use the psycopg cursor.copy\_in() method. Then:
```
insert into mytable
select * from (
select distinct *
from scratch
) uniq
where not exists (
select 1
from mytable
where mytable.mykey = uniq.mykey
);
```
This will d... |
396,463 | <p>I have a site with URLs like this:</p>
<pre><code>http://domain.co.uk/subdir/page.php
</code></pre>
<p>I have redesigned the site so URLs are now like this:</p>
<pre><code>http://domain.co.uk/page.php
</code></pre>
<p>How can I 301 redirect all the pages to their new locations using Apache's mod_rewrite?</p>
| [
{
"answer_id": 396477,
"author": "ceejayoz",
"author_id": 1902010,
"author_profile": "https://Stackoverflow.com/users/1902010",
"pm_score": 2,
"selected": false,
"text": "<p>Something like this should do the trick, I believe:</p>\n\n<pre><code>RewriteRule ^subdir/(.*)$ http://domain.co.u... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16511/"
] | I have a site with URLs like this:
```
http://domain.co.uk/subdir/page.php
```
I have redesigned the site so URLs are now like this:
```
http://domain.co.uk/page.php
```
How can I 301 redirect all the pages to their new locations using Apache's mod\_rewrite? | This should do the trick:
```
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^subdir/(.*)$ http://domain.co.uk/$1 [R=301,L]
</IfModule>
```
Update: Tested it, it works. |
396,480 | <p>I'm wondering if there is an existing class or library code in Cocoa Touch that shows the user a list of real-time suggestions while they are entering text input, with the suggestions based on similarities between what they have already entered and previous entries.</p>
<p>For instance, see how Safari on the iPod T... | [
{
"answer_id": 396477,
"author": "ceejayoz",
"author_id": 1902010,
"author_profile": "https://Stackoverflow.com/users/1902010",
"pm_score": 2,
"selected": false,
"text": "<p>Something like this should do the trick, I believe:</p>\n\n<pre><code>RewriteRule ^subdir/(.*)$ http://domain.co.u... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm wondering if there is an existing class or library code in Cocoa Touch that shows the user a list of real-time suggestions while they are entering text input, with the suggestions based on similarities between what they have already entered and previous entries.
For instance, see how Safari on the iPod Touch shows... | This should do the trick:
```
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^subdir/(.*)$ http://domain.co.uk/$1 [R=301,L]
</IfModule>
```
Update: Tested it, it works. |
396,513 | <p>As I've been incorporating the Linq mindset, I have been more and more inclined to pass around collections via the <code>IEnumerable<T></code> generic type which seems to form the basis of most Linq operations.</p>
<p>However I wonder, with the late evaluation of the <code>IEnumerable<T></code> generic ... | [
{
"answer_id": 396541,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 2,
"selected": false,
"text": "<p>Output types should be as specific as possible, input types should be as loose as possible.</p>\n\n<p>So return <c... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] | As I've been incorporating the Linq mindset, I have been more and more inclined to pass around collections via the `IEnumerable<T>` generic type which seems to form the basis of most Linq operations.
However I wonder, with the late evaluation of the `IEnumerable<T>` generic type if that is a good idea. Does it make mo... | I went through a phase of passing around `T[]`, and to cut a long story short, it's a pain in the backside. `IEnumerable<T>` is much better
>
> *However I wonder, with the late evaluation of the IEnumerable generic type if that is a good idea. Does it make more sense to use the T[] generic type? IList? Or something e... |
396,519 | <p>I'm working on a program that uses PHP's internal array pointers to iterate along a multidimensional array. I need to get an element from the current row, and I've been doing it like so:</p>
<pre><code>$arr[key($arr)]['item']
</code></pre>
<p>However, I'd much prefer to use something like:</p>
<pre><code>current(... | [
{
"answer_id": 396532,
"author": "Adam Wright",
"author_id": 1200,
"author_profile": "https://Stackoverflow.com/users/1200",
"pm_score": 5,
"selected": true,
"text": "<p>I very much doubt there is such a function, but it's trivial to write</p>\n\n<pre><code>function getvalue($array, $key... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/658/"
] | I'm working on a program that uses PHP's internal array pointers to iterate along a multidimensional array. I need to get an element from the current row, and I've been doing it like so:
```
$arr[key($arr)]['item']
```
However, I'd much prefer to use something like:
```
current($arr)['item'] // invalid syntax
```
... | I very much doubt there is such a function, but it's trivial to write
```
function getvalue($array, $key)
{
return $array[$key];
}
```
Edit: As of PHP 5.4, you can index array elements directly from function expressions, `current($arr)['item']`. |
396,521 | <pre><code>int z = 1;
double result = Math.Log(z); //works
</code></pre>
<p>However trying to do the same thing with an array of numbers doesn't work:</p>
<pre><code>int[] z = new [] {1,2,3,4};
double[] result = Math.Log(z); //Syntax 1 - error CS1503: Argument '1': cannot convert from 'int[]' to... | [
{
"answer_id": 396534,
"author": "user21826",
"author_id": 21826,
"author_profile": "https://Stackoverflow.com/users/21826",
"pm_score": -1,
"selected": false,
"text": "<p>Not quite sure what you're asking, but...</p>\n\n<p>You could provide an index into the array.</p>\n\n<pre><code>\nf... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396521",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
int z = 1;
double result = Math.Log(z); //works
```
However trying to do the same thing with an array of numbers doesn't work:
```
int[] z = new [] {1,2,3,4};
double[] result = Math.Log(z); //Syntax 1 - error CS1503: Argument '1': cannot convert from 'int[]' to 'double'
double[] result = z.... | No, there is not a cleaner way. The **Syntax 2** use of `Select()` and a lambda expression to apply `Math.Log()` to each element is the idiomatic way of of doing this in C#. |
396,557 | <p>Using a few different patterns but they each come up with this error - so what's wrong?</p>
<p>My shortest one to diagnose is:</p>
<pre><code>$pattern = "<img([^>]*[^/])>";
preg_match_all($pattern, $subject, $matches);
</code></pre>
<p>Thanks</p>
| [
{
"answer_id": 396563,
"author": "PEZ",
"author_id": 44639,
"author_profile": "https://Stackoverflow.com/users/44639",
"pm_score": 4,
"selected": false,
"text": "<p>You are lacking the regexp delimiters. Try:</p>\n\n<pre><code>$pattern = \"#<img([^>]*[^/])>#i\";\n</code></pre>\n... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396557",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Using a few different patterns but they each come up with this error - so what's wrong?
My shortest one to diagnose is:
```
$pattern = "<img([^>]*[^/])>";
preg_match_all($pattern, $subject, $matches);
```
Thanks | You are lacking the regexp delimiters. Try:
```
$pattern = "#<img([^>]*[^/])>#i";
``` |
396,579 | <p>I'm trying to create a randomized maze in C++, but I can't start because I don't know how to create grids or cells. How could I create it? And I also want to create it using ASCII characters. how can i store it in array? (can any one give a sample code and some explanation so i can understand it better)</p>
<p>Anot... | [
{
"answer_id": 396600,
"author": "ShreevatsaR",
"author_id": 4958,
"author_profile": "https://Stackoverflow.com/users/4958",
"pm_score": 3,
"selected": false,
"text": "<p>Are you looking for <a href=\"http://en.wikipedia.org/wiki/Maze_generation_algorithm\" rel=\"noreferrer\">Maze genera... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49609/"
] | I'm trying to create a randomized maze in C++, but I can't start because I don't know how to create grids or cells. How could I create it? And I also want to create it using ASCII characters. how can i store it in array? (can any one give a sample code and some explanation so i can understand it better)
Another questi... | You probably want to store your maze in a 2-dimension char array. You can declare an array with or without initializing it in C++.
```
char a[30][10]; // declares a char array of 30 rows and 10 columns.
// declare an array with 3 rows and 3 columns, and provide initial values
char ticTacToeBoard[3][3] = {{'x', 'x', ... |
396,586 | <p>I am looking for a XSL snippet that simply returns the XML unaltered. It sounds trivial but I can't seem to find an example anywhere on the web. Any help out there? </p>
| [
{
"answer_id": 396595,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 0,
"selected": false,
"text": "<p>How about:</p>\n\n<pre><code><xsl:template match =\"/\">\n <xsl:copy-of select=\".\"/>\n</xsl:templa... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49611/"
] | I am looking for a XSL snippet that simply returns the XML unaltered. It sounds trivial but I can't seem to find an example anywhere on the web. Any help out there? | In order to copy the complete XML document, it is necessary to have a template that matches the root. This might be:
**`<xsl:template match="/">`**
or
**`<xsl:template match="node()">`**
Then a single copying of the current node (the root node) is just sufficient:
**`<xsl:copy-of` select="."/>**
So... |
396,594 | <p>Is there any way to force PHP to blow up (error, whatever) if I misspell a variable name? What about if I'm using an instance of a class and I spell the name of a variable wrong?</p>
<p>[I know that I should just get used to it, but maybe there's a way to enforce name checking?] </p>
<p>Thanks!</p>
<p><strong>Edi... | [
{
"answer_id": 396604,
"author": "Ryan Doherty",
"author_id": 956,
"author_profile": "https://Stackoverflow.com/users/956",
"pm_score": 1,
"selected": false,
"text": "<p>You can use this in your code:</p>\n\n<pre><code>error_reporting(E_ALL);\n</code></pre>\n\n<p>or this in php.ini</p>\n... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8047/"
] | Is there any way to force PHP to blow up (error, whatever) if I misspell a variable name? What about if I'm using an instance of a class and I spell the name of a variable wrong?
[I know that I should just get used to it, but maybe there's a way to enforce name checking?]
Thanks!
**Edit:** Sorry, that wasn't very s... | Here is something I whipped up really quickly to show how you can trigger errors when something like that happens:
```
<?php
error_reporting( E_ALL | E_STRICT );
class Joe {
public $lastName;
public function __set( $name, $value ) {
if ( !property_exists( $this, $name ) ) {
trigger_error... |
396,610 | <p>I have a DateTime which I want to store in a Date MySQL column. I am using MySQLi and prepared statements. </p>
<p>When binding parameters, I cannot specify date as a type, only strings and integers.</p>
<p>How do I convert the DateTime to a MySQL date string representation? There is very little documentation on t... | [
{
"answer_id": 396628,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 3,
"selected": true,
"text": "<p>I almost closed this as a duplicate of <a href=\"https://stackoverflow.com/questions/136782/format-mysql-datetime-wi... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a DateTime which I want to store in a Date MySQL column. I am using MySQLi and prepared statements.
When binding parameters, I cannot specify date as a type, only strings and integers.
How do I convert the DateTime to a MySQL date string representation? There is very little documentation on the DateTime class... | I almost closed this as a duplicate of [Convert from MySQL datetime to another format with PHP](https://stackoverflow.com/questions/136782/format-mysql-datetime-with-php) but I think it's actually the reverse problem. That question asked how to format a date fetched from MySQL, and you're asking how to format a date fo... |
396,620 | <p>I'm wondering if there is an equivalent function to PHP's <code>call_user_func()</code> in ASP.NET application. I'm looking to do a conversion from a PHP application to ASP.NET as a means of teaching myself the language, by taking a CMS I built professionally and trying to recreate it in this other language.</p>
<p... | [
{
"answer_id": 396653,
"author": "Oli",
"author_id": 12870,
"author_profile": "https://Stackoverflow.com/users/12870",
"pm_score": 0,
"selected": false,
"text": "<p>To the .NET devs, this is basically a method of calling a method from a given name (as a string). </p>\n\n<p>To the OP: (I ... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41654/"
] | I'm wondering if there is an equivalent function to PHP's `call_user_func()` in ASP.NET application. I'm looking to do a conversion from a PHP application to ASP.NET as a means of teaching myself the language, by taking a CMS I built professionally and trying to recreate it in this other language.
The reason I need a ... | In .NET I would probably create some events and handle them. Here's one way of doing it:
```
public class CMS
public Event DoSomethingHook(byval sender as Object, byval e as DoSomethingEventArgs)
public function DoSomething()
dim data() as Integer = {}
Dim e as new DoSomethingEventArgs();
... |
396,621 | <p>I'm trying to combine a number of <code>List<T> where T:IGetTime</code> (i.e <code>T</code> will always have method <code>getTime()</code>).</p>
<p>Then I'm trying order the items by the <code>DateTime</code> that <code>getTime()</code> returns. </p>
<p>My LINQ looks like this:</p>
<pre><code>public static ... | [
{
"answer_id": 396629,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 6,
"selected": true,
"text": "<p>You've got three lists here - what <em>exactly</em> are you trying to order by?</p>\n\n<p>Your cast is incorrect too -... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5648/"
] | I'm trying to combine a number of `List<T> where T:IGetTime` (i.e `T` will always have method `getTime()`).
Then I'm trying order the items by the `DateTime` that `getTime()` returns.
My LINQ looks like this:
```
public static List<T> Combine(List<T> one, List<T> two, List<T> three)
{
var result = from ... | You've got three lists here - what *exactly* are you trying to order by?
Your cast is incorrect too - the result will be an `IEnumerable<X>` where `X` is an anonymous type with three `T`s in.
If the idea is really to *concatenate* the three lists and then sort, you want:
```
return one.Concat(two)
.Concat(... |
396,644 | <p>I'm interested in using something other than the <strong>C</strong> preprocessor to preprocess my <strong>C</strong> and Objective-C source code. Are there good alternatives?</p>
<p>An example would be something that allowed one to escape out into a python or perl snippet in the middle of <strong>C</strong> code, ... | [
{
"answer_id": 396645,
"author": "David Poole",
"author_id": 39766,
"author_profile": "https://Stackoverflow.com/users/39766",
"pm_score": 3,
"selected": false,
"text": "<p>You might want to consider m4.<br />\n<a href=\"http://www.gnu.org/software/m4/\" rel=\"noreferrer\">http://www.gnu... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17320/"
] | I'm interested in using something other than the **C** preprocessor to preprocess my **C** and Objective-C source code. Are there good alternatives?
An example would be something that allowed one to escape out into a python or perl snippet in the middle of **C** code, and where the snippet spit out **C** that is then ... | You can use **PHP** as a C preprocessor. The advantages are:
* very similiar syntax, so syntax highlighting works.
* `<?` and `?>` are not used in standard C (with non-standard C, the only thing that gets broken is old GCC extension operator that returns min/max)
* it's rich in libraries.
* it's turing complete.
* usa... |
396,663 | <p>For testing purposes I need my ABAP program to wait for few seconds. How can this be done?</p>
| [
{
"answer_id": 396903,
"author": "Esti",
"author_id": 25687,
"author_profile": "https://Stackoverflow.com/users/25687",
"pm_score": 6,
"selected": true,
"text": "<p>2 solutions:</p>\n\n<p>1) Either use <a href=\"https://help.sap.com/doc/abapdocu_753_index_htm/7.53/en-US/index.htm?file=ab... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25737/"
] | For testing purposes I need my ABAP program to wait for few seconds. How can this be done? | 2 solutions:
1) Either use [WAIT UP TO ... SECONDS](https://help.sap.com/doc/abapdocu_753_index_htm/7.53/en-US/index.htm?file=abapwait_up_to.htm).
```
WAIT UP TO 42 SECONDS.
WAIT UP TO '0.5' SECONDS. " decimals are possible since ABAP 7.40 SP 8
```
* Does a roll-out and releases the work process to the listener
* D... |
396,674 | <p>I'm working on a WordPress template and need to add a hyperlink to the cartoon bubble at the top of the page. The bubble, as far as I can tell, is php. Where do I insert the href?</p>
<pre><code><h1><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1>... | [
{
"answer_id": 396681,
"author": "Patryk Kordylewski",
"author_id": 30927,
"author_profile": "https://Stackoverflow.com/users/30927",
"pm_score": 1,
"selected": false,
"text": "<p>Don't you have to echo the return values of the function?</p>\n\n<pre><code><h1><a href=\"<?php ... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39781/"
] | I'm working on a WordPress template and need to add a hyperlink to the cartoon bubble at the top of the page. The bubble, as far as I can tell, is php. Where do I insert the href?
```
<h1><a href="<?php bloginfo('url'); ?>/"><?php bloginfo('name'); ?></a></h1>
```
The href should point to [www.ojaivalleynews.com](ht... | rashneon, look for the following HTML (search header.php for 'bubble')
```
<div id="bubble">
<p>Click for OVN Homepage!</p>
</div>
```
replace that with
```
<div id="bubble">
<p><a href="http://www.ojaivalleynews.com/">Click for OVN Homepage!</a></p>
</div>
```
@Endlessdeath - no, delightfully WordPress mixes... |
396,706 | <p>Is it ok to do the following:</p>
<pre><code>View(new {Object A, Object B})
</code></pre>
<p>Or should Object A and Object B be explicitly declared in a new type?</p>
<p>Thanks.</p>
| [
{
"answer_id": 396715,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": true,
"text": "<p>Although anonymous types are versatile for many MVC purposes, in this case I would use a regular named class, or at... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49632/"
] | Is it ok to do the following:
```
View(new {Object A, Object B})
```
Or should Object A and Object B be explicitly declared in a new type?
Thanks. | Although anonymous types are versatile for many MVC purposes, in this case I would use a regular named class, or at a push a dictionary (or the inbuilt one). Otherwise you will have to use reflection / `TypeDescriptor` to get the values out again. |
396,748 | <p>I am wondering if there is away (possibly a better way) to order by the order of the values in an IN() clause.</p>
<p>The problem is that I have 2 queries, one that gets all of the IDs and the second that retrieves all the information. The first creates the order of the IDs which I want the second to order by. The ... | [
{
"answer_id": 396758,
"author": "chaos",
"author_id": 47529,
"author_profile": "https://Stackoverflow.com/users/47529",
"pm_score": 1,
"selected": false,
"text": "<p>Give this a shot:</p>\n\n<pre><code>SELECT name, description, ...\nWHERE id IN\n (SELECT id FROM table1 WHERE...)\nORD... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5441/"
] | I am wondering if there is away (possibly a better way) to order by the order of the values in an IN() clause.
The problem is that I have 2 queries, one that gets all of the IDs and the second that retrieves all the information. The first creates the order of the IDs which I want the second to order by. The IDs are pu... | Use MySQL's [`FIELD()`](http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_field) function:
```
SELECT name, description, ...
FROM ...
WHERE id IN([ids, any order])
ORDER BY FIELD(id, [ids in order])
```
`FIELD()` will return the index of the first parameter that is equal to the first parameter (o... |
396,756 | <p>I'm creating an API for a module and after I created several methods inside my classes, I asked myself this question.</p>
<p>Right now, and as an example, I'm doing this:</p>
<pre><code>public Company GetMonitoredCompany( String companyName ) { ... }
public List<Company> GetMonitoredCompanies( ) { ... }
</co... | [
{
"answer_id": 396763,
"author": "starec",
"author_id": 19727,
"author_profile": "https://Stackoverflow.com/users/19727",
"pm_score": 1,
"selected": false,
"text": "<p>It's up to you. But I recommend you to have the same convention for whole project...\nI prefer the first way (GetMonitor... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28004/"
] | I'm creating an API for a module and after I created several methods inside my classes, I asked myself this question.
Right now, and as an example, I'm doing this:
```
public Company GetMonitoredCompany( String companyName ) { ... }
public List<Company> GetMonitoredCompanies( ) { ... }
```
But I realize that for se... | Use the shortest, simplest name that clearly shows the methods purpose.
And be consistent within your project.
In this example, if there are no other considerations, I would use the name:
>
> GetMonitoredCompanies
>
>
>
Because it's shorter and clearer.
(I would also return a read-only ICollection or IEnumerabl... |
396,806 | <p>There has to be something utterly simple I'm overlooking here, but for the life of me I can't get a JavaScript file to include properly from my master page. My declaration in the <code><head></code> element looks normal enough:</p>
<pre><code><head runat="server">
<title>Untitled Page</tit... | [
{
"answer_id": 396812,
"author": "seanb",
"author_id": 3354,
"author_profile": "https://Stackoverflow.com/users/3354",
"pm_score": 2,
"selected": true,
"text": "<p>If you are running this inside of Visual Studio, chances are the link won't work. By default, VS serves up sites as somethin... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15609/"
] | There has to be something utterly simple I'm overlooking here, but for the life of me I can't get a JavaScript file to include properly from my master page. My declaration in the `<head>` element looks normal enough:
```
<head runat="server">
<title>Untitled Page</title>
<script type="text/javascript" src="/_p... | If you are running this inside of Visual Studio, chances are the link won't work. By default, VS serves up sites as something like <http://localhost:3456/projectname/>... so /\_private won't actualy be at the root.
You can change this in the properties on the project/solution, or use some other approaches to rewrite ... |
396,848 | <p>Okay so I started with <a href="https://stackoverflow.com/questions/391991/for-each-not-working-properly-in-vba-code">a question</a> and have made a lot of changes to the code based on suggestions from this site and others so I figured I should create a new question.</p>
<p>Even though my code is shorter and more e... | [
{
"answer_id": 396890,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 1,
"selected": false,
"text": "<p>Is the form in question bound to a datasource? This is the most common way that Access would be used, and if it wer... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428190/"
] | Okay so I started with [a question](https://stackoverflow.com/questions/391991/for-each-not-working-properly-in-vba-code) and have made a lot of changes to the code based on suggestions from this site and others so I figured I should create a new question.
Even though my code is shorter and more efficient the same pro... | Is the form in question bound to a datasource? This is the most common way that Access would be used, and if it were you probbaly wouldn't need to update via SQL.
Form\_BeforeUpdate() is usually used when a form is bound to a datasource. You wouldn't normally use this event to determine if controls' values have change... |
396,849 | <p>I have an interop assembly generated by TlbImp.exe, the generated classes are heavily evented and the performance is very important.</p>
<p>But there's a problem, the events seem to be registered/unregistered/invoked in such a manner that even empty event handlers are counted in.
Given a set of <strong>1..N</strong... | [
{
"answer_id": 396890,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 1,
"selected": false,
"text": "<p>Is the form in question bound to a datasource? This is the most common way that Access would be used, and if it wer... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15409/"
] | I have an interop assembly generated by TlbImp.exe, the generated classes are heavily evented and the performance is very important.
But there's a problem, the events seem to be registered/unregistered/invoked in such a manner that even empty event handlers are counted in.
Given a set of **1..N** events, when you regi... | Is the form in question bound to a datasource? This is the most common way that Access would be used, and if it were you probbaly wouldn't need to update via SQL.
Form\_BeforeUpdate() is usually used when a form is bound to a datasource. You wouldn't normally use this event to determine if controls' values have change... |
396,856 | <p>I don't understand how classes are used. The following code gives me an error when I try to use the class.</p>
<pre><code>class MyStuff:
def average(a, b, c): # Get the average of three numbers
result = a + b + c
result = result / 3
return result
# Now use the function `average` from th... | [
{
"answer_id": 396871,
"author": "Ryan",
"author_id": 49139,
"author_profile": "https://Stackoverflow.com/users/49139",
"pm_score": 7,
"selected": true,
"text": "<p>You can instantiate the class by declaring a variable and calling the class as if it were a function:</p>\n\n<pre><code>x =... | 2008/12/28 | [
"https://Stackoverflow.com/questions/396856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12386/"
] | I don't understand how classes are used. The following code gives me an error when I try to use the class.
```
class MyStuff:
def average(a, b, c): # Get the average of three numbers
result = a + b + c
result = result / 3
return result
# Now use the function `average` from the `MyStuff` cl... | You can instantiate the class by declaring a variable and calling the class as if it were a function:
```
x = mystuff()
print x.average(9,18,27)
```
However, this won't work with the code you gave us. When you call a class method on a given object (x), it always passes a pointer to the object as the first parameter ... |
396,913 | <p>If I have a certain week number (eg 51) and a given year (eg 2008), how do I find the date of the first Monday of that same week?</p>
<p>Many thanks</p>
| [
{
"answer_id": 396926,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 6,
"selected": true,
"text": "<pre><code>>>> import time\n>>> time.asctime(time.strptime('2008 50 1', '%Y %W %w'))\n'Mon Dec 15 0... | 2008/12/29 | [
"https://Stackoverflow.com/questions/396913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143732/"
] | If I have a certain week number (eg 51) and a given year (eg 2008), how do I find the date of the first Monday of that same week?
Many thanks | ```
>>> import time
>>> time.asctime(time.strptime('2008 50 1', '%Y %W %w'))
'Mon Dec 15 00:00:00 2008'
```
Assuming the first day of your week is Monday, use `%U` instead of `%W` if the first day of your week is Sunday. See the documentation for [strptime](http://docs.python.org/library/time.html#time.strptime) for ... |
396,930 | <p>It would appear that CHM help files are no longer the help file format of choice.</p>
<p>WinHelp<br>
- obsolete</p>
<p>HtmlHelp (CHM)<br>
- not supported on Vista by default<br>
- does not work well on a network share</p>
<p>Help 2 (HXS)<br>
- I understand this is used in VS2005+ for displaying help</p>
<p>W... | [
{
"answer_id": 396939,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 3,
"selected": false,
"text": "<pre><code>this.Mode = Modes.Rant;\n</code></pre>\n<p>There are tremendous problems with almost all the help file for... | 2008/12/29 | [
"https://Stackoverflow.com/questions/396930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48499/"
] | It would appear that CHM help files are no longer the help file format of choice.
WinHelp
- obsolete
HtmlHelp (CHM)
- not supported on Vista by default
- does not work well on a network share
Help 2 (HXS)
- I understand this is used in VS2005+ for displaying help
Web Based
- Could be hard to man... | ```
this.Mode = Modes.Rant;
```
There are tremendous problems with almost all the help file formats because the makers (typically Microsoft for quite a few of them) doesn't seem to want to do a job more than just *slightly* good enough for their own use.
I can't tell you how many times the new HXS format has complet... |
396,933 | <p>I need some mind reading here, since I am trying to do what I do not completely understand.</p>
<p>There is a 32-bit application (electronic trading application called CQG) which provides a COM API for external access. I have sample programs and scripts which access this API from Excel, .NET (C++, VB and C#) and s... | [
{
"answer_id": 396999,
"author": "Rob Walker",
"author_id": 3631,
"author_profile": "https://Stackoverflow.com/users/3631",
"pm_score": 0,
"selected": false,
"text": "<p>A couple of useful things you could try:</p>\n\n<ol>\n<li><p>Run <a href=\"http://technet.microsoft.com/en-us/sysinter... | 2008/12/29 | [
"https://Stackoverflow.com/questions/396933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49678/"
] | I need some mind reading here, since I am trying to do what I do not completely understand.
There is a 32-bit application (electronic trading application called CQG) which provides a COM API for external access. I have sample programs and scripts which access this API from Excel, .NET (C++, VB and C#) and shell VBScri... | There are a number of things you have to remember with a 64 bit machine. These are some things that have caught me out in the past.
1. Building for Any CPU in [.NET](http://en.wikipedia.org/wiki/.NET_Framework) means
it will run as 64 bit on a 64 bit
machine.
2. Lots of COM components
seem to be 32 bit only (I know th... |
396,973 | <p>I'm developing a web-based, turn-based strategy game which takes place on a 10x10 board.</p>
<p>Each tile represents an area of land and has its own set of statistics (eg, income, population, fertility, natural resources).</p>
<p>Each time the client loads it will download all of the information for the game (ie, ... | [
{
"answer_id": 396977,
"author": "WW.",
"author_id": 14663,
"author_profile": "https://Stackoverflow.com/users/14663",
"pm_score": 0,
"selected": false,
"text": "<p>I would create a table where each row represents a single tile in the game.</p>\n\n<p>Then, I would have a column for X (fr... | 2008/12/29 | [
"https://Stackoverflow.com/questions/396973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm developing a web-based, turn-based strategy game which takes place on a 10x10 board.
Each tile represents an area of land and has its own set of statistics (eg, income, population, fertility, natural resources).
Each time the client loads it will download all of the information for the game (ie, loading the stats... | This exact question was asked on the #django IRC channel a while ago, although the asker wanted a variable sized game board for different screens.
The overall recommendation was to go with a nice, clean, normalized method first and optimize to a denormalized state if performance issues are encountered. The main reason... |
397,019 | <p>I am not sure what the problem is but I keep receiving this error when I try to use a while statement in my code.</p>
<blockquote>
<p>Invalid token 'while' in class,
struct, or interface member
declaration</p>
</blockquote>
<p>I want to use a while loop to have something continuously update while a statement... | [
{
"answer_id": 397024,
"author": "stu",
"author_id": 12386,
"author_profile": "https://Stackoverflow.com/users/12386",
"pm_score": 2,
"selected": false,
"text": "<p>There's nothing wrong with the while, it's something above it that's the problem.\nCheck for mismatched braces and semicolo... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49549/"
] | I am not sure what the problem is but I keep receiving this error when I try to use a while statement in my code.
>
> Invalid token 'while' in class,
> struct, or interface member
> declaration
>
>
>
I want to use a while loop to have something continuously update while a statement is true.
The rest of my code... | Based on the error, it sounds like the compiler thinks this code is typed directly in the body of a class/struct/interface declaration. Statements while/if/for/etc ... must appear with in a method.
Try moving this code into a method to fix the problem. If it's in a method, you likely have a mismatched brace problem. |
397,034 | <p>So I was writing up a simple binary tree in Python and came across [...]</p>
<p>I don't believe this to be related to the Ellipsis object, more it seems to have something to do with an infinity loop (due to Python's shallow copy?). The source of this infinity loop and why it doesn't get expanded while expanding whe... | [
{
"answer_id": 397047,
"author": "Jarred McCaffrey",
"author_id": 45410,
"author_profile": "https://Stackoverflow.com/users/45410",
"pm_score": 2,
"selected": false,
"text": "<p>EDIT: As mentioned above, this isn't the Ellipsis object, but the result of a looped list. I jumped the gun h... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40172/"
] | So I was writing up a simple binary tree in Python and came across [...]
I don't believe this to be related to the Ellipsis object, more it seems to have something to do with an infinity loop (due to Python's shallow copy?). The source of this infinity loop and why it doesn't get expanded while expanding when accessed... | It can also appear if you have a circular structure with a list pointing to itself. Like this:
```
>>> a = [1,2]
>>> a.append(a)
>>> a
[1, 2, [...]]
>>>
```
Since python can't print out the structure (it would be an infinite loop) it uses the ellipsis to show that there is recursion in the structure.
---
I'm not ... |
397,052 | <p>I'm writing some functional tests for a controller in rails, using mocha to do mocking/stubbing. </p>
<p>Is there a way to prevent the template from being rendered during the test, so that I can test only the code in the controller?</p>
<p>It looks like rspec provides something like this, but I'm not using rspec.<... | [
{
"answer_id": 397188,
"author": "J Cooper",
"author_id": 38803,
"author_profile": "https://Stackoverflow.com/users/38803",
"pm_score": 0,
"selected": false,
"text": "<p>Would <a href=\"http://api.rubyonrails.org/classes/ActionController/Base.html#M000513\" rel=\"nofollow noreferrer\"><c... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37708/"
] | I'm writing some functional tests for a controller in rails, using mocha to do mocking/stubbing.
Is there a way to prevent the template from being rendered during the test, so that I can test only the code in the controller?
It looks like rspec provides something like this, but I'm not using rspec. | The most obvious solution seems to work:
```
@controller.expects(:render)
```
I could have sworn that I tried that last night with no luck. But this morning it works like a charm. I must have overlooked a typo. |
397,064 | <p>Imagine I am doing something like this:</p>
<pre><code>void *p = malloc (1000);
*((char*)p) = some_opcode;
*((char*)p+1) = another_opcode; // for the sake of the example: the opcodes are ok
....
etc...
</code></pre>
<p>How can I define a function pointer to call p as if it was a function? (i'm using VC++ 2008 exp... | [
{
"answer_id": 397066,
"author": "Eclipse",
"author_id": 8701,
"author_profile": "https://Stackoverflow.com/users/8701",
"pm_score": 3,
"selected": false,
"text": "<p>If you have the right opcodes in place, calling can be as simple as casting to a function pointer and calling it.</p>\n\n... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49710/"
] | Imagine I am doing something like this:
```
void *p = malloc (1000);
*((char*)p) = some_opcode;
*((char*)p+1) = another_opcode; // for the sake of the example: the opcodes are ok
....
etc...
```
How can I define a function pointer to call p as if it was a function? (i'm using VC++ 2008 express).
Thanks | A comment wasn't enough space. Joe\_Muc is correct. You should not stuff code into memory obtained by `malloc` or `new`. You will run into problems if you change the page properties of pages that Windows allocates.
This isn't a problem becuase using VirtualAlloc() and the related WIn32 APIs is every easy: call [Virtua... |
397,075 | <p>In C and C++, what is the difference between <code>exit()</code> and <code>abort()</code>? I am trying to end my program after an error (not an exception).</p>
| [
{
"answer_id": 397079,
"author": "Brian R. Bondy",
"author_id": 3153,
"author_profile": "https://Stackoverflow.com/users/3153",
"pm_score": 5,
"selected": false,
"text": "<p><strong>abort</strong> sends a SIGABRT signal, <strong>exit</strong> just closes the application performing normal... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In C and C++, what is the difference between `exit()` and `abort()`? I am trying to end my program after an error (not an exception). | [`abort()`](http://en.cppreference.com/w/c/program/abort) exits your program without calling functions registered using [`atexit()`](http://en.cppreference.com/w/c/program/atexit) first, and without calling objects' destructors first. [`exit()`](http://en.cppreference.com/w/c/program/exit) does both before exiting your... |
397,085 | <p>I have a problem with CDATA deserialization using standard .Net XmlSerializer.</p>
<p><strong>Update</strong>: I get XML from external system and I can't influence it's format so I can't make CData be enclosed in a separate Element of Attribute.</p>
<p>Serialization gives this:</p>
<pre><code><?xml version="1.... | [
{
"answer_id": 397462,
"author": "oefe",
"author_id": 49793,
"author_profile": "https://Stackoverflow.com/users/49793",
"pm_score": 4,
"selected": true,
"text": "<p>The CData property ends up null, because the content of the CDATA section ends up in the Data property, where it is being i... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1423922/"
] | I have a problem with CDATA deserialization using standard .Net XmlSerializer.
**Update**: I get XML from external system and I can't influence it's format so I can't make CData be enclosed in a separate Element of Attribute.
Serialization gives this:
```
<?xml version="1.0" encoding="utf-16"?>
<MyClass xmlns:xsi="h... | The CData property ends up null, because the content of the CDATA section ends up in the Data property, where it is being ignored...
```
<MyClass><![CDATA[Hello, world!]]></MyClass>
```
is absolutely equivalent to:
```
<MyClass>Hello, world!</MyClass>
```
You shouldn't care whether the external app writes the con... |
397,113 | <p>We have a user provided string that may contain unicode characters, and we want the robot to type that string.</p>
<p>How do you convert a string into keyCodes that the robot will use?<br>
How do you do it so it is also java version independant (1.3 -> 1.6)?</p>
<p>What we have working for "ascii" chars is</p>
<p... | [
{
"answer_id": 397152,
"author": "javamonkey79",
"author_id": 27657,
"author_profile": "https://Stackoverflow.com/users/27657",
"pm_score": 2,
"selected": false,
"text": "<p>The <a href=\"http://java.sun.com/j2se/1.5.0/docs/api/java/awt/event/KeyEvent.html\" rel=\"nofollow noreferrer\">K... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37558/"
] | We have a user provided string that may contain unicode characters, and we want the robot to type that string.
How do you convert a string into keyCodes that the robot will use?
How do you do it so it is also java version independant (1.3 -> 1.6)?
What we have working for "ascii" chars is
```
//char c = nextChar(... | Based on javamonkey79's code I've created the following snippet which should work for all Unicode values...
```
public static void pressUnicode(Robot r, int key_code)
{
r.keyPress(KeyEvent.VK_ALT);
for(int i = 3; i >= 0; --i)
{
// extracts a single decade of the key-code and adds
// an off... |
397,117 | <p>I have a window with a title on it. When the user selects a choice from a drop down list, the title image can change. The problem is when the image loads, it's a blurred, stretched, and pixelated. These are PNG files I'm working with and they look good prior to setting the source dynamically.</p>
<p>Here's the code... | [
{
"answer_id": 397217,
"author": "Jobi Joy",
"author_id": 8091,
"author_profile": "https://Stackoverflow.com/users/8091",
"pm_score": 2,
"selected": false,
"text": "<p>Try Stretch=\"UniformToFill\" on the Image</p>\n"
},
{
"answer_id": 397345,
"author": "Nir",
"author_id"... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22451/"
] | I have a window with a title on it. When the user selects a choice from a drop down list, the title image can change. The problem is when the image loads, it's a blurred, stretched, and pixelated. These are PNG files I'm working with and they look good prior to setting the source dynamically.
Here's the code I'm using... | I can think of two things:
First, try loading the image with:
```
string strUri2 = String.Format(@"pack://application:,,,/MyAseemby;component/resources/main titles/{0}", CurrenSelection.TitleImage);
imgTitle.Source = new BitmapImage(new Uri(strUri2));
```
Maybe the problem is with WinForm's image resizing, if the i... |
397,125 | <p>I'm trying to read the target file/directory of a shortcut (<code>.lnk</code>) file from Python. Is there a headache-free way to do it? The spec is way over my head.
I don't mind using Windows-only APIs.</p>
<p>My ultimate goal is to find the <code>"(My) Videos"</code> folder on Windows XP and Vista. On XP... | [
{
"answer_id": 397137,
"author": "gak",
"author_id": 11125,
"author_profile": "https://Stackoverflow.com/users/11125",
"pm_score": 3,
"selected": false,
"text": "<p>Basically call the Windows API directly. Here is a good example found after Googling:</p>\n\n<pre><code>import os, sys\nimp... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109696/"
] | I'm trying to read the target file/directory of a shortcut (`.lnk`) file from Python. Is there a headache-free way to do it? The spec is way over my head.
I don't mind using Windows-only APIs.
My ultimate goal is to find the `"(My) Videos"` folder on Windows XP and Vista. On XP, by default, it's at `%HOMEPATH%\My Docu... | **Create a shortcut using Python (via WSH)**
```
import sys
import win32com.client
shell = win32com.client.Dispatch("WScript.Shell")
shortcut = shell.CreateShortCut("t:\\test.lnk")
shortcut.Targetpath = "t:\\ftemp"
shortcut.save()
```
**Read the Target of a Shortcut using Python (via WSH)**
```
import sys
import ... |
397,128 | <p>I wrote a device controller (rs232) and it is being used successfully, however users want to view data and control the device (or perhaps communicate through my program) from Excel. I dismissed DDE as an option and found that RTD (IRtdServer) is probably a good start (though no way to send data back to the "server"... | [
{
"answer_id": 397137,
"author": "gak",
"author_id": 11125,
"author_profile": "https://Stackoverflow.com/users/11125",
"pm_score": 3,
"selected": false,
"text": "<p>Basically call the Windows API directly. Here is a good example found after Googling:</p>\n\n<pre><code>import os, sys\nimp... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10755/"
] | I wrote a device controller (rs232) and it is being used successfully, however users want to view data and control the device (or perhaps communicate through my program) from Excel. I dismissed DDE as an option and found that RTD (IRtdServer) is probably a good start (though no way to send data back to the "server" fro... | **Create a shortcut using Python (via WSH)**
```
import sys
import win32com.client
shell = win32com.client.Dispatch("WScript.Shell")
shortcut = shell.CreateShortCut("t:\\test.lnk")
shortcut.Targetpath = "t:\\ftemp"
shortcut.save()
```
**Read the Target of a Shortcut using Python (via WSH)**
```
import sys
import ... |
397,142 | <p>I have a class called User with static function loginRequired(), which returns false if the user is logged in and true if the user is logged out. It also appends an error to an error class that I created that tells the person using the site that they must be logged in to view the content.</p>
<p>The idea is that fo... | [
{
"answer_id": 397163,
"author": "Brian Fisher",
"author_id": 43816,
"author_profile": "https://Stackoverflow.com/users/43816",
"pm_score": 3,
"selected": false,
"text": "<p>I'm not sure you can do exactly what you want, however, you might want to look at using <a href=\"http://us2.php.n... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29595/"
] | I have a class called User with static function loginRequired(), which returns false if the user is logged in and true if the user is logged out. It also appends an error to an error class that I created that tells the person using the site that they must be logged in to view the content.
The idea is that for the top ... | The way I've seen a number of open source apps handle this is by having a `require_login()` function which performs a redirect should the user not be logged in. |
397,148 | <p>OK, I'm aware that triple-quotes strings can serve as multiline comments. For example,</p>
<pre><code>"""Hello, I am a
multiline comment"""
</code></pre>
<p>and </p>
<pre><code>'''Hello, I am a
multiline comment'''
</code></pre>
<p>But technically speaking these are strings, correct?</p>
<p>I've googled... | [
{
"answer_id": 397159,
"author": "Jarred McCaffrey",
"author_id": 45410,
"author_profile": "https://Stackoverflow.com/users/45410",
"pm_score": 5,
"selected": false,
"text": "<p>This likely goes back to the core concept that there should be one obvious way to do a task. Additional comme... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24059/"
] | OK, I'm aware that triple-quotes strings can serve as multiline comments. For example,
```
"""Hello, I am a
multiline comment"""
```
and
```
'''Hello, I am a
multiline comment'''
```
But technically speaking these are strings, correct?
I've googled and read the Python style guide, but I was unable to fi... | I doubt you'll get a better answer than, "Guido didn't feel the need for multi-line comments".
Guido has [tweeted](https://twitter.com/gvanrossum/status/112670605505077248) about this:
>
> Python tip: You can use multi-line strings as multi-line comments. Unless used as docstrings, they generate no code! :-)
>
>
... |
397,153 | <p>I have a these structures definitions</p>
<pre><code>typedef struct my_s {
int x;
int y;
} my_T;
typedef struct your_s {
my_T * x;
} your_T;
your_T array[MAX_COL][MAX_ROW];
</code></pre>
<p>To initialize the array's pointer to NULL, can I do:</p>
<pre><code>memset (array, 0, sizeof(array))
</code></pr... | [
{
"answer_id": 397162,
"author": "rampion",
"author_id": 9859,
"author_profile": "https://Stackoverflow.com/users/9859",
"pm_score": 2,
"selected": false,
"text": "<p>easiest is</p>\n\n<pre><code>your_T array[MAX_COL][MAX_ROW] = {{{0}}};\n</code></pre>\n"
},
{
"answer_id": 397166... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a these structures definitions
```
typedef struct my_s {
int x;
int y;
} my_T;
typedef struct your_s {
my_T * x;
} your_T;
your_T array[MAX_COL][MAX_ROW];
```
To initialize the array's pointer to NULL, can I do:
```
memset (array, 0, sizeof(array))
```
this does not look right to me. | easiest is
```
your_T array[MAX_COL][MAX_ROW] = {{{0}}};
``` |
397,184 | <p>I am trying to use jCarousel plugin for jQuery in order to provide my website users with scrollable (horizontal) content.</p>
<p>The content I am mentioning is basically user defined <code><li></code> elements, styled so that they have a feel and look of a tab. so basically I am trying to achieve the same eff... | [
{
"answer_id": 397276,
"author": "Soviut",
"author_id": 46914,
"author_profile": "https://Stackoverflow.com/users/46914",
"pm_score": 0,
"selected": false,
"text": "<p>From what I can tell, you're trying make JCarousel do something it was never designed to do. Based on what I read on th... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49742/"
] | I am trying to use jCarousel plugin for jQuery in order to provide my website users with scrollable (horizontal) content.
The content I am mentioning is basically user defined `<li>` elements, styled so that they have a feel and look of a tab. so basically I am trying to achieve the same effect of the tabs in pageflak... | The closest thing to what you want is probably [jscrollhorizontalpane](http://plugins.jquery.com/project/jscrollhorizontalpane). I've never used it so I can't vouch for it's effectiveness as a solution to this specific problem.
This sort of widget shouldn't be to hard to make if you want to attempt it. I'll break down... |
397,185 | <p>I need to enable the <a href="http://au2.php.net/manual/en/book.mcrypt.php" rel="noreferrer">mcrypt</a> functions on my website, except I'm on a shared host (running linux) and obviously don't have access to the <code>php.ini</code> file. There does seem to be options for installing PEAR modules but a search told me... | [
{
"answer_id": 397207,
"author": "UnkwnTech",
"author_id": 115,
"author_profile": "https://Stackoverflow.com/users/115",
"pm_score": 3,
"selected": true,
"text": "<p>The MCrypt Sourceforge page should have it\n<a href=\"http://mcrypt.sourceforge.net/\" rel=\"nofollow noreferrer\">http://... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | I need to enable the [mcrypt](http://au2.php.net/manual/en/book.mcrypt.php) functions on my website, except I'm on a shared host (running linux) and obviously don't have access to the `php.ini` file. There does seem to be options for installing PEAR modules but a search told me mcrypt wasn't available. Is there any way... | The MCrypt Sourceforge page should have it
<http://mcrypt.sourceforge.net/>
To compile it just:
```
wget http://superb-east.dl.sourceforge.net/sourceforge/mcrypt/libmcrypt-2.5.8.tar.gz
tar -xzvf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8
./configure
make
sudo make install
```
EDIT:
Can you reference it with a dire... |
397,250 | <p>The list of valid XML characters is well known, as defined by the spec it's:</p>
<pre><code>#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
</code></pre>
<p>My question is whether or not it's possible to make a PCRE regular expression for this (or its inverse) without actually hard-coding th... | [
{
"answer_id": 397285,
"author": "some",
"author_id": 36866,
"author_profile": "https://Stackoverflow.com/users/36866",
"pm_score": 3,
"selected": false,
"text": "<p>For systems that internally stores the codepoints in <a href=\"http://en.wikipedia.org/wiki/Utf-16\" rel=\"noreferrer\">UT... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23845/"
] | The list of valid XML characters is well known, as defined by the spec it's:
```
#x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
```
My question is whether or not it's possible to make a PCRE regular expression for this (or its inverse) without actually hard-coding the codepoints, by using Uni... | I know this isn't exactly an answer to your question, but it's helpful to have it here:
Regular Expression to match **valid** XML Characters:
```
[\u0009\u000a\u000d\u0020-\uD7FF\uE000-\uFFFD]
```
So to remove **invalid** chars from XML, you'd do something like
```
// filters control characters but allows only pro... |
397,253 | <p>I need to pull large Unicode textual strings (e.g. 200Mb) from a Database (nvarchar) and store in memory for processing. i.e. I need random access to all parts of the strings.</p>
<p>Looking at this from strictly memory centric point of view, what are the pro’s and con’s of using a System.IO.MemoryStream versus a S... | [
{
"answer_id": 397388,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": true,
"text": "<blockquote>\n <p>Looking at this from strictly memory centric point of view, what are the pro’s and con’s of using a System.I... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46100/"
] | I need to pull large Unicode textual strings (e.g. 200Mb) from a Database (nvarchar) and store in memory for processing. i.e. I need random access to all parts of the strings.
Looking at this from strictly memory centric point of view, what are the pro’s and con’s of using a System.IO.MemoryStream versus a System.Stri... | >
> Looking at this from strictly memory centric point of view, what are the pro’s and con’s of using a System.IO.MemoryStream versus a System.String as my in memory representation.
>
>
> Some factors I am trying to research are:
>
>
> * How these objects act in a [hypothetical] highly fragmented low memory enviro... |
397,257 | <p>I have a WPF listbox which displays messages. It contains an avatar on the left side and the username and message stacked vertically to the right of the avatar. The layout is fine until the message text should word wrap, but instead I get a horizontal scroll bar on the listbox. </p>
<p>I've Googled and found soluti... | [
{
"answer_id": 397277,
"author": "Martin Moser",
"author_id": 24756,
"author_profile": "https://Stackoverflow.com/users/24756",
"pm_score": 3,
"selected": false,
"text": "<p>The problem might not be located in the ListBox. The TextBlock won't wrap, if one of the parent controls provides ... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/100/"
] | I have a WPF listbox which displays messages. It contains an avatar on the left side and the username and message stacked vertically to the right of the avatar. The layout is fine until the message text should word wrap, but instead I get a horizontal scroll bar on the listbox.
I've Googled and found solutions to sim... | Contents of the `TextBlock` can be wrapped using property `TextWrapping`.
Instead of `StackPanel`, use `DockPanel`/`Grid`.
One more thing - set `ScrollViewer.HorizontalScrollBarVisibility` property to `Disabled` value for the `ListBox`.
Updated `Hidden` to `Disabled` based on comment from Matt. Thanks Matt. |
397,263 | <p>I'm used to doing Java programming, where you never really have to think about pointers when programming. However, at the moment I'm writing a program in C++. When making classes that have members of other classes, when should I use pointers and when should I not? For example, when would I want to do this:</p>
<pre... | [
{
"answer_id": 397266,
"author": "PolyThinker",
"author_id": 47707,
"author_profile": "https://Stackoverflow.com/users/47707",
"pm_score": 1,
"selected": false,
"text": "<p>Both are OK under different conditions. For example, if you know how to construct b when an object of class Foo is ... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm used to doing Java programming, where you never really have to think about pointers when programming. However, at the moment I'm writing a program in C++. When making classes that have members of other classes, when should I use pointers and when should I not? For example, when would I want to do this:
```
class F... | Start by avoiding pointers.
Use them when:
* You want to use the [Pimpl idiom](http://en.wikipedia.org/wiki/Opaque_pointer), or an [abstract factory](http://en.wikipedia.org/wiki/Abstract_factory_pattern).
* The `Bar` instance is actually managed by some other part of your program, whereas the `Foo` class just needs ... |
397,293 | <p>I'm looking for a high performance method or library for scanning all files on disk or in a given directory and grabbing their basic stats - filename, size, and modification date. </p>
<p>I've written a python program that uses <code>os.walk</code> along with <code>os.path.getsize</code> to get the file list, and i... | [
{
"answer_id": 397305,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>The os.path module has a directory tree walking function as well. I've never run any sort of benchmarks on it, but you coul... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397293",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13055/"
] | I'm looking for a high performance method or library for scanning all files on disk or in a given directory and grabbing their basic stats - filename, size, and modification date.
I've written a python program that uses `os.walk` along with `os.path.getsize` to get the file list, and it works fine, but is not particu... | Well, I would expect this to be heavily I/O bound task.
As such, optimizations on python side would be quite ineffective; the only optimization I could think of is some different way of accessing/listing files, in order to reduce the actual read from the file system.
This of course requires a deep knowledge of the file... |
397,301 | <p>I was reading <a href="https://stackoverflow.com/questions/392397/arrays-whats-the-point">this post</a> the other night about the inner workings of the Array, and learned a lot from the answers posted, especially from <a href="https://stackoverflow.com/questions/392397/arrays-whats-the-point#392426">Jonathan Holland... | [
{
"answer_id": 397310,
"author": "Kim Stebel",
"author_id": 46450,
"author_profile": "https://Stackoverflow.com/users/46450",
"pm_score": 2,
"selected": false,
"text": "<p>Arrays in Javascript are \"fake\". They are implemented as hash maps. So in the worst case their access time is not ... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44084/"
] | I was reading [this post](https://stackoverflow.com/questions/392397/arrays-whats-the-point) the other night about the inner workings of the Array, and learned a lot from the answers posted, especially from [Jonathan Holland](https://stackoverflow.com/questions/392397/arrays-whats-the-point#392426)'s one.
So the reaso... | Arrays in Javascript are "fake". They are implemented as hash maps. So in the worst case their access time is not O(1). They also need more memory and you can use any string as an array index. You think that's weird? It is. |
397,320 | <p>I am having a frame-based webpage with 3 frames. A topliner, a navigation on the left side and a content frame on the bottom right side.</p>
<p>Now, I want to show up a popup-menu when the user right-clicks on the content-frame. Because a div-container can not go out of the frame, my idea was, placing the whole fra... | [
{
"answer_id": 399917,
"author": "Soviut",
"author_id": 46914,
"author_profile": "https://Stackoverflow.com/users/46914",
"pm_score": 0,
"selected": false,
"text": "<p>I would strongly recommend switching your frameset to a standard DIV layout using css. Here is a good starting point fo... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49772/"
] | I am having a frame-based webpage with 3 frames. A topliner, a navigation on the left side and a content frame on the bottom right side.
Now, I want to show up a popup-menu when the user right-clicks on the content-frame. Because a div-container can not go out of the frame, my idea was, placing the whole frame-page in... | If you are only planning to support IE - you can try using a new modal window by calling window.showModalDialog.
You can position the new window anywhere on the screen.
There are many drawbacks to using a new window in general and a modal one at that...
By the way - FF 3 and up also [supports window.showModalDialog]... |
397,337 | <p>I develop tools in Autodesk Maya. Many of the tools I build have simple windowed GUIs for the animators and modellers to use. These GUIs often contain what you'd normally expect to see in any basic window; labels, lists, menus, buttons, textfields, etc. However, there are limitations to the complexity of the UIs ... | [
{
"answer_id": 398469,
"author": "Ole",
"author_id": 49540,
"author_profile": "https://Stackoverflow.com/users/49540",
"pm_score": 0,
"selected": false,
"text": "<p>I don't know if there is a way around a mainloop for the gui, since it is needed to handle all event chains and redraw queu... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46914/"
] | I develop tools in Autodesk Maya. Many of the tools I build have simple windowed GUIs for the animators and modellers to use. These GUIs often contain what you'd normally expect to see in any basic window; labels, lists, menus, buttons, textfields, etc. However, there are limitations to the complexity of the UIs you ca... | I'm not sure if this is germane, but some googling turns up that PyQt is pretty popular inside of Maya. You could try the technique [here](http://www.highend3d.com/boards/lofiversion/index.php/t236041.html) or [here](http://www.highend3d.com/boards/index.php?showtopic=242116) (explained [here](http://groups.google.com/... |
397,341 | <p>I'm reading through "A Gentle Introduction to Haskell," and early on it uses this example, which works fine in GHC and horribly in my brain:</p>
<pre><code>initial = 0
next resp = resp
process req = req+1
reqs = client initial resps
resps ... | [
{
"answer_id": 397352,
"author": "Jon",
"author_id": 25111,
"author_profile": "https://Stackoverflow.com/users/25111",
"pm_score": 2,
"selected": false,
"text": "<p>It's been a while since I've played with Haskell, but I'm pretty sure that it's lazily evaluated, meaning it only calculate... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38803/"
] | I'm reading through "A Gentle Introduction to Haskell," and early on it uses this example, which works fine in GHC and horribly in my brain:
```
initial = 0
next resp = resp
process req = req+1
reqs = client initial resps
resps = server re... | I find that it's usually worthwhile to work out the behavior of small Haskell programs by hand. The evaluation rules are quite simple. The key thing to remember is that Haskell is *non-strict* (aka *lazy*): expressions are evaluated only when needed. Laziness is the reason seemingly infinite definitions can yield usefu... |
397,346 | <p>Is possible to set an image as an iPhone application unique icon in code instead of adding a PNG format image file and naming it <code>Icon.png</code>?</p>
| [
{
"answer_id": 397705,
"author": "Airsource Ltd",
"author_id": 18017,
"author_profile": "https://Stackoverflow.com/users/18017",
"pm_score": 2,
"selected": false,
"text": "<p>a) No, not for developer applications. Also note that Apple's preload applications can demonstrably alter Default... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35405/"
] | Is possible to set an image as an iPhone application unique icon in code instead of adding a PNG format image file and naming it `Icon.png`? | Here is an example of what you would add to your Info.plist:
```
<key>CFBundleIconFile</key>
<string>app.png</string>
```
This (as well as other related options) is well documented in the [iPhone Application Programming Guide](http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgramm... |
397,355 | <p>How do I create subdomains in ASP.NET?
I have few links on my homepage(Home.aspx)
Example: Link1 and Link2</p>
<p>I need to create two sub domains link1.example.com and link2.example.com
and redirect to them. I will be using Response.Redirect for navigation. </p>
<p>Questions:
Do the files need to reside in diffe... | [
{
"answer_id": 397374,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 0,
"selected": false,
"text": "<p>You need to set up domains and sub-domains from your Domain Provider (from where you bought your domain name), no... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48307/"
] | How do I create subdomains in ASP.NET?
I have few links on my homepage(Home.aspx)
Example: Link1 and Link2
I need to create two sub domains link1.example.com and link2.example.com
and redirect to them. I will be using Response.Redirect for navigation.
Questions:
Do the files need to reside in different directory or... | Depending on what you are actually trying to accomplish with these redirects, this may be useful. If you are trying simply to have multiple sub-domains handled from a single web application, you can fake this sub-domain behavior outside of ASP.NET entirely using an IIS-based server hosting a single web application with... |
397,371 | <p>I'm porting our old Active-Record based API over to a new structure to make unit testing easier etc. We are using the repository pattern for our data access and StructureMap for dependency injection.</p>
<p>I'm struggling a little now with how to structure everything. Using our 'Product' class as an example, we pre... | [
{
"answer_id": 397360,
"author": "Brann",
"author_id": 47341,
"author_profile": "https://Stackoverflow.com/users/47341",
"pm_score": 0,
"selected": false,
"text": "<p>You should use resources files. Check <a href=\"http://msdn.microsoft.com/en-us/library/t18274tk.aspx\" rel=\"nofollow no... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38911/"
] | I'm porting our old Active-Record based API over to a new structure to make unit testing easier etc. We are using the repository pattern for our data access and StructureMap for dependency injection.
I'm struggling a little now with how to structure everything. Using our 'Product' class as an example, we previously ha... | Everything I said here:
[Internationalizing Desktop App within a couple years... What should we do now?](https://stackoverflow.com/questions/270829/internationalizing-desktop-app-within-a-couple-years-what-should-we-do-now)
applies to this question. |
397,384 | <p>EDIT:</p>
<p>I'm told that making you guys read means I get less attention. My apologies. Here's a simpler version:</p>
<p>Bill got $100 dollars worth of items from a store.</p>
<p>He wants to return enough of the items to get exactly $30 dollars back.</p>
<p>The store has a Point of Return system that will help... | [
{
"answer_id": 397395,
"author": "benlumley",
"author_id": 39161,
"author_profile": "https://Stackoverflow.com/users/39161",
"pm_score": 0,
"selected": false,
"text": "<p>i don't think group by can do it.</p>\n\n<p>i can't think of a better way than finding/trying all of the permutations... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49478/"
] | EDIT:
I'm told that making you guys read means I get less attention. My apologies. Here's a simpler version:
Bill got $100 dollars worth of items from a store.
He wants to return enough of the items to get exactly $30 dollars back.
The store has a Point of Return system that will help him do this.
Here is the data... | If the number of items are small enough you can brute force this with SQL. This might be a quick to write solution, but you probably want to do something smarter. Sounds like the "[knapsack problem](http://en.wikipedia.org/wiki/Knapsack_problem)" which is NP complete.
If the number of items is large, you will need to ... |
397,396 | <p>In my web app I use several asmx (Web Services) from the same provider, they have one for this, other for that, but all require a SOAP Header with Authentication.</p>
<p>It is simple to add the Authentication:</p>
<pre><code>public static SoCredentialsHeader AttachCredentialHeader()
{
SoCredentialsHeader ch = ... | [
{
"answer_id": 397422,
"author": "Yossi Dahan",
"author_id": 43541,
"author_profile": "https://Stackoverflow.com/users/43541",
"pm_score": 0,
"selected": false,
"text": "<p>I don't know if this is something you wish to consider, as it definitely has it's down sides, but - as ultimately t... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28004/"
] | In my web app I use several asmx (Web Services) from the same provider, they have one for this, other for that, but all require a SOAP Header with Authentication.
It is simple to add the Authentication:
```
public static SoCredentialsHeader AttachCredentialHeader()
{
SoCredentialsHeader ch = new SoCredentialsHead... | Create a file called whatever.tt (the trick is the .tt extension) anywhere in your VS solution and paste the following code:
```
using System;
namespace Whatever
{
public static class Howdy
{
<#
string[] webServices = new string[] {"wsContact", "wsDiary"};
foreach (string wsName in webServices)
{... |
397,404 | <p>Say we have:</p>
<pre><code>
Class Base
{
virtual void f(){g();};
virtual void g(){//Do some Base related code;}
};
Class Derived : public Base
{
virtual void f(){Base::f();};
virtual void g(){//Do some Derived related code};
};
int main()
{
Base *pBase = new Derived;
pBase->f();
... | [
{
"answer_id": 397409,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 7,
"selected": true,
"text": "<p>The g of the derived class will be called. If you want to call the function in the base, call</p>\n\n<pre... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46418/"
] | Say we have:
```
Class Base
{
virtual void f(){g();};
virtual void g(){//Do some Base related code;}
};
Class Derived : public Base
{
virtual void f(){Base::f();};
virtual void g(){//Do some Derived related code};
};
int main()
{
Base *pBase = new Derived;
pBase->f();
return 0;
}... | The g of the derived class will be called. If you want to call the function in the base, call
```
Base::g();
```
instead. If you want to call the derived, but still want to have the base version be called, arrange that the derived version of g calls the base version in its first statement:
```
virtual void g() {
... |
397,410 | <p>I accumulated a quite a lot of data in a raw form (csv and binary) - 4GB per day for a few months to be precise.</p>
<p>I decided to join the civilized world and use database to access the data and I wondered what would be the correct layout; the format is quite simple: a few rows for every time tick (bid, ask, tim... | [
{
"answer_id": 397421,
"author": "cletus",
"author_id": 18393,
"author_profile": "https://Stackoverflow.com/users/18393",
"pm_score": 4,
"selected": true,
"text": "<p>You don't really say what your background is and how much you know about programming and <a href=\"http://en.wikipedia.or... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28772/"
] | I accumulated a quite a lot of data in a raw form (csv and binary) - 4GB per day for a few months to be precise.
I decided to join the civilized world and use database to access the data and I wondered what would be the correct layout; the format is quite simple: a few rows for every time tick (bid, ask, timestamp, et... | You don't really say what your background is and how much you know about programming and [database design](http://en.wikipedia.org/wiki/Database_design). It sounds like you should do some reading. Conceptually though your design is fairly simple. Your description identifies a mere two entities:
* Financial instrument;... |
397,412 | <p>I have recently been exploring Apache Ofbiz and was impressed by its ability to customize most areas of the application: UI, workflow, entities.</p>
<p>Is there any similar (not necessarily an ERP system) application developed in C#/.Net which offers a similar level of customization?</p>
<p>I am looking for examp... | [
{
"answer_id": 397421,
"author": "cletus",
"author_id": 18393,
"author_profile": "https://Stackoverflow.com/users/18393",
"pm_score": 4,
"selected": true,
"text": "<p>You don't really say what your background is and how much you know about programming and <a href=\"http://en.wikipedia.or... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46279/"
] | I have recently been exploring Apache Ofbiz and was impressed by its ability to customize most areas of the application: UI, workflow, entities.
Is there any similar (not necessarily an ERP system) application developed in C#/.Net which offers a similar level of customization?
I am looking for examples of application... | You don't really say what your background is and how much you know about programming and [database design](http://en.wikipedia.org/wiki/Database_design). It sounds like you should do some reading. Conceptually though your design is fairly simple. Your description identifies a mere two entities:
* Financial instrument;... |
397,426 | <p>Currently I'm having a problem with generating class files from a xsd with repeating elements. I’m using the custom tool ‘MsDatasetGenerator’ in VS2005 SP1 witch create a typed dataset from the xsd for c#. I’m trying to parse the xml by this schema</p>
<pre><code> <?xml version="1.0" encoding=\"utf-8\"?>
&... | [
{
"answer_id": 397446,
"author": "nick_alot",
"author_id": 46100,
"author_profile": "https://Stackoverflow.com/users/46100",
"pm_score": 1,
"selected": false,
"text": "<p>I would suggest a simple renaming of the schema items, plus the usage of grouping (shown below) or xsd includes (if y... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49788/"
] | Currently I'm having a problem with generating class files from a xsd with repeating elements. I’m using the custom tool ‘MsDatasetGenerator’ in VS2005 SP1 witch create a typed dataset from the xsd for c#. I’m trying to parse the xml by this schema
```
<?xml version="1.0" encoding=\"utf-8\"?>
<xs:schema id="XSDobj... | I had the same problem.. if performances are not an issue, you can use XSLT to rename the "child" tables that have the same name, (i.e. the resulting name is the concatenation of table name and its parent):
```
...
<xsl:template match="*">
<xsl:param name="parentElm">
<xsl:value-of select="name(..)" />
... |
397,477 | <p>In my asp.net-mvc website I have a field that usually has a string (from database) but can from time to time contain nothing.
Because IE doesn't know how to handle the css "empty-cells" tag, empty table cells need to be filled with an &nbsp;<br>
I thought </p>
<pre><code>Html.Encode(" ");
</code></pre>
<p>wo... | [
{
"answer_id": 397486,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": 0,
"selected": false,
"text": "<p>You have to find a different way to fill your empty cell. HTML-encoding a space character to itself is perfectly valid. I... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | In my asp.net-mvc website I have a field that usually has a string (from database) but can from time to time contain nothing.
Because IE doesn't know how to handle the css "empty-cells" tag, empty table cells need to be filled with an
I thought
```
Html.Encode(" ");
```
would fix this for me, but apparant... | A space encode in HTML is just a space. nbsp may look like a space, but has a different semantics, "non-breaking" meaning that line breaks are suppressed.
Solution: Whenever I find functionality lacking or with unexpected behavior (e.g. asp:Label and HyperLink don't HTML encode), I write my own utilities class which d... |
397,483 | <p>What is the best way to have an associative array with arbitrary value types for each key in C++?</p>
<p>Currently my plan is to create a "value" class with member variables of the types I will be expecting. For example:</p>
<pre><code>class Value {
int iValue;
Value(int v) { iValue = v; }
std::strin... | [
{
"answer_id": 397487,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": 2,
"selected": false,
"text": "<p>Subclass <code>Value</code> with <code>IntValue</code>, <code>StringValue</code>, and so on.</p>\n"
},
{
"answer_... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11125/"
] | What is the best way to have an associative array with arbitrary value types for each key in C++?
Currently my plan is to create a "value" class with member variables of the types I will be expecting. For example:
```
class Value {
int iValue;
Value(int v) { iValue = v; }
std::string sValue;
Value(s... | [boost::variant](http://www.boost.org/doc/libs/1_37_0/doc/html/variant.html) seems exactly what you are looking for. |
397,489 | <p>After making a few modifications to a rails app I am tinkering on, railroad stopped working. The verbose output gives some clues. I wonder if other folks have encountered this and if there are some pointers for fixing this problem. Is it a data modeling error? Is it a problem with railroad? Error log follows...</p>
... | [
{
"answer_id": 397490,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 1,
"selected": false,
"text": "<p>Most IDE's have a window called something like \"immediate mode\" that will allow you to evaluate java code on the f... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39584/"
] | After making a few modifications to a rails app I am tinkering on, railroad stopped working. The verbose output gives some clues. I wonder if other folks have encountered this and if there are some pointers for fixing this problem. Is it a data modeling error? Is it a problem with railroad? Error log follows...
```
ra... | **edit**
Since Java 9 there's [JShell](https://en.wikipedia.org/wiki/JShell)
*Original answer follows*
You can also use [Groovy Console](http://www.groovy-lang.org/groovyconsole.html). It is an interactive console where you can do what you want. Since Groovy also includes classes from the core java platform, you'll b... |
397,495 | <p>i want to compare the current time and file creation time in Perl but both are in different format. localtime is in this format:</p>
<pre><code>22116291110813630
</code></pre>
<p>and file creation time is </p>
<pre><code>Today, December 29, 2008, 2:38:37 PM
</code></pre>
<p>How do i compare which one is greater ... | [
{
"answer_id": 397526,
"author": "ysth",
"author_id": 17389,
"author_profile": "https://Stackoverflow.com/users/17389",
"pm_score": 2,
"selected": false,
"text": "<p><code>localtime</code> returns a list of values in list context. See <a href=\"http://perldoc.perl.org/functions/localtim... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | i want to compare the current time and file creation time in Perl but both are in different format. localtime is in this format:
```
22116291110813630
```
and file creation time is
```
Today, December 29, 2008, 2:38:37 PM
```
How do i compare which one is greater and their difference? | If you want to compare values, you might want to use the number you got from [`localtime`](http://perldoc.perl.org/functions/localtime.html) in scalar context and the inode change time that you can get from [`stat`](http://perldoc.perl.org/functions/stat.html):
```
($dev,$ino,$mode,$nlink,$uid,$gid,$rde... |
397,524 | <p>I want to retrieve a set of records from a database, do a rs.next() and then assign the result of this to a variable to pass to a method that will use this record, in the same way that I would without assigning it to a variable and passing it to a method
is there any way to do this?
I'm using JAVA (1.5)</p>
<hr>
<... | [
{
"answer_id": 397546,
"author": "OscarRyz",
"author_id": 20654,
"author_profile": "https://Stackoverflow.com/users/20654",
"pm_score": 1,
"selected": true,
"text": "<p>You want to assign the result of <em>rs.next()</em> to a variable?</p>\n\n<p>I'm afraid you cannot do that. You can hav... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49805/"
] | I want to retrieve a set of records from a database, do a rs.next() and then assign the result of this to a variable to pass to a method that will use this record, in the same way that I would without assigning it to a variable and passing it to a method
is there any way to do this?
I'm using JAVA (1.5)
---
Thank you... | You want to assign the result of *rs.next()* to a variable?
I'm afraid you cannot do that. You can have a reference from that rs and process it in other method ( the same way you would without assign it to a var )
When you pass the rs as an argument to a method that is exactly what you're doing already.
```
while( ... |
397,556 | <p>I've got an enum like this:</p>
<pre><code>public enum MyLovelyEnum
{
FirstSelection,
TheOtherSelection,
YetAnotherOne
};
</code></pre>
<p>I got a property in my DataContext:</p>
<pre><code>public MyLovelyEnum VeryLovelyEnum { get; set; }
</code></pre>
<p>And I got three RadioButtons in my WPF client... | [
{
"answer_id": 397580,
"author": "Martin Moser",
"author_id": 24756,
"author_profile": "https://Stackoverflow.com/users/24756",
"pm_score": 3,
"selected": false,
"text": "<p>I would use the RadioButtons in a ListBox, and then bind to the SelectedValue.</p>\n\n<p>This is an older thread a... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7021/"
] | I've got an enum like this:
```
public enum MyLovelyEnum
{
FirstSelection,
TheOtherSelection,
YetAnotherOne
};
```
I got a property in my DataContext:
```
public MyLovelyEnum VeryLovelyEnum { get; set; }
```
And I got three RadioButtons in my WPF client.
```
<RadioButton Margin="3">First Selection</R... | You could use a more generic converter
```
public class EnumBooleanConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string parameterString = parameter as string;
if (parameterSt... |
397,558 | <p>How can I make a text entry field that takes the input characters and displays it in another place, character by character as a the typest type them!</p>
| [
{
"answer_id": 397567,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 1,
"selected": false,
"text": "<p>You could start by having a look at the sourcecode of the edit fields in this site.\nThe preview is updated as you... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49809/"
] | How can I make a text entry field that takes the input characters and displays it in another place, character by character as a the typest type them! | Something like this:
```
<input type="text" id="textField" />
<br />
<span id="textOutput"></span>
<script type="text/javascript">
var input = document.getElementById("textField");
var output = document.getElementById("textOutput");
// sorry, it's better to use "onkeyup" event
// to avoid the proble... |
397,572 | <p>I am writing a cocoa application which has a NSWindow. I want to change the background color of the window to a specific color. But the window properties in the inspector only provide "Textured Window" alternative. How can I make the color of the window as desired?</p>
| [
{
"answer_id": 397607,
"author": "diciu",
"author_id": 2811,
"author_profile": "https://Stackoverflow.com/users/2811",
"pm_score": 1,
"selected": false,
"text": "<p>You have to subclass NSWindow in order to change the background and then override the implementation for </p>\n\n<pre><code... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39270/"
] | I am writing a cocoa application which has a NSWindow. I want to change the background color of the window to a specific color. But the window properties in the inspector only provide "Textured Window" alternative. How can I make the color of the window as desired? | Try calling the instance method setBackgroundColor: with a color on your window instance. What's in a name.. ;)
Like this:
```
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
// Option 1
[self.window setBackgroundColor: NSColor.whiteColor];
// Option 2 - using dot syntax
self.w... |
397,601 | <p>Reading source code of sample projects, such as Beast and Bort, are recommended as a good way to learn rails. But I found myself getting lost in reading source code of these projects, cause the included plugins might bring in some strange code without any hint, such as <code>"require"</code> or <code>"include"</code... | [
{
"answer_id": 397658,
"author": "Ricardo Acras",
"author_id": 19224,
"author_profile": "https://Stackoverflow.com/users/19224",
"pm_score": 0,
"selected": false,
"text": "<p>Rails code are primarily ruby code. Master in ruby and you will have no problem at all reading rails code.\nGood ... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44512/"
] | Reading source code of sample projects, such as Beast and Bort, are recommended as a good way to learn rails. But I found myself getting lost in reading source code of these projects, cause the included plugins might bring in some strange code without any hint, such as `"require"` or `"include"`. Could you share your r... | When learning to use rails, one of the most important things to know is how it loads the code you've written. Let's say you have a HelloController in the app/controllers/demo/sub directory. If you generated this controller, it will have the correct name of Demo::Sub::HelloController.
When your route tells rails to loo... |
397,631 | <p>I hope someone could help me on this.</p>
<p>I want to add a month to a database date, but I want to prevent two jumping over month on those days at the end.</p>
<p>For instance I may have:</p>
<p>Jan 31 2009 </p>
<p>And I want to get</p>
<p>Feb 28 2009 </p>
<p>and not </p>
<p>March 2 2009 </p>
<p>Next date... | [
{
"answer_id": 397651,
"author": "diciu",
"author_id": 2811,
"author_profile": "https://Stackoverflow.com/users/2811",
"pm_score": 2,
"selected": false,
"text": "<p>I think you're looking for LAST_DAY:</p>\n\n<p><a href=\"http://download.oracle.com/docs/cd/B28359_01/olap.111/b28126/dml_... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20654/"
] | I hope someone could help me on this.
I want to add a month to a database date, but I want to prevent two jumping over month on those days at the end.
For instance I may have:
Jan 31 2009
And I want to get
Feb 28 2009
and not
March 2 2009
Next date would be
March 28 2009
Jun 28 2009
etc.
Is there a fu... | Oracle has a built-in function [ADD\_MONTHS](http://download.oracle.com/docs/cd/B10501_01/server.920/a96540/functions5a.htm) that does exactly that:
```
SQL> select add_months(date '2008-01-31',1) from dual;
ADD_MONTHS(
-----------
29-FEB-2008
SQL> select add_months(date '2008-02-29',1) from dual;
ADD_MONTHS(
-----... |
397,667 | <p>This is my first question in this forum...
I have a file with numerous data fields (both numeric and characters) in the file.
I want to delimit the file with set of delimiter length like 2,5,1,9,6 etc.</p>
<p>(<em>Alternatively: I have a list of field lengths such as 2,5,1,9,6, and I want to insert comma delimiters... | [
{
"answer_id": 397671,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": 1,
"selected": false,
"text": "<p>I think I don’t understand the question. Read the file, line by line, and insert commas into the string.</p>\n\n<pre><cod... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This is my first question in this forum...
I have a file with numerous data fields (both numeric and characters) in the file.
I want to delimit the file with set of delimiter length like 2,5,1,9,6 etc.
(*Alternatively: I have a list of field lengths such as 2,5,1,9,6, and I want to insert comma delimiters in (a copy o... | ```
if (myString.equals("9483trdcvge245621jde")) {
myString = "94,83trd,c,vge245621,jde";
}
```
Jokingly ;-)
I think something like this...
```
private static final int[] pos = {2, 5, 1, 9, 6};
private static final String DIV = ",";
public static String parse(String str) {
int start = 0;
String... |
397,677 | <p>I have a piece of text, that I wish to show truncated, but when clicked it will expand to show the rest. Clicking again should truncate it.</p>
<p>I was trying to use the onclick event to handle this as follows (<strong>WARNING</strong>: Do not run following code without reading below...):</p>
<pre><code><span ... | [
{
"answer_id": 397690,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 3,
"selected": true,
"text": "<p>This is because you are recursively invoking the <code>showAllComment</code> function</p>\n\n<p>Try doing somethin... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1478/"
] | I have a piece of text, that I wish to show truncated, but when clicked it will expand to show the rest. Clicking again should truncate it.
I was trying to use the onclick event to handle this as follows (**WARNING**: Do not run following code without reading below...):
```
<span id='blah' onclick='showAllComment("th... | This is because you are recursively invoking the `showAllComment` function
Try doing something like this instead:
```
function showAllComment( comment, shortCommentLen, showFullComment )
{
alert( $("#blah").html() );
if( showFullComment )
{
$("#blah").html( comment );
$("#blah").click( fu... |
397,684 | <p>I have used <a href="http://www.ericmmartin.com/projects/simplemodal/" rel="nofollow noreferrer">SimpleModal</a>. Now the problem is the resizing of the modal dialog.
I have a confirm dialog, and it is basically small after pressing Yes.</p>
<p>The second one is <code>my.php</code> and it contains large data. I am ... | [
{
"answer_id": 790332,
"author": "tghw",
"author_id": 2363,
"author_profile": "https://Stackoverflow.com/users/2363",
"pm_score": 2,
"selected": false,
"text": "<p>You can do it by adding and removing classes for the modalContainer element.</p>\n\n<p><a href=\"https://www.copilot.com/\" ... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44984/"
] | I have used [SimpleModal](http://www.ericmmartin.com/projects/simplemodal/). Now the problem is the resizing of the modal dialog.
I have a confirm dialog, and it is basically small after pressing Yes.
The second one is `my.php` and it contains large data. I am using the concept of
appending an already existing model. ... | Just do this....
```
$("#simplemodal-container").css('height', 'auto'); //To reset the container.
$(window).trigger('resize.simplemodal'); //To refresh the modal dialog.
``` |
397,692 | <p>I'd like to display the binary (or hexadecimal) representation of a floating point number. I know how to convert by hand (using the method <a href="http://en.wikipedia.org/wiki/Floating_point#Implementation_in_actual_computers:_IEEE_floating-point" rel="noreferrer">here</a>), but I'm interested in seeing code sampl... | [
{
"answer_id": 397700,
"author": "cletus",
"author_id": 18393,
"author_profile": "https://Stackoverflow.com/users/18393",
"pm_score": 6,
"selected": true,
"text": "<p>C/C++ is easy.</p>\n\n<pre><code>union ufloat {\n float f;\n unsigned u;\n};\n\nufloat u1;\nu1.f = 0.3f;\n</code></pre>... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] | I'd like to display the binary (or hexadecimal) representation of a floating point number. I know how to convert by hand (using the method [here](http://en.wikipedia.org/wiki/Floating_point#Implementation_in_actual_computers:_IEEE_floating-point)), but I'm interested in seeing code samples that do the same.
Although I... | C/C++ is easy.
```
union ufloat {
float f;
unsigned u;
};
ufloat u1;
u1.f = 0.3f;
```
Then you just output `u1.u`. You can adapt [this implementation](http://www.daniweb.com/code/snippet87.html).
Doubles just as easy.
```
union udouble {
double d;
unsigned long u;
}
```
because doubles are 64 bit.
Java... |
397,708 | <p>I am trying to write a MySQL query that retrieves one record from table "projects" that has a one-to-many relationship with table "tags". My application uses 4 tables to do this:</p>
<pre><code>Projects - the projects table
Entities - entity table; references several application resources
Tags - tags table
Tag_enti... | [
{
"answer_id": 397716,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "<p>I don't know if it works in MySQL, but in SQL Server you can use a trick for this:</p>\n\n<pre><code>DECLARE @csv ... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11568/"
] | I am trying to write a MySQL query that retrieves one record from table "projects" that has a one-to-many relationship with table "tags". My application uses 4 tables to do this:
```
Projects - the projects table
Entities - entity table; references several application resources
Tags - tags table
Tag_entity - links tag... | see [GROUP\_CONCAT](http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat)
example:
```
mysql> SELECT * FROM blah;
+----+-----+-----------+
| K | grp | name |
+----+-----+-----------+
| 1 | 1 | foo |
| 2 | 1 | bar |
| 3 | 2 | hydrogen |
| 4 | 4 | dasher ... |
397,721 | <p>Is it possible to add a jQuery function so that a click in a table cell will invoke
a hidden <a href="javascript: ..." /> element (that is a descendant of the TD) ?</p>
<p>I've tried with </p>
<p>$('#table td').click(function() {
$(this).find('a').click();
});</p>
<p>An other variants, but to no luc... | [
{
"answer_id": 397742,
"author": "Zach Langley",
"author_id": 45230,
"author_profile": "https://Stackoverflow.com/users/45230",
"pm_score": 3,
"selected": false,
"text": "<p>Why don't you move your JavaScript code out of the <code>href</code> attribute and into your click event? jQuery w... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2732/"
] | Is it possible to add a jQuery function so that a click in a table cell will invoke
a hidden <a href="javascript: ..." /> element (that is a descendant of the TD) ?
I've tried with
$('#table td').click(function() {
$(this).find('a').click();
});
An other variants, but to no luck.
--larsw | ```
<html>
<head></head>
<body>
<table border=1>
<tr>
<td>a1<a href=# onclick='alert("a1")' /></td>
<td>a2<a href=# onclick='alert("a2")' /></td>
</tr>
<tr>
<td>b1<a href=# onclick='alert("b1")' /></td>
<td>b2<a href=# onclick='alert("b2")' /></td>
</tr>
</table>
<script ... |
397,736 | <p>I want to globalize my application.
I have created a small form which asks the user their language.
I have a number of problems :</p>
<p>Problem 1:</p>
<p>In program.cs</p>
<pre><code>new SplashScreen(_tempAL);
new LangForm(_lang);
Application.Run(new Form1(_tempAL, _lang));
</code></pre>
<p>I want the applicat... | [
{
"answer_id": 397746,
"author": "Dan Williams",
"author_id": 4230,
"author_profile": "https://Stackoverflow.com/users/4230",
"pm_score": 2,
"selected": false,
"text": "<p>Not sure if you're on a Windows box but honestly if you can write even a little Javascript the <a href=\"http://deve... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42782/"
] | I want to globalize my application.
I have created a small form which asks the user their language.
I have a number of problems :
Problem 1:
In program.cs
```
new SplashScreen(_tempAL);
new LangForm(_lang);
Application.Run(new Form1(_tempAL, _lang));
```
I want the application not to call Form1 until the user cli... | On Windows Apple provides the [iTunes COM for Windows SDK](http://developer.apple.com/sdk/) that works quite well. It is created using a COM interface so it works with almost every language available for Windows. It provides methods for renaming Tracks and Playlists. I have used this to do all kinds of things with my L... |
397,744 | <p>I have a windows service written in c#. It has a timer inside, which fires some functions on a regular basis. So the skeleton of my service:</p>
<pre><code>public partial class ArchiveService : ServiceBase
{
Timer tickTack;
int interval = 10;
...
protected override void OnStart(string[] args)
{... | [
{
"answer_id": 397756,
"author": "PEZ",
"author_id": 44639,
"author_profile": "https://Stackoverflow.com/users/44639",
"pm_score": 0,
"selected": false,
"text": "<p>Have you checked the error logs? Maybe you run out of timers somehow. Maybe you can create just one timer when you initiali... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/968/"
] | I have a windows service written in c#. It has a timer inside, which fires some functions on a regular basis. So the skeleton of my service:
```
public partial class ArchiveService : ServiceBase
{
Timer tickTack;
int interval = 10;
...
protected override void OnStart(string[] args)
{
tickT... | Like many respondents have pointed out exceptions are swallowed by timer. In my windows services I use System.Threading.Timer. It has Change(...) method which allows you to start/stop that timer. Possible place for exception could be reentrancy problem - in case when tickTack\_Elapsed executes longer than timer period.... |
397,753 | <p>I've a need to add method that will calculate a weighted sum of worker salary and his superior salary. I would like something like this:</p>
<pre><code>class CompanyFinanse
{
public decimal WeightedSumOfWorkerSalaryAndSuperior(Worker WorkerA, Worker Superior)
{
return WorkerA.Salary + Superio... | [
{
"answer_id": 397767,
"author": "brien",
"author_id": 4219,
"author_profile": "https://Stackoverflow.com/users/4219",
"pm_score": 3,
"selected": false,
"text": "<p>For your design to be Object Oriented, you should start by thinking of the purpose of the entire application. If there is ... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49836/"
] | I've a need to add method that will calculate a weighted sum of worker salary and his superior salary. I would like something like this:
```
class CompanyFinanse
{
public decimal WeightedSumOfWorkerSalaryAndSuperior(Worker WorkerA, Worker Superior)
{
return WorkerA.Salary + Superior.Salary * 2;
... | So it may be impossible to give you a complete answer about "best practices" without knowing more about your domain, but I can tell you that you may be setting yourself up for disaster by thinking about the implementation details this early.
If you're like me then you were taught that good OOD/OOP is meticulously deta... |
397,754 | <p>Is there a way to record the screen, either desktop or window, using .NET technologies.</p>
<p>My goal is something free. I like the idea of small, low cpu usage, and simple, but would consider other options if they created a better final product.</p>
<p>In a nutshell, I know how to take a screenshot in C#, but ho... | [
{
"answer_id": 397771,
"author": "PEZ",
"author_id": 44639,
"author_profile": "https://Stackoverflow.com/users/44639",
"pm_score": 2,
"selected": false,
"text": "<p>There is a dll out there that can do it. Don't remember the name of it but it's used by <a href=\"http://www.jingproject.co... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23294/"
] | Is there a way to record the screen, either desktop or window, using .NET technologies.
My goal is something free. I like the idea of small, low cpu usage, and simple, but would consider other options if they created a better final product.
In a nutshell, I know how to take a screenshot in C#, but how would I record ... | There is no need for a third party DLL. This simple method captures the current screen image into a .NET Bitmap object.
```
private Image CaptureScreen()
{
Rectangle screenSize = Screen.PrimaryScreen.Bounds;
Bitmap target = new Bitmap(screenSize.Width,screenSize.Height);
using(Graphics... |
397,760 | <p>What does the <code>[string]</code> indexer of <code>Dictionary</code> return when the key doesn't exist in the Dictionary? I am new to C# and I can't seem to find a reference as good as the Javadocs.</p>
<p>Do I get <code>null</code>, or do I get an exception?</p>
| [
{
"answer_id": 397772,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": false,
"text": "<p>As ever, the <a href=\"http://msdn.microsoft.com/en-us/library/9tee9ht2.aspx\" rel=\"noreferrer\">documentation</a> i... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2598/"
] | What does the `[string]` indexer of `Dictionary` return when the key doesn't exist in the Dictionary? I am new to C# and I can't seem to find a reference as good as the Javadocs.
Do I get `null`, or do I get an exception? | If you mean the indexer of a `Dictionary<string,SomeType>`, then you should see an exception (`KeyNotFoundException`). If you don't want it to error:
```
SomeType value;
if(dict.TryGetValue(key, out value)) {
// key existed; value is set
} else {
// key not found; value is default(SomeType)
}
``` |
397,837 | <p>Im trying to sum an expression in visual studio and just keep getting an #error but not sure why as this si the first time i have tried to sum an expression, only ever done it on a single field before. Any Suggestions!!!</p>
<pre><code> =IIf(Fields!STATUS.value = "Completed" AND Fields!DONOTINVOICE.value = True, Fi... | [
{
"answer_id": 397865,
"author": "recursive",
"author_id": 44743,
"author_profile": "https://Stackoverflow.com/users/44743",
"pm_score": 2,
"selected": false,
"text": "<p>The value of the IIf() will evaluate to a string (\"\") when your condition is false. You can't sum a string. Try u... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Im trying to sum an expression in visual studio and just keep getting an #error but not sure why as this si the first time i have tried to sum an expression, only ever done it on a single field before. Any Suggestions!!!
```
=IIf(Fields!STATUS.value = "Completed" AND Fields!DONOTINVOICE.value = True, Fields!ORDERCOST... | The value of the IIf() will evaluate to a string ("") when your condition is false. You can't sum a string. Try using 0 instead. |
397,851 | <p>I'm making a winform in C# using Visual Studio 2008.</p>
<p>Currently, I have a tabcontrol, containing 2 tabs.
In the first the, there is a button. When I click it, I must be taken to the second tab.</p>
<p>Problem is, I don't know how. I've tried debugging, looking into al kinds of Properties and messing around w... | [
{
"answer_id": 397857,
"author": "Matt Brunell",
"author_id": 24970,
"author_profile": "https://Stackoverflow.com/users/24970",
"pm_score": 5,
"selected": true,
"text": "<p>Did you try this?</p>\n\n<pre><code>tabControl1.SelectedTab = logTab;\n</code></pre>\n"
},
{
"answer_id": 3... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11795/"
] | I'm making a winform in C# using Visual Studio 2008.
Currently, I have a tabcontrol, containing 2 tabs.
In the first the, there is a button. When I click it, I must be taken to the second tab.
Problem is, I don't know how. I've tried debugging, looking into al kinds of Properties and messing around with them, but I f... | Did you try this?
```
tabControl1.SelectedTab = logTab;
``` |
397,864 | <p>What are the different ways of communication between asp.net page and a popup page? Query strings etc. Which is most secure?</p>
| [
{
"answer_id": 397870,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 1,
"selected": false,
"text": "<p>If you are talking about an actual pop-up page, where you are using window.open from javascript. You have the ... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1688440/"
] | What are the different ways of communication between asp.net page and a popup page? Query strings etc. Which is most secure? | You say "communication between" the pop-up and the main ASP.NET page. First, I assume that the pop-up is an ASP.NET page as well so the communication from the main page to the pop-up is no different from the communication from one page to the next in a series of pages. That is, you can store and then use data in the se... |
397,867 | <p>George Marsaglia has written an excellent random number generator that is extremely fast, simple, and has a much higher period than the Mersenne Twister. Here is the code with a description:</p>
<p><a href="http://school.anhb.uwa.edu.au/personalpages/kwessen/shared/Marsaglia03.html" rel="noreferrer">good C random n... | [
{
"answer_id": 397885,
"author": "frankodwyer",
"author_id": 42404,
"author_profile": "https://Stackoverflow.com/users/42404",
"pm_score": 0,
"selected": false,
"text": "<p>You can use signed numbers provided the values don't overflow...for example long in java is a 64 bit signed integer... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48181/"
] | George Marsaglia has written an excellent random number generator that is extremely fast, simple, and has a much higher period than the Mersenne Twister. Here is the code with a description:
[good C random number generator](http://school.anhb.uwa.edu.au/personalpages/kwessen/shared/Marsaglia03.html)
I wanted to port ... | >
> Can anyone port this to Java? How does
> this work when you only have signed
> numbers available?
>
>
>
No Stress! `a=18782` so the largest `t` could ever be is not large enough to cause signed vs. unsigned problems. You would have to "upgrade" the result of using Q to a value equal to a 32-bit unsigned numb... |
397,895 | <p>How can I create a list in C++? I need it to create a linked list. How would I go about doing that? Are there good tutorials or examples I could follow?</p>
| [
{
"answer_id": 397904,
"author": "Roddy",
"author_id": 1737,
"author_profile": "https://Stackoverflow.com/users/1737",
"pm_score": 5,
"selected": false,
"text": "<p>You should really use the <a href=\"http://en.cppreference.com/w/cpp/container/list\" rel=\"noreferrer\">standard List clas... | 2008/12/29 | [
"https://Stackoverflow.com/questions/397895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49609/"
] | How can I create a list in C++? I need it to create a linked list. How would I go about doing that? Are there good tutorials or examples I could follow? | I take it that you know that C++ already has a linked list class, and you want to implement your own because you want to learn how to do it.
First, read [Why do we use arrays instead of other data structures?](https://stackoverflow.com/questions/392397/arrays-whats-the-point) , which contains a good answer of basic d... |