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 |
|---|---|---|---|---|---|---|
426,199 | <p>I'm using the latest nightly build, VS2008 prof trial and .NET 3.5 and
I'm getting this error</p>
<p>"Solution format of file 'C:\test\Project\src\project.sln' is not
supported."</p>
<p>Any Solution to overcome from it</p>
| [
{
"answer_id": 426225,
"author": "Tim",
"author_id": 10755,
"author_profile": "https://Stackoverflow.com/users/10755",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"https://stackoverflow.com/questions/327722/nant-and-vs2008-net-35-solution-format-of-file-solutionsln-is-not-supp... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47868/"
] | I'm using the latest nightly build, VS2008 prof trial and .NET 3.5 and
I'm getting this error
"Solution format of file 'C:\test\Project\src\project.sln' is not
supported."
Any Solution to overcome from it | I don't know from what you posted if this will work, but if you're trying to run the solution using a the Nant Msbuild task, you might be able to get away with substituting that for a an `exec` task that calls the most recent version of msbuild as an executable. For example:
```
<exec program="msbuild.exe"
base... |
426,219 | <p>Pardon the dumb newbie question here; web programming isn't my forte... (blush)</p>
<p>I have an aspx page running on a web server. I have a blob (byte array) containing any kind of binary file, plus a file name.</p>
<p>I would like to push this file to be downloaded through the browser onto the client, and opene... | [
{
"answer_id": 426236,
"author": "Bob",
"author_id": 45,
"author_profile": "https://Stackoverflow.com/users/45",
"pm_score": 4,
"selected": true,
"text": "<pre><code>Response.BinaryWrite(byteArray);\n</code></pre>\n\n<p>You should also set the content type</p>\n\n<pre><code>Response.Cont... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7850/"
] | Pardon the dumb newbie question here; web programming isn't my forte... (blush)
I have an aspx page running on a web server. I have a blob (byte array) containing any kind of binary file, plus a file name.
I would like to push this file to be downloaded through the browser onto the client, and opened using whatever a... | ```
Response.BinaryWrite(byteArray);
```
You should also set the content type
```
Response.ContentType = "application/pdf";
```
But that will be based on your file type.
And the file name (and everything together) is done like this
```
Response.AddHeader("content-disposition",
String.Format("attachment;filen... |
426,221 | <p>I have a query like this:</p>
<pre><code>SELECT t1.id,
(SELECT COUNT(t2.id)
FROM t2
WHERE t2.id = t1.id
) as num_things
FROM t1
WHERE num_things = 5;
</code></pre>
<p>The goal is to get the id of all the elements that appear 5 times in the other table. However, I get this error:</p>
<pre><... | [
{
"answer_id": 426237,
"author": "Brian Fisher",
"author_id": 43816,
"author_profile": "https://Stackoverflow.com/users/43816",
"pm_score": 2,
"selected": true,
"text": "<p>I think you could just rewrite your query like so:</p>\n\n<pre><code>SELECT t1.id\nFROM t1\nWHERE (SELECT COUNT(t2.... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] | I have a query like this:
```
SELECT t1.id,
(SELECT COUNT(t2.id)
FROM t2
WHERE t2.id = t1.id
) as num_things
FROM t1
WHERE num_things = 5;
```
The goal is to get the id of all the elements that appear 5 times in the other table. However, I get this error:
```
ERROR: column "num_things" does ... | I think you could just rewrite your query like so:
```
SELECT t1.id
FROM t1
WHERE (SELECT COUNT(t2.id)
FROM t2
WHERE t2.id = t1.id
) = 5;
``` |
426,224 | <p>Consider the following:</p>
<pre><code>typedef struct
{
float m00, m01, m02, m03;
float m10, m11, m12, m13;
float m20, m21, m22, m23;
float m30, m31, m32, m33;
} Matrix;
@interface TestClass : NSObject
{
Matrix matrix;
}
- (TestClass *) init;
@end
</code></pre>
<hr>
<pre><code>@implementation TestClas... | [
{
"answer_id": 426336,
"author": "Stefan Tannenbaum",
"author_id": 50511,
"author_profile": "https://Stackoverflow.com/users/50511",
"pm_score": 4,
"selected": true,
"text": "<p>In this case matrix <em>should</em> be embedded in the struct that is generated by the ObjectiveC compiler for... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50335/"
] | Consider the following:
```
typedef struct
{
float m00, m01, m02, m03;
float m10, m11, m12, m13;
float m20, m21, m22, m23;
float m30, m31, m32, m33;
} Matrix;
@interface TestClass : NSObject
{
Matrix matrix;
}
- (TestClass *) init;
@end
```
---
```
@implementation TestClass
- (TestClass *) init
{
self... | In this case matrix *should* be embedded in the struct that is generated by the ObjectiveC compiler for instances of TestClass. Its lifetime is bound to the instance of TestClass which it is part of, just like an int or float member would be.
You can easily test this, if you inspect the pointers.
```
TestClass* testA... |
426,230 | <p>I came across a reference to it recently on <a href="http://www.reddit.com/r/programming/comments/7o8d9/tcmalloca_faster_malloc_than_glibcs_open_sourced/c06wjka" rel="noreferrer">proggit</a> and (as of now) it is not explained.</p>
<p>I suspect <a href="https://stackoverflow.com/questions/335108/hide-symbols-in-sha... | [
{
"answer_id": 426244,
"author": "Joshua",
"author_id": 14768,
"author_profile": "https://Stackoverflow.com/users/14768",
"pm_score": 6,
"selected": false,
"text": "<p>You can override symbols in the stock libraries by creating a library with the same symbols and specifying the library i... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4203/"
] | I came across a reference to it recently on [proggit](http://www.reddit.com/r/programming/comments/7o8d9/tcmalloca_faster_malloc_than_glibcs_open_sourced/c06wjka) and (as of now) it is not explained.
I suspect [this](https://stackoverflow.com/questions/335108/hide-symbols-in-shared-object-from-ld#335253) might be it, ... | If you set `LD_PRELOAD` to the path of a shared object, that file will be loaded **before** any other library (including the C runtime, `libc.so`). So to run `ls` with your special `malloc()` implementation, do this:
```
$ LD_PRELOAD=/path/to/my/malloc.so /bin/ls
``` |
426,239 | <p>This is a good <a href="https://stackoverflow.com/questions/41785/learning-resources-on-parsers-interpreters-and-compilers">listing</a>, but what is the best one for a complete newb in this area. One for someone coming from a higher level background (VB6,C#,Java,Python) - not to familiar with C or C++. I'm much more... | [
{
"answer_id": 426308,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 5,
"selected": true,
"text": "<p>Please have a look at: <a href=\"https://stackoverflow.com/questions/1669/learning-to-write-a-compiler\">learning t... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36590/"
] | This is a good [listing](https://stackoverflow.com/questions/41785/learning-resources-on-parsers-interpreters-and-compilers), but what is the best one for a complete newb in this area. One for someone coming from a higher level background (VB6,C#,Java,Python) - not to familiar with C or C++. I'm much more interested in... | Please have a look at: [learning to write a compiler](https://stackoverflow.com/questions/1669/learning-to-write-a-compiler)
Also interesting:
* [how to write a programming language](https://stackoverflow.com/questions/229854/how-to-write-a-programming-language)
* [parsing where can i learn about it](https://stackove... |
426,258 | <p>I'd like to do something like this to tick a <code>checkbox</code> using <strong>jQuery</strong>:</p>
<pre><code>$(".myCheckBox").checked(true);
</code></pre>
<p>or</p>
<pre><code>$(".myCheckBox").selected(true);
</code></pre>
<p>Does such a thing exist?</p>
| [
{
"answer_id": 426273,
"author": "Micah",
"author_id": 17744,
"author_profile": "https://Stackoverflow.com/users/17744",
"pm_score": 7,
"selected": false,
"text": "<p>You can do</p>\n\n<pre><code>$('.myCheckbox').attr('checked',true) //Standards compliant\n</code></pre>\n\n<p>or</p>\n\n<... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18107/"
] | I'd like to do something like this to tick a `checkbox` using **jQuery**:
```
$(".myCheckBox").checked(true);
```
or
```
$(".myCheckBox").selected(true);
```
Does such a thing exist? | Modern jQuery
-------------
Use [`.prop()`](https://api.jquery.com/prop):
```
$('.myCheckbox').prop('checked', true);
$('.myCheckbox').prop('checked', false);
```
DOM API
-------
If you're working with just one element, you can always just access the underlying [`HTMLInputElement`](https://developer.mozilla.org/en... |
426,298 | <p>I need to write some python ftp code that uses a ftp proxy. The proxy doesn't require authentication but the ftp server I am connecting to does. I have the following code but I am getting a "I/O error(ftp error): 501 USER format: proxy-user:auth-method@destination. Closing connection." error. My code is:</p>
<pre><... | [
{
"answer_id": 426331,
"author": "Jehiah",
"author_id": 51022,
"author_profile": "https://Stackoverflow.com/users/51022",
"pm_score": 2,
"selected": false,
"text": "<p>I use the following code block which seems similar except i include the protocol in the <code>top_level_url</code> I use... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need to write some python ftp code that uses a ftp proxy. The proxy doesn't require authentication but the ftp server I am connecting to does. I have the following code but I am getting a "I/O error(ftp error): 501 USER format: proxy-user:auth-method@destination. Closing connection." error. My code is:
```
import ur... | I use the following code block which seems similar except i include the protocol in the `top_level_url` I use (and of course it's http).
You might also try calling `install_opener` after each `build_opener` call and then using `urllib2.urlopen`
```
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_passw... |
426,310 | <p>I have a database which holds the residents of each house in a certain street. I have a 'house view' php web page which can display an individual house and residents when given the house number using 'post'. I also have a 'street view' web page which gives a list of houses. What I want to know is if you can have lin... | [
{
"answer_id": 426324,
"author": "Jon Tackabury",
"author_id": 343,
"author_profile": "https://Stackoverflow.com/users/343",
"pm_score": 2,
"selected": false,
"text": "<p>I would just use a value in the querystring to pass the required information to the next page.</p>\n"
},
{
"a... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23435/"
] | I have a database which holds the residents of each house in a certain street. I have a 'house view' php web page which can display an individual house and residents when given the house number using 'post'. I also have a 'street view' web page which gives a list of houses. What I want to know is if you can have links ... | I assume that each house is stored in its own table and has an 'id' field, e.g house id. So when you loop through the houses and display them, you could do something like this:
```
<a href="house.php?id=<?php echo $house_id;?>">
<?php echo $house_name;?>
</a>
```
Then in house.php, you would get the house id using... |
426,346 | <p>I am currently doing a code review and the following code made me jump. I see multiple issues with this code. Do you agree with me? If so, how do I explain to my colleague that this is wrong (stubborn type...)?</p>
<ul>
<li>Catch a generic exception (Exception ex)</li>
<li>The use of "if (ex is something)" instead ... | [
{
"answer_id": 426356,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 5,
"selected": true,
"text": "<p>The mantra is:</p>\n\n<ul>\n<li>You should only catch exceptions if\nyou can properly handle them</li>\n</ul>\n\n<p>Thus... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42024/"
] | I am currently doing a code review and the following code made me jump. I see multiple issues with this code. Do you agree with me? If so, how do I explain to my colleague that this is wrong (stubborn type...)?
* Catch a generic exception (Exception ex)
* The use of "if (ex is something)" instead of having another cat... | The mantra is:
* You should only catch exceptions if
you can properly handle them
Thus:
* You should not catch general
exceptions.
---
In your case, yes, you should just catch those exceptions and do something helpful (probably not just eat them--you could `throw` after you log them).
Your coder is using `throw` ... |
426,353 | <p>If I use /clr:oldSyntax the following should work:</p>
<pre><code>public __value enum IceCreamFlavors
{
Vanilla,
Chocolate,
Sardine,
};
</code></pre>
<p>what is the equivalent in non-oldSyntax? How do I declare a "managed" enum in Managed C++ for .NET 2.0?</p>
<p><strong>Edit:</strong>
when I follow Jare... | [
{
"answer_id": 426362,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 3,
"selected": true,
"text": "<p>Try</p>\n\n<pre><code>enum class IceCreamFlavors {\n Vanilla,\n Chocolate,\n Sardine,\n};\n</code></pre>\n"
},
{... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2831/"
] | If I use /clr:oldSyntax the following should work:
```
public __value enum IceCreamFlavors
{
Vanilla,
Chocolate,
Sardine,
};
```
what is the equivalent in non-oldSyntax? How do I declare a "managed" enum in Managed C++ for .NET 2.0?
**Edit:**
when I follow JaredPar's [advice](https://stackoverflow.com/ques... | Try
```
enum class IceCreamFlavors {
Vanilla,
Chocolate,
Sardine,
};
``` |
426,363 | <p>In developing a relatively simple web service, that takes the data provided by a post and records it in a database table, we're getting this error:</p>
<p>Exception caught: The remote server returned an error: (500) Internal Server Er
or.
Stack trace: at System.Net.HttpWebRequest.GetResponse()</p>
<p>on some se... | [
{
"answer_id": 426428,
"author": "Dave Markle",
"author_id": 24995,
"author_profile": "https://Stackoverflow.com/users/24995",
"pm_score": 2,
"selected": false,
"text": "<p>Your diagnostic information is not good enough. An HTTP/500 isn't enough detail to really tell if your theory is c... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53133/"
] | In developing a relatively simple web service, that takes the data provided by a post and records it in a database table, we're getting this error:
Exception caught: The remote server returned an error: (500) Internal Server Er
or.
Stack trace: at System.Net.HttpWebRequest.GetResponse()
on some servers, but no others... | Your diagnostic information is not good enough. An HTTP/500 isn't enough detail to really tell if your theory is correct. You're going to need to capture a full stack trace in your logging if you want to get to the problem. I think you've jumped to a conclusion here. And no, you do not need that Dispose() before the en... |
426,368 | <p>So I've never worked with stored procedures and have not a whole lot of DB experience in general and I've been assigned a task that requires I create a package and I'm stuck.</p>
<p>Using SQL Developer, I'm trying to create a package called JUMPTO with this code...</p>
<pre><code>
create or replace package JUMPTO ... | [
{
"answer_id": 426428,
"author": "Dave Markle",
"author_id": 24995,
"author_profile": "https://Stackoverflow.com/users/24995",
"pm_score": 2,
"selected": false,
"text": "<p>Your diagnostic information is not good enough. An HTTP/500 isn't enough detail to really tell if your theory is c... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49294/"
] | So I've never worked with stored procedures and have not a whole lot of DB experience in general and I've been assigned a task that requires I create a package and I'm stuck.
Using SQL Developer, I'm trying to create a package called JUMPTO with this code...
```
create or replace package JUMPTO is
type t_locations... | Your diagnostic information is not good enough. An HTTP/500 isn't enough detail to really tell if your theory is correct. You're going to need to capture a full stack trace in your logging if you want to get to the problem. I think you've jumped to a conclusion here. And no, you do not need that Dispose() before the en... |
426,375 | <p>What I'd like to do is provide a link on an intranet web page that will launch a telnet session and pass context information to a shell script that will take the user to a specific "green screen." </p>
<p>This "pseudolink" might help show what I'm looking for:</p>
<pre><code><a href="telnet://<user>:<... | [
{
"answer_id": 426453,
"author": "LarryF",
"author_id": 18518,
"author_profile": "https://Stackoverflow.com/users/18518",
"pm_score": 5,
"selected": true,
"text": "<p>You need to use a cursor creator, which is pretty much just a bitmap with some header data. I'd use Irfanview if you do ... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6997/"
] | What I'd like to do is provide a link on an intranet web page that will launch a telnet session and pass context information to a shell script that will take the user to a specific "green screen."
This "pseudolink" might help show what I'm looking for:
```
<a href="telnet://<user>:<password>@<host>?showdetail%20123"... | You need to use a cursor creator, which is pretty much just a bitmap with some header data. I'd use Irfanview if you do not use Visual Studio or what not. If you use Visual Studio, just create a new cursor, and copy and paste the image data right into the editor... I'm sure I could whip up a tool that does this for you... |
426,379 | <p>I'm customizing a crystal report which was developed before me. One of the custom formulas includes the line: </p>
<pre><code>FreeFormText("kIMShipWhse")
</code></pre>
<p>Is this a built-in or custom function?</p>
| [
{
"answer_id": 426419,
"author": "Andrew Williams",
"author_id": 5901,
"author_profile": "https://Stackoverflow.com/users/5901",
"pm_score": 0,
"selected": false,
"text": "<p>Sounds like a custom UFL function, Only way to check is to run the report. If it's part of a custom UFL Crystal w... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18853/"
] | I'm customizing a crystal report which was developed before me. One of the custom formulas includes the line:
```
FreeFormText("kIMShipWhse")
```
Is this a built-in or custom function? | UFL-based functions are listed below the 'Additional Functions' node. Custom functions are listed below the 'Custom Functions' node. The remaining functions are 'native' functions. |
426,384 | <p>I have a script that forces a download and I make a call to this via Javascript. However, the dialog box doesn't pop up, here is the download.php script:</p>
<pre><code>header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Cont... | [
{
"answer_id": 426392,
"author": "Luca Matteis",
"author_id": 50394,
"author_profile": "https://Stackoverflow.com/users/50394",
"pm_score": 3,
"selected": true,
"text": "<p>It's not showing the dialog box for the very fact that its an Ajax call.</p>\n\n<pre><code>window.location.href = m... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51649/"
] | I have a script that forces a download and I make a call to this via Javascript. However, the dialog box doesn't pop up, here is the download.php script:
```
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",... | It's not showing the dialog box for the very fact that its an Ajax call.
```
window.location.href = msg;
```
Thats what's redirecting you. I don't think you need an ajax call here, just call the page normally with an href link.
**edit**
If you want the form to submit and show the dialog box for the download, do th... |
426,393 | <p>I'm using the table class that auto-generates a table for me from an array of data pulled from my database.</p>
<p><strong>Model</strong>:</p>
<pre><code>function get_reports_by_user_id($userid)
{
return $this->db->get_where('ss2_report',array('userid' => $userid))->result_array();
}
</code></pre>
... | [
{
"answer_id": 426408,
"author": "FryGuy",
"author_id": 28776,
"author_profile": "https://Stackoverflow.com/users/28776",
"pm_score": 1,
"selected": false,
"text": "<p>One idea might be to do something like..</p>\n\n<pre><code>foreach ($row in $this->mymodel->get_reports_by_user_id... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39539/"
] | I'm using the table class that auto-generates a table for me from an array of data pulled from my database.
**Model**:
```
function get_reports_by_user_id($userid)
{
return $this->db->get_where('ss2_report',array('userid' => $userid))->result_array();
}
```
**Controller**:
```
function index()
{
echo $this... | The only way is, in the function `get_reports_by_user_id()` , you would loop through all the results and add the `<a href>` tag to the ids. Something like this:
```
function get_reports_by_user_id($userid)
{
$rows=$this->db->get_where('ss2_report',array('userid' => $userid))->result_array();
foreach ($rows as $r... |
426,397 | <p>I am trying to parse the Linux <code>/etc/passwd</code> file in Java. I'm currently reading each line through the <a href="https://docs.oracle.com/javase/9/docs/api/java/util/Scanner.html" rel="noreferrer"><code>java.util.Scanner</code></a> class and then using <a href="https://docs.oracle.com/javase/9/docs/api/jav... | [
{
"answer_id": 426404,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 6,
"selected": false,
"text": "<p>From <a href=\"http://en.wikipedia.org/wiki/Newline#Representations\" rel=\"noreferrer\">Wikipedia</a>:</p>\n\n<blockqu... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38663/"
] | I am trying to parse the Linux `/etc/passwd` file in Java. I'm currently reading each line through the [`java.util.Scanner`](https://docs.oracle.com/javase/9/docs/api/java/util/Scanner.html) class and then using [`java.lang.String.split(String)`](https://docs.oracle.com/javase/9/docs/api/java/lang/String.html#split-jav... | From [Wikipedia](http://en.wikipedia.org/wiki/Newline#Representations):
>
> * LF: Multics, Unix and Unix-like systems (GNU/**Linux**, AIX, Xenix, **Mac OS
> X**, FreeBSD, etc.), BeOS, Amiga, RISC
> OS, and others
> * CR+LF: DEC RT-11 and most other early non-Unix, non-IBM OSes, CP/M,
> MP/M, **DOS**, OS/2, Microso... |
426,398 | <p>I have an HTML table that looks like this:</p>
<pre><code>-------------------------------------------------
|Column 1 |Column 2 |
-------------------------------------------------
|this is the text in column |this is the column |
|one which wraps |two test |
--------... | [
{
"answer_id": 426405,
"author": "DavGarcia",
"author_id": 40161,
"author_profile": "https://Stackoverflow.com/users/40161",
"pm_score": 8,
"selected": true,
"text": "<p>Use the CSS property <a href=\"http://www.w3schools.com/cssref/pr_text_white-space.asp\" rel=\"noreferrer\">white-spac... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4965/"
] | I have an HTML table that looks like this:
```
-------------------------------------------------
|Column 1 |Column 2 |
-------------------------------------------------
|this is the text in column |this is the column |
|one which wraps |two test |
----------------------... | Use the CSS property [white-space: nowrap](http://www.w3schools.com/cssref/pr_text_white-space.asp) and [overflow: hidden](http://www.w3schools.com/cssref/pr_pos_overflow.asp) on your td.
Update
------
Just saw your comment, not sure what I was thinking, I've done this so many times I forgot how I do it. This is appr... |
426,421 | <p>I am trying to create a WPF application that takes command line arguments. If no arguments are given, the main window should pop up. In cases of some specific command line arguments, code should be run with no GUI and exit when finished. Any suggestions on how this should properly be done would be appreciated.</p>
| [
{
"answer_id": 426436,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 8,
"selected": true,
"text": "<p>First, find this attribute at the top of your App.xaml file and remove it:</p>\n\n<pre><code>StartupUri=\"Window1.xaml... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20489/"
] | I am trying to create a WPF application that takes command line arguments. If no arguments are given, the main window should pop up. In cases of some specific command line arguments, code should be run with no GUI and exit when finished. Any suggestions on how this should properly be done would be appreciated. | First, find this attribute at the top of your App.xaml file and remove it:
```
StartupUri="Window1.xaml"
```
That means that the application won't automatically instantiate your main window and show it.
Next, override the OnStartup method in your App class to perform the logic:
```
protected override void OnStartu... |
426,463 | <p>I try to encrypt simple text with RSA algorithm. I have a problem with my code.</p>
<pre><code>RSA *_RSA ;
unsigned char text[2560] = "A";
unsigned char sectext[2560];
unsigned char decrypttext[2560];
int i = 0;
_RSA = RSA_generate_key ( 1024, 65537, NULL, NULL );
i = RSA_public_encrypt ( 1, text, sectex... | [
{
"answer_id": 426608,
"author": "Andreas Magnusson",
"author_id": 5811,
"author_profile": "https://Stackoverflow.com/users/5811",
"pm_score": 0,
"selected": false,
"text": "<p>Try calling <a href=\"http://www.openssl.org/docs/crypto/ERR_error_string.html\" rel=\"nofollow noreferrer\"><c... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I try to encrypt simple text with RSA algorithm. I have a problem with my code.
```
RSA *_RSA ;
unsigned char text[2560] = "A";
unsigned char sectext[2560];
unsigned char decrypttext[2560];
int i = 0;
_RSA = RSA_generate_key ( 1024, 65537, NULL, NULL );
i = RSA_public_encrypt ( 1, text, sectext, _RSA, R... | You should not pass 1 to `RSA_private_decrypt` but the length of the block you are trying to decrypt, ie. the return value of `RSA_public_encrypt` = 128. You do not know the length of the cleartext when you are decrypting!
This complete sample program results in:
```
128 from encrypt.
1 from decrypt: 'A'
```
Sourc... |
426,483 | <p>I'm not familiar with ASP, but am helping someone out with their website as a side project. I am trying to call Apache FOP (a java application) from ASP using VB. I have seen simple examples using the GetObject('java:...') constuct, but I don't know how to pass and retrieve binary data from a java object.</p>
<p>... | [
{
"answer_id": 426632,
"author": "duffymo",
"author_id": 37213,
"author_profile": "https://Stackoverflow.com/users/37213",
"pm_score": 1,
"selected": false,
"text": "<p>I wouldn't worry about efficiency until I had observed a problem and measurements told me that the FOP solution was the... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53130/"
] | I'm not familiar with ASP, but am helping someone out with their website as a side project. I am trying to call Apache FOP (a java application) from ASP using VB. I have seen simple examples using the GetObject('java:...') constuct, but I don't know how to pass and retrieve binary data from a java object.
Ideally, I w... | I figured out a workaround. This is for IIS running on a Win 2k3 Server--older versions will be much easier.
First I created a subdirectory off the main site (for security purposes) and attached a new application pool to that directory. The new application pool needs to run as Local System. I couldn't get fop.bat to w... |
426,489 | <p>I am working with a Visual Studio 2008 (C#) project on Windows XP Pro. I am trying to publish that application using "Publish Web" wizard to a remote server which is Windows Web Server 2008 OS. </p>
<p>But the publishing fails every time with following error:</p>
<pre> Connecting to http://XX.XXX.XXX.XX/...
Unabl... | [
{
"answer_id": 426508,
"author": "cmsjr",
"author_id": 23114,
"author_profile": "https://Stackoverflow.com/users/23114",
"pm_score": 0,
"selected": false,
"text": "<p>I've had problems with the http publishing more often than not. I've worked around it by setting up an ftp directory that... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53124/"
] | I am working with a Visual Studio 2008 (C#) project on Windows XP Pro. I am trying to publish that application using "Publish Web" wizard to a remote server which is Windows Web Server 2008 OS.
But the publishing fails every time with following error:
```
Connecting to http://XX.XXX.XXX.XX/...
Unable to create the... | ok problem is solved.
it was an user authorization issue. I set the user as admin for remote server. |
426,495 | <p>How do you rename a table in <a href="http://en.wikipedia.org/wiki/SQLite" rel="noreferrer">SQLite</a> 3.0?</p>
| [
{
"answer_id": 426512,
"author": "John Sheehan",
"author_id": 1786,
"author_profile": "https://Stackoverflow.com/users/1786",
"pm_score": 9,
"selected": true,
"text": "<pre><code>ALTER TABLE `foo` RENAME TO `bar`\n</code></pre>\n\n<p><a href=\"http://www.sqlite.org/lang_altertable.html\"... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4883/"
] | How do you rename a table in [SQLite](http://en.wikipedia.org/wiki/SQLite) 3.0? | ```
ALTER TABLE `foo` RENAME TO `bar`
```
[SQLite Query Language: ALTER TABLE](http://www.sqlite.org/lang_altertable.html) |
426,497 | <p>I get the following compilation error with the following source code:</p>
<p>Compilation Error:</p>
<p>Type of conditional expression cannot be determined because there is no implicit conversion between '' and 'MyEnum'</p>
<p>Source Code</p>
<pre><code>public enum MyEnum
{
Value1, Value2, Value3
}
public cl... | [
{
"answer_id": 426516,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>I think you will just need to cast the result to (MyEnum?) rather than (MyEnum)?</p>\n"
},
{
"answer_id": 426517,
... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26327/"
] | I get the following compilation error with the following source code:
Compilation Error:
Type of conditional expression cannot be determined because there is no implicit conversion between '' and 'MyEnum'
Source Code
```
public enum MyEnum
{
Value1, Value2, Value3
}
public class MyClass
{
public MyClass() ... | I think you just need to cast the result of `Enum.Parse` to `MyEnum?`. This is the case with nullable ints at least. E.g.:
```
int? i;
i = shouldBeNull ? null : (int?) 123;
```
So:
```
MyClassEnum = Convert.IsDBNull(x)
? null
: (MyEnum?) Enum.Parse(typeof(MyEnum), x.ToString(), true)
``` |
426,499 | <p>I created a Winforms AutoComplete combobox control inheriting from ComboBox with the following method:</p>
<pre><code>Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs)
MyBase.OnKeyPress(e)
Dim text As String = Me.Text
If Char.IsLetter(e.KeyChar) Then
... | [
{
"answer_id": 427031,
"author": "James",
"author_id": 41039,
"author_profile": "https://Stackoverflow.com/users/41039",
"pm_score": 3,
"selected": true,
"text": "<p>When I've gotten that error, it turned out to really be an issue with dereferencing a null pointer, but it made the method... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24681/"
] | I created a Winforms AutoComplete combobox control inheriting from ComboBox with the following method:
```
Protected Overrides Sub OnKeyPress(ByVal e As System.Windows.Forms.KeyPressEventArgs)
MyBase.OnKeyPress(e)
Dim text As String = Me.Text
If Char.IsLetter(e.KeyChar) Then
text = ... | When I've gotten that error, it turned out to really be an issue with dereferencing a null pointer, but it made the method call anyway and didn't crash until it tried to access one of the member variables. I haven't really worked with VB since before the days of .Net, but your stack trace suggests it died in a native c... |
426,500 | <p>I'm trying to unit test some code that looks like this:</p>
<pre><code>def main():
parser = optparse.OptionParser(description='This tool is cool', prog='cool-tool')
parser.add_option('--foo', action='store', help='The foo option is self-explanatory')
options, arguments = parser.parse_args()
if not o... | [
{
"answer_id": 426624,
"author": "dF.",
"author_id": 3002,
"author_profile": "https://Stackoverflow.com/users/3002",
"pm_score": 4,
"selected": false,
"text": "<p>Will this work instead of <code>assertEquals</code>?</p>\n\n<pre><code>self.assertRaises(SystemExit, sut.main, 2)\n</code></p... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426500",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4766/"
] | I'm trying to unit test some code that looks like this:
```
def main():
parser = optparse.OptionParser(description='This tool is cool', prog='cool-tool')
parser.add_option('--foo', action='store', help='The foo option is self-explanatory')
options, arguments = parser.parse_args()
if not options.foo:
... | As noted in my updates to my question, I had to modify [dF](https://stackoverflow.com/users/3002/df)'s answer to:
```
self.assertRaises(SystemExit, sut.main)
```
...and I came up with a few longer snippet to test for the exit code.
[Note: I accepted my own answer, but I will delete this answer and accept [dF](https... |
426,505 | <p>I have been struggling for some time trying to define a generic interface, but I fail to
achieve what I want. The following is a simplified example of the problem.</p>
<p>Let's say I have a generic <em>Message</em> class</p>
<pre><code>public class Message<T> {
private T content;
public void setCon... | [
{
"answer_id": 426529,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>It looks to me like you want:</p>\n\n<pre><code>public class Carrier<Thing extends Message<Foo>, Foo>\n ... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23118/"
] | I have been struggling for some time trying to define a generic interface, but I fail to
achieve what I want. The following is a simplified example of the problem.
Let's say I have a generic *Message* class
```
public class Message<T> {
private T content;
public void setContent(T content) {
this.con... | It looks to me like you want:
```
public class Carrier<Thing extends Message<Foo>, Foo>
implements Transfer<Thing>
```
That way the compiler will know that `thing` is a `Message<Foo>` and will therefore have a getContent() method.
You'll need to use it as:
```
Carrier<Message<String>, String>
```
But you've ... |
426,540 | <p>This question doesn't relate only to MouseEvent.CLICK event type but to all event types that already exist in AS3. I read a lot about custom events but until now I couldn't figure it out how to do what I want to do. I'm going to try to explain, I hope you understand:</p>
<p>Here is a illustration of my situation:</... | [
{
"answer_id": 426743,
"author": "fenomas",
"author_id": 10651,
"author_profile": "https://Stackoverflow.com/users/10651",
"pm_score": 2,
"selected": false,
"text": "<p>You can accomplish this by getting your handler out of a function that gives the variable closure, like this:</p>\n\n<p... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47883/"
] | This question doesn't relate only to MouseEvent.CLICK event type but to all event types that already exist in AS3. I read a lot about custom events but until now I couldn't figure it out how to do what I want to do. I'm going to try to explain, I hope you understand:
Here is a illustration of my situation:
```
for(va... | Without knowing more about your application, it seems more like you should use the target to pass parameters, or extend MouseEvent. The former would be more in line with common practice, though. So for example, if you exposed an integer public property on your "clip" object (whatever it is):
```
public class MyClip
{
... |
426,544 | <p>I am concentrating this question on 'reporting-type' queries (count, avg etc. i.e. ones that don't return the domain model itself) and I was just wondering if there is any inherent performance benefit in using HQL, as it may be able to leverage the second level cache. Or perhaps even better - cache the entire query.... | [
{
"answer_id": 426545,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stackoverflow.com/users/12349",
"pm_score": -1,
"selected": false,
"text": "<p>HQL is an object query language. SQL is a relational query language.</p>\n"
},
{
"answer_id": 426763,
"a... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4884/"
] | I am concentrating this question on 'reporting-type' queries (count, avg etc. i.e. ones that don't return the domain model itself) and I was just wondering if there is any inherent performance benefit in using HQL, as it may be able to leverage the second level cache. Or perhaps even better - cache the entire query.
T... | There are zero advantages. HQL will not outperform a direct database query to perform data aggregation and computation.
The result of something like:
```
Select count(*), dept from employees group by dept
```
Will always perform faster at the DB then in HQL. Note I say *always* because it is lame to take the 'depen... |
426,551 | <ol>
<li><p>Header div on top of the 3 columns</p></li>
<li><p>Height of all columns must fill at least the height of viewport. So if a column has a different bgcolor, the color is all the way to bottom of viewport even if column has no content.</p></li>
<li><p>Second and 3rd columns have variable width. If 3rd column ... | [
{
"answer_id": 426564,
"author": "cmsjr",
"author_id": 23114,
"author_profile": "https://Stackoverflow.com/users/23114",
"pm_score": 0,
"selected": false,
"text": "<p>Here's a good reference</p>\n\n<p><a href=\"http://www.glish.com/css/index.html\" rel=\"nofollow noreferrer\">http://www.... | 2009/01/08 | [
"https://Stackoverflow.com/questions/426551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5232/"
] | 1. Header div on top of the 3 columns
2. Height of all columns must fill at least the height of viewport. So if a column has a different bgcolor, the color is all the way to bottom of viewport even if column has no content.
3. Second and 3rd columns have variable width. If 3rd column width is 0, 3rd column collapses an... | [Give up and use tables](http://giveupandusetables.com/)
Really, css alone is not suitable for this kind of thing.
use a simple 3-column table, then use css on top of it.
```
<table id="layout"><tr>
<td id="left-column"> {{ NAV MENU }} </td>
<td>
<table id="middle-table"><tr><td id="middle-column"> {... |
426,561 | <p>I have an ascii file and in there somewhere is the line:
BEGIN
and later on the line:
END</p>
<p>I'd like to be able to remove those two lines and everything in between from a command line call in windows. This needs to be completely automated. </p>
<p>EDIT: See <a href="https://stackoverflow.com/questions/425864/... | [
{
"answer_id": 426695,
"author": "danieltalsky",
"author_id": 22452,
"author_profile": "https://Stackoverflow.com/users/22452",
"pm_score": 1,
"selected": false,
"text": "<p>Alternately, what I use these days is a scripting language that plays nicely with windows like Ruby or Python for ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51948/"
] | I have an ascii file and in there somewhere is the line:
BEGIN
and later on the line:
END
I'd like to be able to remove those two lines and everything in between from a command line call in windows. This needs to be completely automated.
EDIT: See [sed in Vista - how to delete all symbols between?](https://stackover... | Alternately, what I use these days is a scripting language that plays nicely with windows like Ruby or Python for such tasks. Ruby is easy to install in windows and makes problems like this child's play.
Here's a script you could use like:
**cutBeginEnd.rb myFileName.txt**
```
sourcefile = File.open(ARGV[0])
# Get ... |
426,563 | <p>I created a local subversion directory and I'm having problems. I tried checking in my first file with the following command:</p>
<pre><code>svn ci TestCommenterParseFilter.java
</code></pre>
<p>and I got the following error message</p>
<pre><code>svn: Commit failed (details follow):
svn: Can't create directory ... | [
{
"answer_id": 426581,
"author": "Jonathan Lonowski",
"author_id": 15031,
"author_profile": "https://Stackoverflow.com/users/15031",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think it'll fix the issue (usually gives a different error message) -- but still something to try...<... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51189/"
] | I created a local subversion directory and I'm having problems. I tried checking in my first file with the following command:
```
svn ci TestCommenterParseFilter.java
```
and I got the following error message
```
svn: Commit failed (details follow):
svn: Can't create directory '/export/svn/db/transactions/1-1.txn'... | The "permission denied" error, and the pathnames you have used, indicate that your user account doesn't have file permission to write to the `/export/svn` directory tree. There are at least two approaches to solving this:
1. Change the file permissions (perhaps with a group +w bit) on `/export/svn` so that you can wri... |
426,573 | <p>I work off of a multi-user Windows Server, and the rdpclip bug bites us all daily. We usually just open task manager and kill then restart rdpclip, but that's a pain in the butt. I wrote a powershell script for killing then restarting rdpclip, but no one's using it because it's a script (not to mention the executi... | [
{
"answer_id": 426618,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 1,
"selected": false,
"text": "<p>Read the following CodeProject article, it has all the information you need:</p>\n\n<blockquote>\n <p><a href=\"h... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426573",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53159/"
] | I work off of a multi-user Windows Server, and the rdpclip bug bites us all daily. We usually just open task manager and kill then restart rdpclip, but that's a pain in the butt. I wrote a powershell script for killing then restarting rdpclip, but no one's using it because it's a script (not to mention the execution po... | Ok, here's what I ended up doing:
```
Process[] processlist = Process.GetProcesses();
bool rdpclipFound = false;
foreach (Process theprocess in processlist)
{
String ProcessUserSID = GetProcessInfoByPID(theprocess.Id);
String CurrentUser =... |
426,579 | <p>I've become interested in algorithms lately, and the fibonacci sequence grabbed my attention due to its simplicity.</p>
<p>I've managed to put something together in javascript that calculates the nth term in the fibonacci sequence in less than 15 milliseconds after reading lots of information on the web. It goes up... | [
{
"answer_id": 426594,
"author": "recursive",
"author_id": 44743,
"author_profile": "https://Stackoverflow.com/users/44743",
"pm_score": 3,
"selected": false,
"text": "<p>There is a closed form (no loops) solution for the nth Fibonacci number.</p>\n\n<p><a href=\"http://en.wikipedia.org/... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50548/"
] | I've become interested in algorithms lately, and the fibonacci sequence grabbed my attention due to its simplicity.
I've managed to put something together in javascript that calculates the nth term in the fibonacci sequence in less than 15 milliseconds after reading lots of information on the web. It goes up to 1476..... | Don't speculate, benchmark:
**edit:** I added my own matrix implementation using the optimized multiplication functions mentioned in my other answer. This resulted in a major speedup, but even the vanilla O(n^3) implementation of matrix multiplication with loops was faster than the Strassen algorithm.
```
<pre><scrip... |
426,584 | <p>What is the easiest way to programmatically force capitalization of keywords in Visual Studio 2008?</p>
<p>We work with a proprietary command delimited language (like HTML). We are attempting to migrate from an older editor to Visual Studio 2008. Our coding standards are to capitalize the commands. The old edito... | [
{
"answer_id": 426602,
"author": "Rob Allen",
"author_id": 149,
"author_profile": "https://Stackoverflow.com/users/149",
"pm_score": 1,
"selected": false,
"text": "<p>While time consuming, <a href=\"https://stackoverflow.com/questions/2279/add-custom-tag-to-visual-studio-validation\">thi... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8366/"
] | What is the easiest way to programmatically force capitalization of keywords in Visual Studio 2008?
We work with a proprietary command delimited language (like HTML). We are attempting to migrate from an older editor to Visual Studio 2008. Our coding standards are to capitalize the commands. The old editor is customiz... | This may not be the best solution but here is what I came up with.
Use macros to capture Key Press Events.
Here's how:
1. In Visual Studio go to the **Tools->Macros->Macros IDE** menu
2. Double Click "MyMacros" to see the different parts
3. Double Click "EnvironmentEvents"
4. Add the following code within the Enviro... |
426,599 | <p>I am using asp.net and I am trying to save checkbox values into a database. Multiple checkboxes may be entered into the same field in the database. So for instance I have two checkboxes with names "Comma" and "Hyphen" and if the user checks both of these then the database will store the values ',','-'. How do you do... | [
{
"answer_id": 426621,
"author": "DavGarcia",
"author_id": 40161,
"author_profile": "https://Stackoverflow.com/users/40161",
"pm_score": 2,
"selected": true,
"text": "<p>To save multiple values into the same column I'd recommend using a flag enumeration. Here is a <a href=\"http://snippl... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45429/"
] | I am using asp.net and I am trying to save checkbox values into a database. Multiple checkboxes may be entered into the same field in the database. So for instance I have two checkboxes with names "Comma" and "Hyphen" and if the user checks both of these then the database will store the values ',','-'. How do you do th... | To save multiple values into the same column I'd recommend using a flag enumeration. Here is a [code sample using checkboxes](http://snipplr.com/view/2402/using-a-flag-enumeration-with-bitwise-operations/).
If you really have to store the values in a comma-delimited format, might try something like this:
```
List<str... |
426,609 | <p>I don't know what I am missing, but I added Profile properties in the Web.config file but cannot access Profile.<em>Item</em> in the code or create a new profile.</p>
| [
{
"answer_id": 427066,
"author": "nshaw",
"author_id": 29426,
"author_profile": "https://Stackoverflow.com/users/29426",
"pm_score": 2,
"selected": false,
"text": "<p>If you are using a web application project, you cannot access the Profile object at design-time out-of-the-box. Here is a... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49632/"
] | I don't know what I am missing, but I added Profile properties in the Web.config file but cannot access Profile.*Item* in the code or create a new profile. | I had the same problem today, and learned a lot.
There are two kinds of project in Visual Studio -- "Web Site Projects" and "Web Application Projects." For reasons which are a complete mystery to me, Web Application Projects cannot use **Profile.** directly... the strongly-typed class is not magically generated for yo... |
426,620 | <p>Ever stumbled on a tutorial that you feel is of great value but not quite explained properly? That's my dilemma. I know <a href="http://www.tonymarston.net/php-mysql/backbuttonblues.html" rel="nofollow noreferrer">THIS TUTORIAL</a> has some value but I just can't get it. </p>
<ol>
<li>Where do you call each functio... | [
{
"answer_id": 426651,
"author": "BobbyShaftoe",
"author_id": 38426,
"author_profile": "https://Stackoverflow.com/users/38426",
"pm_score": 4,
"selected": true,
"text": "<p>That is a good discussion but more to the point you should be looking into Post Redirect Get (PRG) also known as \"... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40376/"
] | Ever stumbled on a tutorial that you feel is of great value but not quite explained properly? That's my dilemma. I know [THIS TUTORIAL](http://www.tonymarston.net/php-mysql/backbuttonblues.html) has some value but I just can't get it.
1. Where do you call each function?
2. Which function should be called
first and wh... | That is a good discussion but more to the point you should be looking into Post Redirect Get (PRG) also known as "Get after Post."
<http://www.theserverside.com/patterns/thread.tss?thread_id=20936> |
426,622 | <p>After going through the Appendix A, "C# Coding Style Conventions" of the great book "Framework Design Guidelines" (2nd edition from November 2008), I am quite confused as to what coding style is Microsoft using internally / recommending.</p>
<p>The blog entry <a href="http://blogs.msdn.com/sourceanalysis/archive/20... | [
{
"answer_id": 426671,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 1,
"selected": false,
"text": "<p>You make a decision. If you like some parts of one and some parts of the other, write your own style guide. If... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23843/"
] | After going through the Appendix A, "C# Coding Style Conventions" of the great book "Framework Design Guidelines" (2nd edition from November 2008), I am quite confused as to what coding style is Microsoft using internally / recommending.
The blog entry [A Brief History Of C# Style](http://blogs.msdn.com/sourceanalysis... | On a blog I read about this (I can't seem to find the url) it was stated:
the framework guidelines are based and evolved from C++ guideliness (they are all seasoned C++ developers) while the guidelines stylecop provides are more modern new C# only guideliness...
Both are fine, make a decision yourself... I personally u... |
426,647 | <p>I have a huge tab separated file which I want to sort on its 2nd column. I need to use the tab character as the field delimiter in cygwin sort. So I need something like this:</p>
<pre><code>sort -t \t -k 2,2 in.txt > out.txt
</code></pre>
<p>But the command prompt evaluates '\t' literally and not as the tab cha... | [
{
"answer_id": 426699,
"author": "PEZ",
"author_id": 44639,
"author_profile": "https://Stackoverflow.com/users/44639",
"pm_score": 5,
"selected": true,
"text": "<p>On my machine (Mac bash prompt, GNU sort ...) this works:</p>\n<pre><code>sort -t ' ' -k 2,2 in.txt > out.txt\n</code><... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5734/"
] | I have a huge tab separated file which I want to sort on its 2nd column. I need to use the tab character as the field delimiter in cygwin sort. So I need something like this:
```
sort -t \t -k 2,2 in.txt > out.txt
```
But the command prompt evaluates '\t' literally and not as the tab character. Note that I need to d... | On my machine (Mac bash prompt, GNU sort ...) this works:
```
sort -t ' ' -k 2,2 in.txt > out.txt
```
(A "real" tab between the quotes.)
To get the tab there I type `CTRL`-`V`, `TAB` (`CTRL`-`V` followed by `TAB`).
EDIT: I've now tested it on a Windows machine from the cygwin prompt and it works the same there (... |
426,649 | <p>I am constantly forgetting what the special little codes are for formatting .NET strings. Either through ToString() or using String.Format(). Alignment, padding, month vs. minute (month is uppercase M?), abbreviation vs. full word, etc. I can never remember.</p>
<p>I have the same problem with regexes, but luckily ... | [
{
"answer_id": 426662,
"author": "RSlaughter",
"author_id": 40848,
"author_profile": "https://Stackoverflow.com/users/40848",
"pm_score": 1,
"selected": false,
"text": "<p><strike>You could use the <a href=\"http://jasonhaley.com/blog/archive/2008/11/23/142521.aspx\" rel=\"nofollow noref... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14582/"
] | I am constantly forgetting what the special little codes are for formatting .NET strings. Either through ToString() or using String.Format(). Alignment, padding, month vs. minute (month is uppercase M?), abbreviation vs. full word, etc. I can never remember.
I have the same problem with regexes, but luckily there's [E... | PowerShell works great for testing format strings. From PowerShell you can load your assembly and work with the objects and methods you want to test. You could also just create a string on the command line and test out different formatting options.
You can use the static method from the string class:
```
$teststring ... |
426,650 | <p>When I create a constructor with parameters using Resharper's 'Generate code' feature, I get something like this:</p>
<pre><code>public class Example{
private int _x;
private int _y;
public Example(int _x, int _y){
this._x = _x;
this._y = _y;
}
}
</code></pre>
<p>I would like... | [
{
"answer_id": 426714,
"author": "Andre Gallo",
"author_id": 14401,
"author_profile": "https://Stackoverflow.com/users/14401",
"pm_score": 1,
"selected": false,
"text": "<p>Go to Resharper -> Live Templates -> C# -> find the class and the ctor templates and right click on them to make th... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1560/"
] | When I create a constructor with parameters using Resharper's 'Generate code' feature, I get something like this:
```
public class Example{
private int _x;
private int _y;
public Example(int _x, int _y){
this._x = _x;
this._y = _y;
}
}
```
I would like to use this naming conven... | Options / Languages / Common / Naming Style
You should set your field prefix to underscore. |
426,655 | <p>Or, in other words, what is wrong with something like -</p>
<pre><code>new Method[] {Vector.add(), Vector.remove()}
</code></pre>
<p>Eclipse keeps telling me that I need arguments. But I obviously don't want to call the methods, I just want to use them as objects! What to do?</p>
| [
{
"answer_id": 426660,
"author": "Allain Lalonde",
"author_id": 2443,
"author_profile": "https://Stackoverflow.com/users/2443",
"pm_score": 4,
"selected": true,
"text": "<p>this works, I can't help but wondering, what you're doing with this?</p>\n\n<pre><code>new Method[] { \n Vector.cl... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51792/"
] | Or, in other words, what is wrong with something like -
```
new Method[] {Vector.add(), Vector.remove()}
```
Eclipse keeps telling me that I need arguments. But I obviously don't want to call the methods, I just want to use them as objects! What to do? | this works, I can't help but wondering, what you're doing with this?
```
new Method[] {
Vector.class.getMethod("add", Object.class),
Vector.class.getMethod("remove", Object.class)
};
``` |
426,723 | <p>Why would someone use a group by versus distinct when there are no aggregations done in the query?</p>
<p>Also, does someone know the group by versus distinct performance considerations in MySQL and SQL Server. I'm guessing that SQL Server has a better optimizer and they might be close to equivalent there, but in ... | [
{
"answer_id": 426772,
"author": "Andre Gallo",
"author_id": 14401,
"author_profile": "https://Stackoverflow.com/users/14401",
"pm_score": 2,
"selected": false,
"text": "<p>Both would generate the same query plan in MS SQL Server.... If you have MS SQL Server you could just enable the ac... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36902/"
] | Why would someone use a group by versus distinct when there are no aggregations done in the query?
Also, does someone know the group by versus distinct performance considerations in MySQL and SQL Server. I'm guessing that SQL Server has a better optimizer and they might be close to equivalent there, but in MySQL, I ex... | A little (VERY little) empirical data from MS SQL Server, on a couple of random tables from our DB.
For the pattern:
```
SELECT col1, col2 FROM table GROUP BY col1, col2
```
and
```
SELECT DISTINCT col1, col2 FROM table
```
When there's no covering index for the query, both ways produced the following query pla... |
426,731 | <p>Out of the following queries, which method would you consider the better one? What are your reasons (code efficiency, better maintainability, less WTFery)...</p>
<pre><code>SELECT MIN(`field`)
FROM `tbl`;
SELECT `field`
FROM `tbl`
ORDER BY `field`
LIMIT 1;
</code></pre>
| [
{
"answer_id": 426738,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 4,
"selected": false,
"text": "<pre><code>SELECT MIN(`field`)\nFROM `tbl`;\n</code></pre>\n\n<p>Simply because it is ANSI compatible. Limit 1 is par... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | Out of the following queries, which method would you consider the better one? What are your reasons (code efficiency, better maintainability, less WTFery)...
```
SELECT MIN(`field`)
FROM `tbl`;
SELECT `field`
FROM `tbl`
ORDER BY `field`
LIMIT 1;
``` | In the worst case, where you're looking at an unindexed field, using `MIN()` requires a single full pass of the table. Using `SORT` and `LIMIT` requires a filesort. If run against a large table, there would likely be a significant difference in percieved performance. As an anecdotal data point, `MIN()` took .36s while ... |
426,736 | <p>I have the source code of an application written in C++ and I just want to comment something using:</p>
<pre><code>#ifdef 0
...
#endif
</code></pre>
<p>And I get this error</p>
<blockquote>
<p>error: macro names must be identifiers</p>
</blockquote>
<p>Why is this happening?</p>
| [
{
"answer_id": 426754,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 4,
"selected": false,
"text": "<p>Use the following to evaluate an expression (constant 0 evaluates to false).</p>\n\n<pre><code>#if 0\n ...\n#endif\n... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39160/"
] | I have the source code of an application written in C++ and I just want to comment something using:
```
#ifdef 0
...
#endif
```
And I get this error
>
> error: macro names must be identifiers
>
>
>
Why is this happening? | The #ifdef directive is used to check *if a preprocessor symbol is defined.* The standard (`C11 6.4.2 Identifiers`) mandates that identifiers must not start with a digit:
```none
identifier:
identifier-nondigit
identifier identifier-nondigit
identifier digit
identifier-nondigit:
nondigit
universal-... |
426,737 | <p>In the context of C++ (not that it matters):</p>
<pre><code>class Foo{
private:
int x[100];
public:
Foo();
}
</code></pre>
<p>What I've learnt tells me that if you create an instance of Foo like so:</p>
<pre><code>Foo bar = new Foo();
</code></pre>
<p>Then the array x is allocated on the ... | [
{
"answer_id": 426746,
"author": "Uri",
"author_id": 23072,
"author_profile": "https://Stackoverflow.com/users/23072",
"pm_score": 3,
"selected": false,
"text": "<p>An object of type Foo takes the size of 100 ints stored in sequence. \nIf you create it on the stack, you will be getting i... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46555/"
] | In the context of C++ (not that it matters):
```
class Foo{
private:
int x[100];
public:
Foo();
}
```
What I've learnt tells me that if you create an instance of Foo like so:
```
Foo bar = new Foo();
```
Then the array x is allocated on the heap, but if you created an instance of Foo like ... | Given a slight modification of your example:
```
class Foo{
private:
int x[100];
int *y;
public:
Foo()
{
y = new int[100];
}
~Foo()
{
delete[] y;
}
}
```
Example 1:
```
Foo *bar = new Foo();
```
* x and y are on the h... |
426,740 | <p>Is there any way to select a subset from a large set based on a property or predicate in less than <code>O(n)</code> time?</p>
<p>For a simple example, say I have a large set of authors. Each author has a one-to-many relationship with a set of books, and a one-to-one relationship with a city of birth.</p>
<p>Is th... | [
{
"answer_id": 426804,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"http://en.wikipedia.org/wiki/Inverted_index\" rel=\"nofollow noreferrer\">Inverted Index</a>.</p>\n\n<p>Since ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3044/"
] | Is there any way to select a subset from a large set based on a property or predicate in less than `O(n)` time?
For a simple example, say I have a large set of authors. Each author has a one-to-many relationship with a set of books, and a one-to-one relationship with a city of birth.
Is there a way to efficiently do ... | For joins like this on large data sets, a modern RDBMS will often use an algorithm called a **list merge**. Using your example:
1. Prepare a list, A, of all authors who live in Chicago and sort them by author in O(Nlog(N)) time.\*
2. Prepare a list, B, of all (author, book name) pairs and sort them by author in O(Mlog... |
426,747 | <p>I've run across an interesting PHP/SOAP error that has me stymied. After searching I have not found a plausible explanation, and I'd appreciate your help. Here's the background:</p>
<p>I have a site built in PHP/<a href="http://codeigniter.com/" rel="nofollow noreferrer">CodeIgniter</a> which uses SOAP to communica... | [
{
"answer_id": 426824,
"author": "David",
"author_id": 9908,
"author_profile": "https://Stackoverflow.com/users/9908",
"pm_score": 1,
"selected": false,
"text": "<p>You might have this \n<a href=\"http://us.php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen\" rel=\"nofoll... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53182/"
] | I've run across an interesting PHP/SOAP error that has me stymied. After searching I have not found a plausible explanation, and I'd appreciate your help. Here's the background:
I have a site built in PHP/[CodeIgniter](http://codeigniter.com/) which uses SOAP to communicate over SSL with a back-end system provided by ... | OK, a little update on this problem: the error *mysteriously* disappeared without any change from me. I will have to assume that there was some odd configuration error on Mosso that was silently fixed. It is also remotely possible that there was a problem with Company X's setup. That is the worst kind of fix IMO! Thank... |
426,758 | <p>I have a thread that needs to be executed every 10 seconds. This thread contains several calls (12 - 15) to a database on another server. Additionally, it also accesses around 3 files. Consequently, there will be quite a lot of IO and network overhead. </p>
<p>What is the best strategy to perform the above? </p>
<... | [
{
"answer_id": 426766,
"author": "jjnguy",
"author_id": 2598,
"author_profile": "https://Stackoverflow.com/users/2598",
"pm_score": 2,
"selected": false,
"text": "<p>Have a look at the <a href=\"http://java.sun.com/javase/6/docs/api/java/util/Timer.html\" rel=\"nofollow noreferrer\">Time... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48725/"
] | I have a thread that needs to be executed every 10 seconds. This thread contains several calls (12 - 15) to a database on another server. Additionally, it also accesses around 3 files. Consequently, there will be quite a lot of IO and network overhead.
What is the best strategy to perform the above?
One way would b... | I find that a [ScheduledExecutorService](http://java.sun.com/javase/6/docs/api/java/util/concurrent/ScheduledExecutorService.html) is an excellent way to do this. It is arguably slightly more complex than a `Timer`, but gives more flexibility in exchange (e.g. you could choose to use a single thread or a thread pool; i... |
426,765 | <p>I have an erlang server that will be communicating via tcp sockets with a client written in C. Are there any C libraries for parsing erlang binary terms to C structs?</p>
<p>I realize this is not absolutely necessary, but it would be very convenient.</p>
| [
{
"answer_id": 426922,
"author": "Thilo",
"author_id": 14955,
"author_profile": "https://Stackoverflow.com/users/14955",
"pm_score": 2,
"selected": false,
"text": "<p>There are C libraries for interprocess communication between Erlang and C, erl_interface and C Nodes:</p>\n\n<ul>\n<li><a... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49695/"
] | I have an erlang server that will be communicating via tcp sockets with a client written in C. Are there any C libraries for parsing erlang binary terms to C structs?
I realize this is not absolutely necessary, but it would be very convenient. | I've crafted my own: [EPAPI](http://code.google.com/p/epapi/) (Erlang Port API) in C/C++. Very easy to use and I provide a Debian repo for easy updates.
Example
-------
```
PktHandler *ph = new PktHandler();
MsgHandler *mh = new MsgHandler(ph);
//Register a message type
// {echo, {Counter}}
mh->registerType(1, ... |
426,779 | <p>I'm building a app that need manage money datatype.</p>
<p>I'm new on Obj-c, so I can't see the ligth in the use of NSDecimalNumber.</p>
<p>For example, in my unit test I do this:</p>
<pre><code>@interface SamplePerson : NSObject {
NSString *name;
NSDate *birthDate;
NSInteger size;
NSNumber *phone... | [
{
"answer_id": 426800,
"author": "Marc Charbonneau",
"author_id": 35136,
"author_profile": "https://Stackoverflow.com/users/35136",
"pm_score": 3,
"selected": true,
"text": "<p>The reason you're getting that warning is because you declared balance as a primitive NSDecimal, instead of an ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53185/"
] | I'm building a app that need manage money datatype.
I'm new on Obj-c, so I can't see the ligth in the use of NSDecimalNumber.
For example, in my unit test I do this:
```
@interface SamplePerson : NSObject {
NSString *name;
NSDate *birthDate;
NSInteger size;
NSNumber *phone;
NSDecimal balance;
... | The reason you're getting that warning is because you declared balance as a primitive NSDecimal, instead of an NSDecimalNumber \*. Take a look at [this question](https://stackoverflow.com/questions/421463/should-i-use-nsdecimalnumber-to-deal-with-money) as to why you should use NSDecimalNumber. |
426,805 | <p>I'm calling a javascript function that sets the opacity of an iframe an unknown amount of times in rapid succession. Basically this tweens the alpha from 0 to 100.
here is the code</p>
<pre><code>
function setAlpha(value)
{
iframe.style.opacity = value * .01;
iframe.style.filter = 'alpha(opacit... | [
{
"answer_id": 426842,
"author": "olliej",
"author_id": 784,
"author_profile": "https://Stackoverflow.com/users/784",
"pm_score": 1,
"selected": false,
"text": "<p>Javascript doesn't run across multiple threads so you're safe from race conditions (ignoring upcoming Worker thread support ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm calling a javascript function that sets the opacity of an iframe an unknown amount of times in rapid succession. Basically this tweens the alpha from 0 to 100.
here is the code
```
function setAlpha(value)
{
iframe.style.opacity = value * .01;
iframe.style.filter = 'alpha(opacity =' + val + ')... | The issue is that most browsers don't repaint until there is a pause in the javascript execution.
This can be solved by using setTimeout, as others have suggested. However, I recommend using something like jQuery, or any of the javascript libraries to do animations. Running setTimeout 100 times is a bad idea because t... |
426,825 | <p>Is it possible to check who is entering your website in PHP. I have a web application ( written in PHP) that should only allow users entering from some particular websites. Is it possible to get the referral websites by examining the <code>_Request</code> object? If yes, how?</p>
| [
{
"answer_id": 426829,
"author": "Rob",
"author_id": 41908,
"author_profile": "https://Stackoverflow.com/users/41908",
"pm_score": 0,
"selected": false,
"text": "<p>You need to examine the $_SERVER array for the 'HTTP_REFERER' key.</p>\n"
},
{
"answer_id": 426841,
"author": "... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3834/"
] | Is it possible to check who is entering your website in PHP. I have a web application ( written in PHP) that should only allow users entering from some particular websites. Is it possible to get the referral websites by examining the `_Request` object? If yes, how? | Yes, but keep in mind some proxies and other things strip this information out, and it can be easily forged. So never rely on it. For example, don't think your web app is secure from [CSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) because you check the referrer to match your own server.
```
$referringS... |
426,848 | <p>I wonder if it is possible to use KVC to generate SQL. I'm doing a light ORM; I wanna do something like this (pseudocode):</p>
<pre><code>for key in object.getKeys
sql = sql + formatField(key,objet.value[key]);
</code></pre>
<p>and get:</p>
<pre><code>INSERT INTO Table (Field1) VALUES (1);
</code></pre>
<p>I... | [
{
"answer_id": 426862,
"author": "Tall Jeff",
"author_id": 1553,
"author_profile": "https://Stackoverflow.com/users/1553",
"pm_score": 2,
"selected": false,
"text": "<p>On a PC is said in your title, so I assume you mean Windows? If so, I would recommend installing the <a href=\"http://c... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53185/"
] | I wonder if it is possible to use KVC to generate SQL. I'm doing a light ORM; I wanna do something like this (pseudocode):
```
for key in object.getKeys
sql = sql + formatField(key,objet.value[key]);
```
and get:
```
INSERT INTO Table (Field1) VALUES (1);
```
Is this possible in Objective-C? | * [GNU make](http://www.gnu.org/software/make/) is fast, but the native Windows-port is not very polished; there are a lot of pitfal regarding things like which shell is used to execute your commands. (Search for "MS-DOS" in the [GNU make manual](http://www.gnu.org/software/make/manual/make.html).)
* [SCons](http://sco... |
426,860 | <p>Does anyone know of a tool that will analyse a C++ codebase and display a graphical representation of which files include which header files and highlight redundant includes? I've used Understand C++ but it's expensive and became very unwieldy very quickly on a large (and poorly encapsulated) codebase.</p>
| [
{
"answer_id": 426882,
"author": "Tim",
"author_id": 10755,
"author_profile": "https://Stackoverflow.com/users/10755",
"pm_score": 1,
"selected": false,
"text": "<p>try this</p>\n\n<p><a href=\"https://stackoverflow.com/questions/42308/tool-to-track-include-dependencies\">Tool to track #... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52719/"
] | Does anyone know of a tool that will analyse a C++ codebase and display a graphical representation of which files include which header files and highlight redundant includes? I've used Understand C++ but it's expensive and became very unwieldy very quickly on a large (and poorly encapsulated) codebase. | There's always the *"-H"* option to gcc/g++...
Eg.: % **g++ -H foo.C**
```
'-H'
Print the name of each header file used, in addition to other
normal activities. Each name is indented to show how deep in the
'#include' stack it is. Precompiled header files are also
printed, even if they are found... |
426,878 | <p>In other words, can I do something like</p>
<pre><code>for() {
for {
for {
}
}
}
</code></pre>
<p>Except N times? In other words, when the method creating the loops is called, it is given some parameter N, and the method would then create N of these loops nested one in another?</p>
<p>Of cou... | [
{
"answer_id": 426884,
"author": "jjnguy",
"author_id": 2598,
"author_profile": "https://Stackoverflow.com/users/2598",
"pm_score": 6,
"selected": true,
"text": "<p>It sounds like you may want to look into <a href=\"http://en.wikipedia.org/wiki/Recursion\" rel=\"noreferrer\">recursion.</... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51792/"
] | In other words, can I do something like
```
for() {
for {
for {
}
}
}
```
Except N times? In other words, when the method creating the loops is called, it is given some parameter N, and the method would then create N of these loops nested one in another?
Of course, the idea is that there shoul... | It sounds like you may want to look into [recursion.](http://en.wikipedia.org/wiki/Recursion) |
426,941 | <p>I want do this:<br>
<strong>func(conditionA ? pa1 : pa2, conditionB ? pb1 : pb2, conditionC ? pc1 : pc2);</strong></p>
<p>In C style function, there is no problem. But if func() is a template function, compiler will report errors.
Here pa1 and pa2, ... are different class and have a <strong>static</strong> method -... | [
{
"answer_id": 426958,
"author": "Frank Krueger",
"author_id": 338,
"author_profile": "https://Stackoverflow.com/users/338",
"pm_score": 2,
"selected": false,
"text": "<p>The result of the conditional operator (that is, the <code>a</code> and <code>b</code> in <code>p ? a : b</code>) mus... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53200/"
] | I want do this:
**func(conditionA ? pa1 : pa2, conditionB ? pb1 : pb2, conditionC ? pc1 : pc2);**
In C style function, there is no problem. But if func() is a template function, compiler will report errors.
Here pa1 and pa2, ... are different class and have a **static** method - "convert()". convert() is also decla... | The result of the conditional operator (that is, the `a` and `b` in `p ? a : b`) must be of the same type. That is, you can't do:
```
predicate() ? 3.14 : "sdfsd"
```
Make sure your `pa1` and `pa2` are compatible types (either they are the same type, inherit from one type, or are cast to compatible types). If you in... |
426,963 | <p>I would like to convert tab to spaces in gVim. I added the following line to my <code>_vimrc</code>:</p>
<pre><code>set tabstop=2
</code></pre>
<p>It works to stop at two spaces but it still looks like one tab key is inserted (I tried to use the h key to count spaces afterwards).</p>
<p>I'm not sure what should I... | [
{
"answer_id": 426966,
"author": "Hank Gay",
"author_id": 4203,
"author_profile": "https://Stackoverflow.com/users/4203",
"pm_score": 7,
"selected": false,
"text": "<p>Try</p>\n\n<pre><code>set expandtab\n</code></pre>\n\n<p>for soft tabs.</p>\n\n<p>To fix pre-existing tabs:</p>\n\n<pre>... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62776/"
] | I would like to convert tab to spaces in gVim. I added the following line to my `_vimrc`:
```
set tabstop=2
```
It works to stop at two spaces but it still looks like one tab key is inserted (I tried to use the h key to count spaces afterwards).
I'm not sure what should I do to make gVim convert tabs to spaces? | IIRC, something like:
```
set tabstop=2 shiftwidth=2 expandtab
```
should do the trick. If you already have tabs, then follow it up with a nice global RE to replace them with double spaces.
If you already have tabs you want to replace,
```
:retab
``` |
426,979 | <p>My UI designer gives me great UI mockups created in Photoshop. I want to exactly match the colors in the mockup, but every time I create a color using the <code>-colorWithCalibratedRed:green:blue:alpha:</code> method of NSColor, the colors do not match.</p>
<p>I have tried sampling the colors from the Photoshop moc... | [
{
"answer_id": 426992,
"author": "Ates Goral",
"author_id": 23501,
"author_profile": "https://Stackoverflow.com/users/23501",
"pm_score": 2,
"selected": false,
"text": "<p>Have you tried turning color management off in Photoshop? With color management enabled, the actual RGB pixel values... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50122/"
] | My UI designer gives me great UI mockups created in Photoshop. I want to exactly match the colors in the mockup, but every time I create a color using the `-colorWithCalibratedRed:green:blue:alpha:` method of NSColor, the colors do not match.
I have tried sampling the colors from the Photoshop mockup using the Pixie a... | There's no such thing as a "pure" RGB color that's consistent from one display to the next. Unless you're working in a standardized color space, the numbers that show up for a color on one display will probably render slightly differently on another.
Have your designer convert your mock-ups to a standard color space s... |
426,991 | <p>Im learning lisp and im pretty new at this so i was wondering...</p>
<p>if i do this:</p>
<pre><code>(defparameter *list-1* (list 1 2))
(defparameter *list-2* (list 2 3))
(defparameter *list-3* (append *list-1* *list-2*))
</code></pre>
<p>And then</p>
<pre><code>(setf (first *list-2*) 1)
*list-3*
</code></pre>
... | [
{
"answer_id": 427002,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>append</code> function has to make a copy of its first argument, to avoid modifying existing data structures. As ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/426991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47846/"
] | Im learning lisp and im pretty new at this so i was wondering...
if i do this:
```
(defparameter *list-1* (list 1 2))
(defparameter *list-2* (list 2 3))
(defparameter *list-3* (append *list-1* *list-2*))
```
And then
```
(setf (first *list-2*) 1)
*list-3*
```
I will get (1 2 1 4)
I know this is because the appe... | One defensive tactic is to avoid sharing structure.
```
(defparameter *list-3* (append *list-1* *list-2* '()))
```
or
```
(defparameter *list-3* (append *list-1* (copy-list *list-2*)))
```
Now the structure of the new `*list-3*` is all new, and modifications to `*list-3*` won't affect `*list-2*` and vice versa. |
427,007 | <p>All of a sudden I start getting this error while trying to open 2 of some 10+ forms in my Window Forms application in designer.</p>
<p>To prevent possible data loss before loading the designer, the following errors must be resolved:
The key 'UserID' does not exist in the appSettings configuration section.</p>
<p>I... | [
{
"answer_id": 427028,
"author": "Kon",
"author_id": 22303,
"author_profile": "https://Stackoverflow.com/users/22303",
"pm_score": 0,
"selected": false,
"text": "<p>Is it possible the config file was moved to a different folder or a new config file was introduced somewhere?</p>\n"
},
... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26447/"
] | All of a sudden I start getting this error while trying to open 2 of some 10+ forms in my Window Forms application in designer.
To prevent possible data loss before loading the designer, the following errors must be resolved:
The key 'UserID' does not exist in the appSettings configuration section.
It used to work fi... | And finally, here is what the designer REALLY was complaining about:
I had a call to a stored procedure right from the User Control's InitializeComponent().
While it may not be a good idea indeed (separate question material?), I have to say that the error was not presented to me in the best possible way... |
427,039 | <p>I am currently trying to justify text in a textarea, unfortunately the CSS:</p>
<pre><code>text-align: justify;
</code></pre>
<p>Doesn't work on the text like center, left and right do. I've tried this in both Firefox 3 and IE 7 with no luck.</p>
<p>Is there any way around this?</p>
| [
{
"answer_id": 427056,
"author": "Ken Paul",
"author_id": 26671,
"author_profile": "https://Stackoverflow.com/users/26671",
"pm_score": 2,
"selected": false,
"text": "<p>I believe that common practice is to use the <code>TEXTAREA</code> for input without worying about justification; and ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17020/"
] | I am currently trying to justify text in a textarea, unfortunately the CSS:
```
text-align: justify;
```
Doesn't work on the text like center, left and right do. I've tried this in both Firefox 3 and IE 7 with no luck.
Is there any way around this? | i dont think this is possible in the html textarea element. you might be able to use some sort of wysiwyg editor (editable div). ie. fckeditor |
427,040 | <p>I've been mulling over creating a language that would be extremely well suited to creation of DSLs, by allowing definitions of functions that are infix, postfix, prefix, or even consist of multiple words. For example, you could define an infix multiplication operator as follows (where multiply(X,Y) is already defin... | [
{
"answer_id": 427052,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stackoverflow.com/users/12349",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://www.haskell.org\" rel=\"nofollow noreferrer\">Haskell</a> has just what you're looking for.</p>\n"
... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16050/"
] | I've been mulling over creating a language that would be extremely well suited to creation of DSLs, by allowing definitions of functions that are infix, postfix, prefix, or even consist of multiple words. For example, you could define an infix multiplication operator as follows (where multiply(X,Y) is already defined):... | This is not too hard to do. You'll want to assign each operator a *fixity* (infix, prefix, or postfix) and a *precedence*. Make the precedence a real number; you'll thank me later. Operators of higher precedence bind more tightly than operators of lower precedence; at equal levels of precedence, you can require disambi... |
427,051 | <p>I am writing a web app for a client. Users will have a one-time key that they will use to initially identify themselves to the app. Once the app verifies that the key is valid it will take them to a page where they can create a normal account to use for all subsequent logins. The create-account page should only be a... | [
{
"answer_id": 427052,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stackoverflow.com/users/12349",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://www.haskell.org\" rel=\"nofollow noreferrer\">Haskell</a> has just what you're looking for.</p>\n"
... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44394/"
] | I am writing a web app for a client. Users will have a one-time key that they will use to initially identify themselves to the app. Once the app verifies that the key is valid it will take them to a page where they can create a normal account to use for all subsequent logins. The create-account page should only be acce... | This is not too hard to do. You'll want to assign each operator a *fixity* (infix, prefix, or postfix) and a *precedence*. Make the precedence a real number; you'll thank me later. Operators of higher precedence bind more tightly than operators of lower precedence; at equal levels of precedence, you can require disambi... |
427,070 | <p>I've got unformatted html in a string.</p>
<p>I am trying to format it nicely and output the formatted html back into a string.
I've been trying to use The System.Web.UI.HtmlTextWriter to no avail:</p>
<pre><code>System.IO.StringWriter wString = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter wHtml = ne... | [
{
"answer_id": 427092,
"author": "Andrew Kennan",
"author_id": 22506,
"author_profile": "https://Stackoverflow.com/users/22506",
"pm_score": 0,
"selected": false,
"text": "<p>There's nothing in the framework that will do what you want.</p>\n\n<p>If the HTML fragment is valid XML you coul... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9266/"
] | I've got unformatted html in a string.
I am trying to format it nicely and output the formatted html back into a string.
I've been trying to use The System.Web.UI.HtmlTextWriter to no avail:
```
System.IO.StringWriter wString = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter wHtml = new System.Web.UI.HtmlT... | Here's a function that does exactly that:
```
// Attractively format the XML with consistant indentation.
public static String PrettyPrint(String XML)
{
String Result = "";
using (MemoryStream MS = new MemoryStream())
{
using (XmlTextWriter W = new XmlTextWriter(MS, En... |
427,075 | <p>I started getting this error when posting the form back with Model Binder. To test the problem I reduced the postback to one string property of the model but i still get the overflow error. Can anyone suggest what would cause this? </p>
<p>UPDATE
The problem appears to be related to the property in the model that ... | [
{
"answer_id": 427079,
"author": "Jason Creighton",
"author_id": 51717,
"author_profile": "https://Stackoverflow.com/users/51717",
"pm_score": 0,
"selected": false,
"text": "<p>A stack overflow is usually due to infinite recursion. Look through the stack trace and see if you see the same... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49632/"
] | I started getting this error when posting the form back with Model Binder. To test the problem I reduced the postback to one string property of the model but i still get the overflow error. Can anyone suggest what would cause this?
UPDATE
The problem appears to be related to the property in the model that is a foreig... | You can fix this a few ways. One way is to try something like this.
```
public ActionResult AddProduct([Bind(Exclude = "Category")]Product product) { }
```
This tells the model binder to not try to bind the Category (FK property). This is a known issue and the MVC team has already fixed it for RC.
You can also pass... |
427,080 | <p>I'm defining a datagrid's RowDetailsTemplate in the following way:</p>
<p>RowDetailsTemplate="{StaticResource defaultTemplate}"</p>
<p>where</p>
<pre><code><UserControl.Resources>
<DataTemplate x:Key="defaultTemplate">
<StackPanel>
<TextBlock Text="default" x:Name="_tx... | [
{
"answer_id": 427079,
"author": "Jason Creighton",
"author_id": 51717,
"author_profile": "https://Stackoverflow.com/users/51717",
"pm_score": 0,
"selected": false,
"text": "<p>A stack overflow is usually due to infinite recursion. Look through the stack trace and see if you see the same... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51900/"
] | I'm defining a datagrid's RowDetailsTemplate in the following way:
RowDetailsTemplate="{StaticResource defaultTemplate}"
where
```
<UserControl.Resources>
<DataTemplate x:Key="defaultTemplate">
<StackPanel>
<TextBlock Text="default" x:Name="_txt" />
</StackPanel>
</DataTemplate>
... | You can fix this a few ways. One way is to try something like this.
```
public ActionResult AddProduct([Bind(Exclude = "Category")]Product product) { }
```
This tells the model binder to not try to bind the Category (FK property). This is a known issue and the MVC team has already fixed it for RC.
You can also pass... |
427,097 | <p>i am trying to use this code to bind my asp.net menu control to a collection..
but its giving me an error that my collection is now IHierarchyEnumerable.. which I understand why too.. </p>
<pre><code> StringCollection sc = pos.getAllmembers();
Menu1.DataSource = pos.getAllmembers().GetEnumerator();
</code>... | [
{
"answer_id": 427154,
"author": "JoshBerke",
"author_id": 26160,
"author_profile": "https://Stackoverflow.com/users/26160",
"pm_score": 0,
"selected": false,
"text": "<p>You can try writting a wrapper like in this msdn article:</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43838/"
] | i am trying to use this code to bind my asp.net menu control to a collection..
but its giving me an error that my collection is now IHierarchyEnumerable.. which I understand why too..
```
StringCollection sc = pos.getAllmembers();
Menu1.DataSource = pos.getAllmembers().GetEnumerator();
```
is there a way a... | The menu control requires a collection of [IHierarcyData](http://msdn.microsoft.com/en-us/library/system.web.ui.ihierarchydata.aspx) objects in a collection that implements [IHierarchicalEnumerable](http://msdn.microsoft.com/en-us/library/system.web.ui.ihierarchicalenumerable.aspx).
Start with a IHierarcyData class th... |
427,102 | <p>When I read Django code I often see in models what is called a "slug". I am not quite sure what this is, but I do know it has something to do with URLs. How and when is this slug-thing supposed to be used?</p>
<p>(I have read its definition in <a href="http://docs.djangoproject.com/en/dev/glossary/" rel="n... | [
{
"answer_id": 427111,
"author": "BobbyShaftoe",
"author_id": 38426,
"author_profile": "https://Stackoverflow.com/users/38426",
"pm_score": 5,
"selected": false,
"text": "<p>From <a href=\"http://jeffcroft.com/blog/2006/may/02/django-non-programmers/\" rel=\"noreferrer\">here</a>.</p>\n\... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24946/"
] | When I read Django code I often see in models what is called a "slug". I am not quite sure what this is, but I do know it has something to do with URLs. How and when is this slug-thing supposed to be used?
(I have read its definition in [this glossary](http://docs.djangoproject.com/en/dev/glossary/).)
>
> **Slug** ... | A "slug" is a way of generating a valid URL, generally using data already obtained. For instance, a slug uses the title of an article to generate a URL. I advise to generate the slug by means of a function, given the title (or another piece of data), rather than setting it manually.
An example:
```html
<title> The 46... |
427,152 | <p>I have a read function in a module.</p>
<p>If I perform that function simultaneously I need to timestamp it.</p>
<p>How do I do this?</p>
| [
{
"answer_id": 427234,
"author": "Swaroop C H",
"author_id": 4869,
"author_profile": "https://Stackoverflow.com/users/4869",
"pm_score": 2,
"selected": false,
"text": "<pre><code>#!/usr/bin/env python\n\nimport datetime\n\ndef timestampit(func):\n def decorate(*args, **kwargs):\n ... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46646/"
] | I have a read function in a module.
If I perform that function simultaneously I need to timestamp it.
How do I do this? | I'll offer a slightly different approach:
```
import time
def timestampit(func):
def decorate(*args, **kwargs):
decorate.timestamp = time.time()
return func(*args, **kwargs)
return decorate
@timestampit
def hello():
print 'hello'
hello()
print hello.timestamp
time.sleep(1)
hello()
prin... |
427,180 | <p>I want to be able to create a GUID/UUID on the iPhone and iPad. </p>
<p>The intention is to be able to create keys for distributed data that are all unique. Is there a way to do this with the iOS SDK?</p>
| [
{
"answer_id": 427222,
"author": "Henk",
"author_id": 4613,
"author_profile": "https://Stackoverflow.com/users/4613",
"pm_score": 6,
"selected": false,
"text": "<p>Reviewing the Apple Developer documentation I found the <a href=\"http://developer.apple.com/library/mac/documentation/CoreF... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6044/"
] | I want to be able to create a GUID/UUID on the iPhone and iPad.
The intention is to be able to create keys for distributed data that are all unique. Is there a way to do this with the iOS SDK? | ```
[[UIDevice currentDevice] uniqueIdentifier]
```
Returns the Unique ID of your iPhone.
>
> EDIT: `-[UIDevice uniqueIdentifier]` is now deprecated and apps are being rejected from the App Store for using it. The method below is now the preferred approach.
>
>
>
If you need to create several UUID, just use thi... |
427,192 | <p>I’m quite new to jquery and trying to figure out how to preload images for the jQuery Cycle Plugin.</p>
<p>I have 5+ large size images and I need those to be preloaded before starting the slideshow with Cycle plugin. Also I need to display a loading gif wile it preloads the images.</p>
<p>I have tried to implement... | [
{
"answer_id": 427922,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Manage to make it working..</p>\n\n<p><a href=\"http://www.thefancyhouse.com/charlienutting/\" rel=\"nofollow noreferrer\">... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I’m quite new to jquery and trying to figure out how to preload images for the jQuery Cycle Plugin.
I have 5+ large size images and I need those to be preloaded before starting the slideshow with Cycle plugin. Also I need to display a loading gif wile it preloads the images.
I have tried to implement the technique he... | ...or if what you are experiencing is a pause between image transitions, add this argument to the cycle function. It makes cycle ignore non img content, such as whitespace and linebreaks, which can cause cycle to pause between transitions.
```
jQuery('.imageslideshow').cycle({
slideExpr: 'img',
// other option... |
427,200 | <p>I've been hacking together some basic Joomla 1.5 components and modules recently and always every time I get into it, I end up tearing my hair out because I simply do not understand how the MVC pattern works. Some examples of the problems I run into:</p>
<ul>
<li>How does the view get access the model?</li>
<li>How... | [
{
"answer_id": 428220,
"author": "jlleblanc",
"author_id": 586,
"author_profile": "https://Stackoverflow.com/users/586",
"pm_score": 2,
"selected": false,
"text": "<p>Although there are some articles about the core team mixed in, here is a link to the development category where you can g... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | I've been hacking together some basic Joomla 1.5 components and modules recently and always every time I get into it, I end up tearing my hair out because I simply do not understand how the MVC pattern works. Some examples of the problems I run into:
* How does the view get access the model?
* How do you switch to a d... | Although there are some articles about the core team mixed in, here is a link to the development category where you can get the most out of the docs site: <http://docs.joomla.org/Category:Development> And yes, the Joomla! Framework could use a LOT more in the way of documentation.
When you are using the controller cla... |
427,203 | <p>I saw someone ask a question about detecting if a URL redirects from groovy and perl but couldn't find anything on PHP.</p>
<p>Anyone know of somewhere I could find that code that does this?</p>
| [
{
"answer_id": 427216,
"author": "Brian Fisher",
"author_id": 43816,
"author_profile": "https://Stackoverflow.com/users/43816",
"pm_score": 4,
"selected": false,
"text": "<pre><code>$ch = curl_init('http://www.yahoo.com/');\ncurl_exec($ch);\n$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46782/"
] | I saw someone ask a question about detecting if a URL redirects from groovy and perl but couldn't find anything on PHP.
Anyone know of somewhere I could find that code that does this? | Actually, I found this works best:
```
function GetURL($URL)
{
$ch = curl_init($URL);
curl_setopt($ch,CURLOPT_FOLLOWLOCATION,true);
curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);
curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
... |
427,207 | <p>We'd like to make a few basic hook scripts that we can all share -- for things like pre-formatting commit messages. Git has hook scripts for that that are normally stored under <code><project>/.git/hooks/</code>. However, those scripts are not propagated when people do a clone and they are not version contro... | [
{
"answer_id": 427269,
"author": "mipadi",
"author_id": 28804,
"author_profile": "https://Stackoverflow.com/users/28804",
"pm_score": 8,
"selected": true,
"text": "<p>Theoretically, you could create a <code>hooks</code> directory (or whatever name you prefer) in your project directory wi... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/825/"
] | We'd like to make a few basic hook scripts that we can all share -- for things like pre-formatting commit messages. Git has hook scripts for that that are normally stored under `<project>/.git/hooks/`. However, those scripts are not propagated when people do a clone and they are not version controlled.
Is there a goo... | Theoretically, you could create a `hooks` directory (or whatever name you prefer) in your project directory with all the scripts, and then symlink them in `.git/hooks`. Of course, each person who cloned the repo would have to set up these symlinks (although you could get really fancy and have a deploy script that the c... |
427,209 | <p>There are certain conditions that can cause stack overflows on an x86 Linux system:</p>
<ul>
<li><code>struct my_big_object[HUGE_NUMBER]</code> on the stack. Walking through it eventually causes <code>SIGSEGV</code>.</li>
<li>The <code>alloca()</code> routine (like <code>malloc()</code>, but uses the stack, automa... | [
{
"answer_id": 427274,
"author": "Johan",
"author_id": 51425,
"author_profile": "https://Stackoverflow.com/users/51425",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>The deprecated alloca() routine (like malloc(), but uses the stack, \n automatically frees itself, and a... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40620/"
] | There are certain conditions that can cause stack overflows on an x86 Linux system:
* `struct my_big_object[HUGE_NUMBER]` on the stack. Walking through it eventually causes `SIGSEGV`.
* The `alloca()` routine (like `malloc()`, but uses the stack, automatically frees itself, and also blows up with `SIGSEGV` if it's too... | You can determine the stack space the process has available by finding the size of a process' stack space and then subtracting the amount used.
```
ulimit -s
```
shows the stack size on a linux system. For a programmatic approach, check out [getrlimit()](http://www.gnu.org/software/libtool/manual/libc/Limits-on-Reso... |
427,210 | <p>I have a CGFloat value which I want to round to 3 digits after the decimal point. How should I do this?</p>
<p>Thanks.</p>
| [
{
"answer_id": 427225,
"author": "Lily Ballard",
"author_id": 582,
"author_profile": "https://Stackoverflow.com/users/582",
"pm_score": 2,
"selected": false,
"text": "<pre><code>myFloat = round(myfloat * 1000) / 1000.0;\n</code></pre>\n"
},
{
"answer_id": 428268,
"author": "R... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46297/"
] | I have a CGFloat value which I want to round to 3 digits after the decimal point. How should I do this?
Thanks. | ```
NSString *value = [NSString stringWithFormat:@"%.3f", theFloat];
``` |
427,217 | <p>I noticed some people declare a private variable and then a public variable with the get and set statements:</p>
<pre><code>private string myvariable = string.Empty;
public string MyVariable
{
get { return myvariable; }
set { myvariable = value ?? string.Empty; }
}
</code></pre>
<p>and then some people jus... | [
{
"answer_id": 427231,
"author": "Jarrod Dixon",
"author_id": 3,
"author_profile": "https://Stackoverflow.com/users/3",
"pm_score": 4,
"selected": false,
"text": "<p>Your second example won't compile, as the getter's value variable doesn't exist. Also, the setter would result in the epo... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51949/"
] | I noticed some people declare a private variable and then a public variable with the get and set statements:
```
private string myvariable = string.Empty;
public string MyVariable
{
get { return myvariable; }
set { myvariable = value ?? string.Empty; }
}
```
and then some people just do the following:
```
p... | [This](https://blog.codinghorror.com/properties-vs-public-variables/) is a very interesting read on this topic. However, I am pretty sure I have read somewhere on MSDN that objects with public variables are lighter than having properties (can't find the link). |
427,219 | <p>Given the existence of other divs on a page, how would one create a div that acts as if it's fixed-width within a certain domain of a web page? Example: the commenting system on Slashdot, which acts like a fixed-width div for purposes of scrolling along a screen but will remain within a certain length? I want a bloc... | [
{
"answer_id": 427445,
"author": "Marcin Gil",
"author_id": 5731,
"author_profile": "https://Stackoverflow.com/users/5731",
"pm_score": 0,
"selected": false,
"text": "<p>Do you mean something like </p>\n\n<blockquote>\n<pre><code><div style=\"width xx; height xx; overflow: scroll;\"&g... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Given the existence of other divs on a page, how would one create a div that acts as if it's fixed-width within a certain domain of a web page? Example: the commenting system on Slashdot, which acts like a fixed-width div for purposes of scrolling along a screen but will remain within a certain length? I want a block o... | Slashdot's [commenting system](http://science.slashdot.org/article.pl?sid=09/01/27/1950238) uses two different types of positioning for that box. When you first come to the page, the box is absolutely positioned so that it appears at the bottom of that column on the left. (CSS code here:)
```
left: 0px;
top: 429px; /*... |
427,220 | <p>For instance, is the following possible:</p>
<pre><code>#define definer(x) #define #x?
</code></pre>
| [
{
"answer_id": 427227,
"author": "qrdl",
"author_id": 28494,
"author_profile": "https://Stackoverflow.com/users/28494",
"pm_score": 2,
"selected": false,
"text": "<p>No, you can't do that.</p>\n\n<p>You can reference one macro from another, but you cannot define one macro from another.</... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47937/"
] | For instance, is the following possible:
```
#define definer(x) #define #x?
``` | Though your syntax is invalid, the answer to your question is technically yes. But it can only be accomplished by nasty tricks that make your code unreadable and unmaintainable.
See also: <http://www.ioccc.org/years.html#1995_vanschnitz> and <http://www.ioccc.org/years.html#2004_vik2> |
427,221 | <p>The last question I asked concerned how to bin data by x co-ordinate. The solution was simple and elegant, and I'm ashamed I didn't see it. This question may be harder (or I may just be blind).</p>
<p>I started out with about 140000 data points and split them into 70 groups equally spaced along the x axis I then... | [
{
"answer_id": 427247,
"author": "Kevin Loney",
"author_id": 13834,
"author_profile": "https://Stackoverflow.com/users/13834",
"pm_score": 1,
"selected": false,
"text": "<p>I've never used matlab but from looking at your previous question I suspect your looking for something along the li... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52310/"
] | The last question I asked concerned how to bin data by x co-ordinate. The solution was simple and elegant, and I'm ashamed I didn't see it. This question may be harder (or I may just be blind).
I started out with about 140000 data points and split them into 70 groups equally spaced along the x axis I then took the ave... | It sounds like you want to use bins that vary in size depending on the density of x values. I think you can still use the function HISTC like in the answer to your previous post, but you would just have to give it a different set of edges.
I don't know if this is exactly want you want, but here's one suggestion: inste... |
427,226 | <p>This is somewhat asp.net MVC related only for example purposes but I was hoping to achieve something like this:</p>
<pre><code>new SelectList(ViewData.Model.Formats.ToList().ForEach(x => index + " - " + x.Name), "ID", "Name");
</code></pre>
<p>Basically trying to be smart and return "index" as a number 1 - <em>... | [
{
"answer_id": 427236,
"author": "Hosam Aly",
"author_id": 41283,
"author_profile": "https://Stackoverflow.com/users/41283",
"pm_score": 1,
"selected": false,
"text": "<p>How about</p>\n\n<pre><code>int index = 0;\nnew SelectList(ViewData.Model.Formats.ForEach(x => ++index + \" - \" +... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41211/"
] | This is somewhat asp.net MVC related only for example purposes but I was hoping to achieve something like this:
```
new SelectList(ViewData.Model.Formats.ToList().ForEach(x => index + " - " + x.Name), "ID", "Name");
```
Basically trying to be smart and return "index" as a number 1 - *n* where *n* is the number of it... | With great help from Neil and Hosam, I got this working with the following:
```
new SelectList(ViewData.Model.MessageTypeFieldFormats.Select((x, i) => new { ID = x.ID, Name = (i + 1) + " - " + x.Name })
```
Anon methods rock! |
427,235 | <p>say I have this</p>
<pre><code>$result = mysql_query('SELECT views FROM post ORDER BY views ASC');
</code></pre>
<p>and I want to use the value at index 30 I assumed I would use</p>
<pre><code>mysql_data_seek($result, 30);
$useableResult = mysql_fetch_row($result);
echo $useableResult . '<br/>';
</code></p... | [
{
"answer_id": 427245,
"author": "Soviut",
"author_id": 46914,
"author_profile": "https://Stackoverflow.com/users/46914",
"pm_score": 4,
"selected": true,
"text": "<p>Simply use an SQL WHERE clause.</p>\n\n<pre><code>$result = mysql_query('SELECT views FROM post WHERE ID=30')\n</code></p... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36076/"
] | say I have this
```
$result = mysql_query('SELECT views FROM post ORDER BY views ASC');
```
and I want to use the value at index 30 I assumed I would use
```
mysql_data_seek($result, 30);
$useableResult = mysql_fetch_row($result);
echo $useableResult . '<br/>';
```
But that is returning my whole table
What have... | Simply use an SQL WHERE clause.
```
$result = mysql_query('SELECT views FROM post WHERE ID=30')
```
If you don't want to go by ID but instead want the 30th item that would be returned you can use a LIMIT min, max:
```
$result = mysql_query('SELECT views FROM post LIMIT 30, 1')
```
In both cases your ORDER BY comm... |
427,249 | <p>If I have a fileset like this:</p>
<pre><code><fileset dir=".">
<exclude name="classes/*"/>
<include name="**/zar.class"/>
</fileset>
</code></pre>
<p>The exclude takes precedence over the include and I don't end up with any classes. [since for this hypothetical example, zar.class i... | [
{
"answer_id": 427277,
"author": "Brian Fisher",
"author_id": 43816,
"author_profile": "https://Stackoverflow.com/users/43816",
"pm_score": 2,
"selected": false,
"text": "<p>I'm not sure exactly what you want but I think you were on the right track looking at pattersets: How about:</p>\n... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41762/"
] | If I have a fileset like this:
```
<fileset dir=".">
<exclude name="classes/*"/>
<include name="**/zar.class"/>
</fileset>
```
The exclude takes precedence over the include and I don't end up with any classes. [since for this hypothetical example, zar.class is in the classes dir] I would like to include the z... | Why do you need the exclude element ?
```
<fileset dir=".">
<include name="**/zar.class"/>
</fileset>
```
should give you the exact set of files you are after: zar.class, and none of the other `.class` files in classes/.
---
Just put this in community wiki mode, because I am not sure, on second thought, that ... |
427,262 | <p>Am I allowed to add whatever attributes I want to HTML tags such that I can retrieve their value later on using javascript? For example:</p>
<pre><code><a href="something.html" hastooltip="yes" tipcolour="yellow">...</a>
</code></pre>
<p>If that's not going to work, how would you store arbitrary pieces... | [
{
"answer_id": 427265,
"author": "Richard Harrison",
"author_id": 19624,
"author_profile": "https://Stackoverflow.com/users/19624",
"pm_score": 2,
"selected": false,
"text": "<p>You can. The page will not pass verification, however most browsers will accept it.</p>\n\n<p>It is almost cer... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | Am I allowed to add whatever attributes I want to HTML tags such that I can retrieve their value later on using javascript? For example:
```
<a href="something.html" hastooltip="yes" tipcolour="yellow">...</a>
```
If that's not going to work, how would you store arbitrary pieces of information like this?
**Edit:** ... | In HTML5, yes. You just have to prefix them with `data-`. See [the spec](https://www.w3schools.com/tags/att_global_data.asp).
Of course, this implies you should be using the HTML5 doctype (`<!doctype html>`), even though browsers don't care. |
427,264 | <p>When my ASP.Net session times out (and forms authentication as well) and I try to hit a page, I am automatically redirected to my default login.aspx page. </p>
<p>Before the page loads I need to determine whether this is a timeout situation and if so - redirect to timeout.aspx.</p>
<p>The articles below specify th... | [
{
"answer_id": 427518,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 3,
"selected": false,
"text": "<p>You are trying to distinguish between a timeout session and a session that was manully logged out?</p>\n\n<p>Your... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When my ASP.Net session times out (and forms authentication as well) and I try to hit a page, I am automatically redirected to my default login.aspx page.
Before the page loads I need to determine whether this is a timeout situation and if so - redirect to timeout.aspx.
The articles below specify that if IsNewSessio... | You are trying to distinguish between a timeout session and a session that was manully logged out?
Your problem is that since the session data is gone all you have to go on is that a new request coming in has created a new session and the request coming in carries a session ID cookie (indicating that it had been logge... |
427,266 | <p>Seem to be having an issue with std::auto_ptr and assignment, such that the object referenced seems to get trashed for some reason.</p>
<pre><code>std::auto_ptr<AClass> someVar = new AClass(); // should work, but mangles content
std::auto_ptr<AClass> someVar( new AClass() ); // works fine.
std::auto_pt... | [
{
"answer_id": 427273,
"author": "Jesse Pepper",
"author_id": 43058,
"author_profile": "https://Stackoverflow.com/users/43058",
"pm_score": 0,
"selected": false,
"text": "<p>Edited: Michael is quite right, it's a compile error, so which compiler are you using? You need to call <code>res... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37558/"
] | Seem to be having an issue with std::auto\_ptr and assignment, such that the object referenced seems to get trashed for some reason.
```
std::auto_ptr<AClass> someVar = new AClass(); // should work, but mangles content
std::auto_ptr<AClass> someVar( new AClass() ); // works fine.
std::auto_ptr<AClass> someVar = std::... | The first line:
```
std::auto_ptr<AClass> someVar = new AClass(); // should work, but mangles content
```
should result in a compiler error. Because there is no implicit conversion from the raw `AClass` pointer to an `auto_ptr` (the constructor for an `auto_ptr` that takes a raw pointer is marked `explicit`), initi... |
427,272 | <p>I've read in JSF docs that <a href="http://docs.oracle.com/javaee/7/api/javax/faces/render/ResponseStateManager.html" rel="noreferrer"><code>ResponseStateManager</code></a> has a <a href="http://docs.oracle.com/javaee/7/api/javax/faces/render/ResponseStateManager.html#isPostback%28javax.faces.context.FacesContext%29... | [
{
"answer_id": 427328,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 3,
"selected": false,
"text": "<p>Indeed, before jsf1.2, isPostBack was obtained through the <a href=\"http://cagataycivici.wordpress.com/2006/06/05/ispostbac... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27789/"
] | I've read in JSF docs that [`ResponseStateManager`](http://docs.oracle.com/javaee/7/api/javax/faces/render/ResponseStateManager.html) has a [`isPostBack()`](http://docs.oracle.com/javaee/7/api/javax/faces/render/ResponseStateManager.html#isPostback%28javax.faces.context.FacesContext%29) method. How (and where) can I ha... | >
> *How to know if I am in a postback?*
>
>
>
Depends on JSF version.
In JSF 1.0/1.1, there's no [`ResponseStateManager#isPostback()`](http://docs.oracle.com/javaee/6/api/javax/faces/render/ResponseStateManager.html#isPostback%28javax.faces.context.FacesContext%29) method available. check if `javax.faces.ViewSta... |
427,284 | <p>The following jQuery code works just fine for me with Safari, Opera, FF2, and FF3. It positions a busy DIV (with an animated busy GIF) on top of a FORM element on my web page. The problem is that in IE6 and IE7, it gets width and height properly, but doesn't seem to get top and left properly. What's the catch?</p>
... | [
{
"answer_id": 427320,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>I got it to work with the jQuery Dimensions Plugin 1.2's .position() value for top and left. (It returns an array where you... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The following jQuery code works just fine for me with Safari, Opera, FF2, and FF3. It positions a busy DIV (with an animated busy GIF) on top of a FORM element on my web page. The problem is that in IE6 and IE7, it gets width and height properly, but doesn't seem to get top and left properly. What's the catch?
```
var... | Right now jQuery (latest public release) includes dimensions as core functions.
Try using $(element).offset() (it returns an object with "left" and "top" properties).
I've used it a lot and works just perfect for many many browsers (ie6/7, opera, safari, chrome, ff2/3) |
427,289 | <p>Both:</p>
<ul>
<li>CLSID</li>
<li>IID</li>
</ul>
<p>Having specified the above, and using:</p>
<ul><li>CoCreateInstance()</li></ul>
<p>To returning a single uninitialised object of the class specified by the CLSID above.</p>
<p>How can I then access an Interface's method from C++?
Without:</p>
<ul>
<li>ATL</li... | [
{
"answer_id": 427308,
"author": "bmm6o",
"author_id": 10558,
"author_profile": "https://Stackoverflow.com/users/10558",
"pm_score": 0,
"selected": false,
"text": "<p>It's a little vague what the actual problem is. Some code would be helpful. But to take a guess, do you need to QueryIn... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51078/"
] | Both:
* CLSID
* IID
Having specified the above, and using:
* CoCreateInstance()
To returning a single uninitialised object of the class specified by the CLSID above.
How can I then access an Interface's method from C++?
Without:
* ATL
* MFC
* Just plain C++
Afterwards, I use CreateInstance()
I'm having trouble,... | By doing a CoCreateInstance you get an interface pointer. Through QueryInterface(...) method you can get the interface pointer of some other interface easily.
e.g.,
```
IUnknown* pUnk = NULL;
HRESULT hr = ::CoCreateInstance(clsid,NULL,CLSCTX_ALL,__uuidof(IUnknown),(void**)&pUnk);
```
IS8Simulation\* pSim = NULL;
hr... |
427,326 | <p>I am trying to write a C# http server for a personal project, i am wondering how i can change the returned server header from Microsoft-HTTPAPI/2.0, to something else?</p>
<pre><code> public class HttpWebServer
{
private HttpListener Listener;
public void Start()
{
Listener ... | [
{
"answer_id": 427365,
"author": "Elijah Glover",
"author_id": 53238,
"author_profile": "https://Stackoverflow.com/users/53238",
"pm_score": 1,
"selected": false,
"text": "<p>I did try, but it comes back with\nMy Personal Server Microsoft-HTTPAPI/2.0</p>\n\n<p>I have also used with no su... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53238/"
] | I am trying to write a C# http server for a personal project, i am wondering how i can change the returned server header from Microsoft-HTTPAPI/2.0, to something else?
```
public class HttpWebServer
{
private HttpListener Listener;
public void Start()
{
Listener = new HttpList... | The HttpListener class encapsulates the native API, [HttpSendHttpResponse Function](http://msdn.microsoft.com/en-us/library/aa364499(VS.85).aspx), which as stated in the link will always append the preposterous text to the server header information.
There's no way how to fix that, unless you want to code your HttpList... |
427,329 | <p>I have a multi-threaded Windows C++ app written in Visual Studio 6.</p>
<p>Within the app 2 threads are running each trying to read UDP packets on different ports. If I protect the reading from the socket with a critical section then all the date read is fine. Without that protection data is lost from both socket... | [
{
"answer_id": 427358,
"author": "vividos",
"author_id": 23740,
"author_profile": "https://Stackoverflow.com/users/23740",
"pm_score": 0,
"selected": false,
"text": "<p>Reading from one socket in two threads is not thread safe, you may not know for sure which caller gets a packet fron th... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15669/"
] | I have a multi-threaded Windows C++ app written in Visual Studio 6.
Within the app 2 threads are running each trying to read UDP packets on different ports. If I protect the reading from the socket with a critical section then all the date read is fine. Without that protection data is lost from both sockets.
Is readi... | ***Within the app 2 threads are running each trying to read UDP packets on different ports.***
How much UDP data are you sending/reading? How fast are you sending it? How much of your data is lost?
This could be a race condition... **Not between the two threads, but between the thread and the socket!**
I've seen pro... |
427,332 | <p>Coming from a Perl background, I have to say I prefer <code>cpan Foo::Bar</code> to the having to start sbcl, <code>(require :asdf-install)</code> and finally <code>(asdf-install:install :foo-bar)</code>. Is there anything more convenient than this around?</p>
| [
{
"answer_id": 427333,
"author": "jrockway",
"author_id": 8457,
"author_profile": "https://Stackoverflow.com/users/8457",
"pm_score": 3,
"selected": true,
"text": "<p>There is clbuild:</p>\n\n<pre><code>http://common-lisp.net/project/clbuild/\n</code></pre>\n\n<p>But I add this to my .ba... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8457/"
] | Coming from a Perl background, I have to say I prefer `cpan Foo::Bar` to the having to start sbcl, `(require :asdf-install)` and finally `(asdf-install:install :foo-bar)`. Is there anything more convenient than this around? | There is clbuild:
```
http://common-lisp.net/project/clbuild/
```
But I add this to my .bashrc:
```
function asdf_install {
sbcl --eval "(asdf:operate 'asdf:load-op :asdf-install)" --eval "(asdf-install:install :$1)" --eval "(quit)"
}
function asdf_oos {
rlwrap sbcl --eval "(asdf:operate 'asdf:$2 :$1)"
}
... |
427,335 | <p>I have a console application. A class (let's say Worker) does some work in a separate thread and throws an event when it finishes. But this never happens because the execution ends instantly. How can I wait for the thread to finish and handle the event after it throws?</p>
<pre><code>static void Main(string[] args)... | [
{
"answer_id": 427339,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 2,
"selected": false,
"text": "<p>Have you tried switching the order of the statements ?</p>\n\n<pre><code>static void Main(string[] args)\n{\n Wor... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31505/"
] | I have a console application. A class (let's say Worker) does some work in a separate thread and throws an event when it finishes. But this never happens because the execution ends instantly. How can I wait for the thread to finish and handle the event after it throws?
```
static void Main(string[] args)
{
Worker ... | You've got a race condition, in that the work could finish before you register for the event. To avoid the race condition, change the order of the code so you register for the event before starting the work, then it will always be raised, no matter how fast it finishes:
```
static void Main(string[] args)
{
Worker... |
427,346 | <p>How can I get C# to distinguish between ambiguous class types without having to specify the full <code>HtmlAgilityPack.HtmlDocument</code> name every time (it is ambiguous compared to <code>System.Windows.Forms.HtmlDocument</code>)?</p>
<p>Is there a way to make C# know that I am ALWAYS talking about one class or t... | [
{
"answer_id": 427350,
"author": "Hosam Aly",
"author_id": 41283,
"author_profile": "https://Stackoverflow.com/users/41283",
"pm_score": 7,
"selected": true,
"text": "<p>Use aliases:</p>\n\n<pre><code>using HapHtmlDocument = HtmlAgilityPack.HtmlDocument;\nusing WfHtmlDocument = System.Wi... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47630/"
] | How can I get C# to distinguish between ambiguous class types without having to specify the full `HtmlAgilityPack.HtmlDocument` name every time (it is ambiguous compared to `System.Windows.Forms.HtmlDocument`)?
Is there a way to make C# know that I am ALWAYS talking about one class or the other, and thus not have to s... | Use aliases:
```
using HapHtmlDocument = HtmlAgilityPack.HtmlDocument;
using WfHtmlDocument = System.Windows.Forms.HtmlDocument;
``` |
427,362 | <p>I need a table to store the state of a financial transaction.
The state of this transaction can be roughly modelled by this class.</p>
<pre><code>class FinancialTransaction
{
Integer txId,
Money oldLimit,
Money newLimit,
Money oldBalance,
Money newBalance,
Date txDate
}
class Money
{
... | [
{
"answer_id": 427384,
"author": "MandyK",
"author_id": 52717,
"author_profile": "https://Stackoverflow.com/users/52717",
"pm_score": 2,
"selected": false,
"text": "<ol>\n<li>If in future you do need to support transactions between two currencies, it ought to be possible to model this as... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24457/"
] | I need a table to store the state of a financial transaction.
The state of this transaction can be roughly modelled by this class.
```
class FinancialTransaction
{
Integer txId,
Money oldLimit,
Money newLimit,
Money oldBalance,
Money newBalance,
Date txDate
}
class Money
{
Currency curr,... | The currency and money value are two different concepts so would be better to separate them. There is no need to make a separate table for 'values' but would be better to have one for currencies because these are separate entities. The new design would look like:
```
CREATE TABLE tx
(
id bigint(20) unsigned primar... |
427,383 | <p>i've setup a demo to test datasnap 2009, and i've got a problem with dbexpress.</p>
<p>The dbexpress error message, (same at design time or runtime) :
"Cannot load oci.dll library (Error code 127). The OCI.dll library may be missing from the system path."</p>
<p>I'm using Oracle 8.0.5. The path to oci.dll (c:\oran... | [
{
"answer_id": 427632,
"author": "Schalk Versteeg",
"author_id": 15724,
"author_profile": "https://Stackoverflow.com/users/15724",
"pm_score": 0,
"selected": false,
"text": "<p>Try copying the dll into the program's root folder</p>\n"
},
{
"answer_id": 427779,
"author": "devi... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53242/"
] | i've setup a demo to test datasnap 2009, and i've got a problem with dbexpress.
The dbexpress error message, (same at design time or runtime) :
"Cannot load oci.dll library (Error code 127). The OCI.dll library may be missing from the system path."
I'm using Oracle 8.0.5. The path to oci.dll (c:\orant\BIN) is in my s... | Problems like these usually occur if you switch Oracle Homes, but you didn't mention multiple installs.
Can you connect to Oracle using SqlPlus? [This page](http://www.embarcadero.com/jive/entry.jspa?categoryID=2&externalID=300) also recommends checking for multiple copies of oci.dll in the path (esp. windows\system32... |
427,389 | <p>My page deals with many "Store" objects, each of them has a field called 'data'. However, this data is fetched via AJAX requests which may be parallely going on.</p>
<pre><code>function Store(id){
this.id = id;
this.queryparam = 'blah';
this.items = null;
}
Store.prototype.fetch = function(){
$.get... | [
{
"answer_id": 427407,
"author": "Ricardo Vega",
"author_id": 53246,
"author_profile": "https://Stackoverflow.com/users/53246",
"pm_score": 2,
"selected": false,
"text": "<p>function Store(id){\n this.id = id;\n this.queryparam = 'blah';\n this.items = null;\n }</... | 2009/01/09 | [
"https://Stackoverflow.com/questions/427389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | My page deals with many "Store" objects, each of them has a field called 'data'. However, this data is fetched via AJAX requests which may be parallely going on.
```
function Store(id){
this.id = id;
this.queryparam = 'blah';
this.items = null;
}
Store.prototype.fetch = function(){
$.get("/get_items",... | You should be able to use closure:
```
var tmp = this;
$.get("/get_items",{q:this.quaryparam},function(data,status){
tmp.data = data;
});
```
Is that what you mean? |