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 |
|---|---|---|---|---|---|---|
537,303 | <p>In code, I sometimes see people specify constants in hex format like this:</p>
<pre><code>const int has_nukes = 0x0001;
const int has_bio_weapons = 0x0002;
const int has_chem_weapons = 0x0004;
// ...
int arsenal = has_nukes | has_bio_weapons | has_chem_weapons; // all of them
if(arsenal &= has_bio_weapo... | [
{
"answer_id": 537321,
"author": "Jon B",
"author_id": 27414,
"author_profile": "https://Stackoverflow.com/users/27414",
"pm_score": 4,
"selected": false,
"text": "<p>You can use << if you like.</p>\n\n<pre><code>int hasNukes = 1;\nint hasBioWeapons = 1 << 1;\nint hasChemWeap... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60628/"
] | In code, I sometimes see people specify constants in hex format like this:
```
const int has_nukes = 0x0001;
const int has_bio_weapons = 0x0002;
const int has_chem_weapons = 0x0004;
// ...
int arsenal = has_nukes | has_bio_weapons | has_chem_weapons; // all of them
if(arsenal &= has_bio_weapons){
std::cout <... | I'd use a bit shift operator:
```
const int has_nukes = 1<<0;
const int has_bio_weapons = 1<<1;
const int has_chem_weapons = 1<<2;
// ...
int dangerous_mask = has_nukes | has_bio_weapons | has_chem_weapons;
bool is_dangerous = (country->flags & dangerous_mask) == dangerous_mask;
```
It is even better than fl... |
537,306 | <p>I have a ActionResult named "<strong>MyPeriods(string dateSelected)</strong>" and in the end of it, I have a <strong>ViewData["periods"] = listOfPeriods</strong> (and after that, I have my return View(), fininshing up my method). When no "date" is passed, "date" is today, otherwise, "date" is the date passed as argu... | [
{
"answer_id": 537372,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 3,
"selected": true,
"text": "<p>You need to add a success callback to the ajax call that will accept the returned data and update your page via DOM m... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60286/"
] | I have a ActionResult named "**MyPeriods(string dateSelected)**" and in the end of it, I have a **ViewData["periods"] = listOfPeriods** (and after that, I have my return View(), fininshing up my method). When no "date" is passed, "date" is today, otherwise, "date" is the date passed as argument. And this "date" is impo... | You need to add a success callback to the ajax call that will accept the returned data and update your page via DOM manipulation, for example, by replacing the contents of a DIV with the HTML (presumably) returned by your action. I'm assuming here that your action returns a ContentResult. If you are returning a JsonRes... |
537,308 | <p>How do I verify that method was NOT called in <a href="http://code.google.com/p/moq/" rel="noreferrer">Moq</a>? </p>
<p>Does it have something like AssertWasNotCalled?</p>
<p>UPDATE: Starting from Version 3.0, a new syntax can be used:</p>
<pre><code>mock.Verify(foo => foo.Execute("ping"), Times.Never());
</co... | [
{
"answer_id": 537461,
"author": "Aaron Digulla",
"author_id": 34088,
"author_profile": "https://Stackoverflow.com/users/34088",
"pm_score": -1,
"selected": false,
"text": "<p>Use .AtMostOnce();</p>\n\n<p>After the real test, call the method again. If it throws an exception, it was calle... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19268/"
] | How do I verify that method was NOT called in [Moq](http://code.google.com/p/moq/)?
Does it have something like AssertWasNotCalled?
UPDATE: Starting from Version 3.0, a new syntax can be used:
```
mock.Verify(foo => foo.Execute("ping"), Times.Never());
``` | **UPDATE**: Since version 3, check the update to the question above or Dann's answer below.
Either, make your mock strict so it will fail if you call a method for which you don't have an expect
```
new Mock<IMoq>(MockBehavior.Strict)
```
Or, if you want your mock to be loose, use the .Throws( Exception )
```
var m... |
537,312 | <p>I've been working on converting a basicHttpBinding to a customBinding to get my client working on a web farm. I've been fumbling translating the following security section.</p>
<pre>
<basicHttpBinding ...>
<security mode="Transport">
<transport clientCredentialType="Certificate">
</... | [
{
"answer_id": 538526,
"author": "David",
"author_id": 21909,
"author_profile": "https://Stackoverflow.com/users/21909",
"pm_score": 3,
"selected": true,
"text": "<p>Ok, I figured this out, didn't need to even use the security section in the custombinding, everything I need to set was on... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21909/"
] | I've been working on converting a basicHttpBinding to a customBinding to get my client working on a web farm. I've been fumbling translating the following security section.
```
<basicHttpBinding ...>
<security mode="Transport">
<transport clientCredentialType="Certificate">
</security>
</basicHttpBinding>... | Ok, I figured this out, didn't need to even use the security section in the custombinding, everything I need to set was on the <httpsTransport/> element itself. I've cut out all the non important bits.
```
<customBinding>
<binding name="viaLoadBalancers">
<textMessageEncoding
messageVersion=... |
537,353 | <p>I've written a bug reporter for my game, and after it launches, the user can review the data and submit the report to my web server via HTTP. If the submission fails, the user has the option to save the report and try again later, using the bug reporter itself, uploading the file with a web form, or attaching the r... | [
{
"answer_id": 537384,
"author": "Tom Ritter",
"author_id": 8435,
"author_profile": "https://Stackoverflow.com/users/8435",
"pm_score": 0,
"selected": false,
"text": "<p>Sounds like you're trying to tell the difference between e-mail from random people you've never talked to before, that... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've written a bug reporter for my game, and after it launches, the user can review the data and submit the report to my web server via HTTP. If the submission fails, the user has the option to save the report and try again later, using the bug reporter itself, uploading the file with a web form, or attaching the repor... | Other than regular spam filters, etc I do have a suggestion for this.
If, in your application, or page, you can specify a Subject= with the Mailto: link, put a unique ID in the Subject of your message that you will be expecting to receive.
That way you accomplish 2 goals - recognizing the ID in the subject, you will ... |
537,374 | <p>The STLport bundled with the SunStudio11 generates alot of warnings. I beleive most compilers have a way to disable warnings from certain source files, like this:</p>
<p>Sun C</p>
<pre><code>#pragma error_messages off
#include <header.h>
// ...
#pragma error_messages on
</code></pre>
<p>gcc</p>
<pre><cod... | [
{
"answer_id": 537446,
"author": "Timo Geusch",
"author_id": 29068,
"author_profile": "https://Stackoverflow.com/users/29068",
"pm_score": 0,
"selected": false,
"text": "<p>Can't help with turning the warnings off, but when I last looked at SunStudio, it shipped with two STLs - an older ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25164/"
] | The STLport bundled with the SunStudio11 generates alot of warnings. I beleive most compilers have a way to disable warnings from certain source files, like this:
Sun C
```
#pragma error_messages off
#include <header.h>
// ...
#pragma error_messages on
```
gcc
```
#pragma warning(push, 0)
#include <head... | In SunStudio 12, the #pragma error\_messages work as documented in the C users manual.
You can see the tags with the -errtags=yes option, and use it like this:
```
// Disable badargtypel2w:
// String literal converted to char* in formal argument
#pragma error_messages (off, badargtypel2w )
```
and then compile ... |
537,381 | <p>I'm trying to create a simple toggling sidebar using jquery, where it expands and contracts when a button is pressed. The button also changes to another type of button when pressed. The sidebar will expand, but for some reason, it will not move back to it's original position.
You can see a copy of the javascript an... | [
{
"answer_id": 537421,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 3,
"selected": true,
"text": "<p>try instead of right use left with a negative number. in addition I would recommend using preventDefault instead of re... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to create a simple toggling sidebar using jquery, where it expands and contracts when a button is pressed. The button also changes to another type of button when pressed. The sidebar will expand, but for some reason, it will not move back to it's original position.
You can see a copy of the javascript and h... | try instead of right use left with a negative number. in addition I would recommend using preventDefault instead of returning false.
```
$(".active").click(function(e){
e.preventDefault();
$("#sidebar").animate({opacity: "hide", left: -250}, "slow");
$(this).toggleClass("btn-slide");
});
```
Update
----... |
537,399 | <p>I've been told wsgi is the way to go and not mod_python. But more specifically, how would you set up your multi website server environment? Choice of web server, etc?</p>
| [
{
"answer_id": 537504,
"author": "ohnoes",
"author_id": 53330,
"author_profile": "https://Stackoverflow.com/users/53330",
"pm_score": 1,
"selected": false,
"text": "<p>I'd recommend Nginx for the web server. Fast and easy to set up. </p>\n\n<p>You'd probably want to have one unix user pe... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65136/"
] | I've been told wsgi is the way to go and not mod\_python. But more specifically, how would you set up your multi website server environment? Choice of web server, etc? | Apache+mod\_wsgi is a common choice.
Here's a simple example vhost, setup up to map any requests for /wsgi/something to the application (which can then look at PATH\_INFO to choose an action, or however you are doing your dispatching). The root URL '/' is also routed to the WSGI application.
```
LoadModule wsgi_modul... |
537,401 | <p>I'm working with a SQL Server DB that's got tables spread across multiple schemas (not my idea), so queries end up looking like this:</p>
<pre><code>select col1, col2
from some_ridiculously_long_schema_name.table1 t1
inner join
another_really_long_schema_location.table2 t2
on...
</code></pre>
<p>... you ge... | [
{
"answer_id": 537410,
"author": "Mladen Prajdic",
"author_id": 31345,
"author_profile": "https://Stackoverflow.com/users/31345",
"pm_score": 0,
"selected": false,
"text": "<p>no it doesn't. synonims are the only way.</p>\n"
},
{
"answer_id": 537414,
"author": "SQLMenace",
... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65131/"
] | I'm working with a SQL Server DB that's got tables spread across multiple schemas (not my idea), so queries end up looking like this:
```
select col1, col2
from some_ridiculously_long_schema_name.table1 t1
inner join
another_really_long_schema_location.table2 t2
on...
```
... you get the idea.
This is a sma... | Red-Gate sells an SQL tool that adds intellisense to server management studio. Never tried it but it might help cut down on the keystrokes: <http://www.red-gate.com/products/SQL_Prompt/index.htm> |
537,404 | <p>i would like to translate a following script from linux shell to Windows XP shell</p>
<pre><code>GPSID=$(awk '/GPSID/ {print $3}' gora.RTK )
awk -v variable=${GPSID} 'BEGIN {printf "Numer seryjny : " variable,$1}' >>out.txt
</code></pre>
<p>The second line has been translated; the problem is with defining a... | [
{
"answer_id": 537450,
"author": "Sandeep Datta",
"author_id": 39648,
"author_profile": "https://Stackoverflow.com/users/39648",
"pm_score": 0,
"selected": false,
"text": "<p>How about ...</p>\n\n<p>for /f \"tokens=*\" %%a in ('echo Hello World') do set var=%%a</p>\n\n<p>NOTE: use %a ins... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | i would like to translate a following script from linux shell to Windows XP shell
```
GPSID=$(awk '/GPSID/ {print $3}' gora.RTK )
awk -v variable=${GPSID} 'BEGIN {printf "Numer seryjny : " variable,$1}' >>out.txt
```
The second line has been translated; the problem is with defining a variable that contains shell ou... | ok problem fixed
```
for /f "tokens=*" %%a in ('awk "/GPSID/ {print $3}" gora.RTK ') do set var=%%a
awk "BEGIN {printf \"GPSID : \" }" >out.txt
echo %var% >>out.txt
```
This code basicly does what I wanted to do.
You are great Thanks !!!!! |
537,408 | <p>I'm not sure of the exact terminology here. Basically, if I have a model like:</p>
<pre><code>class Student : IDoSchool {}
class Freshman : Student {}
interface IDoSchool {}
</code></pre>
<p>What code would tell me that Freshman doesn't directly implement any interfaces and Student directly implements IDoSchool?</... | [
{
"answer_id": 537470,
"author": "bohdan_trotsenko",
"author_id": 58768,
"author_profile": "https://Stackoverflow.com/users/58768",
"pm_score": 0,
"selected": false,
"text": "<p>Just an idea...</p>\n\n<p>You can get interfaces of the class, and interfaces of the base class.\nThen get the... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1946/"
] | I'm not sure of the exact terminology here. Basically, if I have a model like:
```
class Student : IDoSchool {}
class Freshman : Student {}
interface IDoSchool {}
```
What code would tell me that Freshman doesn't directly implement any interfaces and Student directly implements IDoSchool?
In other words (disregardi... | I suspect the semantic of an interface is not in alignment with what you are trying to do.
An interface simply says that a class has to implemnt a list of members. The class inherits the interface but it is still the responsibilityy of the children class to implement the interface it inherited from the parent. Most of... |
537,431 | <p>My problem is simple. I search a specific pattern in a file (let's say label in a Tex file)</p>
<pre><code>:g/label/#
</code></pre>
<p>but there are lots of occurrences. So I'd like to redirect this output to another file to be able to work easily with it.</p>
<p>Do you have a trick or a command that I don't know... | [
{
"answer_id": 537455,
"author": "chaos",
"author_id": 47529,
"author_profile": "https://Stackoverflow.com/users/47529",
"pm_score": 3,
"selected": true,
"text": "<p>What you're doing is essentially 'grep -n label <i>file</i>' from command line. So you can run that command and > it into... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63347/"
] | My problem is simple. I search a specific pattern in a file (let's say label in a Tex file)
```
:g/label/#
```
but there are lots of occurrences. So I'd like to redirect this output to another file to be able to work easily with it.
Do you have a trick or a command that I don't know? | What you're doing is essentially 'grep -n label *file*' from command line. So you can run that command and > it into a file easily enough.
The derivation of 'grep' is even from basically the same source. |
537,437 | <p>I'm putting some files in /tmp on a web server that are being used by a web application for a limited amount of time. If the files get left in the server's /tmp after the user quits using the application and this happens repeatedly, should i be concerned about the directory filling up? I read online that rebooting c... | [
{
"answer_id": 537447,
"author": "Paul Whelan",
"author_id": 3050,
"author_profile": "https://Stackoverflow.com/users/3050",
"pm_score": 2,
"selected": false,
"text": "<p>Yep It will be linked to one of your disks/partitions and can fill up.\nIt gets deleted on a reboot.</p>\n\n<p>When t... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65147/"
] | I'm putting some files in /tmp on a web server that are being used by a web application for a limited amount of time. If the files get left in the server's /tmp after the user quits using the application and this happens repeatedly, should i be concerned about the directory filling up? I read online that rebooting clea... | Yes, it will fill up. Consider implementing a cron job that will delete old files after a while.
Something like this should do the trick:
```
/usr/bin/find /tmp/mydata -type f -atime +1 -exec rm -f {} \;
```
This will delete files that have a modification time that's more than a day old.
Or as a crontab entry:
``... |
537,453 | <p>Hey! I am not trying to push my luck here but I have another c# question.
I have tried every possible event I found using google.
Here is the code:</p>
<pre><code> private void Form1_OnClose()
{
MessageBox.Show("I was closed -2");
}
private void Form1_Exit(object sender, EventAr... | [
{
"answer_id": 537469,
"author": "Anton Gogolev",
"author_id": 60188,
"author_profile": "https://Stackoverflow.com/users/60188",
"pm_score": 5,
"selected": true,
"text": "<p>You might be missing actual subscription code, which is something along these lines:</p>\n\n<pre><code>this.Closin... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8715/"
] | Hey! I am not trying to push my luck here but I have another c# question.
I have tried every possible event I found using google.
Here is the code:
```
private void Form1_OnClose()
{
MessageBox.Show("I was closed -2");
}
private void Form1_Exit(object sender, EventArgs evArgs)
... | You might be missing actual subscription code, which is something along these lines:
```
this.Closing += Form1_Closing;
```
Instead, try overriding *OnXXX* methods - this is the preferred way of doing things. |
537,475 | <p>I have some javascript that I'm trying to retool using jQuery to learn the library better and I am running into what seems to be a very elementary problem.</p>
<p>html:</p>
<pre><code><form id="theForm">
What would you like to do?<br /><br />
<input type="text" id="doThis" /><br /><... | [
{
"answer_id": 537486,
"author": "Ionuț Staicu",
"author_id": 23810,
"author_profile": "https://Stackoverflow.com/users/23810",
"pm_score": -1,
"selected": false,
"text": "<pre><code>$(\"#theForm\").submit(function(){\n var doThis = $(\"#doThis\").value.toLowerCase(); \n ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62983/"
] | I have some javascript that I'm trying to retool using jQuery to learn the library better and I am running into what seems to be a very elementary problem.
html:
```
<form id="theForm">
What would you like to do?<br /><br />
<input type="text" id="doThis" /><br /><br />
</form>
```
js:
```
$(document).ready(functi... | You need to use [`val()`](http://docs.jquery.com/Attributes/val) to get the value in jQuery
```
$("#doThis").val().toLowerCase();
```
The DOM object is not readily accessible off of `$()`, it is stored in `[0]` by jQuery, so if you wanted to access the value the traditional way, you would do:
```
$("#doThis")[0].va... |
537,502 | <p>Why i cant set selecteditem property programatically?</p>
<p>Im calling it from another XAML Window, that hace certaing controls , one of them is a ComboBox i was trying this : </p>
<pre><code> string tm = (from ea in db.EXAMENXATENCIONs where ea.codigo == Convert.ToInt32(numeroinforme) select ea.turnom... | [
{
"answer_id": 537486,
"author": "Ionuț Staicu",
"author_id": 23810,
"author_profile": "https://Stackoverflow.com/users/23810",
"pm_score": -1,
"selected": false,
"text": "<pre><code>$(\"#theForm\").submit(function(){\n var doThis = $(\"#doThis\").value.toLowerCase(); \n ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1388553/"
] | Why i cant set selecteditem property programatically?
Im calling it from another XAML Window, that hace certaing controls , one of them is a ComboBox i was trying this :
```
string tm = (from ea in db.EXAMENXATENCIONs where ea.codigo == Convert.ToInt32(numeroinforme) select ea.turnomedico).FirstOrDefault... | You need to use [`val()`](http://docs.jquery.com/Attributes/val) to get the value in jQuery
```
$("#doThis").val().toLowerCase();
```
The DOM object is not readily accessible off of `$()`, it is stored in `[0]` by jQuery, so if you wanted to access the value the traditional way, you would do:
```
$("#doThis")[0].va... |
537,524 | <p>Which is the preferred/recommended way of handling events in .NET:</p>
<pre><code>this.Load += new EventHandler(Form1_Load);
private void Form1_Load(object sender, EventArgs e)
{ }
</code></pre>
<p><strong>or</strong></p>
<pre><code>protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
</code></pre>... | [
{
"answer_id": 537540,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": -1,
"selected": false,
"text": "<p>The overridden method is preferrable as it will be invoked <del>polymorphically</del> virtually by the CLR.</p>\n\... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/343/"
] | Which is the preferred/recommended way of handling events in .NET:
```
this.Load += new EventHandler(Form1_Load);
private void Form1_Load(object sender, EventArgs e)
{ }
```
**or**
```
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
```
What would the pros/cons of each method be? I've used bot... | The first way is what Microsoft suggests. The pattern is:
1. some code wants to raise an event, calls OnXxx
2. OnXxx makes a call to the delegate
3. Wired event handlers are called
If you perform the second model, you risk forgetting the base.OnXxx call and breaking everything. Nice part of option 2 is that you get t... |
537,542 | <p>How can I get a MD5, SHA and other hashes from a file but only doing one pass? I have 100mb files, so I'd hate to process those 100MB files multiple times.</p>
| [
{
"answer_id": 537585,
"author": "ʞɔıu",
"author_id": 41613,
"author_profile": "https://Stackoverflow.com/users/41613",
"pm_score": 4,
"selected": false,
"text": "<p>Something like this perhaps?</p>\n\n<pre><code>>>> import hashlib\n>>> hashes = (hashlib.md5(), hashlib.... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I get a MD5, SHA and other hashes from a file but only doing one pass? I have 100mb files, so I'd hate to process those 100MB files multiple times. | Here's a modified [`@ʞɔıu`'s answer](https://stackoverflow.com/questions/537542/how-can-i-create-multiple-hashes-of-a-file-using-only-one-pass/537585#537585) using [`@Jason S`' suggestion](https://stackoverflow.com/questions/537542/how-can-i-create-multiple-hashes-of-a-file-using-only-one-pass/537597#537597).
```
fro... |
537,554 | <p>Using a ajax request I want to change content of my div.</p>
<pre><code><div id="d1">202</div>
</code></pre>
<p>So I want to change the content to a different number.</p>
<pre><code>$('d1').InnerText???
</code></pre>
<p>Also, say I wanted to increment the number, how could I do that? Do I have to con... | [
{
"answer_id": 537561,
"author": "Paolo Bergantino",
"author_id": 16417,
"author_profile": "https://Stackoverflow.com/users/16417",
"pm_score": 5,
"selected": false,
"text": "<pre><code>$(\"#di\").html('My New Text');\n</code></pre>\n\n<p>Check out the <a href=\"http://docs.jquery.com/At... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Using a ajax request I want to change content of my div.
```
<div id="d1">202</div>
```
So I want to change the content to a different number.
```
$('d1').InnerText???
```
Also, say I wanted to increment the number, how could I do that? Do I have to convert to int? | ```
$("#di").html('My New Text');
```
Check out the [jQuery documentation](http://docs.jquery.com/Attributes/html#val).
If you wanted to increment the number, you would do
```
var theint = parseInt($("#di").html(),10)
theint++;
$("#di").html(theint);
```
P.S. Not sure if it was a typo or not, but you need to incl... |
537,565 | <p>My .net MVC action is going to respond to ajax requests (jquery).</p>
<p>Do I (or should I) set the document type of my header?</p>
<p>I will be responding with either just html/plain text or maybe even JSON.</p>
| [
{
"answer_id": 537581,
"author": "Luca Matteis",
"author_id": 50394,
"author_profile": "https://Stackoverflow.com/users/50394",
"pm_score": 2,
"selected": true,
"text": "<p>If it's responding with html/plain text use:</p>\n\n<pre><code>Content-Type: text/html;\n</code></pre>\n\n<p>If it'... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | My .net MVC action is going to respond to ajax requests (jquery).
Do I (or should I) set the document type of my header?
I will be responding with either just html/plain text or maybe even JSON. | If it's responding with html/plain text use:
```
Content-Type: text/html;
```
If it's responding with JSON use:
```
Content-type: application/json
```
It is good practice to do so, although it really depends on what you're doing with the responded data.
Sometimes JavaScript frameworks will automatically *work* t... |
537,573 | <p>I want to pass a <code>byte[]</code> to a method takes a <code>IntPtr</code> Parameter in C#, is that possible and how?</p>
| [
{
"answer_id": 537652,
"author": "Richard Szalay",
"author_id": 3603,
"author_profile": "https://Stackoverflow.com/users/3603",
"pm_score": 8,
"selected": true,
"text": "<p>Not sure about getting an IntPtr to an array, but you can copy the data for use with unmanaged code by using Mashal... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537573",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32718/"
] | I want to pass a `byte[]` to a method takes a `IntPtr` Parameter in C#, is that possible and how? | Not sure about getting an IntPtr to an array, but you can copy the data for use with unmanaged code by using Mashal.Copy:
```
IntPtr unmanagedPointer = Marshal.AllocHGlobal(bytes.Length);
Marshal.Copy(bytes, 0, unmanagedPointer, bytes.Length);
// Call unmanaged code
Marshal.FreeHGlobal(unmanagedPointer);
```
Alterna... |
537,574 | <p>Consider the following table:</p>
<pre><code>create table temp
(
name int,
a int,
b int
)
insert into temp (name, a, b)
values (1, 2, 3)
insert into temp (name, a, b)
values (1, 4, 5)
insert into temp (name, a, b)
values (2, 6, 7)
</code></pre>
<p>I want to select *(all fields) wit... | [
{
"answer_id": 537604,
"author": "SQLMenace",
"author_id": 740,
"author_profile": "https://Stackoverflow.com/users/740",
"pm_score": 2,
"selected": true,
"text": "<p>Here is one way to do this\nsql 2000 and up version</p>\n\n<pre><code>select t1.* from(\nselect name,max(B) as MaxB\nfrom ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48465/"
] | Consider the following table:
```
create table temp
(
name int,
a int,
b int
)
insert into temp (name, a, b)
values (1, 2, 3)
insert into temp (name, a, b)
values (1, 4, 5)
insert into temp (name, a, b)
values (2, 6, 7)
```
I want to select \*(all fields) with distinct [name]. In the... | Here is one way to do this
sql 2000 and up version
```
select t1.* from(
select name,max(B) as MaxB
from temp
group by name) t2
join temp t1 on t1.a = t2.MaxB
and t1.name = t2.name
```
SQL 2005 and up version
```
select name, a, b
from (
select m.*,
row_number() over (
partition by name
order by B desc) as rn
from... |
537,580 | <p>I want to download multiple files (mostly images) from VB6 application. presently i m using URLDownloadToFile but it allows only one file at a time and there is no progress bar. I want to download multiple files and with progress bar. please help. thanks in advance.</p>
<p>my present code:</p>
<pre><code>Dim lngRe... | [
{
"answer_id": 537758,
"author": "Adam Davis",
"author_id": 2915,
"author_profile": "https://Stackoverflow.com/users/2915",
"pm_score": 2,
"selected": false,
"text": "<p>You're hoping for a VB answer, but this is non trivial.</p>\n\n<p>Most of the following comes from <a href=\"http://ww... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to download multiple files (mostly images) from VB6 application. presently i m using URLDownloadToFile but it allows only one file at a time and there is no progress bar. I want to download multiple files and with progress bar. please help. thanks in advance.
my present code:
```
Dim lngRetVal As Long
lngRetVa... | You're hoping for a VB answer, but this is non trivial.
Most of the following comes from <http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_20571958.html>
>
> IBindStatusCallback interface is not
> directly accessible from VB. It must
> be introduced into a compatible type
> library.
>
>
> Yo... |
537,584 | <p>I'm sure this is fairly easy, but I've kind of had a hard time with it. I've got a custom action that executes a different (non-msi) installer on installation. Unfortunately, I've noticed that it also executes the installer on UNinstallation!</p>
<p>I've looked through the options but I cant' seem to find out how t... | [
{
"answer_id": 538876,
"author": "saschabeaumont",
"author_id": 592,
"author_profile": "https://Stackoverflow.com/users/592",
"pm_score": 8,
"selected": true,
"text": "<p>Add a condition on the action so it's only triggered during installation, not uninstallation.</p>\n\n<p>Action run on... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48957/"
] | I'm sure this is fairly easy, but I've kind of had a hard time with it. I've got a custom action that executes a different (non-msi) installer on installation. Unfortunately, I've noticed that it also executes the installer on UNinstallation!
I've looked through the options but I cant' seem to find out how to stop thi... | Add a condition on the action so it's only triggered during installation, not uninstallation.
Action run only during Install
```
NOT Installed AND NOT PATCH
```
Action runs during Install and repair
```
NOT REMOVE
```
Run on initial installation only:
```
NOT Installed
```
Run on initial install or when repai... |
537,593 | <p>I'm writing a simple real-estate listing app in Django. Each property needs to have a variable number of images. Images need to have an editable order. And I need to make the admin user-proof.</p>
<p>So that said, what are my options? </p>
<ol>
<li><p>Is there a ImageList field that I don't know about?</p></li>
<l... | [
{
"answer_id": 537773,
"author": "Javier",
"author_id": 11649,
"author_profile": "https://Stackoverflow.com/users/11649",
"pm_score": 3,
"selected": false,
"text": "<p>Write an Image model that has a ForeignKey to your Property model. Quite probably, you'll have some other fields that be... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12870/"
] | I'm writing a simple real-estate listing app in Django. Each property needs to have a variable number of images. Images need to have an editable order. And I need to make the admin user-proof.
So that said, what are my options?
1. Is there a ImageList field that I don't know about?
2. Is there an app like `django.co... | 1. Variable lists, also known as a many-to-one relationship, are usually handled by making a separate model for the many and, in that model, using a ForeignKey to the "one".
2. There isn't an app like this in django.contrib, but there are several external projects you can use, e.g. [django-photologue](https://github.co... |
537,613 | <p>Ok, I've scoured the web, BOL, various forums and I'm no closer to an answer...hopefully you fine folks can lend a hand...</p>
<p>We've got a dozen or so SQL Servers (some 2k, some 2005) on a network. I'm using SMO objects in a .NET application to get some standard information. My problem appears to boil down to a ... | [
{
"answer_id": 538190,
"author": "Tim Lentine",
"author_id": 2833,
"author_profile": "https://Stackoverflow.com/users/2833",
"pm_score": 0,
"selected": false,
"text": "<p>Just so we understand the issue properly, the Microsoft.SqlServer.BatchParser.dll is not installed in the Global Asse... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Ok, I've scoured the web, BOL, various forums and I'm no closer to an answer...hopefully you fine folks can lend a hand...
We've got a dozen or so SQL Servers (some 2k, some 2005) on a network. I'm using SMO objects in a .NET application to get some standard information. My problem appears to boil down to a missing DL... | Are you running a x64 OS on your box? There appear to be problems with BatchParser.dll in 64-bit environments - usually it is recommended to download the [SMO x64 Package](http://download.microsoft.com/download/4/4/D/44DBDE61-B385-4FC2-A67D-48053B8F9FAD/SQLServer2005_XMO_x64.msi) (SQLServer2005\_XMO\_x64.msi) from Micr... |
537,682 | <p>I'd like to do something similar to <code>jython -cp FOO:BAR:BAZ argle.py</code>.</p>
<p>If I add <code>FOO</code>, <code>BAR</code>, and <code>BAZ</code> to <code>$CLASSPATH</code> this works. I tried to add them to <code>sys.path</code> at run-time, but that doesn't appear to work for jars. It <em>does</em> work ... | [
{
"answer_id": 537764,
"author": "axelclk",
"author_id": 24819,
"author_profile": "https://Stackoverflow.com/users/24819",
"pm_score": 2,
"selected": false,
"text": "<p>You can create a big JAR which contains all related classes. The following ant snippet shows the idea:</p>\n\n<pre><cod... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4203/"
] | I'd like to do something similar to `jython -cp FOO:BAR:BAZ argle.py`.
If I add `FOO`, `BAR`, and `BAZ` to `$CLASSPATH` this works. I tried to add them to `sys.path` at run-time, but that doesn't appear to work for jars. It *does* work if I add a path to the expanded jars to `sys.path` at runtime. Is there a simple al... | You can use the `-D` option to set `python.path`:
```
jython -Dpython.path=FOO:BAR:BAZ argyle.py
``` |
537,685 | <p>Question regarding how to setup dbase relationships (newbie, this may be trivial)</p>
<p>Followed the django tutorial (Poll, Choices); understood that 1 Poll has many Choice(s), therefore many Choice(s) point to a single Poll.</p>
<pre><code> class Poll(models.Model):
question = models.CharField(max_length... | [
{
"answer_id": 537735,
"author": "hasen",
"author_id": 35364,
"author_profile": "https://Stackoverflow.com/users/35364",
"pm_score": 2,
"selected": true,
"text": "<p>I think you're looking for <a href=\"http://www.djangoproject.com/documentation/models/generic_relations/\" rel=\"nofollow... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8638/"
] | Question regarding how to setup dbase relationships (newbie, this may be trivial)
Followed the django tutorial (Poll, Choices); understood that 1 Poll has many Choice(s), therefore many Choice(s) point to a single Poll.
```
class Poll(models.Model):
question = models.CharField(max_length=200)
...
c... | I think you're looking for [Generic Relations](http://www.djangoproject.com/documentation/models/generic_relations/). [Also here](http://docs.djangoproject.com/en/dev/ref/contrib/contenttypes/) |
537,734 | <p>Hi I am querying the Sharepoint Lists using the Sharepoint Library in .net. I noticed that there is more than one title field. How can I get the user defined title field?</p>
<pre><code> SPListItem item = myItemCollection[i];
item["Title"] <- provides me the wrong title field
</code></pre>
<p>Is this a known... | [
{
"answer_id": 537754,
"author": "Andy Mikula",
"author_id": 58114,
"author_profile": "https://Stackoverflow.com/users/58114",
"pm_score": 0,
"selected": false,
"text": "<p>You're looking for <code>[\"LinkTitle\"]</code> or <code>[\"Name\"]</code> - most likely the former.</p>\n"
},
... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55057/"
] | Hi I am querying the Sharepoint Lists using the Sharepoint Library in .net. I noticed that there is more than one title field. How can I get the user defined title field?
```
SPListItem item = myItemCollection[i];
item["Title"] <- provides me the wrong title field
```
Is this a known issue, any work around? Thanks... | Run this in a console application. More than likely your problem is related to difference in Display and Internal name as mentioned above. Something to note: even when you create a custom list and rename the default "Title" field the internal name never changes from "Title".
```
using (SPSite siteCollection = new SPSi... |
537,737 | <p>The following HTML looks as required in Firefox 2 & 3 and IE7. The <code>Left</code> button is on the left, the <code>Right</code> button is on the right, and the text in the middle is...in the middle!</p>
<p>However on IE6 the <code>Left</code> button is misaligned - it appears center-aligned.</p>
<p>Can anyo... | [
{
"answer_id": 537832,
"author": "Bjorn",
"author_id": 66475,
"author_profile": "https://Stackoverflow.com/users/66475",
"pm_score": 0,
"selected": false,
"text": "<p>Your floated/positioned elements should be first in order before normally aligned text. Don't position them in the order ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39709/"
] | The following HTML looks as required in Firefox 2 & 3 and IE7. The `Left` button is on the left, the `Right` button is on the right, and the text in the middle is...in the middle!
However on IE6 the `Left` button is misaligned - it appears center-aligned.
Can anyone suggest why??
```
<!DOCTYPE html PUBLIC "-//W3C//D... | You must trigger the `hasLayout` property (an IE thing…) of `#footer`.
Width and height trigger it, if you don't want to set a width or height, you can use the IE-only `zoom` property in CSS.
```
<!DOCTYPE html>
<html>
<head>
<title>Layout problem!</title>
<style type="text/css">
div#footer
{
... |
537,753 | <p>in a VS 2008 solution I just inherited there is a normal class library project that actually should be a web application project (because it is a web service indeed). What is the best way to convert it?</p>
| [
{
"answer_id": 537759,
"author": "Robert S.",
"author_id": 7565,
"author_profile": "https://Stackoverflow.com/users/7565",
"pm_score": 3,
"selected": false,
"text": "<p>Create a new Web Service (or Web Application) project and add the class library files to it.</p>\n"
},
{
"answe... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5363/"
] | in a VS 2008 solution I just inherited there is a normal class library project that actually should be a web application project (because it is a web service indeed). What is the best way to convert it? | I also found out that this can be done manually by adding:
```
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
```
to the project file (\*.proj) just under `<ProjectGuid>...</ProjectGuid>` |
537,762 | <p>I have spent too much time on this problem and am beginning to think that it
can't be done in Django. I am pulling a list of pathogen names from a postgres
database to a drop down box. The user selects the pathogen, which requires the id
to be passed back through django to the database for further retrieval of
mor... | [
{
"answer_id": 537868,
"author": "Joe Holloway",
"author_id": 48837,
"author_profile": "https://Stackoverflow.com/users/48837",
"pm_score": 4,
"selected": true,
"text": "<p>The id of the select tag in your HTML does not need to have any knowledge of your pathology records. Your code is ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have spent too much time on this problem and am beginning to think that it
can't be done in Django. I am pulling a list of pathogen names from a postgres
database to a drop down box. The user selects the pathogen, which requires the id
to be passed back through django to the database for further retrieval of
more da... | The id of the select tag in your HTML does not need to have any knowledge of your pathology records. Your code is correct, except for the lack of closing select tag.
Your Django view that is mapped to the /pathology/ action URL needs to handle the POST method and pull the pathology id out of the request like so:
```... |
537,766 | <p>I'm printing a document by creating a <code>System.Diagnostics.Process</code> object and then setting the <code>StartInfo</code> verb to "print", then calling the process <code>Start()</code> method.</p>
<p>I want this print process to be hidden, so I'm setting <code>CreateNoWindow = true</code> and <code>WindowSty... | [
{
"answer_id": 537846,
"author": "Dave Swersky",
"author_id": 34796,
"author_profile": "https://Stackoverflow.com/users/34796",
"pm_score": 1,
"selected": false,
"text": "<p>If you want to print a Word document without Word actually appearing in a window, you'll want to use Office Automa... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50198/"
] | I'm printing a document by creating a `System.Diagnostics.Process` object and then setting the `StartInfo` verb to "print", then calling the process `Start()` method.
I want this print process to be hidden, so I'm setting `CreateNoWindow = true` and `WindowStyle = ProcessWindowStyle.Hidden`. But the application (Word ... | The StartInfo.WindowStyle is passed to the application and the application can do whatever it wants with it (it can use it or ignore it).
And I'm not sure but I think CreateNoWindow only applies to console applications.
Once a process is started you have no control over it and that process can show whatever UI it wan... |
537,771 | <p>The link only works when i click on the actual text not the area around it even though the hover effect is working so i know the button is being targeted?</p>
<p>this is also happening on a list within the site where I'm using left-padding and placing images there, if i click where the padding is it doesn't work?</... | [
{
"answer_id": 537995,
"author": "notnot",
"author_id": 65184,
"author_profile": "https://Stackoverflow.com/users/65184",
"pm_score": -1,
"selected": false,
"text": "<p>Off the top of my head, I'm thinking to render each as a element instead, then setting the span's onclick event to fol... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60313/"
] | The link only works when i click on the actual text not the area around it even though the hover effect is working so i know the button is being targeted?
this is also happening on a list within the site where I'm using left-padding and placing images there, if i click where the padding is it doesn't work?
could .js ... | There is nothing wrong with the CSS for `ul#navigation li a`. I have copied your CSS to a [working example](http://webignition.net/examples/csslinkpadding/) and this appears to function correctly in FF3, IE7 and Chrome.
I wouldn't expect a (well written) piece of JavaScript to be interfering with your links in any way... |
537,772 | <p>What is the most correct regular expression (regex) for a UNIX file path?</p>
<p>For example, to detect something like this:</p>
<pre><code>/usr/lib/libgccpp.so.1.0.2
</code></pre>
<p>It's pretty easy to make a regular expression that will match most files, but what's the best one, including one that can detect e... | [
{
"answer_id": 537833,
"author": "Zach Scrivena",
"author_id": 20029,
"author_profile": "https://Stackoverflow.com/users/20029",
"pm_score": 5,
"selected": true,
"text": "<p>If you don't mind false positives for identifying paths, then you really just need to ensure the path doesn't cont... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14193/"
] | What is the most correct regular expression (regex) for a UNIX file path?
For example, to detect something like this:
```
/usr/lib/libgccpp.so.1.0.2
```
It's pretty easy to make a regular expression that will match most files, but what's the best one, including one that can detect escaped whitespace sequences, and ... | If you don't mind false positives for identifying paths, then you really just need to ensure the path doesn't contain a `NUL` character; everything else is permitted (in particular, `/` is the name-separator character). The better approach would be to resolve the given path using the appropriate file IO function (e.g. ... |
537,782 | <p>I have a tricky problem that I've been messing about with for a few days now and cant find an optimal solution for.</p>
<p>These are my tables:</p>
<ul>
<li>site</li>
<li>site_node</li>
<li>page</li>
</ul>
<p>The site node table contains a list of nodes representing a hierarchy (using nested set). Each node must ... | [
{
"answer_id": 537801,
"author": "ConcernedOfTunbridgeWells",
"author_id": 15401,
"author_profile": "https://Stackoverflow.com/users/15401",
"pm_score": 2,
"selected": false,
"text": "<p>Make dummy site nodes for the error or not found page. You can mark them as a specific type of node ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39428/"
] | I have a tricky problem that I've been messing about with for a few days now and cant find an optimal solution for.
These are my tables:
* site
* site\_node
* page
The site node table contains a list of nodes representing a hierarchy (using nested set). Each node must have one or more associated pages. Each site mus... | >
> Option #1 ensures that each page
> belongs to one and only one other
> entity, although the relationship cant
> actually be enforced as the parentId
> field can point to more than one
> place.
>
>
>
Right. In terms of relational theory, the problem is that your "`parentId`" column violates [third normal f... |
537,785 | <p>I'm translating some Delphi code into c# code when I ran into this. I don't have an environment setup for Delphi so I can't test it myself.</p>
<p>Delphi:</p>
<pre><code>RandSeed := var1;
Result := Random($FF);
</code></pre>
<p>c#:</p>
<pre><code>Random RandSeed = new Random(var1);
Result = RandSeed.Next(255);
<... | [
{
"answer_id": 537798,
"author": "schnaader",
"author_id": 34065,
"author_profile": "https://Stackoverflow.com/users/34065",
"pm_score": 3,
"selected": false,
"text": "<p>Certainly not, because they use different RNGs. You could perhaps use a RNG from the Windows API, create your own RNG... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37726/"
] | I'm translating some Delphi code into c# code when I ran into this. I don't have an environment setup for Delphi so I can't test it myself.
Delphi:
```
RandSeed := var1;
Result := Random($FF);
```
c#:
```
Random RandSeed = new Random(var1);
Result = RandSeed.Next(255);
```
Would these put the same value in Resul... | The Delphi PRNG is a deterministic [linear congruential generator](http://en.wikipedia.org/wiki/Linear_congruential_generator) with 134775813 as **`a`** and 1 as **`c`**, and returning the high 32 bits for range-limited numbers. Here's an implementation in C# that returns the same values as Delphi:
```
using System;
... |
537,786 | <p>In my WPF client, I have a loop that calls a WCF service to update some records. When the loop is done, I display a message, "Update complete".</p>
<p>I'm changing my WCF calls to async calls now.</p>
<pre><code> ServiceClient client = new ServiceClient();
client.UpdateRecordsCompleted +=new System.EventHa... | [
{
"answer_id": 537798,
"author": "schnaader",
"author_id": 34065,
"author_profile": "https://Stackoverflow.com/users/34065",
"pm_score": 3,
"selected": false,
"text": "<p>Certainly not, because they use different RNGs. You could perhaps use a RNG from the Windows API, create your own RNG... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3047/"
] | In my WPF client, I have a loop that calls a WCF service to update some records. When the loop is done, I display a message, "Update complete".
I'm changing my WCF calls to async calls now.
```
ServiceClient client = new ServiceClient();
client.UpdateRecordsCompleted +=new System.EventHandler<System.Component... | The Delphi PRNG is a deterministic [linear congruential generator](http://en.wikipedia.org/wiki/Linear_congruential_generator) with 134775813 as **`a`** and 1 as **`c`**, and returning the high 32 bits for range-limited numbers. Here's an implementation in C# that returns the same values as Delphi:
```
using System;
... |
537,796 | <p>Does anyone have any suggestions on how to <strong>justify</strong> read-only text (rendered into a <code>TextBlock</code>) in Silverlight 2? WPF supports text justification by way of the <code>TextAlignment</code> enumeration:</p>
<pre><code>public enum TextAlignment
{
Left,
Right,
Center,
Justify ... | [
{
"answer_id": 537817,
"author": "Muad'Dib",
"author_id": 49910,
"author_profile": "https://Stackoverflow.com/users/49910",
"pm_score": -1,
"selected": false,
"text": "<p>If these dont meet your needs, you should write an extender or converter and bind to that instead of using one of the... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11308/"
] | Does anyone have any suggestions on how to **justify** read-only text (rendered into a `TextBlock`) in Silverlight 2? WPF supports text justification by way of the `TextAlignment` enumeration:
```
public enum TextAlignment
{
Left,
Right,
Center,
Justify // <--- Missing from Silverlight :(
}
```
Howev... | Off the top of my head, I can think of two not-so-easy ways to do this. One is rather lame; adding spaces between the words. The other would be to somehow parse the text so that each word is it's own text block, you could then use a Grid to left justify the first word of a line and right justify the last word of a line... |
537,797 | <pre><code>var newUser = new tblUser() {
Email = strEmail,
Password = strPassword,
DateBirth = DateTime.Parse(strDateBirth),
};
db.tblUsers.InsertOnSubmit(newUser);
db.SubmitChanges();
</code></pre>
<p>I want to get the actual SQL query that linq generated.</p>
| [
{
"answer_id": 537816,
"author": "Jason Punyon",
"author_id": 6212,
"author_profile": "https://Stackoverflow.com/users/6212",
"pm_score": 1,
"selected": false,
"text": "<p>db.Log is a TextWriter that you can use to get the text of the query.</p>\n\n<pre><code>db.Log = Console.Out\nvar ne... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
var newUser = new tblUser() {
Email = strEmail,
Password = strPassword,
DateBirth = DateTime.Parse(strDateBirth),
};
db.tblUsers.InsertOnSubmit(newUser);
db.SubmitChanges();
```
I want to get the actual SQL query that linq generated. | You need to set the DataContext.Log property to a writer, you can wrap a writer around a stringbuilder then after your insert response.write your stringbuilder.tostring...
```
StringBuilder sb = new StringBuilder();
StringWriter writer = new StringWriter(sb);
Con... |
537,800 | <p>I'm given a filename and I have to be able to read it from disk and send its contents over a network. I need to be able to determine whether the file is text or binary so I know whether to use a StreamReader or BinaryReader. Another reason why I need to know the content type is because if it is binary, I have to M... | [
{
"answer_id": 537818,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>You either need to know the type of file ahead of time, or be told what type the file is. And why don't you just use the S... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/132931/"
] | I'm given a filename and I have to be able to read it from disk and send its contents over a network. I need to be able to determine whether the file is text or binary so I know whether to use a StreamReader or BinaryReader. Another reason why I need to know the content type is because if it is binary, I have to MIME e... | The [filename extension](http://en.wikipedia.org/wiki/Filename_extension) provides your best hint at the content type of a file.
It's not perfect, but I've used the following with some success:
```
private static string GetContentTypeFromRegistry(string file)
{
RegistryKey contentTypeKey = Registry.ClassesRoot.Op... |
537,810 | <p>In my last project we used MSBuild as a scripting language. (yeah, really!) We also wrote hundreds of custom MSBuild tasks, for the parts that made more sense in C#. (I even wrote an MSBuild task to generate the boilerplate code for an MSBuild task. Yes, it consumed itself.)</p>
<p>While I don't recommend anyone e... | [
{
"answer_id": 538067,
"author": "user37468",
"author_id": 37468,
"author_profile": "https://Stackoverflow.com/users/37468",
"pm_score": 3,
"selected": false,
"text": "<p>I think you could use an IOC container like Spring to get this kind of behavior.</p>\n\n<p>Instantiate any task that ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5314/"
] | In my last project we used MSBuild as a scripting language. (yeah, really!) We also wrote hundreds of custom MSBuild tasks, for the parts that made more sense in C#. (I even wrote an MSBuild task to generate the boilerplate code for an MSBuild task. Yes, it consumed itself.)
While I don't recommend anyone else take th... | I think you could use an IOC container like Spring to get this kind of behavior.
Instantiate any task that must only run once as a singleton and have the constructor of the task object run the task. Then any object that comes along later with a dependency on that task will get a reference to the task that already ran ... |
537,848 | <p>I really want to put a little question mark image next to some of the input fields on my for so the user can click and get a little box to come up and provide some help text. A tooltip might work for this too. Here is what I would like:</p>
<ol>
<li>Script for having a little text area pop up when user clicks on ... | [
{
"answer_id": 537870,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 2,
"selected": false,
"text": "<p>I use <a href=\"http://plugins.jquery.com/project/bt\" rel=\"nofollow noreferrer\">BeautyTips</a>, a jQuery ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14101/"
] | I really want to put a little question mark image next to some of the input fields on my for so the user can click and get a little box to come up and provide some help text. A tooltip might work for this too. Here is what I would like:
1. Script for having a little text area pop up when user clicks on an image (not a... | It can be done purely in CSS if you don't mind it appearing on hover instead of on click. Try this:
```
<html>
<head>
<style type='text/css'>
a.helpAnchor {
position:relative;
text-decoration:none;
}
a.helpAnchor .helpIcon {
position:absolute;
text-align:center;
... |
537,853 | <p>I am new to Objective C and Cocoa. I just don't get it how to message the superview of an UIView. I can't get it work. Here is what i tried so far:</p>
<p>In my MainView i have a method named resetDrawType:</p>
<pre><code>- (void) resetDrawType {
self.drawType = foo;
}
</code></pre>
<p>Also in the MainView i c... | [
{
"answer_id": 537881,
"author": "Andrew Grant",
"author_id": 1043,
"author_profile": "https://Stackoverflow.com/users/1043",
"pm_score": 3,
"selected": false,
"text": "<p>Well firstly in Objective-C there's no need to cast to a specific class to send it a message. E.g you can just do;</... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65177/"
] | I am new to Objective C and Cocoa. I just don't get it how to message the superview of an UIView. I can't get it work. Here is what i tried so far:
In my MainView i have a method named resetDrawType:
```
- (void) resetDrawType {
self.drawType = foo;
}
```
Also in the MainView i create a subview and add it to Mai... | You shouldn't have a subviews tell its superview much of anything. You should make the superview a delegate of your view class.
```
// MainView
MyView *myView = [[MyView alloc] initWithFrame:CGRectMake(...) delegate:self];
```
Then save the delegate to an instance variable declared by `id delegate`. When you finish ... |
537,860 | <p>I've a box from divs (price_item) with several child divs (date, price etc.). I'm using it as a caroussel for showing prices. If one clicks on any child, the parent's background color must be changed to red. I wrote it like:</p>
<pre><code>$(...selectquery...).click(function() {
var $tgt = $(event.target);
... | [
{
"answer_id": 537933,
"author": "Svante Svenson",
"author_id": 19707,
"author_profile": "https://Stackoverflow.com/users/19707",
"pm_score": 0,
"selected": false,
"text": "<pre><code>$(...selectquery...). .click(function(event) { var $tgt = $(event.target); \n\n$(this).parent().css(\"..... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65189/"
] | I've a box from divs (price\_item) with several child divs (date, price etc.). I'm using it as a caroussel for showing prices. If one clicks on any child, the parent's background color must be changed to red. I wrote it like:
```
$(...selectquery...).click(function() {
var $tgt = $(event.target);
$tgt.parent()... | The `event` object gets passed into your click handler by jQuery, so you need to specify it as a parameter.
You also may be able to add the click handler to the parent object and use "$(this)" instead of event.target:
```
$(...select the parent...).click(function() {
$(this).css("backgroundColor", "red");
});
``... |
537,921 | <p>I have a <code>HashMap</code> with millions of entries.</p>
<p>Need to retrieve all entries whose keys match a specific set of criteria (in this case, each key is an object with two integer properties; I need to retrieve all keys where each of these integers fall within a specified range).</p>
<p>What is the faste... | [
{
"answer_id": 537948,
"author": "Hank Gay",
"author_id": 4203,
"author_profile": "https://Stackoverflow.com/users/4203",
"pm_score": 0,
"selected": false,
"text": "<p>There likely won't be a faster solution than something like:</p>\n\n<pre><code>for (final KeyObj key : map.keySet()) {\n... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47450/"
] | I have a `HashMap` with millions of entries.
Need to retrieve all entries whose keys match a specific set of criteria (in this case, each key is an object with two integer properties; I need to retrieve all keys where each of these integers fall within a specified range).
What is the fastest, most efficient way to it... | Here's a **solution** using [TreeMap](http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html):
```
public static void main(String[] args) {
Comparator<Foo> fooComparator = new Comparator<Foo>() {
@Override
public int compare(Foo o1, Foo o2) {
return o1.compareTo(o2);
}
... |
537,929 | <p>In my test automation practice I always use a gui mapping strategy that reduces a maintenance effort.<p>
So for example, if I need to identify the "<em>Google Search</em>" button (www.google.com), its XPAth will be <pre><code>//input[@name='q']</code></pre>
rather than<br><pre><code>/html/body/center/form/table/tbod... | [
{
"answer_id": 537958,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 3,
"selected": true,
"text": "<p>If the element has an id that is used by scripting/css, we use that ID in testing. Otherwise we actively instrument o... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52042/"
] | In my test automation practice I always use a gui mapping strategy that reduces a maintenance effort.
So for example, if I need to identify the "*Google Search*" button (www.google.com), its XPAth will be
```
//input[@name='q']
```
rather than
```
/html/body/center/form/table/tbody/tr/td[2]/input[3]
```
It's clear... | If the element has an id that is used by scripting/css, we use that ID in testing. Otherwise we actively instrument our HTML for testing. By this I mean we can add an id *just for testing* to avoid any ambiguity. We usually give it a prefix to indicate this, ie. id="ftGoogleButton". This is so the people who work with ... |
537,942 | <p>I have a bunch of servers, on which I run experiments using <code>screen</code>. The procedure is the following :</p>
<ol>
<li><code>ssh</code> to server XXX</li>
<li>launch <code>screen</code></li>
<li>start experiments in a few tabs</li>
<li>detach <code>screen</code></li>
<li>disconnect from the server</li>
</ol... | [
{
"answer_id": 537975,
"author": "Zoredache",
"author_id": 20267,
"author_profile": "https://Stackoverflow.com/users/20267",
"pm_score": 5,
"selected": false,
"text": "<p>The command <strong>screen -list</strong> may be what you want.</p>\n\n<p>See the <a href=\"http://linux.die.net/man/... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56761/"
] | I have a bunch of servers, on which I run experiments using `screen`. The procedure is the following :
1. `ssh` to server XXX
2. launch `screen`
3. start experiments in a few tabs
4. detach `screen`
5. disconnect from the server
While the experiments are running, I can easily find on which servers they are by `ssh`in... | To list all of the screen sessions for a user, run the following command as that user:
```
screen -ls
```
To see all screen sessions on a specific machine you can do:
```
ls -laR /var/run/screen/
```
I get this on my machine:
```
gentle ~ # ls -laR /var/run/screen/
/var/run/screen/:
total 1
drwxrwxr-x 4 root u... |
537,949 | <p>I need a tool or method that allows the transfer of data and automatically updates the foreign keys at the destination table. </p>
<p>The SET IDENTITY_INSERT ON/OFF is not what I'm looking for.</p>
<p>Example:</p>
<pre><code>table master (id int identity, name char)
table slave (id int identity, master_id int, na... | [
{
"answer_id": 537971,
"author": "John Sansom",
"author_id": 60308,
"author_profile": "https://Stackoverflow.com/users/60308",
"pm_score": 2,
"selected": false,
"text": "<p>If you are using Identity columns within your tables, the function SCOPE_IDENTITY() will return the ID of the last ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18073/"
] | I need a tool or method that allows the transfer of data and automatically updates the foreign keys at the destination table.
The SET IDENTITY\_INSERT ON/OFF is not what I'm looking for.
Example:
```
table master (id int identity, name char)
table slave (id int identity, master_id int, name char)
```
I would like... | @John Sansom: right on the money
@pv2008:
```
create proc InsertAndUpdate
@parentName varchar(255),
@childName varchar(255)
as
declare @newParentId int
insert into PARENT values (@parentName)
select @newParentId = SCOPE_IDENTITY()
insert into CHILD values (@newParentId, @childName)
```
call this sproc every time ... |
537,950 | <p>Hope anyone can shed light on this so I can use pens with dash patterns? </p>
<p>I am writing a scrollable chart (a <code>Panel</code> inside <code>ScrollViewer</code> that implements <code>IScrollInfo</code>) in WPF using <code>DrawingVisual</code>'s <code>DataContext.Draw</code><em>X</em>. I have several thousand... | [
{
"answer_id": 538245,
"author": "Josh G",
"author_id": 64329,
"author_profile": "https://Stackoverflow.com/users/64329",
"pm_score": 3,
"selected": true,
"text": "<p>Are the pens getting frozen? Freezing drawing objects helps performance a lot.</p>\n\n<p>You could set up a Loaded handle... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Hope anyone can shed light on this so I can use pens with dash patterns?
I am writing a scrollable chart (a `Panel` inside `ScrollViewer` that implements `IScrollInfo`) in WPF using `DrawingVisual`'s `DataContext.Draw`*X*. I have several thousand `DrawingVisual`s that get scrolled by using `TranslateTransform` on the... | Are the pens getting frozen? Freezing drawing objects helps performance a lot.
You could set up a Loaded handler and debug to see if your pens are frozen. If not, Call the Pen.Freeze() button manually on them.
Note that freeze also makes the pens read-only... you will be unable to modify them after you freeze them. |
537,963 | <p>I'm trying to figure out how to preserve the whitespace nodes between the nodes I'm sorting. Here is an example.</p>
<p>Input:</p>
<pre><code><a>
<b>
<c>
<d>world</d>
</c>
<c>
<d>hello</d>
</c>
... | [
{
"answer_id": 538028,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 3,
"selected": true,
"text": "<p>You are going to want to add these two lines to the top of your stylesheet:</p>\n\n<pre><code><xsl:strip-space el... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65192/"
] | I'm trying to figure out how to preserve the whitespace nodes between the nodes I'm sorting. Here is an example.
Input:
```
<a>
<b>
<c>
<d>world</d>
</c>
<c>
<d>hello</d>
</c>
</b>
<e>some other stuff</e>
</a>
```
Desired output:
```
<a>
<b>
... | You are going to want to add these two lines to the top of your stylesheet:
```
<xsl:strip-space elements="*"/>
<xsl:output indent="yes"/>
```
The first line strips all whitespace from the document and the second one indents the output. |
537,988 | <p>Given the following xml:</p>
<pre><code><rootnode>
<childnode arg="a">Content A</childnode>
<childnode arg="b">Content A</childnode>
</rootnode>
</code></pre>
<p>Using <a href="http://nant.sourceforge.net/release/0.86-beta1/help/tasks/xmlpoke.html" rel="noreferrer">XMLPoke... | [
{
"answer_id": 539365,
"author": "Iain",
"author_id": 5993,
"author_profile": "https://Stackoverflow.com/users/5993",
"pm_score": 6,
"selected": true,
"text": "<p>I hold my hands up! This is a classic case of asking the wrong question.</p>\n\n<p>The problem is that you can't use <em>xmlp... | 2009/02/11 | [
"https://Stackoverflow.com/questions/537988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5993/"
] | Given the following xml:
```
<rootnode>
<childnode arg="a">Content A</childnode>
<childnode arg="b">Content A</childnode>
</rootnode>
```
Using [XMLPoke](http://nant.sourceforge.net/release/0.86-beta1/help/tasks/xmlpoke.html) with the following XPath:
```
rootnode/childnode[arg='b']
```
The result (if the r... | I hold my hands up! This is a classic case of asking the wrong question.
The problem is that you can't use *xmlpoke* to remove a single node. *Xmlpoke* can only be used to edit the contents of a specific node or attribute. There isn't an elegant way to remove a child node as per the question using only the standard *N... |
538,010 | <p>I'd like to use aspectj to profile a library. My plan was to mark methods that require profiling with an annotation:</p>
<p><code>@Profiled("logicalUnitOfWork")</code></p>
<p>And then have an aspect that would fire before and after methods that would use the <code>logicalUnitOfWork</code> to highlight the profile... | [
{
"answer_id": 550111,
"author": "Bogdan",
"author_id": 65092,
"author_profile": "https://Stackoverflow.com/users/65092",
"pm_score": 3,
"selected": true,
"text": "<p>I am not sure if this is the best way to do it, but you could try something like:</p>\n\n<pre>\n<code>\n pointcut profi... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23309/"
] | I'd like to use aspectj to profile a library. My plan was to mark methods that require profiling with an annotation:
`@Profiled("logicalUnitOfWork")`
And then have an aspect that would fire before and after methods that would use the `logicalUnitOfWork` to highlight the profiled content.
So, my pointcut to start wit... | I am not sure if this is the best way to do it, but you could try something like:
```
pointcut profiledOperation(Profiled p) :
execution(@Profiled * *()) && @annotation(p);
before(Profiled p): profiledOperation(p)
{
System.out.println("Before " + p.value());
}
after(Profiled p): profiled... |
538,041 | <p>In my landscape-only iPhone application, I launch a UIImagePickerController to take a photo, but the live image displayed from the camera is in portrait orientation, with blank space around it. The image is rotated.</p>
<p>Once the camera button is pressed, the preview is very messy, with most of the preview off sc... | [
{
"answer_id": 538064,
"author": "Alex Wayne",
"author_id": 62076,
"author_profile": "https://Stackoverflow.com/users/62076",
"pm_score": 6,
"selected": false,
"text": "<p>The answer is more ridiculous than you might think. I had the same problem and found a solution in a forum somewher... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63994/"
] | In my landscape-only iPhone application, I launch a UIImagePickerController to take a photo, but the live image displayed from the camera is in portrait orientation, with blank space around it. The image is rotated.
Once the camera button is pressed, the preview is very messy, with most of the preview off screen, and ... | The answer is more ridiculous than you might think. I had the same problem and found a solution in a forum somewhere. Pass your taken image into a method like this:
```
// Code from: http://discussions.apple.com/thread.jspa?messageID=7949889
- (UIImage *)scaleAndRotateImage:(UIImage *)image {
int kMaxResolution = 64... |
538,042 | <p>My company needs to allow the internal users of our application to write queries directly against the database through our UI. But when we display the results, our code needs to know which column and table each return column is for so that the results can be displayed with some color coding and other logic for each ... | [
{
"answer_id": 538108,
"author": "WildJoe",
"author_id": 9052,
"author_profile": "https://Stackoverflow.com/users/9052",
"pm_score": 0,
"selected": false,
"text": "<p>There's no built in way to do this, you'd need some custom code to maintain the mappings you cared about.</p>\n\n<p>This ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29277/"
] | My company needs to allow the internal users of our application to write queries directly against the database through our UI. But when we display the results, our code needs to know which column and table each return column is for so that the results can be displayed with some color coding and other logic for each col... | you might try something like this:
```
Select b.FirstName As BusinessOwner.Name, c.Address as ContactLoaction.Address
From BusinessOwner as b, ContactLocation as c
```
and with some parsing of first part of the columns name that return form the query you will determine the table that columns belong to.
something lik... |
538,060 | <p>I know from reading <a href="https://learn.microsoft.com/dotnet/api/system.idisposable" rel="noreferrer">Microsoft documentation</a> that the "primary" use of the <code>IDisposable</code> interface is to clean up unmanaged resources.</p>
<p>To me, "unmanaged" means things like database connection... | [
{
"answer_id": 538093,
"author": "mqp",
"author_id": 55943,
"author_profile": "https://Stackoverflow.com/users/55943",
"pm_score": 4,
"selected": false,
"text": "<p>Yep, that code is completely redundant and unnecessary and it doesn't make the garbage collector do anything it wouldn't ot... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4828/"
] | I know from reading [Microsoft documentation](https://learn.microsoft.com/dotnet/api/system.idisposable) that the "primary" use of the `IDisposable` interface is to clean up unmanaged resources.
To me, "unmanaged" means things like database connections, sockets, window handles, etc. But, I've seen code where the `Disp... | The point of Dispose **is** to free unmanaged resources. It needs to be done at some point, otherwise they will never be cleaned up. The garbage collector doesn't know **how** to call `DeleteHandle()` on a variable of type `IntPtr`, it doesn't know **whether** or not it needs to call `DeleteHandle()`.
>
> **Note**: W... |
538,072 | <p>Say I have an enum with four values:</p>
<pre><code>public enum CompassHeading
{
North,
South,
East,
West
}
</code></pre>
<p>What XAML would be required to have a ComboBox be populated with these items?</p>
<pre><code><ComboBox ItemsSource="{Binding WhatGoesHere???}" />
</code></pre>
<p>Ide... | [
{
"answer_id": 538114,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 6,
"selected": true,
"text": "<p>You can use the ObjectDataProvider to do this:</p>\n\n<pre><code><ObjectDataProvider MethodName=\"GetValues\" \n ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24874/"
] | Say I have an enum with four values:
```
public enum CompassHeading
{
North,
South,
East,
West
}
```
What XAML would be required to have a ComboBox be populated with these items?
```
<ComboBox ItemsSource="{Binding WhatGoesHere???}" />
```
Ideally I wouldn't have to set up C# code for this. | You can use the ObjectDataProvider to do this:
```
<ObjectDataProvider MethodName="GetValues"
ObjectType="{x:Type sys:Enum}" x:Key="odp">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="local:CompassHeading"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ComboBox ItemsSou... |
538,079 | <p>I've tested the following Mod Rewrite on MAMP, but for some reason, it fails on LAMP. Any idea of what I am doing wrong?</p>
<pre><code>RewriteEngine on
RewriteCond %{QUERY_STRING} ^newParamA=(.*)&newParamB=([0-9]*)$
RewriteRule ^newfolder/newsubfolder/$ oldfolder/oldsubfolder\.php?oldParamC=%1\&oldParamD=%... | [
{
"answer_id": 538114,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 6,
"selected": true,
"text": "<p>You can use the ObjectDataProvider to do this:</p>\n\n<pre><code><ObjectDataProvider MethodName=\"GetValues\" \n ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538079",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've tested the following Mod Rewrite on MAMP, but for some reason, it fails on LAMP. Any idea of what I am doing wrong?
```
RewriteEngine on
RewriteCond %{QUERY_STRING} ^newParamA=(.*)&newParamB=([0-9]*)$
RewriteRule ^newfolder/newsubfolder/$ oldfolder/oldsubfolder\.php?oldParamC=%1\&oldParamD=%2 [QSA,L]
```
The id... | You can use the ObjectDataProvider to do this:
```
<ObjectDataProvider MethodName="GetValues"
ObjectType="{x:Type sys:Enum}" x:Key="odp">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="local:CompassHeading"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
<ComboBox ItemsSou... |
538,081 | <p>I have a calendar feed (.ics) available from my application, but it's quite large since it includes over 4,000 events. Is there a standard or best practice when it comes to specifying how many events get downloaded or how far back or forward the calendar should go?</p>
<p>My main question though, is how to configu... | [
{
"answer_id": 1125571,
"author": "Duncan Smart",
"author_id": 1278,
"author_profile": "https://Stackoverflow.com/users/1278",
"pm_score": 6,
"selected": true,
"text": "<p>To only check for updates hourly (for example) use this in your VCALENDAR file:</p>\n<pre><code>X-PUBLISHED-TTL:PT1H... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1383003/"
] | I have a calendar feed (.ics) available from my application, but it's quite large since it includes over 4,000 events. Is there a standard or best practice when it comes to specifying how many events get downloaded or how far back or forward the calendar should go?
My main question though, is how to configure or set a... | To only check for updates hourly (for example) use this in your VCALENDAR file:
```
X-PUBLISHED-TTL:PT1H
```
I gleaned this information from one of the Microsoft Protocol documents
[[MS-OXCICAL]: iCalendar to Appointment Object Conversion Protocol Specification](http://msdn.microsoft.com/en-gb/library/cc463911.aspx)... |
538,082 | <p>When firefox (3.0.6) renders a png image at certain widths (e.g., 50%), a thin grey line is shown along the left and top edges of the content box. The line disappears at other widths (e.g., 70%). Furthermore, the line doesn't seem to be present in the original image (using gimp to inspect the image).</p>
<p>The phe... | [
{
"answer_id": 544469,
"author": "Mark Hurd",
"author_id": 65714,
"author_profile": "https://Stackoverflow.com/users/65714",
"pm_score": 1,
"selected": false,
"text": "<p>Save your images as PNG-24. I have had similar issues with pixel distortion when trying to resize PNG-8 images dynami... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65201/"
] | When firefox (3.0.6) renders a png image at certain widths (e.g., 50%), a thin grey line is shown along the left and top edges of the content box. The line disappears at other widths (e.g., 70%). Furthermore, the line doesn't seem to be present in the original image (using gimp to inspect the image).
The phenomenon oc... | Using your demo page and image I wasn't able to see anything wrong.
Maybe it's problem with video drivers? I believe firefox (and cairo, the graphics library it uses) takes advantage of hardware acceleration to resize images smoothly, and unfortunately you can't disable it AFAIK.
Try logging in through a remote proto... |
538,095 | <p>I copied the log4net samples to implement a custom log level, AUDIT. I defined AUDIT to have a value of 35000, between DEBUG 30000 and INFO 40000.</p>
<p>The following is my configuration section. I have one appender that logs all levels and one that is supposed to log only AUDIT levels (this is just for testing)</... | [
{
"answer_id": 538138,
"author": "olle",
"author_id": 48383,
"author_profile": "https://Stackoverflow.com/users/48383",
"pm_score": 3,
"selected": false,
"text": "<p>You will need to add</p>\n\n<pre><code><level>\n <name value=\"AUDIT\" />\n <value value=\"35000\" />\... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3619/"
] | I copied the log4net samples to implement a custom log level, AUDIT. I defined AUDIT to have a value of 35000, between DEBUG 30000 and INFO 40000.
The following is my configuration section. I have one appender that logs all levels and one that is supposed to log only AUDIT levels (this is just for testing)
```
<log4n... | log4net version 1.2.10 requires that you end a `LevelMatchFilter` chain with a `DenyAllFilter` if you want the behavior I described in the question.
```
<appender name="FileAppender.Audit" type="log4net.Appender.FileAppender" >
<filter type="log4net.Filter.LevelMatchFilter">
<levelToMatch value="AUDIT" />
</fi... |
538,097 | <p>I wanna rewrite links like
<code>index.php?page=entry&id=15&action=edit</code> to <code>entry/15/edit</code>.<br>
This is how my .htaccess looks like now:</p>
<pre><code># Turn the Rewrite engine on
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# Rewrite rules
Re... | [
{
"answer_id": 538125,
"author": "chaos",
"author_id": 47529,
"author_profile": "https://Stackoverflow.com/users/47529",
"pm_score": 3,
"selected": true,
"text": "<p>Too many parentheses. You might have a Lisp infection.</p>\n\n<p>Try:</p>\n\n<pre><code>RewriteRule ^([^/]*)/([^/]*)/?([^... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I wanna rewrite links like
`index.php?page=entry&id=15&action=edit` to `entry/15/edit`.
This is how my .htaccess looks like now:
```
# Turn the Rewrite engine on
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
# Rewrite rules
RewriteRule ^([^/]*)(/([^/]*)/?)([^/]*)?$ index... | Too many parentheses. You might have a Lisp infection.
Try:
```
RewriteRule ^([^/]*)/([^/]*)/?([^/]*)?$ index.php?page=$1&id=$2&action=$3 [QSA,L]
``` |
538,111 | <p>Through reflection, is there some way for me to look at a generic List's contained type to see what type the collection is of? For example:</p>
<p>I have a simple set of business objects that derive from an interface, like this:</p>
<pre><code>public interface IEntityBase{}
public class BusinessEntity : IEntit... | [
{
"answer_id": 538136,
"author": "ChrisW",
"author_id": 49942,
"author_profile": "https://Stackoverflow.com/users/49942",
"pm_score": 6,
"selected": true,
"text": "<p>Assuming you have the <code>System.Type</code> which describes your <code>List<></code>, you can use the <code>Type... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28664/"
] | Through reflection, is there some way for me to look at a generic List's contained type to see what type the collection is of? For example:
I have a simple set of business objects that derive from an interface, like this:
```
public interface IEntityBase{}
public class BusinessEntity : IEntityBase
{
public ... | Assuming you have the `System.Type` which describes your `List<>`, you can use the `Type.GetGenericArguments()` method to get the `Type` instance which describes what it's a list of. |
538,113 | <p>im using php</p>
<p>if i have an uknown length of a string being outputted how can i limit it to only 16 characters to be outputted?</p>
| [
{
"answer_id": 538137,
"author": "tkotitan",
"author_id": 57625,
"author_profile": "https://Stackoverflow.com/users/57625",
"pm_score": 3,
"selected": false,
"text": "<p>the function is called substr.</p>\n\n<pre><code>string substr ( string $string , int $start [, int $length ] )\n</cod... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | im using php
if i have an uknown length of a string being outputted how can i limit it to only 16 characters to be outputted? | the function is called substr.
```
string substr ( string $string , int $start [, int $length ] )
```
so:
```
return substr($mystring,0,16);
```
should do it. |
538,122 | <p>For some strange reason, I can't run any functions as a new thread in my production environment, even though it works fine locally and fine on the staging server, which has identical specs as the production server (Windows 2003, IIS 6)</p>
<p>Here is my code:</p>
<pre><code>System.Threading.Thread th = new System.... | [
{
"answer_id": 538157,
"author": "Teun D",
"author_id": 64963,
"author_profile": "https://Stackoverflow.com/users/64963",
"pm_score": 0,
"selected": false,
"text": "<p>Could this be security related? The threading operations require rather high CAS (Code Access Security) privileges and i... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18234/"
] | For some strange reason, I can't run any functions as a new thread in my production environment, even though it works fine locally and fine on the staging server, which has identical specs as the production server (Windows 2003, IIS 6)
Here is my code:
```
System.Threading.Thread th = new System.Threading.Thread(Test... | Turns out it is because I was using impersonation and impersonation doesn't apply when creating a new thread. This is how I fixed it so that the thread is using the same impersonation as the calling function:
```
public static WindowsIdentity ident;
public void ProcessRequest(HttpContext context)
{
ident = Window... |
538,130 | <p>I have this .bat script which I use to maven package my application. Problem is, just after it ends execution, it closes the console window. The last 2 lines somehow are completely ignored.</p>
<p>Does anyone know the trick to make this work?
I just want to have a quick check if the build was successful.</p>
<pre>... | [
{
"answer_id": 538147,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 0,
"selected": false,
"text": "<p>Here is a hack that I found <a href=\"http://notetodogself.blogspot.com/2007/11/wait-or-pause-in-windows-batch-scri... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64784/"
] | I have this .bat script which I use to maven package my application. Problem is, just after it ends execution, it closes the console window. The last 2 lines somehow are completely ignored.
Does anyone know the trick to make this work?
I just want to have a quick check if the build was successful.
```
@echo off
cls
c... | You could try to write
```
call mvn package -o -P local
``` |
538,133 | <p>I have a nested movie clip instance that I want to access. The path to the movie clip is defined by two variables ( similar to a row and column).</p>
<p>I am already dynamically accessing the parent movie clip like this:</p>
<p>eval("row" + ActiveRow)</p>
<p>Now I want to access one of row(#)'s children called l... | [
{
"answer_id": 538275,
"author": "James Hay",
"author_id": 47339,
"author_profile": "https://Stackoverflow.com/users/47339",
"pm_score": 4,
"selected": true,
"text": "<p>you could try </p>\n\n<pre><code>this[\"row\" + ActiveRow][\"let\" + i]\n</code></pre>\n\n<p>What would be better thou... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55124/"
] | I have a nested movie clip instance that I want to access. The path to the movie clip is defined by two variables ( similar to a row and column).
I am already dynamically accessing the parent movie clip like this:
eval("row" + ActiveRow)
Now I want to access one of row(#)'s children called let(#) dynamically.
Here ... | you could try
```
this["row" + ActiveRow]["let" + i]
```
What would be better though is if when you create the instances you put them in an array... so maybe
```
var rowClips : Array = [];
for (var i : int = 0; i < 10; i++)
{
var row : MovieClip = this.createEmptyMovieClip("row" + i, i);
rowClips.push(... |
538,134 | <p>I'd like a simple example of exporting a function from a C++ Windows DLL.</p>
<p>I'd like to see the header, the <code>.cpp</code> file, and the <code>.def</code> file (if absolutely required).</p>
<p>I'd like the exported name to be <strong><em>undecorated</em></strong>. I'd like to use the most standard calling ... | [
{
"answer_id": 538179,
"author": "joshperry",
"author_id": 30587,
"author_profile": "https://Stackoverflow.com/users/30587",
"pm_score": 8,
"selected": true,
"text": "<p>If you want plain C exports, use a C project not C++. C++ DLLs rely on name-mangling for all the C++isms (namespaces e... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3655/"
] | I'd like a simple example of exporting a function from a C++ Windows DLL.
I'd like to see the header, the `.cpp` file, and the `.def` file (if absolutely required).
I'd like the exported name to be ***undecorated***. I'd like to use the most standard calling convention (`__stdcall`?). I'd like the use `__declspec(dll... | If you want plain C exports, use a C project not C++. C++ DLLs rely on name-mangling for all the C++isms (namespaces etc...). You can compile your code as C by going into your project settings under C/C++->Advanced, there is an option "Compile As" which corresponds to the compiler switches /TP and /TC.
If you still wa... |
538,146 | <p>I'm trying to write someting into the DB using PHP but if I try to use mysql_real_escape_string() I don't get any errors but nothing gets saved into the DB and I don't know why =/ specially because I did the same on another PHP file and it worked perfectly...</p>
<pre><code><?php
if(isset($_POST['reporte']))
... | [
{
"answer_id": 538156,
"author": "nickohrn",
"author_id": 59907,
"author_profile": "https://Stackoverflow.com/users/59907",
"pm_score": 5,
"selected": true,
"text": "<p>I think you may need to open the mysql connection prior to using <a href=\"http://php.net/mysql_real_escape_string\" re... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28586/"
] | I'm trying to write someting into the DB using PHP but if I try to use mysql\_real\_escape\_string() I don't get any errors but nothing gets saved into the DB and I don't know why =/ specially because I did the same on another PHP file and it worked perfectly...
```
<?php
if(isset($_POST['reporte']))
$falla = $_PO... | I think you may need to open the mysql connection prior to using [mysql\_real\_escape\_string](http://php.net/mysql_real_escape_string). See the documentation.
**EDIT**
Try this, but what are the datatypes on your table? Are all the fields (usuario, comentario, fecha, estado) strings? That's what your insert statemen... |
538,163 | <p>Pretty simple question, I'm writing an XML document and i'm not sure how to write "]]>" without it being seen as the end of the section.</p>
| [
{
"answer_id": 538171,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 5,
"selected": true,
"text": "<p>You can do it like this:</p>\n\n<pre><code>]]>]]&gt;<![CDATA[\n</code></pre>\n\n<p>This ends up breaking the ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17614/"
] | Pretty simple question, I'm writing an XML document and i'm not sure how to write "]]>" without it being seen as the end of the section. | You can do it like this:
```
]]>]]><![CDATA[
```
This ends up breaking the CDATA section in two parts, but it's what you have to do. |
538,167 | <p>I am using Netbeans and j2mewtk to develop and test mobile applications. If I want to do file IO on an image the emulator uses ...\j2mewtk\2.5.2\appdb\temp.DefaultColorPhone[####]\filesystem\root1 to store files for the current, temporary emulation.</p>
<p>If I want to operate on a pre-existing image I have to star... | [
{
"answer_id": 538171,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 5,
"selected": true,
"text": "<p>You can do it like this:</p>\n\n<pre><code>]]>]]&gt;<![CDATA[\n</code></pre>\n\n<p>This ends up breaking the ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56310/"
] | I am using Netbeans and j2mewtk to develop and test mobile applications. If I want to do file IO on an image the emulator uses ...\j2mewtk\2.5.2\appdb\temp.DefaultColorPhone[####]\filesystem\root1 to store files for the current, temporary emulation.
If I want to operate on a pre-existing image I have to start the emul... | You can do it like this:
```
]]>]]><![CDATA[
```
This ends up breaking the CDATA section in two parts, but it's what you have to do. |
538,178 | <p>The scenario is this. A web page contains:</p>
<ul>
<li>some DIVs whose visibility can be toggled with a javascript (fired from an hyperlink)</li>
<li>a Submit button, whose response takes about 5 seconds</li>
</ul>
<p>The hyperlink code is</p>
<pre><code><a href="javascript:void null;" onclick="MyFunction()"&... | [
{
"answer_id": 538197,
"author": "scunliffe",
"author_id": 6144,
"author_profile": "https://Stackoverflow.com/users/6144",
"pm_score": 3,
"selected": true,
"text": "<p>Yup, this is the <strong>IE6</strong> issue with <strong>GET</strong> requests <em>triggered from a Javascript action</e... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21162/"
] | The scenario is this. A web page contains:
* some DIVs whose visibility can be toggled with a javascript (fired from an hyperlink)
* a Submit button, whose response takes about 5 seconds
The hyperlink code is
```
<a href="javascript:void null;" onclick="MyFunction()">foo</a>
```
The User:
1. Presses Submit.
2. Wh... | Yup, this is the **IE6** issue with **GET** requests *triggered from a Javascript action* on a *hyperlink* (**where the href is set to 'javascript:...'**).
>
> e.g. if your JavaScript calls
> `someForm.submit()` and the method is
> `GET`, there will be `NO` response (the
> request is definately sent though)
>
>
... |
538,212 | <p>I was looking at Blogengine.NET today and he has an interesting setup for Themes, figured I wanted to do something similar, however.. I can't make it work at all.</p>
<p>For each theme he has a folder like:</p>
<p>/themes/Indigo/</p>
<p>/themes/Standard/</p>
<p>/themes/Mobile/</p>
<p>Each theme contains a site.... | [
{
"answer_id": 538235,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>You can set the MasterPage for your page during the Page_PreInit like this:</p>\n\n<p>Me.MasterPageFile = \"~/themes/mythem... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64730/"
] | I was looking at Blogengine.NET today and he has an interesting setup for Themes, figured I wanted to do something similar, however.. I can't make it work at all.
For each theme he has a folder like:
/themes/Indigo/
/themes/Standard/
/themes/Mobile/
Each theme contains a site.master and they all have their own cod... | Found the solution so I'll post it here if anyone else is looking for the same thing.
Multiple identical masterpages works in a .NET Web Site but not in a .NET Web Application.
Maybe someone else can explain why, I just know that's the case.
So this works in a .NET Web Site:
```
Me.MastePageFile = "~/themes/" & Them... |
538,229 | <p>I have a client that is having problems with our the .msi installer for our application. WiX was used to create this installer. The application has installed just fine on dozens of other machines, but on his machine it displays the message:</p>
<blockquote>
<p>This installation package could not be
opened. Cont... | [
{
"answer_id": 538242,
"author": "eleven81",
"author_id": 43263,
"author_profile": "https://Stackoverflow.com/users/43263",
"pm_score": 4,
"selected": false,
"text": "<p><strong>Background:</strong></p>\n\n<p>I have noticed the exact same message when a MSI installer file was not downloa... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45459/"
] | I have a client that is having problems with our the .msi installer for our application. WiX was used to create this installer. The application has installed just fine on dozens of other machines, but on his machine it displays the message:
>
> This installation package could not be
> opened. Contact the application... | **Background:**
I have noticed the exact same message when a MSI installer file was not downloaded completely, or was corrupted by my antivirus program, or was mangled by my FTP client.
The error message is actually coming from [msiexec.exe](http://technet.microsoft.com/en-us/library/cc759262.aspx), which is the exec... |
538,234 | <p>I'm creating my own JavaScript Array-like object and I have methods that call closures. I was just wondering where was the most efficient place to define a closure.</p>
<p>For example, imagine I have a map function and a chop function:</p>
<pre><code>MyObject.prototype =
{
map: function(fn) { ... applies fn to... | [
{
"answer_id": 538252,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 0,
"selected": false,
"text": "<p>They are effectively the same thing - go with whichever one is more readable. For what its worth I prefer the seco... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62571/"
] | I'm creating my own JavaScript Array-like object and I have methods that call closures. I was just wondering where was the most efficient place to define a closure.
For example, imagine I have a map function and a chop function:
```
MyObject.prototype =
{
map: function(fn) { ... applies fn to each element ... };
... | The second one is more efficient. This
```
chop: function()
{ map(
function(element)
{
... chop off last character ...
}
)}
```
will create a new function object on each call to `chop()` with the respective runtime and memory overhead. As there won't be any lingering references to the ne... |
538,239 | <p>I've installed the Web Tools Project for Eclipse version 3.4. I've been trying to get refactoring working the way I think it should and have had no success.</p>
<p>I have one Java project that contains the Java classes for the jar that is put into the /WEB-INF/lib for a web site. Another project (a Dynamic Web pr... | [
{
"answer_id": 538333,
"author": "WolfmanDragon",
"author_id": 13491,
"author_profile": "https://Stackoverflow.com/users/13491",
"pm_score": 0,
"selected": false,
"text": "<p>Maybe I am not understanding you correctly, but it sounds like that you are putting the classes in a Jar or a War... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23271/"
] | I've installed the Web Tools Project for Eclipse version 3.4. I've been trying to get refactoring working the way I think it should and have had no success.
I have one Java project that contains the Java classes for the jar that is put into the /WEB-INF/lib for a web site. Another project (a Dynamic Web project) has t... | Sorry, this is not directly answering your question but nevertheless addressing your problem... maybe it helps, otherwise please ignore:
As matt b suggested, you should not place java code in a jsp. Instead 'simply' use Tags. If you're using the [standard tag library](https://tomcat.apache.org/taglibs/standard/), ther... |
538,240 | <p>I'm designing a really simple GUI but without any luck. Basically the outer layout has two columns which is a splitter pane (this is for an IRC client I'm writing). On the left-hand side is the server/channel/user tree and on the right is the chat pane. Now I break this down so on the right-hand side there's the ... | [
{
"answer_id": 538271,
"author": "Michael Myers",
"author_id": 13531,
"author_profile": "https://Stackoverflow.com/users/13531",
"pm_score": 3,
"selected": true,
"text": "<p>If I remember correctly, <code>JSplitPanes</code> always respect the minimum size of their components. Try explici... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39693/"
] | I'm designing a really simple GUI but without any luck. Basically the outer layout has two columns which is a splitter pane (this is for an IRC client I'm writing). On the left-hand side is the server/channel/user tree and on the right is the chat pane. Now I break this down so on the right-hand side there's the output... | If I remember correctly, `JSplitPanes` always respect the minimum size of their components. Try explicitly setting the minimum size of the `ChatView` to `(0,0)` and see if that helps. If so, you can then look at each of the components inside it to see which is causing the problem. |
538,244 | <p><strong>Problem:</strong> I have HTML markup to deal with that consists of multiple tables nested inside another table. I would like the "inner tables" to all be the same width. I would also like all of the "inner tables" to be no wider than the width of the widest "inner table" in its natural state.</p>
<p>I do <e... | [
{
"answer_id": 538256,
"author": "Joe Phillips",
"author_id": 20471,
"author_profile": "https://Stackoverflow.com/users/20471",
"pm_score": 2,
"selected": false,
"text": "<p>Why can't you just set the inner tables to 100% width and let it be limited by the outer table? If it's not the ca... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42223/"
] | **Problem:** I have HTML markup to deal with that consists of multiple tables nested inside another table. I would like the "inner tables" to all be the same width. I would also like all of the "inner tables" to be no wider than the width of the widest "inner table" in its natural state.
I do *not* want to simply set ... | I do not know of any HTML/CSS tricks to get it done, but since you are open to jQuery...
Assuming all your inner tables have a class of 'inner', you could do something like this:
```
$(document).ready(function() {
var largest = 0;
$('table.inner').each(function() {
var width = $(this)[0].offsetWidth;
... |
538,249 | <p>I have some JS code which generates the following object, </p>
<pre><code>return {
"type": "some thing",
"width": 2,
"colour": "#AA12BB",
"values": [2,3,4]
}
</code></pre>
<p>The creation of this isn't a problem. </p>
<p>In writing the test for the method that returns this am having a problem acce... | [
{
"answer_id": 538257,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 3,
"selected": true,
"text": "<p>Try this:</p>\n\n<pre><code>assertEquals('some thing', jsonObj[\"type\"]);\nassertEquals(2, jsonObj[\"width\"]);\n</... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52175/"
] | I have some JS code which generates the following object,
```
return {
"type": "some thing",
"width": 2,
"colour": "#AA12BB",
"values": [2,3,4]
}
```
The creation of this isn't a problem.
In writing the test for the method that returns this am having a problem accessing the width/type attributes: ... | Try this:
```
assertEquals('some thing', jsonObj["type"]);
assertEquals(2, jsonObj["width"]);
``` |
538,281 | <p>I've got the following bit of code (that another developer wrote) that I need to modify because the ExecuteProc procedure fails. (The reason why it fails isn't in the scope of this question. It's a long story) but in scope is that I'm not sure why a <code>NullReferenceException</code> would occur. It's in VB.NET (I... | [
{
"answer_id": 538295,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": true,
"text": "<p>Well, the most obvious thing is that if <code>CommandGet</code> fails and throws an exception, <code>oCommand</code> w... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16587/"
] | I've got the following bit of code (that another developer wrote) that I need to modify because the ExecuteProc procedure fails. (The reason why it fails isn't in the scope of this question. It's a long story) but in scope is that I'm not sure why a `NullReferenceException` would occur. It's in VB.NET (I'm not a VB.NET... | Well, the most obvious thing is that if `CommandGet` fails and throws an exception, `oCommand` won't be set - it'll still be null, so `oCommand.Connection` in the Finally block will throw a `NullReferenceException`.
In addition, I'd say:
* There's no need for the `Catch` block
* Two `Using` blocks (one for the comman... |
538,293 | <p>I was wondering if there was any way to access common parent node using Xpath. </p>
<pre><code><outer>
<main>
<a><b> sometext </b></a>
<c><d> sometext2 </d></c>
</main>
</outer>
</code></pre>
<p>I have the text nodes some... | [
{
"answer_id": 539957,
"author": "Dimitre Novatchev",
"author_id": 36305,
"author_profile": "https://Stackoverflow.com/users/36305",
"pm_score": 4,
"selected": false,
"text": "<p><strong>Use the following XPath 1.0 expression</strong>:</p>\n\n<pre><code>$v1/ancestor::*\n [count(. | $v2... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538293",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I was wondering if there was any way to access common parent node using Xpath.
```
<outer>
<main>
<a><b> sometext </b></a>
<c><d> sometext2 </d></c>
</main>
</outer>
```
I have the text nodes sometext and sometext2. is there a way i can access main (common parent) of these two nodes? I do not ... | **Use the following XPath 1.0 expression**:
```
$v1/ancestor::*
[count(. | $v2/ancestor::*)
=
count($v2/ancestor::*)
]
[1]
```
**where $v1 and $v2 hold the two text nodes** (in case you use XPath not within XSLT, you will have to replace $v1 and $v2 in the above expression with the XPath expressio... |
538,300 | <p>In a C++ MD2 file loader, I have a lot of frames, each with a name that ends with a number, such as</p>
<ul>
<li>stand0</li>
<li>stand1</li>
<li>stand2</li>
<li>stand3</li>
<li>stand4</li>
<li>...</li>
<li>stand10</li>
<li>stand11</li>
<li>run0</li>
<li>run1</li>
<li>run2</li>
</ul>
<p>etc.</p>
<p>How do I get wh... | [
{
"answer_id": 538326,
"author": "Steve",
"author_id": 1965047,
"author_profile": "https://Stackoverflow.com/users/1965047",
"pm_score": 0,
"selected": false,
"text": "<p>Quick and dirty and not too elegant:</p>\n\n<pre><code>for (int i = str.GetLength()-1; i >= 0; i--)\n {\n if... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216175/"
] | In a C++ MD2 file loader, I have a lot of frames, each with a name that ends with a number, such as
* stand0
* stand1
* stand2
* stand3
* stand4
* ...
* stand10
* stand11
* run0
* run1
* run2
etc.
How do I get what the string is without the number behind? e.g. a function that changed "stand10" to just "stand" | Just to complete it, one with find\_first\_of:
```
string new_string = str.substr(0, str.find_first_of("0123456789"));
```
just one line :)
Also, for these things, I like to use regular expressions (althought this case is very simple):
```
string new_string = boost::regex_replace(str, boost::regex("[0-9]+$"), "");... |
538,303 | <p>In MySQL, how can you select data where every row meets a certain condition? For example lets say I have a table showing when employees arrived at work, it has three fields: </p>
<pre><code>CREATE TABLE ArrivalTimes
(UserID INT
,Day DATE
,ArrivalTime TIME
);
</code></pre>
<p>I want to select all UserIDs of employ... | [
{
"answer_id": 538325,
"author": "jjclarkson",
"author_id": 46425,
"author_profile": "https://Stackoverflow.com/users/46425",
"pm_score": 1,
"selected": false,
"text": "<p>This was a nice thought, but it doesn't work. </p>\n\n<pre><code>SELECT UserID FROM ArrivalTimes WHERE MAX(ArrivalTi... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54645/"
] | In MySQL, how can you select data where every row meets a certain condition? For example lets say I have a table showing when employees arrived at work, it has three fields:
```
CREATE TABLE ArrivalTimes
(UserID INT
,Day DATE
,ArrivalTime TIME
);
```
I want to select all UserIDs of employees who have never been la... | The answers from @jjclarkson and @davethegr8 are close, but you can't put aggregate functions in the WHERE clause. The WHERE clause is evaluated for each row.
You need to evaluate the `MAX()` expression for each group, so you need to use a `HAVING` clause.
Try this:
```
SELECT UserID
FROM ArrivalTimes
GROUP BY Use... |
538,305 | <p>Say you override <code>operator*</code> for <code>point3</code> and <code>float</code> and then for <code>float</code> and <code>point3</code> you used the operator like this:</p>
<pre><code>point3 * float
</code></pre>
<p>Can you know if the operator method is going to end up inlined?</p>
| [
{
"answer_id": 538330,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 2,
"selected": false,
"text": "<p>As far as I know there is no way to know for certain as the JIT is responsible for inlining.</p>\n"
},
{
"a... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51816/"
] | Say you override `operator*` for `point3` and `float` and then for `float` and `point3` you used the operator like this:
```
point3 * float
```
Can you know if the operator method is going to end up inlined? | No, you can't tell for sure. In particular, because it's done at JIT time, it will depend on the version of the CLR - and I believe that the 64 bit CLR inlines differently to the 32 bit one as well. It will also depend on whether optimisations are enabled (e.g. whether you're debugging etc).
You can *prevent* inlining... |
538,316 | <p>I've got the setup below. When I click the 'Edit' link on the CommandField, a RowEditing event gets fired, but the row does not allow me to edit; specifically, the DropDownList does not appear.</p>
<p>My code seems to conform to all the examples I can find.</p>
<p>I'm probably missing something very basic, as I se... | [
{
"answer_id": 538321,
"author": "Greg Hurlman",
"author_id": 35,
"author_profile": "https://Stackoverflow.com/users/35",
"pm_score": 3,
"selected": false,
"text": "<p>System.Linq is a version 3.5 DLL; you'll need to remove references to it to compile in 2.0.</p>\n"
},
{
"answer_... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21294/"
] | I've got the setup below. When I click the 'Edit' link on the CommandField, a RowEditing event gets fired, but the row does not allow me to edit; specifically, the DropDownList does not appear.
My code seems to conform to all the examples I can find.
I'm probably missing something very basic, as I seem to be the only... | Json.NET 2.0 does not support .NET 2.0. If you want .NET 2.0 support, use [Json.NET 1.3.1](http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=Json&ReleaseId=6987). |
538,346 | <p>How can I <em>iterate</em> over a string in Python (get each character from the string, one at a time, each time through a loop)?</p>
| [
{
"answer_id": 538352,
"author": "Johannes Weiss",
"author_id": 55925,
"author_profile": "https://Stackoverflow.com/users/55925",
"pm_score": 7,
"selected": false,
"text": "<p>Even easier:</p>\n\n<pre><code>for c in \"test\":\n print c\n</code></pre>\n"
},
{
"answer_id": 53837... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57627/"
] | How can I *iterate* over a string in Python (get each character from the string, one at a time, each time through a loop)? | As Johannes pointed out,
```
for c in "string":
#do something with c
```
You can iterate pretty much anything in python using the `for loop` construct,
for example, `open("file.txt")` returns a file object (and opens the file), iterating over it iterates over lines in that file
```
with open(filename) as f:
... |
538,350 | <h2>Context</h2>
<ul>
<li>PHP 5.3.x</li>
</ul>
<h2>Overview</h2>
<p>After doing a code-review with an associate who uses both php and ruby routinely, a fun challenge came up on string interpolation in php compared to ruby.</p>
<h2>Question</h2>
<p>Assume color = "orange";</p>
<p><strong>Ruby:</strong></p>
<pre><... | [
{
"answer_id": 538364,
"author": "Shane H",
"author_id": 60247,
"author_profile": "https://Stackoverflow.com/users/60247",
"pm_score": 3,
"selected": false,
"text": "<p>You're close, you can embed variables in strings, but not function calls. </p>\n\n<p>I use <code>printf()</code> (and <... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42223/"
] | Context
-------
* PHP 5.3.x
Overview
--------
After doing a code-review with an associate who uses both php and ruby routinely, a fun challenge came up on string interpolation in php compared to ruby.
Question
--------
Assume color = "orange";
**Ruby:**
```
puts("My favorite color is #{color.downcase() + 'ish'} ... | You can't call plain functions inside strings like that, but you can coax the parser into doing strange things:
```
<?php
print "{$a->b()}"; // Works
//Parse error: syntax error, unexpected '(' in Command line code on line 1
print "${time()}";
print "${$a=time()} $a"; // Also works: prints "1234380996"
?>
```
As l... |
538,373 | <p>I am not sure why the following code is not behaving the way I would expect it to, but as I am new to jQuery I am sure that I'm missing something elementary.</p>
<p>html:</p>
<pre><code><div id="locale"></div>
<form id="theForm">
What would you like to do?<br /><br />
<input type=... | [
{
"answer_id": 538416,
"author": "Jere.Jones",
"author_id": 19476,
"author_profile": "https://Stackoverflow.com/users/19476",
"pm_score": 3,
"selected": false,
"text": "<p>I'll assume you have a submit button somewhere so that isn't your problem.</p>\n\n<p>What I see on your code is that... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62983/"
] | I am not sure why the following code is not behaving the way I would expect it to, but as I am new to jQuery I am sure that I'm missing something elementary.
html:
```
<div id="locale"></div>
<form id="theForm">
What would you like to do?<br /><br />
<input type="text" id="doThis" /><br /><br />
</form>
```
js:
`... | You simply have to first hide the locale div so that it can actually fade in (otherwise it will be displayed directly) :
```
$(document).ready(function() {
$("#theForm").submit(function(){
var doThis = $("#doThis").val().toLowerCase();
$("#locale").hide().html(doThis).fadeIn("slow");
return... |
538,378 | <p>. </p>
<pre><code> private void Form1_Load(object sender, EventArgs e)
{
List<CaclulatedData> tests = new List<CaclulatedData>
{
new CaclulatedData()
{
... | [
{
"answer_id": 538400,
"author": "Gordon Bell",
"author_id": 16473,
"author_profile": "https://Stackoverflow.com/users/16473",
"pm_score": 2,
"selected": false,
"text": "<p>There are a number of free online C# to VB.NET and VB.NET to C# converters available:</p>\n\n<p><a href=\"http://co... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61856/"
] | .
```
private void Form1_Load(object sender, EventArgs e)
{
List<CaclulatedData> tests = new List<CaclulatedData>
{
new CaclulatedData()
{
Bonds = "Fir... | Part of your problem is that vb8 does not yet support some of the features your C# code is using (automatic properties and collection initializers, for example), so the translations is not 1:1. Some of these features were added in VB9. That said, it's not that hard:
```
Private Sub Form1_Load(ByVal sender As Object, B... |
538,391 | <p>I make an AJAX request like so using JQuery:</p>
<pre><code>$.ajax({
type: "GET",
url: "getvideo.php",
data: 'videoid=' + vid,
</code></pre>
<p>I use firebug to tell me what's going on and it tells me that a 500 internal server error has occurred? Here is part of the script concerned:</p>
<pre><code>$videoi... | [
{
"answer_id": 538405,
"author": "Luca Matteis",
"author_id": 50394,
"author_profile": "https://Stackoverflow.com/users/50394",
"pm_score": 2,
"selected": false,
"text": "<p>What? <code>.php5</code> ? I don't know your apache configuration (given you're even using it), but <code>.php</co... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51649/"
] | I make an AJAX request like so using JQuery:
```
$.ajax({
type: "GET",
url: "getvideo.php",
data: 'videoid=' + vid,
```
I use firebug to tell me what's going on and it tells me that a 500 internal server error has occurred? Here is part of the script concerned:
```
$videoid = $_GET['videoid'];
$get = new yout... | Try executing the call manually yourself in your browser (its the same thing) and see what gets returned. If nothing gets returned and you get a 500 internal server error, you need to then review your logs and see whats causing this error to happen.
Also make sure you are making the ajax call to the proper domain. If... |
538,397 | <p>I have a Windows 6 app I am developing (in VB). I am pulling data from a MSSQL 2005 database. Everything worked fine running it locally (with an emulator) but when I moved the database to a test box, I get the following error:</p>
<p>System.Data.SqlClient.SqlException {"Specified SQL server not found: xx.xx.xx.x... | [
{
"answer_id": 538418,
"author": "SQLMenace",
"author_id": 740,
"author_profile": "https://Stackoverflow.com/users/740",
"pm_score": 2,
"selected": false,
"text": "<p>make sure sql browser is running</p>\n\n<p>make sure remote connections and TCP/IP is enabled on the SQL box</p>\n"
},
... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63504/"
] | I have a Windows 6 app I am developing (in VB). I am pulling data from a MSSQL 2005 database. Everything worked fine running it locally (with an emulator) but when I moved the database to a test box, I get the following error:
System.Data.SqlClient.SqlException {"Specified SQL server not found: xx.xx.xx.xxx\sql2005"}
... | Try changing your connection string to:
```
Data Source=XX.XX.XX.XXX;Initial Catalog=databaseName;UID=databaseUser;PWD=password
```
Most likely the Instance Name (sql2005) is incorrect. |
538,412 | <p><strong>Duplicate of</strong> <em><a href="https://stackoverflow.com/questions/2775">What's the BEST way to remove the time portion of a datetime value (SQL Server)?</a></em></p>
<p>I have a column that tracks when things are created using a datetime, but I'd like to generate a report that groups them by day, so I ... | [
{
"answer_id": 538431,
"author": "Austin Salonen",
"author_id": 4068,
"author_profile": "https://Stackoverflow.com/users/4068",
"pm_score": 1,
"selected": false,
"text": "<p>Yes. There are many formats to choose from so I'll link it instead.</p>\n\n<p><a href=\"http://library.cirr.com/M... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2443/"
] | **Duplicate of** *[What's the BEST way to remove the time portion of a datetime value (SQL Server)?](https://stackoverflow.com/questions/2775)*
I have a column that tracks when things are created using a datetime, but I'd like to generate a report that groups them by day, so I need a way of nulling out the time compon... | One way is to change `getdate()` to your column name,
```
select dateadd(dd, datediff(dd, 0, getdate())+0, 0)
``` |
538,426 | <p>When using a SortedDictionary in Linq and iterating over the KeyValuePair it provides, can I be assured that a complex linq query will execute it in ascending order? Here's a brief, although a bit confusing example:</p>
<pre><code>Random r = new Random();
//build 100 dictionaries and put them into a sorted diction... | [
{
"answer_id": 538478,
"author": "LDomagala",
"author_id": 45719,
"author_profile": "https://Stackoverflow.com/users/45719",
"pm_score": 0,
"selected": false,
"text": "<ol>\n<li>Yes you can. The SortedDictionary has no way to get unsorted. It is guaranteed to stay sorted, even if it thro... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18941/"
] | When using a SortedDictionary in Linq and iterating over the KeyValuePair it provides, can I be assured that a complex linq query will execute it in ascending order? Here's a brief, although a bit confusing example:
```
Random r = new Random();
//build 100 dictionaries and put them into a sorted dictionary
//with "pri... | 1. Yes, you can trust the order of SortedDictionary. It would be pointless otherwise :)
2. It would be slightly more efficient without the "let" clause. Just do:
```
var qry = from key in keys
from priority in sortedDict
where priority.Value.ContainsKey(key)
let value = priority.Value[key... |
538,435 | <p>I need to encrypt a string on the iPhone and send it to a .Net web service for decryption. I am able to encrypt/decrypt on the iPhone and with .Net, but the encrypted strings from the iPhone cannot be decrypted by .Net. The error I get is "Padding is invalid and cannot be removed."</p>
<p>The .Net code is from:
<... | [
{
"answer_id": 539928,
"author": "johnny",
"author_id": 61097,
"author_profile": "https://Stackoverflow.com/users/61097",
"pm_score": 5,
"selected": true,
"text": "<p>At the very least, you are using differing initialization vectors (IV).</p>\n\n<ul>\n<li><p>The .Net code uses the key fo... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65244/"
] | I need to encrypt a string on the iPhone and send it to a .Net web service for decryption. I am able to encrypt/decrypt on the iPhone and with .Net, but the encrypted strings from the iPhone cannot be decrypted by .Net. The error I get is "Padding is invalid and cannot be removed."
The .Net code is from:
<http://blog.... | At the very least, you are using differing initialization vectors (IV).
* The .Net code uses the key for IV.
```
private static AesCryptoServiceProvider GetProvider(byte[] key)
{
//Set up the encryption objects
AesCryptoServiceProvider result = new AesCryptoServiceProvider();
byte[] RealKey = Encryptor.Ge... |
538,441 | <p>Sometimes when copying stuff into PostgreSQL I get errors that there's invalid byte sequences.</p>
<p>Is there an easy way using either vim or other utilities to detect byte sequences that cause errors such as: <strong>invalid invalid byte sequence for encoding "UTF8": 0xde70</strong> and whatnot, and possibly and ... | [
{
"answer_id": 538462,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stackoverflow.com/users/12349",
"pm_score": 2,
"selected": false,
"text": "<p>Based on one short sentence, it sounds like you have text in one encoding (e.g. ANSI/ASCII) and you are telling Postg... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64941/"
] | Sometimes when copying stuff into PostgreSQL I get errors that there's invalid byte sequences.
Is there an easy way using either vim or other utilities to detect byte sequences that cause errors such as: **invalid invalid byte sequence for encoding "UTF8": 0xde70** and whatnot, and possibly and easy way to do a conver... | I figured it out. It wasn't really an encoding issue.
SQLite's output escaped strings differently than Postgres expects. There were some cases where 'asdf\xd\foo' was outputted. I believe the '\x' was causing it to expect the following characters to be unicode encoding.
Solution to this is dumping each table individu... |
538,442 | <p>I'm working on a web application that renders a reporting services report as a PDF and one of my requirements is to allow for multiple locations to be included on the same report. To handle this, I have created a multi-value report parameter which seems to do the trick when using the RS UI, etc. But, I am using th... | [
{
"answer_id": 538462,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stackoverflow.com/users/12349",
"pm_score": 2,
"selected": false,
"text": "<p>Based on one short sentence, it sounds like you have text in one encoding (e.g. ANSI/ASCII) and you are telling Postg... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55747/"
] | I'm working on a web application that renders a reporting services report as a PDF and one of my requirements is to allow for multiple locations to be included on the same report. To handle this, I have created a multi-value report parameter which seems to do the trick when using the RS UI, etc. But, I am using the web... | I figured it out. It wasn't really an encoding issue.
SQLite's output escaped strings differently than Postgres expects. There were some cases where 'asdf\xd\foo' was outputted. I believe the '\x' was causing it to expect the following characters to be unicode encoding.
Solution to this is dumping each table individu... |
538,450 | <p>Some context for the question</p>
<ul>
<li>All objects in this question are persistent.</li>
<li>All requests will be from a Silverlight client talking to an app server via a binary protocol (Hessian) and not WCF.</li>
<li>Each user will have a session key (not an ASP.NET session) which will be a string, integer, o... | [
{
"answer_id": 538482,
"author": "Logicalmind",
"author_id": 26977,
"author_profile": "https://Stackoverflow.com/users/26977",
"pm_score": 1,
"selected": false,
"text": "<p>Have you considered an <a href=\"http://en.wikipedia.org/wiki/Multiversion_concurrency_control\" rel=\"nofollow nor... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61311/"
] | Some context for the question
* All objects in this question are persistent.
* All requests will be from a Silverlight client talking to an app server via a binary protocol (Hessian) and not WCF.
* Each user will have a session key (not an ASP.NET session) which will be a string, integer, or GUID (undecided so far).
... | Have you considered an [mvcc](http://en.wikipedia.org/wiki/Multiversion_concurrency_control) implementation:
Granted, it would be harder to implement but seems much more concurrent than what you have explained. Just throwing the idea out there. |
538,476 | <p>I'm rendering some HTML in a QT QLabel. The HTML looks like this:</p>
<pre><code><pre>foo\tbar</pre>
</code></pre>
<p>(note that I've put "\t" where there is a tab chracter in the code). </p>
<p>This renders fine, but the tab character appears to be rendered as eight spaces, whereas I want it to be re... | [
{
"answer_id": 538510,
"author": "strager",
"author_id": 39992,
"author_profile": "https://Stackoverflow.com/users/39992",
"pm_score": 4,
"selected": true,
"text": "<p>According to <a href=\"http://www.w3.org/TR/html4/struct/text.html#h-9.3.4\" rel=\"noreferrer\">W3</a> (HTML4):</p>\n\n<... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1304/"
] | I'm rendering some HTML in a QT QLabel. The HTML looks like this:
```
<pre>foo\tbar</pre>
```
(note that I've put "\t" where there is a tab chracter in the code).
This renders fine, but the tab character appears to be rendered as eight spaces, whereas I want it to be redered as 4. How can I change this **without h... | According to [W3](http://www.w3.org/TR/html4/struct/text.html#h-9.3.4) (HTML4):
>
> The horizontal tab character (decimal 9 in [ISO10646] and [ISO88591]) is usually interpreted by visual user agents as the smallest non-zero number of spaces necessary to line characters up along tab stops that are every 8 characters. ... |
538,485 | <p>I am working on some source code these days. In some codes, I find these at the head. Dunno what it means. Any ideas?</p>
<pre><code>#include "pth_p.h"
#if cpp
#ifndef PTH_DEBUG
#define pth_debug1(a1) /* NOP */
#define pth_debug2(a1, a2) /* NOP */
#define pth_debug3(a1, a2, a... | [
{
"answer_id": 538487,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 2,
"selected": false,
"text": "<p>This is an example of a preprocessor directive that allows you to test an expression at compilation time. <a href=\... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48826/"
] | I am working on some source code these days. In some codes, I find these at the head. Dunno what it means. Any ideas?
```
#include "pth_p.h"
#if cpp
#ifndef PTH_DEBUG
#define pth_debug1(a1) /* NOP */
#define pth_debug2(a1, a2) /* NOP */
#define pth_debug3(a1, a2, a3) ... | it is testing if some constant named cpp that is visible to the preprocessor (is likely a macro) is non-zero.
Usual convention is that macros should be all uppercase so that they are more obvious, but they don't have to be (as is apparently the case here).
My guess is that it stands for c++ and one of the included he... |
538,504 | <p>I have a portion of a bash script that is getting a filename without extension, but I'm trying to understand what is really going on here. What are the "%%"'s for? Can someone elaborate on what bash is doing behind the scenes? How can this technique be used on a general basis?</p>
<pre><code>#!/bin/bash
for src... | [
{
"answer_id": 538523,
"author": "PEZ",
"author_id": 44639,
"author_profile": "https://Stackoverflow.com/users/44639",
"pm_score": 1,
"selected": false,
"text": "<p>Check out \"Parameter Expansion\" in the bash man pages. That syntax expands the $src variable deleting stuff that matches ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/538504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46425/"
] | I have a portion of a bash script that is getting a filename without extension, but I'm trying to understand what is really going on here. What are the "%%"'s for? Can someone elaborate on what bash is doing behind the scenes? How can this technique be used on a general basis?
```
#!/bin/bash
for src in *.tif
do
... | It gets rid of the filename extension (*here*: `.tif`), sample:
```
$ for A in test.py test.sh test.xml test.xsl; do echo "$A: ${A%%.*}"; done
test.py: test
test.sh: test
test.xml: test
test.xsl: test
```
from bash manual:
```
${parameter%%word}
The word is expanded to produce a pattern just as in path... |