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 |
|---|---|---|---|---|---|---|
277,224 | <p>I can use <code>set_error_handler()</code> to catch most PHP errors, but it doesn't work for fatal (<code>E_ERROR</code>) errors, such as calling a function that doesn't exist. Is there another way to catch these errors?</p>
<p>I am trying to call <code>mail()</code> for all errors and am running PHP 5.2.3.</p>
| [
{
"answer_id": 277387,
"author": "troelskn",
"author_id": 18180,
"author_profile": "https://Stackoverflow.com/users/18180",
"pm_score": 3,
"selected": false,
"text": "<p>Not really. Fatal errors are called that, because they are fatal. You can't recover from them.</p>\n"
},
{
"an... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28835/"
] | I can use `set_error_handler()` to catch most PHP errors, but it doesn't work for fatal (`E_ERROR`) errors, such as calling a function that doesn't exist. Is there another way to catch these errors?
I am trying to call `mail()` for all errors and am running PHP 5.2.3. | Log fatal errors using the `register_shutdown_function`, which requires PHP 5.2+:
```
register_shutdown_function( "fatal_handler" );
function fatal_handler() {
$errfile = "unknown file";
$errstr = "shutdown";
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last();
if($error !== NU... |
277,247 | <p>How do I add a certain number of days to the current date in PHP?</p>
<p>I already got the current date with:</p>
<pre><code>$today = date('y:m:d');
</code></pre>
<p>Just need to add x number of days to it</p>
| [
{
"answer_id": 277251,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 5,
"selected": false,
"text": "<p>a day is 86400 seconds.</p>\n\n<pre><code>$tomorrow = date('y:m:d', time() + 86400);\n</code></pre>\n"
},
{
"answer... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do I add a certain number of days to the current date in PHP?
I already got the current date with:
```
$today = date('y:m:d');
```
Just need to add x number of days to it | `php` supports c style date functions. You can add or substract date-periods with English-language style phrases via the `strtotime` function. examples...
```
$Today=date('y:m:d');
// add 3 days to date
$NewDate=Date('y:m:d', strtotime('+3 days'));
// subtract 3 days from date
$NewDate=Date('y:m:d', strtotime('-3 da... |
277,256 | <p>Is it possible to have a CSS rule which basically "undoes" a prior rule?</p>
<p>An example:</p>
<pre><code><blockquote>
some text <em>more text</em> other text
</blockquote>
</code></pre>
<p>and let's say there's this CSS:</p>
<pre><code>blockquote {
color: red;
}
</code></pre>
<... | [
{
"answer_id": 277270,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 0,
"selected": false,
"text": "<p>Ok, the additional text with example clarifies the question a lot. And I'm affraid that what you want is not possi... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | Is it possible to have a CSS rule which basically "undoes" a prior rule?
An example:
```
<blockquote>
some text <em>more text</em> other text
</blockquote>
```
and let's say there's this CSS:
```
blockquote {
color: red;
}
```
...but I want the `<em>` to remain the normal text color (which you may not ne... | With CSS alone, you can't refer to a parent's parent.
The thing you can do is try a mix of specific CSS selectors and markup so that the desired effect appears.
```
<td>
This is the enclosing element.
<ul>
<li>This is the first level UL, direct child of TD
<ul>
<li>This is the second level UL<... |
277,284 | <p>I've been playing around with ASP.NET MVC and had a question. Or maybe its a concern that I am doing this wrong. Just working on a lame site to stretch my wings a bit. I am sorry this question is not at all concise.</p>
<p>Ok, here's the scenario. When the user visits home/index, the page should show a list of ... | [
{
"answer_id": 281712,
"author": "anonymous",
"author_id": 36602,
"author_profile": "https://Stackoverflow.com/users/36602",
"pm_score": 2,
"selected": false,
"text": "<p>[edit:</p>\n\n<p>I was thinking, you have 2 cases:</p>\n\n<ul>\n<li>the Home controller is the only one that ever ref... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32203/"
] | I've been playing around with ASP.NET MVC and had a question. Or maybe its a concern that I am doing this wrong. Just working on a lame site to stretch my wings a bit. I am sorry this question is not at all concise.
Ok, here's the scenario. When the user visits home/index, the page should show a list of products and a... | >
> Because I was calling RenderAction()
> from a view in Product
>
>
> ...
>
>
> I do not understand why I needed
> to specify the full path of the view.
> It would make sense to me for the
> relative name to be interpreted
> relative to the current view's path
> rather than the original controller's
> view path
... |
277,288 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/334879/how-do-i-get-the-application-exit-code-from-a-windows-command-line">How do I get the application exit code from a Windows command line?</a> </p>
</blockquote>
<p>In Unix/bash, I can simply say:</p>
<blo... | [
{
"answer_id": 277292,
"author": "CiNN",
"author_id": 2566,
"author_profile": "https://Stackoverflow.com/users/2566",
"pm_score": 2,
"selected": false,
"text": "<p>check for the ERRORLEVEL</p>\n"
},
{
"answer_id": 277302,
"author": "JesperE",
"author_id": 13051,
"auth... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10955/"
] | >
> **Possible Duplicate:**
>
> [How do I get the application exit code from a Windows command line?](https://stackoverflow.com/questions/334879/how-do-i-get-the-application-exit-code-from-a-windows-command-line)
>
>
>
In Unix/bash, I can simply say:
>
> $ echo $?
>
>
>
to find out the return/exit code o... | Use "errorlevel", like this:
```
IF ERRORLEVEL 1 GOTO ERROR
```
The errorlevel command is a little peculiar; it returns true if the return code was equal to or **higher** than the specified errorlevel. You can also write
```
IF %ERRORLEVEL% NEQ 0 GOTO ERROR
```
[This page](http://www.robvanderwoude.com/errorlevel... |
277,291 | <p>In Eclipse RCP way of doing things, where should I keep my model objects? And when they are loaded or changed, how should they talk to the views?</p>
<p>I am attempting to port my existing application to Eclipse RCP. It could be viewed as an IDE-like application: I open a file, which contains links to source files.... | [
{
"answer_id": 277411,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 4,
"selected": true,
"text": "<p>I believe this is best achieved through Listeners.</p>\n\n<p>Your data (model) is in private package, and only Interfaces of ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3827/"
] | In Eclipse RCP way of doing things, where should I keep my model objects? And when they are loaded or changed, how should they talk to the views?
I am attempting to port my existing application to Eclipse RCP. It could be viewed as an IDE-like application: I open a file, which contains links to source files. The sourc... | I believe this is best achieved through Listeners.
Your data (model) is in private package, and only Interfaces of those data are exposed in a public package.

You will find in this [wiki section](http://wiki.eclipse.org/JFace_Data_Binding_Introduction) the pr... |
277,316 | <p>I place the following statements in the second row of my grid in the xaml:</p>
<pre><code><ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="1">
<ListView Name="listView" Margin="5" Grid.Row="1">
<ListView.View>
<GridView AllowsColumnReorder="Tr... | [
{
"answer_id": 277436,
"author": "Artur Carvalho",
"author_id": 1013,
"author_profile": "https://Stackoverflow.com/users/1013",
"pm_score": 2,
"selected": false,
"text": "<p>See that the margins and paddings are correct. The scrollbar can be behind something.</p>\n\n<p>Put the exterior c... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I place the following statements in the second row of my grid in the xaml:
```
<ScrollViewer VerticalScrollBarVisibility="Auto" Grid.Row="1">
<ListView Name="listView" Margin="5" Grid.Row="1">
<ListView.View>
<GridView AllowsColumnReorder="True">
<GridV... | It works for me:
```
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
... |
277,327 | <p>Is there a built in way to determine if a component is fully visible in a Flex application (i.e. not offscreen one way or the other). If not how would I go about figurin it out?</p>
<p>I want to show or hide additional 'next' and 'previous' buttons if my primary 'next' and 'previous' buttons are off screen.</p>
<p... | [
{
"answer_id": 277426,
"author": "Jim Carroll",
"author_id": 35922,
"author_profile": "https://Stackoverflow.com/users/35922",
"pm_score": 0,
"selected": false,
"text": "<p>Could you give the specifics of the visible item and the container(s) it's in? Is it a matter of having to scroll ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277327",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] | Is there a built in way to determine if a component is fully visible in a Flex application (i.e. not offscreen one way or the other). If not how would I go about figurin it out?
I want to show or hide additional 'next' and 'previous' buttons if my primary 'next' and 'previous' buttons are off screen.
What event would... | here is a method for calculating if the component is within the bounds of the stage, it will not however tell you if the component is being hidden by another component, or if the component is being hidden because it is outside the bounds of another container.
```
public function isComponentWithinStage(c:UIComponent):B... |
277,340 | <p>I'm executing a query like this</p>
<pre><code>select field from table;
</code></pre>
<p>In that query, there is a loop running on many tables. So, if the field is not present in a table I get a </p>
<blockquote>
<p>Runtime Error 3061</p>
</blockquote>
<p>How can I by pass this error such as that on this error... | [
{
"answer_id": 277366,
"author": "JTeagle",
"author_id": 162171,
"author_profile": "https://Stackoverflow.com/users/162171",
"pm_score": 0,
"selected": false,
"text": "<p>Try this: </p>\n\n<p>On Error Resume Next ' If an error occurs, move to next statement.</p>\n\n<p>...statement that... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31132/"
] | I'm executing a query like this
```
select field from table;
```
In that query, there is a loop running on many tables. So, if the field is not present in a table I get a
>
> Runtime Error 3061
>
>
>
How can I by pass this error such as that on this error flow should go to another point?
This is the code I h... | Rather than trapping the error, why not use the TableDefs to check for the field or use a mixture of ADO and DAO? ADO Schemas can provide a list of tables that contain the required field:
```
Function ListTablesContainingField()
Dim cn As New ADODB.Connection, cn2 As New ADODB.Connection
Dim rs As ADODB.Recordset, rs2... |
277,345 | <p>I want to be able to compare Dates and Times in Rails without always having to call the to_time or to_date method. So I wrote the following code:</p>
<pre><code>class Date
def ==(other)
if other.kind_of?(Time)
self.to_time == other
else
super(other)
end
end
end
</code></pre>
<p>I know t... | [
{
"answer_id": 277520,
"author": "Christoph Schiessl",
"author_id": 20467,
"author_profile": "https://Stackoverflow.com/users/20467",
"pm_score": 0,
"selected": false,
"text": "<p>Your example looks okay, but I wouldn't use <code>kind_of?</code> - if <code>other</code> doesn't implement ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11082/"
] | I want to be able to compare Dates and Times in Rails without always having to call the to\_time or to\_date method. So I wrote the following code:
```
class Date
def ==(other)
if other.kind_of?(Time)
self.to_time == other
else
super(other)
end
end
end
```
I know there's an easy way to wr... | The easiest way to make any old Ruby class comparable is to implement the <=> instance method and include the [Comparable](http://www.ruby-doc.org/core/classes/Comparable.html) mixin. You'll get the >, <, >=, <=, ==, etc. methods for free then.
One way of approaching this is to re-open the Date and Time classes to `in... |
277,351 | <p>What is a mathematical way of of saying 1 - 1 = 12 for a month calculation? Adding is easy, 12 + 1 % 12 = 1, but subtraction introduces 0, stuffing things up.</p>
<p>My actual requirement is x = x + d, where x must always be between 1 and 12 before and after the summing, and d any unsigned integer.</p>
| [
{
"answer_id": 277355,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>Assuming x and y are both in the range 1-12:</p>\n\n<pre><code>((x - y + 11) % 12) + 1\n</code></pre>\n\n<p>To break ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | What is a mathematical way of of saying 1 - 1 = 12 for a month calculation? Adding is easy, 12 + 1 % 12 = 1, but subtraction introduces 0, stuffing things up.
My actual requirement is x = x + d, where x must always be between 1 and 12 before and after the summing, and d any unsigned integer. | I'd work internally with a 0 based month (0-11), summing one for external consumption only (output, another calling method expecting 1-12, etc.), that way you can wrap around backwards just as easily as wrapping around forward.
```
>>> for i in range(15):
... print '%d + 1 => %d' % (i, (i+1)%12)
...
0 + 1 => 1
1 + 1 ... |
277,368 | <p>I hate to have to ask, but I'm pretty stuck here.</p>
<p>I need to test a sequence of numbers to find the first which has over 500 factors:
<a href="http://projecteuler.net/index.php?section=problems&id=12" rel="nofollow noreferrer">http://projecteuler.net/index.php?section=problems&id=12</a></p>
<p>-At fi... | [
{
"answer_id": 277372,
"author": "Martin",
"author_id": 24364,
"author_profile": "https://Stackoverflow.com/users/24364",
"pm_score": 3,
"selected": true,
"text": "<p>As far as I can tell, question 12 doesn't mention anything about prime numbers? Is this the one you're looking at? </p>\n... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15075/"
] | I hate to have to ask, but I'm pretty stuck here.
I need to test a sequence of numbers to find the first which has over 500 factors:
<http://projecteuler.net/index.php?section=problems&id=12>
-At first I attempted to brute force the answer (finding a number with 480 after a LONG time)
-I am now looking at determinin... | As far as I can tell, question 12 doesn't mention anything about prime numbers? Is this the one you're looking at?
>
> The sequence of triangle numbers is generated by adding the natural numbers...
>
>
>
If so, then perhaps not thinking about primes will help? ;) |
277,384 | <p>I have a little Perl script (On Windows) that checks some files for me as an aid to my day-to-day business. At the moment it prints out something like...</p>
<pre><code>0%
25%
50%
75%
Complete
</code></pre>
<p>But I can remember scripts I've used in the past that didn't print progress on a line-by-line basis, but ... | [
{
"answer_id": 277389,
"author": "Jarod Elliott",
"author_id": 1061,
"author_profile": "https://Stackoverflow.com/users/1061",
"pm_score": 2,
"selected": false,
"text": "<p>You should be able to print a backspace character '\\b' to move the cursor back so you can overwrite what you print... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974/"
] | I have a little Perl script (On Windows) that checks some files for me as an aid to my day-to-day business. At the moment it prints out something like...
```
0%
25%
50%
75%
Complete
```
But I can remember scripts I've used in the past that didn't print progress on a line-by-line basis, but which updated the output o... | In addition to the other answers, \r will go back to the beginning of the current line |
277,409 | <p>I want to store a list of the following tuples in a compressed format and I was wondering which algorithm gives me</p>
<ul>
<li>smallest compressed size</li>
<li>fastest de/compression</li>
<li>tradeoff optimum ("knee" of the tradeoff curve)</li>
</ul>
<p>My data looks like this:</p>
<pre><code>(<int>, <... | [
{
"answer_id": 277434,
"author": "schnaader",
"author_id": 34065,
"author_profile": "https://Stackoverflow.com/users/34065",
"pm_score": 3,
"selected": true,
"text": "<p>Since the \"time\" ints can be close to each other, try to only store the first and after that save the difference to ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2077/"
] | I want to store a list of the following tuples in a compressed format and I was wondering which algorithm gives me
* smallest compressed size
* fastest de/compression
* tradeoff optimum ("knee" of the tradeoff curve)
My data looks like this:
```
(<int>, <int>, <double>),
(<int>, <int>, <double>),
...
(<int>, <int>... | Since the "time" ints can be close to each other, try to only store the first and after that save the difference to the int before (delta-coding). You can try the same for the second int, too.
Another thing you can try is to reorganize the data from [int1, int2, double], [int1, int2, double]... to [int1, int1...], [in... |
277,423 | <p>Does anybody know how I can see the actual machine code that <a href="http://code.google.com/p/v8/" rel="noreferrer">v8</a> generates from Javascript? I've gotten as far as <code>Script::Compile()</code> in <code>src/api.cc</code> but I can't figure out where to go from there.</p>
| [
{
"answer_id": 277807,
"author": "Mike G.",
"author_id": 18901,
"author_profile": "https://Stackoverflow.com/users/18901",
"pm_score": 1,
"selected": false,
"text": "<p>You're on the right track, I think.</p>\n\n<p>It looks like you need to get from Script::Compile to Compiler::Compile, ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36128/"
] | Does anybody know how I can see the actual machine code that [v8](http://code.google.com/p/v8/) generates from Javascript? I've gotten as far as `Script::Compile()` in `src/api.cc` but I can't figure out where to go from there. | I don't know how to invoke the disassembler from C++ code, but there is a quick-and-dirty way to get a disassembly from the shell.
First, compile v8 with disassembler support:
```
scons [your v8 build options here] disassembler=on sample=shell
```
Now you can invoke the shell with the "--print\_code" option:
```
.... |
277,431 | <p>I have huge number of Word files I need to merge (join) into one file, and will be time consuming to use the Word merger (one by one). Have you experienced any tool that can handle this job?</p>
| [
{
"answer_id": 277433,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried using the Word COM api? You can automate lots of things - maybe you can automate a merge.</p>\n\n... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1233512/"
] | I have huge number of Word files I need to merge (join) into one file, and will be time consuming to use the Word merger (one by one). Have you experienced any tool that can handle this job? | ```vb
Sub MergeAllDocuments(AllDocumentsPath as String, MasterDocumentPath as String)
Dim MasterDocument As Document
Set MasterDocument = Documents.Open(FileName:=MasterDocumentPath)
TheDocumentPath = Dir(AllDocumentsPath , vbNormal)
While TheDocumentPath <> ""
' Append the next doc to the end of the mast... |
277,437 | <p>This has got to be something simple: I set up a frames page with two possible sources for the target frame based on a form with two options. I used the OnClick event to trap the user's click to show the appropriate page. It works fine in Internet Explorer 7, swapping the two source pages. FireFox 3 and Chrome sh... | [
{
"answer_id": 277451,
"author": "Jack Ryan",
"author_id": 28882,
"author_profile": "https://Stackoverflow.com/users/28882",
"pm_score": 0,
"selected": false,
"text": "<p>I don't believe that getElementById works on frames in firefox. I have always used the frames[\"frameID\"], which see... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3125/"
] | This has got to be something simple: I set up a frames page with two possible sources for the target frame based on a form with two options. I used the OnClick event to trap the user's click to show the appropriate page. It works fine in Internet Explorer 7, swapping the two source pages. FireFox 3 and Chrome show only... | You are using getElementByID, but you aren't specifying IDs for your inputs. Perhaps consider this instead:
```
function SwapInlineFrameSource(rdoButton)
{
rsiFrame = document.getElementById("RatesFrame");
rsiFrame.src = rdoButton.value;
}
<input type="radio" value="SantaCruzRates.htm" checked="checked" name="Cou... |
277,438 | <p>Generally, I like to keep an application completely ignorant of the IoC container. However I have ran into problems where I needed to access it. To abstract away the pain I use a basic Singleton. Before you run for the hills or pull out the shotgun, let me go over my solution. Basically, the IoC singleton does a... | [
{
"answer_id": 277554,
"author": "chrissie1",
"author_id": 2936,
"author_profile": "https://Stackoverflow.com/users/2936",
"pm_score": 2,
"selected": false,
"text": "<p>That's not really a singleton class. That's a static class with static members. And yes that seems a good approach. </p... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5802/"
] | Generally, I like to keep an application completely ignorant of the IoC container. However I have ran into problems where I needed to access it. To abstract away the pain I use a basic Singleton. Before you run for the hills or pull out the shotgun, let me go over my solution. Basically, the IoC singleton does absolutl... | I've seen that even Ayende implements this pattern in the Rhino Commons code, but I'd advise against using it wherever possible. There's a reason Castle Windsor doesn't have this code by default. StructureMap does, but Jeremy Miller has been moving away from it. Ideally, you should regard the container itself with as m... |
277,485 | <p>In Python, if I do this:</p>
<pre><code>print "4" * 4
</code></pre>
<p>I get</p>
<pre><code>> "4444"
</code></pre>
<p>In Perl, I'd get</p>
<pre><code>> 16
</code></pre>
<p>Is there an easy way to do the former in Perl?</p>
| [
{
"answer_id": 277489,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 8,
"selected": true,
"text": "<pre><code>$ perl -e 'print "4" x 4; print "\\n"'\n4444\n</code></pre>\n<p>The x operator is docu... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974/"
] | In Python, if I do this:
```
print "4" * 4
```
I get
```
> "4444"
```
In Perl, I'd get
```
> 16
```
Is there an easy way to do the former in Perl? | ```
$ perl -e 'print "4" x 4; print "\n"'
4444
```
The x operator is documented in perldoc [perlop](http://perldoc.perl.org/perlop.html). Here binary means an operator taking two arguments, not composed of bits, by the way.
>
> Binary "x" is the repetition operator. In scalar context or if the
> left operand is not... |
277,492 | <p>In a database, I have a string that contains "default" written in it. I just want to replace that default with 0. I have something like: </p>
<pre><code>select * from tblname where test = 'default'
</code></pre>
<p>I do not want quotes in the replacement for "default".</p>
<p>I want </p>
<pre><code>select * from... | [
{
"answer_id": 277503,
"author": "Dave Anderson",
"author_id": 371,
"author_profile": "https://Stackoverflow.com/users/371",
"pm_score": 0,
"selected": false,
"text": "<p>I think you would be better using format strings</p>\n\n<pre><code>string myVar = \"0\";\nstring sql = String.Format(... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In a database, I have a string that contains "default" written in it. I just want to replace that default with 0. I have something like:
```
select * from tblname where test = 'default'
```
I do not want quotes in the replacement for "default".
I want
```
select * from tblname where test = 0
```
is there any w... | I'm assuming the field `test` is of a text type (varchar, char, or the like).
First: Update the table to contain '0' where it contains 'default'.
```
UPDATE tblname SET test = '0' WHERE test = 'default'
```
Then: Select all rows with '0' in them. You can't leave off the quotes, because they are part of the SQL synt... |
277,494 | <p>I am trying to let a piece of runtime state decide WHICH implementation of an interface to use, preferably solely by autowiring. </p>
<p>I have tried making an object factory for the interface thet uses dynamic proxies, and I used qualifiers to coerce the @Autowired injections to use the factory. The qualifiers are... | [
{
"answer_id": 277503,
"author": "Dave Anderson",
"author_id": 371,
"author_profile": "https://Stackoverflow.com/users/371",
"pm_score": 0,
"selected": false,
"text": "<p>I think you would be better using format strings</p>\n\n<pre><code>string myVar = \"0\";\nstring sql = String.Format(... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23691/"
] | I am trying to let a piece of runtime state decide WHICH implementation of an interface to use, preferably solely by autowiring.
I have tried making an object factory for the interface thet uses dynamic proxies, and I used qualifiers to coerce the @Autowired injections to use the factory. The qualifiers are necessary... | I'm assuming the field `test` is of a text type (varchar, char, or the like).
First: Update the table to contain '0' where it contains 'default'.
```
UPDATE tblname SET test = '0' WHERE test = 'default'
```
Then: Select all rows with '0' in them. You can't leave off the quotes, because they are part of the SQL synt... |
277,502 | <p>My schema specifies a namespace, but the documents don't. What's the simplest way to ignore namespace during JAXB unmarshalling (XML -> object)?</p>
<p>In other words, I have</p>
<pre><code><foo><bar></bar></foo>
</code></pre>
<p>instead of,</p>
<pre><code><foo xmlns="http://tempuri.or... | [
{
"answer_id": 277512,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 5,
"selected": true,
"text": "<p>I believe you must <a href=\"https://download.oracle.com/javaee-archive/jaxb.java.net/users/2008/05/7860.html\" rel=\"nofollo... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3827/"
] | My schema specifies a namespace, but the documents don't. What's the simplest way to ignore namespace during JAXB unmarshalling (XML -> object)?
In other words, I have
```
<foo><bar></bar></foo>
```
instead of,
```
<foo xmlns="http://tempuri.org/"><bar></bar></foo>
``` | I believe you must [add the namespace](https://download.oracle.com/javaee-archive/jaxb.java.net/users/2008/05/7860.html) to your xml document, with, for example, the use of a [SAX filter](https://web.archive.org/web/20090113211510/http://www.digitalkarate.net/?p=63).
That means:
* Define a ContentHandler interface wi... |
277,529 | <p>I’m currently using the OpenNETCF.Desktop.Communication.dll to copy files from my desktop to a CE device, but I keep getting an error:</p>
<p>‘Could not create remote file’ </p>
<p>My development environment is VS2005 (VB.NET)</p>
<p>My code:</p>
<pre><code>ObjRapi.Connect()
ObjRapi.CopyFileToDevice("C:\results.... | [
{
"answer_id": 277548,
"author": "Nathan W",
"author_id": 6335,
"author_profile": "https://Stackoverflow.com/users/6335",
"pm_score": 2,
"selected": true,
"text": "<p>I have run into this once before but I can't really remember what was causing it.</p>\n\n<p>The only thing I can think of... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1731/"
] | I’m currently using the OpenNETCF.Desktop.Communication.dll to copy files from my desktop to a CE device, but I keep getting an error:
‘Could not create remote file’
My development environment is VS2005 (VB.NET)
My code:
```
ObjRapi.Connect()
ObjRapi.CopyFileToDevice("C:\results.txt", "\results.txt")
ObjRapi.Dispo... | I have run into this once before but I can't really remember what was causing it.
The only thing I can think of from looking at your code is this line:
```
ObjRapi.CopyFileToDevice("C:\results.txt", "\ \results.txt")
```
I'm not sure but you could try and change the destination path to something different. Somethi... |
277,544 | <p>Is there a simple way to <strong>set the focus</strong> (input cursor) of a web page <strong>on the first input element</strong> (textbox, dropdownlist, ...) on loading the page without having to know the id of the element?</p>
<p>I would like to implement it as a common script for all my pages/forms of my web appl... | [
{
"answer_id": 277555,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 3,
"selected": false,
"text": "<p>There's a write-up here that may be of use: <a href=\"http://www.codeproject.com/KB/scripting/FocusFirstInput.aspx\" re... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6461/"
] | Is there a simple way to **set the focus** (input cursor) of a web page **on the first input element** (textbox, dropdownlist, ...) on loading the page without having to know the id of the element?
I would like to implement it as a common script for all my pages/forms of my web application. | You can also try jQuery based method:
```
$(document).ready(function() {
$('form:first *:input[type!=hidden]:first').focus();
});
``` |
277,546 | <p>Just say I have a file: "HelloWorld.pm" in multiple subdirectories within a Git repository.</p>
<p>I would like to issue a command to find the full paths of all the files matching "HelloWorld.pm":</p>
<p>For example:</p>
<pre><code>/path/to/repository/HelloWorld.pm
/path/to/repository/but/much/deeper/down/HelloWo... | [
{
"answer_id": 277557,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 5,
"selected": false,
"text": "<p>Try:</p>\n\n<pre><code>git ls-tree -r HEAD | grep HelloWorld.pm\n</code></pre>\n"
},
{
"answer_id": 5681657,
... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36142/"
] | Just say I have a file: "HelloWorld.pm" in multiple subdirectories within a Git repository.
I would like to issue a command to find the full paths of all the files matching "HelloWorld.pm":
For example:
```
/path/to/repository/HelloWorld.pm
/path/to/repository/but/much/deeper/down/HelloWorld.pm
/path/to/repository/p... | [`git ls-files`](http://www.kernel.org/pub/software/scm/git/docs/git-ls-files.html) will give you a listing of all files in current state of the repository (the cache or index). You can pass a pattern in to get files matching that pattern.
```
git ls-files HelloWorld.pm '**/HelloWorld.pm'
```
If you would like to fi... |
277,551 | <p>It looks like all the methods for loading SQLite involve loading from a named file using a string. I would like to load SQlite database from memory.</p>
<p>The database is already loaded into memory.</p>
| [
{
"answer_id": 277558,
"author": "Alex B",
"author_id": 23643,
"author_profile": "https://Stackoverflow.com/users/23643",
"pm_score": 5,
"selected": true,
"text": "<p>Use a special file name, <code>:memory:</code></p>\n\n<pre><code>sqlite3_open(\":memory:\", &db);\n</code></pre>\n\n<... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35223/"
] | It looks like all the methods for loading SQLite involve loading from a named file using a string. I would like to load SQlite database from memory.
The database is already loaded into memory. | Use a special file name, `:memory:`
```
sqlite3_open(":memory:", &db);
```
`libsqlite` must have been compiled **without** `SQLITE_OMIT_MEMORYDB` defined, as pointed out in [SQLite documentation](http://www.sqlite.org/compile.html):
>
> **`SQLITE_OMIT_MEMORYDB`**
>
>
>
> >
> > When this is defined, the library... |
277,569 | <p>In PHP, is there an easy way to convert a number to a word? For instance, <em>27</em> to <em>twenty-seven</em>.</p>
| [
{
"answer_id": 277586,
"author": "Chris",
"author_id": 4742,
"author_profile": "https://Stackoverflow.com/users/4742",
"pm_score": 6,
"selected": true,
"text": "<p>I <a href=\"http://bloople.net/num2text/cnumlib.txt\" rel=\"noreferrer\">found</a> some (2007/2008) source-code online and a... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21709/"
] | In PHP, is there an easy way to convert a number to a word? For instance, *27* to *twenty-seven*. | I [found](http://bloople.net/num2text/cnumlib.txt) some (2007/2008) source-code online and as it is copyright but I can use it freely and modify it however I want, so I place it here and re-license under CC-Wiki:
```
<?php
/**
* English Number Converter - Collection of PHP functions to convert a number
* ... |
277,589 | <p>How to perform validation for a radio button group (one radio button should be selected) using jQuery validation plugin?</p>
| [
{
"answer_id": 1843196,
"author": "Mahes",
"author_id": 301960,
"author_profile": "https://Stackoverflow.com/users/301960",
"pm_score": 5,
"selected": false,
"text": "<p>use the following rule for validating radio button group selection</p>\n\n<pre><code>myRadioGroupName : {required :tru... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27052/"
] | How to perform validation for a radio button group (one radio button should be selected) using jQuery validation plugin? | With newer releases of jquery (1.3+ I think), all you have to do is set one of the members of the radio set to be required and jquery will take care of the rest:
```
<input type="radio" name="myoptions" value="blue" class="required"> Blue<br />
<input type="radio" name="myoptions" value="red"> Red<br />
<input type="r... |
277,607 | <p>After tinkering around to solve [this][1] problem, I think the core of the problem is the following:</p>
<p>When you use the Html.RadioButton() html helper with an Enum as value field, you can only choose your option once. AFter reposting the page, the helpers will ignore the value set in the call and set all radio... | [
{
"answer_id": 277671,
"author": "Cristian Libardo",
"author_id": 16526,
"author_profile": "https://Stackoverflow.com/users/16526",
"pm_score": 0,
"selected": false,
"text": "<p>One thing to check. Are you using the updated model to render your view? I.e. is the same model data that was ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | After tinkering around to solve [this][1] problem, I think the core of the problem is the following:
When you use the Html.RadioButton() html helper with an Enum as value field, you can only choose your option once. AFter reposting the page, the helpers will ignore the value set in the call and set all radio buttons t... | This is due to a bug in the ASP.NET MVC Beta code. I wrote a full explanation of the issue at asp.net MVC forum. Refer to this [link](http://forums.asp.net/t/1338576.aspx) |
277,618 | <ul>
<li>What exactly is a learning curve?</li>
<li>And why is it wrong to use the term "steep learning curve" for something which has high entry barriers and takes quite some time to get into?</li>
</ul>
<p>As to the why-ness of this question:</p>
<ul>
<li>The terms are used often and inconsistently on Stack Overflo... | [
{
"answer_id": 277631,
"author": "markus",
"author_id": 11995,
"author_profile": "https://Stackoverflow.com/users/11995",
"pm_score": 3,
"selected": false,
"text": "<p>from Widipedia:</p>\n\n<blockquote>\n <p>The term learning curve refers to the\n graphical relation between the amount... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11995/"
] | * What exactly is a learning curve?
* And why is it wrong to use the term "steep learning curve" for something which has high entry barriers and takes quite some time to get into?
As to the why-ness of this question:
* The terms are used often and inconsistently on Stack Overflow
* I myself have been confused by it
*... | It's a curve of time versus proficiency.
Steep for hard is wrong because it'd mean that you get very proficient in very little time
```
proficiency
| __
| |
| | Proficient in little time (steep = easy)
| |
|_/____________
time
proficiency
|
| Proficient in lots of time (gentle = h... |
277,623 | <p>I'm trying to get a Server application to expose some status information using WCF.
In particular I'm after using WCF services with RESTful "API".
I'm hitting somewhat of a wall when it comes to consuming the REST api from a silverlight
app/page that I want to have as an additional type of client...</p>
<p>So far I... | [
{
"answer_id": 283260,
"author": "Rob",
"author_id": 34224,
"author_profile": "https://Stackoverflow.com/users/34224",
"pm_score": 1,
"selected": false,
"text": "<p>I almost hate to suggest it but would you feel comfortable with <a href=\"http://msdn.microsoft.com/en-us/library/ms405827(... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9172/"
] | I'm trying to get a Server application to expose some status information using WCF.
In particular I'm after using WCF services with RESTful "API".
I'm hitting somewhat of a wall when it comes to consuming the REST api from a silverlight
app/page that I want to have as an additional type of client...
So far I've been s... | I almost hate to suggest it but would you feel comfortable with [reimplementing the WebChannelFactory<T> class](http://msdn.microsoft.com/en-us/library/ms405827(VS.95).aspx "ChannelFactoryBase<TChannel>")?
From a cursory glance through the Silverlight API it looks like you won't get much help from Microsoft out of the... |
277,630 | <p>Is it possible to use a DB sequence for some column that <strong>is not the identifier/is not part of a composite identifier</strong>? </p>
<p>I'm using hibernate as jpa provider, and I have a table that has some columns that are generated values (using a sequence), although they are not part of the identifier.</p>... | [
{
"answer_id": 282774,
"author": "Frederic Morin",
"author_id": 4064,
"author_profile": "https://Stackoverflow.com/users/4064",
"pm_score": -1,
"selected": false,
"text": "<p>I've been in a situation like you (JPA/Hibernate sequence for non @Id field) and I ended up creating a trigger in... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22992/"
] | Is it possible to use a DB sequence for some column that **is not the identifier/is not part of a composite identifier**?
I'm using hibernate as jpa provider, and I have a table that has some columns that are generated values (using a sequence), although they are not part of the identifier.
What I want is to use a s... | Looking for answers to this problem, I stumbled upon [this link](http://forum.hibernate.org/viewtopic.php?p=2405140)
It seems that Hibernate/JPA isn't able to automatically create a value for your non-id-properties. The `@GeneratedValue` annotation is only used in conjunction with `@Id` to create auto-numbers.
The `@... |
277,634 | <p>still new to the world of linq, and i need some help flatening a list of parents that have children, into a single list of ParentChild's.</p>
<p>Just like this:</p>
<pre><code>class Program
{
static void Main()
{
List<Parent> parents = new List<Parent>();
parents.Add(new Parent... | [
{
"answer_id": 277637,
"author": "Kent Boogaart",
"author_id": 5380,
"author_profile": "https://Stackoverflow.com/users/5380",
"pm_score": 5,
"selected": true,
"text": "<pre><code>from parent in parents\nfrom child in parent.Children\nselect new ParentChild() { ParentName = parent.Name, ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26759/"
] | still new to the world of linq, and i need some help flatening a list of parents that have children, into a single list of ParentChild's.
Just like this:
```
class Program
{
static void Main()
{
List<Parent> parents = new List<Parent>();
parents.Add(new Parent { Name = "Parent1", Children = n... | ```
from parent in parents
from child in parent.Children
select new ParentChild() { ParentName = parent.Name, ChildName = child.Name };
``` |
277,640 | <p>SPListItem.GetFormattedValue seems to have a strange behavior for DateTime fields.
It retrieves the DateTime value through SPListItem's indexer which according to this <a href="http://msdn.microsoft.com/en-us/library/ms197282.aspx" rel="noreferrer">MSDN article</a> returns <em>local</em> time.
Here's a snippet from ... | [
{
"answer_id": 278934,
"author": "Nat",
"author_id": 13813,
"author_profile": "https://Stackoverflow.com/users/13813",
"pm_score": 0,
"selected": false,
"text": "<p>I have had a recognised bug with the date conversion from UTC in SharePoint. It was fixed in SP1.</p>\n"
},
{
"answ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/578/"
] | SPListItem.GetFormattedValue seems to have a strange behavior for DateTime fields.
It retrieves the DateTime value through SPListItem's indexer which according to this [MSDN article](http://msdn.microsoft.com/en-us/library/ms197282.aspx) returns *local* time.
Here's a snippet from Reflector
```
public string GetFormat... | Converting the date back to universal time before calling GetFieldValueAsHtml works just fine.
```
DateTime localTime = (DateTime)item["DueDate"];
// this is local time but if you do localDateTime.Kind it returns Unspecified
// treats the date as universal time..
// let's give it the universal time :)
DateTime univer... |
277,646 | <p>I am having a number of panels in my page in which I am collecting user information and saving the page details. The page panel has textbox, dropdown list, listbox.</p>
<p>When I need to come to this page. I need to show the Page if these controls have any values. How to do this?</p>
| [
{
"answer_id": 277654,
"author": "Cristian Libardo",
"author_id": 16526,
"author_profile": "https://Stackoverflow.com/users/16526",
"pm_score": 6,
"selected": true,
"text": "<p>It boils down to enumerating all the controls in the control hierarchy:</p>\n\n<pre><code> IEnumerable<Co... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277646",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22162/"
] | I am having a number of panels in my page in which I am collecting user information and saving the page details. The page panel has textbox, dropdown list, listbox.
When I need to come to this page. I need to show the Page if these controls have any values. How to do this? | It boils down to enumerating all the controls in the control hierarchy:
```
IEnumerable<Control> EnumerateControlsRecursive(Control parent)
{
foreach (Control child in parent.Controls)
{
yield return child;
foreach (Control descendant in EnumerateControlsRecursive(child)... |
277,660 | <p>3/10/2008 = 1822556159</p>
<p>2/10/2008 = 1822523391</p>
<p>1/10/2008 = 1822490623</p>
<p>30/09/2008 = 1822392319</p>
<p>29/09/2008 = 1822359551</p>
<p>This is all the information that I know at the current time. </p>
<p>Dates increment by 32768 except when changing month when the increment is 32768 x 2 (65536... | [
{
"answer_id": 277683,
"author": "Alnitak",
"author_id": 6782,
"author_profile": "https://Stackoverflow.com/users/6782",
"pm_score": 3,
"selected": false,
"text": "<p>September 30th 2008</p>\n\n<pre><code>1822392319 = 0x6c9f7fff\n0x6c = 108 = 2008 (based on 1900 start date)\n0x9 = 9 = Se... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | 3/10/2008 = 1822556159
2/10/2008 = 1822523391
1/10/2008 = 1822490623
30/09/2008 = 1822392319
29/09/2008 = 1822359551
This is all the information that I know at the current time.
Dates increment by 32768 except when changing month when the increment is 32768 x 2 (65536).
Has anyone seen this binary date format a... | September 30th 2008
```
1822392319 = 0x6c9f7fff
0x6c = 108 = 2008 (based on 1900 start date)
0x9 = 9 = September
0xf7fff - take top 5 bits = 0x1e = 30
```
October 1st 2008
```
1822490623 = 0x6ca0ffff
0x6c = 108 = 2008
0xa = 10 = October
0x0ffff - take top 5 bits = 0x01 = 1
```
It's anyone's guess what the remai... |
277,715 | <p>i tried the following</p>
<ol>
<li><code>svnadmin create svn_repos</code></li>
<li><code>svn import my_first_proj file:///c:/svn_repos -m "initial import"</code></li>
<li><code>svn checkout file:///c:/svn_repos</code></li>
</ol>
<p>and the command returned</p>
<pre><code>A svn_repos\trunk
A svn_repos\trunk\... | [
{
"answer_id": 277737,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 1,
"selected": false,
"text": "<p>Are you sure it's not just hidden (they are by default)?</p>\n\n<p>Try running <code>dir /AH</code></p>\n"
},
{
"a... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | i tried the following
1. `svnadmin create svn_repos`
2. `svn import my_first_proj file:///c:/svn_repos -m "initial import"`
3. `svn checkout file:///c:/svn_repos`
and the command returned
```
A svn_repos\trunk
A svn_repos\trunk\Sample.txt.txt
A svn_repos\branches
A svn_repos\branches\my_pers_branch
Check... | Perhaps you're expecting to find that .svn directory inside the my\_first\_proj directory. Currently, your svn is checked out inside a "svn\_repos" directory, relative to the path you typed in the checkout command. What you may want to do is :
```
svn checkout --force file:///c:/svn_repos/ my_first_proj
```
Which c... |
277,726 | <p>I have a query that is currently using a correlated subquery to return the results, but I am thinking the problem could be solved more eloquently perhaps using ROW_NUMBER().</p>
<p>The problem is around the profile of a value v, through a number of years for an Item. Each item has a number of versions, each with i... | [
{
"answer_id": 277740,
"author": "splattne",
"author_id": 6461,
"author_profile": "https://Stackoverflow.com/users/6461",
"pm_score": 0,
"selected": false,
"text": "<p>I think it's okay how you do it. You could check if there is a <strong>composite index on ItemId and Year</strong>.</p>\... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21197/"
] | I have a query that is currently using a correlated subquery to return the results, but I am thinking the problem could be solved more eloquently perhaps using ROW\_NUMBER().
The problem is around the profile of a value v, through a number of years for an Item. Each item has a number of versions, each with its own pro... | I would do it with a CTE:
```
WITH Result AS
(
SELECT Row_Number() OVER (PARTITION BY ItemId, Year
ORDER BY ItemversionId DESC) AS RowNumber
,ItemId
,ItemversionId
,Year
,Value
FROM table
)
SELECT ItemId
,ItemversionId
,Year
,Value
FROM Result
WHERE RowNumber = 1
ORDER BY ItemId, Year... |
277,744 | <p>I'm getting an Exception while trying to insert a row in oracle table.
I'm using ojdbc5.jar for oracle 11
this is the sql i'm trying </p>
<pre><code>INSERT INTO rule_definitions(RULE_DEFINITION_SYS,rule_definition_type,
rule_name,rule_text,rule_comment,rule_message,rule_condition,rule_active,
rule_type,current_valu... | [
{
"answer_id": 277754,
"author": "madlep",
"author_id": 14160,
"author_profile": "https://Stackoverflow.com/users/14160",
"pm_score": 0,
"selected": false,
"text": "<p>Without seeing the code, the only thing I can think of is to check that each connection is being accessed in a thread sa... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11247/"
] | I'm getting an Exception while trying to insert a row in oracle table.
I'm using ojdbc5.jar for oracle 11
this is the sql i'm trying
```
INSERT INTO rule_definitions(RULE_DEFINITION_SYS,rule_definition_type,
rule_name,rule_text,rule_comment,rule_message,rule_condition,rule_active,
rule_type,current_value,last_modifie... | In Oracle Metalink (Oracle's support site - Note ID 736273.1) I found that this is a bug in JDBC adapter (version 10.2.0.0.0 to 11.1.0.7.0) that when you call preparedStatement with more than 7 positional parameters then JDBC will throw this error.
If you have access to Oracle Metalink then one option is to go there a... |
277,771 | <p>How do I create, execute and control a winform from within a console application?</p>
| [
{
"answer_id": 277776,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 8,
"selected": true,
"text": "<p>The easiest option is to start a windows forms project, then change the output-type to Console Application. Alterna... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30717/"
] | How do I create, execute and control a winform from within a console application? | The easiest option is to start a windows forms project, then change the output-type to Console Application. Alternatively, just add a reference to System.Windows.Forms.dll, and start coding:
```
using System.Windows.Forms;
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.Run(new ... |
277,772 | <p>I keep stumbling on the format specifiers for the printf() family of functions. What I want is to be able to print a double (or float) with a maximum given number of digits after the decimal point. If I use:</p>
<pre><code>printf("%1.3f", 359.01335);
printf("%1.3f", 359.00999);
</code></pre>
<p>I get</p>
<pre><... | [
{
"answer_id": 277779,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 6,
"selected": false,
"text": "<p>To get rid of the trailing zeros, you should use the \"%g\" format:</p>\n\n<pre><code>float num = 1.33;\nprintf(\"%g\",... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25824/"
] | I keep stumbling on the format specifiers for the printf() family of functions. What I want is to be able to print a double (or float) with a maximum given number of digits after the decimal point. If I use:
```
printf("%1.3f", 359.01335);
printf("%1.3f", 359.00999);
```
I get
```
359.013
359.010
```
Instead of t... | This can't be done with the normal `printf` format specifiers. The closest you could get would be:
```
printf("%.6g", 359.013); // 359.013
printf("%.6g", 359.01); // 359.01
```
but the ".6" is the *total* numeric width so
```
printf("%.6g", 3.01357); // 3.01357
```
breaks it.
What you *can* do is to `sprintf("%... |
277,775 | <p>I want to call a c# function from my javascript function.</p>
<p>I have a link button in my ascx (please see the code below). The problem is that if you press enter in firefox is not working however it is working fine in internet explorer.</p>
<pre><code><li class="clearfix border_top">
<label for="title"... | [
{
"answer_id": 277779,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 6,
"selected": false,
"text": "<p>To get rid of the trailing zeros, you should use the \"%g\" format:</p>\n\n<pre><code>float num = 1.33;\nprintf(\"%g\",... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30394/"
] | I want to call a c# function from my javascript function.
I have a link button in my ascx (please see the code below). The problem is that if you press enter in firefox is not working however it is working fine in internet explorer.
```
<li class="clearfix border_top">
<label for="title" class="first_column bold">Sea... | This can't be done with the normal `printf` format specifiers. The closest you could get would be:
```
printf("%.6g", 359.013); // 359.013
printf("%.6g", 359.01); // 359.01
```
but the ".6" is the *total* numeric width so
```
printf("%.6g", 3.01357); // 3.01357
```
breaks it.
What you *can* do is to `sprintf("%... |
277,793 | <p>I'm using Java's <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/Transformer.html" rel="nofollow noreferrer">Transformer</a> class to process an XML Document object.</p>
<p>This is the code that creates the Transformer:</p>
<pre><code>import javax.xml.transform.TransformerFactory;
import javax... | [
{
"answer_id": 277848,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https://Stackoverflow.com/users/8709",
"pm_score": 0,
"selected": false,
"text": "<p>The package description for <a href=\"http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/package-summary.html... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15649/"
] | I'm using Java's [Transformer](http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/transform/Transformer.html) class to process an XML Document object.
This is the code that creates the Transformer:
```
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Tran... | Note that `<svg xmlns="SVGNS" />` is the same as `<svg:svg xmlns:svg="SVGNS" />`.
Did you check you called `setNamespaceAware(true)` on your `DocumentBuilderFactory` instance ? |
277,817 | <h2>Scenario</h2>
<p>I have two wrappers around Microsoft Office, one for 2003 and one for 2007. Since having two versions of Microsoft Office running side by side is "not officially possible" nor recommended by Microsoft, we have two boxes, one with Office 2003 and the other with Office 2007. We compile the wrappers ... | [
{
"answer_id": 277835,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "<p>Just a thought - could you use TlbExp to create two interop assemblies (with different names and assemblies), and ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277817",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2684/"
] | Scenario
--------
I have two wrappers around Microsoft Office, one for 2003 and one for 2007. Since having two versions of Microsoft Office running side by side is "not officially possible" nor recommended by Microsoft, we have two boxes, one with Office 2003 and the other with Office 2007. We compile the wrappers sep... | When the .NET assembly resolver is unable to find a referenced assembly at runtime (in this case, it cannot find the particular wrapper DLL version the application was linked against), its default behavior is to fail and essentially crash the application. However, this behavior can be overridden by hooking the AppDomai... |
277,857 | <p>This code does not seem to compile, I just need to write something to a small log text file (a new row to end of file).</p>
<pre><code><%@ Import Namespace="System.IO" %>
void Page_Load( object sender, EventArgs e ){
FileSystem myFileSystem = new FileSystem();
myFileSystem.WriteAllText(logFile, hash... | [
{
"answer_id": 277868,
"author": "Winston Smith",
"author_id": 35086,
"author_profile": "https://Stackoverflow.com/users/35086",
"pm_score": 2,
"selected": false,
"text": "<p>FileSystem is a class from the VisualBasic namespace:</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20979/"
] | This code does not seem to compile, I just need to write something to a small log text file (a new row to end of file).
```
<%@ Import Namespace="System.IO" %>
void Page_Load( object sender, EventArgs e ){
FileSystem myFileSystem = new FileSystem();
myFileSystem.WriteAllText(logFile, hash, false);
``` | I can't see any class called FileSystem in [the `System.IO` namespace](http://msdn.microsoft.com/en-us/library/system.io.aspx). Is this something new in .NET 4.0 which you're trying to use?
Note that the [`File`](http://msdn.microsoft.com/en-us/library/system.io.file.aspx) class has a *static* method called [`WriteAll... |
277,869 | <p>In a piece of C# that I am writing at the moment I need to handle several methods with the same signature in the same way. Also there might be more of these methods in the future. Instead of repeating the same kind of logic over and over I thought up the following:</p>
<pre><code>private delegate bool cleanStep(Bui... | [
{
"answer_id": 277882,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>Why not use a foreach loop and just break? (I've renamed <code>cleanStep</code> to <code>CleanStep</code> here for co... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6434/"
] | In a piece of C# that I am writing at the moment I need to handle several methods with the same signature in the same way. Also there might be more of these methods in the future. Instead of repeating the same kind of logic over and over I thought up the following:
```
private delegate bool cleanStep(BuildData bd, out... | Why not use a foreach loop and just break? (I've renamed `cleanStep` to `CleanStep` here for conventionality - I suggest you do the same.)
```
foreach(CleanStep step in steps)
{
string failureText;
if (!step(build, out failureText))
{
logger.Write(LogTypes.Error, strFailure);
break;
}
}... |
277,881 | <p>I have a WCF service, hosted in IIS 7.0 that needs to run database queries. In order to get the right permissions to do this I am impersonating within the service as follows:</p>
<h3>Code</h3>
<pre><code>[OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
public void MyOperation(int arg)
</code></pre>... | [
{
"answer_id": 277918,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 0,
"selected": false,
"text": "<p>Hmmm... I don't know. However, you could force the dll to load early on. Since you are using IIS, this would presu... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/994/"
] | I have a WCF service, hosted in IIS 7.0 that needs to run database queries. In order to get the right permissions to do this I am impersonating within the service as follows:
### Code
```
[OperationBehavior(Impersonation = ImpersonationOption.Allowed)]
public void MyOperation(int arg)
```
### Configuration
```
<be... | If you want the SQL queries to be executed as the impersonated identity, you may actually need to enable delegation to your SQL server. Check out this article for more info:
<http://msdn.microsoft.com/en-us/library/ms730088.aspx> |
277,884 | <p>I need to check the <code>RequestType</code> of an <code>HttpRequest</code> in ASP.NET (or <code>WebRequest.Method</code>). I know that I can just use the string values "<code>POST</code>" or "<code>GET</code>" for the request type, but I could have sworn there was a constant somewhere in some class in .NET that con... | [
{
"answer_id": 277908,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 8,
"selected": true,
"text": "<pre><code>System.Net.WebRequestMethods.Http\n .Connect = \"CONNECT\"\n .Get = \"GET\"\n .Head = \"HEAD\"\n ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] | I need to check the `RequestType` of an `HttpRequest` in ASP.NET (or `WebRequest.Method`). I know that I can just use the string values "`POST`" or "`GET`" for the request type, but I could have sworn there was a constant somewhere in some class in .NET that contained the values.
Out of curiosity I was wondering if an... | ```
System.Net.WebRequestMethods.Http
.Connect = "CONNECT"
.Get = "GET"
.Head = "HEAD"
.MkCol = "MKCOL"
.Post = "POST"
.Put = "PUT"
```
Ultimately, though; since `const` expressions are burned into the caller, this is identical to using "GET" etc, just without the risk of a typo. |
277,899 | <p>Is it alright to do this?</p>
<pre><code>$author = strtolower($_SESSION['valid_username']);
</code></pre>
<p>I want to enter all authors into the table as lower case.</p>
| [
{
"answer_id": 277910,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, that's fine as long as <code>$_SESSION['valid_username']</code> is set, otherwise you'll get a notice (if your error r... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26130/"
] | Is it alright to do this?
```
$author = strtolower($_SESSION['valid_username']);
```
I want to enter all authors into the table as lower case. | Yes, that's fine as long as `$_SESSION['valid_username']` is set, otherwise you'll get a notice (if your error reporting is set that low).
You can check if it exists with `if (isset($_SESSION['valid_username']))` |
277,900 | <p>I want to do something like:</p>
<pre><code>exec sproc1 and sproc2 at the same time
when they are both finished exec sproc3
</code></pre>
<p>I can do this in dts.
Is there a way to do it in transact sql?
Or is there a way to do it with a batch script (eg vbs or powershell)?</p>
| [
{
"answer_id": 277966,
"author": "Timothy Khouri",
"author_id": 11917,
"author_profile": "https://Stackoverflow.com/users/11917",
"pm_score": 3,
"selected": false,
"text": "<p>You could create a CLR Stored Procedure that (using C#) would call the first two on their own threads, and then ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36189/"
] | I want to do something like:
```
exec sproc1 and sproc2 at the same time
when they are both finished exec sproc3
```
I can do this in dts.
Is there a way to do it in transact sql?
Or is there a way to do it with a batch script (eg vbs or powershell)? | sp \_ start \_ job
I'm doing a similar thing at the moment, and the only way I've found to avoid using SSIS or some external shell is to split my load routine into 'threads' manually, and then fire a single master sqlagent job which in turn executes as many sp \_ start \_ job's as I have threads. From that point, they... |
277,914 | <p>I've got a PHPUnit mock object that returns <code>'return value'</code> no matter what its arguments:</p>
<pre><code>// From inside a test...
$mock = $this->getMock('myObject', 'methodToMock');
$mock->expects($this->any))
->method('methodToMock')
->will($this->returnValue('return value')... | [
{
"answer_id": 277975,
"author": "eddy147",
"author_id": 30759,
"author_profile": "https://Stackoverflow.com/users/30759",
"pm_score": 0,
"selected": false,
"text": "<p>Do you mean something like this?</p>\n\n<pre><code>public function TestSomeCondition($condition){\n $mockObj = $this-&... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36191/"
] | I've got a PHPUnit mock object that returns `'return value'` no matter what its arguments:
```
// From inside a test...
$mock = $this->getMock('myObject', 'methodToMock');
$mock->expects($this->any))
->method('methodToMock')
->will($this->returnValue('return value'));
```
What I want to be able to do is re... | Use a callback. e.g. (straight from PHPUnit documentation):
```
<?php
class StubTest extends PHPUnit_Framework_TestCase
{
public function testReturnCallbackStub()
{
$stub = $this->getMock(
'SomeClass', array('doSomething')
);
$stub->expects($this->any())
->method... |
277,922 | <p>How can I bind arguments to a Python function so that I can call it later without arguments (or with fewer additional arguments)?</p>
<p>For example:</p>
<pre><code>def add(x, y):
return x + y
add_5 = magic_function(add, 5)
assert add_5(3) == 8
</code></pre>
<p>What is the <code>magic_function</code> I need her... | [
{
"answer_id": 277932,
"author": "Jeremy",
"author_id": 1114,
"author_profile": "https://Stackoverflow.com/users/1114",
"pm_score": 7,
"selected": true,
"text": "<p><a href=\"http://docs.python.org/2/library/functools.html#functools.partial\" rel=\"noreferrer\" title=\"Python 2 Documenta... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20003/"
] | How can I bind arguments to a Python function so that I can call it later without arguments (or with fewer additional arguments)?
For example:
```
def add(x, y):
return x + y
add_5 = magic_function(add, 5)
assert add_5(3) == 8
```
What is the `magic_function` I need here?
---
It often happens with frameworks... | [`functools.partial`](http://docs.python.org/2/library/functools.html#functools.partial "Python 2 Documentation: functools module: partial function") returns a callable wrapping a function with some or all of the arguments frozen.
```py
import sys
import functools
print_hello = functools.partial(sys.stdout.write, "He... |
277,923 | <p>How can we find the junit tests in our suite that take the longest amount of time to run? The default output of the junitreport ant task is helpful, but our suite has thousands of tests organized into many smaller suites, so it gets tedious, and the worst offenders are always changing.</p>
<p>We use luntbuild but ... | [
{
"answer_id": 277951,
"author": "ripper234",
"author_id": 11236,
"author_profile": "https://Stackoverflow.com/users/11236",
"pm_score": 2,
"selected": false,
"text": "<p>Use <a href=\"http://www.jetbrains.com/teamcity/\" rel=\"nofollow noreferrer\">TeamCity</a>. They have great reports,... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23572/"
] | How can we find the junit tests in our suite that take the longest amount of time to run? The default output of the junitreport ant task is helpful, but our suite has thousands of tests organized into many smaller suites, so it gets tedious, and the worst offenders are always changing.
We use luntbuild but ideally it ... | JUnitReport works on the xml files produced by the JUnit task. You could write a task that would read the test durations out of the same xml files (TEST-\*.xml). But you can also take a shortcut and just read the summary file created by JUnitReport (TESTS-TestSuites.xml) which has all the information in the single file... |
277,924 | <p>I'm trying to expand navigation options of the context menu on certain elements (specifically, <code>h1</code> and <code>h2</code> tags)
I want to prevent the browser's default action when right-clicking on those elements.</p>
<p>I found nice information at <a href="http://ajaxcookbook.org/disable-browser-context-m... | [
{
"answer_id": 277945,
"author": "James Hughes",
"author_id": 34671,
"author_profile": "https://Stackoverflow.com/users/34671",
"pm_score": 3,
"selected": true,
"text": "<p>This will prevent the context menu from appearing on a particular element</p>\n\n<pre><code>$(it).observe(\"context... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17600/"
] | I'm trying to expand navigation options of the context menu on certain elements (specifically, `h1` and `h2` tags)
I want to prevent the browser's default action when right-clicking on those elements.
I found nice information at [this page](http://ajaxcookbook.org/disable-browser-context-menu/).
However, I couldn't f... | This will prevent the context menu from appearing on a particular element
```
$(it).observe("contextmenu", function(e){
e.stop();
});
```
So, for example stop all H1/H2 tags from showing a context menu
```
$$('h1, h2').each(function(it){
$(it).observe("contextmenu", function(e){
e.stop();
});
})... |
277,942 | <p>I am attempting to create a struts2 component using freemarker. I created an <code>ftl</code> file with code like this:</p>
<pre><code><script type="text/javascript" src="${parameters.library?default('')}"></script>
</code></pre>
<p>Which is expecting a parameter named <code>library</code> to be passed... | [
{
"answer_id": 286226,
"author": "Vincent Ramdhanie",
"author_id": 27439,
"author_profile": "https://Stackoverflow.com/users/27439",
"pm_score": 0,
"selected": false,
"text": "<p>I eventually ran across some syntax in the docs that works. I have to refer to the parameter like this:</p>\n... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27439/"
] | I am attempting to create a struts2 component using freemarker. I created an `ftl` file with code like this:
```
<script type="text/javascript" src="${parameters.library?default('')}"></script>
```
Which is expecting a parameter named `library` to be passed to the component. If the parameter is absent then it defaul... | send the param with single quotes
```
<s:component template="mytemplate.ftl">
<s:param name="library" value="'/scripts/mylibrary.js'"/>
</s:component>
``` |
277,944 | <p>I have to read a binary file in a legacy format with Java. </p>
<p>In a nutshell the file has a header consisting of several integers, bytes and fixed-length char arrays, followed by a list of records which also consist of integers and chars.</p>
<p>In any other language I would create <code>struct</code>s (C/C++)... | [
{
"answer_id": 277961,
"author": "Arvind",
"author_id": 11541,
"author_profile": "https://Stackoverflow.com/users/11541",
"pm_score": 2,
"selected": false,
"text": "<p>I guess FileInputStream lets you read in bytes. So, opening the file with FileInputStream and read in the sizeof(header)... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23368/"
] | I have to read a binary file in a legacy format with Java.
In a nutshell the file has a header consisting of several integers, bytes and fixed-length char arrays, followed by a list of records which also consist of integers and chars.
In any other language I would create `struct`s (C/C++) or `record`s (Pascal/Delphi... | To my knowledge, Java forces you to read a file as bytes rather than being able to block read. If you were serializing Java objects, it'd be a different story.
The other examples shown use the [DataInputStream](http://java.sun.com/javase/6/docs/api/java/io/DataInputStream.html) class with a File, but you can also use ... |
277,953 | <p>I have a table of events with a recorded start and end time as a MySQL DATETIME object (in the format <code>YYYY-MM-DD HH:MM:SS</code>. I want to find all events that occur in a specific date range. However, events can span multiple days (and go outside of my date range, but I want to return them if they even overla... | [
{
"answer_id": 277967,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 2,
"selected": false,
"text": "<pre><code>SELECT *\nFROM table\nWHERE startdate >= 'starting date' AND startdate < 'ending date'\n OR endd... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572/"
] | I have a table of events with a recorded start and end time as a MySQL DATETIME object (in the format `YYYY-MM-DD HH:MM:SS`. I want to find all events that occur in a specific date range. However, events can span multiple days (and go outside of my date range, but I want to return them if they even overlap by 1 second ... | This will find every event that is completely contained inside the range:
```
SELECT * FROM table WHERE start_date BETWEEN start_of_range AND end_of_range
AND stop_date BETWEEN start_of_range AND end_of_range
```
This will find any events where any part of the event overlaps any part of the r... |
277,965 | <p>I am writing a script at the moment that will grab certain information from HTML using dom4j.</p>
<p>Since Python/Jython does not have a native <strong>switch</strong> statement I decided to use a whole bunch of <strong>if</strong> statements that call the appropriate method, like below:</p>
<pre><code>if type == ... | [
{
"answer_id": 277972,
"author": "Brian",
"author_id": 9493,
"author_profile": "https://Stackoverflow.com/users/9493",
"pm_score": 5,
"selected": true,
"text": "<p>To avoid specifying the tag and handler in the dict, you could just use a handler class with methods named to match the type... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30786/"
] | I am writing a script at the moment that will grab certain information from HTML using dom4j.
Since Python/Jython does not have a native **switch** statement I decided to use a whole bunch of **if** statements that call the appropriate method, like below:
```
if type == 'extractTitle':
extractTitle(dom)
if type =... | To avoid specifying the tag and handler in the dict, you could just use a handler class with methods named to match the type. Eg
```
class MyHandler(object):
def handle_extractTitle(self, dom):
# do something
def handle_extractMetaTags(self, dom):
# do something
def handle(self, type, do... |
277,996 | <p>Do you know of a JAXB setting to prevent <strong>standalone="yes"</strong> from being generated in the resulting XML?</p>
<pre><code><?xml version="1.0" encoding="UTF-8" standalone="yes"?>
</code></pre>
| [
{
"answer_id": 352107,
"author": "Sam",
"author_id": 37575,
"author_profile": "https://Stackoverflow.com/users/37575",
"pm_score": 7,
"selected": true,
"text": "<p>This property:</p>\n<pre class=\"lang-java prettyprint-override\"><code>marshaller.setProperty("com.sun.xml.bind.xmlDec... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9707/"
] | Do you know of a JAXB setting to prevent **standalone="yes"** from being generated in the resulting XML?
```
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
``` | This property:
```java
marshaller.setProperty("com.sun.xml.bind.xmlDeclaration", false);
```
...can be used to have no:
```xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
```
However, I wouldn't consider this best practice. |
277,999 | <p>I know that to find all the <code>.h</code> files I need to use:</p>
<pre><code>find . -name "*.h"
</code></pre>
<p>but how to find all the <code>.h</code> AND <code>.cpp</code> files?</p>
| [
{
"answer_id": 278002,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 7,
"selected": true,
"text": "<pre><code>find . -name \\*.h -print -o -name \\*.cpp -print\n</code></pre>\n\n<p>or</p>\n\n<pre><code>find . \\( -name ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/277999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I know that to find all the `.h` files I need to use:
```
find . -name "*.h"
```
but how to find all the `.h` AND `.cpp` files? | ```
find . -name \*.h -print -o -name \*.cpp -print
```
or
```
find . \( -name \*.h -o -name \*.cpp \) -print
``` |
278,034 | <p>I have an authentication script (<strong><code>CheckLogin.aspx</code></strong>), and if any of the credentials do not match my application will redirect (via <strong><code>Server.Transfer</code></strong>) to the access denied page (<strong><code>forbidden.aspx</code></strong>). Each time my script runs,it gets an <... | [
{
"answer_id": 278042,
"author": "DOK",
"author_id": 27637,
"author_profile": "https://Stackoverflow.com/users/27637",
"pm_score": 3,
"selected": true,
"text": "<p>Sometimes you have to precede the page path with a tilde to indicate the root directory:</p>\n\n<pre><code>'~/forbidden.aspx... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] | I have an authentication script (**`CheckLogin.aspx`**), and if any of the credentials do not match my application will redirect (via **`Server.Transfer`**) to the access denied page (**`forbidden.aspx`**). Each time my script runs,it gets an **`InvalidOperationException: Failed to map the path '/forbidden.aspx'`**. He... | Sometimes you have to precede the page path with a tilde to indicate the root directory:
```
'~/forbidden.aspx'
``` |
278,037 | <p>I'm working with a third party to integrate some of our systems with theirs and they provide us with a SOAP interface to make certain requests and changes in their connected systems. The problem for me is that they do not supply a WSDL-file for me to work against. If I had a WSDL-file it would be a simple matter jus... | [
{
"answer_id": 278072,
"author": "cori",
"author_id": 8151,
"author_profile": "https://Stackoverflow.com/users/8151",
"pm_score": 1,
"selected": false,
"text": "<p>I haven't built a SOAP interface without access to a WSDL file, but the format is <a href=\"http://www.w3.org/TR/wsdl\" rel=... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26746/"
] | I'm working with a third party to integrate some of our systems with theirs and they provide us with a SOAP interface to make certain requests and changes in their connected systems. The problem for me is that they do not supply a WSDL-file for me to work against. If I had a WSDL-file it would be a simple matter just t... | ```
string EndPoints = "http://203.189.91.127:7777/services/spm/spm";
string New_Xml_Request_String = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-inst... |
278,039 | <p>I have a timely operation that runs on a background thread. While running, I currently put the cursor in a wait state:</p>
<pre><code>Mouse.OverrideCursor = Cursors.Wait
</code></pre>
<p>I just implemented a feature that allows the user to click a "Cancel" button if they're tired of waiting. However, some users ... | [
{
"answer_id": 278050,
"author": "TcKs",
"author_id": 20382,
"author_profile": "https://Stackoverflow.com/users/20382",
"pm_score": 2,
"selected": false,
"text": "<p>I think you should use a \"AppStarting\" property of \"System.Windows.Forms.Cursros\" class.</p>\n"
},
{
"answer_i... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/132931/"
] | I have a timely operation that runs on a background thread. While running, I currently put the cursor in a wait state:
```
Mouse.OverrideCursor = Cursors.Wait
```
I just implemented a feature that allows the user to click a "Cancel" button if they're tired of waiting. However, some users may not realize they can do ... | ```
Me.Cursor = Cursors.AppStarting
``` |
278,046 | <p>Are there any free tools to help simplify working with an NHibernate project in .NET 3.5? Primarily, I'm looking for some kind of code and config file generator to automate some of the more tedious parts of working with NHibernate.</p>
| [
{
"answer_id": 278065,
"author": "Mark Struzinski",
"author_id": 1284,
"author_profile": "https://Stackoverflow.com/users/1284",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://altinoren.com/activewriter/\" rel=\"nofollow noreferrer\">ActiveWriter</a> is a plugin to Visual... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] | Are there any free tools to help simplify working with an NHibernate project in .NET 3.5? Primarily, I'm looking for some kind of code and config file generator to automate some of the more tedious parts of working with NHibernate. | [Fluent-NHibernate](http://code.google.com/p/fluent-nhibernate/) presents an alternative way of writing your mapping, that for example is more refactor friendly than the standard XML approach.
Example:
```
public CustomerMap : ClassMap<Customer>
{
public CustomerMap()
{
Id(x => x.ID);
Map(x => x.Name);
... |
278,062 | <p>I've got a cool piece of code taken from a VC++ project which gets complete information of the hard disk drive WITHOUT using WMI (since WMI has got its own problems).</p>
<p>I ask those of you who are comfortable with API functions to try to convert this VB6 code into VB.NET (or C#) and help A LOT of people who are ... | [
{
"answer_id": 278124,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>That's a lot of code to wade through for someone who doesn't understand the spoken language used in the comments. <... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've got a cool piece of code taken from a VC++ project which gets complete information of the hard disk drive WITHOUT using WMI (since WMI has got its own problems).
I ask those of you who are comfortable with API functions to try to convert this VB6 code into VB.NET (or C#) and help A LOT of people who are in great ... | I found it! Here is the equivalent VB.NET code. It's not exactly the converted version of the VB6 code, but does the same thing. Enjoy!
```
Public Class HDDInfo
#Region " Declatrations "
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Integer... |
278,068 | <p>I have an image that I want to show some 'spotlights' on, like they do on TV. The rest of the image should be darker than the original, and the person that I'm spotlighting should be normal. I have the x,y and radius of the spotlight, but I'm not sure how to change the brightness at that location. </p>
<p>Also, ... | [
{
"answer_id": 278113,
"author": "Lou Franco",
"author_id": 3937,
"author_profile": "https://Stackoverflow.com/users/3937",
"pm_score": 0,
"selected": false,
"text": "<p>A simple way is to convert the color to HSL, lower L to darken, increase to lighten, then convert back to RGB and set ... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an image that I want to show some 'spotlights' on, like they do on TV. The rest of the image should be darker than the original, and the person that I'm spotlighting should be normal. I have the x,y and radius of the spotlight, but I'm not sure how to change the brightness at that location.
Also, if I have two... | Use RescaleOp on the original image and subimages. Given that you have a buffered image (called biDest) that contains the image, call RescaleOp(0.6, 0, null) on it to make it darker. Then, to add a (rectangular) spotlight, call the following:
```
public void spotLight(int x, int y, int w, int h)
{
Buff... |
278,071 | <p>I want to get the overall total CPU usage for an application in C#. I've found many ways to dig into the properties of processes, but I only want the CPU usage of the processes, and the total CPU like you get in the TaskManager.</p>
<p>How do I do that?</p>
| [
{
"answer_id": 278088,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 8,
"selected": false,
"text": "<p>You can use the <a href=\"http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter(VS.8... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to get the overall total CPU usage for an application in C#. I've found many ways to dig into the properties of processes, but I only want the CPU usage of the processes, and the total CPU like you get in the TaskManager.
How do I do that? | You can use the [PerformanceCounter](http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter(VS.80).aspx) class from [System.Diagnostics](http://msdn.microsoft.com/en-us/library/system.diagnostics.aspx).
Initialize like this:
```
PerformanceCounter cpuCounter;
PerformanceCounter ramCounter;
cpu... |
278,075 | <p>I am monitoring a folder with a .net filewatcher for certain kind of files(*.mbxml). I am using the created event of filewatcher for it. Once the created event fires I have to move this file to another folder. The problem with this approach is that the created event is fired as soon as the file copying starts. So if... | [
{
"answer_id": 278083,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>Are you able to change the program which is creating the files? If so, change it to create them in one folder and the... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25125/"
] | I am monitoring a folder with a .net filewatcher for certain kind of files(\*.mbxml). I am using the created event of filewatcher for it. Once the created event fires I have to move this file to another folder. The problem with this approach is that the created event is fired as soon as the file copying starts. So if t... | i have yet to see this done in anyway except with a try catch block. usually on the oncreate event i set a bool that try's to open the file. this determines if the rest of the code proceeds, if there is another way i would be interested as well.
```
private static bool creationComplete(string fileName)
{
... |
278,081 | <p>I've been using Git on Windows (msysgit) to track changes for some design work I've been doing.</p>
<p>Today I've been working on a different PC (with remote repo <code>brian</code>) and I'm now trying to merge the edits done today back into my regular local version on my laptop.</p>
<p>On my laptop, I've used <co... | [
{
"answer_id": 278207,
"author": "VolkA",
"author_id": 25472,
"author_profile": "https://Stackoverflow.com/users/25472",
"pm_score": 7,
"selected": false,
"text": "<p>You have to resolve the conflict manually (copying the file over) and then commit the file (no matter if you copied it ov... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33721/"
] | I've been using Git on Windows (msysgit) to track changes for some design work I've been doing.
Today I've been working on a different PC (with remote repo `brian`) and I'm now trying to merge the edits done today back into my regular local version on my laptop.
On my laptop, I've used `git pull brian master` to pull... | `git checkout` accepts an `--ours` or `--theirs` option for cases like this. So if you have a merge conflict, and you know you just want the file from the branch you are merging in, you can do:
```
$ git checkout --theirs -- path/to/conflicted-file.txt
```
to use that version of the file. Likewise, if you know you w... |
278,089 | <p>is there a quick way to sort the items of a select element?
Or I have to resort to writing javascript?</p>
<p>Please any ideas.</p>
<pre><code><select size="4" name="lstALL" multiple="multiple" id="lstALL" tabindex="12" style="font-size:XX-Small;height:95%;width:100%;">
<option value="0"> XXX</optio... | [
{
"answer_id": 278111,
"author": "Joel Martinez",
"author_id": 5416,
"author_profile": "https://Stackoverflow.com/users/5416",
"pm_score": 1,
"selected": false,
"text": "<p>Yes DOK has the right answer ... either pre-sort the results before you write the HTML (assuming it's dynamic and y... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13370/"
] | is there a quick way to sort the items of a select element?
Or I have to resort to writing javascript?
Please any ideas.
```
<select size="4" name="lstALL" multiple="multiple" id="lstALL" tabindex="12" style="font-size:XX-Small;height:95%;width:100%;">
<option value="0"> XXX</option>
<option value="1203">ABC</option>... | This will do the trick. Just pass it your select element a la: `document.getElementById('lstALL')` when you need your list sorted.
```
function sortSelect(selElem) {
var tmpAry = new Array();
for (var i=0;i<selElem.options.length;i++) {
tmpAry[i] = new Array();
tmpAry[i][0] = selElem.options[i]... |
278,101 | <p>I am using ActiveReports with ASP.NET but I think answer for any similar reporting component will do.</p>
<p>I have two resultset to merge and show in a single report, like:</p>
<pre><code>Table 1:
Name Job Start End
Jack Some service 1992 1997
Jack Some Sales Exp 1998 2007
Jane Some programm... | [
{
"answer_id": 278141,
"author": "agsamek",
"author_id": 33608,
"author_profile": "https://Stackoverflow.com/users/33608",
"pm_score": 1,
"selected": false,
"text": "<p>In general you cannot do it in a single SELECT statement. Most reporting tools offer some kind of \"subreports\" or \"i... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31505/"
] | I am using ActiveReports with ASP.NET but I think answer for any similar reporting component will do.
I have two resultset to merge and show in a single report, like:
```
Table 1:
Name Job Start End
Jack Some service 1992 1997
Jack Some Sales Exp 1998 2007
Jane Some programming 2000 2003
Table... | Use subreports... Create a main report that will have two subreports. One subreport for job history and one subreport for training history. The main report will need a query that will return a list of people. Then for each Person in the detail of the main report, set a parameter on each of the child subreports that wil... |
278,112 | <p>Is there any c library to get a video from the webcam on linux?</p>
| [
{
"answer_id": 278117,
"author": "Brian R. Bondy",
"author_id": 3153,
"author_profile": "https://Stackoverflow.com/users/3153",
"pm_score": 3,
"selected": false,
"text": "<p>Your best bet is probably: <a href=\"http://en.wikipedia.org/wiki/Video4Linux\" rel=\"noreferrer\">video4linux (V4... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there any c library to get a video from the webcam on linux? | A lot of us use [OpenCV](http://opencv.willowgarage.com/wiki/) (cross-platform Computer Vision library, currently on v2.1)
The following snippet grabs frames from camera, converts them to grayscale and displays them on the screen:
```
#include <stdio.h>
#include "cv.h"
#include "highgui.h"
typedef IplImage* (*callba... |
278,121 | <p>Its my understanding that the recommended approach to localization in WPF is to use the LocBaml tool to extract the localizable items into e.g. a csv file, translate the items into the desired language and regenerate a new sattelite assembly from this csv file. However from my experiments this seems to conflict with... | [
{
"answer_id": 279432,
"author": "Sacha Bruttin",
"author_id": 20761,
"author_profile": "https://Stackoverflow.com/users/20761",
"pm_score": 1,
"selected": false,
"text": "<p>I prefer to use the <a href=\"http://www.codeplex.com/WPFLocalizeExtension\" rel=\"nofollow noreferrer\">WPF Loca... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9222/"
] | Its my understanding that the recommended approach to localization in WPF is to use the LocBaml tool to extract the localizable items into e.g. a csv file, translate the items into the desired language and regenerate a new sattelite assembly from this csv file. However from my experiments this seems to conflict with th... | You have to manually do this generating .resources from LocBaml and then merging the Resx and BAML resources using the Assembly linker.
The process looks something like this:
```
LocBaml.exe /generate ..\obj\WpfLocalization.g.en-US.resources
/trans:Res\de.csv /out:de /culture:de
REM Combine resource fi... |
278,122 | <p>We're using Prototype for all of our Ajax request handling and to keep things simple we simple render HTML content which is then assigned to the appropriate div using the following function:</p>
<pre><code>function ajaxModify(controller, parameters, div_id)
{
var div = $(div_id);
var request = new Ajax.Req... | [
{
"answer_id": 278138,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 5,
"selected": true,
"text": "<p>The parameter is:</p>\n\n<pre><code>evalScripts:true\n</code></pre>\n\n<p>Note that you should be usi... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20178/"
] | We're using Prototype for all of our Ajax request handling and to keep things simple we simple render HTML content which is then assigned to the appropriate div using the following function:
```
function ajaxModify(controller, parameters, div_id)
{
var div = $(div_id);
var request = new Ajax.Request
(
... | The parameter is:
```
evalScripts:true
```
Note that you should be using **Ajax.Updater**, not **Ajax.Request**
See: <http://www.prototypejs.org/api/ajax/updater>
Ajax.Request will only process JavaScript if the response headers are:
>
> application/ecmascript,
> application/javascript,
> application/x-ecmascr... |
278,132 | <p>I need to impersonate myself as a domain user in a ASP.NET application running on VMWare machine. Since the VMWare machine is not itself in the domain, ASP.NET is unable to resolve the user token (specified in web.config). Is there a way to do that?</p>
<p>Thanks in advance,
Petr</p>
| [
{
"answer_id": 278395,
"author": "Martin Brown",
"author_id": 20553,
"author_profile": "https://Stackoverflow.com/users/20553",
"pm_score": -1,
"selected": false,
"text": "<p>This may be the dumb obvious answer, but you could add your VMWare machine to the domain.</p>\n"
},
{
"an... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15497/"
] | I need to impersonate myself as a domain user in a ASP.NET application running on VMWare machine. Since the VMWare machine is not itself in the domain, ASP.NET is unable to resolve the user token (specified in web.config). Is there a way to do that?
Thanks in advance,
Petr | I use this class I wrote all the time and it works like a charm!
```
using System;
using System.Security.Principal;
/// <summary>
/// Changes the security context the application runs under.
/// </summary>
public class ImpersonateHelper : IDisposable
{
[System.Runtime.InteropServices.DllImport("Kernel32")]
pr... |
278,137 | <p>I am using some custom controls one of which is a tooltip controller that can display images, so I am using th ebelow code to instantiate it:</p>
<pre><code>Image newImage = Image.FromFile(imagePath);
e.ToolTipImage = newImage;
</code></pre>
<p>obviously could inline it but just testing at the moment. The trouble ... | [
{
"answer_id": 278166,
"author": "John Rudy",
"author_id": 14048,
"author_profile": "https://Stackoverflow.com/users/14048",
"pm_score": 2,
"selected": true,
"text": "<p>Once you have an image object loaded from its source, the Height and Width (and Size, and all ancillary properties) ar... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16989/"
] | I am using some custom controls one of which is a tooltip controller that can display images, so I am using th ebelow code to instantiate it:
```
Image newImage = Image.FromFile(imagePath);
e.ToolTipImage = newImage;
```
obviously could inline it but just testing at the moment. The trouble is the image is sometimes ... | Once you have an image object loaded from its source, the Height and Width (and Size, and all ancillary properties) are read-only. Therefore, you are stuck with GDI+ methods for resizing it in RAM and then displaying it accordingly.
There are a lot of approaches you can take, but if you were to encapsulate that out t... |
278,160 | <p>Are there ways to programmatically simulate connection problems (slow connection, response does not complete, connection gets dropped, etc.) when using the HttpWebRequest class?</p>
<p>Thanks</p>
<p>EDIT: To elaborate more, I need this for debugging but would want to turn it into a test eventually. I'm using the a... | [
{
"answer_id": 278258,
"author": "ajh1138",
"author_id": 13936,
"author_profile": "https://Stackoverflow.com/users/13936",
"pm_score": 0,
"selected": false,
"text": "<p>If you're in control of the site that's responding to the request, I'd say putting the thread to sleep for a while woul... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8280/"
] | Are there ways to programmatically simulate connection problems (slow connection, response does not complete, connection gets dropped, etc.) when using the HttpWebRequest class?
Thanks
EDIT: To elaborate more, I need this for debugging but would want to turn it into a test eventually. I'm using the async methods Begi... | If this is for testing purposes - i.e. to inspect your's code behavior, I would suggest to create a class which inherits from from HttpWebRequest/HttpWebResponse, and override the methods you are interested in to behave the way you want - i.e. Thread.Sleep for delays, throw an exceptions, etc. |
278,163 | <p>I need to catch the HTML of a ASP.NET just before it is being sent to the client in order to do last minute string manipulations on it, and then send the modified version to the client.</p>
<p>e.g.</p>
<p>The Page is loaded
Every control has been rendered correctly
The Full html of the page is ready to be transferre... | [
{
"answer_id": 278178,
"author": "Bruno Shine",
"author_id": 28294,
"author_profile": "https://Stackoverflow.com/users/28294",
"pm_score": 2,
"selected": false,
"text": "<p>You can use a <a href=\"http://msdn.microsoft.com/en-us/library/system.web.ihttpmodule.aspx\" rel=\"nofollow norefe... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32582/"
] | I need to catch the HTML of a ASP.NET just before it is being sent to the client in order to do last minute string manipulations on it, and then send the modified version to the client.
e.g.
The Page is loaded
Every control has been rendered correctly
The Full html of the page is ready to be transferred back to the c... | You can override the Render method of your page. Then call the base implementation and supply your HtmlTextWriter object. Here is an example
```
protected override void Render(HtmlTextWriter writer)
{
StringWriter output = new StringWriter();
base.Render(new HtmlTextWriter(output));
//This is the rendered ... |
278,186 | <p>I've got a simple little WPF app with a TextBox and a WebBrowser control. As I type into the TextBox the WebBrowser updates with its content.</p>
<p>But on each keystroke, when the WebBrowser updates, it makes a click sound. How can I disable the WebBrowser control's refresh click sound?</p>
<p><a href="http://i... | [
{
"answer_id": 278178,
"author": "Bruno Shine",
"author_id": 28294,
"author_profile": "https://Stackoverflow.com/users/28294",
"pm_score": 2,
"selected": false,
"text": "<p>You can use a <a href=\"http://msdn.microsoft.com/en-us/library/system.web.ihttpmodule.aspx\" rel=\"nofollow norefe... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278186",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] | I've got a simple little WPF app with a TextBox and a WebBrowser control. As I type into the TextBox the WebBrowser updates with its content.
But on each keystroke, when the WebBrowser updates, it makes a click sound. How can I disable the WebBrowser control's refresh click sound?
[WPF TextBox and WebBrowser controls... | You can override the Render method of your page. Then call the base implementation and supply your HtmlTextWriter object. Here is an example
```
protected override void Render(HtmlTextWriter writer)
{
StringWriter output = new StringWriter();
base.Render(new HtmlTextWriter(output));
//This is the rendered ... |
278,189 | <p>What is the string concatenation operator in Oracle SQL? </p>
<p>Are there any "interesting" features I should be careful of? </p>
<p>(This seems obvious, but I couldn't find a previous question asking it). </p>
| [
{
"answer_id": 278198,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 9,
"selected": true,
"text": "<p>It is <code>||</code>, for example:</p>\n\n<pre><code>select 'Mr ' || ename from emp;\n</code></pre>\n\n<p>The only... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278189",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7211/"
] | What is the string concatenation operator in Oracle SQL?
Are there any "interesting" features I should be careful of?
(This seems obvious, but I couldn't find a previous question asking it). | It is `||`, for example:
```
select 'Mr ' || ename from emp;
```
The only "interesting" feature I can think of is that `'x' || null` returns `'x'`, not `null` as you might perhaps expect. |
278,192 | <p>How do I view the history of an individual file with complete details of what has changed?</p>
<p><code>git log -- [filename]</code> shows me the commit history of a file, but how do I see the file content that changed?</p>
| [
{
"answer_id": 278239,
"author": "cori",
"author_id": 8151,
"author_profile": "https://Stackoverflow.com/users/8151",
"pm_score": 3,
"selected": false,
"text": "<p>If you're using the <a href=\"https://git-scm.com/docs/git-gui\" rel=\"nofollow noreferrer\">Git GUI</a> (on Windows):</p>\n... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36214/"
] | How do I view the history of an individual file with complete details of what has changed?
`git log -- [filename]` shows me the commit history of a file, but how do I see the file content that changed? | For a graphical view, use [`gitk`](https://git-scm.com/docs/gitk/):
```
gitk [filename]
```
To follow the file across file renames:
```
gitk --follow [filename]
``` |
278,215 | <p>I'm working with an existing XML document which has a structure (in part) like so:</p>
<pre><code><Group>
<Entry>
<Name> Bob </Name>
<ID> 1 </ID>
</Entry>
<Entry>
<Name> Larry </Name>
</Entry>
</Group>
</... | [
{
"answer_id": 278233,
"author": "Cristian Libardo",
"author_id": 16526,
"author_profile": "https://Stackoverflow.com/users/16526",
"pm_score": 2,
"selected": false,
"text": "<p>In a similar situation I used an extension method:</p>\n\n<pre><code> public static string OptionalElement(... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7862/"
] | I'm working with an existing XML document which has a structure (in part) like so:
```
<Group>
<Entry>
<Name> Bob </Name>
<ID> 1 </ID>
</Entry>
<Entry>
<Name> Larry </Name>
</Entry>
</Group>
```
I'm using LINQ to XML to query the XDocument to retrieve all these entries as foll... | [XElement](http://msdn.microsoft.com/en-us/library/system.xml.linq.xelement.aspx) actually has [interesting explicit conversion operators](http://msdn.microsoft.com/en-us/library/system.xml.linq.xelement.op_explicit.aspx) that do the right thing in this case.
So, you rarely actually need to access the `.Value` propert... |
278,249 | <p>We would like to enumerate all strings in a resource file in .NET (resx file). We want this to generate a javascript object containing all these key-value pairs. We do this now for satellite assemblies with code like this (this is VB.NET, but any example code is fine):</p>
<pre><code>Dim rm As ResourceManager
rm = ... | [
{
"answer_id": 278413,
"author": "baretta",
"author_id": 30052,
"author_profile": "https://Stackoverflow.com/users/30052",
"pm_score": 3,
"selected": true,
"text": "<p>Use <a href=\"http://msdn.microsoft.com/en-us/library/system.resources.resxresourcereader.aspx\" rel=\"nofollow noreferr... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8071/"
] | We would like to enumerate all strings in a resource file in .NET (resx file). We want this to generate a javascript object containing all these key-value pairs. We do this now for satellite assemblies with code like this (this is VB.NET, but any example code is fine):
```
Dim rm As ResourceManager
rm = New ResourceMa... | Use [System.Resources.ResXResourceReader](http://msdn.microsoft.com/en-us/library/system.resources.resxresourcereader.aspx) (it's in System.Windows.Forms.dll) |
278,259 | <p>I'm trying to write an iterator for results from a PDO statement but I can't find any way of rewinding to the first row. I would like to avoid the overhead of calling fetchAll and storing all the result data.</p>
<pre><code>// first loop works fine
foreach($statement as $result) {
// do something with result
}
... | [
{
"answer_id": 278317,
"author": "Noah Goodrich",
"author_id": 20178,
"author_profile": "https://Stackoverflow.com/users/20178",
"pm_score": 1,
"selected": false,
"text": "<p>You'll probably want to take a look at some of the PHP SPL classes that can be extended to provide array-like acc... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20074/"
] | I'm trying to write an iterator for results from a PDO statement but I can't find any way of rewinding to the first row. I would like to avoid the overhead of calling fetchAll and storing all the result data.
```
// first loop works fine
foreach($statement as $result) {
// do something with result
}
// but subseq... | I'm pretty sure this is database dependent. Because of that, it is something you should try to avoid. However, I think you can achieve what you want by enabling [buffered queries](http://www.php.net/pdo-mysql#pdo-mysql.constants). If that doesn't work, you can always pull the result into an array with [`fetchAll`](http... |
278,278 | <p>I'd like to change this:</p>
<pre><code><a href='foo'>
<div> Moo </div>
</a>
</code></pre>
<p>to be standards compliant (you're not supposed to have block elements in inline elements). Wiring javascript to the divs just for navigation seems like a hack and degrades accessibility.. In t... | [
{
"answer_id": 278292,
"author": "Zack The Human",
"author_id": 18265,
"author_profile": "https://Stackoverflow.com/users/18265",
"pm_score": 5,
"selected": true,
"text": "<p>Why not use a <strong><span></strong> rather than a <strong><div></strong> and set <strong>display:bl... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4435/"
] | I'd like to change this:
```
<a href='foo'>
<div> Moo </div>
</a>
```
to be standards compliant (you're not supposed to have block elements in inline elements). Wiring javascript to the divs just for navigation seems like a hack and degrades accessibility.. In this case, my requirements are for 2 sets of border... | Why not use a **<span>** rather than a **<div>** and set **display:block** on both elements?
Additionally, to answer your latter question: I don't believe adding **display:block;** to your anchor will make it pass validation. The validator checks to see if you're following (X)HTML rules, not how to present the page to... |
278,286 | <p><strike>All of the errors are on auto-generated files, not within the files that were created by me. Here are a few of them:</p>
<pre><code>'Context' is not a member of 'auth_cookies'
'ProcessRequest' cannot be declared 'Overrides' because it does not override a sub in a base class
'Server' is not a member of 'ASP... | [
{
"answer_id": 278319,
"author": "Kon",
"author_id": 22303,
"author_profile": "https://Stackoverflow.com/users/22303",
"pm_score": 2,
"selected": true,
"text": "<p>Did you put a <code><%@Page%></code> directive in your Master page? It should only have a <code><%@Master%></co... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] | All of the errors are on auto-generated files, not within the files that were created by me. Here are a few of them:
```
'Context' is not a member of 'auth_cookies'
'ProcessRequest' cannot be declared 'Overrides' because it does not override a sub in a base class
'Server' is not a member of 'ASP.auth_cookies_aspx'
Cla... | Did you put a `<%@Page%>` directive in your Master page? It should only have a `<%@Master%>` directive. |
278,290 | <p>Is there some elegant way to add an empty option to a DropDownList bound with a LinqDataSource?</p>
| [
{
"answer_id": 278315,
"author": "DOK",
"author_id": 27637,
"author_profile": "https://Stackoverflow.com/users/27637",
"pm_score": 4,
"selected": true,
"text": "<p>Here's how to add a value at the top of the list. It can be an empty string, or some text.</p>\n\n<pre><code><asp:DropDow... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12111/"
] | Is there some elegant way to add an empty option to a DropDownList bound with a LinqDataSource? | Here's how to add a value at the top of the list. It can be an empty string, or some text.
```
<asp:DropDownList ID="categories" runat="server" AppendDataBoundItems="True" AutoPostBack="True" DataSourceID="categoriesDataSource" DataTextField="CategoryName" DataValueField="CategoryID" EnableViewState="False">
<asp:... |
278,294 | <p>The new Vista Audio subsystem is set up to be a chain of devices starting with the inputs, going through all the various controls (like mixers and volumen controls) and then ending up at various endpoints (like speakers or headphones).</p>
<p>My question is: Is there a tool out there that will show all the endpoint... | [
{
"answer_id": 278315,
"author": "DOK",
"author_id": 27637,
"author_profile": "https://Stackoverflow.com/users/27637",
"pm_score": 4,
"selected": true,
"text": "<p>Here's how to add a value at the top of the list. It can be an empty string, or some text.</p>\n\n<pre><code><asp:DropDow... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17958/"
] | The new Vista Audio subsystem is set up to be a chain of devices starting with the inputs, going through all the various controls (like mixers and volumen controls) and then ending up at various endpoints (like speakers or headphones).
My question is: Is there a tool out there that will show all the endpoints devices ... | Here's how to add a value at the top of the list. It can be an empty string, or some text.
```
<asp:DropDownList ID="categories" runat="server" AppendDataBoundItems="True" AutoPostBack="True" DataSourceID="categoriesDataSource" DataTextField="CategoryName" DataValueField="CategoryID" EnableViewState="False">
<asp:... |
278,296 | <p>I've got a PHP script which I'm running from a command line (windows) that performs a variety of tasks, and the only output it gives is via 'print' statements which output direct to screen.</p>
<p>What I want to do is capture this to a log file as well.</p>
<p>I know I can do: </p>
<pre><code>php-cli script.php ... | [
{
"answer_id": 278327,
"author": "vfilby",
"author_id": 24279,
"author_profile": "https://Stackoverflow.com/users/24279",
"pm_score": 2,
"selected": false,
"text": "<p>You can create a powershell script that runs the command, reads the data from the command's STDOUT then outputs the outp... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11905/"
] | I've got a PHP script which I'm running from a command line (windows) that performs a variety of tasks, and the only output it gives is via 'print' statements which output direct to screen.
What I want to do is capture this to a log file as well.
I know I can do:
```
php-cli script.php > log.txt
```
But the pro... | I have always opened the log file up in my web browser. This allows me to refresh it easily and does not interrupt any writing to the file that windows does. It isn't particularly elegant but it does work! |
278,304 | <p>What is the best way to stop a user from resizing the top-level window of an application written in WPF?</p>
| [
{
"answer_id": 278332,
"author": "Todd White",
"author_id": 30833,
"author_profile": "https://Stackoverflow.com/users/30833",
"pm_score": 8,
"selected": true,
"text": "<p>You will want to use the <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.resizemode.aspx\" rel=\"nor... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15985/"
] | What is the best way to stop a user from resizing the top-level window of an application written in WPF? | You will want to use the [`ResizeMode.NoResize`](http://msdn.microsoft.com/en-us/library/system.windows.resizemode.aspx) on the window.
```
<Window x:Class="WpfApplication5.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Resi... |
278,312 | <p>I am migrating web apps to new hosting servers, but when I try to access them to test on the new server, I get all these assemblies not found errors like:</p>
<pre><code>Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review t... | [
{
"answer_id": 278316,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": true,
"text": "<p>That's part of the ASP.Net AJAX kit.</p>\n"
},
{
"answer_id": 278384,
"author": "StingyJack",
"autho... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18309/"
] | I am migrating web apps to new hosting servers, but when I try to access them to test on the new server, I get all these assemblies not found errors like:
```
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific er... | That's part of the ASP.Net AJAX kit. |
278,320 | <p>I am using SQL Server 2005 CE framework 3.5 and attempting to use merge replication between my hand held and my SQL Server. When I run the code to synchronise it just seems to sit forever, and when I put a breakpoint in my code it never gets past the call to Synchronize().</p>
<p>If I look at the replication monit... | [
{
"answer_id": 278510,
"author": "Cheryl",
"author_id": 30270,
"author_profile": "https://Stackoverflow.com/users/30270",
"pm_score": 0,
"selected": false,
"text": "<p>I have since discovered that it was just taking a long time to copy the data to the physical disk. Although the sql ser... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30270/"
] | I am using SQL Server 2005 CE framework 3.5 and attempting to use merge replication between my hand held and my SQL Server. When I run the code to synchronise it just seems to sit forever, and when I put a breakpoint in my code it never gets past the call to Synchronize().
If I look at the replication monitor in sql s... | Another thing you can do to speed up the Synchronize operation is to specify a db file path that is in your PDA's main program memory (instead of on the SD Card as in your example). You should see a speed improvement of up to 4X (meaning the Sync may take only 25% as long as it's taking now).
If you're running out of ... |
278,331 | <p>I'm finally getting the hang of RSpec after spending a couple of hours over the weekend. Now I'm stuck trying to figure out how to assert that parameters are indeed passed into the controller. I'm following the <a href="http://blog.8thlight.com/articles/2008/04/20/bowled-over-by-rubycocoa" rel="nofollow noreferrer">... | [
{
"answer_id": 279817,
"author": "Louis Gerbarg",
"author_id": 30506,
"author_profile": "https://Stackoverflow.com/users/30506",
"pm_score": 2,
"selected": false,
"text": "<p>RubyCocoa is not supported at all on the iPhone. There is no bridge support library, and I do not believe there i... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10631/"
] | I'm finally getting the hang of RSpec after spending a couple of hours over the weekend. Now I'm stuck trying to figure out how to assert that parameters are indeed passed into the controller. I'm following the [Bowled over by Ruby/Cocoa example](http://blog.8thlight.com/articles/2008/04/20/bowled-over-by-rubycocoa) an... | RubyCocoa is not supported at all on the iPhone. There is no bridge support library, and I do not believe there is any ruby interpreter on the phone.
You might be able to get it working in the simulator, it will not stop you from using OS X only libraries if you really try, but that still will not make it work on the ... |
278,351 | <p>I'm painfully new to PHP, and was trying to set up phpBB on my local site. I have a stock debian install of apache2 and php5. The phpBB installer ran fine, connected to the database and created all its tables with no problem. But when I tried to open the login page, I got a 0-byte response.</p>
<p>A little diggi... | [
{
"answer_id": 278394,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>I sometimes have PHP going down a 'black hole' when it finds a function that it can't find.</p>\n\n<p>Can you verify that t... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36228/"
] | I'm painfully new to PHP, and was trying to set up phpBB on my local site. I have a stock debian install of apache2 and php5. The phpBB installer ran fine, connected to the database and created all its tables with no problem. But when I tried to open the login page, I got a 0-byte response.
A little digging showed tha... | try doing this:
```
<?php
ini_set('display_errors', true);
error_reporting(E_ALL | E_NOTICE);
$id = mysql_pconnect('localhost','myusername', 'mypassword', true);
print "id=".$id."\n";
?>
```
and see what the response is
**edit**
From your comment it looks like the mysql module is not installed or enabled. You coul... |
278,361 | <p>I'm updating a long list of records. In my code, everything run as predicted until it execute the query. I get an </p>
<blockquote>
<p>Incorrect syntax near 'TempUpdatePhysicalCityStateZip' </p>
</blockquote>
<p>(my stored procedure name). I've tested it with SQL Server Management Studio and it runs fine. So, I'... | [
{
"answer_id": 278380,
"author": "DOK",
"author_id": 27637,
"author_profile": "https://Stackoverflow.com/users/27637",
"pm_score": 3,
"selected": false,
"text": "<p>I believe you can get that puzzling error message if you don't specify the command type:</p>\n\n<pre><code>cmdUpdate.Comman... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28647/"
] | I'm updating a long list of records. In my code, everything run as predicted until it execute the query. I get an
>
> Incorrect syntax near 'TempUpdatePhysicalCityStateZip'
>
>
>
(my stored procedure name). I've tested it with SQL Server Management Studio and it runs fine. So, I'm not quite sure where I got it ... | I believe you can get that puzzling error message if you don't specify the command type:
```
cmdUpdate.CommandType = CommandType.StoredProcedure;
``` |
278,363 | <p>My lack of C++ experience, or rather my early learning in garbage collected languages is really stinging me at the moment and I have a problem working with strings in C++.</p>
<p>To make it very clear, using std::string or equlivents is not an option - this is char* 's all the way.</p>
<p>So: what I need to do is ... | [
{
"answer_id": 278406,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>Since std::string is not an option, for whatever reason, have you looked into smart pointers? See <a href=\"http://www.boos... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15667/"
] | My lack of C++ experience, or rather my early learning in garbage collected languages is really stinging me at the moment and I have a problem working with strings in C++.
To make it very clear, using std::string or equlivents is not an option - this is char\* 's all the way.
So: what I need to do is very simple and ... | Since std::string is not an option, for whatever reason, have you looked into smart pointers? See [boost](http://www.boost.org/doc/libs/1_37_0/libs/smart_ptr/smart_ptr.htm)
But I can only encourage you to use std::string.
Christian |
278,398 | <p>I'd like to have a blank line after my bash prompt and before the output on my Mac. It should look like this would:</p>
<pre><code>echo; ls
</code></pre>
<p>Can I add a newline to my bash prompt and then go back up one line to wait for user input? Is there something obvious I'm missing?</p>
| [
{
"answer_id": 278414,
"author": "Paul D. Eden",
"author_id": 3045,
"author_profile": "https://Stackoverflow.com/users/3045",
"pm_score": 2,
"selected": false,
"text": "<p>To my knowledge this is not possible unless you delve into more low-level stuff like full-screen emulators like curs... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019/"
] | I'd like to have a blank line after my bash prompt and before the output on my Mac. It should look like this would:
```
echo; ls
```
Can I add a newline to my bash prompt and then go back up one line to wait for user input? Is there something obvious I'm missing? | I know this is old but for someone like me who came across this while googling for it. This is how you do this...
It's actually pretty simple!
Check out this link --> [Cursor Movement](http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x361.html)
Basically to move up N number of lines:
```
echo -e "\033[<N>A HELLO WORLD\n"
``... |
278,416 | <p>I have a C++ assembly with both managed and umanaged code compiled to
a DLL. It is correctly imported into the project references as I can
see all my classes and their members with the Object Browser.</p>
<p>The problem is with the XAML Design view. In my XAML code I want to
make a data bind with my C++ assembly s... | [
{
"answer_id": 278531,
"author": "Aaron Fischer",
"author_id": 5618,
"author_profile": "https://Stackoverflow.com/users/5618",
"pm_score": 2,
"selected": true,
"text": "<p>This is probably happening because the ide cannot load one of the unmanaged dll's. You may have to move them into th... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36234/"
] | I have a C++ assembly with both managed and umanaged code compiled to
a DLL. It is correctly imported into the project references as I can
see all my classes and their members with the Object Browser.
The problem is with the XAML Design view. In my XAML code I want to
make a data bind with my C++ assembly so I have th... | This is probably happening because the ide cannot load one of the unmanaged dll's. You may have to move them into the windows/system32. |
278,421 | <p>I'm trying to drop a SQL Server database using the following code:</p>
<pre><code>SqlCommand command = new SqlCommand("USE MASTER; ALTER DATABASE @database SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE @Database", connection);
command.Parameters.AddWithValue("@database", TestingEnvironment.DatabaseName);
c... | [
{
"answer_id": 278492,
"author": "Mr. Flibble",
"author_id": 34632,
"author_profile": "https://Stackoverflow.com/users/34632",
"pm_score": 0,
"selected": false,
"text": "<p>Are the Params case sensitive? You have a capital D in the 2nd @Database.</p>\n"
},
{
"answer_id": 278568,
... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1727/"
] | I'm trying to drop a SQL Server database using the following code:
```
SqlCommand command = new SqlCommand("USE MASTER; ALTER DATABASE @database SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE @Database", connection);
command.Parameters.AddWithValue("@database", TestingEnvironment.DatabaseName);
command.Execute... | putting it simply the Alter Database command doesn't support parameters as you want it to. you'll have to concat strings here. |
278,429 | <p>I have a piece of code looking like this : </p>
<pre><code>TAxis *axis = 0;
if (dynamic_cast<MonitorObjectH1C*>(obj))
axis = (dynamic_cast<MonitorObjectH1C*>(obj))->GetXaxis();
</code></pre>
<p>Sometimes it crashes : </p>
<pre><code>Thread 1 (Thread -1208658240 (LWP 11400)):
#0 0x0019e7a2 in _d... | [
{
"answer_id": 278479,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 1,
"selected": false,
"text": "<p>Can the value of obj be changed by a different thread?</p>\n"
},
{
"answer_id": 278483,
"author": "Dav... | 2008/11/10 | [
"https://Stackoverflow.com/questions/278429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20986/"
] | I have a piece of code looking like this :
```
TAxis *axis = 0;
if (dynamic_cast<MonitorObjectH1C*>(obj))
axis = (dynamic_cast<MonitorObjectH1C*>(obj))->GetXaxis();
```
Sometimes it crashes :
```
Thread 1 (Thread -1208658240 (LWP 11400)):
#0 0x0019e7a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x048... | Some possible reasons for the crash:
* `obj` points to an object with a non-polymorphic type (a class or struct with no virtual methods, or a fundamental type).
* `obj` points to an object that has been freed.
* `obj` points to unmapped memory, or memory that has been mapped in such a way as to generate an exception w... |