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 |
|---|---|---|---|---|---|---|
439,393 | <p>I was going to try <a href="http://subsonicproject.com/" rel="nofollow noreferrer">Subsonic</a>, you can generate DAL with buildProvider element in an ASP.NET website project. But I get curious why Web applications or windows applications do not support <a href="http://msdn.microsoft.com/en-us/library/system.web.com... | [
{
"answer_id": 439415,
"author": "Scottie T",
"author_id": 6688,
"author_profile": "https://Stackoverflow.com/users/6688",
"pm_score": 2,
"selected": false,
"text": "<p>$1 is the first command line argument. This goes up to $9. Check this <a href=\"http://www.bolthole.com/solaris/ksh-v... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35012/"
] | I was going to try [Subsonic](http://subsonicproject.com/), you can generate DAL with buildProvider element in an ASP.NET website project. But I get curious why Web applications or windows applications do not support [BuildProvider](http://msdn.microsoft.com/en-us/library/system.web.compilation.buildprovider.aspx).
P... | If you want to be prompted (as opposed to passing the date in as a parameter), use the following logic (or something similar):
```
date=
while [ -z $date ]
do
echo -n 'Date? '
read date
done
```
That loop will continue to prompt for the date until the user enters something (anything) other than a simple RETU... |
439,402 | <p>I'm trying setup a subset of boost and get it properly compiled using bjam, however I'm not getting the result I'm looking for. I'm working on windows using boost 1.37.0.</p>
<p>Let's say I want the libraries smart_ptr and filesystem built/installed. I intentionally chose a header only library and one library needi... | [
{
"answer_id": 439559,
"author": "Laserallan",
"author_id": 11758,
"author_profile": "https://Stackoverflow.com/users/11758",
"pm_score": 4,
"selected": true,
"text": "<p>Solved it.</p>\n\n<p>The bcp solution had make files for the projects, however I needed to copy the tools directory a... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11758/"
] | I'm trying setup a subset of boost and get it properly compiled using bjam, however I'm not getting the result I'm looking for. I'm working on windows using boost 1.37.0.
Let's say I want the libraries smart\_ptr and filesystem built/installed. I intentionally chose a header only library and one library needing to com... | Solved it.
The bcp solution had make files for the projects, however I needed to copy the tools directory and the root of the boost directory to the place I copied all my libs to get things up running. |
439,404 | <p>I'm triying to find leaks in my project <a href="http://code.google.com/p/chibiorm/" rel="nofollow noreferrer">chibi-ORM</a> using the tool of scan-build as suggested in other threads.</p>
<p>But when run from the terminal:</p>
<pre><code>/Users/mamcx/Downloads/checker-0.138/scan-build -k -V xcodebuild
</code></p... | [
{
"answer_id": 439671,
"author": "Ashutosh Singh-MVP SharePoint",
"author_id": 54271,
"author_profile": "https://Stackoverflow.com/users/54271",
"pm_score": 3,
"selected": true,
"text": "<p>the build is failing due to code signing reasons\nthe fix for iphone apps would be to just go to t... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53185/"
] | I'm triying to find leaks in my project [chibi-ORM](http://code.google.com/p/chibiorm/) using the tool of scan-build as suggested in other threads.
But when run from the terminal:
```
/Users/mamcx/Downloads/checker-0.138/scan-build -k -V xcodebuild
```
I get this:
```
009-01-13 10:33:18.296 xcodebuild[14025:4213]... | the build is failing due to code signing reasons
the fix for iphone apps would be to just go to the project’s properties and set the “Base SDK” to “Simulator - iPhone OS 2.1″ rather than “Device”
check in your case what it would be |
439,447 | <p>I have a path and I need to determine if it is a directory or file. </p>
<p>Is this the best way to determine if the path is a file?</p>
<pre><code>string file = @"C:\Test\foo.txt";
bool isFile = !System.IO.Directory.Exists(file) &&
System.IO.File.Exists(file);
</code></pre>
<p... | [
{
"answer_id": 439473,
"author": "Scott Dorman",
"author_id": 1559,
"author_profile": "https://Stackoverflow.com/users/1559",
"pm_score": 4,
"selected": false,
"text": "<p>You can do this with some interop code:</p>\n\n<pre><code> [DllImport(\"shlwapi.dll\", CharSet = CharSet.Unicode)... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2469/"
] | I have a path and I need to determine if it is a directory or file.
Is this the best way to determine if the path is a file?
```
string file = @"C:\Test\foo.txt";
bool isFile = !System.IO.Directory.Exists(file) &&
System.IO.File.Exists(file);
```
For a directory I would reverse the logic... | Use:
```
System.IO.File.GetAttributes(string path)
```
and check whether the returned `FileAttributes` result contains the value `FileAttributes.Directory`:
```
bool isDir = (File.GetAttributes(path) & FileAttributes.Directory)
== FileAttributes.Directory;
``` |
439,463 | <p>How do I simply get <code>GET</code> and <code>POST</code> values with JQuery?</p>
<p>What I want to do is something like this:</p>
<pre><code>$('#container-1 > ul').tabs().tabs('select', $_GET('selectedTabIndex'));
</code></pre>
| [
{
"answer_id": 439578,
"author": "Ates Goral",
"author_id": 23501,
"author_profile": "https://Stackoverflow.com/users/23501",
"pm_score": 8,
"selected": true,
"text": "<p>For GET parameters, you can grab them from <code>document.location.search</code>:</p>\n\n<pre><code>var $_GET = {};\n... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | How do I simply get `GET` and `POST` values with JQuery?
What I want to do is something like this:
```
$('#container-1 > ul').tabs().tabs('select', $_GET('selectedTabIndex'));
``` | For GET parameters, you can grab them from `document.location.search`:
```
var $_GET = {};
document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () {
function decode(s) {
return decodeURIComponent(s.split("+").join(" "));
}
$_GET[decode(arguments[1])] = decode(arguments[2]);
});
... |
439,468 | <p>I am creating a webpage in html with php.</p>
<p>I want the user to be able to click on a small icon image. When the icon is clicked a preview of a larger image appears.</p>
<p>Guessing the solution probably involves javascript or flash. Can you point me to the right direction. Thanks in advance.</p>
| [
{
"answer_id": 439578,
"author": "Ates Goral",
"author_id": 23501,
"author_profile": "https://Stackoverflow.com/users/23501",
"pm_score": 8,
"selected": true,
"text": "<p>For GET parameters, you can grab them from <code>document.location.search</code>:</p>\n\n<pre><code>var $_GET = {};\n... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45066/"
] | I am creating a webpage in html with php.
I want the user to be able to click on a small icon image. When the icon is clicked a preview of a larger image appears.
Guessing the solution probably involves javascript or flash. Can you point me to the right direction. Thanks in advance. | For GET parameters, you can grab them from `document.location.search`:
```
var $_GET = {};
document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () {
function decode(s) {
return decodeURIComponent(s.split("+").join(" "));
}
$_GET[decode(arguments[1])] = decode(arguments[2]);
});
... |
439,474 | <p>I am writing a parser which generates the 32 bit opcode for each command. For example, for the following statement:</p>
<pre><code>set lcl_var = 2
</code></pre>
<p>my parser generates the following opcodes:</p>
<pre><code>// load immdshort 2 (loads the value 2)
0x10000010
// strlocal lclvar (lcl_var is converted... | [
{
"answer_id": 439529,
"author": "MattK",
"author_id": 52734,
"author_profile": "https://Stackoverflow.com/users/52734",
"pm_score": 0,
"selected": false,
"text": "<p>You don't specify what language you're writing the parser in, so I'm going to assume for the sake of argument that you're... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28641/"
] | I am writing a parser which generates the 32 bit opcode for each command. For example, for the following statement:
```
set lcl_var = 2
```
my parser generates the following opcodes:
```
// load immdshort 2 (loads the value 2)
0x10000010
// strlocal lclvar (lcl_var is converted to an index to identify the var)
0x01... | It depends on how you structured your parser. A Unit-Test tests a single UNIT.
So, if you want to test your entire parser as a single unit, you can give it a list of commands and verify it produces the correct opcodes (which you checked manually when you wrote the test). You can write tests for each command, and test ... |
439,485 | <p>Is there a difference between single and double quotes in Java?</p>
| [
{
"answer_id": 439505,
"author": "Yuval Adam",
"author_id": 24545,
"author_profile": "https://Stackoverflow.com/users/24545",
"pm_score": 8,
"selected": true,
"text": "<p>Use single quotes for literal <code>char</code>s, double quotes for literal <code>String</code>s, like so:</p>\n\n<pr... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6068/"
] | Is there a difference between single and double quotes in Java? | Use single quotes for literal `char`s, double quotes for literal `String`s, like so:
```
char c = 'a';
String s = "hello";
```
They cannot be used any other way around (like in Python, for example). |
439,495 | <p>I am trying to filter items with a <a href="https://en.wikipedia.org/wiki/Stored_procedure" rel="nofollow noreferrer">stored procedure</a> using <em>like</em>. The column is a varchar(15). The items I am trying to filter have square brackets in the name.</p>
<p>For example: <code>WC[R]S123456</code>.</p>
<p>If I do... | [
{
"answer_id": 439509,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 10,
"selected": true,
"text": "<pre><code>LIKE 'WC[[]R]S123456' \n</code></pre>\n\n<p>or</p>\n\n<pre><code>LIKE 'WC\\[R]S123456' ESCAPE '\\'\n</code... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7316/"
] | I am trying to filter items with a [stored procedure](https://en.wikipedia.org/wiki/Stored_procedure) using *like*. The column is a varchar(15). The items I am trying to filter have square brackets in the name.
For example: `WC[R]S123456`.
If I do a `LIKE 'WC[R]S123456'` it will not return anything.
I found some inf... | ```
LIKE 'WC[[]R]S123456'
```
or
```
LIKE 'WC\[R]S123456' ESCAPE '\'
```
Should work. |
439,510 | <p>I seem to be getting a type mismatch error when trying to do something like this:</p>
<p>In new workbook:</p>
<pre><code>A1 B1
5 4
Function Test1() As Integer
Dim rg As Range
Set rg = Test2()
Test1 = rg.Cells(1, 1).Value
End Function
Function Test2() As Range
Dim rg As Range
Set rg = Range("A... | [
{
"answer_id": 439533,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 3,
"selected": false,
"text": "<p>Change last line in Test2 to:</p>\n\n<pre><code>Set Test2 = rg\n</code></pre>\n"
},
{
"answer_id": 439535... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1946/"
] | I seem to be getting a type mismatch error when trying to do something like this:
In new workbook:
```
A1 B1
5 4
Function Test1() As Integer
Dim rg As Range
Set rg = Test2()
Test1 = rg.Cells(1, 1).Value
End Function
Function Test2() As Range
Dim rg As Range
Set rg = Range("A1:B1")
Test2 = rg... | A range is an object. Assigning objects requires the use of the SET keyword, and looks like you forgot one in your Test2 function:
```
Function Test1() As Integer
Dim rg As Range
Set rg = Test2()
Test1 = rg.Cells(1, 1).Value
End Function
Function Test2() As Range
Dim rg As Range
Set rg = Range("A1... |
439,526 | <p>I know that R works most efficiently with vectors and looping should be avoided. I am having a hard time teaching myself to actually write code this way. I would like some ideas on how to 'vectorize' my code. Here's an example of creating 10 years of sample data for 10,000 non unique combinations of state (<code>st<... | [
{
"answer_id": 440066,
"author": "JD Long",
"author_id": 37751,
"author_profile": "https://Stackoverflow.com/users/37751",
"pm_score": 4,
"selected": true,
"text": "<p>Clearly I should have worked on this for another hour before I posted my question. It's so obvious in retrospect. :)</p>... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37751/"
] | I know that R works most efficiently with vectors and looping should be avoided. I am having a hard time teaching myself to actually write code this way. I would like some ideas on how to 'vectorize' my code. Here's an example of creating 10 years of sample data for 10,000 non unique combinations of state (`st`), plan1... | Clearly I should have worked on this for another hour before I posted my question. It's so obvious in retrospect. :)
To use R's vector logic I took out the loop and replaced it with this:
```
st <- sample(c(12,17,24),10000,prob=c(20,30,50),replace=TRUE)
p1 <- sample(c(12,17,24),10000,prob=c(20,30,50),replace=TRUE... |
439,540 | <p>First of all I have to admit that my programming skills are pretty limited and I took over a (really small) existing C++ OOP project where I try to push my own stuff in. Unfortunately I'm experiencing a problem which goes beyond my knowledge and I hope to find some help here. I'm working with a third party library (... | [
{
"answer_id": 439587,
"author": "Paolo Tedesco",
"author_id": 15622,
"author_profile": "https://Stackoverflow.com/users/15622",
"pm_score": 3,
"selected": true,
"text": "<p>The reason \"&MyFrameGrabber::HookFunction\" cannot be converted to a BUF_HOOK_FUNCTION_PTR is that, being a m... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47725/"
] | First of all I have to admit that my programming skills are pretty limited and I took over a (really small) existing C++ OOP project where I try to push my own stuff in. Unfortunately I'm experiencing a problem which goes beyond my knowledge and I hope to find some help here. I'm working with a third party library (whi... | The reason "&MyFrameGrabber::HookFunction" cannot be converted to a BUF\_HOOK\_FUNCTION\_PTR is that, being a member of the class, it has implicitly as first parameter the "this" pointer, thus you cannot convert a member function to a non-member function: the two signatures look the same but are actually different.
I ... |
439,553 | <p>I have a block of preformatted code (<pre>) which overflows horizontally so there is an horizontal scrollbar to allow the user to view the content.</p>
<pre><code>overflow: auto;
</code></pre>
<p>However, in IE7 (maybe other IE versions), the scrollbar overlaps the last line of my content (which is especiall... | [
{
"answer_id": 439585,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 1,
"selected": false,
"text": "<p>Wrap your <code>PRE</code> in a <code>DIV</code> with some additional margins.</p>\n"
},
{
"... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/810/"
] | I have a block of preformatted code (<pre>) which overflows horizontally so there is an horizontal scrollbar to allow the user to view the content.
```
overflow: auto;
```
However, in IE7 (maybe other IE versions), the scrollbar overlaps the last line of my content (which is especially irritating when there is just ... | Just after posting the question I thought about checking if stackoverflow handled that (which it does).
I took a look at the stylesheet and found this:
```
padding-bottom: 19px!ie7;
```
(well, they use 20px, but 19 looked better).
It adds a bottom padding only for IE7, which makes every preformatted sections witho... |
439,561 | <p>I'm having difficulty throwing away the bits of the expression I don't want, and keeping the bits I do.</p>
<p>The problem is - given the input string:</p>
<pre><code>{if cond}foo{else}bar{/if}
</code></pre>
<p>I'd like just to have:</p>
<pre><code>0: {if cond}foo{else}bar{/if}
1: cond
2: foo
3: bar
</code></pre... | [
{
"answer_id": 439645,
"author": "Diadistis",
"author_id": 47401,
"author_profile": "https://Stackoverflow.com/users/47401",
"pm_score": 3,
"selected": false,
"text": "<p>This should work :</p>\n\n<pre><code>{if\\s+([^}]*)}([^{]*)(?:{else}([^{]*))?{/if}\n</code></pre>\n\n<p>Escape it acc... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20972/"
] | I'm having difficulty throwing away the bits of the expression I don't want, and keeping the bits I do.
The problem is - given the input string:
```
{if cond}foo{else}bar{/if}
```
I'd like just to have:
```
0: {if cond}foo{else}bar{/if}
1: cond
2: foo
3: bar
```
And for the input string:
```
{if cond}foo{/if}
... | What about this?
```
\{if ([a-z0-9]+)\}([^\{]*)(?:\{else\})?([^\{]*)\{/if\}
``` |
439,573 | <p>I have a string of digits, e.g. "123456789", and I need to extract each one of them to use them in a calculation. I can of course access each char by index, but how do I convert it into an int?</p>
<p>I've looked into atoi(), but it takes a string as argument. Hence I must convert each char into a string and then c... | [
{
"answer_id": 439589,
"author": "Binary Worrier",
"author_id": 18797,
"author_profile": "https://Stackoverflow.com/users/18797",
"pm_score": 8,
"selected": true,
"text": "<p>You can utilize the fact that the character encodings for digits are all in order from 48 (for '0') to 57 (for '9... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439573",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37268/"
] | I have a string of digits, e.g. "123456789", and I need to extract each one of them to use them in a calculation. I can of course access each char by index, but how do I convert it into an int?
I've looked into atoi(), but it takes a string as argument. Hence I must convert each char into a string and then call atoi o... | You can utilize the fact that the character encodings for digits are all in order from 48 (for '0') to 57 (for '9'). This holds true for ASCII, UTF-x and practically all other encodings (*see comments below for more on this*).
Therefore the integer value for any digit is the digit minus '0' (or 48).
```
char c = '1';... |
439,574 | <p>Occasionally I come across methods with an uncomfortable number of parameters. More often than not, they seem to be constructors. It seems like there ought to be a better way, but I can't see what it is. </p>
<pre><code>return new Shniz(foo, bar, baz, quux, fred, wilma, barney, dino, donkey)
</code></pre>
<p>I'... | [
{
"answer_id": 439588,
"author": "Matthew Brubaker",
"author_id": 21311,
"author_profile": "https://Stackoverflow.com/users/21311",
"pm_score": 8,
"selected": true,
"text": "<p>The best way would be to find ways to group the arguments together. This assumes, and really only works if, yo... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44743/"
] | Occasionally I come across methods with an uncomfortable number of parameters. More often than not, they seem to be constructors. It seems like there ought to be a better way, but I can't see what it is.
```
return new Shniz(foo, bar, baz, quux, fred, wilma, barney, dino, donkey)
```
I've thought of using structs t... | The best way would be to find ways to group the arguments together. This assumes, and really only works if, you would end up with multiple "groupings" of arguments.
For instance, if you are passing the specification for a rectangle, you can pass x, y, width, and height or you could just pass a rectangle object that co... |
439,611 | <p>I have an entity that has a collection of associated entities in an EntitySet. Ultimately, I'm trying to report on some changes that have been made to this entity. I will most likely use the GetModifiedMembers() method to do this, and I'm guessing I can just do the same with each entity in the EntitySet, but I'm not... | [
{
"answer_id": 439782,
"author": "bruno conde",
"author_id": 31136,
"author_profile": "https://Stackoverflow.com/users/31136",
"pm_score": 3,
"selected": true,
"text": "<p>You could use the <code>dataContext.GetChangeSet()</code> to track all the changed entities and filter the specific ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18866/"
] | I have an entity that has a collection of associated entities in an EntitySet. Ultimately, I'm trying to report on some changes that have been made to this entity. I will most likely use the GetModifiedMembers() method to do this, and I'm guessing I can just do the same with each entity in the EntitySet, but I'm not su... | You could use the `dataContext.GetChangeSet()` to track all the changed entities and filter the specific `T` entities. Please see if this is what you want:
```
public static void ShowModifiedEntitiesInfo<T>(DataContext context) where T : class
{
foreach (var entity in context.GetChangeSet().Updates.Whe... |
439,612 | <p>I am having trouble sending a collection of Enums to a WCF service method. I used this post as a guide: <a href="https://stackoverflow.com/questions/187505/sharing-enum-with-wcf-service">Sharing Enum with WCF Service</a></p>
<pre><code>[ServiceContract]
[ServiceKnownType(typeof(MyEnum))]
[ServiceKnownType(typeof(Li... | [
{
"answer_id": 439874,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 2,
"selected": false,
"text": "<p>What does your configuration file look like? It sounds like you might be using a <code>webHttpBinding</code> eleme... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45071/"
] | I am having trouble sending a collection of Enums to a WCF service method. I used this post as a guide: [Sharing Enum with WCF Service](https://stackoverflow.com/questions/187505/sharing-enum-with-wcf-service)
```
[ServiceContract]
[ServiceKnownType(typeof(MyEnum))]
[ServiceKnownType(typeof(List<MyEnum>))]
public inte... | What does your configuration file look like? It sounds like you might be using a `webHttpBinding` element which would not support `IList<MyEnum>` as that would be impossible to represent on a URL.
You should look into using a `basicHttpBinding` as this uses SOAP. Using SOAP will allow you to serialize `IList<MyEnum>` ... |
439,617 | <p>I wrote a quick and dirty wrapper around svn.exe to retrieve some content and do something with it, but for certain inputs it occasionally and reproducibly hangs and won't finish. For example, one call is to svn list:</p>
<pre><code>svn list "http://myserver:84/svn/Documents/Instruments/" --xml --no-auth-cache --... | [
{
"answer_id": 439633,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 6,
"selected": true,
"text": "<p>One standard issue: the process could be waiting for you to read its output. Create a separate thread to read from its... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/404/"
] | I wrote a quick and dirty wrapper around svn.exe to retrieve some content and do something with it, but for certain inputs it occasionally and reproducibly hangs and won't finish. For example, one call is to svn list:
```
svn list "http://myserver:84/svn/Documents/Instruments/" --xml --no-auth-cache --username myuser... | One standard issue: the process could be waiting for you to read its output. Create a separate thread to read from its standard output while you're waiting for it to exit. It's a bit of a pain, but that may well be the problem. |
439,630 | <p>I have a web page with three dropdowns for day, month and year. If I use the JavaScript <code>Date</code> constructor that takes numbers, then I get a <code>Date</code> object for my current timezone:</p>
<pre><code>new Date(xiYear, xiMonth, xiDate)
</code></pre>
<p>Give the correct date, but it thinks that date i... | [
{
"answer_id": 439744,
"author": "Andrzej Doyle",
"author_id": 45664,
"author_profile": "https://Stackoverflow.com/users/45664",
"pm_score": 5,
"selected": false,
"text": "<p>I don't believe this is possible - there is no ability to set the timezone on a Date object after it is created.<... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28537/"
] | I have a web page with three dropdowns for day, month and year. If I use the JavaScript `Date` constructor that takes numbers, then I get a `Date` object for my current timezone:
```
new Date(xiYear, xiMonth, xiDate)
```
Give the correct date, but it thinks that date is GMT+01:00 due to daylight savings time.
The p... | using `.setUTCHours()` it would be possible to actually set dates in UTC-time, which would allow you to use UTC-times throughout the system.
You cannot set it using UTC in the constructor though, unless you specify a date-string.
Using `new Date(Date.UTC(year, month, day, hour, minute, second))` you can create a Date... |
439,635 | <p>I have a script that addresses and sends an email but I need a body in the message <strong>without creating a file</strong> and then inserting the file with the standard MAIL commandline.</p>
<p>How can I do that?</p>
| [
{
"answer_id": 440121,
"author": "EvilTeach",
"author_id": 7734,
"author_profile": "https://Stackoverflow.com/users/7734",
"pm_score": 0,
"selected": false,
"text": "<p>Have the script create a temporary file to hold the body of the message.</p>\n\n<p>Mail will accept a text file on the ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/730/"
] | I have a script that addresses and sends an email but I need a body in the message **without creating a file** and then inserting the file with the standard MAIL commandline.
How can I do that? | Assuming the body you want to create is something you can write to SYS$OUTPUT (e.g. the output of a command procedure or DCL command), then you can use DCL PIPE to pipe the output into VMS Mail, like:
```
$ PIPE write sys$output "The date is ", f$cvtime() | MAIL SYS$INPUT smith/SUBJ="Piping in DCL"
```
or
```
$ PI... |
439,637 | <p>I've got an internal service hosted over tcp. It's being self-hosted inside of a windows service. The service works fine for the most part, but once in awhile I'll get a bunch of exceptions (all in a row) from it.</p>
<pre><code>System.ServiceModel.Security.SecuritySessionServerSettings.AddPendingSession(UniqueId... | [
{
"answer_id": 440326,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 2,
"selected": false,
"text": "<p>Have you tried to raise the maxReceivedMessageSize and the maxBuffersize in your config? Googling \"QuotaExceededExc... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3426/"
] | I've got an internal service hosted over tcp. It's being self-hosted inside of a windows service. The service works fine for the most part, but once in awhile I'll get a bunch of exceptions (all in a row) from it.
```
System.ServiceModel.Security.SecuritySessionServerSettings.AddPendingSession(UniqueId sessionId, ISer... | Have you tried to raise the maxReceivedMessageSize and the maxBuffersize in your config? Googling "QuotaExceededException wcf" leads to these three links, which seem to indicate that it helps:
<http://www.arquitecturadesoftware.org/blogs/hugobatista/archive/2006/05/16/wcf-maxreceivedmessagesize-and-quotaexceededexcept... |
439,647 | <p>I'm pushing elements into an array during a while statement. Each element is a teacher's name. There ends up being duplicate teacher names in the array when the loop finishes. Sometimes they are not right next to each other in the array, sometimes they are.</p>
<p>How can I print only the unique values in that arr... | [
{
"answer_id": 439659,
"author": "user54650",
"author_id": 54650,
"author_profile": "https://Stackoverflow.com/users/54650",
"pm_score": 4,
"selected": false,
"text": "<p>I suggest pushing it into a hash.\nlike this:</p>\n\n<pre><code>my %faculty_hash = ();\nforeach my $facs (@faculty) {... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42229/"
] | I'm pushing elements into an array during a while statement. Each element is a teacher's name. There ends up being duplicate teacher names in the array when the loop finishes. Sometimes they are not right next to each other in the array, sometimes they are.
How can I print only the unique values in that array after it... | ```
use List::MoreUtils qw/ uniq /;
my @unique = uniq @faculty;
foreach ( @unique ) {
print $_, "\n";
}
``` |
439,653 | <p><s>Duplicate of <a href="https://stackoverflow.com/questions/217951/get-the-current-working-directory-for-cmdexe">this question</a>.</s></p>
<p><b>update</b> - This is not an exact duplicate. See my solution.</p>
<p>I see a java.exe process in process explorer, and double clicking it gives me its working directory... | [
{
"answer_id": 439659,
"author": "user54650",
"author_id": 54650,
"author_profile": "https://Stackoverflow.com/users/54650",
"pm_score": 4,
"selected": false,
"text": "<p>I suggest pushing it into a hash.\nlike this:</p>\n\n<pre><code>my %faculty_hash = ();\nforeach my $facs (@faculty) {... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11236/"
] | ~~Duplicate of [this question](https://stackoverflow.com/questions/217951/get-the-current-working-directory-for-cmdexe).~~
**update** - This is not an exact duplicate. See my solution.
I see a java.exe process in process explorer, and double clicking it gives me its working directory & starting command line arguments... | ```
use List::MoreUtils qw/ uniq /;
my @unique = uniq @faculty;
foreach ( @unique ) {
print $_, "\n";
}
``` |
439,656 | <p>My experience with MySQL is very basic. The simple stuff is easy enough, but I ran into something that is going to require a little more knowledge. I have a need for a table that stores a small list of words. The number of words stored could be anywhere between 1 to 15. Later, I plan on searching through the tab... | [
{
"answer_id": 439676,
"author": "Jason S",
"author_id": 44330,
"author_profile": "https://Stackoverflow.com/users/44330",
"pm_score": 5,
"selected": true,
"text": "<p>C) use a <a href=\"http://en.wikipedia.org/wiki/Database_normalization\" rel=\"nofollow noreferrer\">normal form</a>; us... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27763/"
] | My experience with MySQL is very basic. The simple stuff is easy enough, but I ran into something that is going to require a little more knowledge. I have a need for a table that stores a small list of words. The number of words stored could be anywhere between 1 to 15. Later, I plan on searching through the table by t... | C) use a [normal form](http://en.wikipedia.org/wiki/Database_normalization); use multiple rows with appropriate keys. an example:
```
mysql> SELECT * FROM blah;
+----+-----+-----------+
| K | grp | name |
+----+-----+-----------+
| 1 | 1 | foo |
| 2 | 1 | bar |
| 3 | 2 | hydrogen |
| 4 | ... |
439,657 | <p>I am trying to create an XSD schema for the following XML:</p>
<pre><code><root>
<!-- The actual file must contain one of the following constraints -->
<constraint type="interval">
<min>100</min>
<max>200</max>
</constraint>
<constraint type="equal... | [
{
"answer_id": 439676,
"author": "Jason S",
"author_id": 44330,
"author_profile": "https://Stackoverflow.com/users/44330",
"pm_score": 5,
"selected": true,
"text": "<p>C) use a <a href=\"http://en.wikipedia.org/wiki/Database_normalization\" rel=\"nofollow noreferrer\">normal form</a>; us... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to create an XSD schema for the following XML:
```
<root>
<!-- The actual file must contain one of the following constraints -->
<constraint type="interval">
<min>100</min>
<max>200</max>
</constraint>
<constraint type="equals">
<value>EOF</value>
</constraint>
</root>
```
The chil... | C) use a [normal form](http://en.wikipedia.org/wiki/Database_normalization); use multiple rows with appropriate keys. an example:
```
mysql> SELECT * FROM blah;
+----+-----+-----------+
| K | grp | name |
+----+-----+-----------+
| 1 | 1 | foo |
| 2 | 1 | bar |
| 3 | 2 | hydrogen |
| 4 | ... |
439,662 | <p>What are the differences between #import and #include in Objective-C and are there times where you should use one over the other? Is one deprecated?</p>
<p>I was reading the following tutorial: <a href="http://www.otierney.net/objective-c.html#preamble" rel="noreferrer">http://www.otierney.net/objective-c.html#prea... | [
{
"answer_id": 439683,
"author": "Ferruccio",
"author_id": 4086,
"author_profile": "https://Stackoverflow.com/users/4086",
"pm_score": 5,
"selected": false,
"text": "<p><code>#include</code> works just like the C <code>#include</code>.</p>\n\n<p><code>#import</code> keeps track of which ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7186/"
] | What are the differences between #import and #include in Objective-C and are there times where you should use one over the other? Is one deprecated?
I was reading the following tutorial: <http://www.otierney.net/objective-c.html#preamble> and its paragraph about #import and #include seems to contradict itself or at le... | The #import directive was added to Objective-C as an improved version of #include. Whether or not it's improved, however, is still a matter of debate. #import ensures that a file is only ever included once so that you never have a problem with recursive includes. However, most decent header files protect themselves aga... |
439,664 | <p>In Delphi, is normal do this:</p>
<pre><code>ob = TObject.create;
try
//code
finally
ob.free;
end;
</code></pre>
<p>I wonder if that is similar in Obj-c.</p>
| [
{
"answer_id": 439692,
"author": "Marc Charbonneau",
"author_id": 35136,
"author_profile": "https://Stackoverflow.com/users/35136",
"pm_score": 1,
"selected": false,
"text": "<p>No. Objective-C does support exceptions and you see them in Cocoa infrequently (NSError is the direction Apple... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53185/"
] | In Delphi, is normal do this:
```
ob = TObject.create;
try
//code
finally
ob.free;
end;
```
I wonder if that is similar in Obj-c. | You could do it that way, but exceptions tend to have a high cost in Objective-C. There are some differences in their performance between the 32-bit and 64-bit ABIs, as well as the interaction between Objective-C exceptions and C++ exceptions.
An alternative is to create your objects such that they are autoreleased an... |
439,670 | <p>I started with a query:</p>
<pre><code>SELECT strip.name as strip, character.name as character
from strips, characters, appearances
where strips.id = appearances.strip_id
and characters.id = appearances.character.id
and appearances.date in (...)
</code></pre>
<p>Which yielded me some results:</p>
<pre><c... | [
{
"answer_id": 439700,
"author": "Yes - that Jake.",
"author_id": 5287,
"author_profile": "https://Stackoverflow.com/users/5287",
"pm_score": 0,
"selected": false,
"text": "<p>On an RDBMS system, I'd select the count query into a temporary table, then rejoin the temp table to the main ta... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190/"
] | I started with a query:
```
SELECT strip.name as strip, character.name as character
from strips, characters, appearances
where strips.id = appearances.strip_id
and characters.id = appearances.character.id
and appearances.date in (...)
```
Which yielded me some results:
```
strip | character... | Does mySQL support analytic functions? Like:
```
SELECT foo.bar, baz.yoo, count(baz.yoo) over (partition by foo.bar) as yoo_count
from foo, bar
where foo.baz_id = baz.id and baz.id in (...)
```
Alternatively:
```
SELECT foo.bar, baz.yoo, v.yoo_count
from foo, bar,
( select foo.baz_id, count(*) as yoo_count
fro... |
439,677 | <p>I need a client-side script to confirm that the Timer's OnTick event can proceed. </p>
<p>How do I invoke <em>CanContinue()</em> before the Timer1 postback occurs? <br />
How do I cancel the postback if user selects Cancel?</p>
<pre><code><%@ Page Language="C#" %>
<script runat="server">
protecte... | [
{
"answer_id": 439700,
"author": "Yes - that Jake.",
"author_id": 5287,
"author_profile": "https://Stackoverflow.com/users/5287",
"pm_score": 0,
"selected": false,
"text": "<p>On an RDBMS system, I'd select the count query into a temporary table, then rejoin the temp table to the main ta... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23566/"
] | I need a client-side script to confirm that the Timer's OnTick event can proceed.
How do I invoke *CanContinue()* before the Timer1 postback occurs?
How do I cancel the postback if user selects Cancel?
```
<%@ Page Language="C#" %>
<script runat="server">
protected void Timer1_OnTick(object sender, EventArgs... | Does mySQL support analytic functions? Like:
```
SELECT foo.bar, baz.yoo, count(baz.yoo) over (partition by foo.bar) as yoo_count
from foo, bar
where foo.baz_id = baz.id and baz.id in (...)
```
Alternatively:
```
SELECT foo.bar, baz.yoo, v.yoo_count
from foo, bar,
( select foo.baz_id, count(*) as yoo_count
fro... |
439,679 | <p>Could someone please explain to me how arithmetic operators such as > or < compare strings in SQL Server 2005?</p>
| [
{
"answer_id": 439700,
"author": "Yes - that Jake.",
"author_id": 5287,
"author_profile": "https://Stackoverflow.com/users/5287",
"pm_score": 0,
"selected": false,
"text": "<p>On an RDBMS system, I'd select the count query into a temporary table, then rejoin the temp table to the main ta... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32326/"
] | Could someone please explain to me how arithmetic operators such as > or < compare strings in SQL Server 2005? | Does mySQL support analytic functions? Like:
```
SELECT foo.bar, baz.yoo, count(baz.yoo) over (partition by foo.bar) as yoo_count
from foo, bar
where foo.baz_id = baz.id and baz.id in (...)
```
Alternatively:
```
SELECT foo.bar, baz.yoo, v.yoo_count
from foo, bar,
( select foo.baz_id, count(*) as yoo_count
fro... |
439,686 | <p>I am implementing a tree think of it as a folder structure so I have a class that looks like:</p>
<pre><code>public class Folder
{
//Various Props like Name etc.
public IList<Folder> Children{get;}
public Folder Parent {get;}
}
</code></pre>
<p>Now what I want is to be able to walk up and down th... | [
{
"answer_id": 439726,
"author": "Harper Shelby",
"author_id": 21196,
"author_profile": "https://Stackoverflow.com/users/21196",
"pm_score": 1,
"selected": false,
"text": "<p>Personally, I'd go with method 1. Allowing client code to manipulate the Children collection directly violates en... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439686",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26160/"
] | I am implementing a tree think of it as a folder structure so I have a class that looks like:
```
public class Folder
{
//Various Props like Name etc.
public IList<Folder> Children{get;}
public Folder Parent {get;}
}
```
Now what I want is to be able to walk up and down the tree so given a root I can fin... | After looking [on MSDN](http://msdn.microsoft.com/en-us/library/e78dcd75.aspx) you could try this:
```
List<Folder> children;
public ReadOnlyCollection<Folder> Children
{
get { return this.children.AsReadOnly(); }
}
```
If your private member must be declared as an IList then we can copy that into a list and th... |
439,729 | <p>Right now I'm trying to figure out a way to do things smarter, and in the course of doing so all i've managed to do is use a full bottle of excedrin in a single day.</p>
<p>Assume i have an interface called IRepository like so.</p>
<pre><code> public interface IRepository<T>
{
T Get(int id);
void Ad... | [
{
"answer_id": 439795,
"author": "rball",
"author_id": 50711,
"author_profile": "https://Stackoverflow.com/users/50711",
"pm_score": 1,
"selected": false,
"text": "<p>Couldn't you have a LoggingRepository abstract base class that would handle logging for your different Get, Add, Update,... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/77/"
] | Right now I'm trying to figure out a way to do things smarter, and in the course of doing so all i've managed to do is use a full bottle of excedrin in a single day.
Assume i have an interface called IRepository like so.
```
public interface IRepository<T>
{
T Get(int id);
void Add(T value);
void Update... | If you are going to use [decorators](http://en.wikipedia.org/wiki/Decorator_pattern) that sounds about right. Each decorator would have a constructor with an argument of IRepository and call the logging or transaction code around calls to the inner repository that it is decorating.
As an alternative you might consider... |
439,750 | <p>Scenario:</p>
<p>Let's say I have two tables, TableA and TableB. TableB's primary key is a single column (BId), and is a foreign key column in TableA.</p>
<p>In my situation, I want to remove all rows in TableA that are linked with specific rows in TableB: Can I do that through joins? Delete all rows that are pul... | [
{
"answer_id": 439768,
"author": "TheTXI",
"author_id": 22164,
"author_profile": "https://Stackoverflow.com/users/22164",
"pm_score": 11,
"selected": true,
"text": "<pre><code>DELETE TableA\nFROM TableA a\n INNER JOIN TableB b\n ON b.Bid = a.Bid\n A... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30006/"
] | Scenario:
Let's say I have two tables, TableA and TableB. TableB's primary key is a single column (BId), and is a foreign key column in TableA.
In my situation, I want to remove all rows in TableA that are linked with specific rows in TableB: Can I do that through joins? Delete all rows that are pulled in from the jo... | ```
DELETE TableA
FROM TableA a
INNER JOIN TableB b
ON b.Bid = a.Bid
AND [my filter condition]
```
should work |
439,758 | <p>When I try to list Synthesizer devices in Java (1.6.0), I get only one device, <em>Java Sound Synthesizer</em>. I want to use the Synthesizer in the sound card or use any other installed synthesizer, eg. the Microsoft Synthesizer. How can I go about doing that ? If this capability is not inbuilt, is there any open s... | [
{
"answer_id": 439768,
"author": "TheTXI",
"author_id": 22164,
"author_profile": "https://Stackoverflow.com/users/22164",
"pm_score": 11,
"selected": true,
"text": "<pre><code>DELETE TableA\nFROM TableA a\n INNER JOIN TableB b\n ON b.Bid = a.Bid\n A... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18390/"
] | When I try to list Synthesizer devices in Java (1.6.0), I get only one device, *Java Sound Synthesizer*. I want to use the Synthesizer in the sound card or use any other installed synthesizer, eg. the Microsoft Synthesizer. How can I go about doing that ? If this capability is not inbuilt, is there any open source proj... | ```
DELETE TableA
FROM TableA a
INNER JOIN TableB b
ON b.Bid = a.Bid
AND [my filter condition]
```
should work |
439,787 | <p>I have a C++.NET app and a C#.NET app. I would like them to communicate via shared memory.</p>
<p>How is it possible in .NET version 2.0 ?</p>
<p>Mainly want to share a queue object.</p>
| [
{
"answer_id": 439862,
"author": "Diadistis",
"author_id": 47401,
"author_profile": "https://Stackoverflow.com/users/47401",
"pm_score": 3,
"selected": false,
"text": "<p>There are several options for your applications to communicate. The most popular are Remoting and Pipes. There are se... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a C++.NET app and a C#.NET app. I would like them to communicate via shared memory.
How is it possible in .NET version 2.0 ?
Mainly want to share a queue object. | Update: Hey, [here's a page](http://blogs.microsoft.co.il/blogs/pavely/archive/2008/05/05/shared-memory-section-wrapper-using-c-cli.aspx) I just found with a compleate implmentation.
---
Using C++/CLI, it's quite easy to setup shared memory as per normal C++ API (C++/CLI being able to interact with the managed and na... |
439,814 | <p>I need to find out the prime factors of over 300 billion. I have a function that is adding to the list of them...very slowly! It has been running for about an hour now and i think its got a fair distance to go still. Am i doing it completly wrong or is this expected?</p>
<p>Edit: Im trying to find the largest prime... | [
{
"answer_id": 439835,
"author": "Alnitak",
"author_id": 6782,
"author_profile": "https://Stackoverflow.com/users/6782",
"pm_score": 6,
"selected": true,
"text": "<p>Are you remembering to divide the number that you're factorizing by each factor as you find them?</p>\n\n<p>Say, for examp... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36243/"
] | I need to find out the prime factors of over 300 billion. I have a function that is adding to the list of them...very slowly! It has been running for about an hour now and i think its got a fair distance to go still. Am i doing it completly wrong or is this expected?
Edit: Im trying to find the largest prime factor of... | Are you remembering to divide the number that you're factorizing by each factor as you find them?
Say, for example, you find that 2 is a factor. You can add that to your list of factors, but then you divide the number that you're trying to factorise by that value.
Now you're only searching for the factors of 150 bill... |
439,815 | <p>I have an access 2007 Database that outputs a report in excel format, the report is dependent on a date parameter that is chosen by the user. This parameter is selected via a textbox (text100) that has a pop up calendar. I would like to use the date in the text box(text100) as part of the filename. I am using the t... | [
{
"answer_id": 439851,
"author": "JD Long",
"author_id": 37751,
"author_profile": "https://Stackoverflow.com/users/37751",
"pm_score": 0,
"selected": false,
"text": "<p>It's a little tough to determine exactly what your question is, but I think you are asking, \"how do I use the contents... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439815",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44685/"
] | I have an access 2007 Database that outputs a report in excel format, the report is dependent on a date parameter that is chosen by the user. This parameter is selected via a textbox (text100) that has a pop up calendar. I would like to use the date in the text box(text100) as part of the filename. I am using the trans... | Well the obvious question is, where does Text100 get first set?
Another style comment, it is better to do
```
goto ExitSub
'...
ExitSub:
```
Then your "GoTo 53" - its a little more meaningful.
At that rate, it would be better to move your "Done" message outside of the IF statements, and the TempVars doesn't seem ... |
439,823 | <p>Is there anyway simple ways to add a property to Linq to Sql generated entity to reference its DataContext?
For example:</p>
<pre><code>var myContext = new DataContext();
var product = context.Products.Where(p => p.Id == productId).SingleOrDefault();
</code></pre>
<p>and product entity has a property called "... | [
{
"answer_id": 440055,
"author": "Amy B",
"author_id": 8155,
"author_profile": "https://Stackoverflow.com/users/8155",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>Is there a simple way to add a property to Linq to Sql generated entity to reference its DataContext?</p>\n... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34623/"
] | Is there anyway simple ways to add a property to Linq to Sql generated entity to reference its DataContext?
For example:
```
var myContext = new DataContext();
var product = context.Products.Where(p => p.Id == productId).SingleOrDefault();
```
and product entity has a property called "Context" (product.Context) th... | >
> Is there a simple way to add a property to Linq to Sql generated entity to reference its DataContext?
>
>
>
There is no simple way to achieve this. |
439,829 | <p>I have a crystal report function which requires me to trim off characters which start with a "-" and delete the rest following the the "-" (dash). </p>
<p>For example, I would have order number 00000112345-C43-PJ. </p>
<p>How would I just trim off everything from the right of the "-" get the result as 00000112345... | [
{
"answer_id": 439999,
"author": "DJ.",
"author_id": 10492,
"author_profile": "https://Stackoverflow.com/users/10492",
"pm_score": 3,
"selected": true,
"text": "<p>Crystal might not have regex but it certainly has all the basic string functions</p>\n\n<p>Something like this should do it ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18853/"
] | I have a crystal report function which requires me to trim off characters which start with a "-" and delete the rest following the the "-" (dash).
For example, I would have order number 00000112345-C43-PJ.
How would I just trim off everything from the right of the "-" get the result as 00000112345?
I looked for a ... | Crystal might not have regex but it certainly has all the basic string functions
Something like this should do it for you (not tested):
```
Left({OrderNumber}, InStr({OrderNumber}, "-") - 1)
``` |
439,831 | <h2>Setup</h2>
<p>I have a VBScript for driving the stress testing of a web service. The script creates a data file of measurements, with each record timestamped with a general date/time:</p>
<pre><code>FormatDateTime(Now(), 0)
</code></pre>
<p>This creates dates like</p>
<pre><code>mm/dd/yyyy hh:mm:ss [AM|PM]
</co... | [
{
"answer_id": 439890,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 1,
"selected": false,
"text": "<p>VBScripts FormatDateTime function does not supprot general format strings only a constrained set of constants and... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7903/"
] | Setup
-----
I have a VBScript for driving the stress testing of a web service. The script creates a data file of measurements, with each record timestamped with a general date/time:
```
FormatDateTime(Now(), 0)
```
This creates dates like
```
mm/dd/yyyy hh:mm:ss [AM|PM]
```
I need to import this data file into a... | From this [link](http://classicasp.aspfaq.com/date-time-routines-manipulation/can-i-make-vbscript-format-dates-for-me.html); I can mimic VB's `Format()` function to format the date as 24-hour date/time:
```
Function Format(vExpression, sFormat)
set fmt = CreateObject("MSSTDFMT.StdDataFormat")
fmt.Format = s... |
439,857 | <p>Does anyone know of any (preferrably free) supported api's for accessing movie showtimes by zip code?</p>
<p>I don't believe any existing api's, such as netflix or imdb, provide this information.</p>
| [
{
"answer_id": 439875,
"author": "user54650",
"author_id": 54650,
"author_profile": "https://Stackoverflow.com/users/54650",
"pm_score": 0,
"selected": false,
"text": "<p>My guess is that your best bet on that (unless these guys have RSS feeds) would be to scrape the HTML with a language... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Does anyone know of any (preferrably free) supported api's for accessing movie showtimes by zip code?
I don't believe any existing api's, such as netflix or imdb, provide this information. | when "allow\_url\_fopen" is disabled then use
```
<?php
/**
* Google Showtime grabber
*
* This file will grab the last showtimes of theatres nearby your zipcode.
* Please make the URL your own! You can also add parameters to this URL:
* &date=0|1|2|3 => today|1 day|2 days|etc..
* &start=10 gets the second... |
439,877 | <p>I'm wondering how one could use template databinding to accomplish what the following code produces (a grid of checkboxes with some associated text): </p>
<pre><code> int tbIndex = 0;
for (int i = 1; i < 5; i++) {
StackPanel pan = new StackPanel();
pan.Orientation = Orienta... | [
{
"answer_id": 439901,
"author": "Kent Boogaart",
"author_id": 5380,
"author_profile": "https://Stackoverflow.com/users/5380",
"pm_score": 1,
"selected": false,
"text": "<pre><code><ItemsControl ItemsSource=\"{Binding YourListOfItems}\">\n <ItemsControl.ItemTemplate>\n ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64/"
] | I'm wondering how one could use template databinding to accomplish what the following code produces (a grid of checkboxes with some associated text):
```
int tbIndex = 0;
for (int i = 1; i < 5; i++) {
StackPanel pan = new StackPanel();
pan.Orientation = Orientation.Horizontal;
... | AnthonyWJones has it right that the Wrap Panel is a good approach but Kent went through the trouble of demonstrating how once could use the ItemSource (albeit with the StackPanel which doesn't achieve the goal). As such I'll post the code which demonstrates the declarative equivalent:
```
<ItemsControl x:Name="myItem... |
439,915 | <p>How do I get an old VC++ 6.0 MFC program to read and display UTF8 in a TextBox or MessageBox? Preferably without breaking any of the file reading and displaying that is currently written in there (fairly substantial).</p>
<p>I read a line into CString strStr, then used this code:</p>
<pre><code>int nLengthNeeded ... | [
{
"answer_id": 439969,
"author": "cbrulak",
"author_id": 29505,
"author_profile": "https://Stackoverflow.com/users/29505",
"pm_score": 0,
"selected": false,
"text": "<p>take a look at:</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/ms776420(VS.85).aspx\" rel=\"nofollow noref... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12889/"
] | How do I get an old VC++ 6.0 MFC program to read and display UTF8 in a TextBox or MessageBox? Preferably without breaking any of the file reading and displaying that is currently written in there (fairly substantial).
I read a line into CString strStr, then used this code:
```
int nLengthNeeded = MultiByteToWideChar(... | I feel like this won't be helpful, but it's a starting point... I'm assuming it doesn't 'just work', and I don't think you want to try to screw around with wacky code pages that may or may not get you what you want.
How about just using MultiByteToWideChar(CP\_UTF8, ...) to convert it to utf16 and then calling the W v... |
439,932 | <p>I've written an installer using NSIS and I need it to install some files (DLLs etc.) in a standard location like C:/Program Files/App Name/. I also need to install files in the current user's Application Data directory. The problem is that when the user is not an admin on Vista I need to elevate privileges and in do... | [
{
"answer_id": 440813,
"author": "Igal Serban",
"author_id": 25737,
"author_profile": "https://Stackoverflow.com/users/25737",
"pm_score": 1,
"selected": false,
"text": "<p>Look at the <a href=\"http://msdn.microsoft.com/en-us/windows/dd203105.aspx\" rel=\"nofollow noreferrer\">Windows 7... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14059/"
] | I've written an installer using NSIS and I need it to install some files (DLLs etc.) in a standard location like C:/Program Files/App Name/. I also need to install files in the current user's Application Data directory. The problem is that when the user is not an admin on Vista I need to elevate privileges and in doing... | All of my NSIS installers use this UAC plug-in: <http://nsis.sourceforge.net/UAC_plug-in>.
You can elevate to admin as soon as you launch the installer. This spawns a second instance of your installer that does all of the work. But you can make calls to code segments that will run in the original process as the user t... |
439,959 | <p>I'm looking for a ClearCase command that will list all the elements that are visible in my current view, but do <strong>NOT</strong> have a particular label applied to them.</p>
<p>Say for example, most of the elements that are visible in my view have <em>LABEL_X</em> applied to them. I want a list of those elemen... | [
{
"answer_id": 442130,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 3,
"selected": true,
"text": "<p>This should work:</p>\n\n<pre><code>ct find -all -ele '! lbtype_sub(LABEL_X)' -print\nct find -ele '! lbtype_sub(LABEL_X)' -p... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54213/"
] | I'm looking for a ClearCase command that will list all the elements that are visible in my current view, but do **NOT** have a particular label applied to them.
Say for example, most of the elements that are visible in my view have *LABEL\_X* applied to them. I want a list of those elements that do not have *LABEL\_X*... | This should work:
```
ct find -all -ele '! lbtype_sub(LABEL_X)' -print
ct find -ele '! lbtype_sub(LABEL_X)' -print
```
Notes:
* ct stands for cleartool
* Unix syntax here (for windows, replace simple quotes with double quotes)
* beware of the space between `!` and `lbtype_sub` (in winodws you do not need the space)... |
439,966 | <p>I'm about to build my first Ruby on Rails application (and first anything beyond xhtml and css), and I'm looking for some helpful feedback on my model structure.</p>
<p><strong><a href="http://img523.imageshack.us/img523/523/demoox9.jpg" rel="nofollow noreferrer">I've included a mockup to help visual the applicatio... | [
{
"answer_id": 440005,
"author": "Abie",
"author_id": 53166,
"author_profile": "https://Stackoverflow.com/users/53166",
"pm_score": 3,
"selected": true,
"text": "<p>I would recommend getting your data model clear first. You can then start with one rails model per database table. This is ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53875/"
] | I'm about to build my first Ruby on Rails application (and first anything beyond xhtml and css), and I'm looking for some helpful feedback on my model structure.
**[I've included a mockup to help visual the application.](http://img523.imageshack.us/img523/523/demoox9.jpg)**
The only models I'm sure I need so far are:... | I would recommend getting your data model clear first. You can then start with one rails model per database table. This is not always the case, but it's a reasonable place to start.
Let's focus on the movies and actors:
Some assumptions:
* movies can have a many-to-many relationship to the other entities
* you want... |
439,970 | <p>I use a parser generator here, that unfortunately insists on putting a</p>
<pre><code>#include <some/file.h>
</code></pre>
<p>at the top of every generated source file. The header has since long been renamed. While it is no problem forcing the compiler (gcc) to use the new header with <code>-include new/head... | [
{
"answer_id": 439984,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": 3,
"selected": false,
"text": "<p>Replace <code>some/file.h</code> with an empty file.</p>\n"
},
{
"answer_id": 439992,
"author": "Joe",
"a... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24937/"
] | I use a parser generator here, that unfortunately insists on putting a
```
#include <some/file.h>
```
at the top of every generated source file. The header has since long been renamed. While it is no problem forcing the compiler (gcc) to use the new header with `-include new/header.h`, removing the above directive f... | No. You can post-process your generated file - I say: NO!!!
Or you can just add '.' to your system include directories (or whatever your local include path is - make sure it's also a <> system include path).
Then make a 'some' directory and stick your own permanent 'file.h' in there that has 1 line for #include and g... |
440,016 | <p>I'm trying to new up a LocalCommand instance which is a private class of System.Data.SqlClient.SqlCommandSet. I seem to be able to grab the type information just fine:</p>
<pre><code>Assembly sysData = Assembly.Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
localCmdType = sy... | [
{
"answer_id": 440047,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": true,
"text": "<p>My first thought would be to get the <code>ConstructorInfo</code> using <code>ConstructorInfo constructorInfo = Type.G... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to new up a LocalCommand instance which is a private class of System.Data.SqlClient.SqlCommandSet. I seem to be able to grab the type information just fine:
```
Assembly sysData = Assembly.Load("System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
localCmdType = sysData.GetType(... | My first thought would be to get the `ConstructorInfo` using `ConstructorInfo constructorInfo = Type.GetConstructor()`, and then `constructorInfo.Invoke()` that. I suspect that `Activator.CreateInstance` makes it hard to call constructors you wouldn't normally have access to, although I don't remember trying it myself. |
440,018 | <p>I've tried searching but couldn't come up with a defined way on how to add your own packages to a GWT project.</p>
<p>My tree structure looks like this:</p>
<pre><code>-com.mycompany
-public
MyApplication.html
MyApplication.gwt.xml
-com.mycompany.client
MyApp.java
-com.mycompany.gui
TableLayout.java... | [
{
"answer_id": 440835,
"author": "rustyshelf",
"author_id": 6044,
"author_profile": "https://Stackoverflow.com/users/6044",
"pm_score": 4,
"selected": true,
"text": "<p>You can get rid of the two source path lines, because by default GWT will pick up anything that is relative to the root... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16631/"
] | I've tried searching but couldn't come up with a defined way on how to add your own packages to a GWT project.
My tree structure looks like this:
```
-com.mycompany
-public
MyApplication.html
MyApplication.gwt.xml
-com.mycompany.client
MyApp.java
-com.mycompany.gui
TableLayout.java
```
The answer I've... | You can get rid of the two source path lines, because by default GWT will pick up anything that is relative to the root, and in the client package like you have. You also need to move your gui package into your client package, so it would become:
```
-com.mycompany
-public
MyApplication.html
MyApplication.gwt.... |
440,037 | <p>I have a range I'd like to arbitrarily sort and filter using vba. I don't, however, want it to affect the worksheet. I'd like to essentially copy the range into some native class that supports filtering and sorting (so i don't have to reinvent the wheel) and use that class to return a result to calling code. </p>
<... | [
{
"answer_id": 440094,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": -1,
"selected": false,
"text": "<p>Why not copy the data to a new, hidden worksheet, perform your sort/filter there, and then copy the data back when d... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1946/"
] | I have a range I'd like to arbitrarily sort and filter using vba. I don't, however, want it to affect the worksheet. I'd like to essentially copy the range into some native class that supports filtering and sorting (so i don't have to reinvent the wheel) and use that class to return a result to calling code.
Are ther... | Turns out I can create a recordSet to do this. Unlike, Remou's answer though we don't have to invoke a heavy weight odbc process on our sheet.
The following function (adapted from Mark Nold's answer) will create a record set from the supplied range. It assumes column headers are in the first row of the supplied range.... |
440,061 | <p>I have a tab delimited file where each record has a timestamp field in 12-hour format:</p>
<blockquote>
<p>mm/dd/yyyy hh:mm:ss [AM|PM].</p>
</blockquote>
<p>I need to quickly convert these fields to 24-hour time:</p>
<blockquote>
<p>mm/dd/yyyy HH:mm:ss.</p>
</blockquote>
<p>What would be the best way to do t... | [
{
"answer_id": 440089,
"author": "Dillie-O",
"author_id": 71,
"author_profile": "https://Stackoverflow.com/users/71",
"pm_score": -1,
"selected": false,
"text": "<p>Since you have multiple languages, I'll suggest the following algorithm.</p>\n\n<p>1 Check the timestamp for the existence ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440061",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7903/"
] | I have a tab delimited file where each record has a timestamp field in 12-hour format:
>
> mm/dd/yyyy hh:mm:ss [AM|PM].
>
>
>
I need to quickly convert these fields to 24-hour time:
>
> mm/dd/yyyy HH:mm:ss.
>
>
>
What would be the best way to do this? I'm running on a Windows platform, but I have access to ... | Using Perl and hand-crafted regexes instead of facilities like strptime:
```
#!/bin/perl -w
while (<>)
{
# for date times that don't use leading zeroes, use this regex instead:
# (?:\d{1,2}/\d{1,2}/\d{4} )(\d{1,2})(?::\d\d:\d\d) (AM|PM)
while (m%(?:\d\d/\d\d/\d{4} )(\d\d)(?::\d\d:\d\d) (AM|PM)%)
{
... |
440,063 | <p>there is a check I need to perform after each subsequent step in a function, so I wanted to define that step as a function within a function.</p>
<pre><code>>>> def gs(a,b):
... def ry():
... if a==b:
... return a
...
... ry()
...
... a += 1
... ry()
...
... b*=2
... ry()
...
>>... | [
{
"answer_id": 440072,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 4,
"selected": false,
"text": "<p>Do you mean?</p>\n\n<pre><code>def gs(a,b):\n def ry():\n if a==b:\n return a\n return ry()\n</c... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2908/"
] | there is a check I need to perform after each subsequent step in a function, so I wanted to define that step as a function within a function.
```
>>> def gs(a,b):
... def ry():
... if a==b:
... return a
...
... ry()
...
... a += 1
... ry()
...
... b*=2
... ry()
...
>>> gs(1,2) # should return 2
... | This should allow you to keep checking the state and return from the outer function if a and b ever end up the same:
```
def gs(a,b):
class SameEvent(Exception):
pass
def ry():
if a==b:
raise SameEvent(a)
try:
# Do stuff here, and call ry whenever you want to return if t... |
440,068 | <p>I was wondering if there was any unobtrusive way to hook into methods such as attr, data, css, etc and call custom triggers?</p>
<p>Ideally, I could do something like this:</p>
<pre><code>$(".friend a").bind("attr.changed", changed /* data */, function(e) {
alert("The " + changed.attribute + " attribute change... | [
{
"answer_id": 440205,
"author": "Robert K",
"author_id": 24950,
"author_profile": "https://Stackoverflow.com/users/24950",
"pm_score": 0,
"selected": false,
"text": "<p>There is no event for this currently existing within jQuery.</p>\n\n<p>The <a href=\"http://plugins.jquery.com/project... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54697/"
] | I was wondering if there was any unobtrusive way to hook into methods such as attr, data, css, etc and call custom triggers?
Ideally, I could do something like this:
```
$(".friend a").bind("attr.changed", changed /* data */, function(e) {
alert("The " + changed.attribute + " attribute changed from " + changed.fr... | It's pretty easy to write a "hook" function:
```
function hook(original, wrapper) {
return function() {
wrapper.apply(this, arguments);
return original.apply(this, arguments);
}
}
```
The `wrapper` function you provide will be called with the same arguments as the `original` function, before ... |
440,083 | <p>I'm trying to use the <code>Seq.generate_using</code> function but unfortunately, I don't seem to be able to find it. I thought it would be living here: </p>
<pre><code>Microsoft.FSharp.Collections.Seq.generate_using
</code></pre>
<p>But it doesn't. I am getting the error listed below.</p>
<blockquote>
<p>C:\U... | [
{
"answer_id": 440294,
"author": "Juliet",
"author_id": 40516,
"author_profile": "https://Stackoverflow.com/users/40516",
"pm_score": 4,
"selected": true,
"text": "<p>According to the <a href=\"http://blogs.msdn.com/dsyme/archive/2008/08/29/detailed-release-notes-for-the-f-september-2008... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26227/"
] | I'm trying to use the `Seq.generate_using` function but unfortunately, I don't seem to be able to find it. I thought it would be living here:
```
Microsoft.FSharp.Collections.Seq.generate_using
```
But it doesn't. I am getting the error listed below.
>
> C:\Users\Owner\Documents\Visual Studio
> 2008\Projects\fsh... | According to the [Sept 2008 CTP Release Notes](http://blogs.msdn.com/dsyme/archive/2008/08/29/detailed-release-notes-for-the-f-september-2008-ctp-release.aspx):
>
> The F# library is split into two
> components. FSharp.Core.dll: Contains
> the core F# libraries, which will be
> stabilized and versioned infrequentl... |
440,087 | <p>I am serializing a class using simple-xml (<a href="http://simple.sourceforge.net/" rel="nofollow noreferrer">http://simple.sourceforge.net/</a>) but when i try to use @Element on a Point object i get an error, how can i transform this Point object?</p>
| [
{
"answer_id": 440148,
"author": "ng.",
"author_id": 21896,
"author_profile": "https://Stackoverflow.com/users/21896",
"pm_score": 2,
"selected": true,
"text": "<p>You can create a transform like so</p>\n\n<pre><code>public class PointTransform implements Transform<Point> {\n\n pu... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54564/"
] | I am serializing a class using simple-xml (<http://simple.sourceforge.net/>) but when i try to use @Element on a Point object i get an error, how can i transform this Point object? | You can create a transform like so
```
public class PointTransform implements Transform<Point> {
public Point read(String value) {
return fromString(value);
}
public String write(Point value) {
return toString(value);
}
// etc ...
}
```
Then pass in a Matcher to the Persister constructor so t... |
440,131 | <p>As an example, when inserting a record into a table with a unique index, is it best to test first? <em>e.g.</em>, </p>
<pre><code>$mysqli->query('SELECT email FROM tblUser WHERE email = 'foo@bar.org');
</code></pre>
<p>then make sure 0 rows are returned, <em>then</em> do the insert? </p>
<pre><code>$mysqli->... | [
{
"answer_id": 440165,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 5,
"selected": true,
"text": "<p>It's better to insert and handle any duplicate key errors.</p>\n\n<p>The reason is that if you test first, some othe... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49529/"
] | As an example, when inserting a record into a table with a unique index, is it best to test first? *e.g.*,
```
$mysqli->query('SELECT email FROM tblUser WHERE email = 'foo@bar.org');
```
then make sure 0 rows are returned, *then* do the insert?
```
$mysqli->query('INSERT INTO tblUser ...');
```
Or is it better ... | It's better to insert and handle any duplicate key errors.
The reason is that if you test first, some other client can still insert the value in the brief moment between your test and your insert. So you'd need to handle errors anyway. |
440,133 | <p>I'd like to create a random string, consisting of alpha-numeric characters. I want to be able to be specify the length of the string.</p>
<p>How do I do this in C++?</p>
| [
{
"answer_id": 440147,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 4,
"selected": false,
"text": "<pre><code> void gen_random(char *s, size_t len) {\n for (size_t i = 0; i < len; ++i) {\n int randomChar = rand... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/814/"
] | I'd like to create a random string, consisting of alpha-numeric characters. I want to be able to be specify the length of the string.
How do I do this in C++? | Mehrdad Afshari's [answer](https://stackoverflow.com/questions/440133/how-do-i-create-a-random-alpha-numeric-string-in-c#440147) would do the trick, but I found it a bit too verbose for this simple task. Look-up tables can sometimes do wonders:
```
#include <ctime>
#include <iostream>
#include <unistd.h>
std::string ... |
440,135 | <p>Say I have an Oracle PL/SQL block that inserts a record into a table and need to recover from a unique constraint error, like this:</p>
<pre><code>begin
insert into some_table ('some', 'values');
exception
when ...
update some_table set value = 'values' where key = 'some';
end;
</code></pre>
<p>Is ... | [
{
"answer_id": 440157,
"author": "EvilTeach",
"author_id": 7734,
"author_profile": "https://Stackoverflow.com/users/7734",
"pm_score": 4,
"selected": false,
"text": "<p>I suspect the condition you are looking for is <a href=\"http://www.ordba.net/Tutorials/PLSQL/PLSQL~Error_Handling.htm... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17801/"
] | Say I have an Oracle PL/SQL block that inserts a record into a table and need to recover from a unique constraint error, like this:
```
begin
insert into some_table ('some', 'values');
exception
when ...
update some_table set value = 'values' where key = 'some';
end;
```
Is it possible to replace the... | ```
EXCEPTION
WHEN DUP_VAL_ON_INDEX
THEN
UPDATE
``` |
440,142 | <p>I'm looking at converting a web site from classic ASP to ASP.NET. I'm thinking of doing an agile style approach and providing deliverables as quickly as possible and so am thinking of doing a line by line conversion and creating "bad" ASP.NET and have it all in the ASPX file for phase 1 and get that working. That, I... | [
{
"answer_id": 440155,
"author": "Daniel Schaffer",
"author_id": 2596,
"author_profile": "https://Stackoverflow.com/users/2596",
"pm_score": 1,
"selected": false,
"text": "<p>If using ASP.NET MVC is an option for you, I'd take a look at that first. I would think it would be a much easier... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] | I'm looking at converting a web site from classic ASP to ASP.NET. I'm thinking of doing an agile style approach and providing deliverables as quickly as possible and so am thinking of doing a line by line conversion and creating "bad" ASP.NET and have it all in the ASPX file for phase 1 and get that working. That, I fi... | Look in the Microsoft.VisualBasic namespace to get access to the old VBScript/VB6 functions. You can use them directly from C#.
Additionally, you're in for a shock. ASP.Net uses a different compiler model, and so some of the things you did in Classic ASP aren't allowed at all in ASP.Net. Include files is the big one t... |
440,144 | <p>I'd like to get a list of all the uniforms & attribs used by a shader program object. <code>glGetAttribLocation()</code> & <code>glGetUniformLocation()</code> can be used to map a string to a location, but what I would really like is the list of strings without having to parse the glsl code.</p>
<p>Note: I... | [
{
"answer_id": 442819,
"author": "NeARAZ",
"author_id": 6799,
"author_profile": "https://Stackoverflow.com/users/6799",
"pm_score": 8,
"selected": true,
"text": "<p><em>Variables shared between both examples:</em></p>\n\n<pre><code>GLint i;\nGLint count;\n\nGLint size; // size of the var... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1841/"
] | I'd like to get a list of all the uniforms & attribs used by a shader program object. `glGetAttribLocation()` & `glGetUniformLocation()` can be used to map a string to a location, but what I would really like is the list of strings without having to parse the glsl code.
Note: In OpenGL 2.0 `glGetObjectParameteriv()` i... | *Variables shared between both examples:*
```
GLint i;
GLint count;
GLint size; // size of the variable
GLenum type; // type of the variable (float, vec3 or mat4, etc)
const GLsizei bufSize = 16; // maximum name length
GLchar name[bufSize]; // variable name in GLSL
GLsizei length; // name length
```
Attributes
---... |
440,161 | <p>Is there some way to make c++ dlls built with diffrent compilers compatible with each other? The classes can have factory methods for creation and destruction, so each compiler can use its own new/delete (since diffrent runtimes have there own heaps).</p>
<p>I tried the following code but it crashed on the first me... | [
{
"answer_id": 440286,
"author": "gbjbaanb",
"author_id": 13744,
"author_profile": "https://Stackoverflow.com/users/13744",
"pm_score": 0,
"selected": false,
"text": "<p>interesting.. what happens if you compile the dll in VC++ as well, and what if you put some debug statements in Create... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6266/"
] | Is there some way to make c++ dlls built with diffrent compilers compatible with each other? The classes can have factory methods for creation and destruction, so each compiler can use its own new/delete (since diffrent runtimes have there own heaps).
I tried the following code but it crashed on the first member metho... | You should be able to mix modules built with different compilers if you lower your expectations and stick to simple functions.
The way classes and virtual functions behave is defined by the C++ standard, but the way that's implemented is up to the compiler. In this case, I know that VC++ builds objects which have virt... |
440,167 | <p>Following code, when compiled and run with g++,
prints '1' twice, whereas I expect '1' to be printed
only once, since I am dumping a single structure to
the file, but while reading back it seems to be
reading two structures. Why?</p>
<pre><code>#include <iostream.h>
#include <fstream.h>
int main(){
... | [
{
"answer_id": 440183,
"author": "Eclipse",
"author_id": 8701,
"author_profile": "https://Stackoverflow.com/users/8701",
"pm_score": 5,
"selected": true,
"text": "<p><code>eof</code> only gets set after a read fails, so the read runs twice, and the second time, it doesn't modify the buff... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49560/"
] | Following code, when compiled and run with g++,
prints '1' twice, whereas I expect '1' to be printed
only once, since I am dumping a single structure to
the file, but while reading back it seems to be
reading two structures. Why?
```
#include <iostream.h>
#include <fstream.h>
int main(){
struct student
{
... | `eof` only gets set after a read fails, so the read runs twice, and the second time, it doesn't modify the buffer.
Try this:
```
while(filin.read((char*)&tmpStu,sizeof(tmpStu)))
{
cout << tmpStu.rollNo << endl;
}
```
Or
```
while(!filin.read((char*)&tmpStu,sizeof(tmpStu)).eof())
{
cout << tmpStu.rollNo <... |
440,175 | <p>I have a computer (say computer A) whenever computer A gets a connection over a particular telnet port, it launches a program.</p>
<p>this program on computer A handles login, authentication etc. One of the jobs it can do is receive files. It handles this by launching gKermit. </p>
<p><code><pre>/usr/local/bin/gke... | [
{
"answer_id": 440263,
"author": "dr.manhattan ",
"author_id": 54466,
"author_profile": "https://Stackoverflow.com/users/54466",
"pm_score": -1,
"selected": false,
"text": "<p>Typically, when your database schema becomes very large and multiple users are trying to access the same informa... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54706/"
] | I have a computer (say computer A) whenever computer A gets a connection over a particular telnet port, it launches a program.
this program on computer A handles login, authentication etc. One of the jobs it can do is receive files. It handles this by launching gKermit.
````
/usr/local/bin/gkermit -e 8000 -w -a /loc... | As you have probably realized, the problem with an EAV model is that tables grow very large and queries grow very complex very quickly. For example, EAV-based queries typically require lots of subqueries just to get at the same data that would be trivial to select if you were using more traditionally-structured tables.... |
440,200 | <p>Would like to create a strong password in C++. Any suggestions?</p>
<ul>
<li><p>I assume it should use alpha (upper
and lower), numeric, special
characters.</p></li>
<li><p>It would be good to be able to
specify a minimum length.</p></li>
<li><p>It would be great to avoid characters
that are hard to visually distin... | [
{
"answer_id": 440224,
"author": "daniel",
"author_id": 50526,
"author_profile": "https://Stackoverflow.com/users/50526",
"pm_score": 1,
"selected": false,
"text": "<p>You can try a <a href=\"http://en.wikipedia.org/wiki/TRNG\" rel=\"nofollow noreferrer\">TRNG</a> device plus some well <... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/814/"
] | Would like to create a strong password in C++. Any suggestions?
* I assume it should use alpha (upper
and lower), numeric, special
characters.
* It would be good to be able to
specify a minimum length.
* It would be great to avoid characters
that are hard to visually distinguish
like "O" and "O"
* It would be great to... | [APG](http://www.adel.nursat.kz/apg/download.shtml) (Automated Password Generator) implements all but your last requirement (no dictionary words / usernames / repeated characters). It includes both pronounceable and fully random password generation algorithms. Pronounceable passwords look something like this:
```
yevG... |
440,204 | <p>In C89, floor() returns a double. Is the following guaranteed to work?</p>
<pre><code>double d = floor(3.0 + 0.5);
int x = (int) d;
assert(x == 3);
</code></pre>
<p>My concern is that the result of floor might not be exactly representable in IEEE 754. So d gets something like 2.99999, and x ends up being 2.</p>
... | [
{
"answer_id": 440222,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 5,
"selected": true,
"text": "<p>All integers can have exact floating point representation if your floating point type supports the required mantissa bits. S... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6160/"
] | In C89, floor() returns a double. Is the following guaranteed to work?
```
double d = floor(3.0 + 0.5);
int x = (int) d;
assert(x == 3);
```
My concern is that the result of floor might not be exactly representable in IEEE 754. So d gets something like 2.99999, and x ends up being 2.
For the answer to this question... | All integers can have exact floating point representation if your floating point type supports the required mantissa bits. Since `double` uses 53 bits for mantissa, it can store all 32-bit `int`s exactly. After all, you could just set the value as mantissa with zero exponent. |
440,209 | <p>I'm writing a Java Swing application using the Metal look-and-feel. Every time there is a JButton in my application the user uses the Tab key to move the focus to the button and then hits the Enter key. Nothing happens! If he hits the Space key the button events are fired. How do I assign the Enter key to trigger th... | [
{
"answer_id": 440273,
"author": "Richard Campbell",
"author_id": 12254,
"author_profile": "https://Stackoverflow.com/users/12254",
"pm_score": 0,
"selected": false,
"text": "<p>You do it by assigning an input / action map for the Enter key. Something like the following:</p>\n\n<pre><co... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3379/"
] | I'm writing a Java Swing application using the Metal look-and-feel. Every time there is a JButton in my application the user uses the Tab key to move the focus to the button and then hits the Enter key. Nothing happens! If he hits the Space key the button events are fired. How do I assign the Enter key to trigger the s... | I found the following:
<http://tips4java.wordpress.com/2008/10/25/enter-key-and-button/>
Where Rob Camick writes that when using JDK5 and later you simply add...
```
UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE);
```
...to the application to solve the problem. This did the trick for me! And I can... |
440,258 | <p>I've run into the following case a few times and I was wondering if there is a fast way to handle it in Vim.</p>
<p>I'll have a source file like the following:</p>
<pre><code>#ifndef _FOO_H_
#define _FOO_H_
class Foo {
Foo(int foo);
};
#endif
</code></pre>
<p>And I would like to convert it to the following:<... | [
{
"answer_id": 440279,
"author": "dF.",
"author_id": 3002,
"author_profile": "https://Stackoverflow.com/users/3002",
"pm_score": 4,
"selected": true,
"text": "<p><a href=\"http://www.vim.org/scripts/script.php?script_id=6\" rel=\"noreferrer\">This script</a> will do a case-preserving sea... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've run into the following case a few times and I was wondering if there is a fast way to handle it in Vim.
I'll have a source file like the following:
```
#ifndef _FOO_H_
#define _FOO_H_
class Foo {
Foo(int foo);
};
#endif
```
And I would like to convert it to the following:
```
#ifndef _BAR_H_
#define _BAR... | [This script](http://www.vim.org/scripts/script.php?script_id=6) will do a case-preserving search/replace.
Copy the script to the plugin directory (`~/.vim/plugin`), then do
```
:set ic
:%s/foo/\=KeepCaseSameLen(submatch(0), 'bar')/g
``` |
440,262 | <p>How come, in Java, I can write</p>
<pre><code>List<?> list = new LinkedList<Double>();
</code></pre>
<p>but not</p>
<pre><code>List<Container<?>> list = new LinkedList<Container<Double>>();
</code></pre>
<p>where Container is just something like</p>
<pre><code>public class Co... | [
{
"answer_id": 440309,
"author": "kdgregory",
"author_id": 42126,
"author_profile": "https://Stackoverflow.com/users/42126",
"pm_score": 5,
"selected": true,
"text": "<p>Each parameterization must be wildcarded:</p>\n\n<pre><code>List<? extends Container<?>> list = new Linked... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53905/"
] | How come, in Java, I can write
```
List<?> list = new LinkedList<Double>();
```
but not
```
List<Container<?>> list = new LinkedList<Container<Double>>();
```
where Container is just something like
```
public class Container<T> { ... }
```
This came up because I have a method that accepts a `List<Container<?>>... | Each parameterization must be wildcarded:
```
List<? extends Container<?>> list = new LinkedList<Container<Double>>();
```
Edit: I was searching through [Angelika Langer's FAQ](http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html) for an explanation, but didn't find one (it's probably there, but hiding som... |
440,277 | <p>Our <strong>WinForms</strong> application does lazy loading of the data for auto complete of a textbox. The pseudocode for this is as follows;</p>
<ol>
<li>User types in TextBox</li>
<li>On typing pause, determine if we need to fetch the auto complete data</li>
<li>In worker thread, contact the server and fetch da... | [
{
"answer_id": 440807,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 2,
"selected": false,
"text": "<p>Typically, you would use COM interop and access the <a href=\"http://msdn.microsoft.com/en-us/library/windows/desktop... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30827/"
] | Our **WinForms** application does lazy loading of the data for auto complete of a textbox. The pseudocode for this is as follows;
1. User types in TextBox
2. On typing pause, determine if we need to fetch the auto complete data
3. In worker thread, contact the server and fetch data
4. Invoke back to the UI thread
5. S... | I have written an async autocomplete class for a TextBox using only managed code. Hope it helps.
```
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace TextboxAutocomplete
{
public abstract class AutoCompleteSource
{
pr... |
440,290 | <p>I often find myself writing a property that is evaluated lazily. Something like:</p>
<pre><code>if (backingField == null)
backingField = SomeOperation();
return backingField;
</code></pre>
<p>It is not much code, but it does get repeated a lot if you have a lot of properties.</p>
<p>I am thinking about definin... | [
{
"answer_id": 440307,
"author": "Ryan Guill",
"author_id": 7186,
"author_profile": "https://Stackoverflow.com/users/7186",
"pm_score": 1,
"selected": false,
"text": "<p>I like the idea in that it is much less code and more elegant, but I would be very worried about the fact that it beco... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13627/"
] | I often find myself writing a property that is evaluated lazily. Something like:
```
if (backingField == null)
backingField = SomeOperation();
return backingField;
```
It is not much code, but it does get repeated a lot if you have a lot of properties.
I am thinking about defining a class called LazyProperty:
`... | Just to be overly pedantic:
Your proposed solution to avoid repeating code:
```
private LazyProperty<HeavyObject> first =
new LazyProperty<HeavyObject>(() => new HeavyObject { MyProperty = Value });
public HeavyObject First {
get {
return first;
}
}
```
Is actually more characters than the code that... |
440,295 | <p>In Windows Mobile I am using FindFirstFile/FindNextFile to search for some files. As part of the results I am getting a WIN32_FIND_DATA structure which contains one search result. This structure contains 3 FILETIME structures for file creation, last write and last access times. </p>
<p>Then I am converting these st... | [
{
"answer_id": 440307,
"author": "Ryan Guill",
"author_id": 7186,
"author_profile": "https://Stackoverflow.com/users/7186",
"pm_score": 1,
"selected": false,
"text": "<p>I like the idea in that it is much less code and more elegant, but I would be very worried about the fact that it beco... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33885/"
] | In Windows Mobile I am using FindFirstFile/FindNextFile to search for some files. As part of the results I am getting a WIN32\_FIND\_DATA structure which contains one search result. This structure contains 3 FILETIME structures for file creation, last write and last access times.
Then I am converting these structures... | Just to be overly pedantic:
Your proposed solution to avoid repeating code:
```
private LazyProperty<HeavyObject> first =
new LazyProperty<HeavyObject>(() => new HeavyObject { MyProperty = Value });
public HeavyObject First {
get {
return first;
}
}
```
Is actually more characters than the code that... |
440,308 | <p>This is more of a syntax question
I'm trying to write a store procedure or function that I can embed into a query such as:</p>
<pre><code>select * from MyBigProcOrFunction
</code></pre>
<p>I'm trying to define a tabular function but I do not understand how to do it as I build tmp tables to work out the data before... | [
{
"answer_id": 440315,
"author": "ConcernedOfTunbridgeWells",
"author_id": 15401,
"author_profile": "https://Stackoverflow.com/users/15401",
"pm_score": 3,
"selected": false,
"text": "<p>You need a special type of function known as a <a href=\"http://msdn.microsoft.com/en-us/library/ms19... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52843/"
] | This is more of a syntax question
I'm trying to write a store procedure or function that I can embed into a query such as:
```
select * from MyBigProcOrFunction
```
I'm trying to define a tabular function but I do not understand how to do it as I build tmp tables to work out the data before I finally have the return... | You can't access Temporary Tables from within a SQL Function. You will need to use table variables so essentially:
```
ALTER FUNCTION FnGetCompanyIdWithCategories()
RETURNS @rtnTable TABLE
(
-- columns returned by the function
ID UNIQUEIDENTIFIER NOT NULL,
Name nvarchar(255) NOT NULL
)
AS
BEGIN
DECLARE @... |
440,320 | <p>Is there any reason to prefer <code>unicode(somestring, 'utf8')</code> as opposed to <code>somestring.decode('utf8')</code>?</p>
<p>My only thought is that <code>.decode()</code> is a bound method so python may be able to resolve it more efficiently, but correct me if I'm wrong.</p>
| [
{
"answer_id": 440315,
"author": "ConcernedOfTunbridgeWells",
"author_id": 15401,
"author_profile": "https://Stackoverflow.com/users/15401",
"pm_score": 3,
"selected": false,
"text": "<p>You need a special type of function known as a <a href=\"http://msdn.microsoft.com/en-us/library/ms19... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41613/"
] | Is there any reason to prefer `unicode(somestring, 'utf8')` as opposed to `somestring.decode('utf8')`?
My only thought is that `.decode()` is a bound method so python may be able to resolve it more efficiently, but correct me if I'm wrong. | You can't access Temporary Tables from within a SQL Function. You will need to use table variables so essentially:
```
ALTER FUNCTION FnGetCompanyIdWithCategories()
RETURNS @rtnTable TABLE
(
-- columns returned by the function
ID UNIQUEIDENTIFIER NOT NULL,
Name nvarchar(255) NOT NULL
)
AS
BEGIN
DECLARE @... |
440,324 | <p>Newbie to LINQ, and trying to write the following query...</p>
<pre><code>select
f.Section_ID,
f.Page_ID,
f.SortOrder,
f.Type
from
(
select
Section_ID,
min(SortOrder) as minSortOrder
from
ContentPages
group by
Section_ID
) as x
inner join
ContentPages as f on
f.Secti... | [
{
"answer_id": 440574,
"author": "Ecton",
"author_id": 457,
"author_profile": "https://Stackoverflow.com/users/457",
"pm_score": 4,
"selected": true,
"text": "<p>Here's my first attempt at it:</p>\n\n<pre><code>from sectionPage in pages\ngroup sectionPage by sectionPage.Section_ID into s... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54720/"
] | Newbie to LINQ, and trying to write the following query...
```
select
f.Section_ID,
f.Page_ID,
f.SortOrder,
f.Type
from
(
select
Section_ID,
min(SortOrder) as minSortOrder
from
ContentPages
group by
Section_ID
) as x
inner join
ContentPages as f on
f.Section_ID = x.Sect... | Here's my first attempt at it:
```
from sectionPage in pages
group sectionPage by sectionPage.Section_ID into sectionGroup
join page in pages on sectionGroup.Key equals page.Section_ID
where page.SortOrder == sectionGroup.Min(p => p.SortOrder)
orderby page.SortOrder
select page;
```
What happens is first we create a... |
440,331 | <p>Why does the following code in C work?</p>
<pre><code>const char* str = NULL;
str = "test";
str = "test2";
</code></pre>
<p>Since str is a pointer to a constant character, why are we allowed to assign it different string literals? Further, how can we protect str from being modified? It seems like this could be a... | [
{
"answer_id": 440343,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>Memory for the string literals are allocated on the stack, and all your assignments do are change the <code>str</co... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54723/"
] | Why does the following code in C work?
```
const char* str = NULL;
str = "test";
str = "test2";
```
Since str is a pointer to a constant character, why are we allowed to assign it different string literals? Further, how can we protect str from being modified? It seems like this could be a problem if, for example, we... | You are changing the pointer, which is not const (the thing it's pointing to is const).
If you want the pointer itself to be const, the declaration would look like:
```
char * const str = "something";
```
or
```
char const * const str = "something"; // a const pointer to const char
const char * const str = "somet... |
440,427 | <p>I'm trying to write a script that informs the user when someone has logged in on the machine via ssh.</p>
<p>My current idea is to parse the output of "w" using grep in intervals. </p>
<p>But that's neither elegant nor performant. Has anyone got a better idea how to implement such a program?</p>
<p>Any help would... | [
{
"answer_id": 440459,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 2,
"selected": false,
"text": "<p>Set up a named pipe, and set up a log file parser to listen to it, and send the ssh messages to it. The log file pa... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43960/"
] | I'm trying to write a script that informs the user when someone has logged in on the machine via ssh.
My current idea is to parse the output of "w" using grep in intervals.
But that's neither elegant nor performant. Has anyone got a better idea how to implement such a program?
Any help would really be appreciated! | On Ubuntu (and I'd guess all other Debian distros, if not all Linuces), the file /var/log/auth.log records successful (and unsuccessful) login attempts:
```
sshd[XXX]: pam_unix(sshd:session): session opened for user XXX
```
You could set up a very simple monitor using this command (note that you have to be root to s... |
440,430 | <p>I have an array of filenames and need to sort that array by the extensions of the filename. Is there an easy way to do this?</p>
| [
{
"answer_id": 440447,
"author": "Matthew Brubaker",
"author_id": 21311,
"author_profile": "https://Stackoverflow.com/users/21311",
"pm_score": 2,
"selected": false,
"text": "<p>If I remember correctly, the Arrays.sort(...) takes a Comparator<> that it will use to do the sorting. You... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/673/"
] | I have an array of filenames and need to sort that array by the extensions of the filename. Is there an easy way to do this? | ```
Arrays.sort(filenames, new Comparator<String>() {
@Override
public int compare(String s1, String s2) {
// the +1 is to avoid including the '.' in the extension and to avoid exceptions
// EDIT:
// We first need to make sure that either both files or neither file
// has an exte... |
440,450 | <p>I have a silverlight page with a textblock and button on it. Like this:</p>
<pre><code><TextBlock x:Name="txbNote" Margin="50,50" Text="Hello"/>
<Button x:Name="btnCheck" Height="40" Click="btnCheck_Click" ClickMode="Press" Margin="50,50,50,50" Content="Check Service"/>
</code></pre>
<p>Here i... | [
{
"answer_id": 440845,
"author": "Soviut",
"author_id": 46914,
"author_profile": "https://Stackoverflow.com/users/46914",
"pm_score": 1,
"selected": false,
"text": "<p>You may need to post more code as this could be an issue with the surrounding tags, such as the container that these con... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a silverlight page with a textblock and button on it. Like this:
```
<TextBlock x:Name="txbNote" Margin="50,50" Text="Hello"/>
<Button x:Name="btnCheck" Height="40" Click="btnCheck_Click" ClickMode="Press" Margin="50,50,50,50" Content="Check Service"/>
```
Here is the handler for the click event:
``... | You may need to post more code as this could be an issue with the surrounding tags, such as the container that these controls are in.
If you're unable to paste it all to StackOverflow, use [www.dpaste.com](http://www.dpaste.com) or [www.pastebin.com](http://www.pastebin.com). |
440,457 | <p>I'm having a problem sending XML through Microsoft.XMLHTTP object in ASP (not .NET). I have CDATA elements inside some of the XML nodes and i get this error while trying to send.</p>
<p>msxml3.dll error '80070005'
Access is denied. </p>
<p>First of all, this only comes up with CDATA. If i remove it, all sends allr... | [
{
"answer_id": 440540,
"author": "Kev",
"author_id": 419,
"author_profile": "https://Stackoverflow.com/users/419",
"pm_score": 1,
"selected": false,
"text": "<p>First of all you shouldn't be using the Microsoft.XMLHTTP in ASP. It's not thread safe and <em>will</em> cause your app to fail... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm having a problem sending XML through Microsoft.XMLHTTP object in ASP (not .NET). I have CDATA elements inside some of the XML nodes and i get this error while trying to send.
msxml3.dll error '80070005'
Access is denied.
First of all, this only comes up with CDATA. If i remove it, all sends allright. I did a lit... | First of all you shouldn't be using the Microsoft.XMLHTTP in ASP. It's not thread safe and *will* cause your app to fail mysteriously and other customer sites if you're on a shared platform.
You should be using MSXML2.ServerXMLHTTP instead.
You should also set the content type header:
```
Set xmlhttp = Server.Create... |
440,474 | <p>I have multiple tables with an "id" component. I'd like to use LINQ to get an item from one of these tables with the correct LINQ-To-SQL type, but only using one CompiledQuery.</p>
<p>Here's an example that works currently. Say the object type defined in the DBML is "myitem" and its table is "myitems".</p>
<pre><... | [
{
"answer_id": 440608,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": true,
"text": "<p>I'm pretty sure you can't make the one compiled-query span multiple tables (if that is what you mean); how would it... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51184/"
] | I have multiple tables with an "id" component. I'd like to use LINQ to get an item from one of these tables with the correct LINQ-To-SQL type, but only using one CompiledQuery.
Here's an example that works currently. Say the object type defined in the DBML is "myitem" and its table is "myitems".
```
var getOneIte... | I'm pretty sure you can't make the one compiled-query span multiple tables (if that is what you mean); how would it know where to look? EF supports something like this with inheritance (and multiple tables), but even with inheritance LINQ-to-SQL only supports **single-table** discriminated inheritance.
The heart of th... |
440,479 | <p>The basic idea of a masterpage is simple -- you have a block of content that you want to 'inject' into a location in a master page.</p>
<p>Its very easy to figure this out without even reading the documentation about masterpages (which I admit to not having read!). </p>
<p>What i want to do is pass 'properties' to... | [
{
"answer_id": 440495,
"author": "Rune Grimstad",
"author_id": 30366,
"author_profile": "https://Stackoverflow.com/users/30366",
"pm_score": 1,
"selected": false,
"text": "<p>Yes, but the other way round. </p>\n\n<p>If you set the MasterPageType property of your content page you can acce... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] | The basic idea of a masterpage is simple -- you have a block of content that you want to 'inject' into a location in a master page.
Its very easy to figure this out without even reading the documentation about masterpages (which I admit to not having read!).
What i want to do is pass 'properties' to a master page fr... | In your master page create some type of hook (a property or method) that allows some piece of code to manipulate the master page in whatever way you want. Then on the individual pages do something like this:
```
YourMasterPageType masterPage = (YourMasterPageType)Page.Master;
masterPage.YourHook();
```
Whatever you ... |
440,490 | <p>How do I build Borland C++ project files (bpr) and package files (bpk) from the command line? Project groups (bpg) are apparently make files and can be compile with make. But bpks and bprs are xml based and the Export to Makefile won't compile with make.
If I put a project in a bpg, make can't seem to find any of ... | [
{
"answer_id": 440649,
"author": "Roger Nelson",
"author_id": 14964,
"author_profile": "https://Stackoverflow.com/users/14964",
"pm_score": 0,
"selected": false,
"text": "<p>Perhaps you could give some more information on 'won't compile'. \nI.e. What error messages are you getting.</p>\n... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do I build Borland C++ project files (bpr) and package files (bpk) from the command line? Project groups (bpg) are apparently make files and can be compile with make. But bpks and bprs are xml based and the Export to Makefile won't compile with make.
If I put a project in a bpg, make can't seem to find any of the f... | You don't need to directly compile a bpr. Just create a bpk which just includes that single bpr, and you can use make to compile it.
```
"c:\program files\borland\cbuilder5\bin\make" -B -s -fabc.bpg
```
If you also have other borland compilers installed, do not call the make.exe from the other compiler.
EDIT: exec... |
440,494 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/168214/pass-a-php-string-to-a-javascript-variable-and-escape-newlines">Pass a PHP string to a Javascript variable (and escape newlines)</a> </p>
</blockquote>
<p>I have several constants in a PHP application I'... | [
{
"answer_id": 440514,
"author": "Adam Peck",
"author_id": 26658,
"author_profile": "https://Stackoverflow.com/users/26658",
"pm_score": 4,
"selected": true,
"text": "<p>I would use <code>json_encode</code>. You will have to convert the class to an associative array first.</p>\n\n<pre><... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43816/"
] | >
> **Possible Duplicate:**
>
> [Pass a PHP string to a Javascript variable (and escape newlines)](https://stackoverflow.com/questions/168214/pass-a-php-string-to-a-javascript-variable-and-escape-newlines)
>
>
>
I have several constants in a PHP application I'm developing. I've defined a Constants class and th... | I would use `json_encode`. You will have to convert the class to an associative array first.
```
$constants = array("RESOURCE_TYPE_REGISTER"=>2, "RESOURCE_TYPE_INFO"=>2);
echo json_encode($constants);
```
You could also use reflection to convert the class to an associative array if you would prefer to use a class.
... |
440,524 | <p>Not really a programming question, but relevant to many programmers...</p>
<p>Let's say I have opened an SSH session to another computer.</p>
<blockquote>
<p>remote:html avalys$ ls <br>
welcome.msg index.html readme.txt <br>
remote:html avalys$</p>
</blockquote>
<p>Is there any command that I can type in my... | [
{
"answer_id": 440533,
"author": "Bill",
"author_id": 53064,
"author_profile": "https://Stackoverflow.com/users/53064",
"pm_score": 0,
"selected": false,
"text": "<p>At school if I am transferring a file from one linux system to another, I usually remote using ssh and then use scp to tra... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53905/"
] | Not really a programming question, but relevant to many programmers...
Let's say I have opened an SSH session to another computer.
>
> remote:html avalys$ ls
>
> welcome.msg index.html readme.txt
>
> remote:html avalys$
>
>
>
Is there any command that I can type in my remote shell that will immediately... | You could set up such an inverted transfer connection w/
```
ssh -Rport:127.0.0.1:22 user@host
```
for `scp` back.
Use `scp user@host:port` to access it. |
440,541 | <p>Part of a programme builds this list,</p>
<pre><code>[u'1 x Affinity for war', u'1 x Intellect', u'2 x Charisma', u'2 x Perception', u'3 x Population growth', u'4 x Affinity for the land', u'5 x Morale']
</code></pre>
<p>I'm currently trying to sort it alphabetically by the name of the evolution rather than by the... | [
{
"answer_id": 440559,
"author": "Teifion",
"author_id": 1384652,
"author_profile": "https://Stackoverflow.com/users/1384652",
"pm_score": -1,
"selected": false,
"text": "<p>As you are trying to sort what is essentially custom data, I'd go with a custom sort.</p>\n\n<p><a href=\"http://e... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33061/"
] | Part of a programme builds this list,
```
[u'1 x Affinity for war', u'1 x Intellect', u'2 x Charisma', u'2 x Perception', u'3 x Population growth', u'4 x Affinity for the land', u'5 x Morale']
```
I'm currently trying to sort it alphabetically by the name of the evolution rather than by the number. Is there any way ... | You have to get the "key" from the string.
```
def myKeyFunc( aString ):
stuff, x, label = aString.partition(' x ')
return label
aList.sort( key= myKeyFunc )
``` |
440,547 | <h3>The Question</h3>
<p>What is the correct way to install Python 3.0 alongside Python 2.x using Cygwin?</p>
<h3>Notes</h3>
<p>I already have a working copy of Cygwin, and Python 2.x is installed within Cygwin (<code>/lib/python2.x</code>, not <code>c:\python2.x</code>).</p>
<p>Also, I would like to be able to call py... | [
{
"answer_id": 440970,
"author": "Martin v. Löwis",
"author_id": 33006,
"author_profile": "https://Stackoverflow.com/users/33006",
"pm_score": 4,
"selected": true,
"text": "<p>The standard <code>make install</code> target of the Python 3.0 sources doesn't install a python binary. Instead... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/208/"
] | ### The Question
What is the correct way to install Python 3.0 alongside Python 2.x using Cygwin?
### Notes
I already have a working copy of Cygwin, and Python 2.x is installed within Cygwin (`/lib/python2.x`, not `c:\python2.x`).
Also, I would like to be able to call python 3 separately (and only intentionally) by... | The standard `make install` target of the Python 3.0 sources doesn't install a python binary. Instead, make install prints at the end
```
* Note: not installed as 'python'.
* Use 'make fullinstall' to install as 'python'.
* However, 'make fullinstall' is discouraged,
* as it will clobber your Python 2.x installation.
... |
440,571 | <p>I'm trying to build some unit tests for testing my Rails helpers, but I can never remember how to access them. Annoying. Suggestions?</p>
| [
{
"answer_id": 440573,
"author": "aronchick",
"author_id": 4322,
"author_profile": "https://Stackoverflow.com/users/4322",
"pm_score": 4,
"selected": false,
"text": "<p>Stolen from here: <a href=\"http://joakimandersson.se/archives/2006/10/05/test-your-rails-helpers/\" rel=\"noreferrer\"... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4322/"
] | I'm trying to build some unit tests for testing my Rails helpers, but I can never remember how to access them. Annoying. Suggestions? | In rails 3 you can do this (and in fact it's what the generator creates):
```
require 'test_helper'
class YourHelperTest < ActionView::TestCase
test "should work" do
assert_equal "result", your_helper_method
end
end
```
And of course [the rspec variant by Matt Darby](https://stackoverflow.com/a/441298/11525... |
440,585 | <p>I was trying to build <a href="http://en.wikipedia.org/wiki/Boost_C%2B%2B_Libraries" rel="noreferrer">Boost C++ Libraries</a> for last two hours and stopped without any result. Since I am new to C++, I am unable to get the build right. How can I build it correctly using Visual Studio 2008?</p>
<p>I need to use the ... | [
{
"answer_id": 440653,
"author": "vividos",
"author_id": 23740,
"author_profile": "https://Stackoverflow.com/users/23740",
"pm_score": 6,
"selected": true,
"text": "<p>First, you need to have the proper PATH, INCLUDE and LIB environment variables in your command shell. For this, call the... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50419/"
] | I was trying to build [Boost C++ Libraries](http://en.wikipedia.org/wiki/Boost_C%2B%2B_Libraries) for last two hours and stopped without any result. Since I am new to C++, I am unable to get the build right. How can I build it correctly using Visual Studio 2008?
I need to use the BCP tool to extract a subset of librar... | First, you need to have the proper PATH, INCLUDE and LIB environment variables in your command shell. For this, call the file "`vcvarsall.bat`" (or similar) with parameter:
```
vcvarsall.bat x86
```
Next you have to build bjam (you can also download it from the Boost page, but it's almost as quick). Go to the `tools... |
440,588 | <p>All articles I've read about localization of a WinForms application assume that I already have all the strings translated. According to the articles, I should just set the Localizable property to true and edit all the controls.</p>
<p>But how do I get all the original (English) strings from the form? Assume I have ... | [
{
"answer_id": 440635,
"author": "Rob Prouse",
"author_id": 30827,
"author_profile": "https://Stackoverflow.com/users/30827",
"pm_score": 2,
"selected": true,
"text": "<p>I you are doing localization the same way as I am, you just go into the Properties directory of your project and open... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20353/"
] | All articles I've read about localization of a WinForms application assume that I already have all the strings translated. According to the articles, I should just set the Localizable property to true and edit all the controls.
But how do I get all the original (English) strings from the form? Assume I have a complete... | I you are doing localization the same way as I am, you just go into the Properties directory of your project and open the **Resources.resx** file in a text editor. In that, the strings are in XML nodes that look like this;
```
<data name="ErrorLaunching" xml:space="preserve">
<value>Error launching Ivara</value>
<... |
440,613 | <p>I've got a new instance of an object in a Linq DBML, but don't know of the test if the a date field is empty.</p>
<p>I have tried:</p>
<pre><code>If d Is Nothing OrElse IsDBNull(d) OrElse d <= Date.MinValue Then
TextValue = "nada"
Else
TextValue = FormatDateTime(d)
End If
</code></pre>
<p>But the result ... | [
{
"answer_id": 440819,
"author": "Christopher Edwards",
"author_id": 29411,
"author_profile": "https://Stackoverflow.com/users/29411",
"pm_score": 3,
"selected": true,
"text": "<p>The code you want is (hopefully)..</p>\n\n<pre><code>If MyNullableDateObject.HasValue Then\n TextValue = F... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2385/"
] | I've got a new instance of an object in a Linq DBML, but don't know of the test if the a date field is empty.
I have tried:
```
If d Is Nothing OrElse IsDBNull(d) OrElse d <= Date.MinValue Then
TextValue = "nada"
Else
TextValue = FormatDateTime(d)
End If
```
But the result is "12:00:00 am"
edit: Changed vari... | The code you want is (hopefully)..
```
If MyNullableDateObject.HasValue Then
TextValue = FormatDateTime(MyNullableDateObject.Value)
Else
TextValue = "nada"
End If
```
If the SQL field accepts Nulls then the Linq to SQL designer maps it to a .net Nullable type, for instance SQL DateTime will be mapped to the ty... |
440,615 | <p>If I have a list of items, say</p>
<pre><code>apples
pairs
pomegranites
</code></pre>
<p>and I want to identify any that don't exist in the 'fruit' column in an SQL DB table.</p>
<ul>
<li>Fast performance is the main concern.</li>
<li>Needs to be portable over different SQL implementations.</li>
<li>The input lis... | [
{
"answer_id": 440637,
"author": "scottm",
"author_id": 53007,
"author_profile": "https://Stackoverflow.com/users/53007",
"pm_score": 2,
"selected": false,
"text": "<pre><code>if exists(select top 1 name from fruit where name in ('apples', 'pairs', 'pomegranates'))\n PRINT 'one exists'\... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440615",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2362/"
] | If I have a list of items, say
```
apples
pairs
pomegranites
```
and I want to identify any that don't exist in the 'fruit' column in an SQL DB table.
* Fast performance is the main concern.
* Needs to be portable over different SQL implementations.
* The input list could contain an arbitrary number of entries.
I ... | Since the list of fruits you are selecting from can be arbitrarily long, I would suggest the following:
```
create table FruitList (FruitName char(30))
insert into FruitList values ('apples'), ('pears'), ('oranges')
select * from FruitList left outer join AllFruits on AllFruits.fruit = FruitList.FruitName
where AllFr... |
440,645 | <p>So I have 1000 lines of javascript. I need to turn it into a Java String so that I can output (via <code>System.out.println</code> or whatever). </p>
<p>I'm looking for an <strong><em>online tool to escape all the quotes</em></strong>... something geared toward my specific need would be nice as I don't want o... | [
{
"answer_id": 440659,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 1,
"selected": false,
"text": "<p>You can compress the file using one of the available tools to achieve this effect:</p>\n\n<p><a href... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | So I have 1000 lines of javascript. I need to turn it into a Java String so that I can output (via `System.out.println` or whatever).
I'm looking for an ***online tool to escape all the quotes***... something geared toward my specific need would be nice as I don't want other special characters changed. Lines like:
`... | Here's a link which features [Crockford's implementation of the `quote()` function](http://javascript.crockford.com/remedial.html). Use it to build your own JavaScript converter.
**Edit:** I also [slightly modified the function](http://mercurial.intuxication.org/hg/js-hacks/raw-file/a243b3e46ddb/quote.js) to output an... |
440,651 | <p>I'm trying to set the DisplayMember Property of my ListBox in a windows forms project to a property of a nested class inside a Generic List I am binding to.</p>
<p>Here's a simple example:</p>
<pre><code> public class Security
{
public int SecurityId { get; set;}
public SecurityInfo Info { get; set;}
}
pub... | [
{
"answer_id": 440660,
"author": "gcores",
"author_id": 40256,
"author_profile": "https://Stackoverflow.com/users/40256",
"pm_score": 0,
"selected": false,
"text": "<p>Just override SecurityInfo ToString method to return Description and do:</p>\n\n<pre><code>lstSecurities.DisplayMember =... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8534/"
] | I'm trying to set the DisplayMember Property of my ListBox in a windows forms project to a property of a nested class inside a Generic List I am binding to.
Here's a simple example:
```
public class Security
{
public int SecurityId { get; set;}
public SecurityInfo Info { get; set;}
}
public class SecurityInf... | No, most winforms bindings do not support child properties like this.
You can do it directly with custom type-descriptors, but that is a *lot* of work and not worth it.
Check the generated code; it should (with any recent version of the tools) be a `partial class`; that means you can add extra members in a **second**... |
440,675 | <p>I keep getting this error ever so often when I launch the debugger to debug my site. I'm using the Telerik controls, and usually the error is in my tab strip. Here is an example of the error I'm looking at right now:</p>
<pre><code>Compiler Error Message: CS0433: The type 'ASP.controls_motorvehiclegeneral_ascx' e... | [
{
"answer_id": 442982,
"author": "domusvita",
"author_id": 1557682,
"author_profile": "https://Stackoverflow.com/users/1557682",
"pm_score": 1,
"selected": false,
"text": "<p>For me, closing the IDE, shutting the web site (IIS or Cassini), deleting all of my temporary asp.net files, laun... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18518/"
] | I keep getting this error ever so often when I launch the debugger to debug my site. I'm using the Telerik controls, and usually the error is in my tab strip. Here is an example of the error I'm looking at right now:
```
Compiler Error Message: CS0433: The type 'ASP.controls_motorvehiclegeneral_ascx' exists in both 'c... | killing Cassini instances as above didn't work for me.
[ScottGu posted about this issue](http://weblogs.asp.net/scottgu/public-hotfix-patch-available-for-asp-net-compilation-issues)
setting the batch="false" attribute on the compilation section in web.config worked for me.
```
<configuration>
<system.web>
... |
440,676 | <p>I've got a piece of code which contains a for loop to draw things from an XML file;</p>
<pre><code> for evoNode in node.getElementsByTagName('evolution'):
evoName = getText(evoNode.getElementsByTagName( "type")[0].childNodes)
evoId = getText(evoNode.getElementsByTagName( "typeid")[... | [
{
"answer_id": 440687,
"author": "Teifion",
"author_id": 1384652,
"author_profile": "https://Stackoverflow.com/users/1384652",
"pm_score": 3,
"selected": true,
"text": "<pre><code>for evoNode in node.getElementsByTagName('evolution'):\n evoName = getText(evoNode.getElementsByTagNam... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33061/"
] | I've got a piece of code which contains a for loop to draw things from an XML file;
```
for evoNode in node.getElementsByTagName('evolution'):
evoName = getText(evoNode.getElementsByTagName( "type")[0].childNodes)
evoId = getText(evoNode.getElementsByTagName( "typeid")[0].childNodes)... | ```
for evoNode in node.getElementsByTagName('evolution'):
evoName = getText(evoNode.getElementsByTagName("type")[0].childNodes)
evoId = getText(evoNode.getElementsByTagName("typeid")[0].childNodes)
evoLevel = getText(evoNode.getElementsByTagName("level")[0].childNodes)
evoCost = getText(evoNod... |
440,685 | <p>I need to find a way to hide HTML Rows (or Tables) from view without blocking them from being rendered. Setting this.myTable.Visible = false would seem to be the easiest way to hide tables from the user, but it prevents the HTML Table from being sent to the browser and that causes a problem because I am using Valida... | [
{
"answer_id": 440697,
"author": "M4N",
"author_id": 19635,
"author_profile": "https://Stackoverflow.com/users/19635",
"pm_score": 3,
"selected": true,
"text": "<p>To hide a complete table (but still render it to the client), wrap it in a div with style=\"display:none\":</p>\n\n<pre><cod... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52587/"
] | I need to find a way to hide HTML Rows (or Tables) from view without blocking them from being rendered. Setting this.myTable.Visible = false would seem to be the easiest way to hide tables from the user, but it prevents the HTML Table from being sent to the browser and that causes a problem because I am using Validator... | To hide a complete table (but still render it to the client), wrap it in a div with style="display:none":
```
<div style="display:none;">
asp.net table goes here
</div>
```
Although, for single rows, this does not work. You will probably have to use some javascript (e.g. jquery, as another user recommended). |
440,694 | <p>If my understanding is correct, they do exactly the same thing. Why would anyone use for the "for" variant? Is it just taste?</p>
<p><strong>Edit:</strong> I suppose I was also thinking of for (;;).</p>
| [
{
"answer_id": 440700,
"author": "Oren Shemesh",
"author_id": 27333,
"author_profile": "https://Stackoverflow.com/users/27333",
"pm_score": 3,
"selected": false,
"text": "<p>Yes, it is just taste.</p>\n"
},
{
"answer_id": 440709,
"author": "mipadi",
"author_id": 28804,
... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43496/"
] | If my understanding is correct, they do exactly the same thing. Why would anyone use for the "for" variant? Is it just taste?
**Edit:** I suppose I was also thinking of for (;;). | ```
for (;;)
```
is often used to prevent a compiler warning:
```
while(1)
```
or
```
while(true)
```
usually throws a compiler warning about a conditional expression being constant (at least at the highest warning level). |
440,702 | <p>Two tables:<BR><br>
<strong><em><code>COURSE_ROSTER</code></em></strong> - contains<br></p>
<ul>
<li><code>COURSE_ID</code> as foreign key to <code>COURSES</code></li>
<li><code>USER_ID</code> as field I need to insert into <code>COURSES</code></li>
</ul>
<p><strong><em><code>COURSES</code></em></strong> - contain... | [
{
"answer_id": 440727,
"author": "TheTXI",
"author_id": 22164,
"author_profile": "https://Stackoverflow.com/users/22164",
"pm_score": 3,
"selected": false,
"text": "<pre><code> Update Courses\n SET Courses.Instructor_ID = Course_Roster.User_ID\n from Courses Inner Join Course_Ro... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42229/"
] | Two tables:
***`COURSE_ROSTER`*** - contains
* `COURSE_ID` as foreign key to `COURSES`
* `USER_ID` as field I need to insert into `COURSES`
***`COURSES`*** - contains
* `COURSE_ID` as primary key
* `INSTRUCTOR_ID` as field that needs to be updated with `USER_ID` field from `COURSE_ROSTER`
What would the `UPD... | Not all database vendors (SQL Server, Oracle, etc.) Implement Update syntax in the same way... You can use a join in SQL Server, but Oracle will not like that. I believe just about all will accept a correclated subquery however
```
Update Courses C
SET Instructor_ID =
(Select User_ID from Course_Rost... |
440,739 | <p>I'm new to both JavaScript and <a href="http://developer.yahoo.com/yui/" rel="noreferrer">YUI</a>. In YUI library examples, you can find many uses of this construct:</p>
<pre><code>(function() {
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event,
layout = null,
...
})();
</code></pre>
<p>I thin... | [
{
"answer_id": 440761,
"author": "Sean Edwards",
"author_id": 53315,
"author_profile": "https://Stackoverflow.com/users/53315",
"pm_score": 2,
"selected": false,
"text": "<p>The first parentheses are for, if you will, order of operations. The 'result' of the set of parentheses surroundin... | 2009/01/13 | [
"https://Stackoverflow.com/questions/440739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54692/"
] | I'm new to both JavaScript and [YUI](http://developer.yahoo.com/yui/). In YUI library examples, you can find many uses of this construct:
```
(function() {
var Dom = YAHOO.util.Dom,
Event = YAHOO.util.Event,
layout = null,
...
})();
```
I think the last couple of parentheses are to execute the fu... | It is a self-executing anonymous function. The first set of parentheses contain the expressions to be executed, and the second set of parentheses executes those expressions.
It is a useful construct when trying to hide variables from the parent namespace. All the code within the function is contained in the private sc... |