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 |
|---|---|---|---|---|---|---|
466,187 | <p>This is the MySQL table structure that I have:</p>
<pre><code>itemID (BIGINT)
userID (BIGINT)
wasAdded (DATETIME)
</code></pre>
<p>I need to get the number of items introduced in the current day, by the <em>X</em> userID</p>
<p>What would be the most efficient way to do this?</p>
<p>Thanks</p>
| [
{
"answer_id": 466205,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 3,
"selected": true,
"text": "<p>The best way would be to add an index that covers <code>userID</code> <em>and</em> <code>wasAdded</code>, then you can do <... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2019426/"
] | This is the MySQL table structure that I have:
```
itemID (BIGINT)
userID (BIGINT)
wasAdded (DATETIME)
```
I need to get the number of items introduced in the current day, by the *X* userID
What would be the most efficient way to do this?
Thanks | The best way would be to add an index that covers `userID` *and* `wasAdded`, then you can do
```
SELECT COUNT(*) FROM my_table WHERE userID = 'X' AND wasAdded BETWEEN CONCAT(CURDATE(), ' ', '00:00:00') AND CONCAT(CURDATE(), ' ', '23:59:59');
```
This shouldn't even need to read from the table, as all the data it ne... |
466,204 | <p>I want to write a function that returns the nearest next power of 2 number. For example if my input is 789, the output should be 1024. Is there any way of achieving this without using any loops but just using some bitwise operators?</p>
| [
{
"answer_id": 466242,
"author": "florin",
"author_id": 18308,
"author_profile": "https://Stackoverflow.com/users/18308",
"pm_score": 9,
"selected": true,
"text": "<p>Check the <a href=\"https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2\" rel=\"noreferrer\">Bit Twiddli... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39742/"
] | I want to write a function that returns the nearest next power of 2 number. For example if my input is 789, the output should be 1024. Is there any way of achieving this without using any loops but just using some bitwise operators? | Check the [Bit Twiddling Hacks](https://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2). You need to get the base 2 logarithm, then add 1 to that. Example for a 32-bit value:
>
> Round up to the next highest power of 2
>
>
>
> ```
> unsigned int v; // compute the next highest power of 2 of 32-bit v
>... |
466,248 | <p>I have a login page that has several textboxes on the page, one of them has the mode set to "password". This page worked previously but we've recently noticed (since an IE7 update) that the textbox that is specified as a password textbox is not as wide as the other textboxes on the page. If I remove the TextMode="Pa... | [
{
"answer_id": 466255,
"author": "TheTXI",
"author_id": 22164,
"author_profile": "https://Stackoverflow.com/users/22164",
"pm_score": 1,
"selected": false,
"text": "<p>It may help if you provide a Width=\"\" property to your textboxes. That should force them to match up in terms of width... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52886/"
] | I have a login page that has several textboxes on the page, one of them has the mode set to "password". This page worked previously but we've recently noticed (since an IE7 update) that the textbox that is specified as a password textbox is not as wide as the other textboxes on the page. If I remove the TextMode="Passw... | The best way to ensure that all of your controls will be of the same size is via style (either inline or in css). |
466,280 | <p>I have a Flash library with Sprite symbols composed of other sprites with design-time applied filters. I'm embedding those symbols into a Flex application like so:</p>
<pre><code><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Bindable]
... | [
{
"answer_id": 466660,
"author": "James Hay",
"author_id": 47339,
"author_profile": "https://Stackoverflow.com/users/47339",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure this is possible using the normal methods of getBounds or getRect as these methods will just return the ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a Flash library with Sprite symbols composed of other sprites with design-time applied filters. I'm embedding those symbols into a Flex application like so:
```
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
[Bindable]
[Embed(source="Resource... | Oh sweet success! (and thanks for the tips) A friend helped solve the problem with a nice recursive function to handle the filters which may exist on nested sprites:
```
private function getDisplayObjectRectangle(container:DisplayObjectContainer, processFilters:Boolean):Rectangle {
var final_rectangle:Rectangle = ... |
466,285 | <p>Is there a version of xlC/VACPP available for AIX 4.3, which does not choke when given following source:</p>
<pre><code>#include <map>
int main(void)
{
return 0;
}
</code></pre>
<p>If yes, is it still available anywhere?</p>
| [
{
"answer_id": 466660,
"author": "James Hay",
"author_id": 47339,
"author_profile": "https://Stackoverflow.com/users/47339",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure this is possible using the normal methods of getBounds or getRect as these methods will just return the ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57601/"
] | Is there a version of xlC/VACPP available for AIX 4.3, which does not choke when given following source:
```
#include <map>
int main(void)
{
return 0;
}
```
If yes, is it still available anywhere? | Oh sweet success! (and thanks for the tips) A friend helped solve the problem with a nice recursive function to handle the filters which may exist on nested sprites:
```
private function getDisplayObjectRectangle(container:DisplayObjectContainer, processFilters:Boolean):Rectangle {
var final_rectangle:Rectangle = ... |
466,286 | <p>So I have this code in a google app engine template:</p>
<pre><code><select name='voter'>
{% for voter in allowed_voters %}
<option {% ifequal voter last_voter %}selected="yes" {% endifequal %}
value='{{voter}}'>{{voter}}</option>
{% endfor %}
</select>
</code></pre>
<p>The pag... | [
{
"answer_id": 467700,
"author": "bskinnersf",
"author_id": 52135,
"author_profile": "https://Stackoverflow.com/users/52135",
"pm_score": 0,
"selected": false,
"text": "<p>try just the token 'selected' rather than selected=\"yes\"</p>\n"
},
{
"answer_id": 467764,
"author": "s... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55565/"
] | So I have this code in a google app engine template:
```
<select name='voter'>
{% for voter in allowed_voters %}
<option {% ifequal voter last_voter %}selected="yes" {% endifequal %}
value='{{voter}}'>{{voter}}</option>
{% endfor %}
</select>
```
The page doesn't render with the correct person selected,... | [`option`'s `select` attribute](http://www.w3.org/TR/html4/interact/forms.html#adef-selected) is a boolean attribute.
Try one of the following:
```
<option {% ifequal voter last_voter %}selected="selected" {% endifequal %}
value='{{voter}}'>{{voter}}</option>
<option {% ifequal voter last_voter %}selected {% endife... |
466,291 | <p>Firefox 3 has introduced a new behavior in which line-height, when unset, differs from how other browsers render it. Thus, a critical section maybe render too high in that browser. Setting a global percentage doesn't work, since it's basis is different. Setting a unitless value such as "1" doesn't work either. Is th... | [
{
"answer_id": 466328,
"author": "cowgod",
"author_id": 6406,
"author_profile": "https://Stackoverflow.com/users/6406",
"pm_score": -1,
"selected": false,
"text": "<p>You should always \"reset\" styles to eliminate all browser inconsistencies with element styles.</p>\n\n<p>I like <a href... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4241/"
] | Firefox 3 has introduced a new behavior in which line-height, when unset, differs from how other browsers render it. Thus, a critical section maybe render too high in that browser. Setting a global percentage doesn't work, since it's basis is different. Setting a unitless value such as "1" doesn't work either. Is there... | The computed value of `line-height: normal` varies between platforms, browsers (and different versions of the same browser, as you state), fonts, and even different sizes of the same font [(see Eric Meyer's article)](http://meyerweb.com/eric/thoughts/2008/05/06/line-height-abnormal/).
Setting a unitless value such as.... |
466,293 | <p>In SCons, my command generators create ridiculously long command lines. I'd
like to be able to split these commands across multiple lines for
readability in the build log.</p>
<p>e.g. I have a SConscipt like:</p>
<pre><code>import os
# create dependency
def my_cmd_generator(source, target, env, for_signature):
... | [
{
"answer_id": 510842,
"author": "David Cournapeau",
"author_id": 11465,
"author_profile": "https://Stackoverflow.com/users/11465",
"pm_score": 1,
"selected": false,
"text": "<p>You are mixing two totally different things: the command to be executed, and its representation in the command... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466293",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20712/"
] | In SCons, my command generators create ridiculously long command lines. I'd
like to be able to split these commands across multiple lines for
readability in the build log.
e.g. I have a SConscipt like:
```
import os
# create dependency
def my_cmd_generator(source, target, env, for_signature):
return r'''echo its... | Thanks to cournape's tip about Actions versus Generators ( and eclipse pydev debugger), I've finally figured out what I need to do. You want to pass in your function to the 'Builder' class as an 'action' not a 'generator'. This will allow you to actually execute the os.system or os.popen call directly. Here's the updat... |
466,317 | <p>I have a sparsely populated matrix that's the result of a series of left joins. I'd like to collapse it down to a single row (see below). The only solution I've seen to this is a GROUP BY on the PK and a MAX() on ColA, ColB etc. Performance is a huge issue here, so I'd like to know if anyone has a better solution. T... | [
{
"answer_id": 466347,
"author": "duffymo",
"author_id": 37213,
"author_profile": "https://Stackoverflow.com/users/37213",
"pm_score": -1,
"selected": false,
"text": "<p>Sparse matricies are common in linear algebra, numerical methods, and modeling of physics problems. If a matrix is di... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30946/"
] | I have a sparsely populated matrix that's the result of a series of left joins. I'd like to collapse it down to a single row (see below). The only solution I've seen to this is a GROUP BY on the PK and a MAX() on ColA, ColB etc. Performance is a huge issue here, so I'd like to know if anyone has a better solution. The ... | I rewrote this as a PIVOT and saw a performance increase of about 30%. It wasn't easy to do, had to read [**this post**](http://www.simple-talk.com/community/blogs/andras/archive/2007/09/14/37265.aspx) very carefully. PIVOTs are weird. |
466,318 | <p>I have this div:</p>
<pre><code><div class="inauguration-image">
I do not want this text to display, just here for description
</div>
</code></pre>
<p>Here is the css for it:</p>
<pre><code>.inauguration-image {
margin-top:5px;
margin-left:auto;
margin-right:auto;
background: url("/i... | [
{
"answer_id": 466326,
"author": "Ben Blank",
"author_id": 46387,
"author_profile": "https://Stackoverflow.com/users/46387",
"pm_score": 5,
"selected": true,
"text": "<pre><code>.inauguration-image {\n margin-top:5px;\n margin-left:auto;\n margin-right:auto;\n background: url... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26130/"
] | I have this div:
```
<div class="inauguration-image">
I do not want this text to display, just here for description
</div>
```
Here is the css for it:
```
.inauguration-image {
margin-top:5px;
margin-left:auto;
margin-right:auto;
background: url("/images/inauguration_block.png") no-repeat;
pos... | ```
.inauguration-image {
margin-top:5px;
margin-left:auto;
margin-right:auto;
background: url("/images/inauguration_block.png") no-repeat;
position:relative;
width:760px;
height:0;
padding-top:552px;
overflow:hidden;
}
```
Setting `height:0` and `overflow:hidden` hides your text; ... |
466,321 | <p>How can I convert from a unix timestamp (say 1232559922) to a fractional julian date (2454853.03150).</p>
<p>I found a website ( <a href="http://aa.usno.navy.mil/data/docs/JulianDate.php" rel="noreferrer">http://aa.usno.navy.mil/data/docs/JulianDate.php</a> ) that performs a similar calculation but I need to do it ... | [
{
"answer_id": 466348,
"author": "Jason Cohen",
"author_id": 4926,
"author_profile": "https://Stackoverflow.com/users/4926",
"pm_score": 6,
"selected": true,
"text": "<p>The Unix epoch (zero-point) is January 1, 1970 GMT. That corresponds to the Julian day of 2440587.5</p>\n\n<p>So, in p... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/280/"
] | How can I convert from a unix timestamp (say 1232559922) to a fractional julian date (2454853.03150).
I found a website ( <http://aa.usno.navy.mil/data/docs/JulianDate.php> ) that performs a similar calculation but I need to do it programatically.
Solutions can be in C/C++, python, perl, bash, etc... | The Unix epoch (zero-point) is January 1, 1970 GMT. That corresponds to the Julian day of 2440587.5
So, in pseudo-code:
```
function float getJulianFromUnix( int unixSecs )
{
return ( unixSecs / 86400.0 ) + 2440587.5;
}
``` |
466,323 | <p>What is the best way to append to a text field using t-sql in Sql Server 2005?</p>
<p>With a varchar I would do this.</p>
<pre><code>update tablename set fieldname = fieldname + 'appended string'
</code></pre>
<p>But this doesn't work with a text field.</p>
| [
{
"answer_id": 466342,
"author": "Joe",
"author_id": 57135,
"author_profile": "https://Stackoverflow.com/users/57135",
"pm_score": 3,
"selected": false,
"text": "<p><a href=\"http://developer.fusium.com/FUblog/index.cfm/2006/7/13/appending-an-ntext-field\" rel=\"nofollow noreferrer\" tit... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3045/"
] | What is the best way to append to a text field using t-sql in Sql Server 2005?
With a varchar I would do this.
```
update tablename set fieldname = fieldname + 'appended string'
```
But this doesn't work with a text field. | Try this:
```
update
tablename
set
fieldname = convert(nvarchar(max),fieldname) + 'appended string'
``` |
466,330 | <p>First some background:
VB.NET 2005 Application that accesses a MS-SQL back-end, using multiple Web Services for data gathering/publishing.</p>
<p>On to the error:
Our application mysteriously crashes on one of our clients computers, it works fine on the other computers in their office, but not on the big whigs' co... | [
{
"answer_id": 466678,
"author": "Ricardo Villamil",
"author_id": 19314,
"author_profile": "https://Stackoverflow.com/users/19314",
"pm_score": 3,
"selected": true,
"text": "<p>Is it possible that this user doesn't have the appropriate .net framework? I'm guessing your application requir... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57592/"
] | First some background:
VB.NET 2005 Application that accesses a MS-SQL back-end, using multiple Web Services for data gathering/publishing.
On to the error:
Our application mysteriously crashes on one of our clients computers, it works fine on the other computers in their office, but not on the big whigs' computer, wh... | Is it possible that this user doesn't have the appropriate .net framework? I'm guessing your application requires 2.0, but maybe he/she has 3.5? Is he running a different version of windows than the other users?
The problem is not happening with your code but the lower level .net BCL. |
466,345 | <p>How do I convert the following string to a <a href="https://docs.python.org/3/library/datetime.html#datetime-objects" rel="noreferrer"><code>datetime</code></a> object?</p>
<pre><code>"Jun 1 2005 1:33PM"
</code></pre>
| [
{
"answer_id": 466366,
"author": "florin",
"author_id": 18308,
"author_profile": "https://Stackoverflow.com/users/18308",
"pm_score": 9,
"selected": false,
"text": "<p>Check out <a href=\"http://docs.python.org/3/library/time.html#time.strptime\" rel=\"noreferrer\">strptime</a> in the <a... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12870/"
] | How do I convert the following string to a [`datetime`](https://docs.python.org/3/library/datetime.html#datetime-objects) object?
```
"Jun 1 2005 1:33PM"
``` | [`datetime.strptime`](https://docs.python.org/3/library/datetime.html#datetime.datetime.strptime) parses an input string in the user-specified format into a *timezone-naive* [`datetime`](https://docs.python.org/3/library/datetime.html#datetime-objects) object:
```
>>> from datetime import datetime
>>> datetime.strptim... |
466,346 | <p>OK, every other browser works fine with the method I have coded so far but for some reason Internet Explorer will not work. I have spent hours of time (more time than actually developing the feature!) on compatibility and am close to giving up!</p>
<p>I have a forum and one of its neat features is the WYSIWYG edito... | [
{
"answer_id": 466396,
"author": "Adriano Varoli Piazza",
"author_id": 22184,
"author_profile": "https://Stackoverflow.com/users/22184",
"pm_score": 1,
"selected": false,
"text": "<p>Have you activated IE's <a href=\"https://msdn.microsoft.com/library/bg182326(v=vs.85)\" rel=\"nofollow n... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | OK, every other browser works fine with the method I have coded so far but for some reason Internet Explorer will not work. I have spent hours of time (more time than actually developing the feature!) on compatibility and am close to giving up!
I have a forum and one of its neat features is the WYSIWYG editor. For tha... | In the end I used frames['frameName'].document.write('someText') but only if the other method fails. |
466,356 | <p>Part of the system I'm working on at the moment involves a log in mysql, with counts being frequently updated.</p>
<p>The data being inserted is of the format:</p>
<pre><code> date | name | count |
-----------+------+-------+
2009-01-12 | alan | 5 |
2009-01-12 | dave | 2 |
2009-01-12 | mary | 1 |
... | [
{
"answer_id": 466369,
"author": "Jason Cohen",
"author_id": 4926,
"author_profile": "https://Stackoverflow.com/users/4926",
"pm_score": 0,
"selected": false,
"text": "<p>Why isn't the <code>INSERT</code> sufficient? Even if most of the time it's a duplicate key and therefore an update ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2287/"
] | Part of the system I'm working on at the moment involves a log in mysql, with counts being frequently updated.
The data being inserted is of the format:
```
date | name | count |
-----------+------+-------+
2009-01-12 | alan | 5 |
2009-01-12 | dave | 2 |
2009-01-12 | mary | 1 |
```
This data is pa... | It's just the same. With "UPDATE ... ON NO KEY INSERT", the database engine will still have to check first if there is something to update. Hence no need for a separate construct even if update is most common |
466,362 | <p>This is the setup for the queue:</p>
<ol>
<li>The queue is public and marked as transactional.</li>
<li>A web service is responsible for inserting messages into the queue.</li>
<li>A Windows service is listening in on the queue</li>
</ol>
<p>Given that, how can I only process messages that are at least 20 minutes ... | [
{
"answer_id": 466609,
"author": "Gavin Miller",
"author_id": 33226,
"author_profile": "https://Stackoverflow.com/users/33226",
"pm_score": 0,
"selected": false,
"text": "<p>The caveat of this is at what point are you defining 20 minutes old?</p>\n\n<p><strong>Case 1:</strong> If defined... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This is the setup for the queue:
1. The queue is public and marked as transactional.
2. A web service is responsible for inserting messages into the queue.
3. A Windows service is listening in on the queue
Given that, how can I only process messages that are at least 20 minutes old? | Given that a queue is first-in, first-out, you have to assume that all messages that are in a queue arrive at a time equal to or later than the time than the first message in the queue.
You can use that to your advantage.
Basically, you would call the Peek method on your MessageQueue instance and look at the ArrivedT... |
466,377 | <p>How can I detect which CPU is being used at runtime ? The c++ code needs to differentiate between AMD / Intel architectures ? Using gcc 4.2. </p>
| [
{
"answer_id": 466389,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 5,
"selected": true,
"text": "<p>If you're on Linux (or on Windows running under Cygwin), you can figure that out by reading the special file <code... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57619/"
] | How can I detect which CPU is being used at runtime ? The c++ code needs to differentiate between AMD / Intel architectures ? Using gcc 4.2. | If you're on Linux (or on Windows running under Cygwin), you can figure that out by reading the special file `/proc/cpuinfo` and looking for the line beginning with `vendor_id`. If the string is `GenuineIntel`, you're running on an Intel chip. If you get `AuthenticAMD`, you're running on an AMD chip.
```
void get_vend... |
466,395 | <p>I'm not good with JavaScript, and this is Google's code. I'm getting a object expected on this, which seems to work fine in other places.</p>
<p>It's the 3rd to the last line (the one with <code>utmSetVar</code>).</p>
<pre><code> <HTML>
<HEAD>
</HEAD>
<BODY >
<script type="text/javascr... | [
{
"answer_id": 466473,
"author": "Eppz",
"author_id": 48478,
"author_profile": "https://Stackoverflow.com/users/48478",
"pm_score": 0,
"selected": false,
"text": "<p>Works fine for me when I remove the offending line of code.</p>\n\n<p>I don't know what <code>__utmSetVar('aff/VG-CEGBWI')... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13704/"
] | I'm not good with JavaScript, and this is Google's code. I'm getting a object expected on this, which seems to work fine in other places.
It's the 3rd to the last line (the one with `utmSetVar`).
```
<HTML>
<HEAD>
</HEAD>
<BODY >
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protoc... | The utmSetVar function is a one that was available in the old Google Analytics codebase using the "urchin" tracker.
<http://www.google-analytics.com/urchin.js>
You can use the following to determine which one you are using
<http://www.google.com/support/googleanalytics/bin/answer.py?answer=75129>
In order to solve ... |
466,406 | <p>Hey all - I have an app where I'm authenticating the user. They pass username and password. I pass the username and password to a class that has a static method. For example it'm calling a method with the signature below: </p>
<pre><code>public class Security
{
public static bool Security.Member_Authenticate (strin... | [
{
"answer_id": 466419,
"author": "SqlRyan",
"author_id": 8114,
"author_profile": "https://Stackoverflow.com/users/8114",
"pm_score": 4,
"selected": true,
"text": "<p>This will not happen. When a method is Static (or Shared in VB.NET), then you're safe as long as the method doesn't rely o... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46064/"
] | Hey all - I have an app where I'm authenticating the user. They pass username and password. I pass the username and password to a class that has a static method. For example it'm calling a method with the signature below:
```
public class Security
{
public static bool Security.Member_Authenticate (string username, st... | This will not happen. When a method is Static (or Shared in VB.NET), then you're safe as long as the method doesn't rely on anything other than the inputs to figure something out. As long as you're not modifying any public variables or objects from anywhere else, you're fine. |
466,449 | <p>i have a problem, i'm working on a gallery php script and need help, i have a picture, it has a lightgray border around, and if theres a mouseover event, i want the border to turn gray. how can i do that?</p>
<p>thanks in advance</p>
| [
{
"answer_id": 466463,
"author": "DavGarcia",
"author_id": 40161,
"author_profile": "https://Stackoverflow.com/users/40161",
"pm_score": 1,
"selected": false,
"text": "<p>You can use the <a href=\"http://www.w3schools.com/css/pr_pseudo_hover.asp\" rel=\"nofollow noreferrer\">:hover</a> p... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | i have a problem, i'm working on a gallery php script and need help, i have a picture, it has a lightgray border around, and if theres a mouseover event, i want the border to turn gray. how can i do that?
thanks in advance | Use the :hover pseudo class. For example:
```
<html>
<head>
<style>
IMG.HoverBorder {border:5px solid #eee;}
IMG.HoverBorder:hover {border:5px solid #555;}
</style>
</head>
<body>
<img class="HoverBorder" src="test.png" />
</body>
</html>
```
The above code works well on all sane browsers... |
466,464 | <p>I'm using the <a href="http://docs.jquery.com/UI/Sortable" rel="nofollow noreferrer">Sortable</a> component of <a href="http://ui.jquery.com/" rel="nofollow noreferrer">jQuery UI</a>. The callbacks don't seem to work at all, even with this minimalistic test:</p>
<pre><code><script type="text/javascript" src="jqu... | [
{
"answer_id": 466566,
"author": "Soviut",
"author_id": 46914,
"author_profile": "https://Stackoverflow.com/users/46914",
"pm_score": 3,
"selected": true,
"text": "<p>It seems that the .sortable() is having some technical difficulties according to <a href=\"http://groups.google.com/group... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23501/"
] | I'm using the [Sortable](http://docs.jquery.com/UI/Sortable) component of [jQuery UI](http://ui.jquery.com/). The callbacks don't seem to work at all, even with this minimalistic test:
```
<script type="text/javascript" src="jquery-1.3.js"></script>
<script type="text/javascript" src="jquery-ui-personalized-1.6rc4.js"... | It seems that the .sortable() is having some technical difficulties according to [this post](http://groups.google.com/group/jquery-dev/browse_thread/thread/8be6c23bf57b3199). You may need to use SVN to download the [latest trunk release](http://dev.jquery.com/browser/trunk) to fix it. |
466,474 | <p>I am attempting to create a small application to collect data received from an external sensor attached to COM10. I have successfully created a small C# console object and application that opens the port and streams data to a file for a fixed period of time using a for-loop.</p>
<p>I would like to convert this appl... | [
{
"answer_id": 466510,
"author": "Jason Down",
"author_id": 9732,
"author_profile": "https://Stackoverflow.com/users/9732",
"pm_score": 5,
"selected": true,
"text": "<p><s>I think your issue is the line:</s>**</p>\n\n<p><s>sp.DataReceived += port_OnReceiveDatazz;</s></p>\n\n<p><s>Shouldn... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466474",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4612/"
] | I am attempting to create a small application to collect data received from an external sensor attached to COM10. I have successfully created a small C# console object and application that opens the port and streams data to a file for a fixed period of time using a for-loop.
I would like to convert this application to... | ~~I think your issue is the line:~~\*\*
~~sp.DataReceived += port\_OnReceiveDatazz;~~
~~Shouldn't it be:~~
~~sp.DataReceived += new SerialDataReceivedEventHandler (port\_OnReceiveDatazz);~~
\*\*Nevermind, the syntax is fine (didn't realize the shortcut at the time I originally answered this question).
I've also se... |
466,484 | <p>I've been looking for this all over, and simply cannot find it.</p>
<p>I have a blog that has no titles in its blog posts, but I'd like, for various usability reasons, to have the permalinks use the first few words from entries that do not have titles as the permalink slug.</p>
<pre><code> ie, if the post on samp... | [
{
"answer_id": 466732,
"author": "Todd Rowan",
"author_id": 3473,
"author_profile": "https://Stackoverflow.com/users/3473",
"pm_score": 0,
"selected": false,
"text": "<p>I doubt there's anything like this already built for wordpress. To get your blog to do this, you have to write a plugi... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've been looking for this all over, and simply cannot find it.
I have a blog that has no titles in its blog posts, but I'd like, for various usability reasons, to have the permalinks use the first few words from entries that do not have titles as the permalink slug.
```
ie, if the post on sample.com/blog is
Titl... | You could enter in titles, and then not display them in your view template. |
466,488 | <p>I'm basically looking for a way to automate typing stuff like the following:</p>
<pre><code>cout << "a[" << x << "][" << y << "] =\t" << a[x][y] << endl;
</code></pre>
<p>Something like:</p>
<pre><code>PRINTDBG(a[x][y]);
</code></pre>
<p>Ideally this would also work for<... | [
{
"answer_id": 466509,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "<p>This is an area where the <code>printf</code> style output can be more concise:</p>\n\n<pre><code>cout << \"a[\"... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm basically looking for a way to automate typing stuff like the following:
```
cout << "a[" << x << "][" << y << "] =\t" << a[x][y] << endl;
```
Something like:
```
PRINTDBG(a[x][y]);
```
Ideally this would also work for
```
PRINTDBG(func(arg1, arg2));
```
and even
```
PRINTDBG(if(condition) func(foo););
`... | This is, in the way you want it, not possible. If you have *if(condition) func(foo);* given to a macro, it can stringize that stuff, and it will print *if(condition) func(foo);*, but not with the actual values of the variables substituted. Remember the preprocessor doesn't know about the structure about that code.
Fo... |
466,496 | <p>When I use top the iowait on the host is really high. </p>
<p>iostat tells me which disk is utilized more but I want to find out which process is the culprit?</p>
<p>I am trying to find this out on a red hat linux host. Any suggestions. </p>
<p>EDIT: My linux flavor does not either have atop or ntop and since bui... | [
{
"answer_id": 466509,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "<p>This is an area where the <code>printf</code> style output can be more concise:</p>\n\n<pre><code>cout << \"a[\"... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43756/"
] | When I use top the iowait on the host is really high.
iostat tells me which disk is utilized more but I want to find out which process is the culprit?
I am trying to find this out on a red hat linux host. Any suggestions.
EDIT: My linux flavor does not either have atop or ntop and since building kernel is not an o... | This is, in the way you want it, not possible. If you have *if(condition) func(foo);* given to a macro, it can stringize that stuff, and it will print *if(condition) func(foo);*, but not with the actual values of the variables substituted. Remember the preprocessor doesn't know about the structure about that code.
Fo... |
466,525 | <p>Conceptually, I would like to accomplish the following but have had trouble understand how to code it properly in Python:</p>
<pre><code>from threading import Thread
for i in range(0,3):
t = Thread(target=myfunction)
t.start()
# wait until threads have finished executing
print 'complete!'
</code></pre>
| [
{
"answer_id": 466550,
"author": "E.J. Brennan",
"author_id": 53686,
"author_profile": "https://Stackoverflow.com/users/53686",
"pm_score": -1,
"selected": false,
"text": "<p>I have never used python, but I think the concept you are looking for is a \"semaphore\".</p>\n\n<p>Google turned... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4960/"
] | Conceptually, I would like to accomplish the following but have had trouble understand how to code it properly in Python:
```
from threading import Thread
for i in range(0,3):
t = Thread(target=myfunction)
t.start()
# wait until threads have finished executing
print 'complete!'
``` | add the threads to a list and `join()` them.
```
from threading import Thread
tlist = []
for i in range(3):
t = Thread(target=some_function)
t.start()
tlist.append(t)
# wait until threads have finished executing
for t in tlist:
t.join()
print 'complete!'
``` |
466,540 | <p>I have a Gridview with ImageButtons added to a column via a templatefield. I've attached a function to the "OnClick" event.</p>
<p>Once in this function, how can I get the index of the row that has the button that has been clicked. It appears that all I have is the mouse coordinates on the page.</p>
| [
{
"answer_id": 466549,
"author": "bdukes",
"author_id": 2688,
"author_profile": "https://Stackoverflow.com/users/2688",
"pm_score": 2,
"selected": false,
"text": "<p>The easiest way that I've found is to use the <a href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3259/"
] | I have a Gridview with ImageButtons added to a column via a templatefield. I've attached a function to the "OnClick" event.
Once in this function, how can I get the index of the row that has the button that has been clicked. It appears that all I have is the mouse coordinates on the page. | Instead of looping through the rows you can use this
```
<asp:ImageButton runat="server" id="ibtn1" ... RowIndex='<%# Container.DisplayIndex %>'
OnClick="button_click"/>
...
protected void button_click(object sender, EventArgs e){
ImageButton ibtn1 = sender as ImageButton;
int rowIndex = Convert.ToInt32(ibt... |
466,555 | <p>I have a listview that you select a row/item on. This is linked to a datatrigger that displays an image on the row. The image should only be displayed when the row is selected.</p>
<p>This part works fine, however when you move the focus to something else, such as a textbox, or a messagebox is displayed, the listvi... | [
{
"answer_id": 467097,
"author": "Bubblewrap",
"author_id": 57497,
"author_profile": "https://Stackoverflow.com/users/57497",
"pm_score": 3,
"selected": true,
"text": "<p>I think you're confusing IsSelected and IsFocused.</p>\n\n<p>Experiment with binding your triggers to <a href=\"http:... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57630/"
] | I have a listview that you select a row/item on. This is linked to a datatrigger that displays an image on the row. The image should only be displayed when the row is selected.
This part works fine, however when you move the focus to something else, such as a textbox, or a messagebox is displayed, the listviewitem los... | I think you're confusing IsSelected and IsFocused.
Experiment with binding your triggers to [IsFocused](http://msdn.microsoft.com/en-us/library/system.windows.uielement.isfocused.aspx) instead of IsSelected to get your desired result.
If i understand correctly, you only want the image to be visible if both IsSelected... |
466,562 | <h2>I would like to know what is the best practice between using bind tag and setting direct property to a control in asp.net.</h2>
<hr>
<p>aspx.cs</p>
<pre><code>public string Description {get; set;}
</code></pre>
<p>aspx</p>
<pre><code><asp:Literal ID="txtDescription" runat="server" Text='<%# Description %... | [
{
"answer_id": 466633,
"author": "Chris Marisic",
"author_id": 37055,
"author_profile": "https://Stackoverflow.com/users/37055",
"pm_score": 3,
"selected": true,
"text": "<p>The only time it's worth using the binding expressions is when... databinding. For dealing with static controls li... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47109/"
] | I would like to know what is the best practice between using bind tag and setting direct property to a control in asp.net.
--------------------------------------------------------------------------------------------------------------------------
---
aspx.cs
```
public string Description {get; set;}
```
aspx
```
<... | The only time it's worth using the binding expressions is when... databinding. For dealing with static controls like your textbox the best way to access it is the way you did in the second case.
This is even the case for dealing with the Model View Presenter implementation where generally your aspx page will inherent ... |
466,565 | <p>Why does the compiler say "a constant value is required" for the first case...the second case works fine... </p>
<pre><code>switch (definingGroup)
{
case Properties.Settings.Default.OU_HomeOffice:
//do something
break;
case "OU=Home Office":
//do something
break;
d... | [
{
"answer_id": 466574,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 6,
"selected": true,
"text": "<p><code>Properties.Settings.Default.OU_HomeOffice</code> isn't a constant string - something known at compile time. The ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4232/"
] | Why does the compiler say "a constant value is required" for the first case...the second case works fine...
```
switch (definingGroup)
{
case Properties.Settings.Default.OU_HomeOffice:
//do something
break;
case "OU=Home Office":
//do something
break;
default:
... | `Properties.Settings.Default.OU_HomeOffice` isn't a constant string - something known at compile time. The C# switch statement requires that every case is a compile-time constant.
(Apart from anything else, that's the only way it can know that there won't be any duplicates.)
See section 8.7.2 of the C# 3.0 spec for m... |
466,568 | <p>Sorry in advance, I'm struggling a bit with how to explain this... :) </p>
<p>Essentially, I've got a typical windows coordinate system (the Top, Left is 0,0). If anybody's familiar with the haversine query, <a href="http://forums.mysql.com/read.php?10,238858,238858" rel="nofollow noreferrer">like in SQL</a>, it ca... | [
{
"answer_id": 466592,
"author": "Francisco Canedo",
"author_id": 54591,
"author_profile": "https://Stackoverflow.com/users/54591",
"pm_score": 3,
"selected": true,
"text": "<p>Use Pythagoras:</p>\n\n<pre><code>distance = sqrt(xDifference^2 + yDifference^2)\n</code></pre>\n\n<p>Note that... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48957/"
] | Sorry in advance, I'm struggling a bit with how to explain this... :)
Essentially, I've got a typical windows coordinate system (the Top, Left is 0,0). If anybody's familiar with the haversine query, [like in SQL](http://forums.mysql.com/read.php?10,238858,238858), it can get all points in a radius based on latitude ... | Use Pythagoras:
```
distance = sqrt(xDifference^2 + yDifference^2)
```
Note that '^' in this example means "to the power of" and not C's bitwise XOR operator. In other words the idea is to square both differences. |
466,585 | <p>In my app I've got certain buttons which use the following code:</p>
<pre><code>SystemSoundID beep;
CFStringRef beepPath = (CFStringRef) [NSString stringWithFormat: @"%@/SoundFile.aif", [[NSBundle mainBundle] bundlePath]];
AudioServicesCreateSystemSoundID (CFURLCreateWithFileSystemPath (NULL, beepPath, kCFURLPOSIX... | [
{
"answer_id": 466595,
"author": "Mark Brittingham",
"author_id": 15592,
"author_profile": "https://Stackoverflow.com/users/15592",
"pm_score": 0,
"selected": false,
"text": "<p>Telerik offers many useful controls and is generally quite conscientious about their code and support. You're... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53677/"
] | In my app I've got certain buttons which use the following code:
```
SystemSoundID beep;
CFStringRef beepPath = (CFStringRef) [NSString stringWithFormat: @"%@/SoundFile.aif", [[NSBundle mainBundle] bundlePath]];
AudioServicesCreateSystemSoundID (CFURLCreateWithFileSystemPath (NULL, beepPath, kCFURLPOSIXPathStyle, fal... | As Mark and Martin already pointed out Telerik support is second to none, so you would surely get help in their forums/support threads. I'm currently working with their Reporting product and honestly I have not experienced any problems so far. I've read that they had problems with the toolbox in x64 bit machines, but i... |
466,599 | <p>I try to dynamically add nodes to a Java Swing <a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTree.html" rel="nofollow noreferrer"><code>JTree</code></a>, and the user should be able to browse and to collapse hierarchy while nodes are constantly added. When I add a <code>Thread.sleep(10)</code> in my ... | [
{
"answer_id": 466634,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "https://Stackoverflow.com/users/15880",
"pm_score": -1,
"selected": false,
"text": "<p>You may want to have the tree.expandRow command run from a <a href=\"http://java.sun.com/javase/6/docs/api/javax/swi... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48181/"
] | I try to dynamically add nodes to a Java Swing [`JTree`](http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTree.html), and the user should be able to browse and to collapse hierarchy while nodes are constantly added. When I add a `Thread.sleep(10)` in my loop, it works fine; but this is a dirty hack...
Here is the ... | tree.expandRow needs to be done in the event thread, so change the loop as follows:
```
while (true)
{
MutableTreeNode child = new DefaultMutableTreeNode("test");
model.insertNodeInto(child, root, root.getChildCount());
final int rowToExpand = tree.getRowCount() - 1; // ? does this work ?
... |
466,601 | <p>I'm using mod perl 1.3.0 with apache 1.3.41 perl version 5.8.6, and the memory size seems to grow about 4k every 3rd or 4th request. The Perl script we are running is simply: </p>
<pre><code>print "Content-type: text/html\n\n"; print "baby";
</code></pre>
<p>Yet that apache process just grows and grows when we s... | [
{
"answer_id": 468614,
"author": "innaM",
"author_id": 7498,
"author_profile": "https://Stackoverflow.com/users/7498",
"pm_score": 2,
"selected": false,
"text": "<p>Have you taken a look at the excellent <a href=\"http://modperl2book.org/mp1/html/index.html\" rel=\"nofollow noreferrer\">... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35697/"
] | I'm using mod perl 1.3.0 with apache 1.3.41 perl version 5.8.6, and the memory size seems to grow about 4k every 3rd or 4th request. The Perl script we are running is simply:
```
print "Content-type: text/html\n\n"; print "baby";
```
Yet that apache process just grows and grows when we slam it with apache benchmar... | Have you taken a look at the excellent [Practial mod\_perl](http://modperl2book.org/mp1/html/index.html) and its [chapter on memory leaks](http://modperl2book.org/mp1/html/14-2-6-Memory-Leakage.html)? |
466,608 | <p>I have tried all the possible options to use openID delegation on my site, but none of the methods are working for me. </p>
<ol>
<li>I'm having the "link rel" tags in the head section of the HTML file.</li>
<li>I'm having the xrds location meta tags in the head section of the HTML file.</li>
<li>I'm setting HTTP He... | [
{
"answer_id": 466680,
"author": "nezroy",
"author_id": 49968,
"author_profile": "https://Stackoverflow.com/users/49968",
"pm_score": 0,
"selected": false,
"text": "<p>Try changing the protocol on the openid.server to http instead of https and see if that works. Also, I think you'll want... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399891/"
] | I have tried all the possible options to use openID delegation on my site, but none of the methods are working for me.
1. I'm having the "link rel" tags in the head section of the HTML file.
2. I'm having the xrds location meta tags in the head section of the HTML file.
3. I'm setting HTTP Headers for X-XRDS-Location... | try this, it should work ;)
```
<link rel="openid.server" href="http://pip.verisignlabs.com/server" />
<link rel="openid.delegate" href="http://gubbi.pip.verisignlabs.com" />
<link rel="openid2.provider" href="http://pip.verisignlabs.com/server" />
<link rel="openid2.local_id" href="http://gubbi.pip.verisignlabs.com" ... |
466,611 | <p>When using Python's <code>super()</code> to do method chaining, you have to explicitly specify your own class, for example:</p>
<pre><code>class MyDecorator(Decorator):
def decorate(self):
super(MyDecorator, self).decorate()
</code></pre>
<p>I have to specify the name of my class <code>MyDecorator</cod... | [
{
"answer_id": 466638,
"author": "Peter Rowell",
"author_id": 17017,
"author_profile": "https://Stackoverflow.com/users/17017",
"pm_score": 4,
"selected": true,
"text": "<p>The BDFL agrees. See <a href=\"http://www.python.org/dev/peps/pep-3135/\" rel=\"nofollow noreferrer\">PEP 3135 - Ne... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466611",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5304/"
] | When using Python's `super()` to do method chaining, you have to explicitly specify your own class, for example:
```
class MyDecorator(Decorator):
def decorate(self):
super(MyDecorator, self).decorate()
```
I have to specify the name of my class `MyDecorator` as an argument to `super()`. This is not DRY.... | The BDFL agrees. See [PEP 3135 - New Super](http://www.python.org/dev/peps/pep-3135/) for Python 3.0 (and [Pep 367 - New Super](http://www.python.org/dev/peps/pep-0367/) for Python 2.6). |
466,620 | <p>I need to convert a datagrid table in Adobe Flex to an ArrayCollection. I was expecting to be able to loop through each row of a datagrid and write that to the Array collection, but the only method for accessing data in the datagrid that I can find is SelectedItem, which doesn't help me.</p>
<p>Obviously one could... | [
{
"answer_id": 466710,
"author": "Simon",
"author_id": 24039,
"author_profile": "https://Stackoverflow.com/users/24039",
"pm_score": 2,
"selected": false,
"text": "<p>You can do it by iterating over the fields in the columns, but you should be using the data provider. If the only place ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55900/"
] | I need to convert a datagrid table in Adobe Flex to an ArrayCollection. I was expecting to be able to loop through each row of a datagrid and write that to the Array collection, but the only method for accessing data in the datagrid that I can find is SelectedItem, which doesn't help me.
Obviously one could just copy ... | If your DataGrid is:
```
<mx:DataGrid id="someDG" dataProvider="{this.provider}" />
```
Then check if this.provider is Array or ArrayCollection. If it is ArrayCollection then access it simply by:
```
var gotIt:ArrayCollection = this.someDG.dataProvider as ArrayCollection;
```
if it is an Array, then:
```
var got... |
466,625 | <p>I have a feeling this is a repost but I can't seem to find any good information about it. I was just wondering how serialization actually works (well actually deserialization). What I'm wondering is if say I have a property that is not actually backed by a private field; i.e.:</p>
<pre><code>public string SomeProp ... | [
{
"answer_id": 466645,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 4,
"selected": true,
"text": "<p>It completely depends on the mechanism you are using for serialization.</p>\n\n<p>If you are using XmlSerialization, t... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13688/"
] | I have a feeling this is a repost but I can't seem to find any good information about it. I was just wondering how serialization actually works (well actually deserialization). What I'm wondering is if say I have a property that is not actually backed by a private field; i.e.:
```
public string SomeProp {
get {
... | It completely depends on the mechanism you are using for serialization.
If you are using XmlSerialization, then yes, the setter gets called.
If you are using data contract serialization (the DataContractSerialization) then the getter/setter will be called if you apply the DataMember attribute to the property (not to ... |
466,653 | <p>I've downloaded an HttpHandler class that concatenates JS files into one file and it keeps appending the <code></code> characters at the start of each file it concatenates.</p>
<p>Any ideas on what is causing this? Could it be that onces the files processed they are written to the cache and that's how the cache ... | [
{
"answer_id": 466665,
"author": "Stefan",
"author_id": 48003,
"author_profile": "https://Stackoverflow.com/users/48003",
"pm_score": 5,
"selected": false,
"text": "<p>The  characters are the <a href=\"http://en.wikipedia.org/wiki/Byte-order_mark\" rel=\"noreferrer\">UTF BOM markers</... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34819/"
] | I've downloaded an HttpHandler class that concatenates JS files into one file and it keeps appending the `` characters at the start of each file it concatenates.
Any ideas on what is causing this? Could it be that onces the files processed they are written to the cache and that's how the cache is storing/rendering ... | OK, I've debugged your code.
BOM marks appear in the source stream when the files are being read from the disk:
```
byte[] bytes = File.ReadAllBytes(physicalPath);
// TODO: Convert unicode files to specified encoding. For now, assuming
// files are either ASCII or UTF8
```
If you read the files properly, you can ge... |
466,679 | <p>I had discovered that when resizing image by using System.Drawing.Graphics class resulting image missed one pixel from right and bottom borders. This is bug somewhere in my code or .Net issue?
Test code:</p>
<pre><code>public static void Resize(string imagePath,int width) {
InterpolationMode[] interpolationModes =... | [
{
"answer_id": 466703,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 0,
"selected": false,
"text": "<p>Given that the percentage that you are scaling by will not always yield an integral result, that is going to lead to ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39292/"
] | I had discovered that when resizing image by using System.Drawing.Graphics class resulting image missed one pixel from right and bottom borders. This is bug somewhere in my code or .Net issue?
Test code:
```
public static void Resize(string imagePath,int width) {
InterpolationMode[] interpolationModes = new Interpol... | This is a bug in .NET graphics, and a tremendously annoying one. It is not a rounding error or an algorithm problem. You can see a variant of the same problem if you create a 100x100 bitmap and then call DrawRectangle using a 100x100 rectangle as one of the parameters: you will not see the bottom or right sides of the ... |
466,684 | <p>Using Python, how can information such as CPU usage, memory usage (free, used, etc), process count, etc be returned in a generic manner so that the same code can be run on Linux, Windows, BSD, etc?</p>
<p>Alternatively, how could this information be returned on all the above systems with the code specific to that O... | [
{
"answer_id": 466714,
"author": "JuanDeLosMuertos",
"author_id": 39339,
"author_profile": "https://Stackoverflow.com/users/39339",
"pm_score": 0,
"selected": false,
"text": "<p>take a look at the <a href=\"http://docs.python.org/library/os.html\" rel=\"nofollow noreferrer\">os module</a... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183/"
] | Using Python, how can information such as CPU usage, memory usage (free, used, etc), process count, etc be returned in a generic manner so that the same code can be run on Linux, Windows, BSD, etc?
Alternatively, how could this information be returned on all the above systems with the code specific to that OS being ru... | Regarding cross-platform: your best bet is probably to write platform-specific code, and then import it conditionally. e.g.
```
import sys
if sys.platform == 'win32':
import win32_sysinfo as sysinfo
elif sys.platform == 'darwin':
import mac_sysinfo as sysinfo
elif 'linux' in sys.platform:
import linux_sysinfo as... |
466,699 | <p>From what I understand, the goal of the Command pattern is to help separate UI interaction from application logic. With properly implemented commands, a click on a "Print" menu item might result in a chain of interaction like this:</p>
<pre><code>(button) ---click executes command----> (command) ---calls Print(... | [
{
"answer_id": 466712,
"author": "Steven Robbins",
"author_id": 26507,
"author_profile": "https://Stackoverflow.com/users/26507",
"pm_score": 0,
"selected": false,
"text": "<p>They can be overkill for some things, but you do get some nice benefits like CanExecute which can automagically ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2547/"
] | From what I understand, the goal of the Command pattern is to help separate UI interaction from application logic. With properly implemented commands, a click on a "Print" menu item might result in a chain of interaction like this:
```
(button) ---click executes command----> (command) ---calls Print() in app logic ---... | In addition to the things already mentioned, what you've forgotten in your specific Paste example are the CommandTarget and CommandParameter properties. For Paste, you can specify a TextBox by setting as the CommandTarget.
These properties are absolutely essential when want to use the same RoutedCommand from different... |
466,737 | <p>Why was it decided that using <strong>XMLHTTPRequest</strong> for doing XML calls should not do calls across the domain boundary? You can retrieve JavaScript, images, CSS, iframes, and just about any other content I can think of from other domains. Why are the Ajax HTTP requests not allowed to cross the domain boun... | [
{
"answer_id": 466762,
"author": "user57660",
"author_id": 57660,
"author_profile": "https://Stackoverflow.com/users/57660",
"pm_score": 0,
"selected": false,
"text": "<p>You turn unsuspecting visitors into denial of service attackers.</p>\n\n<p>Also, Imagine a cross site script that ste... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1862/"
] | Why was it decided that using **XMLHTTPRequest** for doing XML calls should not do calls across the domain boundary? You can retrieve JavaScript, images, CSS, iframes, and just about any other content I can think of from other domains. Why are the Ajax HTTP requests not allowed to cross the domain boundaries? It seems ... | >
> Why are Ajax HTTP Requests not allowed to cross domain boundaries.
>
>
>
Because AJAX requests are (a) submitted with user credentials, and (b) allow the caller to read the returned data.
It is a combination of these factors that can result in a vulnerability. There are proposals to add a form of cross-domain... |
466,741 | <p>I've already referred to <a href="https://stackoverflow.com/questions/104177/how-do-i-embed-an-image-in-a-net-html-mail-message">this SO post</a>. I've been embedding images using an AlternateView for PNG files. Now I'm wondering how to do it with PDFs.</p>
<p>Should it work, for the LinkedResource, to just say: ... | [
{
"answer_id": 466753,
"author": "DavGarcia",
"author_id": 40161,
"author_profile": "https://Stackoverflow.com/users/40161",
"pm_score": 4,
"selected": true,
"text": "<p>You can embed images since they can be rendered in place by an email client. PDFs cannot do that, so I'd recommend eit... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13244/"
] | I've already referred to [this SO post](https://stackoverflow.com/questions/104177/how-do-i-embed-an-image-in-a-net-html-mail-message). I've been embedding images using an AlternateView for PNG files. Now I'm wondering how to do it with PDFs.
Should it work, for the LinkedResource, to just say:
```
Dim document As N... | You can embed images since they can be rendered in place by an email client. PDFs cannot do that, so I'd recommend either having a thumbnail of the PDF that links to your web site with the actual PDF. Or just attach the PDF to the email message. |
466,745 | <p>I modified one of the apps I made for russian market. Everything seemed to be fine, there was an issue when you enter data into database but it was solved by by setting page encoding to utf-8. So inserting and retrieving works fine. I ran into problem I just have no idea how to tackle.
When I ran following query (si... | [
{
"answer_id": 466754,
"author": "Zeljko Dakic",
"author_id": 29325,
"author_profile": "https://Stackoverflow.com/users/29325",
"pm_score": 5,
"selected": false,
"text": "<p>OK just found answer and it is lame :) a little. You need to add N in front of unicode string.</p>\n\n<pre><code>S... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29325/"
] | I modified one of the apps I made for russian market. Everything seemed to be fine, there was an issue when you enter data into database but it was solved by by setting page encoding to utf-8. So inserting and retrieving works fine. I ran into problem I just have no idea how to tackle.
When I ran following query (simpl... | OK just found answer and it is lame :) a little. You need to add N in front of unicode string.
```
SELECT * FROM institutions WHERE city LIKE N'%Москва%' ORDER BY address1
```
I will leave this in case someone else get stuck with it. |
466,748 | <p>My company, like everyone else's, requires password resets from time to time. This is all good and well for security's sake, but I'd like to explore the challenge of resetting it through a script (notably because we can't use our previous 25 passwords; Perl is much quicker about cycling through a list two-dozen deep... | [
{
"answer_id": 467194,
"author": "Leon Timmermans",
"author_id": 4727,
"author_profile": "https://Stackoverflow.com/users/4727",
"pm_score": 2,
"selected": false,
"text": "<p><code>Net::LDAP::Extension::SetPassword</code> doesn't have anything to do with any OLE LDAP object. Either you u... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2993381/"
] | My company, like everyone else's, requires password resets from time to time. This is all good and well for security's sake, but I'd like to explore the challenge of resetting it through a script (notably because we can't use our previous 25 passwords; Perl is much quicker about cycling through a list two-dozen deep th... | When you said you were trying to "reset" your password, I think you really meant [change](http://msdn.microsoft.com/en-us/library/aa746341(VS.85).aspx) password rather than [set](http://msdn.microsoft.com/en-us/library/aa746344(VS.85).aspx) password. There is a difference between the two. "SetPassword" requires god/adm... |
466,752 | <p>I've been experimenting with ASP.NET MVC and following <a href="http://www.asp.net/learn/mvc/tutorial-01-cs.aspx" rel="nofollow noreferrer">this</a> tutorial to create the basic task list application. I've gotten it running fine, everything is working although the video is in VB and I had some trouble getting it "co... | [
{
"answer_id": 466774,
"author": "zsharp",
"author_id": 49632,
"author_profile": "https://Stackoverflow.com/users/49632",
"pm_score": 2,
"selected": false,
"text": "<pre><code>ViewData[\"Anyleft\"] = Anyleft;\n</code></pre>\n"
},
{
"answer_id": 466776,
"author": "mmx",
"a... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135/"
] | I've been experimenting with ASP.NET MVC and following [this](http://www.asp.net/learn/mvc/tutorial-01-cs.aspx) tutorial to create the basic task list application. I've gotten it running fine, everything is working although the video is in VB and I had some trouble getting it "converted" to C# but muddled through thank... | Use this in the controller:
```
public ActionResult Index()
{
ViewData["AnyLeft"] = Uncomplete();
var tasks = from t in db.Tasks orderby t.EntryDate descending select t;
return View(tasks.ToList());
}
```
And in the view:
```
<% if (!(bool)ViewData["AnyLeft"])
{ %>
<h1 class="green">My Tasks</h1>... |
466,764 | <p>I am getting my feet wet with Git and have the following issue:</p>
<p>My project source tree:</p>
<pre><code>/
|
+--src/
+----refs/
+----...
|
+--vendor/
+----...
</code></pre>
<p>I have code (currently MEF) in my vendor branch that I will compile there and then move the references into <code>/src/refs</code> wh... | [
{
"answer_id": 467053,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 11,
"selected": true,
"text": "<p>Notes:</p>\n<ul>\n<li><a href=\"https://stackoverflow.com/users/814145/xiaobai\">xiaobai</a>'s <a href=\"https://stackoverfl... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3683/"
] | I am getting my feet wet with Git and have the following issue:
My project source tree:
```
/
|
+--src/
+----refs/
+----...
|
+--vendor/
+----...
```
I have code (currently MEF) in my vendor branch that I will compile there and then move the references into `/src/refs` which is where the project picks them up from.... | Notes:
* [xiaobai](https://stackoverflow.com/users/814145/xiaobai)'s [answer](https://stackoverflow.com/a/12080920/6309) is simpler (git1.7.6+): **`git status --ignored`**
(as detailed in "[Is there a way to tell git-status to ignore the effects of `.gitignore` files?](https://stackoverflow.com/a/12080857/6309)")
*... |
466,771 | <p>During some research in the .net 3.5 symbols I've found a preprocessor directive</p>
<pre><code>#if WIN95_SUPPORT
//...
#endif
</code></pre>
<p>This looks <em>really</em> strange to me! It is located in line 13861 in System.Windows.Forms.Control's Control.cs in method <em>void WndProc(ref Message m)</em>!</p>
<p>... | [
{
"answer_id": 466783,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 3,
"selected": false,
"text": "<p>It's probably left over from previous versions of the framework which were supported on Windows 95 (since it would ma... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44107/"
] | During some research in the .net 3.5 symbols I've found a preprocessor directive
```
#if WIN95_SUPPORT
//...
#endif
```
This looks *really* strange to me! It is located in line 13861 in System.Windows.Forms.Control's Control.cs in method *void WndProc(ref Message m)*!
Does any of you know anything about that? | Considering that the betas of .NET 1.0 (<http://en.wikipedia.org/wiki/.NET_Framework_version_list>) were released before Microsoft ended support of Windows 95 (31 December 2001) I think is safe to assume that the developers were unsure until some point if they had to support Windows 95 or not. |
466,792 | <p>I'm still fairly new to PInvoke calls, so I'm hoping that someone out there can help me clear this up:</p>
<p>I'm trying to PInvoke a call to CeGetVolumeInfo()- which is kept in CoreDll.dll- from a C# project. <a href="http://msdn.microsoft.com/en-us/library/aa912305.aspx" rel="nofollow noreferrer">Here</a> is the... | [
{
"answer_id": 466969,
"author": "Just a Bill",
"author_id": 56824,
"author_profile": "https://Stackoverflow.com/users/56824",
"pm_score": 3,
"selected": true,
"text": "<p>Look at the following link\n<a href=\"http://msdn.microsoft.com/en-us/library/aa912305.aspx\" rel=\"nofollow norefer... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm still fairly new to PInvoke calls, so I'm hoping that someone out there can help me clear this up:
I'm trying to PInvoke a call to CeGetVolumeInfo()- which is kept in CoreDll.dll- from a C# project. [Here](http://msdn.microsoft.com/en-us/library/aa912305.aspx) is the definition for this function from MSDN:
```
W... | Look at the following link
[link text](http://msdn.microsoft.com/en-us/library/aa912305.aspx)
"InfoLevel
[in] Type of information requested. Currently, this value must be set to CeVolumeInfoLevelStandard."
From the header storemgr.h
>
> typedef enum \_CE\_VOLUME\_INFO\_LEVEL {
> CeVolumeInfoLevelStandard, } CE\_V... |
466,801 | <p>I'm trying something like this</p>
<p>Output.py</p>
<pre><code>print "Hello"
</code></pre>
<p>Input.py</p>
<pre><code>greeting = raw_input("Give me the greeting. ")
print "The greeting is:", greeting
</code></pre>
<p>At the cmd line</p>
<pre><code>Output.py | Input.py
</code></pre>
<p>But it returns an <i>EOF... | [
{
"answer_id": 466849,
"author": "Jay",
"author_id": 20840,
"author_profile": "https://Stackoverflow.com/users/20840",
"pm_score": 6,
"selected": true,
"text": "<p>I tested this on my Windows machine and it works if you specify the Python exe: </p>\n\n<pre><code>C:\\>C:\\Python25\\pyt... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41718/"
] | I'm trying something like this
Output.py
```
print "Hello"
```
Input.py
```
greeting = raw_input("Give me the greeting. ")
print "The greeting is:", greeting
```
At the cmd line
```
Output.py | Input.py
```
But it returns an *EOFError*. Can someone tell me what I am doing wrong?
Thanks for your help.
**EDIT... | I tested this on my Windows machine and it works if you specify the Python exe:
```
C:\>C:\Python25\python.exe output.py | C:\Python25\python.exe input.py
Give me the greeting. The greeting is: hello
```
But I get an EOFError also if running the commands directly as:
```
output.py | input.py
```
I'm not sure e... |
466,802 | <p>My situation: I'm new to Spirit, I have to use VC6 and am thus using Spirit 1.6.4.</p>
<p>I have a line that looks like this:</p>
<pre><code>//The Description;DESCRIPTION;;
</code></pre>
<p>I want to put the text <code>DESCRIPTION</code> in a string if the line starts with <code>//The Description;</code>.</p>
<p... | [
{
"answer_id": 466849,
"author": "Jay",
"author_id": 20840,
"author_profile": "https://Stackoverflow.com/users/20840",
"pm_score": 6,
"selected": true,
"text": "<p>I tested this on my Windows machine and it works if you specify the Python exe: </p>\n\n<pre><code>C:\\>C:\\Python25\\pyt... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27596/"
] | My situation: I'm new to Spirit, I have to use VC6 and am thus using Spirit 1.6.4.
I have a line that looks like this:
```
//The Description;DESCRIPTION;;
```
I want to put the text `DESCRIPTION` in a string if the line starts with `//The Description;`.
I have something that works but looks not that elegant to me:... | I tested this on my Windows machine and it works if you specify the Python exe:
```
C:\>C:\Python25\python.exe output.py | C:\Python25\python.exe input.py
Give me the greeting. The greeting is: hello
```
But I get an EOFError also if running the commands directly as:
```
output.py | input.py
```
I'm not sure e... |
466,816 | <p>Please excuse my ignorance on the topic, as I am relatively new to Hibernate / NHibernate, but I have encountered a mapping I can't figure out:</p>
<p>This is what my database table looks like:</p>
<pre><code><bincontents>
<id>5873715</id>
<title>Video Title</title>
<sorto... | [
{
"answer_id": 466885,
"author": "Ryan Lanciaux",
"author_id": 1385358,
"author_profile": "https://Stackoverflow.com/users/1385358",
"pm_score": 0,
"selected": false,
"text": "<p>Couldn't you have both Video and Clip objects in your class and just make sure that both are never populated ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13145/"
] | Please excuse my ignorance on the topic, as I am relatively new to Hibernate / NHibernate, but I have encountered a mapping I can't figure out:
This is what my database table looks like:
```
<bincontents>
<id>5873715</id>
<title>Video Title</title>
<sortorder>0</sortorder>
<itemid>23079</itemid>
<itemt... | It sounds to me like you have a candidate for inheritance. If you have an abstract base type of BinContents, have a derived class of VideoBinContents, which contains just a Video mapping, and and a ClipBinContents which contains just a Clip mapping. Your itemtype is your discriminator. Have a look here for more: <http:... |
466,819 | <p>We use Selenium to test the UI layer of our ASP.NET application. Many of the test cases test longer flows that span several pages.</p>
<p>I've found that the tests are very brittle, broken not just by code changes that actually change the pages but also by innocuous refactorings such as renaming a control (since I ... | [
{
"answer_id": 466889,
"author": "cynicalman",
"author_id": 410,
"author_profile": "https://Stackoverflow.com/users/410",
"pm_score": 2,
"selected": false,
"text": "<p>How are you creating your Selenium tests, by recording them and playing them back? What we have done is build an object... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9449/"
] | We use Selenium to test the UI layer of our ASP.NET application. Many of the test cases test longer flows that span several pages.
I've found that the tests are very brittle, broken not just by code changes that actually change the pages but also by innocuous refactorings such as renaming a control (since I need to pa... | I've found PageObject pattern very helpful.
<http://code.google.com/p/webdriver/wiki/PageObjects>
more info:
- [What's the Point of Selenium?](https://stackoverflow.com/questions/616810/whats-the-point-of-selenium/616887)
- [Selenium Critique](https://stackoverflow.com/questions/99876/selenium-critique/211452)
ma... |
466,827 | <p>I talked my team into turning on compiler warnings again. Some how all warnings (-w) were disabled (don't ask...). Most of them are obvious but one of them is really annoying. I get it from my date and time classes which are used in lots of places. Story is really simple. Time is subclass of Date and both of them ha... | [
{
"answer_id": 466866,
"author": "Michael Kristofik",
"author_id": 46821,
"author_profile": "https://Stackoverflow.com/users/46821",
"pm_score": 2,
"selected": true,
"text": "<p>I can help you with that particular warning - it looks a lot like this one from <a href=\"http://www.parashift... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3579/"
] | I talked my team into turning on compiler warnings again. Some how all warnings (-w) were disabled (don't ask...). Most of them are obvious but one of them is really annoying. I get it from my date and time classes which are used in lots of places. Story is really simple. Time is subclass of Date and both of them have ... | I can help you with that particular warning - it looks a lot like this one from [C++ FAQ Lite](http://www.parashift.com/c++-faq-lite/strange-inheritance.html#faq-23.9). Did you by chance change the type of argument that ACTime::operator- uses from the one in ACDate? |
466,841 | <p>I am comparing text files in junit using:</p>
<pre><code>public static void assertReaders(BufferedReader expected,
BufferedReader actual) throws IOException {
String line;
while ((line = expected.readLine()) != null) {
assertEquals(line, actual.readLine());
}
assertNull("Actual ha... | [
{
"answer_id": 466854,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>If expected has more lines than actual, you'll fail an assertEquals before getting to the assertNull later.</p>\n\n<p... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22801/"
] | I am comparing text files in junit using:
```
public static void assertReaders(BufferedReader expected,
BufferedReader actual) throws IOException {
String line;
while ((line = expected.readLine()) != null) {
assertEquals(line, actual.readLine());
}
assertNull("Actual had more lines t... | [junit-addons](http://sourceforge.net/projects/junit-addons) has nice support for it: [FileAssert](http://junit-addons.sourceforge.net/junitx/framework/FileAssert.html)
It gives you exceptions like:
```
junitx.framework.ComparisonFailure: aa Line [3] expected: [b] but was:[a]
``` |
466,856 | <p>I have a script that runs a stored procedure in my SQL server database, the problem is the stored procedure takes a uniqueidentifier parameter. I have a function that grabs a session id from the database (which is an nvarchar), so VBScript makes it a string and I need to convert it to pass it to the stored procedur... | [
{
"answer_id": 466918,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 0,
"selected": false,
"text": "<p>I usually change the parameter type of the stored procedure to varchar(38).</p>\n\n<p>SQL Server makes a better j... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38695/"
] | I have a script that runs a stored procedure in my SQL server database, the problem is the stored procedure takes a uniqueidentifier parameter. I have a function that grabs a session id from the database (which is an nvarchar), so VBScript makes it a string and I need to convert it to pass it to the stored procedure.
... | Depending on the data type of the SELECT OpenSession, you may be able to cast/convert it in the query and VBScript may possibly keep the data type as a GUID:
```
SELECT top 1 CONVERT(uniqueidentifier, OpenSession)
FROM OpenSessions with (nolock)
```
When you use `GetOpenSession` or `rs.Fields(0).Value`, hopefully VB... |
466,867 | <p>Is there a way to set a button inside the dojo dialog box and have it close the dialog box it is residing in?</p>
<p>Putting dijits inside of dijits doesn't work, and I can't beleive there isn't a way to do that.</p>
| [
{
"answer_id": 473385,
"author": "Maine",
"author_id": 37489,
"author_profile": "https://Stackoverflow.com/users/37489",
"pm_score": 2,
"selected": false,
"text": "<p>Sure you can put a dijit widget inside another widget. And in a standard Dojo release there's even a test case <a href=\"... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there a way to set a button inside the dojo dialog box and have it close the dialog box it is residing in?
Putting dijits inside of dijits doesn't work, and I can't beleive there isn't a way to do that. | Sure you can put a dijit widget inside another widget. And in a standard Dojo release there's even a test case [Dijit Dialog focus & destroy](http://download.dojotoolkit.org/release-1.2.3/dojo-release-1.2.3/dijit/tests/test_Dialog_focusDestroy.html) included that demonstrates closing dialog with a button inside of it. ... |
466,878 | <p>I would like to have some long-running server applications periodically output general GC performance numbers in Java, something like the GC equivalent of Runtime.freeMemory(), etc. Something like number of cycles done, average time, etc.</p>
<p>We have systems running on customer machines where there is a suspici... | [
{
"answer_id": 466919,
"author": "Michael Myers",
"author_id": 13531,
"author_profile": "https://Stackoverflow.com/users/13531",
"pm_score": 4,
"selected": false,
"text": "<p>The JVM has a certain amount of garbage collector logging already built in, so depending on your requirements, yo... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8946/"
] | I would like to have some long-running server applications periodically output general GC performance numbers in Java, something like the GC equivalent of Runtime.freeMemory(), etc. Something like number of cycles done, average time, etc.
We have systems running on customer machines where there is a suspicion that mis... | Here's an example using `[GarbageCollectorMXBean](http://java.sun.com/javase/6/docs/api/java/lang/management/GarbageCollectorMXBean.html)` to print out GC stats. Presumably you would call this method periodically, e.g. scheduling using a `[ScheduledExecutorService](http://java.sun.com/javase/6/docs/api/java/util/concur... |
466,884 | <p>I am on a windows IIS server serving some php sites. We have moved a working PHP site on to our server, however submitting one of the forms returns:</p>
<pre><code>PHP has encountered a Stack overflow
</code></pre>
<p>When commenting out the MYSQL INSERT and assigning SESSION variables the form processes, however ... | [
{
"answer_id": 466901,
"author": "Evan Fosmark",
"author_id": 49701,
"author_profile": "https://Stackoverflow.com/users/49701",
"pm_score": 3,
"selected": false,
"text": "<p>Too much recursion?</p>\n"
},
{
"answer_id": 466910,
"author": "Dinah",
"author_id": 356,
"aut... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am on a windows IIS server serving some php sites. We have moved a working PHP site on to our server, however submitting one of the forms returns:
```
PHP has encountered a Stack overflow
```
When commenting out the MYSQL INSERT and assigning SESSION variables the form processes, however these are vital segments o... | Too much recursion? |
466,893 | <p>My Ant build includes a junit task that runs some tests. In order for the tests to work, the value of the property that specifies the current working directory (<code>user.dir</code>) must be changed, but I am unsure how to achieve this.</p>
<p>The task in question currently looks like this:</p>
<pre><code><jun... | [
{
"answer_id": 466928,
"author": "Kevin",
"author_id": 26620,
"author_profile": "https://Stackoverflow.com/users/26620",
"pm_score": 4,
"selected": true,
"text": "<p>Try using a jvmarg:</p>\n\n<pre><code><junit fork=\"yes\">\n <jvmarg value=\"-Duser.dir=somedir\"/>\n ...\n&... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648/"
] | My Ant build includes a junit task that runs some tests. In order for the tests to work, the value of the property that specifies the current working directory (`user.dir`) must be changed, but I am unsure how to achieve this.
The task in question currently looks like this:
```
<junit printsummary="withOutAndErr" for... | Try using a jvmarg:
```
<junit fork="yes">
<jvmarg value="-Duser.dir=somedir"/>
...
</junit>
```
Note that fork **must** be true on both the *junit* tag and the *batchtest* tag as the *batchtest* tag overrides the value from *junit*. Jvmargs only work if junit forks a new JVM. |
466,921 | <p>Have read through the <a href="http://msdn.microsoft.com/en-us/library/ms229002.aspx" rel="nofollow noreferrer">MSDN naming guidelines</a> and could not find a clear answer, other than that you should try to avoid underscores in general. Let's say I have the following:</p>
<pre><code>public class Employee
{
pri... | [
{
"answer_id": 466937,
"author": "Brian Rasmussen",
"author_id": 38206,
"author_profile": "https://Stackoverflow.com/users/38206",
"pm_score": 3,
"selected": false,
"text": "<p>First of all - for the simple get/set cases I would recommend that you use automatically implemented properties... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29426/"
] | Have read through the [MSDN naming guidelines](http://msdn.microsoft.com/en-us/library/ms229002.aspx) and could not find a clear answer, other than that you should try to avoid underscores in general. Let's say I have the following:
```
public class Employee
{
private string m_name; //to store property value call... | I think that, whatever naming convention you use, the most important thing is that you stay consistent.
I mean, if you choose to name private members like \_name , then always do it like this instead of once using \_name, and the other time m\_name.
I personally use the underscore-prefix convention. (one of the reasons... |
466,946 | <p>.NET offers a generic list container whose performance is almost identical (see Performance of Arrays vs. Lists question). However they are quite different in initialization. </p>
<p>Arrays are very easy to initialize with a default value, and by definition they already have certain size:</p>
<pre><code>string[] A... | [
{
"answer_id": 466952,
"author": "Ed S.",
"author_id": 1053,
"author_profile": "https://Stackoverflow.com/users/1053",
"pm_score": 5,
"selected": false,
"text": "<p>Use the constructor which takes an int (\"capacity\") as an argument:</p>\n\n<pre><code>List<string> = new List<st... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2892/"
] | .NET offers a generic list container whose performance is almost identical (see Performance of Arrays vs. Lists question). However they are quite different in initialization.
Arrays are very easy to initialize with a default value, and by definition they already have certain size:
```
string[] Ar = new string[10];
... | I can't say I need this very often - could you give more details as to why you want this? I'd probably put it as a static method in a helper class:
```
public static class Lists
{
public static List<T> RepeatedDefault<T>(int count)
{
return Repeated(default(T), count);
}
public static List<T> ... |
466,963 | <p>I would like to be able to kill a user's query in Oracle 10.2.0.4 without killing their entire session. This would allow the query to end, but not log that user out of their session, so they can continue making other queries. Is this possible at all? Or is the blunt hammer of killing the session the only way to g... | [
{
"answer_id": 467266,
"author": "Gary Myers",
"author_id": 25714,
"author_profile": "https://Stackoverflow.com/users/25714",
"pm_score": 1,
"selected": false,
"text": "<p>You could look at Resource Limits:</p>\n\n<p>\"If a user exceeds a call-level resource limit, then Oracle halts the ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75/"
] | I would like to be able to kill a user's query in Oracle 10.2.0.4 without killing their entire session. This would allow the query to end, but not log that user out of their session, so they can continue making other queries. Is this possible at all? Or is the blunt hammer of killing the session the only way to go abou... | I found a trick. I have no idea how safe this is to play with, but it does work. There is an Oracle event, 10237, which is described as "simulate ^C (for testing purposes)".
You have to have the SID and SERIAL# of the session you want to interrupt.
Call SYS.DBMS\_SYSTEM.SET\_EV( *sid*, *serial#*, 10237, 1, '' ) to ac... |
466,972 | <p>I am looking for a way to store a large variable number of matrixes in an array in MATLAB.</p>
<p>Are there any ways to achieve this?</p>
<p>Example:</p>
<pre><code>for i: 1:unknown
myArray(i) = zeros(500,800);
end
</code></pre>
<p>Where unknown is the varied length of the array, I can revise with additional i... | [
{
"answer_id": 467042,
"author": "Hosam Aly",
"author_id": 41283,
"author_profile": "https://Stackoverflow.com/users/41283",
"pm_score": 6,
"selected": false,
"text": "<p>Use cell arrays. This has an advantage over 3D arrays in that it does not require <em>a contiguous memory space</em> ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/466972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57685/"
] | I am looking for a way to store a large variable number of matrixes in an array in MATLAB.
Are there any ways to achieve this?
Example:
```
for i: 1:unknown
myArray(i) = zeros(500,800);
end
```
Where unknown is the varied length of the array, I can revise with additional info if needed.
Update:
Performance is t... | If all of the matrices are going to be the same size (i.e. 500x800), then you can just make a 3D array:
```
nUnknown; % The number of unknown arrays
myArray = zeros(500,800,nUnknown);
```
To access one array, you would use the following syntax:
```
subMatrix = myArray(:,:,3); % Gets the third matrix
```
You can... |
467,002 | <p>I have the following query:</p>
<pre><code>SELECT DISTINCT c.id
FROM clients AS c
LEFT JOIN client_project AS cp ON (cp.client_id = c.id)
WHERE cp.project_id = 1
AND c.active_flag = 1
ORDER BY c.client_name
</code></pre>
<p>If I remove the order by, the query takes 0.005 seconds. With the order by, the query t... | [
{
"answer_id": 467015,
"author": "Eppz",
"author_id": 48478,
"author_profile": "https://Stackoverflow.com/users/48478",
"pm_score": -1,
"selected": false,
"text": "<p>Is c.id an identity column? If it is, I don't think you'll need the DISTINCT in there since each c.id will be unique.</p>... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5441/"
] | I have the following query:
```
SELECT DISTINCT c.id
FROM clients AS c
LEFT JOIN client_project AS cp ON (cp.client_id = c.id)
WHERE cp.project_id = 1
AND c.active_flag = 1
ORDER BY c.client_name
```
If I remove the order by, the query takes 0.005 seconds. With the order by, the query takes 1.8-1.9 seconds. I ha... | looking at your edits
try using EXISTS in that case
```
SELECT c.id
FROM clients AS c
WHERE EXISTS (SELECT * FROM client_project AS cp
WHERE cp.client_id = c.id and cp.project_id = 1)
AND c.active_flag = 1
``` |
467,004 | <p>We're developing a site that will only run on the intranet, and computers with access to this intranet will have this executable installed. We can't have any "Would you like to open [filename].exe?" prompts. Click a link and the program begins running.</p>
<p>I realize that giving websites the ability to run exec... | [
{
"answer_id": 467014,
"author": "TheTXI",
"author_id": 22164,
"author_profile": "https://Stackoverflow.com/users/22164",
"pm_score": 0,
"selected": false,
"text": "<p>The only way I could possibly imagine this working is through some sort of ActiveX control which would run your executab... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34715/"
] | We're developing a site that will only run on the intranet, and computers with access to this intranet will have this executable installed. We can't have any "Would you like to open [filename].exe?" prompts. Click a link and the program begins running.
I realize that giving websites the ability to run executables on t... | >
> We're developing a site that will only run on the intranet, and computers with access to this intranet will have this executable installed.
>
>
>
Does this mean the EXE is already installed on the desktop? You just want to launch it from the website?
If so, you can associate the EXE with a [MIME Content Type... |
467,008 | <p>I could just create a form and use that to do a POST request to any site, thing is the FORM method isn't asynchronous, I need to know when the page has finished loading. I tried messing around with this using an iframe with a form inside, but no success. </p>
<p>Any ideas?</p>
<p><strong>EDIT</strong></p>
<p>unfo... | [
{
"answer_id": 467032,
"author": "Curtis Shipley",
"author_id": 57114,
"author_profile": "https://Stackoverflow.com/users/57114",
"pm_score": 1,
"selected": false,
"text": "<p>If the data returned from the cross domain post is JSON, then you can dynamically add a script tag pointing to t... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50394/"
] | I could just create a form and use that to do a POST request to any site, thing is the FORM method isn't asynchronous, I need to know when the page has finished loading. I tried messing around with this using an iframe with a form inside, but no success.
Any ideas?
**EDIT**
unfortunately I have no control over the ... | You can capture the `onload` event of an `iframe`. Target your `form` to the iframe and listen for the onload. You will not be able to access the contents of the iframe though, just the event.
Try something like this:
```
<iframe id='RS' name='RS' src='about:blank' onload='loaded()'></iframe>
<form action='wherever... |
467,013 | <p>I have an events calendar and on each event in the calendar there is an edit link which open up ajax <code>ModalPopupExtender</code> for editing the event information. The issue that I am facing right now is that the edit has to be in a form so it can update the information on the server.. </p>
<p>How do I deal wi... | [
{
"answer_id": 467032,
"author": "Curtis Shipley",
"author_id": 57114,
"author_profile": "https://Stackoverflow.com/users/57114",
"pm_score": 1,
"selected": false,
"text": "<p>If the data returned from the cross domain post is JSON, then you can dynamically add a script tag pointing to t... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43838/"
] | I have an events calendar and on each event in the calendar there is an edit link which open up ajax `ModalPopupExtender` for editing the event information. The issue that I am facing right now is that the edit has to be in a form so it can update the information on the server..
How do I deal with this? And what woul... | You can capture the `onload` event of an `iframe`. Target your `form` to the iframe and listen for the onload. You will not be able to access the contents of the iframe though, just the event.
Try something like this:
```
<iframe id='RS' name='RS' src='about:blank' onload='loaded()'></iframe>
<form action='wherever... |
467,016 | <p>Mind you, I am using master pages, but can I locate a div within the page and throw some html in there? Thanks. </p>
| [
{
"answer_id": 467022,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 4,
"selected": false,
"text": "<p>Use <code>asp:Panel</code> for that. It translates into a div.</p>\n"
},
{
"answer_id": 467061,
"autho... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4140/"
] | Mind you, I am using master pages, but can I locate a div within the page and throw some html in there? Thanks. | You can add a div with runat="server" to the page:
```
<div runat="server" id="myDiv">
</div>
```
and then set its InnerHtml property from the code-behind:
```
myDiv.InnerHtml = "your html here";
```
If you want to modify the DIV's contents on the client side, then you can use javascript code similar to this:
``... |
467,034 | <p>I've got a .Net web system with a VB.Net front end talking to a SQL Server 2005 back end over ADO.Net. Essentially, what I want to do is this:</p>
<pre><code>Dim command As SqlCommand = New SqlCommand("", connection)
command.CommandText = "SELECT * FROM someTable ORDER BY orderValue @SortOrder"
Dim sortParam As Sq... | [
{
"answer_id": 467037,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 1,
"selected": false,
"text": "<p>I don't think that is possible, only parameter values can be prepared.</p>\n"
},
{
"answer_id": 467041,
... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19074/"
] | I've got a .Net web system with a VB.Net front end talking to a SQL Server 2005 back end over ADO.Net. Essentially, what I want to do is this:
```
Dim command As SqlCommand = New SqlCommand("", connection)
command.CommandText = "SELECT * FROM someTable ORDER BY orderValue @SortOrder"
Dim sortParam As SqlParameter = Ne... | No, that won't work.
There are two possibilities that I can think of right off the top of my head to do what you're trying to do:
1. Build the SQL string dynamically
2. Return a Data Table from your query, and then use a View to do your sorting.
---
With another 6 years or so of experience (plus SQL Server Version... |
467,060 | <p>I know this is probably general, please bear with me!</p>
<p>We've got a program that uses a web camera and, based on what the camera is seeing, runs certain functions. The program runs excellently on MacOS and Linux, and it compiles and it <em>does run</em> on Windows, but a couple of the functions, (including one... | [
{
"answer_id": 467085,
"author": "Dima",
"author_id": 13313,
"author_profile": "https://Stackoverflow.com/users/13313",
"pm_score": 2,
"selected": false,
"text": "<p>What do you use to compile the program on Windows? Visual Studio? Cygwin? Are you sure you are not compiling a debug ve... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48957/"
] | I know this is probably general, please bear with me!
We've got a program that uses a web camera and, based on what the camera is seeing, runs certain functions. The program runs excellently on MacOS and Linux, and it compiles and it *does run* on Windows, but a couple of the functions, (including one that iterates pi... | What do you use to compile the program on Windows? Visual Studio? Cygwin? Are you sure you are not compiling a debug version? Have you turned on compiler optimization? You may also want to check your data types. You may be assuming int to be 64 bits, while you may be using 32-bit Windows, where it is 32 bits. |
467,077 | <p>I'm struggling a bit here so I thought why not ask:</p>
<p>Every entity in my system has a list of tags (a list of strings), and I want to be able to search for multiple tags at once.</p>
<p>I have a IQueryable to work with. Every Entity has a IList called Tags and my input parameter is a IList.</p>
<p>I simply c... | [
{
"answer_id": 467105,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure I really understand what you're asking, but maybe something like the following would work.</p>\n\n<pre><cod... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21699/"
] | I'm struggling a bit here so I thought why not ask:
Every entity in my system has a list of tags (a list of strings), and I want to be able to search for multiple tags at once.
I have a IQueryable to work with. Every Entity has a IList called Tags and my input parameter is a IList.
I simply could go through all tags... | From [here](https://stackoverflow.com/questions/163887/sql-query-simulating-an-and-over-several-rows-instead-of-sub-querying#163907), this is some sql that will work for you:
```
SELECT entityID
FROM tags
WHERE tagID in (...) --taglist
GROUP BY entityID
HAVING COUNT(DISTINCT tagID) = ... --tagcount
```
Now the trick... |
467,094 | <p>I'm looking to take a string and create a list of strings that build up the original string.</p>
<p>e.g.:</p>
<pre><code>"asdf" => ["a", "as", "asd", "asdf"]
</code></pre>
<p>I'm sure there's a "pythonic" way to do it; I think I'm just losing my mind. What's the best way to get this done?</p>
| [
{
"answer_id": 467102,
"author": "dF.",
"author_id": 3002,
"author_profile": "https://Stackoverflow.com/users/3002",
"pm_score": 5,
"selected": true,
"text": "<p>One possibility:</p>\n\n<pre><code>>>> st = 'asdf'\n>>> [st[:n+1] for n in range(len(st))]\n['a', 'as', 'asd... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm looking to take a string and create a list of strings that build up the original string.
e.g.:
```
"asdf" => ["a", "as", "asd", "asdf"]
```
I'm sure there's a "pythonic" way to do it; I think I'm just losing my mind. What's the best way to get this done? | One possibility:
```
>>> st = 'asdf'
>>> [st[:n+1] for n in range(len(st))]
['a', 'as', 'asd', 'asdf']
``` |
467,103 | <h2>Question</h2>
<p>Hello All,</p>
<p>I've had some confusion for quite some time with essentially flooring a DateTime SQL type using T-SQL. Essentially, I want to take a DateTime value of say 2008-12-1 14:30:12 and make it 2008-12-1 00:00:00. Alot of the queries we run for reports use a date value in the WHERE cl... | [
{
"answer_id": 467116,
"author": "Mark Brackett",
"author_id": 2199,
"author_profile": "https://Stackoverflow.com/users/2199",
"pm_score": 1,
"selected": false,
"text": "<pre><code>DATEADD(d, 0, DATEDIFF(d, 0, [tstamp]))\n</code></pre>\n\n<p>Edit: While this will remove the time portion ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23869/"
] | Question
--------
Hello All,
I've had some confusion for quite some time with essentially flooring a DateTime SQL type using T-SQL. Essentially, I want to take a DateTime value of say 2008-12-1 14:30:12 and make it 2008-12-1 00:00:00. Alot of the queries we run for reports use a date value in the WHERE clause, but I ... | that is very bad for performance, take a look at [Only In A Database Can You Get 1000% + Improvement By Changing A Few Lines Of Code](http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/only-in-a-database-can-you-get-1000-impr)
functions on the left side of the operator are bad
here is what you need to do
``... |
467,104 | <p>So it seemed easy enough. Use a series of nested loops to go though a ton of URLs sorted by year/month/day and download the XML files.
As this is my first script, I started with the loop; something familiar in any language. I ran it just printing the constructed URLs and it worked perfect.
I then wrote the code to ... | [
{
"answer_id": 467156,
"author": "regex",
"author_id": 23869,
"author_profile": "https://Stackoverflow.com/users/23869",
"pm_score": -1,
"selected": false,
"text": "<p>I have yet to use Perl, but at first glance I'm wondering if the exception is thrown as a result of a 404 error. I would... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27739/"
] | So it seemed easy enough. Use a series of nested loops to go though a ton of URLs sorted by year/month/day and download the XML files.
As this is my first script, I started with the loop; something familiar in any language. I ran it just printing the constructed URLs and it worked perfect.
I then wrote the code to dow... | Since <http://www.adatabase.com/1987/oct/20.xml> is a 404 (and isn't something that can be generated from your program anyway (no 'subheading' in the path), I'm assuming that isn't the real link you are using, which makes it hard for us to test. As a general rule, please use example.com instead of making up hostnames, ... |
467,112 | <p>I'm developing a Python web app as a learning exercise, and I am looking into making my app RESTful.</p>
<p>To that end, I want to be able to handle various types of HTTP actions/verbs where they are applicable. For example, if widget with id 12 is represented with the URI <a href="http://domain/widget/12" rel="no... | [
{
"answer_id": 467146,
"author": "Tracker1",
"author_id": 43906,
"author_profile": "https://Stackoverflow.com/users/43906",
"pm_score": 4,
"selected": true,
"text": "<p>From a browser, you will need to use XmlHttpRequest (Ajax) for the scenario you are describing. If your client, or ser... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5675/"
] | I'm developing a Python web app as a learning exercise, and I am looking into making my app RESTful.
To that end, I want to be able to handle various types of HTTP actions/verbs where they are applicable. For example, if widget with id 12 is represented with the URI <http://domain/widget/12>, and I want to give the en... | From a browser, you will need to use XmlHttpRequest (Ajax) for the scenario you are describing. If your client, or server doesn't support the additional methods, it's become common to use the custom X-HTTP-Method-Override header to specify the action. |
467,122 | <p>(<strong>Disclaimer:</strong> This question is <strong>not</strong> specific to ASP.NET)</p>
<p>I have a control which may be templated, similar to the login controls:</p>
<pre><code>public abstract class TemplatedControl : CompositeControl
{
public ITemplate Template { get; set; }
protected override void... | [
{
"answer_id": 467147,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 0,
"selected": false,
"text": "<p>Do you really want to use the exact same instance for the template control? We may need some more info about what ... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37815/"
] | (**Disclaimer:** This question is **not** specific to ASP.NET)
I have a control which may be templated, similar to the login controls:
```
public abstract class TemplatedControl : CompositeControl
{
public ITemplate Template { get; set; }
protected override void CreateChildControls()
{
var templa... | In this case I would say not. In the pattern you are proposing, there would only ever be one FooTemplate, which would be shared across multiple controls, pages and threads. You would have to be very careful that the template did not contain any request or user specific information, and also synchronize any method calls... |
467,149 | <p>I am generating associative arrays and the key value is a string concat of 1..n columns.</p>
<p>Is there a max length for keys that will come back to bite me? If so, I'll probably stop and do it differently.</p>
| [
{
"answer_id": 467184,
"author": "Lusid",
"author_id": 56855,
"author_profile": "https://Stackoverflow.com/users/56855",
"pm_score": 4,
"selected": false,
"text": "<p>There is no practical limit to string size in PHP. According to <a href=\"http://us.php.net/manual/en/language.types.stri... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57706/"
] | I am generating associative arrays and the key value is a string concat of 1..n columns.
Is there a max length for keys that will come back to bite me? If so, I'll probably stop and do it differently. | It seems to be limited only by the script's memory limit.
A quick test got me a key of 128mb no problem:
```
ini_set('memory_limit', '1024M');
$key = str_repeat('x', 1024 * 1024 * 128);
$foo = array($key => $key);
echo strlen(key($foo)) . "<br>";
echo strlen($foo[$key]) . "<br>";
``` |
467,166 | <p>I've encountered what seems like a chicken & egg problem, and have what I think is a logical solution. However, it occurred to me that others must have encountered something similar, so I figured I'd float it out there for the masses.</p>
<p>The situation is that I want to use dojo's addOnLoad function to queu... | [
{
"answer_id": 473519,
"author": "Maine",
"author_id": 37489,
"author_profile": "https://Stackoverflow.com/users/37489",
"pm_score": 5,
"selected": true,
"text": "<p>You're doing it correctly. External Javascript files are loaded and executed synchronously in order, so by the time it rea... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57699/"
] | I've encountered what seems like a chicken & egg problem, and have what I think is a logical solution. However, it occurred to me that others must have encountered something similar, so I figured I'd float it out there for the masses.
The situation is that I want to use dojo's addOnLoad function to queue up a number o... | You're doing it correctly. External Javascript files are loaded and executed synchronously in order, so by the time it reaches your `dojo.addOnLoad( ... );` Dojo has loaded. Use `dojo.addOnLoad` instead of `window.onload` for two reasons:
* it fires earlier, because it utilizes [DOMContentLoaded](http://dojotoolkit.or... |
467,172 | <p>I've written a query using Hibernate Criteria API to grab a summation of a particular value, now I need to be able to restrict the result to rows where that sum is greater or equal to a particular value.</p>
<p>Normally I would use a HAVING clause in my SQL to do this, but the Criteria API doesn't seem to support t... | [
{
"answer_id": 490591,
"author": "Aidan Boyle",
"author_id": 32719,
"author_profile": "https://Stackoverflow.com/users/32719",
"pm_score": 3,
"selected": false,
"text": "<p>I don't know of a way for Hibernate/NHibernate to use a subquery in the FROM clause but you can use them in the WHE... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57701/"
] | I've written a query using Hibernate Criteria API to grab a summation of a particular value, now I need to be able to restrict the result to rows where that sum is greater or equal to a particular value.
Normally I would use a HAVING clause in my SQL to do this, but the Criteria API doesn't seem to support that at thi... | I don't know of a way for Hibernate/NHibernate to use a subquery in the FROM clause but you can use them in the WHERE clause.
Apologies for any Java/Hibernate code mistakes, I am more familiar with C#/NHibernate.
```
DetachedCriteria subQuery = DetachedCriteria.forClass(Transaction.class);
subQuery.setProjection(Proj... |
467,176 | <p><strong>Duplicate</strong>: <a href="https://stackoverflow.com/questions/263836/generating-sql-schema-from-xml">Generating SQL Schema from XML</a></p>
<hr>
<p>In a project i am working on, i have a need to support either a strongly-typed dataset for storing the data as XML, or storing the data in sql server. Now i... | [
{
"answer_id": 468095,
"author": "Chris Nava",
"author_id": 45163,
"author_profile": "https://Stackoverflow.com/users/45163",
"pm_score": 1,
"selected": false,
"text": "<p>I would write some XSLT to turn the XSD into SQL create statements.</p>\n"
},
{
"answer_id": 468488,
"au... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18811/"
] | **Duplicate**: [Generating SQL Schema from XML](https://stackoverflow.com/questions/263836/generating-sql-schema-from-xml)
---
In a project i am working on, i have a need to support either a strongly-typed dataset for storing the data as XML, or storing the data in sql server. Now i already have the XSD schema create... | I managed to come up with the following class based on the SQL Server Management Objects:
```
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Text;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Smo;
using ... |
467,180 | <p>I am attempting to write a XML parser in VB6.<br>
The standards that the XML is based off of comes with a DTD to verify the XML before you begin parsing. I have also written a sample XML file so that I have something with which to test.</p>
<p>I am able to load the XML via the vb6 code </p>
<pre><code>Dim objXMLD... | [
{
"answer_id": 467526,
"author": "mercator",
"author_id": 23263,
"author_profile": "https://Stackoverflow.com/users/23263",
"pm_score": 2,
"selected": true,
"text": "<p>I can't reproduce your error. It works just fine with both files in the same folder for me.</p>\n\n<p>It's not a proble... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am attempting to write a XML parser in VB6.
The standards that the XML is based off of comes with a DTD to verify the XML before you begin parsing. I have also written a sample XML file so that I have something with which to test.
I am able to load the XML via the vb6 code
```
Dim objXMLDoc As MSXML.DOMDocument... | I can't reproduce your error. It works just fine with both files in the same folder for me.
It's not a problem of the DTD not being well-formed either; that throws another error. I get the same error as you if it can't find the DTD, while I get error `-1072896757` ("Invalid character found in DTD.") if it does find my... |
467,188 | <p>Why when I access an aspx (e.g., <a href="http://www.example.com/foo.aspx" rel="noreferrer">http://www.example.com/foo.aspx</a> - not the real site) through IE6 would I get a 404 Error (i.e., "The page cannot be found") in IIS6</p>
<p>I've got scripts enabled for the website and I've tried with executables enabled... | [
{
"answer_id": 467192,
"author": "Chuck Conway",
"author_id": 17360,
"author_profile": "https://Stackoverflow.com/users/17360",
"pm_score": 0,
"selected": false,
"text": "<p>The site is pointing to a different directory where the page is not. </p>\n\n<p>It could be permissions, however I... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/685/"
] | Why when I access an aspx (e.g., <http://www.example.com/foo.aspx> - not the real site) through IE6 would I get a 404 Error (i.e., "The page cannot be found") in IIS6
I've got scripts enabled for the website and I've tried with executables enabled as well.
Here is the full error:
```
The page cannot be found
The pa... | It could be a lot of things. I had this issue today because .NET had not been re-initialized after installing IIS (`aspnet_regiis -i -enable` or equivalent). |
467,190 | <p>I have an XML column in my table which contains this xsd snippet:</p>
<pre><code><xsd:element name="Postcode" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="^[0-9]{4}$" />
</xsd:restriction>
</xsd:simpleTyp... | [
{
"answer_id": 467257,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 1,
"selected": false,
"text": "<p>Does your source XML look like this:</p>\n\n<pre><code><Postcode>1234</Postcode>\n</code></pre>\n\n<p>o... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an XML column in my table which contains this xsd snippet:
```
<xsd:element name="Postcode" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:pattern value="^[0-9]{4}$" />
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
```
The regular expression ... | Does your source XML look like this:
```
<Postcode>1234</Postcode>
```
or like this:
```
<Postcode>
1234
</Postcode>
```
Since you are trimming the string (with `^` and `$`) make sure that your XML looks like the former and not the latter. |
467,202 | <p>Does anyone know how to insert a line break into a summary comment in order for the line break to be reflected in Intellisense documentation? </p>
<p>To clarify, assume code documentation..</p>
<pre><code>/// <summary>
/// Some text documentation
/// - a line break -
/// Some more documentation
/// </su... | [
{
"answer_id": 467211,
"author": "Brian Kim",
"author_id": 5704,
"author_profile": "https://Stackoverflow.com/users/5704",
"pm_score": 6,
"selected": false,
"text": "<p>Try using this.</p>\n\n<pre><code>/// <summary>\n/// <para>Paragraph 1.</para>\n/// <para>Parag... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27805/"
] | Does anyone know how to insert a line break into a summary comment in order for the line break to be reflected in Intellisense documentation?
To clarify, assume code documentation..
```
/// <summary>
/// Some text documentation
/// - a line break -
/// Some more documentation
/// </summary>
public void SomeMethod(... | Try using this.
```
/// <summary>
/// <para>Paragraph 1.</para>
/// <para>Paragraph 2.</para>
/// </summary>
```
But I don't think you can have an actual empty line.
Empty para tag gets ignored. |
467,232 | <p>Lets say I'm converting a whole bunch of content pages - dumb HTML - over to MVC model.</p>
<p>I'd want to stick all the plain HTML files in a directory and 'find' them based on a controller.</p>
<p>This kind of appears to be what the 'HomeController' in the standard ASP.NET-MVC is doing, but I have to explicitly ... | [
{
"answer_id": 467253,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "<p>Update the route handler in global.asax to ignore routing for your static pages. To make this easier I would put th... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] | Lets say I'm converting a whole bunch of content pages - dumb HTML - over to MVC model.
I'd want to stick all the plain HTML files in a directory and 'find' them based on a controller.
This kind of appears to be what the 'HomeController' in the standard ASP.NET-MVC is doing, but I have to explicitly add each page.
`... | Update the route handler in global.asax to ignore routing for your static pages. To make this easier I would put them in a separate directory.
```
routes.IgnoreRoute("static/myfile.htm");
``` |
467,235 | <p>I want to write a simple servlet in JBoss which will call a method on a Spring bean. The purpose is to allow a user to kick off an internal job by hitting a URL.</p>
<p>What is the easiest way to get hold of a reference to my Spring bean in the servlet?</p>
<p>JBoss web services allow you to inject a WebServiceCon... | [
{
"answer_id": 467312,
"author": "Sophie Gage",
"author_id": 37134,
"author_profile": "https://Stackoverflow.com/users/37134",
"pm_score": 3,
"selected": false,
"text": "<p>I've found one way to do it:</p>\n\n<pre><code>WebApplicationContext context = WebApplicationContextUtils.getWebApp... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37134/"
] | I want to write a simple servlet in JBoss which will call a method on a Spring bean. The purpose is to allow a user to kick off an internal job by hitting a URL.
What is the easiest way to get hold of a reference to my Spring bean in the servlet?
JBoss web services allow you to inject a WebServiceContext into your se... | Your servlet can use WebApplicationContextUtils to get the application context, but then your servlet code will have a direct dependency on the Spring Framework.
Another solution is configure the application context to export the Spring bean to the servlet context as an attribute:
```
<bean class="org.springframework... |
467,242 | <p>I'm writing an ASP.NET application. When a specific kind of request is being handled, I want to schedule a method to be called in a certain number of minutes after the request is handled. The postponed method does not need to communicate with the client that made the original request, it is just intended to do some... | [
{
"answer_id": 467261,
"author": "M4N",
"author_id": 19635,
"author_profile": "https://Stackoverflow.com/users/19635",
"pm_score": 1,
"selected": false,
"text": "<p>You could start a timer (System.Timers.Timer) from one of the application event in global.asax.cs (e.g. in Application_Begi... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40047/"
] | I'm writing an ASP.NET application. When a specific kind of request is being handled, I want to schedule a method to be called in a certain number of minutes after the request is handled. The postponed method does not need to communicate with the client that made the original request, it is just intended to do some "ho... | In Global.asax use this to check your incoming request:
```
protected void Application_BeginRequest(object sender, EventArgs e)
{
CheckRequest(HttpContext.Current.Request);
}
```
if your request is valid, register a cache entry:
```
private void CheckRequest(HttpRequest request)
{
... |
467,249 | <p>Given a domain object (say, for example, Person), should that object contain its Data Mapper (Person_Mapper)?</p>
<p>For example, I could have an inactivate action work in these two different ways:</p>
<pre><code>$mapper = new Person_Mapper();
$person = $mapper->load(1);
$person->active = false;
$mapper-&g... | [
{
"answer_id": 467280,
"author": "James L",
"author_id": 2700,
"author_profile": "https://Stackoverflow.com/users/2700",
"pm_score": 4,
"selected": true,
"text": "<p>The Person class should only know Person stuff, therefore shouldn't contain anything to do with data mapping.</p>\n\n<p>Se... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20178/"
] | Given a domain object (say, for example, Person), should that object contain its Data Mapper (Person\_Mapper)?
For example, I could have an inactivate action work in these two different ways:
```
$mapper = new Person_Mapper();
$person = $mapper->load(1);
$person->active = false;
$mapper->save($person);
```
Or lik... | The Person class should only know Person stuff, therefore shouldn't contain anything to do with data mapping.
See <http://en.wikipedia.org/wiki/Single_responsibility_principle> |
467,255 | <p>I currently rely on anchor tags to perform AJAX requests on my web application (using jQuery). For example:</p>
<pre><code><script type="text/javascript">
$(document).ready(function() {
$("#test").click(function() {
// Perform AJAX call and manipulate the DOM
});
});
... | [
{
"answer_id": 467283,
"author": "Kevin",
"author_id": 26620,
"author_profile": "https://Stackoverflow.com/users/26620",
"pm_score": 1,
"selected": false,
"text": "<p>Read about <a href=\"http://en.wikipedia.org/wiki/Unobtrusive_JavaScript\" rel=\"nofollow noreferrer\">Unobtrusive JavaSc... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1574/"
] | I currently rely on anchor tags to perform AJAX requests on my web application (using jQuery). For example:
```
<script type="text/javascript">
$(document).ready(function() {
$("#test").click(function() {
// Perform AJAX call and manipulate the DOM
});
});
<a id="test" href="">... | The answer I was looking for is buried in one of the comments:
>
> your use of the `<a>` tag to do an HTTP
> POST operation is conflicting. `<a>` was
> designed for HTTP GET. You won't find
> a satisfactory answer here if you keep
> the semantics of your operation
> embedded in an `<a>` tag. See
> <http://www.w... |
467,262 | <p>I'm just getting into ASP.NET MVC and was a little confused in the sample app why 'HomeController' is called 'HomeController'.</p>
<p>It seems to be a better name would be 'DefaultController' or 'ContentController'.</p>
<p>Its really a little misleading because its name implies that its got something to do with co... | [
{
"answer_id": 467317,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 1,
"selected": false,
"text": "<p>Home is pretty ubiquitous on the web (Home Page). I think it's a perfectly reasonable choice for the name of the de... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] | I'm just getting into ASP.NET MVC and was a little confused in the sample app why 'HomeController' is called 'HomeController'.
It seems to be a better name would be 'DefaultController' or 'ContentController'.
Its really a little misleading because its name implies that its got something to do with controlling the hom... | Home is pretty ubiquitous on the web (Home Page). I think it's a perfectly reasonable choice for the name of the default controller. I actually prefer it over default or content because default implies that there is some alternative and content, in my mind, applies to all of my application entirely or to the specific H... |
467,267 | <p>I have the following Perl code:</p>
<pre><code>my $progName = shift ;
open(IPLAYERLIST, "iplayer-list.html") or die "Cannot open iplayer index file iplayer-list.html\n" ;
while (<IPLAYERLIST>) {
if ( /($progName)/is ) {
#if ( /Just A Minute/is ) { <-- This works!
my $iplayerID = $1 ;
... | [
{
"answer_id": 467334,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 0,
"selected": false,
"text": "<p>There doesn't seem to be anything wrong with your example. It works just fine in my tests.</p>\n\n<p>Can you giv... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have the following Perl code:
```
my $progName = shift ;
open(IPLAYERLIST, "iplayer-list.html") or die "Cannot open iplayer index file iplayer-list.html\n" ;
while (<IPLAYERLIST>) {
if ( /($progName)/is ) {
#if ( /Just A Minute/is ) { <-- This works!
my $iplayerID = $1 ;
print "IPlayer prog... | Your program (the first one) works fine for me.
Note that you have to quote the argument sting (because it contains spaces), otherwise you're just looking for a match with "Just". So run it like this...
perl yourprog.pl "Just A Minute"
I ran it with this input file:
```
Foo
Just A Minute
Bar
```
Which outputs...
... |
467,276 | <p>So far the association works fine (the <code>User</code> class loads the appropriate <code>UserRoles</code> instance when present), but when creating a new <code>User</code> and setting its <code>Roles</code> property to a new instance of <code>UserRoles</code>, the <code>UserRoles</code> object is not saved.</p>
<... | [
{
"answer_id": 467328,
"author": "James L",
"author_id": 2700,
"author_profile": "https://Stackoverflow.com/users/2700",
"pm_score": 0,
"selected": false,
"text": "<p>I'm probably missing something, but do you need a one-to-one between User and UserRoles? Can you not just have a one-to-... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17847/"
] | So far the association works fine (the `User` class loads the appropriate `UserRoles` instance when present), but when creating a new `User` and setting its `Roles` property to a new instance of `UserRoles`, the `UserRoles` object is not saved.
Here is my abridged User.hbm.xml:
```
<?xml version="1.0" encoding="utf-8... | Usually you don't need one-to-one, unless you're stuck with an immutable legacy database schema. Most User-Role mappings allow for users to be in multiple roles and roles to be allowed to be used by any number of users, which means an associative table for a many-to-many association.
If your app only needs one role p... |
467,282 | <p>Is there a limit to the number of joins permitted in a JPA/Hibernate query?</p>
<p>Since Hibernate <a href="http://www.hibernate.org/118.html#A23" rel="nofollow noreferrer">doesn't automatically join</a>, I have to explicitly specify the joins in my JPA/Hibernate query. For example, person has an address, an addres... | [
{
"answer_id": 467308,
"author": "James L",
"author_id": 2700,
"author_profile": "https://Stackoverflow.com/users/2700",
"pm_score": 1,
"selected": false,
"text": "<p>There is nothing within the Hibernate code which limits the number of joins. This could be a bug in the dialect, or a l... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24396/"
] | Is there a limit to the number of joins permitted in a JPA/Hibernate query?
Since Hibernate [doesn't automatically join](http://www.hibernate.org/118.html#A23), I have to explicitly specify the joins in my JPA/Hibernate query. For example, person has an address, an address has a state. The following query retrieves pe... | The question is why are you trying to make such a complex query in the first place?
Have you considered different approaches? The documentation on [improving performance](http://www.hibernate.org/hib_docs/v3/reference/en-US/html/performance.html) makes some suggestions. |
467,290 | <p>I am using spring-ws with Jaxb2Marshaller, PayloadRootAnnotationMethodEndpointMapping and GenericMarshallingMethodEndpointAdapter to configure my web services via the @Endpoint and @PayloadRoot annotations.</p>
<p>When I try to use the DAO's of my project I am able to load objects from the database but as soon as I... | [
{
"answer_id": 467356,
"author": "Simon Groenewolt",
"author_id": 31884,
"author_profile": "https://Stackoverflow.com/users/31884",
"pm_score": 2,
"selected": false,
"text": "<p>Wrap a org.springframework.aop.framework.ProxyFactoryBean around the object in the spring context that needs t... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30967/"
] | I am using spring-ws with Jaxb2Marshaller, PayloadRootAnnotationMethodEndpointMapping and GenericMarshallingMethodEndpointAdapter to configure my web services via the @Endpoint and @PayloadRoot annotations.
When I try to use the DAO's of my project I am able to load objects from the database but as soon as I try to ac... | In the meanwhile I found a solution. This forum entry gave me the hint:
<http://forum.springframework.org/showthread.php?t=50284>
Basically I added the @Transactional annotations to my web service implementation class. The tricky part was to tell spring to use the original class (not the proxy created by tx:annotatio... |
467,300 | <p>It is not really a question because I have already found a solution. It took me a lot of time, that's why I want to explain it here.</p>
<p>Msxml is based on COM so it is not really easy to use in C++ even when you have helpful classes to deal with memory allocation issues. But writing a new XML parser would be muc... | [
{
"answer_id": 467337,
"author": "ctacke",
"author_id": 13154,
"author_profile": "https://Stackoverflow.com/users/13154",
"pm_score": 1,
"selected": false,
"text": "<p>Another option would to use another XML parser that is already done, <a href=\"http://expat.sourceforge.net/\" rel=\"nof... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32354/"
] | It is not really a question because I have already found a solution. It took me a lot of time, that's why I want to explain it here.
Msxml is based on COM so it is not really easy to use in C++ even when you have helpful classes to deal with memory allocation issues. But writing a new XML parser would be much more dif... | I'm happy I posted my question although I already had a solution because I got several alternative solutions. Thanks for all your answers.
Using another parser such as [eXpat](http://expat.sourceforge.net/) or the maybe smaller (not so powerfull but enough for my needs) [TinyXML](http://www.grinninglizard.com/tinyxml)... |
467,322 | <p>Is there any performance difference between using something like</p>
<pre><code>for(int i = 0; i < 10; i++) { ... }
</code></pre>
<p>and</p>
<pre><code>for(int i = 0; i < 10; ++i) { ... }
</code></pre>
<p>or is the compiler able to optimize in such a way that they are equally fast in the case where they ar... | [
{
"answer_id": 467345,
"author": "M4N",
"author_id": 19635,
"author_profile": "https://Stackoverflow.com/users/19635",
"pm_score": 0,
"selected": false,
"text": "<p>According to <a href=\"https://stackoverflow.com/questions/437026/in-c-what-is-the-difference-between-myint-and-myint#43712... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/341413/"
] | Is there any performance difference between using something like
```
for(int i = 0; i < 10; i++) { ... }
```
and
```
for(int i = 0; i < 10; ++i) { ... }
```
or is the compiler able to optimize in such a way that they are equally fast in the case where they are functionally equivalent?
Edit:
This was asked becaus... | There is no difference in the generated intermediate code for ++i and i++ in this case. Given this program:
```
class Program
{
const int counter = 1024 * 1024;
static void Main(string[] args)
{
for (int i = 0; i < counter; ++i)
{
Console.WriteLine(i);
}
for (in... |
467,336 | <p>I'm trying to add a row to a table and have that row slide into view, however the slidedown function seems to be adding a display:block style to the table row which messes up the layout.</p>
<p>Any ideas how to work around this?</p>
<p>Here's the code:</p>
<pre><code>$.get('/some_url',
{ 'val1': id },
funct... | [
{
"answer_id": 467374,
"author": "Paolo Bergantino",
"author_id": 16417,
"author_profile": "https://Stackoverflow.com/users/16417",
"pm_score": 2,
"selected": false,
"text": "<p>You could try wrapping the contents of the row in a <code><span></code> and having your selector be <cod... | 2009/01/21 | [
"https://Stackoverflow.com/questions/467336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13009/"
] | I'm trying to add a row to a table and have that row slide into view, however the slidedown function seems to be adding a display:block style to the table row which messes up the layout.
Any ideas how to work around this?
Here's the code:
```
$.get('/some_url',
{ 'val1': id },
function (data) {
var row = $... | Animations are not supported on table rows.
From "Learning jQuery" by Chaffer and Swedberg
---
>
> Table rows present particular
> obstacles to animation, since browsers
> use different values (table-row and
> block) for their visible display
> property. The .hide() and .show()
> methods, without animation, ar... |