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 |
|---|---|---|---|---|---|---|
311,627 | <p>This is my code:</p>
<pre><code>import datetime
today = datetime.date.today()
print(today)
</code></pre>
<p>This prints: <code>2008-11-22</code> which is exactly what I want.</p>
<p>But, I have a list I'm appending this to and then suddenly everything goes "wonky". Here is the code:</p>
<pre><code>import datetim... | [
{
"answer_id": 311635,
"author": "Simon Johnson",
"author_id": 854,
"author_profile": "https://Stackoverflow.com/users/854",
"pm_score": 3,
"selected": false,
"text": "<p>You need to convert the <code>datetime</code> object to a <code>str</code>.</p>\n<p>The following code worked for me:... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311627",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15250/"
] | This is my code:
```
import datetime
today = datetime.date.today()
print(today)
```
This prints: `2008-11-22` which is exactly what I want.
But, I have a list I'm appending this to and then suddenly everything goes "wonky". Here is the code:
```
import datetime
mylist = []
today = datetime.date.today()
mylist.appe... | The WHY: dates are objects
--------------------------
In Python, dates are objects. Therefore, when you manipulate them, you manipulate objects, not strings or timestamps.
Any object in Python has TWO string representations:
* The regular representation that is used by `print` can be get using the `str()` function. ... |
311,630 | <p>I have two entities Foo and Bar with a Many to Many relationship between them.</p>
<p>Let's say there is no semantic argument for why Foo might be "responsible" for the many to many relationship, but we arbitrarily decide that Foo is responsible for the relation (I.e., in NHibernate we would mark Bar as Inverse)</p... | [
{
"answer_id": 311679,
"author": "BCS",
"author_id": 1343,
"author_profile": "https://Stackoverflow.com/users/1343",
"pm_score": -1,
"selected": false,
"text": "<p>you could make it static</p>\n\n<pre><code>public class Foo\n{\n List<Bar> Bars = new List<Bar>();\n\n pub... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3285/"
] | I have two entities Foo and Bar with a Many to Many relationship between them.
Let's say there is no semantic argument for why Foo might be "responsible" for the many to many relationship, but we arbitrarily decide that Foo is responsible for the relation (I.e., in NHibernate we would mark Bar as Inverse)
That's all ... | You said that one side will "own" the relationship. Make this method public. The other associations (or add methods) can be made internal to avoid consumers from interacting with it directly.
```
public class Foo
{
private IList<Bar> Bars {get;set;}
public void AddBar(Bar bar)
{
Bars.Add(bar);
... |
311,644 | <p>I'm loading an html snippet using </p>
<pre><code>$("#TemplateDump").load("Themes/default.template", function() { processTemplate() })
</code></pre>
<p>The html i am loading contains</p>
<pre><code><div>
`hello ##name##, your age is ##age##.
your page is <a href="##website##">here</a>
</div&... | [
{
"answer_id": 311679,
"author": "BCS",
"author_id": 1343,
"author_profile": "https://Stackoverflow.com/users/1343",
"pm_score": -1,
"selected": false,
"text": "<p>you could make it static</p>\n\n<pre><code>public class Foo\n{\n List<Bar> Bars = new List<Bar>();\n\n pub... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39655/"
] | I'm loading an html snippet using
```
$("#TemplateDump").load("Themes/default.template", function() { processTemplate() })
```
The html i am loading contains
```
<div>
`hello ##name##, your age is ##age##.
your page is <a href="##website##">here</a>
</div>
```
I need to replace the ## placeholders with "joe","1... | You said that one side will "own" the relationship. Make this method public. The other associations (or add methods) can be made internal to avoid consumers from interacting with it directly.
```
public class Foo
{
private IList<Bar> Bars {get;set;}
public void AddBar(Bar bar)
{
Bars.Add(bar);
... |
311,662 | <p>I was just wondering if there are any good work-arounds for Deserializing private fields/properties using XmlSerializer.Deserialize() ?</p>
<p>Currently, I Deserialize my XML to a simple disposable type with all public properties, then I load the complex type that has private properties like this:</p>
<pre><code>C... | [
{
"answer_id": 311664,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 4,
"selected": true,
"text": "<p>MySQL doesn't support milliseconds in any of the time / date columns, or return it in <code>NOW()</code> so unfortunately, ... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37794/"
] | I was just wondering if there are any good work-arounds for Deserializing private fields/properties using XmlSerializer.Deserialize() ?
Currently, I Deserialize my XML to a simple disposable type with all public properties, then I load the complex type that has private properties like this:
```
ComplexType complex = ... | MySQL doesn't support milliseconds in any of the time / date columns, or return it in `NOW()` so unfortunately, no.
If you have a string in a date / time + microseconds format you can use `SELECT MICROSECOND('1997-12-31 23:59:59.000010');` to extract the microseconds. |
311,672 | <p>I've seen a related question on this website regarding a Linux system. I have the same question on a Windows XP OS. I bought a Winchester USB external HD, and found out from technical support that the sleep feature is in the firmware and cannot be turned off. I'm looking for an application that will automatically... | [
{
"answer_id": 311743,
"author": "Casey Wagner",
"author_id": 362821,
"author_profile": "https://Stackoverflow.com/users/362821",
"pm_score": 0,
"selected": false,
"text": "<p>Any text editor with an autosave function would do it.\nYou could also write a batch file to get a directory lis... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've seen a related question on this website regarding a Linux system. I have the same question on a Windows XP OS. I bought a Winchester USB external HD, and found out from technical support that the sleep feature is in the firmware and cannot be turned off. I'm looking for an application that will automatically read/... | I have tried nearly everything to fix this problem on my external which is shared out containing my movies. Nothing ever worked. I have a WD Mybook, and I think the sleep is occurring internally in the drive.
I have a solution that works for me, and should for anyone else. The key is to keep the USB drive doing someth... |
311,677 | <p>can anybody please explain the following c# behaviour? I have written a small console application just to learn about CAS, but I can not seem to understand why the following lines of code work like they do:</p>
<pre><code>string[] myRoles = new string[] { "role1", "role2", "role3" };
GenericIdentity myIdentity = ne... | [
{
"answer_id": 312498,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 0,
"selected": false,
"text": "<p>I believe <code>SecurityManager.IsGranted</code> is mainly looking at code demands (the assembly etc) - not specif... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | can anybody please explain the following c# behaviour? I have written a small console application just to learn about CAS, but I can not seem to understand why the following lines of code work like they do:
```
string[] myRoles = new string[] { "role1", "role2", "role3" };
GenericIdentity myIdentity = new GenericIdent... | In .NET 4.0 SecurityManager.IsGranted has been made obsolete.
This is what it was and if you compile in .NET 4.0 compatibility it will complain.
```
bool isGranted = SecurityManager.IsGranted(new SecurityPermission(SecurityPermissionFlag.Infrastructure))
```
To fix it:
```
var permissionSet = new PermissionSet(Pe... |
311,691 | <p>I feel like this is a stupid question because it seems like common sense . . . but no google search I can put together seems to be able to give me the answer! </p>
<p>I know how to get data OUT of a sqlite3 database using the .dump command. But now that I have this ASCII file titled export.sqlite3.sql . . . I can't... | [
{
"answer_id": 311718,
"author": "Ali Afshar",
"author_id": 28380,
"author_profile": "https://Stackoverflow.com/users/28380",
"pm_score": 7,
"selected": true,
"text": "<pre><code>cat dumpfile.sql | sqlite3 my_database.sqlite\n</code></pre>\n\n<p><a href=\"http://www.sqlite.org/sqlite.htm... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34568/"
] | I feel like this is a stupid question because it seems like common sense . . . but no google search I can put together seems to be able to give me the answer!
I know how to get data OUT of a sqlite3 database using the .dump command. But now that I have this ASCII file titled export.sqlite3.sql . . . I can't seem to g... | ```
cat dumpfile.sql | sqlite3 my_database.sqlite
```
[This is modified from the sqlite3 getting started guide.](http://www.sqlite.org/sqlite.html) |
311,696 | <p>According to the documentation, the <a href="http://msdn.microsoft.com/en-us/library/zy06z30k.aspx" rel="noreferrer"><code>decimal.Round</code></a> method uses a round-to-even algorithm which is not common for most applications. So I always end up writing a custom function to do the more natural round-half-up algori... | [
{
"answer_id": 311704,
"author": "Kibbee",
"author_id": 1862,
"author_profile": "https://Stackoverflow.com/users/1862",
"pm_score": 9,
"selected": true,
"text": "<p>Probably because it's a better algorithm. Over the course of many roundings performed, you will average out that all .5's ... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29407/"
] | According to the documentation, the [`decimal.Round`](http://msdn.microsoft.com/en-us/library/zy06z30k.aspx) method uses a round-to-even algorithm which is not common for most applications. So I always end up writing a custom function to do the more natural round-half-up algorithm:
```
public static decimal RoundHalfU... | Probably because it's a better algorithm. Over the course of many roundings performed, you will average out that all .5's end up rounding equally up and down. This gives better estimations of actual results if you are for instance, adding a bunch of rounded numbers. I would say that even though it isn't what some may e... |
311,710 | <p>I have a List< int[] > myList, where I know that all the int[] arrays are the same length - for the sake of argument, let us say I have 500 arrays, each is 2048 elements long. I'd like to sum all 500 of these arrays, to give me a single array, 2048 elements long, where each element is the sum of all the same pos... | [
{
"answer_id": 311720,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>EDIT: I've left this here for the sake of interest, but the accepted answer is much nicer.</p>\n\n<p>EDIT: Okay, my p... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/987/"
] | I have a List< int[] > myList, where I know that all the int[] arrays are the same length - for the sake of argument, let us say I have 500 arrays, each is 2048 elements long. I'd like to sum all 500 of these arrays, to give me a single array, 2048 elements long, where each element is the sum of all the same positions ... | Edit: Ouch...This became a bit harder while I wasn't looking. Changing requirements can be a real PITA.
Okay, so take each position in the array, and sum it:
```
var sums = Enumerable.Range(0, myList[0].Length)
.Select(i => myList.Select(
nums => nums[i]
).Sum()
... |
311,725 | <p>I have a table that has, in essence, this structure:</p>
<pre> key value
------ ------
2 val1
3 val2
5 val3</pre>
<p>The keys are sequential integers from 1 up to (currently) 1 million, increasing by several thousand each day. Gaps in the keys occur when records have been ... | [
{
"answer_id": 311746,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 2,
"selected": false,
"text": "<p>SQL queries have no looping mechanism. Procedure languages have loops, but queries themselves can only \"loop\" ov... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39965/"
] | I have a table that has, in essence, this structure:
```
key value
------ ------
2 val1
3 val2
5 val3
```
The keys are sequential integers from 1 up to (currently) 1 million, increasing by several thousand each day. Gaps in the keys occur when records have been deleted.
I'm... | SQL queries have no looping mechanism. Procedure languages have loops, but queries themselves can only "loop" over data that they find in a table (or a derived table).
What I do to generate a list of numbers on the fly is to do a cross-join on a small table of digits 0 through 9:
```
CREATE TABLE n (d NUMERIC);
INSER... |
311,730 | <p>I need a simple window with three input boxes and three labels (login name, password, and server node) and a button to execute the script. I do not want any third party programs that need to be installed on Windows. If it can be installed on Cygwin that would be great.</p>
| [
{
"answer_id": 311753,
"author": "Lou Franco",
"author_id": 3937,
"author_profile": "https://Stackoverflow.com/users/3937",
"pm_score": 1,
"selected": false,
"text": "<p>A lot of people used to use TCL/TK for this kind of thing (in cygwin). </p>\n\n<p>If it's just for Windows, then any ... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34531/"
] | I need a simple window with three input boxes and three labels (login name, password, and server node) and a button to execute the script. I do not want any third party programs that need to be installed on Windows. If it can be installed on Cygwin that would be great. | You might want to look at Tcl/Tk and the notion of starkits and starpacks. With the latter you can create a single-file windows executable so your end users wouldn't have to install anything other than this program.
By using tk 8.5 you'll also get the benefit of native windows widgets so the GUI can look very professi... |
311,734 | <p>I am creating a custom WPF control that let's say for simplicity sake has a vertical stack panel with a "title" TextBlock, followed by a ContentPresenter. I want the font size for the "title" to be 5 Points LARGER than the size used in the content, which is inherited by whatever container the user places this contro... | [
{
"answer_id": 311774,
"author": "Bill",
"author_id": 17595,
"author_profile": "https://Stackoverflow.com/users/17595",
"pm_score": 4,
"selected": true,
"text": "<p>I did it with an IValueConverter as follows:</p>\n\n<p>Created a class FontSizeConverter that derives from IValueConverter.... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17595/"
] | I am creating a custom WPF control that let's say for simplicity sake has a vertical stack panel with a "title" TextBlock, followed by a ContentPresenter. I want the font size for the "title" to be 5 Points LARGER than the size used in the content, which is inherited by whatever container the user places this control i... | I did it with an IValueConverter as follows:
Created a class FontSizeConverter that derives from IValueConverter. The Convert method adds 10 to the value, and the ConvertBack method subtracts 10.
```
public class FontSizeConverter : IValueConverter
{
#region IValueConverter Members
public object Convert(obj... |
311,763 | <p>I have a friend who is finishing up his masters degree in aerospace engineering. For his final project, he is on a small team tasked with writing a program for tracking weather balloons, rockets and satellites. The program receives input from a GPS device, does calculations with the data, and uses the results of tho... | [
{
"answer_id": 311769,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 3,
"selected": false,
"text": "<p>It's simpler to use split than a regex.</p>\n\n<pre><code>>>> line=\"$GPRMC,092204.999,4250.5589,S,14718.5084,E... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33383/"
] | I have a friend who is finishing up his masters degree in aerospace engineering. For his final project, he is on a small team tasked with writing a program for tracking weather balloons, rockets and satellites. The program receives input from a GPS device, does calculations with the data, and uses the results of those ... | splitting should do the trick. Here's a good way to extract the data, as well:
```
>>> line = "$GPRMC,199304.973,3248.7780,N,11355.7832,W,1,06,02.2,25722.5,M,,,*00"
>>> line = line.split(",")
>>> neededData = (float(line[2]), line[3], float(line[4]), line[5], float(line[9]))
>>> print neededData
(3248.7779999999998, '... |
311,768 | <p>I want to select about 4-5 rows from a table, then form a space separated string.</p>
<p>All of this is to be done in a stored procedure (SQL server 2005).</p>
<p>Is this possible?</p>
<p>I will then use this space-separated string and save it to another table.</p>
<p><b>Update</b></p>
<pre><code>SELECT *
FROM ... | [
{
"answer_id": 311780,
"author": "Micky McQuade",
"author_id": 12908,
"author_profile": "https://Stackoverflow.com/users/12908",
"pm_score": 0,
"selected": false,
"text": "<p>I think something like this will work:</p>\n\n<pre><code>DECLARE @whatever varchar(max) -- or varchar(1000) or w... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311768",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to select about 4-5 rows from a table, then form a space separated string.
All of this is to be done in a stored procedure (SQL server 2005).
Is this possible?
I will then use this space-separated string and save it to another table.
**Update**
```
SELECT *
FROM Users
WHERE userID < 10
```
output:
```
jo... | ```
DECLARE @firstnames varchar(max)
SELECT
@firstnames = COALESCE(@firstnames + ' ', '') + FirstName
FROM
Users
WHERE
UserId < 10
INSERT INTO OtherTable (OtherColumn) VALUES (@firstNames)
``` |
311,775 | <p>Code like this often happens:</p>
<pre><code>l = []
while foo:
# baz
l.append(bar)
# qux
</code></pre>
<p>This is really slow if you're about to append thousands of elements to your list, as the list will have to be constantly resized to fit the new elements.</p>
<p>In Java, you can create an ArrayList w... | [
{
"answer_id": 311783,
"author": "Ned Batchelder",
"author_id": 14343,
"author_profile": "https://Stackoverflow.com/users/14343",
"pm_score": 7,
"selected": false,
"text": "<p>Python lists have no built-in pre-allocation. If you really need to make a list, and need to avoid the overhead ... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] | Code like this often happens:
```
l = []
while foo:
# baz
l.append(bar)
# qux
```
This is really slow if you're about to append thousands of elements to your list, as the list will have to be constantly resized to fit the new elements.
In Java, you can create an ArrayList with an initial capacity. If yo... | Warning: This answer is contested. See comments.
------------------------------------------------
```
def doAppend( size=10000 ):
result = []
for i in range(size):
message= "some unique object %d" % ( i, )
result.append(message)
return result
def doAllocate( size=10000 ):
result=size*[... |
311,801 | <p>i’m trying to create a url string that works like this:</p>
<pre><code>/app/process/example.com/index.html
</code></pre>
<p>so in other words,</p>
<pre><code>/app/process/$URL
</code></pre>
<p>i then retrieve the url with </p>
<pre><code>$this->uri->segment(3);
</code></pre>
<p>the forward slashes in the... | [
{
"answer_id": 311806,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://Stackoverflow.com/users/658",
"pm_score": 1,
"selected": false,
"text": "<p>With CodeIgniter, the path of the URL corresponds to a controller, a function in the controller, and the parameters to ... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | i’m trying to create a url string that works like this:
```
/app/process/example.com/index.html
```
so in other words,
```
/app/process/$URL
```
i then retrieve the url with
```
$this->uri->segment(3);
```
the forward slashes in the URL will of course be a problem accessing uri segments, so i’ll go ahead and ... | I think the error message you are getting is not from codeigniter but from your web server.
I replicated this using Apache2 without even using CodeIgniter: I created a file index.php, and then accessed `index.php/a/b/c` - it worked fine. If I then tried to access `index.php/a/b/c%2F` I got a 404 from Apache.
I solve... |
311,816 | <p>When I generate CSS or JavaScript files using PHP I like to use .js.php or .css.php file extensions. so that I know what's going on.</p>
<p>Is there a way of associating these "compound" file extensions to their respective languages?</p>
| [
{
"answer_id": 311841,
"author": "Sherm Pendley",
"author_id": 27631,
"author_profile": "https://Stackoverflow.com/users/27631",
"pm_score": 1,
"selected": false,
"text": "<p>What I usually do is condense such \"compound\" extensions into one, following the tradition of condensing .tar.g... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2443/"
] | When I generate CSS or JavaScript files using PHP I like to use .js.php or .css.php file extensions. so that I know what's going on.
Is there a way of associating these "compound" file extensions to their respective languages? | I don't use NetBeans or PHP, but the following trick helped me in a similar setting:
```
<?php if(0) { ?><script><?php } ?>
# code goes here
<?php if(0) { ?></script><?php } ?>
```
Simply surround the js code with `<script>` or `<style>` tags that don't get rendered. No need to configure any special associations, as... |
311,818 | <p>How should I tell SDL to maximize the application window?</p>
<p>I'm creating the window with these flags: SDL_OPENGL | SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE.</p>
| [
{
"answer_id": 312129,
"author": "Peter Shinners",
"author_id": 17209,
"author_profile": "https://Stackoverflow.com/users/17209",
"pm_score": 0,
"selected": false,
"text": "<p>There are additional environment variables that can be set to control the display window. Unfortunately the sdl ... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38256/"
] | How should I tell SDL to maximize the application window?
I'm creating the window with these flags: SDL\_OPENGL | SDL\_HWSURFACE | SDL\_DOUBLEBUF | SDL\_RESIZABLE. | This functionality is controlled by the window manager when you use the SDL\_RESIZABLE flag. To simulate the maximizing a window with SDL you would need to first determine the size the window would occupy when maximized. Then you would call [SDL\_SetVideoMode](http://libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode) with th... |
311,840 | <p>I am looking for a tool like <a href="http://linux.die.net/man/1/ltrace" rel="noreferrer">ltrace</a> or <a href="http://linux.die.net/man/1/strace" rel="noreferrer">strace</a> that can trace locally defined functions in an executable. ltrace only traces dynamic library calls and strace only traces system calls. Fo... | [
{
"answer_id": 311847,
"author": "activout.se",
"author_id": 20444,
"author_profile": "https://Stackoverflow.com/users/20444",
"pm_score": 0,
"selected": false,
"text": "<p>Hopefully the <a href=\"http://valgrind.org/info/tools.html\" rel=\"nofollow noreferrer\">callgrind or cachegrind t... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25222/"
] | I am looking for a tool like [ltrace](http://linux.die.net/man/1/ltrace) or [strace](http://linux.die.net/man/1/strace) that can trace locally defined functions in an executable. ltrace only traces dynamic library calls and strace only traces system calls. For example, given the following C program:
```
#include <stdi... | Assuming you only want to be notified for specific functions, you can do it like this:
compile with debug informations (as you already have symbol informations, you probably also have enough debugs in)
given
```
#include <iostream>
int fac(int n) {
if(n == 0)
return 1;
return n * fac(n-1);
}
int ma... |
311,857 | <p>I'm embedding MSBuild directly into a more complex build tool. The relevant code looks roughly like this:</p>
<pre><code>// assume 'using Microsoft.Build.BuildEngine;'
Engine e = Engine();
BuildPropertyGroup props = new BuildPropertyGroup();
props.SetProperty( "Configuration", Config.BuildConfig );
e.BuildProjectFi... | [
{
"answer_id": 311903,
"author": "Klathzazt",
"author_id": 35223,
"author_profile": "https://Stackoverflow.com/users/35223",
"pm_score": 0,
"selected": false,
"text": "<p>I had done something similar by running msbuild from command. This starts a process which you could terminate.</p>\n... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18529/"
] | I'm embedding MSBuild directly into a more complex build tool. The relevant code looks roughly like this:
```
// assume 'using Microsoft.Build.BuildEngine;'
Engine e = Engine();
BuildPropertyGroup props = new BuildPropertyGroup();
props.SetProperty( "Configuration", Config.BuildConfig );
e.BuildProjectFile( projectFil... | It appears is that there's no official way to do this.
For C# builds it's not a huge deal, since they are typically really fast. The best workaround I've come up with for C++ builds is to locate the child processes that are created by the VC build process and terminate them, which stops the MSBuild build. This can be ... |
311,873 | <p><strong>NOTE: the original question is moot but scan to the bottom for something relevant.</strong></p>
<p>I have a query I want to optimize that looks something like this:</p>
<pre><code>select cols from tbl where col = "some run time value" limit 1;
</code></pre>
<p>I want to know what keys are being used but w... | [
{
"answer_id": 311914,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 3,
"selected": false,
"text": "<p>You are getting \"Impossible WHERE noticed\" because the value you specified is not in the column, not just becau... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1343/"
] | **NOTE: the original question is moot but scan to the bottom for something relevant.**
I have a query I want to optimize that looks something like this:
```
select cols from tbl where col = "some run time value" limit 1;
```
I want to know what keys are being used but whatever I pass to explain, it is able to optim... | >
> For example say my client side code is generating a query with a number in it's where clause.
>
>
> Some times the number will result in an impossible where clause other times it won't.
>
>
> How can I use explain to examine how well optimized the query is?
>
>
>
`MySQL` builds different query plans for di... |
311,876 | <p>Hey everyone. I'm trying to make a swing GUI with a button and a label on it. im using a border layout and the label ( in the north field ) shows up fine, but the button takes up the rest of the frame (it's in the center field). any idea how to fix this?</p>
| [
{
"answer_id": 311878,
"author": "OscarRyz",
"author_id": 20654,
"author_profile": "https://Stackoverflow.com/users/20654",
"pm_score": 5,
"selected": true,
"text": "<p>You have to add the button to another panel, and then add that panel to the frame.</p>\n\n<p>It turns out the BorderLay... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39984/"
] | Hey everyone. I'm trying to make a swing GUI with a button and a label on it. im using a border layout and the label ( in the north field ) shows up fine, but the button takes up the rest of the frame (it's in the center field). any idea how to fix this? | You have to add the button to another panel, and then add that panel to the frame.
It turns out the BorderLayout expands what ever component is in the middle
Your code should look like this now:
Before
```
public static void main( String [] args ) {
JLabel label = new JLabel("Some info");
JButton button = ... |
311,882 | <p>I often hear the terms 'statically linked' and 'dynamically linked', often in reference to code written in <a href="http://en.wikipedia.org/wiki/C_%28programming_language%29" rel="noreferrer">C</a>, <a href="https://en.wikipedia.org/wiki/C++" rel="noreferrer">C++</a> or <a href="http://en.wikipedia.org/wiki/C_Sharp_... | [
{
"answer_id": 311886,
"author": "John D. Cook",
"author_id": 25188,
"author_profile": "https://Stackoverflow.com/users/25188",
"pm_score": 5,
"selected": false,
"text": "<p>Statically linked libraries are linked in at compile time. Dynamically linked libraries are loaded at run time. S... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115/"
] | I often hear the terms 'statically linked' and 'dynamically linked', often in reference to code written in [C](http://en.wikipedia.org/wiki/C_%28programming_language%29), [C++](https://en.wikipedia.org/wiki/C++) or [C#](http://en.wikipedia.org/wiki/C_Sharp_%28programming_language%29). What are they, what exactly are th... | There are (in most cases, discounting interpreted code) two stages in getting from source code (what you write) to executable code (what you run).
The first is compilation which turns source code into object modules.
The second, linking, is what combines object modules together to form an executable.
The distinction... |
311,883 | <p>I've got a method JSNI that calls a Java method that take a Hasmap as input.
I've tried </p>
<pre><code>handler.@com.mypackage::myMethod(Ljava/util/Hashmap;)(myHashMap);
handler.@com.mypackage::myMethod(Ljava/util/Hashmap<Ljava/lang/String,Ljava/lang/String>;)(myHashMap);
</code></pre>
<p>I'm can't seem to ... | [
{
"answer_id": 317227,
"author": "rustyshelf",
"author_id": 6044,
"author_profile": "https://Stackoverflow.com/users/6044",
"pm_score": 1,
"selected": true,
"text": "<p>Can you post the error that your getting, and also what kind of javascript object your trying to pass as a hashmap. I'm... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21387/"
] | I've got a method JSNI that calls a Java method that take a Hasmap as input.
I've tried
```
handler.@com.mypackage::myMethod(Ljava/util/Hashmap;)(myHashMap);
handler.@com.mypackage::myMethod(Ljava/util/Hashmap<Ljava/lang/String,Ljava/lang/String>;)(myHashMap);
```
I'm can't seem to define the correct type signatur... | Can you post the error that your getting, and also what kind of javascript object your trying to pass as a hashmap. I'm assuming you're getting a compile time error?
Here is a good start for JSNI documentation:
[GWT JSNI doc](http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&... |
311,888 | <p>I have a syntax highlighting function in vb.net. I use regular expressions to match "!IF" for instance and then color it blue. This works perfect until I tried to figure out how to do comments. </p>
<p>The language I'm writing this for a comment can either be if the line starts with a single quote ' OR if anywhere... | [
{
"answer_id": 311895,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 4,
"selected": true,
"text": "<p>Something along the lines of:</p>\n\n<pre><code>^(\\'[^\\r\\n]+)$|(''[^\\r\\n]+)$\n</code></pre>\n\n<p>should give you the co... | 2008/11/22 | [
"https://Stackoverflow.com/questions/311888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39143/"
] | I have a syntax highlighting function in vb.net. I use regular expressions to match "!IF" for instance and then color it blue. This works perfect until I tried to figure out how to do comments.
The language I'm writing this for a comment can either be if the line starts with a single quote ' OR if anywhere in the lin... | Something along the lines of:
```
^(\'[^\r\n]+)$|(''[^\r\n]+)$
```
should give you the commented line (of part of the line) in group n° 1
Actually, you do not even need group
```
^\'[^\r\n]+$|''[^\r\n]+$
```
If it finds something, it is a comment.
```
"(^'|'').*$"
```
mentioned by Boaz would work if applied o... |
311,936 | <p>I've read a few instances in reading mathematics and computer science that use the equivalence symbol <strong><code>≡</code></strong>, (basically an '=' with three lines) and it always makes sense to me to read this as if it were equality. What is the difference between these two concepts?</p>
| [
{
"answer_id": 311941,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 3,
"selected": false,
"text": "<p>In languages that I have seen that differentiate between equality and equivalence, equality usually means the typ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/311936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30529/"
] | I've read a few instances in reading mathematics and computer science that use the equivalence symbol **`≡`**, (basically an '=' with three lines) and it always makes sense to me to read this as if it were equality. What is the difference between these two concepts? | [Wikipedia: Equivalence relation](http://en.wikipedia.org/wiki/Equivalence_relation):
>
> In mathematics, an equivalence
> relation is a binary relation between
> two elements of a set which groups
> them together as being "equivalent" in
> some way. Let a, b, and c be arbitrary
> elements of some set X. Then "a ~ b"... |
311,939 | <p>So the following rewrite rules always seem to fire. This has the effect of hiding another domain that I am hosting on the server?</p>
<p>I can't seem to figure out what's wrong and it is time to call in the experts:</p>
<pre><code>RewriteEngine on
RewriteCond %{HTTP_HOST} ^danielhonig.com
RewriteRule ^(.*)$ http:... | [
{
"answer_id": 311945,
"author": "mthurlin",
"author_id": 39991,
"author_profile": "https://Stackoverflow.com/users/39991",
"pm_score": 2,
"selected": false,
"text": "<p>Place the rewrite rules inside your <code><VirtualHost></code> directive, then it will not affect your other dom... | 2008/11/23 | [
"https://Stackoverflow.com/questions/311939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1129162/"
] | So the following rewrite rules always seem to fire. This has the effect of hiding another domain that I am hosting on the server?
I can't seem to figure out what's wrong and it is time to call in the experts:
```
RewriteEngine on
RewriteCond %{HTTP_HOST} ^danielhonig.com
RewriteRule ^(.*)$ http://www.danielhonig.com/... | Place the rewrite rules inside your `<VirtualHost>` directive, then it will not affect your other domain. |
311,948 | <p>How do I make gdb print functions of interest as they are called, indented according to how deep in the stack they are?</p>
<p>I want to be able to say something like (made up):</p>
<pre><code>(gdb) trace Foo* Bar* printf
</code></pre>
<p>And have gdb print all functions which begin with Foo or Bar, as they are c... | [
{
"answer_id": 311991,
"author": "Piotr Lesnicki",
"author_id": 38796,
"author_profile": "https://Stackoverflow.com/users/38796",
"pm_score": 1,
"selected": false,
"text": "<p>Did you see litb's excellent anwser to a similar post <a href=\"https://stackoverflow.com/questions/311840/tool-... | 2008/11/23 | [
"https://Stackoverflow.com/questions/311948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do I make gdb print functions of interest as they are called, indented according to how deep in the stack they are?
I want to be able to say something like (made up):
```
(gdb) trace Foo* Bar* printf
```
And have gdb print all functions which begin with Foo or Bar, as they are called. Kind of like gnu cflow, ex... | In your case I would turn to the `define` command in gdb, which allows you to define a function, which can take up to 10 arguments.
You can pass in the names of functions to "trace" as arguments to the function you define, or record them all in the function itself. I'd do something like the following
```
define funct... |
311,949 | <p>Is there any good way to unit test destructors? Like say I have a class like this (contrived) example:</p>
<pre><code>class X
{
private:
int *x;
public:
X()
{
x = new int;
}
~X()
{
delete x;
}
int *getX() {return x;}
const int *getX() const {return x;}
};
</... | [
{
"answer_id": 311976,
"author": "Matthew Crumley",
"author_id": 2214,
"author_profile": "https://Stackoverflow.com/users/2214",
"pm_score": 0,
"selected": false,
"text": "<p>Some compilers will overwrite deleted memory with a known pattern in debug mode to help detect access to dangling... | 2008/11/23 | [
"https://Stackoverflow.com/questions/311949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] | Is there any good way to unit test destructors? Like say I have a class like this (contrived) example:
```
class X
{
private:
int *x;
public:
X()
{
x = new int;
}
~X()
{
delete x;
}
int *getX() {return x;}
const int *getX() const {return x;}
};
```
Is there an... | There may be something to be said for dependency injection. Instead of creating an object (in this case an int, but in a non-contrived case more likely a user-defined type) in its constructor, the object is passed as a parameter to the constructor. If the object is created later, then a factory is passed to the constru... |
311,955 | <p>I have an application which is a relatively old. Through some minor changes, it builds nearly perfectly with Visual C++ 2008. One thing that I've noticed is that my "debug console" isn't quite working right. Basically in the past, I've use <code>AllocConsole()</code> to create a console for my debug output to go to.... | [
{
"answer_id": 311982,
"author": "DarthPingu",
"author_id": 37199,
"author_profile": "https://Stackoverflow.com/users/37199",
"pm_score": 0,
"selected": false,
"text": "<p>The ios library has a function that lets you re-sync C++ IO to whatever the standard C IO is using: ios::sync_with_s... | 2008/11/23 | [
"https://Stackoverflow.com/questions/311955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13430/"
] | I have an application which is a relatively old. Through some minor changes, it builds nearly perfectly with Visual C++ 2008. One thing that I've noticed is that my "debug console" isn't quite working right. Basically in the past, I've use `AllocConsole()` to create a console for my debug output to go to. Then I would ... | Updated Feb 2018:
-----------------
Here is the latest version of a function which fixes this problem:
```
void BindCrtHandlesToStdHandles(bool bindStdIn, bool bindStdOut, bool bindStdErr)
{
// Re-initialize the C runtime "FILE" handles with clean handles bound to "nul". We do this because it has been
// obse... |
311,970 | <p>I am trying to create a custom accordion for my page to that display my posts. I have it in list format using HTML and I am trying to create an effect when you click each header to expand to show more information.</p>
<p>But I don't want to have say six blocks of code for six of the <code><li></code> elements... | [
{
"answer_id": 311977,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 3,
"selected": true,
"text": "<p>Did you take a look at <a href=\"http://roshanbh.com.np/2008/03/expandable-collapsible-toggle-pane-jquery.html\" rel=\"nofoll... | 2008/11/23 | [
"https://Stackoverflow.com/questions/311970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to create a custom accordion for my page to that display my posts. I have it in list format using HTML and I am trying to create an effect when you click each header to expand to show more information.
But I don't want to have say six blocks of code for six of the `<li>` elements I have on the page.
Is th... | Did you take a look at [this tutorial](http://roshanbh.com.np/2008/03/expandable-collapsible-toggle-pane-jquery.html) ?
Because, as this [example illustrates](http://roshanbh.com.np/examples/exapandable-panel/), one does not need multiple conditions to achieve this.
```
<script type="text/javascript" src="jquery.js">... |
312,006 | <p>I have a system that creates an order and that order can be billed to a house account, sent Cash on Delivery (COD), or charged to a credit card. I've created the following tables:</p>
<p>ORDERS<br/>
order_id<br/>
billingoption_id</p>
<p>BILLINGOPTIONS<br/>
billingoption_id<br/></p>
<p>I'm unsure of how the next ... | [
{
"answer_id": 312012,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 3,
"selected": false,
"text": "<p>Focus on things. Actual things. Try to describe things simply, directly, and in natural language first.</p>\n\n<p>Then... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37347/"
] | I have a system that creates an order and that order can be billed to a house account, sent Cash on Delivery (COD), or charged to a credit card. I've created the following tables:
ORDERS
order\_id
billingoption\_id
BILLINGOPTIONS
billingoption\_id
I'm unsure of how the next table should be built for the b... | You can do it either way: a big honking `billingoptions` table that has fields that encompasses all of the types, with NULLs for fields that don't apply to a given type, or a bunch of baby tables that "star off" of a parent `billingoptions` table. Both have their advantages and disadvantages.
For the big honking table... |
312,009 | <p>I have two tables in a DataSet in .NET. I want to join them on an ID column. Then I want a DataGridView to display two columns from the first table and one column from the second table.</p>
<p>If it makes it easier, the relation between the two tables is one-to-one.</p>
<p>Can it be done?</p>
| [
{
"answer_id": 312686,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "<p>Well, is it read only? In .NET 3.5 / C# 3.0 you could probably use a LINQ join and an anonymous output type pretty... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29281/"
] | I have two tables in a DataSet in .NET. I want to join them on an ID column. Then I want a DataGridView to display two columns from the first table and one column from the second table.
If it makes it easier, the relation between the two tables is one-to-one.
Can it be done? | Well, is it read only? In .NET 3.5 / C# 3.0 you could probably use a LINQ join and an anonymous output type pretty easily:
```
DataTable left = new DataTable
{
Columns = { {"PK", typeof(int)}, {"Name", typeof(string)}},
Rows = {{1,"abc"},{2,"def"}}
}, right = new DataTab... |
312,013 | <p>I am not sure if I am missing something grotesquely obvious or what, but I can't seem to figure out how to efficiently access tables in a relational database. I am using PostgreSQL for the database server (and Npgsql for its access) and C# with Mono 2.0.</p>
<p>Say I have the table created by the following <code>C... | [
{
"answer_id": 312028,
"author": "Michael Trausch",
"author_id": 26534,
"author_profile": "https://Stackoverflow.com/users/26534",
"pm_score": 0,
"selected": false,
"text": "<p>Heh... turns out I should have just <em>tried</em> it instead of asking. Can't find any documentation to say t... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26534/"
] | I am not sure if I am missing something grotesquely obvious or what, but I can't seem to figure out how to efficiently access tables in a relational database. I am using PostgreSQL for the database server (and Npgsql for its access) and C# with Mono 2.0.
Say I have the table created by the following `CREATE TABLE` and... | If you want easy go with an ORM framework.
If you want max performance this should work.
Just remember caching is alwast fastest :)
Top example is also faster because there is no conversion. |
312,015 | <p>I'd like a textbox that allows for certain text within to be "constant" and uneditable while the rest of the text is editable. For instance, I'd like to define a template like this:</p>
<pre><code><Name:>[]
<Address:>[] <City>:[]
</code></pre>
<p>So that the user could later enter:</p>
<pre><co... | [
{
"answer_id": 312023,
"author": "Frank Krueger",
"author_id": 338,
"author_profile": "https://Stackoverflow.com/users/338",
"pm_score": 3,
"selected": true,
"text": "<p>I don't know of any ready-made components. But you could try this simple method.</p>\n\n<ol>\n<li>Create a normal mult... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13257/"
] | I'd like a textbox that allows for certain text within to be "constant" and uneditable while the rest of the text is editable. For instance, I'd like to define a template like this:
```
<Name:>[]
<Address:>[] <City>:[]
```
So that the user could later enter:
```
<Name:>[Stefan]
<Address:>[Nowhere] <City>:[Alaska]
... | I don't know of any ready-made components. But you could try this simple method.
1. Create a normal multi-line text box control
2. Create a regex-based template that has `(.*)` or `([a-z]*)` or whatever wherever you want the user to add text.
3. Whenever the text is changed, checked if it still matches the regex. If i... |
312,022 | <p>is there any way to make IE6 understand double classes,
say I have a class MenuButton with a color class and possibly a clicked class;
like :</p>
<pre><code>.LeftContent a.MenuButton {..general rules..}
.LeftContent a.MenuButton.Orange {..sets background-image..}
.LeftContent a.MenuButton.Clicked {...hum ta dum... | [
{
"answer_id": 312038,
"author": "Borgar",
"author_id": 27388,
"author_profile": "https://Stackoverflow.com/users/27388",
"pm_score": 6,
"selected": true,
"text": "<p>IE6 doesn't support multiple class selectors. The reason you see a change with the <code>Orange</code> class is because <... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/447694/"
] | is there any way to make IE6 understand double classes,
say I have a class MenuButton with a color class and possibly a clicked class;
like :
```
.LeftContent a.MenuButton {..general rules..}
.LeftContent a.MenuButton.Orange {..sets background-image..}
.LeftContent a.MenuButton.Clicked {...hum ta dum...}
```
Now... | IE6 doesn't support multiple class selectors. The reason you see a change with the `Orange` class is because `a.MenuButton.Orange` is interpreted by IE6 as `a.Orange`.
I recommend structuring your markup in such a way that you can work around this:
```
<div class="leftcontent">
<ul class="navmenu">
<li><a cla... |
312,024 | <p>I have a class Agent with a property Id</p>
<p>Given a collection of Agents I need to check if any of them have duplicate Ids.</p>
<p>I am currently doing this with a hash table but am trying to get Linq-ified, what's a good way of doing this?</p>
| [
{
"answer_id": 312033,
"author": "Yona",
"author_id": 40007,
"author_profile": "https://Stackoverflow.com/users/40007",
"pm_score": 1,
"selected": false,
"text": "<pre><code>foreach(var agent in Agents) {\n if(Agents.Count(a => a.ID == agent.ID) > 1)\n Console.WriteLine(\... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] | I have a class Agent with a property Id
Given a collection of Agents I need to check if any of them have duplicate Ids.
I am currently doing this with a hash table but am trying to get Linq-ified, what's a good way of doing this? | Similar to Y Low's approach,
**Edited:**
```
var duplicates = agents.GroupBy(a => a.ID).Where(a=>a.Count() > 1);
foreach (var agent in duplicates)
{
Console.WriteLine(agent.Key.ToString());
}
``` |
312,044 | <p>I want to set the width of a TextBlock based on the width of its container, minus the margins set on the TextBlock.</p>
<p>Here is my code:</p>
<pre><code><TextBlock x:Name="txtStatusMessages"
Width="{Binding ElementName=LayoutRoot,Path=ActualWidth }"
TextWrapping="WrapWithOverflo... | [
{
"answer_id": 312171,
"author": "Danny Varod",
"author_id": 38368,
"author_profile": "https://Stackoverflow.com/users/38368",
"pm_score": 5,
"selected": true,
"text": "<p>you're supposed to use the other control as the source, not the parameter.\nThe parameter has to be a constant and i... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6514/"
] | I want to set the width of a TextBlock based on the width of its container, minus the margins set on the TextBlock.
Here is my code:
```
<TextBlock x:Name="txtStatusMessages"
Width="{Binding ElementName=LayoutRoot,Path=ActualWidth }"
TextWrapping="WrapWithOverflow"
Foregroun... | you're supposed to use the other control as the source, not the parameter.
The parameter has to be a constant and in your case can be -5.
I'm not near VS at the moment so the syntax maybe inaccurate, however, it is something like:
```
Width="{Binding ElementName=LayoutRoot, Path=ActualWidth,
Converter={StaticResource... |
312,054 | <p>So I just spent 5 hours troubleshooting a problem which turned out to be due not only to the <a href="https://web.archive.org/web/20141209040727/http://classicasp.aspfaq.com/general/what-is-wrong-with-isnumeric.html" rel="nofollow noreferrer">old unreliable</a> <code>ISNUMERIC</code> but it looks like my problem onl... | [
{
"answer_id": 312294,
"author": "bugmagnet",
"author_id": 426,
"author_profile": "https://Stackoverflow.com/users/426",
"pm_score": 1,
"selected": false,
"text": "<p>Are you ever going to be handling number systems outside of your own (human) language, like Chinese etc? If so, I'd sugge... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18255/"
] | So I just spent 5 hours troubleshooting a problem which turned out to be due not only to the [old unreliable](https://web.archive.org/web/20141209040727/http://classicasp.aspfaq.com/general/what-is-wrong-with-isnumeric.html) `ISNUMERIC` but it looks like my problem only appears when the UDF in which `ISNUMERIC` is decl... | You can use the T-SQL functions TRY\_CAST() or TRY\_CONVERT() if you're running SQL Server 2012 as Bacon Bits mentions in the comments:
```
SELECT CASE WHEN TRY_CAST('foo' AS INT) IS NULL THEN 0 ELSE 1 END
SELECT CASE WHEN TRY_CAST(1 AS INT) IS NULL THEN 0 ELSE 1 END
```
If you're using SQL 2008 R2 or older, you'll... |
312,055 | <p>Some repository clones I have allow me to do this:</p>
<pre><code>% git pull
% git push
</code></pre>
<p>But other repositories require me to type:</p>
<pre><code>% git pull origin master
% git push origin master
</code></pre>
<p>I think I am missing something in the latter case - does anyone know what is (not) ... | [
{
"answer_id": 312061,
"author": "Brian Gianforcaro",
"author_id": 3415,
"author_profile": "https://Stackoverflow.com/users/3415",
"pm_score": 5,
"selected": true,
"text": "<p>If you cd into your repository directory and then open up your <strong>.git/config</strong> file in an editor.</... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14356/"
] | Some repository clones I have allow me to do this:
```
% git pull
% git push
```
But other repositories require me to type:
```
% git pull origin master
% git push origin master
```
I think I am missing something in the latter case - does anyone know what is (not) going on here? I am using the latest git version,... | If you cd into your repository directory and then open up your **.git/config** file in an editor.
Append this to the end of the file:
```
[branch "master"]
remote = origin
merge = refs/heads/master
```
This is pretty much just an alias so git knows by default to pull from origin master. |
312,103 | <p>I know how to do this using for loops. Is it possible to do something like this using LINQ or lambdas?</p>
<pre><code>int[] a = { 10, 20, 30 };
int[] b = { 2, 4, 10 };
int[] c = a * b; //resulting array should be { 20, 80, 300 }
</code></pre>
| [
{
"answer_id": 312126,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 2,
"selected": false,
"text": "<p>You can do something like this:</p>\n\n<pre><code>int[] a = {10, 20, 30};\nint[] b = {2, 4, 10};\n\nif (a.Le... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2470/"
] | I know how to do this using for loops. Is it possible to do something like this using LINQ or lambdas?
```
int[] a = { 10, 20, 30 };
int[] b = { 2, 4, 10 };
int[] c = a * b; //resulting array should be { 20, 80, 300 }
``` | EDIT: The code below will work, but it's not as readable as using an explicit method. LINQ is great where it definitely *adds* to readability... but this isn't one of those cases.
This is a briefer version of CMS's answer - the extra `let` isn't required, and when you're just doing a projection it's simpler to just us... |
312,115 | <p>I'm getting some really wierd linking errors from a class I wrote. I am completely unable to find anything that will describe what is happening. </p>
<p>Visual Studio (Windows XP)</p>
<blockquote>
<p>players.obj : error LNK2019: unresolved external symbol "public: __thiscall TreeNode::TreeNode(void)" (??0?$TreeN... | [
{
"answer_id": 312127,
"author": "strager",
"author_id": 39992,
"author_profile": "https://Stackoverflow.com/users/39992",
"pm_score": 0,
"selected": false,
"text": "<p>Are you forgetting to link the object file containing the function bodies for your class functions?</p>\n\n<p>E.g. you'... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16204/"
] | I'm getting some really wierd linking errors from a class I wrote. I am completely unable to find anything that will describe what is happening.
Visual Studio (Windows XP)
>
> players.obj : error LNK2019: unresolved external symbol "public: \_\_thiscall TreeNode::TreeNode(void)" (??0?$TreeNode@VPlayer@@@@QAE@XZ) re... | When you define your template in a .cpp file, you have to explicitly instantiate it with all the types / template parameters known the template will be used beforehand like this (put it in the .cpp file):
```
template class TreeNode<Player>;
```
If you don't know with which template parameters the template will be u... |
312,116 | <p>I have a simple function in which an array is declared with size
depending on the parameter which is int.</p>
<pre><code> void f(int n){
char a[n];
};
int main() {
return 0;
}
</code></pre>
<p>This piece of code compiles fine on <a href="http://en.wikipedia.org/wiki/G%2B%2B" rel="no... | [
{
"answer_id": 312120,
"author": "Jim Buck",
"author_id": 2666,
"author_profile": "https://Stackoverflow.com/users/2666",
"pm_score": 3,
"selected": false,
"text": "<p>Your method of allocating from the stack is a g++ extension. To do the equivalent under MSVC, you need to use _alloca:</... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34051/"
] | I have a simple function in which an array is declared with size
depending on the parameter which is int.
```
void f(int n){
char a[n];
};
int main() {
return 0;
}
```
This piece of code compiles fine on [GNU C++](http://en.wikipedia.org/wiki/G%2B%2B), but not on MSVC 2005.
I get th... | What you have found it one of the Gnu compiler's extensions to the C++ language. In this case, Visual C++ is completely correct. Arrays in C++ must be defined with a size that is a compile-time constant expression.
There was a feature added to C in the 1999 update to that language called variable length arrays, where ... |
312,118 | <p>I'm reading in a large text file with 1.4 million lines that is 24 MB in size (average 17 characters a line).</p>
<p>I'm using Delphi 2009 and the file is ANSI but gets converted to Unicode upon reading, so fairly you can say the text once converted is 48 MB in size.</p>
<p>( Edit: I found a much simpler example .... | [
{
"answer_id": 312165,
"author": "Loren Pechtel",
"author_id": 10659,
"author_profile": "https://Stackoverflow.com/users/10659",
"pm_score": 1,
"selected": false,
"text": "<p>Are you relying on Windows to tell you how much memory the program is using? It's notorious for overstating the ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30176/"
] | I'm reading in a large text file with 1.4 million lines that is 24 MB in size (average 17 characters a line).
I'm using Delphi 2009 and the file is ANSI but gets converted to Unicode upon reading, so fairly you can say the text once converted is 48 MB in size.
( Edit: I found a much simpler example ... )
I'm loading... | You asked me personally to answer your question here. I don't know the precise reason why you're seeing such high memory usage, but you need to remember that TStringList does a lot more than just loading your file. Each of these steps requires memory that may result in memory fragmentation. TStringList needs to load yo... |
312,124 | <p>How do I apply a <em>repeating</em> texture that always maintains its original scale (1 pixel in the texture = 1 pixel on screen), regardless of the vertex data it is applied with.</p>
<p>I realize this is not the most usual task, but is it possible to easily set opengl to do this, or do I need to apply some kind o... | [
{
"answer_id": 312128,
"author": "strager",
"author_id": 39992,
"author_profile": "https://Stackoverflow.com/users/39992",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not really sure, but try something like this:</p>\n\n<p>Take your model matrix, perspective matrix, and stuff like ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36182/"
] | How do I apply a *repeating* texture that always maintains its original scale (1 pixel in the texture = 1 pixel on screen), regardless of the vertex data it is applied with.
I realize this is not the most usual task, but is it possible to easily set opengl to do this, or do I need to apply some kind of mask to vertex ... | Create the 3D object in question, without displaying it.
You can get the bounds of the object as pixel locations by using gluProject (to get the pixels that represent the object's edges. You can then use gluUnProject to map the intervening pixels to the object's coordinates.
Then, you start your draw over, and ma... |
312,150 | <p>Getting started with jquery and having trouble getting hello world type example going for asp.net mvc. I get a runtime error "object expected" when trying to load a page with this script. </p>
<p>A. Where should script tags be placed in a master page?
B. What might I be doing wrong? There are definitely "a" element... | [
{
"answer_id": 312162,
"author": "Dan Esparza",
"author_id": 19020,
"author_profile": "https://Stackoverflow.com/users/19020",
"pm_score": 3,
"selected": false,
"text": "<p>Hmmm ... </p>\n\n<p>To answer your first question: They should be put in the <code><head></code> element.</p... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Getting started with jquery and having trouble getting hello world type example going for asp.net mvc. I get a runtime error "object expected" when trying to load a page with this script.
A. Where should script tags be placed in a master page?
B. What might I be doing wrong? There are definitely "a" elements in my pa... | B) I checked your inline script on quick test page and it works ok, so i advice using **Firefox** with **FireBug** plugin installed for finding the problem:
* In Firebug's "script" tab use the Watch window on the right to insert and check parts of your script and see what do they return.
* I'd start with putting `$` i... |
312,168 | <p>So I was making a class the other day and used Eclipse's method to create the equals method when I realized that it generated the following <strong>working</strong> code:</p>
<pre><code>class Test {
private int privateInt;
[...]
public boolean equals(Object obj) {
[...]
Test t = (Test) obj;
if ( t... | [
{
"answer_id": 312174,
"author": "mthurlin",
"author_id": 39991,
"author_profile": "https://Stackoverflow.com/users/39991",
"pm_score": 2,
"selected": false,
"text": "<p>You are referencing it from within the same class. Thus, you know what you are doing and does not need to be protected... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2644/"
] | So I was making a class the other day and used Eclipse's method to create the equals method when I realized that it generated the following **working** code:
```
class Test {
private int privateInt;
[...]
public boolean equals(Object obj) {
[...]
Test t = (Test) obj;
if ( t.privateInt == privateInt )... | It's accessible from different instances of the same class.
According to [this page](http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html) (bolding mine):
>
> At the member level, you can also use the public modifier or no modifier (package-private) just as with top-level classes, and with the same... |
312,185 | <p>I am new to C++ on MacOS.
I got an error when I used <code>kbhit()</code> in my program.</p>
<p>I used <code>#include<conio.h></code> but got error too, so I searched and test with <code>#include<curses.h></code> but error is still remained.</p>
| [
{
"answer_id": 312189,
"author": "strager",
"author_id": 39992,
"author_profile": "https://Stackoverflow.com/users/39992",
"pm_score": 1,
"selected": false,
"text": "<p>kbhit() is non-standard. In fact, I don't believe there is a standard function for detecting keyboard input. The best... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am new to C++ on MacOS.
I got an error when I used `kbhit()` in my program.
I used `#include<conio.h>` but got error too, so I searched and test with `#include<curses.h>` but error is still remained. | No idea if this would work on Mac, but here's some code that I've used to get a single keypress on Linux.
```
int mygetch() {
char ch;
int error;
static struct termios Otty, Ntty;
fflush(stdout);
tcgetattr(0, &Otty);
Ntty = Otty;
Ntty.c_iflag = 0; /* input mode */
Ntty.c_o... |
312,188 | <p>I am given an integer (lets call it x) and I need to generate an array of arrays, where each subarray is a list of elements which are one of a given set of integers, and the sum of all of the elements of each subarray is x. The array of arrays needs to contain all possible distinct subarrays of this form.</p>
<p>Fo... | [
{
"answer_id": 312209,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": 0,
"selected": false,
"text": "<p>Since you don't know the size of the \"subarrays,\" I suggest you use one of the collections from Java such as <a h... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40036/"
] | I am given an integer (lets call it x) and I need to generate an array of arrays, where each subarray is a list of elements which are one of a given set of integers, and the sum of all of the elements of each subarray is x. The array of arrays needs to contain all possible distinct subarrays of this form.
For example,... | For the storage, you probably want a LinkedList of HashSets:
```
LinkedList<HashSet<Integer>> l;
```
For the problem: This is the SubSet problem, which is NP-Complete, so I don't think there's a known, fast way to do it. I haven't taken any optimization theory, so the best I could do is to just search through the po... |
312,213 | <p>I want to use part of the output of a command run from the command line in another xterm, or as part of a different command. For instance: </p>
<pre><code>> grep error error.log
error: can't find file ~/<some very long path>/thisfile
</code></pre>
<p>and I want to do this:</p>
<pre><code>>ls ~/<s... | [
{
"answer_id": 312215,
"author": "strager",
"author_id": 39992,
"author_profile": "https://Stackoverflow.com/users/39992",
"pm_score": 7,
"selected": true,
"text": "<p>You can use GNU screen's copy and paste commands.</p>\n\n<p>Quick tutorial:</p>\n\n<ol>\n<li>Open screen: <code>screen</... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1084/"
] | I want to use part of the output of a command run from the command line in another xterm, or as part of a different command. For instance:
```
> grep error error.log
error: can't find file ~/<some very long path>/thisfile
```
and I want to do this:
```
>ls ~/<some very long path>/
```
I know two ways to do this:... | You can use GNU screen's copy and paste commands.
Quick tutorial:
1. Open screen: `screen` (or `screen myprog my args here`)
2. Run your program, producing output you want copied
3. Enter copy mode: `Control`+`a`+`[`
4. Move your cursor to the start point
5. Hit `Enter`
6. Move your cursor to the end point
7. Hit `En... |
312,214 | <p>I already have a deploy.rb that can deploy my app on my production server. </p>
<p>My app contains a custom rake task (a .rake file in the lib/tasks directory). </p>
<p>I'd like to create a cap task that will remotely run that rake task.</p>
| [
{
"answer_id": 312227,
"author": "Richard Poirier",
"author_id": 26842,
"author_profile": "https://Stackoverflow.com/users/26842",
"pm_score": 6,
"selected": true,
"text": "<pre><code>run(\"cd #{deploy_to}/current && /usr/bin/env rake `<task_name>` RAILS_ENV=production\")\n... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26842/"
] | I already have a deploy.rb that can deploy my app on my production server.
My app contains a custom rake task (a .rake file in the lib/tasks directory).
I'd like to create a cap task that will remotely run that rake task. | ```
run("cd #{deploy_to}/current && /usr/bin/env rake `<task_name>` RAILS_ENV=production")
```
Found it with Google -- <http://ananelson.com/said/on/2007/12/30/remote-rake-tasks-with-capistrano/>
The `RAILS_ENV=production` was a gotcha -- I didn't think of it at first and couldn't figure out why the task wasn't doin... |
312,234 | <p>I cannot seem to debug my JavaScript code with Firebug. The play button is greyed out. I use FireFox 3.0.4 and Firebug 1.2.1.</p>
<p>Are there any known issues?</p>
<p>This is the script I want to debug:</p>
<p>(breakpoints set on <code><img onclick></code> and function <code>say()</code>), the code execute... | [
{
"answer_id": 312242,
"author": "acrosman",
"author_id": 24215,
"author_profile": "https://Stackoverflow.com/users/24215",
"pm_score": 0,
"selected": false,
"text": "<p>I usually see this behavior if I forget to set a break point, or I have set the break points in places that don't get ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30759/"
] | I cannot seem to debug my JavaScript code with Firebug. The play button is greyed out. I use FireFox 3.0.4 and Firebug 1.2.1.
Are there any known issues?
This is the script I want to debug:
(breakpoints set on `<img onclick>` and function `say()`), the code executes well.
```
<html>
<head>
<meta http-eq... | Check if you have "support for script debugging" enabled in Console. Its disabled by default for performance reasons. |
312,244 | <p>document.body.offsetWidth returns the innerwidth value from left hand side to the left side of the vertical scrollbar in firefox.
In IE it doesn't, instead it returns from left hand side to the right side of the vertical scrollbar.
Does anyone know a sensible way I could make a veriable such as "var = offsetw;" for ... | [
{
"answer_id": 312242,
"author": "acrosman",
"author_id": 24215,
"author_profile": "https://Stackoverflow.com/users/24215",
"pm_score": 0,
"selected": false,
"text": "<p>I usually see this behavior if I forget to set a break point, or I have set the break points in places that don't get ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36076/"
] | document.body.offsetWidth returns the innerwidth value from left hand side to the left side of the vertical scrollbar in firefox.
In IE it doesn't, instead it returns from left hand side to the right side of the vertical scrollbar.
Does anyone know a sensible way I could make a veriable such as "var = offsetw;" for off... | Check if you have "support for script debugging" enabled in Console. Its disabled by default for performance reasons. |
312,263 | <p>What is a good way to implement keyboard handling? In any language, where I write a keyboard-interactive program (such as a tetris game), I end up having some code that looks like this:</p>
<pre><code>for event in pygame.event.get():
if event.type == KEYDOWN:
if False: pass #make everything an ... | [
{
"answer_id": 312270,
"author": "andrewrk",
"author_id": 432,
"author_profile": "https://Stackoverflow.com/users/432",
"pm_score": 5,
"selected": true,
"text": "<p>You could create a dictionary where the keys are the input and the value is a function that handles the keypress:</p>\n\n<p... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] | What is a good way to implement keyboard handling? In any language, where I write a keyboard-interactive program (such as a tetris game), I end up having some code that looks like this:
```
for event in pygame.event.get():
if event.type == KEYDOWN:
if False: pass #make everything an elif
e... | You could create a dictionary where the keys are the input and the value is a function that handles the keypress:
```
def handle_quit():
quit()
def handle_left():
curpiece.shift(-1, 0)
shadowpiece = curpiece.clone(); setupshadow(shadowpiece)
def handle_right():
curpiece.shift(1, 0)
shadowpiece = cu... |
312,273 | <p>I have a query (which was created by LINQ to SQL) to get me a list of 'site visits' that were made between a certain date range which resulted in an order (orderid is not null).</p>
<p>Theres nothing wrong with the query. I just need advice on creating the correct index for it. I was playing around trying different... | [
{
"answer_id": 312298,
"author": "Brannon",
"author_id": 5745,
"author_profile": "https://Stackoverflow.com/users/5745",
"pm_score": 2,
"selected": false,
"text": "<p>How many rows do you expect to have between a typical date range? Are you typically looking at a month at a time?</p>\n\... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] | I have a query (which was created by LINQ to SQL) to get me a list of 'site visits' that were made between a certain date range which resulted in an order (orderid is not null).
Theres nothing wrong with the query. I just need advice on creating the correct index for it. I was playing around trying different combinati... | How many rows do you expect to have between a typical date range? Are you typically looking at a month at a time?
I would start out with an index over the `[Date]` column. If, for a typical query, your resulting row count is small you shouldn't need to add the `[OrderId]` column to your index.
On the other hand, if y... |
312,286 | <p>For my programming class I have to write a linked list class. One of the functions we have to include is next(). This function would return the memory address of the next element in the list.</p>
<pre><code>#include <iostream>
using namespace std;
class Set {
private:
int num;
Set *nextva... | [
{
"answer_id": 312288,
"author": "luqui",
"author_id": 33796,
"author_profile": "https://Stackoverflow.com/users/33796",
"pm_score": 4,
"selected": true,
"text": "<p><code>Set*</code> is correct. You are suffering from a rather silly bug in this function:</p>\n\n<pre><code>Set* Set::nex... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38/"
] | For my programming class I have to write a linked list class. One of the functions we have to include is next(). This function would return the memory address of the next element in the list.
```
#include <iostream>
using namespace std;
class Set {
private:
int num;
Set *nextval;
bool empt... | `Set*` is correct. You are suffering from a rather silly bug in this function:
```
Set* Set::next() {
Set *current;
current = this;
return current->next;
}
```
The last line should be `return current->nextval`. Otherwise you are trying to return a pointer to the `next` function... probably not what you w... |
312,300 | <p>On Vista, I got a problem with the application crash handler. Basically, if something unexpected occurs which cannot be captured by SEH, I get this pop-up window with "The application stopped working", blablabla, "Close program/Debug program" -- that is, after I disable the error reporting using the system control p... | [
{
"answer_id": 312366,
"author": "wimh",
"author_id": 33499,
"author_profile": "https://Stackoverflow.com/users/33499",
"pm_score": 4,
"selected": true,
"text": "<p>Use</p>\n\n<pre><code>SetErrorMode(SetErrorMode(0)|SEM_NOGPFAULTERRORBOX);\n</code></pre>\n\n<p>But I would suggest to inst... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39912/"
] | On Vista, I got a problem with the application crash handler. Basically, if something unexpected occurs which cannot be captured by SEH, I get this pop-up window with "The application stopped working", blablabla, "Close program/Debug program" -- that is, after I disable the error reporting using the system control pane... | Use
```
SetErrorMode(SetErrorMode(0)|SEM_NOGPFAULTERRORBOX);
```
But I would suggest to install an exceptions handler which creates a dump so you can verify what happened. For example [crashrpt](http://code.google.com/p/crashrpt/) (or [here](http://www.codeproject.com/KB/debug/crash_report.aspx)).
See also
* <http... |
312,312 | <p>I have a Visual Studio 2005 C++ program that runs differently in Release mode than it does in Debug mode. In release mode, there's an (apparent) intermittent crash occurring. In debug mode, it doesn't crash. What are some reasons that a Release build would work differently than a Debug build?</p>
<p>It's also wo... | [
{
"answer_id": 312315,
"author": "Burkhard",
"author_id": 12860,
"author_profile": "https://Stackoverflow.com/users/12860",
"pm_score": 3,
"selected": false,
"text": "<p>Variables that are not initialized explicitly will or might not be zeroed in Release build.</p>\n"
},
{
"answe... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/191808/"
] | I have a Visual Studio 2005 C++ program that runs differently in Release mode than it does in Debug mode. In release mode, there's an (apparent) intermittent crash occurring. In debug mode, it doesn't crash. What are some reasons that a Release build would work differently than a Debug build?
It's also worth mentionin... | [**Surviving the Release Version**](https://www.codeproject.com/Articles/548/Surviving-the-Release-Version) gives a good overview.
Things I have encountered - most are already mentioned
**Variable initialization**
by far the most common. In Visual Studio, debug builds explicitly initialize allocated memory to given v... |
312,314 | <p>I know I can access environment variables in PowerShell using <code>$Env</code>. For example, I can access <code>FOO</code> with <code>$Env:FOO</code>.</p>
<p>I can't figure out how to access the environment variable called <code>FOO.BAR</code>.</p>
<p><code>$Env:FOO.BAR</code> doesn't work. How can I access this ... | [
{
"answer_id": 312327,
"author": "Jesse Weigert",
"author_id": 7618,
"author_profile": "https://Stackoverflow.com/users/7618",
"pm_score": 3,
"selected": false,
"text": "<p>Use the .NET method to get the variable:</p>\n\n<pre><code>[Environment]::GetEnvironmentVariable(\"FOO.BAR\")\n</co... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7618/"
] | I know I can access environment variables in PowerShell using `$Env`. For example, I can access `FOO` with `$Env:FOO`.
I can't figure out how to access the environment variable called `FOO.BAR`.
`$Env:FOO.BAR` doesn't work. How can I access this from within PowerShell? | To access any kind of PowerShell variable where the name contains non-alphanumeric characters, use the ${…} notation as in:
```
${env:variable.with.dots} = "Hi there"
${env:variable.with.dots}
```
This works for variables in any drive (registry, filesystem, etc.) |
312,318 | <p>I've tried to the letter to search for mistakes in my code, but i can't myself get that autocomplete extender to work. Help wanted. </p>
<p>Here's my code: (excerpt from my aspx page) </p>
<pre><code> <asp:TextBox ID="TextBox1" Width="120px" runat="server"></asp:TextBox>
<cc1:AutoCompleteExtend... | [
{
"answer_id": 312709,
"author": "Dave Markle",
"author_id": 24995,
"author_profile": "https://Stackoverflow.com/users/24995",
"pm_score": 2,
"selected": false,
"text": "<p>How to troubleshoot this:</p>\n\n<p>Comment out your SQL code. Just return an array with some test data. Does tha... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've tried to the letter to search for mistakes in my code, but i can't myself get that autocomplete extender to work. Help wanted.
Here's my code: (excerpt from my aspx page)
```
<asp:TextBox ID="TextBox1" Width="120px" runat="server"></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat=... | How to troubleshoot this:
Comment out your SQL code. Just return an array with some test data. Does that work? Do you see it? If not, your webservice code is not getting called. If that works, your problem is with your database code.... Is your webservice code on the calling page? |
312,321 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/71419/whats-wrong-with-delphis-with">What's wrong with Delphi's “with”</a> </p>
</blockquote>
<p>I am have a problem debugging code that uses a ‘WITH’ statement in BDS 2006
The debugger will... | [
{
"answer_id": 312333,
"author": "Holgerwa",
"author_id": 5015,
"author_profile": "https://Stackoverflow.com/users/5015",
"pm_score": 3,
"selected": false,
"text": "<p>The Debugger cannot make the connection between the variable shown in the source-code that you want to examine and the r... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17560/"
] | >
> **Possible Duplicate:**
>
> [What's wrong with Delphi's “with”](https://stackoverflow.com/questions/71419/whats-wrong-with-delphis-with)
>
>
>
I am have a problem debugging code that uses a ‘WITH’ statement in BDS 2006
The debugger will not show the values of the variables with in a class or record.
Am I d... | `With` is considered by many one of those language features that falls into the "just because you have it doesn't mean you have to use it" category. There are *very* few occasions where I'd give it house-room - I've found one or two cases where it's use is essential when using extremely complex multi-level structures w... |
312,322 | <p>I have a variable of type Hashmap<code><String,Integer</code>>.</p>
<p>In this, the Integer value might have to go some manipulation depending upon the value of a flag variable. I did it like this...</p>
<pre><code>Hashmapvariable.put( somestring,
if (flag_variable) {
//manipulation code goes here
... | [
{
"answer_id": 312330,
"author": "coobird",
"author_id": 17172,
"author_profile": "https://Stackoverflow.com/users/17172",
"pm_score": 3,
"selected": true,
"text": "<p>You cannot place a statement in the method call.</p>\n\n<p>However, one option could be to make an method that returns a... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9195/"
] | I have a variable of type Hashmap`<String,Integer`>.
In this, the Integer value might have to go some manipulation depending upon the value of a flag variable. I did it like this...
```
Hashmapvariable.put( somestring,
if (flag_variable) {
//manipulation code goes here
new Integer(manipulated value);
... | You cannot place a statement in the method call.
However, one option could be to make an method that returns a `Integer` such as:
```
private Integer getIntegerDependingOnFlag(boolean flag)
{
if (flag)
return new Integer(MANIPULATED_VALUE);
else
return new Integer(NON-MANIPULATED_VALUE);
}
``... |
312,328 | <p>Pretty much as the question asks. Answers preferably in pseudo code and referenced. The correct answer should value speed over simplicity.</p>
| [
{
"answer_id": 312332,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": 3,
"selected": true,
"text": "<p>See <a href=\"http://www.softsurfer.com/Archive/algorithm_0105/algorithm_0105.htm\" rel=\"nofollow noreferrer\">Inte... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42413/"
] | Pretty much as the question asks. Answers preferably in pseudo code and referenced. The correct answer should value speed over simplicity. | See [Intersections of Rays, Segments, Planes and Triangles in 3D](http://www.softsurfer.com/Archive/algorithm_0105/algorithm_0105.htm). You can find ways to triangulate polygons.
If you really need ray/polygon intersection, it's on 16.9 of [Real-Time Rendering](http://www.realtimerendering.com/) (13.8 for 2nd ed).
> ... |
312,379 | <p>I need to draw gridlines on the background of a canvas that will have other controls placed on it. </p>
<p>I tried creating a StreamGeometry, using that to draw lines, and getting that assigned to a DrawingBrush. However I find that if the StreamGeometry has too many lines, the program becomes sluggish after the Dr... | [
{
"answer_id": 312849,
"author": "ligaz",
"author_id": 6409,
"author_profile": "https://Stackoverflow.com/users/6409",
"pm_score": 1,
"selected": false,
"text": "<p>One solution is to override OnRender(DrawingContext dc) method on the panel and draw the lines in there. </p>\n\n<p>Another... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/618/"
] | I need to draw gridlines on the background of a canvas that will have other controls placed on it.
I tried creating a StreamGeometry, using that to draw lines, and getting that assigned to a DrawingBrush. However I find that if the StreamGeometry has too many lines, the program becomes sluggish after the DrawingBrush... | My advice would be to keep the primitive count down. You're making WPF spend CPU cycles and bandwidth creating and sending that massive grid to the render thread and GPU.
DrawingBrush is a [TileBrush](http://msdn.microsoft.com/en-us/library/system.windows.media.tilebrush.aspx).
Draw a single unit of the grid onto the... |
312,400 | <p>I have the following (shortened query):</p>
<pre><code>SELECT
`Statistics`.`StatisticID`,
COUNT(DISTINCT `Flags`.`FlagType`) AS `FlagCount`
FROM `Statistics`
LEFT JOIN `Flags` ON `Statistics`.`StatisticID` = `Flags`.`StatisticID`
WHERE `FlagCount` = 0
GROUP BY `Statistics`.`StatisticID`
ORDER BY `Submitted... | [
{
"answer_id": 312405,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": 3,
"selected": false,
"text": "<p>Use <a href=\"http://dev.mysql.com/doc/refman/5.0/en/select.html\" rel=\"nofollow noreferrer\"><code>HAVING COUNT(D... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2025/"
] | I have the following (shortened query):
```
SELECT
`Statistics`.`StatisticID`,
COUNT(DISTINCT `Flags`.`FlagType`) AS `FlagCount`
FROM `Statistics`
LEFT JOIN `Flags` ON `Statistics`.`StatisticID` = `Flags`.`StatisticID`
WHERE `FlagCount` = 0
GROUP BY `Statistics`.`StatisticID`
ORDER BY `SubmittedTime` DESC
LIM... | Maybe you can try subquerying if HAVING doesn't work.
```
SELECT
`Statistics`.`StatisticID`,
COUNT(DISTINCT `Flags`.`FlagType`) AS `FlagCount`
FROM `Statistics`
LEFT JOIN `Flags` ON `Statistics`.`StatisticID` = `Flags`.`StatisticID`
WHERE `Statistics`.`StatisticID`
IN (SELECT `Flags`.`StatisticID`
... |
312,424 | <p>I am trying to set the <code>fieldValue</code> of the check box to a value I got from the property tag.</p>
<p>I am having trouble with the syntax.</p>
<p>This is what I have tried:</p>
<pre><code><s:form id="myForm" method="post" action="removeUser" enctype="multipart/form-data">
<s:iterator value=... | [
{
"answer_id": 312575,
"author": "Alexandru Luchian",
"author_id": 32188,
"author_profile": "https://Stackoverflow.com/users/32188",
"pm_score": 2,
"selected": true,
"text": "<p>I don't think you can do that:</p>\n\n<p><em><s:checkbox label=\"delete\" name=\"delete\" fieldValue=\"<... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17085/"
] | I am trying to set the `fieldValue` of the check box to a value I got from the property tag.
I am having trouble with the syntax.
This is what I have tried:
```
<s:form id="myForm" method="post" action="removeUser" enctype="multipart/form-data">
<s:iterator value="myList">
<tr>
<td><s:proper... | I don't think you can do that:
*<s:checkbox label="delete" name="delete" fieldValue="<s:property value='id'/>"/>*
fieldValue expects a OGNL expression. I did some Struts, not too much, you could try:
fieldValue="%{id}" |
312,427 | <p>I'm not good at programming and my trying to open one of my spreadsheet documents.
Below in the basic login im using, I then request a list all my spreadsheet, which is returned in $feed.</p>
<p>And now I'm worried I'm not on the right track with opening a document so I can read and write cells.</p>
<pre><code><... | [
{
"answer_id": 525380,
"author": "Kekoa",
"author_id": 31288,
"author_profile": "https://Stackoverflow.com/users/31288",
"pm_score": 0,
"selected": false,
"text": "<p>You're on the right track. Are you using the information found <a href=\"http://framework.zend.com/manual/en/zend.gdata.... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19709/"
] | I'm not good at programming and my trying to open one of my spreadsheet documents.
Below in the basic login im using, I then request a list all my spreadsheet, which is returned in $feed.
And now I'm worried I'm not on the right track with opening a document so I can read and write cells.
```
<?php
require_once '../... | I forgot which social network my id was with, and so I have Activ8ed a new. A bit like a cylon.
>
> I looked at the zend manual. I'm new
> to php so accessing Objects like $feed
> is still confusing. The Zend document
> needs to make better usage of http to
> expand the information present.
>
>
> ie. the quote ... |
312,443 | <p>How do I split a list of arbitrary length into equal sized chunks?</p>
<hr />
<p><sub>See <a href="https://stackoverflow.com/q/434287">How to iterate over a list in chunks</a> if the data result will be used directly for a loop, and does not need to be stored.</sub></p>
<p><sub>For the same question with a string in... | [
{
"answer_id": 312464,
"author": "Ned Batchelder",
"author_id": 14343,
"author_profile": "https://Stackoverflow.com/users/14343",
"pm_score": 13,
"selected": true,
"text": "<p>Here's a generator that yields evenly-sized chunks:</p>\n<pre><code>def chunks(lst, n):\n """Y... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112415/"
] | How do I split a list of arbitrary length into equal sized chunks?
---
See [How to iterate over a list in chunks](https://stackoverflow.com/q/434287) if the data result will be used directly for a loop, and does not need to be stored.
For the same question with a string input, see [Split string every nth character?]... | Here's a generator that yields evenly-sized chunks:
```
def chunks(lst, n):
"""Yield successive n-sized chunks from lst."""
for i in range(0, len(lst), n):
yield lst[i:i + n]
```
```
import pprint
pprint.pprint(list(chunks(range(10, 75), 10)))
[[10, 11, 12, 13, 14, 15, 16, 17, 18, 19],
[20, 21, 22, ... |
312,444 | <p>Greetings,</p>
<p>I'm trying to use pylucene in Python 2.6. Since there's no windows build for 2.6, I try to build the source code.</p>
<p>First of all, I build JCC (windows, using cygwin)</p>
<pre><code>python setup.py build
running build
running build_py
[...]
building 'jcc' extension
error: None
python setup... | [
{
"answer_id": 312586,
"author": "user39307",
"author_id": 39307,
"author_profile": "https://Stackoverflow.com/users/39307",
"pm_score": 1,
"selected": false,
"text": "<p>try:</p>\n\n<blockquote>\n <p>/cygdrive/f/Python26//python.exe setup.py build</p>\n</blockquote>\n\n<p>and</p>\n\n<b... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40062/"
] | Greetings,
I'm trying to use pylucene in Python 2.6. Since there's no windows build for 2.6, I try to build the source code.
First of all, I build JCC (windows, using cygwin)
```
python setup.py build
running build
running build_py
[...]
building 'jcc' extension
error: None
python setup.py install
running install
[... | try:
>
> /cygdrive/f/Python26//python.exe setup.py build
>
>
>
and
>
> /cygdrive/f/Python26//python.exe setup.py build setup.py install
>
>
>
I believe you are using python from cygwin for instaling jcc and python from windows for running... |
312,487 | <p>Need help narrowing the scope of this Regex to not return records if there is an alphanumeric character preceding the first "I"</p>
<pre><code>"I([ ]{1,2})([a-zA-Z]|\d){2,13}"
</code></pre>
<p>Want to capture I APF From this string, but not the I ARPT. </p>
<pre><code>I APF 'NAPLES MUNI ARPT. ... | [
{
"answer_id": 312504,
"author": "Gareth",
"author_id": 31582,
"author_profile": "https://Stackoverflow.com/users/31582",
"pm_score": 4,
"selected": true,
"text": "<p><code>\\b</code> represents a word boundary in regular expressions, so the following should work (assuming you're happy w... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38349/"
] | Need help narrowing the scope of this Regex to not return records if there is an alphanumeric character preceding the first "I"
```
"I([ ]{1,2})([a-zA-Z]|\d){2,13}"
```
Want to capture I APF From this string, but not the I ARPT.
```
I APF 'NAPLES MUNI ARPT. ' 42894 JEB 29785584
```... | `\b` represents a word boundary in regular expressions, so the following should work (assuming you're happy with the rest of the regex):
```
("\bI([ ]{1,2})([a-zA-Z]|\d){2,13}")
```
A word boundary is defined as the zero-width space between a word character and a non-word character. Depending on your regex engine a ... |
312,491 | <p>I'm adding an existing site to SVN.</p>
<p>The files already exist on the webserver, and now identical copies (- configuration files) exist in the repository.</p>
<p>I want to convert the webserver directory into an SVN working copy, but when I run:</p>
<pre><code>svn checkout http://path.to/svn/repo/httpdocs .
<... | [
{
"answer_id": 312493,
"author": "Ned Batchelder",
"author_id": 14343,
"author_profile": "https://Stackoverflow.com/users/14343",
"pm_score": 2,
"selected": false,
"text": "<p>Pull from the repository to a new directory, then rename the old one to <code>old_crufty</code>, and the new one... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13238/"
] | I'm adding an existing site to SVN.
The files already exist on the webserver, and now identical copies (- configuration files) exist in the repository.
I want to convert the webserver directory into an SVN working copy, but when I run:
```
svn checkout http://path.to/svn/repo/httpdocs .
```
I get the error:
>
> ... | Try the `--force` option. `svn help checkout` gives the details. |
312,511 | <p>I am looking to use/connect to a different database for one of my controllers and one model. I posted this hear since on the forums of CI I am getting no response.</p>
<p>I added this in database.php:</p>
<pre><code>$db['tdb']['hostname'] = "localhost";//localhost
$db['tdb']['username'] = "username";//root
$db['... | [
{
"answer_id": 321813,
"author": "jmccartie",
"author_id": 24708,
"author_profile": "https://Stackoverflow.com/users/24708",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried loading $tdb inside the FInsert function? Looks like $tdb may be a local variable and not accessible ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am looking to use/connect to a different database for one of my controllers and one model. I posted this hear since on the forums of CI I am getting no response.
I added this in database.php:
```
$db['tdb']['hostname'] = "localhost";//localhost
$db['tdb']['username'] = "username";//root
$db['tdb']['password'] = "... | Your issue here isn't with the use of CodeIgniter's database functions, but with variable scoping in classes. When you load your model you're connecting to the database and assigning the result to a local variable in the model's constructor. When any function finishes, the local variables are discarded. Later you try t... |
312,517 | <p>I'm having some trouble with the Google Maps API; I want to determine a LatLong for a certain place (for example, from the name of a city), then focus my map on it. The LatLong part is working, and so is centering the map on that point. However, I cannot figure out how to determine what a good zoomlevel might be whe... | [
{
"answer_id": 312545,
"author": "BigInJapan",
"author_id": 38810,
"author_profile": "https://Stackoverflow.com/users/38810",
"pm_score": 1,
"selected": false,
"text": "<p>Your question is missing a input parameter . You are saying LatLon point but actually you need LatLonBounds to do t... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37472/"
] | I'm having some trouble with the Google Maps API; I want to determine a LatLong for a certain place (for example, from the name of a city), then focus my map on it. The LatLong part is working, and so is centering the map on that point. However, I cannot figure out how to determine what a good zoomlevel might be when I... | I had the same question, and Nick Retallack's response, is what worked for me. To provide more detail, the name of the undocumented property is "ExtendedData", and within that you have "LatLonBox" which contains the north, south, east and west boundaries of the appropriate zoom level.
For instance, if you were to do a... |
312,549 | <p>I have updated to latest Django version 1.0.2 after uninstalling my old Django version.But now when I run django-admin.py I get the following error. How can I resolve this?</p>
<pre><code>Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\django\bin\django-admin.py", line 2, in <module>
... | [
{
"answer_id": 325295,
"author": "Fil",
"author_id": 12218,
"author_profile": "https://Stackoverflow.com/users/12218",
"pm_score": 6,
"selected": true,
"text": "<p>You must make sure that django is in your PYTHONPATH.</p>\n\n<p>To test, just do a <code>import django</code> from a python ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7965/"
] | I have updated to latest Django version 1.0.2 after uninstalling my old Django version.But now when I run django-admin.py I get the following error. How can I resolve this?
```
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\django\bin\django-admin.py", line 2, in <module>
from django.core... | You must make sure that django is in your PYTHONPATH.
To test, just do a `import django` from a python shell. There should be no output:
```
ActivePython 2.5.1.1 (ActiveState Software Inc.) based on
Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credit... |
312,552 | <p>I am looking for a Java open source beautifier or reformatter for SQL that I can use to clean up DDL statements that I am generating with <a href="http://www.openarchitectureware.org" rel="nofollow noreferrer">openArchitectureWare</a>.</p>
<p>Nothing in the answer to "<a href="https://stackoverflow.com/questions/20... | [
{
"answer_id": 534869,
"author": "tcurdt",
"author_id": 33165,
"author_profile": "https://Stackoverflow.com/users/33165",
"pm_score": 0,
"selected": false,
"text": "<p>You could just use a <a href=\"http://antlr.org/grammar/list\" rel=\"nofollow noreferrer\">SQL grammar</a> and build the... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1969/"
] | I am looking for a Java open source beautifier or reformatter for SQL that I can use to clean up DDL statements that I am generating with [openArchitectureWare](http://www.openarchitectureware.org).
Nothing in the answer to "[Online Code Beautifier And Formatter](https://stackoverflow.com/questions/206441/online-code-... | **UPDATE 2:**
`org.hibernate.jdbc.util.BasicFormatterImpl` got moved in release 4.0. It is now located at: `org.hibernate.engine.jdbc.internal.BasicFormatterImpl`.
**UPDATE 1:**
Technology marches on. As noted by Alex, **`org.hibernate.pretty.Formatter` no longer exists as of version 3.3.2.GA**. The replacement is `... |
312,570 | <p>I know that <a href="http://en.wikipedia.org/wiki/Buffer_overflow" rel="nofollow noreferrer">buffer overruns</a> are one potential hazard to using C-style strings (char arrays). If I know my data will fit in my buffer, is it okay to use them anyway? Are there other drawbacks inherent to C-style strings that I need... | [
{
"answer_id": 312572,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 2,
"selected": false,
"text": "<p>Character encoding issues tend to surface when you have an array of bytes instead of a string of characters.</p>\n"
}... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] | I know that [buffer overruns](http://en.wikipedia.org/wiki/Buffer_overflow) are one potential hazard to using C-style strings (char arrays). If I know my data will fit in my buffer, is it okay to use them anyway? Are there other drawbacks inherent to C-style strings that I need to be aware of?
**EDIT:** Here's an exam... | C strings lack the following aspects of their C++ counterparts:
* Automatic memory management: you have to allocate and free their memory manually.
* Extra capacity for concatenation efficiency: C++ strings often have a capacity greater than their size. This allows increasing the size without many reallocations.
* No ... |
312,576 | <p>So i'm used to PHPMySQL where if I want to transfer a table from one database to another, I:</p>
<ul>
<li>go to the table</li>
<li>click "export"</li>
<li>CTRL-C</li>
<li>go to the other database, insert SQL, CTRL-V</li>
</ul>
<p>In MS SQL Server 2008 Express, I try:</p>
<ul>
<li>right-click, script table as, CRE... | [
{
"answer_id": 312595,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 2,
"selected": false,
"text": "<p>Look here: <a href=\"http://www.simonholywell.com/article/sql-server-2005-dump-to-sql-statements.html\" rel=\"nofollow ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | So i'm used to PHPMySQL where if I want to transfer a table from one database to another, I:
* go to the table
* click "export"
* CTRL-C
* go to the other database, insert SQL, CTRL-V
In MS SQL Server 2008 Express, I try:
* right-click, script table as, CREATE TO
+ but this only gives me the CREATE TABLE sql, not t... | From the SQL Server Management Studio you can right click on your database and select:
Tasks -> Generate Scripts - Next -> Select objects that you need from list -> click on the advanced
Then simply proceed through the wizard. Make sure to set 'Script Data' to TRUE when prompted to choose the script options.
SQL Ser... |
312,605 | <p>I'm making a simple form to create polls, therefore I want the possibility to add additional input fields in case the user wants more options in the poll.</p>
<p>I've made Javascript code that adds a new input field to the form, but the dynamically added input fields are not posted when the form is submitted (I use... | [
{
"answer_id": 312618,
"author": "Pim Jager",
"author_id": 35197,
"author_profile": "https://Stackoverflow.com/users/35197",
"pm_score": 0,
"selected": false,
"text": "<p>You can always serialize the form yourself using a javascript function and then submit that (using AJAX or a get requ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37066/"
] | I'm making a simple form to create polls, therefore I want the possibility to add additional input fields in case the user wants more options in the poll.
I've made Javascript code that adds a new input field to the form, but the dynamically added input fields are not posted when the form is submitted (I use a standar... | Your code works fine as is:
```
<?php
print_r($_REQUEST)
?>
<html>
<body>
<form id="myForm" method="post">
<input type="submit">
<input type="text" name="poll[question]">
<input type="text" name="poll[option1]">
<input type="text" name="poll[option2]">
</form>
<a href="javascript:addOption();... |
312,625 | <p>I am creating a Firefox Extension...what would be the javascript to open a URL in the current tab from a menuitem?</p>
<p>e.g. in my overlay.xul file i have the following line:</p>
<pre><code><menuitem label="Visit homepage" oncommand="window.location='http://www.somepage.com'"/>
</code></pre>
<p>but in fir... | [
{
"answer_id": 312683,
"author": "aryo",
"author_id": 17998,
"author_profile": "https://Stackoverflow.com/users/17998",
"pm_score": 4,
"selected": true,
"text": "<p>After browsing around, I found that I had to replace the above code with this:</p>\n\n<pre><code><menuitem label=\"Visit... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17998/"
] | I am creating a Firefox Extension...what would be the javascript to open a URL in the current tab from a menuitem?
e.g. in my overlay.xul file i have the following line:
```
<menuitem label="Visit homepage" oncommand="window.location='http://www.somepage.com'"/>
```
but in firefox, when i click on the menu item, it... | After browsing around, I found that I had to replace the above code with this:
```
<menuitem label="Visit homepage" oncommand="content.wrappedJSObject.location='http://www.somepage.com'"/>
``` |
312,648 | <p>I thought that if a c pointer pointing to a char array was incremented then it would point to the next element in that array. But when I tried this I found that I had to increment it twice. Trying the increment using sizeof(char) I found that adding the size of a char was too much so it had to be divided by two. </p... | [
{
"answer_id": 312656,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 2,
"selected": false,
"text": "<p>If you have a pointer <code>ptr</code> of type <code>T*</code> and you add <code>N</code>, then the poin... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I thought that if a c pointer pointing to a char array was incremented then it would point to the next element in that array. But when I tried this I found that I had to increment it twice. Trying the increment using sizeof(char) I found that adding the size of a char was too much so it had to be divided by two.
```
... | sizeof(char) is guaranteed to be 1, but sizeof(char\*) isn't.
Nevertheless, your function **only works by accident**.
For example, try calling it with the following parameters:
```
abc defg
```
This will yield:
```
2 args.
input: a, c,
```
which is plain wrong. The problem is you are incrementing a pointer to t... |
312,652 | <p>I'm currently in the process of replacing my homebrewn build script by an Ant build script.</p>
<p>Now I need to replace various tokens by the size of a specific file. I know how to get the size in bytes via the <code><length></code> task and store in in a property, but I need the size in kilobytes and megaby... | [
{
"answer_id": 312664,
"author": "Miserable Variable",
"author_id": 18573,
"author_profile": "https://Stackoverflow.com/users/18573",
"pm_score": 2,
"selected": false,
"text": "<p>There is a math task at <a href=\"http://ant-contrib.sourceforge.net/\" rel=\"nofollow noreferrer\">http://a... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4445/"
] | I'm currently in the process of replacing my homebrewn build script by an Ant build script.
Now I need to replace various tokens by the size of a specific file. I know how to get the size in bytes via the `<length>` task and store in in a property, but I need the size in kilobytes and megabytes too.
How can I access ... | I found a solution that does not require any third-party library or custom tasks using the [`<script>` task](http://ant.apache.org/manual/Tasks/script.html) that allows for using JavaScript (or any other [Apache BSF](http://jakarta.apache.org/bsf) or [JSR 223](https://scripting.dev.java.net/) supported language) from w... |
312,672 | <p>While an applet is loading, it displays a white rectangle for a split second. How can we get rid of it?</p>
| [
{
"answer_id": 312664,
"author": "Miserable Variable",
"author_id": 18573,
"author_profile": "https://Stackoverflow.com/users/18573",
"pm_score": 2,
"selected": false,
"text": "<p>There is a math task at <a href=\"http://ant-contrib.sourceforge.net/\" rel=\"nofollow noreferrer\">http://a... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5541/"
] | While an applet is loading, it displays a white rectangle for a split second. How can we get rid of it? | I found a solution that does not require any third-party library or custom tasks using the [`<script>` task](http://ant.apache.org/manual/Tasks/script.html) that allows for using JavaScript (or any other [Apache BSF](http://jakarta.apache.org/bsf) or [JSR 223](https://scripting.dev.java.net/) supported language) from w... |
312,673 | <pre><code>if __name__=='__main__':
parser = OptionParser()
parser.add_option("-i", "--input_file",
dest="input_filename",
help="Read input from FILE", metavar="FILE")
(options, args) = parser.parse_args()
print options
</code></pre>
<p>result is</p>
<pre><c... | [
{
"answer_id": 312677,
"author": "Charles Duffy",
"author_id": 14122,
"author_profile": "https://Stackoverflow.com/users/14122",
"pm_score": 4,
"selected": true,
"text": "<p>Python has nothing to do with this -- it's the shell.</p>\n\n<p>Call</p>\n\n<pre><code>$ python convert.py -i 'vid... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29364/"
] | ```
if __name__=='__main__':
parser = OptionParser()
parser.add_option("-i", "--input_file",
dest="input_filename",
help="Read input from FILE", metavar="FILE")
(options, args) = parser.parse_args()
print options
```
result is
```
$ python convert.py -i vid... | Python has nothing to do with this -- it's the shell.
Call
```
$ python convert.py -i 'video_*'
```
and it will pass in that wildcard.
The other six values were passed in as args, not attached to the `-i`, exactly as if you'd run `python convert.py -i video_1 video_2 video_3 video_4 video_5 video_6`, and the `-i` ... |
312,674 | <p>First off, how do I know if my html file is running on localhost in Xampp?
Is there a tutorial on how to manage files/directories and get that all working under htdocs?
Is there a good tutorial on how to setup includes?</p>
<p>I want to use "includes" in Xampp with my html.
Can I use both html includes AND php incl... | [
{
"answer_id": 312725,
"author": "Noah Goodrich",
"author_id": 20178,
"author_profile": "https://Stackoverflow.com/users/20178",
"pm_score": 1,
"selected": false,
"text": "<p>To answer your first question, can you access <a href=\"http://localhost/\" rel=\"nofollow noreferrer\">http://lo... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40091/"
] | First off, how do I know if my html file is running on localhost in Xampp?
Is there a tutorial on how to manage files/directories and get that all working under htdocs?
Is there a good tutorial on how to setup includes?
I want to use "includes" in Xampp with my html.
Can I use both html includes AND php includes?
Do I... | Since **XAMPP** uses **Apache** you need to configure it to permit **SSI**.
>
> To permit SSI on your server, you must have the following directive either in your httpd.conf file, or in a .htaccess file:
>
>
>
> ```
> Options +Includes
>
> ```
>
> This tells Apache that you want to permit files to be parsed for ... |
312,695 | <p>WARNING: I have been learning Python for all of 10 minutes so apologies for any stupid questions!</p>
<p>I have written the following code, however I get the following exception: </p>
<blockquote>
<p>Message File
Name Line Position Traceback Node
31
exceptions.TypeE... | [
{
"answer_id": 312698,
"author": "mthurlin",
"author_id": 39991,
"author_profile": "https://Stackoverflow.com/users/39991",
"pm_score": 3,
"selected": false,
"text": "<p>Constructors in Python are called <code>__init__</code>. You must also use \"self\" as the first argument for all meth... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | WARNING: I have been learning Python for all of 10 minutes so apologies for any stupid questions!
I have written the following code, however I get the following exception:
>
> Message File
> Name Line Position Traceback Node
> 31
> exceptions.TypeError: this constructor takes no arguments
>
>
>
```
class Co... | I'm going to assume you're coming from a Java-ish background, so there are a few key differences to point out.
```
class Computer(object):
"""Docstrings are used kind of like Javadoc to document classes and
members. They are the first thing inside a class or method.
You probably want to extend object, to... |
312,732 | <p>I'm trying to create an algorithm in C# which produces the following output strings:</p>
<pre><code>AAAA
AAAB
AAAC
...and so on...
ZZZX
ZZZY
ZZZZ
</code></pre>
<p>What is the best way to accomplish this?</p>
<pre><code>public static IEnumerable<string> GetWords()
{
//Perform algorithm
yield return w... | [
{
"answer_id": 312739,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 5,
"selected": true,
"text": "<p>well, if the length is a constant 4, then this would handle it:</p>\n\n<pre><code>public static IEnumerable<Stri... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33431/"
] | I'm trying to create an algorithm in C# which produces the following output strings:
```
AAAA
AAAB
AAAC
...and so on...
ZZZX
ZZZY
ZZZZ
```
What is the best way to accomplish this?
```
public static IEnumerable<string> GetWords()
{
//Perform algorithm
yield return word;
}
``` | well, if the length is a constant 4, then this would handle it:
```
public static IEnumerable<String> GetWords()
{
for (Char c1 = 'A'; c1 <= 'Z'; c1++)
{
for (Char c2 = 'A'; c2 <= 'Z'; c2++)
{
for (Char c3 = 'A'; c3 <= 'Z'; c3++)
{
for (Char c4 = 'A'; c4 ... |
312,735 | <p><strong>(Scroll down to bottom of post to find solution.)</strong></p>
<p>Got a asp.net page which contains a
Datalist. Inside this datalist, there
is a template containing a
dropdownlist and each time the
datalist is filled with an item, a
ItemCreatedCommand is called. The
itemCreatedCommand is responsible for
da... | [
{
"answer_id": 312743,
"author": "devio",
"author_id": 21336,
"author_profile": "https://Stackoverflow.com/users/21336",
"pm_score": 4,
"selected": true,
"text": "<p>When the DataList is data-bound, the AutoPostBack has not been handled yet, i.e. the values in the ItemCreated event are s... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37280/"
] | **(Scroll down to bottom of post to find solution.)**
Got a asp.net page which contains a
Datalist. Inside this datalist, there
is a template containing a
dropdownlist and each time the
datalist is filled with an item, a
ItemCreatedCommand is called. The
itemCreatedCommand is responsible for
databinding the dropdownli... | When the DataList is data-bound, the AutoPostBack has not been handled yet, i.e. the values in the ItemCreated event are still the original values.
You need to handle the SelectedIndexChange event of the dropdown control. |
312,749 | <p>I have a container filled with pairs. I want to iterate in it using the STL generic algorithms (in my case it would be inner_product, but consider it as a generic problem).
The algorithm I am using expects iterators first and last. Can I provide special iterators first and last that will iterate not on the pairs but... | [
{
"answer_id": 312754,
"author": "strager",
"author_id": 39992,
"author_profile": "https://Stackoverflow.com/users/39992",
"pm_score": 1,
"selected": false,
"text": "<p>You can subclass e.g. std::vector::const_iterator yourself, reimplementing operator* and operator-> to return the first... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/78828/"
] | I have a container filled with pairs. I want to iterate in it using the STL generic algorithms (in my case it would be inner\_product, but consider it as a generic problem).
The algorithm I am using expects iterators first and last. Can I provide special iterators first and last that will iterate not on the pairs but o... | I've looked around and found `boost::transform_iterator`. I've come up with this code. Surprising how well it works:
```
#include <map>
#include <algorithm>
#include <iostream>
#include <string>
#include <iterator>
#include <boost/iterator/transform_iterator.hpp>
#include <boost/bind.hpp>
#include <boost/function.hpp>... |
312,794 | <p>What is the Python equivalent of the following code in Ruby?</p>
<pre><code>def loop
cont=nil
for i in 1..4
puts i
callcc {|continuation| cont=continuation} if i==2
end
return cont
end
> c=loop
1
2
3
4
> c.call
3
4
</code></pre>
<p>Reference: <a href="http://www-128.ibm.com/developerworks/ja... | [
{
"answer_id": 312801,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>take a look at the <a href=\"http://www.python.org/doc/2.6/reference/simple_stmts.html#the-yield-statement\" rel=\"nofollow... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30289/"
] | What is the Python equivalent of the following code in Ruby?
```
def loop
cont=nil
for i in 1..4
puts i
callcc {|continuation| cont=continuation} if i==2
end
return cont
end
> c=loop
1
2
3
4
> c.call
3
4
```
Reference: [Secrets of lightweight development success, Part 9: Continuations-based framewor... | The article you quoted contains a link to [Continuations Made Simple And Illustrated](http://www.ps.uni-sb.de/~duchier/python/continuations.html) in the Resources section, which talks about continuations in the Python language. |
312,796 | <p>I'm trying to integrate a NSURLConnection object with UIProgressView, so I can update the user while a file download is happening in the background.</p>
<p>I created a separate object to download the file in the background, and I'm having problems figuring out how to update the progress property in the UIProgressVi... | [
{
"answer_id": 312879,
"author": "Dave Dribin",
"author_id": 26825,
"author_profile": "https://Stackoverflow.com/users/26825",
"pm_score": 6,
"selected": true,
"text": "<p>Not sure what I'm missing here, but your <code>filesize</code> being -1 seems to be your problem. The <a href=\"htt... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35478/"
] | I'm trying to integrate a NSURLConnection object with UIProgressView, so I can update the user while a file download is happening in the background.
I created a separate object to download the file in the background, and I'm having problems figuring out how to update the progress property in the UIProgressView object ... | Not sure what I'm missing here, but your `filesize` being -1 seems to be your problem. The [API docs](http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLResponse_Class/Reference/Reference.html#//apple_ref/occ/instm/NSURLResponse/expectedContentLength) clearly state that `expectedContentLen... |
312,810 | <p>I am building an Entity Framework model for a subset of the Pubs database from microsoft. I am only interested and publishers and books, not publishers and employees, but there is a foreign key constraint between the publishers and emoloyees tables. When I remove the employees entity from my model, the model won't v... | [
{
"answer_id": 312879,
"author": "Dave Dribin",
"author_id": 26825,
"author_profile": "https://Stackoverflow.com/users/26825",
"pm_score": 6,
"selected": true,
"text": "<p>Not sure what I'm missing here, but your <code>filesize</code> being -1 seems to be your problem. The <a href=\"htt... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17715/"
] | I am building an Entity Framework model for a subset of the Pubs database from microsoft. I am only interested and publishers and books, not publishers and employees, but there is a foreign key constraint between the publishers and emoloyees tables. When I remove the employees entity from my model, the model won't vali... | Not sure what I'm missing here, but your `filesize` being -1 seems to be your problem. The [API docs](http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLResponse_Class/Reference/Reference.html#//apple_ref/occ/instm/NSURLResponse/expectedContentLength) clearly state that `expectedContentLen... |
312,846 | <p>I have a very simple model. I want to add a send email routine to on of the methods for the model:</p>
<pre><code>$this->Email->delivery = 'smtp';
$this->Email->template = 'default';
$this->Email->sendAs = 'text';
$this->Email->from = 'email';
$this->Email->to = 'email';
$... | [
{
"answer_id": 313184,
"author": "neilcrookes",
"author_id": 9968,
"author_profile": "https://Stackoverflow.com/users/9968",
"pm_score": 2,
"selected": false,
"text": "<p>Components are supposed to be used in controllers, not models.</p>\n\n<p>In your controller use</p>\n\n<pre><code>var... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43/"
] | I have a very simple model. I want to add a send email routine to on of the methods for the model:
```
$this->Email->delivery = 'smtp';
$this->Email->template = 'default';
$this->Email->sendAs = 'text';
$this->Email->from = 'email';
$this->Email->to = 'email';
$this->Email->subject = 'Error';
```
I've t... | Well, you're doing it wrong way. You should place email send routine in your AppController:
```
function _sendMail($to,$subject,$template) {
$this->Email->to = $to;
// $this->Email->bcc = array('secret@example.com'); // copies
$this->Email->subject = $subject;
$this->Email->replyTo = 'noreply@domain.co... |
312,858 | <p>My scenario should be simple... the type I want to convert <em>FROM</em> is <em>ALWAYS</em> 'string'. What I want to convert to... could be many things - ints, DateTimes, ... strings, etc.</p>
<p>This would be easy:</p>
<pre><code>string valueToConvertFrom = "123";
int blah = Convert.ToInt32(valueToConvertFrom);
... | [
{
"answer_id": 312884,
"author": "arul",
"author_id": 15409,
"author_profile": "https://Stackoverflow.com/users/15409",
"pm_score": 3,
"selected": false,
"text": "<p>String class implements IConvertible, this code simply SHOULD work. Which version of .NET are you aiming?</p>\n\n<pre><cod... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11917/"
] | My scenario should be simple... the type I want to convert *FROM* is *ALWAYS* 'string'. What I want to convert to... could be many things - ints, DateTimes, ... strings, etc.
This would be easy:
```
string valueToConvertFrom = "123";
int blah = Convert.ToInt32(valueToConvertFrom);
```
However... I don't know (unti... | the clean way to do it is using the a TypeConverter.
you can get an instance of a type converter by calling the [TypeDescriptor.GetConverter](http://msdn.microsoft.com/en-us/library/system.componentmodel.typedescriptor.getconverter.aspx) and then using the instance of the type converter to do the convertion.
so somethi... |
312,859 | <p>I'm using grails j2d which in turns uses <code>GraphicsBuilder</code> to make a simple service to scale an image. My problem is specifically accessing the downloaded image height and width attributes in order to pass the correct parameters to the scale method. How do I access these attributes inside the transformati... | [
{
"answer_id": 319945,
"author": "billjamesdev",
"author_id": 13824,
"author_profile": "https://Stackoverflow.com/users/13824",
"pm_score": 1,
"selected": false,
"text": "<p>I don't know the J2D plugin at all, but you might check into what the delegate is for the closure you're passing t... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39907/"
] | I'm using grails j2d which in turns uses `GraphicsBuilder` to make a simple service to scale an image. My problem is specifically accessing the downloaded image height and width attributes in order to pass the correct parameters to the scale method. How do I access these attributes inside the transformations closure?
... | I don't know the J2D plugin at all, but you might check into what the delegate is for the closure you're passing to the image call. Add a line like "def d = delegate" before the transformations call, and debug this to see what type the delegate is. If it's an Image, then you ought to be able to get delegate.width or de... |
312,861 | <p>I put together a sample scenario of my issue and I hope its enough for someone to point me in the right direction.</p>
<p>I have two tables</p>
<p>Products</p>
<p><img src="https://i.stack.imgur.com/ktnI0.gif" alt="alt text"></p>
<p>Product Meta</p>
<p><img src="https://i.stack.imgur.com/dBrc0.gif" alt="alt tex... | [
{
"answer_id": 312883,
"author": "GregD",
"author_id": 38317,
"author_profile": "https://Stackoverflow.com/users/38317",
"pm_score": 2,
"selected": false,
"text": "<pre><code>Select a.ProductId\n ,a.Name\n ,(Select c.MetaValue\n From [Product Meta] c\n Where c.ProductId = a.Produ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34444/"
] | I put together a sample scenario of my issue and I hope its enough for someone to point me in the right direction.
I have two tables
Products

Product Meta

I need a result set of the following
 AS A,
MAX(CASE [m].MetaKey
WHEN 'B'
THEN [m].MetaValue
END) AS B,
... |
312,881 | <p>How do I actually run a file on localhost?
I know it is working, but how do I run a file on it, and how do I verify that the file is in fact running on localhost?</p>
<p><strong>Server newbie here, additional questions (I have xampp running Apache 2.2):</strong>
From your responses it sounds like I have to type in ... | [
{
"answer_id": 312886,
"author": "markus",
"author_id": 11995,
"author_profile": "https://Stackoverflow.com/users/11995",
"pm_score": 5,
"selected": false,
"text": "<p>Ok, thanks for the more specific info, ppl may remove their downvotes now...</p>\n\n<p>What you are proposing is a very ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40091/"
] | How do I actually run a file on localhost?
I know it is working, but how do I run a file on it, and how do I verify that the file is in fact running on localhost?
**Server newbie here, additional questions (I have xampp running Apache 2.2):**
From your responses it sounds like I have to type in the path in the browser... | Ok, thanks for the more specific info, ppl may remove their downvotes now...
What you are proposing is a very common thing to do! You want to run your web application locally without uploading it to your host yet. That's totally fine and that's what your Apache is there for. Your Apache is a web server meaning its mai... |
312,900 | <p>I'm writing a little web-based utility for my brother who needs to merge columns in a CSV file. I know things like this surely exist somewhere, but a large part of this is that is a fun little exercise.</p>
<p>Anyways, I'm trying to figure out the best/neatest way to present the part of the UI where he reorders the... | [
{
"answer_id": 312927,
"author": "dylanfm",
"author_id": 38795,
"author_profile": "https://Stackoverflow.com/users/38795",
"pm_score": 0,
"selected": false,
"text": "<p>I'd say to stick with using tables for tabular data, unordered lists don't seem to suit the content as much.</p>\n"
}... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2596/"
] | I'm writing a little web-based utility for my brother who needs to merge columns in a CSV file. I know things like this surely exist somewhere, but a large part of this is that is a fun little exercise.
Anyways, I'm trying to figure out the best/neatest way to present the part of the UI where he reorders the columns a... | Basic steps:
1. Grab the list of columns to be merged as an array of <li>'s.
* If you're merging two already-merged columns (or one of the colums is already merged), extract each column in the group. In your structure, you'd want to make "Column 1" have its own <li> without the child <ul>.
* You'd probably want to c... |
312,912 | <p>Given a list of sets:</p>
<ul>
<li>S_1 : [ 1, 2, 3, 4 ]</li>
<li>S_2 : [ 3, 4, 5, 6, 7 ]</li>
<li>S_3 : [ 8, 9, 10, 11 ]</li>
<li>S_4 : [ 1, 8, 12, 13 ]</li>
<li>S_5 : [ 6, 7, 14, 15, 16, 17 ]</li>
</ul>
<p>What the most efficient way to merge all sets that share at least 2 elements? I suppose this is similar to ... | [
{
"answer_id": 312971,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://Stackoverflow.com/users/658",
"pm_score": 2,
"selected": false,
"text": "<p>If you can order the elements in the set, you can look into using <a href=\"http://en.wikipedia.org/wiki/Merge_sort\" r... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21339/"
] | Given a list of sets:
* S\_1 : [ 1, 2, 3, 4 ]
* S\_2 : [ 3, 4, 5, 6, 7 ]
* S\_3 : [ 8, 9, 10, 11 ]
* S\_4 : [ 1, 8, 12, 13 ]
* S\_5 : [ 6, 7, 14, 15, 16, 17 ]
What the most efficient way to merge all sets that share at least 2 elements? I suppose this is similar to a connected components problem. So the result would ... | ```
Let there be a list of many Sets named (S)
Perform a pass through all elements of S, to determine the range (LOW .. HIGH).
Create an array of pointer to Set, of dimensions (LOW, HIGH), named (M).
do
Init all elements of M to NULL.
Iterate though S, processing them one Set at a time, named (Si).
... |
312,915 | <p>I've been trying to solve this for weeks...</p>
<p>My Goal is to search my inbox for the following messages:</p>
<pre><code>Hello
Hi
Hey
</code></pre>
<p>Im using three files to do this for me. The first, a .forward file in my $HOME</p>
<pre><code>"|IFS=' '&&exec usr/bin/procmail||exit 75 #username"
</co... | [
{
"answer_id": 312949,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 2,
"selected": false,
"text": "<p>Procmail processes mail as it comes in, not when it's just sitting there in your mailbox. If you want to process ma... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40120/"
] | I've been trying to solve this for weeks...
My Goal is to search my inbox for the following messages:
```
Hello
Hi
Hey
```
Im using three files to do this for me. The first, a .forward file in my $HOME
```
"|IFS=' '&&exec usr/bin/procmail||exit 75 #username"
```
And these two are in my ~/.procmail directory
```... | Procmail processes mail as it comes in, not when it's just sitting there in your mailbox. If you want to process mail that's already in your mailbox, you've got to pass it through procmail again, either by "bouncing" it to yourself, or by piping it through procmail. In a command line email client like mutt, you'd do th... |
312,925 | <p>I want to add some <a href="http://en.wikipedia.org/wiki/Ajax_%28programming%29" rel="noreferrer">Ajax</a>-niceness to my Django-coded website. </p>
<p>In my Django code, I use the <code>@login_required</code> decorator from <code>django.contrib.auth.decorators</code> to mark which view requires authentication. The... | [
{
"answer_id": 313015,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 3,
"selected": false,
"text": "<p>Sounds like a page template possibility.</p>\n\n<ol>\n<li><p>You could pass a <code>LINK_VIA</code> (or something) that ... | 2008/11/23 | [
"https://Stackoverflow.com/questions/312925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4172/"
] | I want to add some [Ajax](http://en.wikipedia.org/wiki/Ajax_%28programming%29)-niceness to my Django-coded website.
In my Django code, I use the `@login_required` decorator from `django.contrib.auth.decorators` to mark which view requires authentication. The default behavior when a not authenticated user clicks it is... | I am facing the same issue, and, like you, I would like a simple decorator to wrap around a Django ajax view in order to handle authentication in the same way that I have other views. One approach that seems promising to me is to use such a decorator in conjunction with JavaScript that looks for a certain value in the ... |