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 |
|---|---|---|---|---|---|---|
357,505 | <p>I have a web forum that I have coded in Python for the App Engine platform. I have noticed that it is not being indexed well by Google and I am trying to fix that.<br>
I have used Google Webmaster to submit a sitemap with almost 400 URLs but apparently only 8 were indexed!<br>
I even get a warning stating:</p>
<blo... | [
{
"answer_id": 357609,
"author": "David Hill",
"author_id": 1181217,
"author_profile": "https://Stackoverflow.com/users/1181217",
"pm_score": -1,
"selected": false,
"text": "<p>URL content is part of the picture, but only a small part.</p>\n\n<p>Having the URL say readforum2106 instead o... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a web forum that I have coded in Python for the App Engine platform. I have noticed that it is not being indexed well by Google and I am trying to fix that.
I have used Google Webmaster to submit a sitemap with almost 400 URLs but apparently only 8 were indexed!
I even get a warning stating:
>
> All the ... | The real thing to look out for it stuff like:
```
http://www.example.com/forum.py?thread=1000
http://www.example.com/forum.py?thread=1000&mode=printer
```
The web crawler sees two different URLs with the same content and assume you are trying to do something fishy. You need to make sure your "Print this Page" link... |
357,512 | <p>I have a custom sharepoint app whose security model depends on an HTTP header.
When a request is made from the mobile device, an http header called HTTP_RIM_DEVICE_EMAIL is added to each request.
I grab the http header via the following method:</p>
<pre><code>private static string GetValueFromHeader(string headerNa... | [
{
"answer_id": 359856,
"author": "Dave Harding",
"author_id": 42697,
"author_profile": "https://Stackoverflow.com/users/42697",
"pm_score": 0,
"selected": false,
"text": "<p>The value in the http header is device specific, which is dynamic.</p>\n"
},
{
"answer_id": 521303,
"a... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42697/"
] | I have a custom sharepoint app whose security model depends on an HTTP header.
When a request is made from the mobile device, an http header called HTTP\_RIM\_DEVICE\_EMAIL is added to each request.
I grab the http header via the following method:
```
private static string GetValueFromHeader(string headerName)
... | Actually, sharepoint doesn't strip HTTP Headers. |
357,537 | <p>I have a class Pkg and I need to use it under form of QVariant. </p>
<p>At the end of my Pkg.h I have:</p>
<pre><code>Q_DECLARE_METATYPE(Pkg)
</code></pre>
<p>and this does not give compile errors, but in my main.cpp I have to do:</p>
<pre><code>qRegisterMetaType<Pkg>("Pkg");
</code></pre>
<p>and this doe... | [
{
"answer_id": 358261,
"author": "Michael Bishop",
"author_id": 45114,
"author_profile": "https://Stackoverflow.com/users/45114",
"pm_score": 4,
"selected": true,
"text": "<p>The QVariant constructor won't just take any old type. You need to use <a href=\"http://doc.trolltech.com/4.4/qva... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39339/"
] | I have a class Pkg and I need to use it under form of QVariant.
At the end of my Pkg.h I have:
```
Q_DECLARE_METATYPE(Pkg)
```
and this does not give compile errors, but in my main.cpp I have to do:
```
qRegisterMetaType<Pkg>("Pkg");
```
and this does not give errors too, but when I try to create a QVariant(Pkg... | The QVariant constructor won't just take any old type. You need to use [QVariant::setValue()](http://doc.trolltech.com/4.4/qvariant.html#setValue) or [qVariantFromValue](http://doc.trolltech.com/4.4/qvariant.html#qVariantFromValue). |
357,571 | <p>the object of the game in this case is to use a Treeview with a sitemap provider - and implement using CSS. I'm guessing the way to do this is with the CSS adapter kit. </p>
<p>I've plugged in the adapters using the DLL implementation and there i get my basic treeview but it seems to pull in all sorts of js that le... | [
{
"answer_id": 357694,
"author": "Nathan Prather",
"author_id": 44595,
"author_profile": "https://Stackoverflow.com/users/44595",
"pm_score": 2,
"selected": true,
"text": "<p>I would use a repeater as in this example taken from the asp.net data access tutorials:</p>\n\n<pre><code><asp... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45131/"
] | the object of the game in this case is to use a Treeview with a sitemap provider - and implement using CSS. I'm guessing the way to do this is with the CSS adapter kit.
I've plugged in the adapters using the DLL implementation and there i get my basic treeview but it seems to pull in all sorts of js that lets me clic... | I would use a repeater as in this example taken from the asp.net data access tutorials:
```
<asp:Repeater runat="server" ID="menu" DataSourceID="SiteMapDataSource1">
<ItemTemplate>
<li>
<asp:HyperLink runat="server"
NavigateUrl='<%# Eval("Url") %>'>
<%# Eval("Title") %... |
357,578 | <p>I want to add a single model object that has been instantiated <em>once</em> in XAML, and add it to two different collections (in xaml).</p>
<p>The following code renders fine in Blend's Design Time, but I get the following errors at run time:</p>
<p><em>For "Post1"</em><br>
Object of type 'WpfBlog.Models.Tag' can... | [
{
"answer_id": 357658,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 0,
"selected": false,
"text": "<p>This is very similar to the problem described in <a href=\"https://stackoverflow.com/questions/150150/how-do-i-share-... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4572/"
] | I want to add a single model object that has been instantiated *once* in XAML, and add it to two different collections (in xaml).
The following code renders fine in Blend's Design Time, but I get the following errors at run time:
*For "Post1"*
Object of type 'WpfBlog.Models.Tag' cannot be converted to type 'System... | I was able to avoid the problem by explicitly initializing a new collection within the Tags property. Something like this:
```
<local:PostViewModel Title="Post1">
<local:PostViewModel.Tags>
<model:TagCollection>
<StaticResource ResourceKey="TDD" />
</model:TagCollection>
</local:PostViewModel.Tag... |
357,594 | <pre><code>SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY hrl.Frn) as Row,
hrl.unq, hrl.LcnsId, hc.Business,hc.Name,hc.Phone,
hrl.Frn,hrl.CallSign, hrl.gsamarkettypeid,
gmt.[Market Type Code] + ' - ' + gmt.gsamarkettype,
hrl.gsalatitude,hrl.gsalongitude,
rsc.RadioServiceCode ... | [
{
"answer_id": 357605,
"author": "Charles Bretana",
"author_id": 32632,
"author_profile": "https://Stackoverflow.com/users/32632",
"pm_score": 0,
"selected": false,
"text": "<p>You can't use an alias for a column in a where clause, because the where clause is processed before the Select ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33690/"
] | ```
SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY hrl.Frn) as Row,
hrl.unq, hrl.LcnsId, hc.Business,hc.Name,hc.Phone,
hrl.Frn,hrl.CallSign, hrl.gsamarkettypeid,
gmt.[Market Type Code] + ' - ' + gmt.gsamarkettype,
hrl.gsalatitude,hrl.gsalongitude,
rsc.RadioServiceCode + ' - '... | Move your Row criteria into the outer select
```
SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY hrl.Frn) as Row,
...
WHERE hc.Entity_Type = 'L' AND hrl.LicenseStatusId IN (1)
) T
WHERE T.Row >=1 and T.Row <= 20)
``` |
357,600 | <p>I can't find much information on <code>const_cast</code>. The only info I could find (on Stack Overflow) is:</p>
<blockquote>
<p>The <code>const_cast<>()</code> is used to add/remove const(ness) (or volatile-ness) of a variable.</p>
</blockquote>
<p>This makes me nervous. Could using a <code>const_cast</... | [
{
"answer_id": 357607,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 8,
"selected": true,
"text": "<p><code>const_cast</code> is safe only if you're casting a variable that was originally non-<code>const</code>. For... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10606/"
] | I can't find much information on `const_cast`. The only info I could find (on Stack Overflow) is:
>
> The `const_cast<>()` is used to add/remove const(ness) (or volatile-ness) of a variable.
>
>
>
This makes me nervous. Could using a `const_cast` cause unexpected behavior? If so, what?
Alternatively, when is it ... | `const_cast` is safe only if you're casting a variable that was originally non-`const`. For example, if you have a function that takes a parameter of a `const char *`, and you pass in a modifiable `char *`, it's safe to `const_cast` that parameter back to a `char *` and modify it. However, if the original variable was ... |
357,616 | <p>I am relatively new to bazaar (primarily used cvs, then subversion, and at my current job we're using SourceUnsafe). My current development environment is structured like this:</p>
<pre>
\dev (shared repository)
\trunk
\project1 (branch)
\project2 (branch)
\branches
\pr... | [
{
"answer_id": 358087,
"author": "Brody",
"author_id": 17131,
"author_profile": "https://Stackoverflow.com/users/17131",
"pm_score": 1,
"selected": true,
"text": "<p>Wouldn't you want any new libraries to have their own solution and be built as part of that and then referenced by the oth... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28776/"
] | I am relatively new to bazaar (primarily used cvs, then subversion, and at my current job we're using SourceUnsafe). My current development environment is structured like this:
```
\dev (shared repository)
\trunk
\project1 (branch)
\project2 (branch)
\branches
\proj1-bugf... | Wouldn't you want any new libraries to have their own solution and be built as part of that and then referenced by the other projects. That way the library has only a single version being built (instead of one per solution) |
357,629 | <p>The size and range of the integer value types in C++ are platform specific. Values found on most 32-bit systems can be found at <a href="http://www.cplusplus.com/doc/tutorial/variables.html" rel="noreferrer">Variables. Data Types. - C++ Documentation</a>. How do you determine what the actual size and range are for... | [
{
"answer_id": 357637,
"author": "Doug T.",
"author_id": 8123,
"author_profile": "https://Stackoverflow.com/users/8123",
"pm_score": 3,
"selected": false,
"text": "<p>Why not just be sure and use boost's numeric types?</p>\n\n<p>ie:</p>\n\n<pre><code>boost::uint32_t\nboost::int32_t\n</co... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] | The size and range of the integer value types in C++ are platform specific. Values found on most 32-bit systems can be found at [Variables. Data Types. - C++ Documentation](http://www.cplusplus.com/doc/tutorial/variables.html). How do you determine what the actual size and range are for your specific system? | C Style
-------
limits.h contains the min and max values for ints as well as other data types which should be exactly what you need:
```
#include <limits.h> // C header
#include <climits> // C++ header
// Constant containing the minimum value of a signed integer (–2,147,483,648)
INT_MIN;
// Constant containing the... |
357,639 | <p>I'm trying to write a script that will create a file on the server then use <code>header()</code> to redirect the user to that file. Then, after about 10 seconds I want to delete the file. I've tried this:</p>
<pre><code>header('Location: '.$url);
flush();
sleep(10);
unlink($url);
</code></pre>
<p>But the browser ... | [
{
"answer_id": 357670,
"author": "pbrodka",
"author_id": 33093,
"author_profile": "https://Stackoverflow.com/users/33093",
"pm_score": 0,
"selected": false,
"text": "<p>You can try doing smth like that:</p>\n\n<pre><code><iframe src=\"<?=$url?>\"></iframe>\n\n....\n<... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13557/"
] | I'm trying to write a script that will create a file on the server then use `header()` to redirect the user to that file. Then, after about 10 seconds I want to delete the file. I've tried this:
```
header('Location: '.$url);
flush();
sleep(10);
unlink($url);
```
But the browser just waits for the script to complete... | You might be better off having the PHP page serve the file. No need to create a temporary file in this case and delete it, just send out the data you intended to write to the temporary file. You will need to set the headers correctly so the browser can identify the type of file you are sending. i.e. Content-Type: text/... |
357,643 | <h2>Repetitive Dates:</h2>
<p>Billing cycles come in a lot of different formats, for example: "the first of the month", "third Friday of the month", or "first weekday on or after 21st day after the 13th of the month" (thanks visa!). My goal is to be able to represent these different billing cycles in one easily parsed... | [
{
"answer_id": 357708,
"author": "Jim Barrows",
"author_id": 45108,
"author_profile": "https://Stackoverflow.com/users/45108",
"pm_score": 1,
"selected": false,
"text": "<p>You forgot weekend processing. If my bill is due on a Sunday, I want it to show up on Friday. That kind of thing.... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/80/"
] | Repetitive Dates:
-----------------
Billing cycles come in a lot of different formats, for example: "the first of the month", "third Friday of the month", or "first weekday on or after 21st day after the 13th of the month" (thanks visa!). My goal is to be able to represent these different billing cycles in one easily ... | Current solution:
-----------------
```
YYYY/MM/DD+YY/MM/DD+DOW
```
* all blocks (delimited by `+`) are optional as well as all parts of each block.
* first block denotes the starting date
+ if blank - denotes today
+ if missing portion - denotes all... ie "//12" would denote the 12th of the month every month.
+ ... |
357,656 | <p>(I'm using the <a href="http://developer.berlios.de/projects/pyprocessing" rel="nofollow noreferrer">pyprocessing</a> module in this example, but replacing processing with multiprocessing should probably work if you run <a href="http://docs.python.org/library/multiprocessing.html" rel="nofollow noreferrer">python 2.... | [
{
"answer_id": 357793,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 0,
"selected": false,
"text": "<p>Probably not ideal, but you can release the block by sending the socket some data from the signal handler or the thre... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2010/"
] | (I'm using the [pyprocessing](http://developer.berlios.de/projects/pyprocessing) module in this example, but replacing processing with multiprocessing should probably work if you run [python 2.6](http://docs.python.org/library/multiprocessing.html) or use the [multiprocessing backport](http://code.google.com/p/python-m... | Isnt that what select is for??
Only call accept on the socket if the select indicates it will not block...
The select has a timeout, so you can break out occasionally occasionally to check
if its time to shut down.... |
357,672 | <p>I want to dynamically create variables with dynamic names for later use in my transform, but to do this I'd need to dynamically generate XSL and then run it in the same script.</p>
<p>This is just a rough pseudo code example of what I'm looking for.</p>
<pre><code> <xsl:for-each select="//constants/constan... | [
{
"answer_id": 358154,
"author": "Dimitre Novatchev",
"author_id": 36305,
"author_profile": "https://Stackoverflow.com/users/36305",
"pm_score": 4,
"selected": false,
"text": "<p><strong>XSLT has a special built-in feature that supports generating output, which is XSLT</strong> itself.</... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10922/"
] | I want to dynamically create variables with dynamic names for later use in my transform, but to do this I'd need to dynamically generate XSL and then run it in the same script.
This is just a rough pseudo code example of what I'm looking for.
```
<xsl:for-each select="//constants/constant" >
<xsl:variab... | What you want is not possible at present in pure XSLT (1.0 or 2.0).
If you are useing the [**Saxon 9.x XSLT processor**](http://www.saxonica.com/), there is a couple of extension functions that implement this: [**saxon:compile-stylesheet()**](http://www.saxonica.com/documentation/extensions/functions/compile-styleshee... |
357,695 | <p>Using ANTLR v3 and the CSharp2 language specifier, is there any way to indicate that you want the generated lexer or parser to be internal versus the default of public?</p>
<p>The namespace is specified with:</p>
<pre><code>@lexer::namespace {My.Namespace}
</code></pre>
<p>and I would assume something similar exi... | [
{
"answer_id": 373646,
"author": "Ted Elliott",
"author_id": 16501,
"author_profile": "https://Stackoverflow.com/users/16501",
"pm_score": 0,
"selected": false,
"text": "<p>I wanted to know the same thing, from looking at the template that it uses, it doesn't look like you can. \"publi... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33724/"
] | Using ANTLR v3 and the CSharp2 language specifier, is there any way to indicate that you want the generated lexer or parser to be internal versus the default of public?
The namespace is specified with:
```
@lexer::namespace {My.Namespace}
```
and I would assume something similar exists for the access specifier, but... | This [thread](http://antlr.markmail.org/message/hwddx4xi7da4czre) on the antlr-interest mailing list talks about it. At the time of writing they are adding access specifiers to rules, but don't support access specifiers on the entire parser/lexer class. Will update if that changes. |
357,732 | <p>I can successfully run my Grails application in Jetty. It succeeds in connecting to my MsSql database and everything is fine. When I deploy that same application in Tomcat 6 on the same machine, I receive the following error on startup in the Tomcat log:</p>
<pre><code>Caused by: java.net.ConnectException: Connec... | [
{
"answer_id": 359017,
"author": "Ben Williams",
"author_id": 2453,
"author_profile": "https://Stackoverflow.com/users/2453",
"pm_score": 2,
"selected": false,
"text": "<p>What does your DataSource.groovy file look like? When you run your app with 'grails run-app', Grails uses the dataso... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21832/"
] | I can successfully run my Grails application in Jetty. It succeeds in connecting to my MsSql database and everything is fine. When I deploy that same application in Tomcat 6 on the same machine, I receive the following error on startup in the Tomcat log:
```
Caused by: java.net.ConnectException: Connection refused: co... | This is an issue with grails 1.1beta1. When I reverted my application to grails 1.0.4, it seemed to work. Unfortunately, I had to change a couple pieces of code because the beta version of grails fixed some bugs, but this seems to be rooted in the version of grails I was using.
I just created an empty grails applicati... |
357,752 | <p>I have a web application that uses the current version of JQuery that needs to get some JSON objects back from a REST web service. I'm using the following call to $.getJSON:</p>
<p>$.getJSON("<a href="http://localhost:17245/Service.svc/?format=json" rel="nofollow noreferrer">http://localhost:17245/Service.svc/?form... | [
{
"answer_id": 357767,
"author": "palehorse",
"author_id": 312,
"author_profile": "https://Stackoverflow.com/users/312",
"pm_score": 3,
"selected": true,
"text": "<p>I had a similar issue. The signature $.getJSON is (url, data, callback) and I was not passing the data argument either. ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22848/"
] | I have a web application that uses the current version of JQuery that needs to get some JSON objects back from a REST web service. I'm using the following call to $.getJSON:
$.getJSON("<http://localhost:17245/Service.svc/?format=json>", function(data) {alert(data.id);});
This call works fine in IE7 and I can call the... | I had a similar issue. The signature $.getJSON is (url, data, callback) and I was not passing the data argument either. Try this:
```
$.getJSON("http://localhost:17245/Service.svc/?format=json", {}, function(data) {alert(data.id);});
``` |
357,754 | <p>In Ruby, <code>Dir.glob("**/*.rb")</code> (for instance) doesn't traverse symlinked directories. Is it possible to get the <code>**</code> to traverse symlinks?</p>
<p>I'm using two gems which find files this way, but I need them to see files within a symlinked directory.</p>
| [
{
"answer_id": 357798,
"author": "Jonathan Lonowski",
"author_id": 15031,
"author_profile": "https://Stackoverflow.com/users/15031",
"pm_score": 4,
"selected": false,
"text": "<p>Normally not with recursive search due to the risk of infinite loops.</p>\n\n<p>But, <a href=\"http://groups.... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4937/"
] | In Ruby, `Dir.glob("**/*.rb")` (for instance) doesn't traverse symlinked directories. Is it possible to get the `**` to traverse symlinks?
I'm using two gems which find files this way, but I need them to see files within a symlinked directory. | Jonathan's clever and cunning approach is great, capable of slashing through hordes of symlinks with but a mere flick of a few asterisks, muahaha. However, it has the unfortunate side-effect of not returning immediate-child matches. An improved version might be:
```
Dir.glob("**{,/*/**}/*.rb")
```
Which will (in my ... |
357,785 | <p>I am interested in enabling code folding in Vim for Python code. I have noticed multiple ways to do so.</p>
<p>Does anyone have a preferred way to do Python code folding in Vim? I.e, </p>
<ul>
<li>Do you have a particular Vim plugin that you use and like?</li>
<li>Do you use manual folding or do you place markers ... | [
{
"answer_id": 357826,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": false,
"text": "<p>Python is well suited for folding on indent, bit for writing my own code I use markers as they can crunch a document down t... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3045/"
] | I am interested in enabling code folding in Vim for Python code. I have noticed multiple ways to do so.
Does anyone have a preferred way to do Python code folding in Vim? I.e,
* Do you have a particular Vim plugin that you use and like?
* Do you use manual folding or do you place markers in comments?
* Any other rec... | Personally I can't convince myself to litter my code with the markers. I've become pretty used to (and efficient) at using indent-folding. Together with my mapping of space bar (see below) to open/close folds and the zR and zM commands, I'm right at home. Perfect for Python!
```
set foldmethod=indent
nnoremap <space> ... |
357,790 | <p>I have a small calculator that I am creating in C# (Sharp Develop). The user enters two values and the code returns the third. I am having trouble rounding the third value once it is returned. I have been through a couple of forums and the msdn site and I understand the code that is posted there, but I cant seem to ... | [
{
"answer_id": 357799,
"author": "terjetyl",
"author_id": 29519,
"author_profile": "https://Stackoverflow.com/users/29519",
"pm_score": 0,
"selected": false,
"text": "<p>Could Math.Round(z, nrofdecimals) be the answer to your problem?</p>\n"
},
{
"answer_id": 357800,
"author"... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45151/"
] | I have a small calculator that I am creating in C# (Sharp Develop). The user enters two values and the code returns the third. I am having trouble rounding the third value once it is returned. I have been through a couple of forums and the msdn site and I understand the code that is posted there, but I cant seem to mak... | Try using Math.Round()
```
tb2_kva.Text = Math.Round(z, # Places).ToString();
``` |
357,803 | <p>Basically what I need is an automated way to update the product version number in WiX (3.0 with Votive etc), and then get that version number into an Inno Setup "bootstrapper"</p>
<p>I pretty much have the process mostly automated, however version numbers still need to be updated manually which obviously isn't idea... | [
{
"answer_id": 357820,
"author": "Rob",
"author_id": 9236,
"author_profile": "https://Stackoverflow.com/users/9236",
"pm_score": 1,
"selected": false,
"text": "<p>The way I do it is with a WSF script (I use JavaScript but you could use VBScript or even an SH script using Cygwin) that cre... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23822/"
] | Basically what I need is an automated way to update the product version number in WiX (3.0 with Votive etc), and then get that version number into an Inno Setup "bootstrapper"
I pretty much have the process mostly automated, however version numbers still need to be updated manually which obviously isn't ideal, but I c... | No need to pass anything! You can simply let the InnoSetup Preprocessor read the version info straight from the binary's version resource, e.g.:
```
#define AppName "My App"
#define SrcApp "MyApp.exe"
#define FileVerStr GetFileVersion(SrcApp)
#define StripBuild(str VerStr) Copy(VerStr, 1, RPos(".", VerStr)-1)
#define ... |
357,804 | <p>Today I found out that putting strings in a resource file will cause them to be treated as literals, i.e putting "Text for first line \n Text for second line" will cause the escape character itself to become escaped, and so what's stored is "Text for first line \n Text for second line" - and then these come out in t... | [
{
"answer_id": 357811,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 5,
"selected": true,
"text": "<p>Since <code>\\n</code> is actually a single character, you cannot acheive this by simply replacing the backslashes in ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45139/"
] | Today I found out that putting strings in a resource file will cause them to be treated as literals, i.e putting "Text for first line \n Text for second line" will cause the escape character itself to become escaped, and so what's stored is "Text for first line \n Text for second line" - and then these come out in the ... | Since `\n` is actually a single character, you cannot acheive this by simply replacing the backslashes in the string. You will need to replace each pair of `\` and the following character with the escaped character, like:
```
s.Replace("\\n", "\n");
s.Replace("\\t", "\t");
etc
``` |
357,810 | <p>I am a beginner of python and have a question, very confusing for me.
If I define a function first but within the function I have to use a variable which is defined in another function below, can I do it like this? Or how can I import the return things of another function into a function?
for example:</p>
<pre><cod... | [
{
"answer_id": 357853,
"author": "Jimmy",
"author_id": 4435,
"author_profile": "https://Stackoverflow.com/users/4435",
"pm_score": 2,
"selected": false,
"text": "<p>your example program works, because the two instances of 'good' are different variables (you just happen to have both varia... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44354/"
] | I am a beginner of python and have a question, very confusing for me.
If I define a function first but within the function I have to use a variable which is defined in another function below, can I do it like this? Or how can I import the return things of another function into a function?
for example:
```
def hello(x,... | The scope of functions `hello` and `hi` are entirely different. They do not have any variables in common.
Note that the result of calling `hi(x,y)` is some object. You save that object with the name `good` in the function `hello`.
The variable named `good` in `hello` is a different variable, unrelated to the variable... |
357,814 | <p>It seems that the choice to use string parsing vs. regular expressions comes up on a regular basis for me anytime a situation arises that I need part of a string, information about said string, etc.</p>
<p>The reason that this comes up is that we're evaluating a soap header's action, <strong>after</strong> it has b... | [
{
"answer_id": 357829,
"author": "Joachim Sauer",
"author_id": 40342,
"author_profile": "https://Stackoverflow.com/users/40342",
"pm_score": 3,
"selected": false,
"text": "<p>The regex can be</p>\n\n<ul>\n<li>easier to understand</li>\n<li>express more clearly the intent</li>\n<li>much s... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14409/"
] | It seems that the choice to use string parsing vs. regular expressions comes up on a regular basis for me anytime a situation arises that I need part of a string, information about said string, etc.
The reason that this comes up is that we're evaluating a soap header's action, **after** it has been parsed into somethi... | My main guideline is to use regular expressions for throwaway code, and for user-input validation. Or when I'm trying to find a specific pattern within a big glob of text. For most other purposes, I'll write a grammar and implement a simple parser.
One important guideline (that's really hard to sidestep, though I see ... |
357,822 | <p>This is more an observation than a real question: MS-Access (and VBA in general) is desperately missing a tool where error handling code can be generated automatically, and where the line number can be displayed when an error occurs. Did you find a solution? What is it? I just realized how many hundreds of hours I s... | [
{
"answer_id": 357872,
"author": "DJ.",
"author_id": 10492,
"author_profile": "https://Stackoverflow.com/users/10492",
"pm_score": 3,
"selected": false,
"text": "<p>Well there are a couple of tools that will do what you ask <a href=\"http://www.mztools.com/index.aspx\" rel=\"noreferrer\"... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11436/"
] | This is more an observation than a real question: MS-Access (and VBA in general) is desperately missing a tool where error handling code can be generated automatically, and where the line number can be displayed when an error occurs. Did you find a solution? What is it? I just realized how many hundreds of hours I spar... | My solution is the following:
1. install [MZ-Tools](http://www.mztools.com), a very interesting add-on for VBA. No they did not pay me to write this. Version 3 was free, but since version 8.0, the add-in is commercially sold.
2. program a standard error handler code such as this one (see MZ-Tools menu/Options/Error ha... |
357,824 | <p>I would like to automatically align lines of python variable assignments in vim.</p>
<p>For example I would like to change this:</p>
<pre><code>a = 1
banana = 2
</code></pre>
<p>into this</p>
<pre><code>a = 1
banana = 2
</code></pre>
<p>automatically in vim.</p>
<p>Is there a way to do this?</p>
| [
{
"answer_id": 357836,
"author": "Brian Carper",
"author_id": 23070,
"author_profile": "https://Stackoverflow.com/users/23070",
"pm_score": 1,
"selected": false,
"text": "<p>The <a href=\"http://www.vim.org/scripts/script.php?script_id=294\" rel=\"nofollow noreferrer\">Align</a> plugin d... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3045/"
] | I would like to automatically align lines of python variable assignments in vim.
For example I would like to change this:
```
a = 1
banana = 2
```
into this
```
a = 1
banana = 2
```
automatically in vim.
Is there a way to do this? | You are probably looking for the Align plugin for vim:
<http://www.vim.org/scripts/script.php?script_id=294>
Once installed, you simply select the text you want to align (Shift V) and type:
:Align =
This will align the text based on the = character, so you can use anything you want really. |
357,825 | <p>Have you found such a tool and used it successfully?</p>
| [
{
"answer_id": 358268,
"author": "fenomas",
"author_id": 10651,
"author_profile": "https://Stackoverflow.com/users/10651",
"pm_score": 1,
"selected": false,
"text": "<p>Flex Builder 3 includes a <a href=\"http://labs.adobe.com/wiki/index.php/Flex_3:Feature_Introductions:_Performance_and_... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30741/"
] | Have you found such a tool and used it successfully? | I was also looking for a profiler for AS, but I wanted an freeware/open source solution that works with FlashDevelop and Flex SDK. I found none. So I wrote a simple python script and an even simpler AS class. The script essentially takes any AS file and adds profiling code (i.e. calls to measure the total runtime of th... |
357,851 | <p>My application is receiving email through SMTP server. There are one or more attachments in the email and email attachment return as byte[] (using sun javamail api).</p>
<p>I am trying to zip the attachment files on the fly without writing them to disk first.</p>
<p>What is/are possible way to achieve this outcome... | [
{
"answer_id": 357856,
"author": "Eric",
"author_id": 6367,
"author_profile": "https://Stackoverflow.com/users/6367",
"pm_score": 0,
"selected": false,
"text": "<p>Maybe the <a href=\"http://java.sun.com/j2se/1.3/docs/api/java/util/zip/package-summary.html\" rel=\"nofollow noreferrer\">j... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44534/"
] | My application is receiving email through SMTP server. There are one or more attachments in the email and email attachment return as byte[] (using sun javamail api).
I am trying to zip the attachment files on the fly without writing them to disk first.
What is/are possible way to achieve this outcome? | You can use Java's java.util.zip.ZipOutputStream to create a zip file in memory. For example:
```
public static byte[] zipBytes(String filename, byte[] input) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ZipOutputStream zos = new ZipOutputStream(baos);
ZipEntry entry = new... |
357,860 | <p><img src="https://farm4.static.flickr.com/3199/3099078396_a3c4924c81_o.gif" alt="alt text"></p>
<p>On the left you will notice the google logo rendered by IE, I drew a black line at the top and bottom of the G which extends into the FF windows which rendered the same exact logo yet the FF version renders the image ... | [
{
"answer_id": 357900,
"author": "seanb",
"author_id": 3354,
"author_profile": "https://Stackoverflow.com/users/3354",
"pm_score": 2,
"selected": false,
"text": "<p>Is text rendering any different? Might be that you have zoomed the page in FF (or IE)?</p>\n\n<p>Can try Ctrl-0 to reset zo... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40714/"
] | 
On the left you will notice the google logo rendered by IE, I drew a black line at the top and bottom of the G which extends into the FF windows which rendered the same exact logo yet the FF version renders the image larger. There is NO css ... | I just created a composite image of screenshots of the Google image in IE, Firefox & Chrome and they're all in perfect register (top 2 images at 30% opacity).
I believe it has to be a custom zoom you've got set in one of your browsers. Check IE's zoom at the right of the status bar, for example.
[. Basically, I'm looking for a ... | [
{
"answer_id": 360509,
"author": "wimh",
"author_id": 33499,
"author_profile": "https://Stackoverflow.com/users/33499",
"pm_score": 2,
"selected": false,
"text": "<p>I think there is no \"clean\" way to do this, because a msi project must be able to uninstall itself completely by design.... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26302/"
] | I have an application with several files that contain configuration parameters and other data that changes as the user uses the application. These files can change with newer versions of my software, but the user can also modify them (or they may be changed by the application itself). Basically, I'm looking for a solut... | I think there is no "clean" way to do this, because a msi project must be able to uninstall itself completely by design. I think the best way to solve this, is by using a custom action which executes a batch file and put your configfile update logic in that batch file. The custom action looks like this (only relevant p... |
357,929 | <p>Ought I to unit test constructors? Say I have a constructor like this:</p>
<pre><code>IMapinfoWrapper wrapper;
public SystemInfo(IMapinfoWrapper mapinfoWrapper)
{
this.wrapper = mapinfoWrapper;
}
</code></pre>
<p>Do I need to write a unit test for this construtor? I don't have any getters for the wrapper varia... | [
{
"answer_id": 357940,
"author": "Draemon",
"author_id": 26334,
"author_profile": "https://Stackoverflow.com/users/26334",
"pm_score": 3,
"selected": false,
"text": "<p>No. Its functionality will be tested by every other unit test on the class.</p>\n"
},
{
"answer_id": 357946,
... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6335/"
] | Ought I to unit test constructors? Say I have a constructor like this:
```
IMapinfoWrapper wrapper;
public SystemInfo(IMapinfoWrapper mapinfoWrapper)
{
this.wrapper = mapinfoWrapper;
}
```
Do I need to write a unit test for this construtor? I don't have any getters for the wrapper variable, so I don't need to te... | Unit testing is about testing the public states, behaviors, and interactions of your objects.
If you simply set a private field in your constructor, what is there to test?
Don't bother unit-testing your simple accessors and mutators. That's just silly, and it doesn't help anyone. |
357,939 | <p>I have a domain that will be accessed by a small, private group of people. So I want to control access via authentication.</p>
<p>The domain has a collection of applications installed that each have their own sub-domain. Eg: domain.com, app1.domain.com, app2.domain.com, app3.domain.com</p>
<p>I'd love to have a si... | [
{
"answer_id": 365182,
"author": "innaM",
"author_id": 7498,
"author_profile": "https://Stackoverflow.com/users/7498",
"pm_score": 0,
"selected": false,
"text": "<p>I have no experience with something like this myself. But I just took a look at the <a href=\"http://httpd.apache.org/docs/... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a domain that will be accessed by a small, private group of people. So I want to control access via authentication.
The domain has a collection of applications installed that each have their own sub-domain. Eg: domain.com, app1.domain.com, app2.domain.com, app3.domain.com
I'd love to have a single sign-on solu... | Most browsers do not respect the Digest "domain" directive and will not resend credentials for other URIs. As far as I know, Opera is the only browser that honors it.
For Opera, the server(s) must respond with the same "realm" string for each URI in the domain list. In other words, if domain="/test /example", the serv... |
357,956 | <p>In reading Haskell-related stuff I sometimes come across the expression “tying the knot”, I think I understand <em>what</em> it does, but not <em>how</em>.</p>
<p>So, are there any good, basic, and simple to understand explanations of this concept?</p>
| [
{
"answer_id": 364931,
"author": "Norman Ramsey",
"author_id": 41661,
"author_profile": "https://Stackoverflow.com/users/41661",
"pm_score": 4,
"selected": false,
"text": "<p>It's not quite what you asked for, and it's not directly related to Haskell, but Bruce McAdam's paper <a href=\"h... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34996/"
] | In reading Haskell-related stuff I sometimes come across the expression “tying the knot”, I think I understand *what* it does, but not *how*.
So, are there any good, basic, and simple to understand explanations of this concept? | Tying the knot is a solution to the problem of circular data structures. In imperative languages you construct a circular structure by first creating a non-circular structure, and then going back and fixing up the pointers to add the circularity.
Say you wanted a two-element circular list with the elements "0" and "1"... |
357,963 | <p>I am developing a prototype for a game, and certain gameplay rules are to be defined in an ini file so that the game designers can tweak the game parameters without requiring help from me in addition to a re-compile. This is what I'm doing currently:</p>
<pre><code>std::ifstream stream;
stream.open("rules.ini");
i... | [
{
"answer_id": 357988,
"author": "Brody",
"author_id": 17131,
"author_profile": "https://Stackoverflow.com/users/17131",
"pm_score": 2,
"selected": false,
"text": "<p>Is the scope of your open stream correct.</p>\n\n<p>\"rules.ini\" isn't a full path so it has to be relative so what is i... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37472/"
] | I am developing a prototype for a game, and certain gameplay rules are to be defined in an ini file so that the game designers can tweak the game parameters without requiring help from me in addition to a re-compile. This is what I'm doing currently:
```
std::ifstream stream;
stream.open("rules.ini");
if (!stream.is_... | You are assuming that the **working directory** is the directory that your executable resides in. That is a bad assumption.
Your executable can be run from any working directory, so it's usually a bad idea to hard-code relative paths in your software.
If you want to be able to access files relative to the location of... |
357,968 | <p>I am working on <a href="http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life" rel="nofollow noreferrer">Conway's Game of Life</a> currently and have gotten stuck. My code doesn't work.</p>
<p>When I run my code in GUI, it says:</p>
<pre>
[[0 0 0 0]
[0 1 1 0]
[0 1 0 0]
[0 0 0 0]]
Traceback (most recent call l... | [
{
"answer_id": 357982,
"author": "Jimmy",
"author_id": 4435,
"author_profile": "https://Stackoverflow.com/users/4435",
"pm_score": 2,
"selected": false,
"text": "<p>A cursory glance shows that your <code>number_neighbors</code> indices are off.</p>\n\n<p>Also, you never initialize <code>... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44354/"
] | I am working on [Conway's Game of Life](http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) currently and have gotten stuck. My code doesn't work.
When I run my code in GUI, it says:
```
[[0 0 0 0]
[0 1 1 0]
[0 1 0 0]
[0 0 0 0]]
Traceback (most recent call last):
File "C:\Users\Documents\Physics\Python\MainP... | Well, I guess that you are also quite new to programming *per se*, otherwise you should not have any problems in interpreting that simple error message.
I'll help you dissect it:
* First, all "current" line numbers of your project's files are displayed, in calling order.
* Then, it shows you the function in which the... |
357,969 | <p>I am trying to combine some of my CSS and it is kind of an easy questions but I am kind of having some trouble, i have this code:</p>
<pre><code>h2.post-title, h2.post-title a{
display:block;
background-color:#000;
padding:3px;
color:#ffffff;
text-decoration:none;
text-transform:uppercase;
... | [
{
"answer_id": 357992,
"author": "Eran Galperin",
"author_id": 10585,
"author_profile": "https://Stackoverflow.com/users/10585",
"pm_score": 3,
"selected": true,
"text": "<p>If you remove the h2 font styling, it will revert to its default font size which is pretty big. You could set it u... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to combine some of my CSS and it is kind of an easy questions but I am kind of having some trouble, i have this code:
```
h2.post-title, h2.post-title a{
display:block;
background-color:#000;
padding:3px;
color:#ffffff;
text-decoration:none;
text-transform:uppercase;
font:lighte... | If you remove the h2 font styling, it will revert to its default font size which is pretty big. You could set it up separately:
```
h2.post-title {
font-size:130%;
}
```
But it will take up more space than simply setting both selectors to the same style. My advice — leave it as it is unless you have a good reaso... |
357,997 | <p>In Java you can define a new class inline using anonymous inner classes. This is useful when you need to rewrite only a single method of the class.</p>
<p>Suppose that you want create a subclass of <code>OptionParser</code> that overrides only a single method (for example <code>exit()</code>). In Java you can write... | [
{
"answer_id": 358012,
"author": "Joachim Sauer",
"author_id": 40342,
"author_profile": "https://Stackoverflow.com/users/40342",
"pm_score": 4,
"selected": false,
"text": "<p>Java uses anonymous classes mostly to imitate closures or simply code blocks. Since in Python you can easily pass... | 2008/12/10 | [
"https://Stackoverflow.com/questions/357997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36131/"
] | In Java you can define a new class inline using anonymous inner classes. This is useful when you need to rewrite only a single method of the class.
Suppose that you want create a subclass of `OptionParser` that overrides only a single method (for example `exit()`). In Java you can write something like this:
```
new O... | You can use the [`type(name, bases, dict)`](http://docs.python.org/library/functions.html#type) builtin function to create classes on the fly. For example:
```
op = type("MyOptionParser", (OptionParser,object), {"foo": lambda self: "foo" })
op().foo()
```
Since OptionParser isn't a new-style class, you have to expli... |
358,011 | <p>I have a simple WCF service that I'm exposing using a .svc. The service has some related DataContract classes that are used with the ServiceContracts. When calling a method that gets some data, the json that comes back has all the properties just as you'd expect. </p>
<p>My question is how can I get a new instance ... | [
{
"answer_id": 361781,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>If you browse to ./Service1.svc/js you can see the exact client proxy script that is generated by the server.</p>\n\n<p>At ... | 2008/12/10 | [
"https://Stackoverflow.com/questions/358011",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a simple WCF service that I'm exposing using a .svc. The service has some related DataContract classes that are used with the ServiceContracts. When calling a method that gets some data, the json that comes back has all the properties just as you'd expect.
My question is how can I get a new instance of one of ... | If you browse to ./Service1.svc/js you can see the exact client proxy script that is generated by the server.
At the end of this file you should see lines that register your data contract types as client types - this just makes them available in the client type system and lets you call a well-known constructor, but it... |
358,025 | <p>I need to keep the arrow keys from being able to scroll through my various tabs. Anyone know of a way to do this?</p>
| [
{
"answer_id": 358030,
"author": "Eric",
"author_id": 6367,
"author_profile": "https://Stackoverflow.com/users/6367",
"pm_score": -1,
"selected": true,
"text": "<p>I think you can trap event \"KeyPress\" for that control</p>\n\n<p>then on the handle you have </p>\n\n<pre><code>System::Wi... | 2008/12/10 | [
"https://Stackoverflow.com/questions/358025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19802/"
] | I need to keep the arrow keys from being able to scroll through my various tabs. Anyone know of a way to do this? | I think you can trap event "KeyPress" for that control
then on the handle you have
```
System::Windows::Forms::KeyPressEventArgs^ e
```
You then check
```
if (e->KeyChar == [find the number representing the arrow key])
e->Handled = true; // Meaning that no one will receive it afterwards
``` |
358,039 | <p>What is the meaning, and where is the Ruby documentation for the syntax of: </p>
<pre><code>Array(phrases)
</code></pre>
<p>which I found browsing the Rails source here:</p>
<pre><code># File actionpack/lib/action_view/helpers/text_helper.rb, line 109
...
119: match = Array(phrases).map { |p| Regexp.esc... | [
{
"answer_id": 358078,
"author": "Brian Carper",
"author_id": 23070,
"author_profile": "https://Stackoverflow.com/users/23070",
"pm_score": 5,
"selected": true,
"text": "<p>It's most likely the <code>Kernel#Array</code> method, see <a href=\"http://www.ruby-doc.org/core/classes/Kernel.ht... | 2008/12/10 | [
"https://Stackoverflow.com/questions/358039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37572/"
] | What is the meaning, and where is the Ruby documentation for the syntax of:
```
Array(phrases)
```
which I found browsing the Rails source here:
```
# File actionpack/lib/action_view/helpers/text_helper.rb, line 109
...
119: match = Array(phrases).map { |p| Regexp.escape(p) }.join('|')
```
I thought th... | It's most likely the `Kernel#Array` method, see [here](http://www.ruby-doc.org/core/classes/Kernel.html#M005989). It's slightly different than `Array.new`; it's more of a cast into an array. (It tries `to_ary` and `to_a`.) |
358,048 | <p>I am using a third party application and would like to change one of its files. The file is stored in XML but with an invalid doctype.</p>
<p>When I try to read use a it errors out becuase the doctype contains "file:///ReportWiz.dtd"
(as shown, with quotes) and I get an exception for cannot find file. Is there a wa... | [
{
"answer_id": 358065,
"author": "Bill K",
"author_id": 12943,
"author_profile": "https://Stackoverflow.com/users/12943",
"pm_score": 1,
"selected": false,
"text": "<p>My first thought was dealing with it as a stream. You could make a new adapter at some level and just copy input to out... | 2008/12/10 | [
"https://Stackoverflow.com/questions/358048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/673/"
] | I am using a third party application and would like to change one of its files. The file is stored in XML but with an invalid doctype.
When I try to read use a it errors out becuase the doctype contains "file:///ReportWiz.dtd"
(as shown, with quotes) and I get an exception for cannot find file. Is there a way to tell ... | Tell your DocumentBuilderFactory to ignore the DTD declaration like this:
```
docFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
```
See [here](http://xerces.apache.org/xerces2-j/features.html) for a list of available features.
You also might find JDOM a lot easier to wo... |
358,079 | <p>I came across this code today</p>
<pre><code>AsyncInvoke(OnTimeMessageTimer, (object)null, (ElapsedEventArgs)null);
</code></pre>
<p>Is there anything wrong with it or no?</p>
| [
{
"answer_id": 358081,
"author": "Jimmy",
"author_id": 4435,
"author_profile": "https://Stackoverflow.com/users/4435",
"pm_score": 2,
"selected": false,
"text": "<p>it probably needs the cast to resolve overloads</p>\n"
},
{
"answer_id": 358084,
"author": "Brian Genisio",
... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358079",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36258/"
] | I came across this code today
```
AsyncInvoke(OnTimeMessageTimer, (object)null, (ElapsedEventArgs)null);
```
Is there anything wrong with it or no? | Sometimes, you need to to this when the method is overloaded... to tell the compiler which one you are calling. A null object is still null and it is safe. |
358,091 | <p>I'm still learning ASP.NET and I often see code like this throughout parts of our framework:</p>
<pre><code>Public MustInherit Class DBFileManager(Of F As IDBFile, FC As IDBFileContent, FT As IDBFileThumb)
</code></pre>
<p>Can anybody tell me what this means? Much thanks!</p>
| [
{
"answer_id": 358081,
"author": "Jimmy",
"author_id": 4435,
"author_profile": "https://Stackoverflow.com/users/4435",
"pm_score": 2,
"selected": false,
"text": "<p>it probably needs the cast to resolve overloads</p>\n"
},
{
"answer_id": 358084,
"author": "Brian Genisio",
... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40/"
] | I'm still learning ASP.NET and I often see code like this throughout parts of our framework:
```
Public MustInherit Class DBFileManager(Of F As IDBFile, FC As IDBFileContent, FT As IDBFileThumb)
```
Can anybody tell me what this means? Much thanks! | Sometimes, you need to to this when the method is overloaded... to tell the compiler which one you are calling. A null object is still null and it is safe. |
358,092 | <p>Is the following possible in SQL Server 2000?</p>
<pre><code>CREATE FUNCTION getItemType (@code varchar(18))
RETURNS int
AS
BEGIN
Declare @Type tinyint
Select @Type = case len(@code)
WHEN 12,14,17 THEN 1
WHEN 13,15,18 THEN 2
WHEN 8,10 THEN 3
ELSE 0
END
RETURN (@Type)
END
</code></pre>
<p>Thanks.</p>
| [
{
"answer_id": 358097,
"author": "dkretz",
"author_id": 31641,
"author_profile": "https://Stackoverflow.com/users/31641",
"pm_score": 0,
"selected": false,
"text": "<pre><code> try \n SELECT CASE\n WHEN LEN(@gcode) IN(x, y, z) THEN a \n END\n etc.\n</code></pre>\n\n<... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358092",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23667/"
] | Is the following possible in SQL Server 2000?
```
CREATE FUNCTION getItemType (@code varchar(18))
RETURNS int
AS
BEGIN
Declare @Type tinyint
Select @Type = case len(@code)
WHEN 12,14,17 THEN 1
WHEN 13,15,18 THEN 2
WHEN 8,10 THEN 3
ELSE 0
END
RETURN (@Type)
END
```
Thanks. | try this:
```
Select @Type =
(select case
WHEN len(@code) IN (12,14,17) THEN 1
WHEN len(@code) IN (13,15,18) THEN 2
WHEN len(@code) IN (8,10) THEN 3
ELSE 0
END)
``` |
358,095 | <p>I've installed VisualSVN on my Windows Server 2008. I have several IP addresses on this server, but I want VisualSVN to only bind to one of them. By default it binds to all available addresses. How can I make VisualSVN only handle requests on one IP address?</p>
<p>I tried adding </p>
<pre><code>BindAddress xxx... | [
{
"answer_id": 358145,
"author": "Lance Fisher",
"author_id": 571,
"author_profile": "https://Stackoverflow.com/users/571",
"pm_score": 1,
"selected": false,
"text": "<p>I found an easy way! I just upgraded to VisualSVN 1.6. Then, in the management console, right-click the VisualSVN Se... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/571/"
] | I've installed VisualSVN on my Windows Server 2008. I have several IP addresses on this server, but I want VisualSVN to only bind to one of them. By default it binds to all available addresses. How can I make VisualSVN only handle requests on one IP address?
I tried adding
```
BindAddress xxx.xxx.xxx.xxx
```
to ht... | To clarify, the method for binding VisualSVN to explicitly defined IP addresses is:
1. Load the **VisualSVN Server Manager** MMC snap-in
2. In the left pane, right-click the **VisualSVN Server** item and choose **Properties** from the context menu
3. Click the **Network** tab
4. In the **Server Binding** group, select... |
358,120 | <p>On Internet Explorer, the standard HTML file upload form also allows for direct input of the file name (instead of using the file selector dialog). This makes it possible to enter non-existing files. On other browsers (which do not let you do that) I suppose this case can still occur if you delete the file after hav... | [
{
"answer_id": 358250,
"author": "seanb",
"author_id": 3354,
"author_profile": "https://Stackoverflow.com/users/3354",
"pm_score": 0,
"selected": false,
"text": "<p>Really good question, in .net there is Request.IsClientConnected, but don't know if that will work for you in this case, or... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14955/"
] | On Internet Explorer, the standard HTML file upload form also allows for direct input of the file name (instead of using the file selector dialog). This makes it possible to enter non-existing files. On other browsers (which do not let you do that) I suppose this case can still occur if you delete the file after having... | I think I figured it out.
First of all, it seems to make a difference whether it is just the file that does not exist, or the whole path is incorrect. If only the file is missing, apparently a POST does take place.
At least in the case I mentioned (FCKEditor's image upload dialog on WinXP and IE6), the browser does n... |
358,135 | <p>I haven't been able to find this explicitly stated anywhere yet, but a bunch of examples I've found online follow what I've been doing.</p>
<p>I have a C# class which uses ODP.net to connect to an Oracle DB and run a procedure that's in a package. </p>
<p>My package has stored procedures which take a ref cursor o... | [
{
"answer_id": 358221,
"author": "AJ.",
"author_id": 27457,
"author_profile": "https://Stackoverflow.com/users/27457",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure if you've stumbled onto <a href=\"http://www.oracle.com/technology/oramag/oracle/06-jan/o16odpnet.html\" rel=\... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45194/"
] | I haven't been able to find this explicitly stated anywhere yet, but a bunch of examples I've found online follow what I've been doing.
I have a C# class which uses ODP.net to connect to an Oracle DB and run a procedure that's in a package.
My package has stored procedures which take a ref cursor output parameter. A... | ODP.NET requires you to clean up things. So you:
* have to dispose OracleParameter instances, as they contain unmanaged resources (!) and Odp.net doesn't do this
* have to dispose OracleCommand objects, as they too contain unmanaged resources and closing a connection doesn't close these
* open cursors can't live witho... |
358,136 | <p>What is the most efficient way to remove duplicate items from an array under the constraint that axillary memory usage must be to a minimum, preferably small enough to not even require any heap allocations? Sorting seems like the obvious choice, but this is clearly not asymptotically efficient. Is there a better a... | [
{
"answer_id": 358171,
"author": "Doug Currie",
"author_id": 33252,
"author_profile": "https://Stackoverflow.com/users/33252",
"pm_score": 0,
"selected": false,
"text": "<p>If you sort the array, you will still need another pass to remove duplicates, so the complexity is O(N<em>N) in th... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358136",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23903/"
] | What is the most efficient way to remove duplicate items from an array under the constraint that axillary memory usage must be to a minimum, preferably small enough to not even require any heap allocations? Sorting seems like the obvious choice, but this is clearly not asymptotically efficient. Is there a better algori... | I'll answer my own question since, after posting, I came up with a really clever algorithm to do this. It uses hashing, building something like a hash set in place. It's guaranteed to be O(1) in axillary space (the recursion is a tail call), and is typically O(N) time complexity. The algorithm is as follows:
1. Take t... |
358,147 | <p>I have two computers. Both running WinXP SP2 (I don't really know ho similar they are beyond that). I am running MS Visual C# 2008 express edition on both and that's what I'm currently using to program.</p>
<p>I made an application that loads in an XML file and displays the contents in a DataGridView.</p>
<p>The... | [
{
"answer_id": 358164,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 2,
"selected": false,
"text": "<p>This doesn't have to do with UTF-8 or character encodings - this problem has to do with <a href=\"http://en.wikip... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44004/"
] | I have two computers. Both running WinXP SP2 (I don't really know ho similar they are beyond that). I am running MS Visual C# 2008 express edition on both and that's what I'm currently using to program.
I made an application that loads in an XML file and displays the contents in a DataGridView.
The first line of my x... | I'm not sure of the cause of your problem, but one solution would be to to just strip out the carriage returns from your strings. For every string you add, just call `TrimEnd(null)` on it to remove trailing whitespace:
```
newrow["topic"] = att1.ToString().TrimEnd(null);
```
If your strings might end in other whites... |
358,160 | <p>I've isolated the behaviour into the following test case. I'd be grateful to anyone who can tell me how to expect/verify a property set for a <code>List<T></code> property - it appears there's something going on inside <code>It.Is<T>(predicate)</code> that isn't making a whole lot of sense to me right no... | [
{
"answer_id": 358202,
"author": "Mike Scott",
"author_id": 43649,
"author_profile": "https://Stackoverflow.com/users/43649",
"pm_score": 1,
"selected": false,
"text": "<p>The second parameter of ExpectSet() is the value you're expecting. You can't use <code>It.Is<T></code> in this... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5017/"
] | I've isolated the behaviour into the following test case. I'd be grateful to anyone who can tell me how to expect/verify a property set for a `List<T>` property - it appears there's something going on inside `It.Is<T>(predicate)` that isn't making a whole lot of sense to me right now. Sample code will run as a console ... | I'm not using the very latest version of Moq, so I don't have an overload of ExpectSet that takes two parameters, but I've had some success with this pattern:
```
mockView.ExpectSet(mv => mv.Names).Callback(n => Assert.That(n != null));
```
The Assert (from NUnit) call in the callback will throw an exception if the ... |
358,168 | <p>Ok, I'm doing a bunch of RIA/AJAX stuff and need to create a "pretty", custom confirm box which is a DIV (not the built-in javascript confirm). I'm having trouble determining how to accomplish a pause in execution to give the user a chance to accept or decline the condition before either resuming or halting executio... | [
{
"answer_id": 358182,
"author": "Marc Novakowski",
"author_id": 27020,
"author_profile": "https://Stackoverflow.com/users/27020",
"pm_score": 4,
"selected": true,
"text": "<p>I'm afraid to say that it's not possible to pause the Javascript runtime in the same way that the \"confirm\" an... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Ok, I'm doing a bunch of RIA/AJAX stuff and need to create a "pretty", custom confirm box which is a DIV (not the built-in javascript confirm). I'm having trouble determining how to accomplish a pause in execution to give the user a chance to accept or decline the condition before either resuming or halting execution. ... | I'm afraid to say that it's not possible to pause the Javascript runtime in the same way that the "confirm" and "alert" dialogs pause it. To do it with a DIV you're going to have to break up your code into multiple chunks and have the event handler on the custom confirm box call the next section of code.
There have be... |
358,185 | <p><strong>Background:</strong><br>
I have an old web CMS that stored content in XML files, one XML file per page. I am in the process of importing content from that CMS into a new one, and I know I'm going to need to massage the existing XML in order for the import process to work properly.</p>
<p>Existing XML:</p>
... | [
{
"answer_id": 358182,
"author": "Marc Novakowski",
"author_id": 27020,
"author_profile": "https://Stackoverflow.com/users/27020",
"pm_score": 4,
"selected": true,
"text": "<p>I'm afraid to say that it's not possible to pause the Javascript runtime in the same way that the \"confirm\" an... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2614/"
] | **Background:**
I have an old web CMS that stored content in XML files, one XML file per page. I am in the process of importing content from that CMS into a new one, and I know I'm going to need to massage the existing XML in order for the import process to work properly.
Existing XML:
```
<page>
<audience1>tr... | I'm afraid to say that it's not possible to pause the Javascript runtime in the same way that the "confirm" and "alert" dialogs pause it. To do it with a DIV you're going to have to break up your code into multiple chunks and have the event handler on the custom confirm box call the next section of code.
There have be... |
358,195 | <p>What's the best way to extract the key and value from a string like this:</p>
<pre><code>var myString = 'A1234=B1234';
</code></pre>
<p>I originally had something like this:</p>
<pre><code>myString.split('=');
</code></pre>
<p>And that works fine, BUT an equal (=) sign could be used as a key or value within the ... | [
{
"answer_id": 358201,
"author": "Jimmy",
"author_id": 4435,
"author_profile": "https://Stackoverflow.com/users/4435",
"pm_score": 2,
"selected": false,
"text": "<p>can't help with a one-liner, but I'll suggest the naive way:</p>\n\n<pre><code>var inQuote = false;\nfor(i=0; i<str.leng... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21677/"
] | What's the best way to extract the key and value from a string like this:
```
var myString = 'A1234=B1234';
```
I originally had something like this:
```
myString.split('=');
```
And that works fine, BUT an equal (=) sign could be used as a key or value within the string plus the string could have quotes, like th... | What I've tended to do in config files is ensure that there's **no** possibility that the separator character can get into either the key or value.
Sometimes that's easy if you can just say "no '=' characters allowed" but I've had to resort to encoding those characters in some places.
I generally hex them up so that ... |
358,196 | <p>I'm new to unit testing and I'm trying to figure out if I should start using more of <code>internal</code> access modifier. I know that if we use <code>internal</code> and set the assembly variable <code>InternalsVisibleTo</code>, we can test functions that we don't want to declare public from the testing project. T... | [
{
"answer_id": 358236,
"author": "Steven Behnke",
"author_id": 42588,
"author_profile": "https://Stackoverflow.com/users/42588",
"pm_score": 3,
"selected": false,
"text": "<p>You can use private as well and you can call private methods with reflection. If you're using Visual Studio Team... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1381/"
] | I'm new to unit testing and I'm trying to figure out if I should start using more of `internal` access modifier. I know that if we use `internal` and set the assembly variable `InternalsVisibleTo`, we can test functions that we don't want to declare public from the testing project. This makes me think that I should jus... | Internal classes need to be tested and there is an assembly attribute:
```
using System.Runtime.CompilerServices;
[assembly:InternalsVisibleTo("MyTests")]
```
Add this to the project info file, e.g. `Properties\AssemblyInfo.cs`, for the project under test. In this case "MyTests" is the test project. |
358,207 | <p>What is the best way to get the current system time milliseconds?</p>
| [
{
"answer_id": 358219,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 9,
"selected": true,
"text": "<pre><code>[[NSDate date] timeIntervalSince1970];\n</code></pre>\n\n<p>It returns the number of seconds since epoch as a ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What is the best way to get the current system time milliseconds? | ```
[[NSDate date] timeIntervalSince1970];
```
It returns the number of seconds since epoch as a double. I'm almost sure you can access the milliseconds from the fractional part. |
358,209 | <p>Greetings!</p>
<p>I have a DropDownList within a FormView which are bound to XmlDataSources:</p>
<pre><code><asp:FormView ID="MyFormView" runat="server" DataSourceID="MyXmlDataSource">
<ItemTemplate>
<h1><%# XPath("SomeNode")%></h1>
<asp:Label ID="MyLabel" runat... | [
{
"answer_id": 358588,
"author": "sirrocco",
"author_id": 5246,
"author_profile": "https://Stackoverflow.com/users/5246",
"pm_score": 0,
"selected": false,
"text": "<p>You could try <code>MyFormView.DataBind()</code> after <code>MyXmlDataSource.DataBind();</code></p>\n"
},
{
"ans... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27870/"
] | Greetings!
I have a DropDownList within a FormView which are bound to XmlDataSources:
```
<asp:FormView ID="MyFormView" runat="server" DataSourceID="MyXmlDataSource">
<ItemTemplate>
<h1><%# XPath("SomeNode")%></h1>
<asp:Label ID="MyLabel" runat="server" AssociatedControlID="MyDdl" Text='<%# XPath(... | in order to automatically rebind you must have the ViewState enabled on that control. |
358,220 | <p>Just flicking through one of my favourite books (Ellen Ullman's The Bug) and there is a small bit where one programmer confronts another over three levels of indirection:</p>
<pre><code>***object_array = ***winarray;
</code></pre>
<p>I get the idea of double indirection - a way of passing a pointer into a function... | [
{
"answer_id": 358228,
"author": "shoosh",
"author_id": 9611,
"author_profile": "https://Stackoverflow.com/users/9611",
"pm_score": 3,
"selected": true,
"text": "<p>Sure<br>\n4 dimensional arrays.<br>\nIt doesn't take too much for an application for such an array either. Say some sort of... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41116/"
] | Just flicking through one of my favourite books (Ellen Ullman's The Bug) and there is a small bit where one programmer confronts another over three levels of indirection:
```
***object_array = ***winarray;
```
I get the idea of double indirection - a way of passing a pointer into a function, and allowing it to point... | Sure
4 dimensional arrays.
It doesn't take too much for an application for such an array either. Say some sort of lookup table. I've had lookup tables of 8 and more dimensions. |
358,225 | <p>this is my log output</p>
<pre><code>INFO main digestemails - process inbox
INFO main digestemails - checking for emails in c:\development\DCMail\email\KN-Source
INFO main digestemails - digesting 003d01c95a7b_3446880_0202fea9@xxxx.com.eml
INFO main digestemails - extracting attachments
INFO main digestemails - no ... | [
{
"answer_id": 358247,
"author": "joshperry",
"author_id": 30587,
"author_profile": "https://Stackoverflow.com/users/30587",
"pm_score": 8,
"selected": true,
"text": "<p>Use <code>%d</code> in your PatternLayout.</p>\n\n<p>Also <code>%d</code> can take a format pattern as in <code>%d{dd ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21537/"
] | this is my log output
```
INFO main digestemails - process inbox
INFO main digestemails - checking for emails in c:\development\DCMail\email\KN-Source
INFO main digestemails - digesting 003d01c95a7b_3446880_0202fea9@xxxx.com.eml
INFO main digestemails - extracting attachments
INFO main digestemails - no attachments or... | Use `%d` in your PatternLayout.
Also `%d` can take a format pattern as in `%d{dd MMM yyyy HH:mm:ss,SSS}` you can pick and choose the elements that you want. When the format pattern is omitted the date will be in ISO8601 format. |
358,251 | <p>I have made a C# application and I am trying to figure out if I can tap into build events of cctray (cruise control tray)? I don't want to re-invent the wheel, I just want to know when my builds fail or succeed (on a client machine) so than my custom C# application may execute a specific set of routines.</p>
| [
{
"answer_id": 358585,
"author": "Gishu",
"author_id": 1695,
"author_profile": "https://Stackoverflow.com/users/1695",
"pm_score": -1,
"selected": false,
"text": "<p>Any reason why you can't use your build tool to do that?<br>\ne.g. in <a href=\"http://nant.sourceforge.net/\" rel=\"nofol... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19854/"
] | I have made a C# application and I am trying to figure out if I can tap into build events of cctray (cruise control tray)? I don't want to re-invent the wheel, I just want to know when my builds fail or succeed (on a client machine) so than my custom C# application may execute a specific set of routines. | You could add the CruiseControl remote library as a refrence and create an instance of CruiseManagerFactory and this line will get you the status of all the projects. ServerUri is a string in the format of tcp://ServerName:Port/CruiseManager.rem
```
ProjectStatus[] currentStatuses = managerFactory.GetCruiseManager(Ser... |
358,260 | <p>I'm currently in the process of updating a site from preview 2 of ASP.NET MVC to the Beta release. I'm down to my last compile error with no solution in site after an exhaustive search. I have some code in Global.asax.cs which sets up IOC using the Windsor container:</p>
<pre><code>ControllerBuilder.Current.SetCont... | [
{
"answer_id": 358271,
"author": "Mike Scott",
"author_id": 43649,
"author_profile": "https://Stackoverflow.com/users/43649",
"pm_score": 1,
"selected": false,
"text": "<p>Check that you've updated the appropriate assembly references to 3.5.0.0 in your web.config file, as described in th... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45207/"
] | I'm currently in the process of updating a site from preview 2 of ASP.NET MVC to the Beta release. I'm down to my last compile error with no solution in site after an exhaustive search. I have some code in Global.asax.cs which sets up IOC using the Windsor container:
```
ControllerBuilder.Current.SetControllerFactory(... | PublicKeyToken=null doesn't seem right...
**Edit:** I was right, the PublicKeyToken should be "31bf3856ad364e35". It sounds like they're linked against a private build of System.Web.Mvc.dll that isn't signed. |
358,263 | <p>I have a website where all requests are redirected silently (via <code>.htaccess</code>) to <code>index.php</code> and then PHP is used to show the correct page (by parsing the <code>REQUEST_URI</code>).</p>
<p>I was wondering if it's possible to submit POST data to a fake address too?</p>
<p>I've currently got my... | [
{
"answer_id": 358334,
"author": "Tautologistics",
"author_id": 44481,
"author_profile": "https://Stackoverflow.com/users/44481",
"pm_score": 7,
"selected": true,
"text": "<p>Try this:</p>\n<pre><code># redirect mail posting to index\nRewriteRule send-mail index.php?send-mail [NC,P]\n</c... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31671/"
] | I have a website where all requests are redirected silently (via `.htaccess`) to `index.php` and then PHP is used to show the correct page (by parsing the `REQUEST_URI`).
I was wondering if it's possible to submit POST data to a fake address too?
I've currently got my form like so...
```
<form action="/send-mail" me... | Try this:
```
# redirect mail posting to index
RewriteRule send-mail index.php?send-mail [NC,P]
```
"P" acts like "L" in that it stops processing rules but it also tells the module that the request should be passed off to the proxy module intact (meaning POST data is preserved). |
358,278 | <p>I have a bunch of tables in a sql server database (all with a certain prefix, e.g. ABC_table1), and I want to move ALL tables with this prefix to another database.</p>
<p>Is there a way in which this can be done?</p>
<p>I am using SQL Server 2k5.</p>
<p>Thanks</p>
| [
{
"answer_id": 358330,
"author": "Robert Wagner",
"author_id": 10784,
"author_profile": "https://Stackoverflow.com/users/10784",
"pm_score": 1,
"selected": false,
"text": "<p>Figure out the uid of the ABC schema:</p>\n\n<pre><code>SELECT * from sys.schemas\n</code></pre>\n\n<p>Then subst... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32484/"
] | I have a bunch of tables in a sql server database (all with a certain prefix, e.g. ABC\_table1), and I want to move ALL tables with this prefix to another database.
Is there a way in which this can be done?
I am using SQL Server 2k5.
Thanks | Figure out the uid of the ABC schema:
```
SELECT * from sys.schemas
```
Then substitute the schema\_id for the 5 (uid) in the script below and run it:
```
SELECT
'SELECT * INTO OtherDB.ABC.' + name +
' FROM ABC.' + name
FROM
sysobjects
WHERE
xtype = 'U'
AND uid = 5
```
Then Cut and paste ... |
358,297 | <p>I have the following HTML</p>
<pre><code><div>
<img id="image1"
src="http://valleywag.com/assets/resources/2008/03/BlackGoogleLogo.jpg"
alt="Why doesn't this float correcly?"
style="border-width: 0px; float: left;" />
<div id="divText" style="font-family: Arial, He... | [
{
"answer_id": 358314,
"author": "Matt Mitchell",
"author_id": 364,
"author_profile": "https://Stackoverflow.com/users/364",
"pm_score": 0,
"selected": false,
"text": "<p>The text is wrapping around the image for me in Firefox2. Can you maybe post a screenshot so I understand the proble... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2469/"
] | I have the following HTML
```
<div>
<img id="image1"
src="http://valleywag.com/assets/resources/2008/03/BlackGoogleLogo.jpg"
alt="Why doesn't this float correcly?"
style="border-width: 0px; float: left;" />
<div id="divText" style="font-family: Arial, Helvetica, sans-serif; font-siz... | The text does float around the image for me in IE6 and FireFox2. Is there any CSS that you're leaving out for us to test?
Here is what I see:
[Example 1 http://img214.imageshack.us/img214/6906/ff2topie6bottomhz5.gif](http://img214.imageshack.us/img214/6906/ff2topie6bottomhz5.gif)
The HTML example you provided *is* ... |
358,307 | <p>I am wondering if there is a "best" way to shuffle a list of elements that contains duplicates such that the case where array[i] == array[i+1] is avoided as much as possible.</p>
<p>I am working on a weighted advertising display (I can adjust the number of displays per rotation for any given advertiser) and would l... | [
{
"answer_id": 358322,
"author": "MK_Dev",
"author_id": 39843,
"author_profile": "https://Stackoverflow.com/users/39843",
"pm_score": 0,
"selected": false,
"text": "<p>What's the biggest number of duplicates you may have? 2, 3, any?</p>\n"
},
{
"answer_id": 358323,
"author": ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/364/"
] | I am wondering if there is a "best" way to shuffle a list of elements that contains duplicates such that the case where array[i] == array[i+1] is avoided as much as possible.
I am working on a weighted advertising display (I can adjust the number of displays per rotation for any given advertiser) and would like to avo... | For reference, my (very) naive approach was something like this (actually using LINQ/SQL calls but this is simplified):
```
var advertisers = getAdvertisers();
var returnList = new List();
int totalWeight = sumOfAllAdvertisersWeight();
while (totalWeight > 0)
{
for (int i=0; i<advertisers.Count; i++)
{
... |
358,344 | <p>I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery) on <a href="http://www.learningjquery.com/2008/05/working-with-events-part-2" rel="nofollow noreferrer">Karl Swedberg's blog</a>, and I became totally puzzled at this part of the code (simplified for brevity)... | [
{
"answer_id": 358359,
"author": "Greg Dean",
"author_id": 1200558,
"author_profile": "https://Stackoverflow.com/users/1200558",
"pm_score": 3,
"selected": false,
"text": "<p>As far as i can tell your example will. However your example is not the same as the example on the website you r... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43465/"
] | I was reading the great article about binding and unbinding events (because I am a js beginner using jQuery) on [Karl Swedberg's blog](http://www.learningjquery.com/2008/05/working-with-events-part-2), and I became totally puzzled at this part of the code (simplified for brevity):
```
function addItemUnbind() {
... | Because the call is within an internal function.
E.g. He does some stuff in addItemUnbind() and one of those things is to bind a function to a button click.
This function is then declared e.g. within addItemUnbind() there is:
```
.bind('click', function() {
var $newLi = $('<li class="special">special and new <butt... |
358,345 | <p>I'm having an issue with the following code:</p>
<pre><code> private void DataPortal_Fetch(TaskCriteria criteria)
{
using (var ctx = ContextManager<Gimli.Data.GimliDataContext>
.GetManager(Database.ApplicationConnection, false))
{
this.RaiseListChangedEve... | [
{
"answer_id": 358351,
"author": "BFree",
"author_id": 15861,
"author_profile": "https://Stackoverflow.com/users/15861",
"pm_score": 0,
"selected": false,
"text": "<p>Try changing the code to:</p>\n\n<pre><code>query.Where(row => object.Equals(row.InvoiceId, Guid.Empty))\n</code></pre... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1768/"
] | I'm having an issue with the following code:
```
private void DataPortal_Fetch(TaskCriteria criteria)
{
using (var ctx = ContextManager<Gimli.Data.GimliDataContext>
.GetManager(Database.ApplicationConnection, false))
{
this.RaiseListChangedEvents = false;
... | The following code works ... interestingly enough ... any idea of why?
```
query = query.Where(row => row.InvoiceId == new Guid("00000000-0000-0000-0000-000000000000"));
``` |
358,350 | <p>I have a list, and each item is linked, is there a way I can alternate the background colors for each item?</p>
<pre><code><ul>
<li><a href="link">Link 1</a></li>
<li><a href="link">Link 2</a></li>
<li><a href="link">Link 3</a></... | [
{
"answer_id": 358357,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": -1,
"selected": false,
"text": "<p>You can by hardcoding the sequence, like so:</p>\n\n<pre><code>li, li + li + li, li + li + li + li + li {\n background-... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26130/"
] | I have a list, and each item is linked, is there a way I can alternate the background colors for each item?
```
<ul>
<li><a href="link">Link 1</a></li>
<li><a href="link">Link 2</a></li>
<li><a href="link">Link 3</a></li>
<li><a href="link">Link 4</a></li>
<li><a href="link">Link 5</a></li>
</ul>
... | How about some lovely CSS3?
```
li { background: green; }
li:nth-child(odd) { background: red; }
``` |
358,387 | <p>Basically what the title says...</p>
<p>I need to have an image that when clicked, I call script.php for instance and in that PHP script file, I get the image coordinates where the mouse was clicked.</p>
<p>Is this possible?</p>
<p><strong>EDIT:</strong><br />
After a couple of answers I realized I didn't describ... | [
{
"answer_id": 358393,
"author": "seanb",
"author_id": 3354,
"author_profile": "https://Stackoverflow.com/users/3354",
"pm_score": 2,
"selected": false,
"text": "<p>If you use an input type=\"image\", which works like a button, it will send you x and y coordinates of the mouse click (sub... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40480/"
] | Basically what the title says...
I need to have an image that when clicked, I call script.php for instance and in that PHP script file, I get the image coordinates where the mouse was clicked.
Is this possible?
**EDIT:**
After a couple of answers I realized I didn't describe my problem correctly... The thing is, ... | If you can't:
1. use JavaScript, or
2. use input type="image", or
3. add any attributes to your img tag (to do things like create an image map)
then, no, you won't be able to do what you describe. |
358,389 | <p>I just finished watching the Google clean code video on YouTube (see <a href="http://googletesting.blogspot.com/" rel="nofollow noreferrer">link</a>, first article) about removing <code>if</code> statements from your code and using polymorphism instead. </p>
<p>After watching the video I had a look at some code th... | [
{
"answer_id": 358403,
"author": "Andrew Kennan",
"author_id": 22506,
"author_profile": "https://Stackoverflow.com/users/22506",
"pm_score": 0,
"selected": false,
"text": "<p>I would maybe consider passing off the fetching of the return value to another class that could be injected at ru... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358389",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6335/"
] | I just finished watching the Google clean code video on YouTube (see [link](http://googletesting.blogspot.com/), first article) about removing `if` statements from your code and using polymorphism instead.
After watching the video I had a look at some code that I was writing before watching the video and noticed some... | Just a cautionary note here after seeing some of these (technically correct) reponses, just getting rid of an If statement should not be your sole aim, the aim should be to make your code extensible, maintainable and simple, if that means getting rid of an if statement, great, but it shouldn't be an aim in an of itself... |
358,397 | <p><strong>Is it possible for some Javascript to detect whether Skype is installed or not?</strong></p>
<p>The reason I ask is that I'd like to change a link's href based on that: if Skype isn't installed, show a popup explaining what Skype is and how to install it, if it is installed, change the link to <code>skype:m... | [
{
"answer_id": 358407,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>No, it's not generally possible to detect if skype or any other software is installed from a web page unless the ap... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | **Is it possible for some Javascript to detect whether Skype is installed or not?**
The reason I ask is that I'd like to change a link's href based on that: if Skype isn't installed, show a popup explaining what Skype is and how to install it, if it is installed, change the link to `skype:my.contact.name?call` so the ... | Thanks for the answers everyone: from the links and methods seanb and some posted, I was able to come up with a solution which works for IE and Firefox, so I thought I'd post a 'complete' answer. Here it is as a handy jQuery extension!
The jQuery Extension
--------------------
```
jQuery.extend({
skype : function... |
358,410 | <p>Can anybody let me know the query to find all the tables that has a date columns on it.</p>
<p>Thanks</p>
| [
{
"answer_id": 358424,
"author": "RobS",
"author_id": 18471,
"author_profile": "https://Stackoverflow.com/users/18471",
"pm_score": 4,
"selected": false,
"text": "<p>This uses INFORMATION_SCHEMA on tables in the current database.<br>\nTested in SQL Server 2008.</p>\n\n<pre><code> sele... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can anybody let me know the query to find all the tables that has a date columns on it.
Thanks | This should do the trick, just add in additional types if you need them:
```
select
so.name table_name
,sc.name column_name
,st.name data_type
from sysobjects so
inner join syscolumns sc on (so.id = sc.id)
inner join systypes st on (st.type = sc.type)
where so.type = 'U'
and st.name IN ('DATETIME', 'DATE', '... |
358,430 | <p>I want to implement a simple 2 part FormWizard.
Form 1 will by dynamically generated something like this:</p>
<pre><code>class BuyAppleForm(forms.Form):
creditcard = forms.ChoiceField(widget = forms.RadioSelect)
type = forms.ChoiceField(widget = forms.RadioSelect)
def __init__(self,*args, **kwargs):
... | [
{
"answer_id": 358556,
"author": "Krystian Cybulski",
"author_id": 45226,
"author_profile": "https://Stackoverflow.com/users/45226",
"pm_score": 1,
"selected": true,
"text": "<p>I don't know if answering one's own question is an acceptable behaviour on StackOverflow, here is my solution ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45226/"
] | I want to implement a simple 2 part FormWizard.
Form 1 will by dynamically generated something like this:
```
class BuyAppleForm(forms.Form):
creditcard = forms.ChoiceField(widget = forms.RadioSelect)
type = forms.ChoiceField(widget = forms.RadioSelect)
def __init__(self,*args, **kwargs):
user = kwarg... | I don't know if answering one's own question is an acceptable behaviour on StackOverflow, here is my solution to my own problem.
First, ditch FormWizard.
I have one form.
Two views: `buy_apples` and `buy_apples_confirm`
First view only handles GET. It prints out the unbound form, with an action to go to the URL of t... |
358,443 | <p>I'm trying to get some WPF concepts down, so I've put together a simple example of what I'm trying to do. I would like to set a custom property of a user control, and have it be used by an element within the control.</p>
<p>I've been researching and experimenting, but I'm not fully understanding everything here. An... | [
{
"answer_id": 358458,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 0,
"selected": false,
"text": "<p>You need to create a DependencyProperty in your CircleInSquare class. Do some googling on that. The concept of using... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/641985/"
] | I'm trying to get some WPF concepts down, so I've put together a simple example of what I'm trying to do. I would like to set a custom property of a user control, and have it be used by an element within the control.
I've been researching and experimenting, but I'm not fully understanding everything here. Any help wou... | Sorry to repost, but After re-reading you post, I think that you might be better off with templating. I've attached some samples in VB
Window.xaml
```
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ap... |
358,449 | <p>When using ASP.NET protected configuration, how can I encrypt the config with just the public key?</p>
<p>I can export a public key file. I would like to then use this public key to encrypt the configuration files on another server for later deployment. However, I can't figure out how to get aspnet_regiis to use ... | [
{
"answer_id": 358458,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 0,
"selected": false,
"text": "<p>You need to create a DependencyProperty in your CircleInSquare class. Do some googling on that. The concept of using... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24954/"
] | When using ASP.NET protected configuration, how can I encrypt the config with just the public key?
I can export a public key file. I would like to then use this public key to encrypt the configuration files on another server for later deployment. However, I can't figure out how to get aspnet\_regiis to use the exporte... | Sorry to repost, but After re-reading you post, I think that you might be better off with templating. I've attached some samples in VB
Window.xaml
```
<Window x:Class="Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ap... |
358,462 | <p>It took me forever to reduce the problem to this. I cannot express the amount of frustration I'm experiencing, and if I did, it would not be suitable for any website. Ever. Here is the HTML code that is causing me epic pain:</p>
<pre><code><div style="padding: 5px; background: #EEE">
This text is invis... | [
{
"answer_id": 358467,
"author": "ieure",
"author_id": 45224,
"author_profile": "https://Stackoverflow.com/users/45224",
"pm_score": 3,
"selected": true,
"text": "<p>You’ve been bitten by <a href=\"http://www.positioniseverything.net/explorer/peekaboo.html\" rel=\"nofollow noreferrer\">P... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43005/"
] | It took me forever to reduce the problem to this. I cannot express the amount of frustration I'm experiencing, and if I did, it would not be suitable for any website. Ever. Here is the HTML code that is causing me epic pain:
```
<div style="padding: 5px; background: #EEE">
This text is invisible. Remove either pad... | You’ve been bitten by [Peek-a-boo](http://www.positioniseverything.net/explorer/peekaboo.html).
From that link, your options are:
1. Keep the clearing div from touching the float, or avoid using a background on div#floatholder. Not exactly ideal.
2. Give both div#floatholder and div#float 'position: relative'. Be sur... |
358,471 | <p>I am writing a program that requires the use of XMODEM to transfer data from a sensor device. I'd like to avoid having to write my own XMODEM code, so I was wondering if anyone knew if there was a python XMODEM module available anywhere?</p>
| [
{
"answer_id": 358480,
"author": "ieure",
"author_id": 45224,
"author_profile": "https://Stackoverflow.com/users/45224",
"pm_score": 1,
"selected": false,
"text": "<p>I think you’re stuck with rolling your own.</p>\n\n<p>You might be able to use <a href=\"http://linux.about.com/library/c... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am writing a program that requires the use of XMODEM to transfer data from a sensor device. I'd like to avoid having to write my own XMODEM code, so I was wondering if anyone knew if there was a python XMODEM module available anywhere? | ```
def xmodem_send(serial, file):
t, anim = 0, '|/-\\'
serial.setTimeout(1)
while 1:
if serial.read(1) != NAK:
t = t + 1
print anim[t%len(anim)],'\r',
if t == 60 : return False
else:
break
p = 1
s = file.read(128)
while s:
s = s + '\xFF'*(128 - len(s))
chk = 0
for c... |
358,495 | <p>I have designing the TabMenu Like following</p>
<pre><code><script type="text/javascript">
$(function() {
$('#container-1').tabs();
$('#container-2').tabs();
}
</script>
.....
<div id="container-1">
<ul>
<li><a href="#fragment-1"><span id="start"&g... | [
{
"answer_id": 358508,
"author": "ChadT",
"author_id": 23300,
"author_profile": "https://Stackoverflow.com/users/23300",
"pm_score": 1,
"selected": false,
"text": "<p>Can you clarify what you mean?</p>\n\n<p>If you change this:</p>\n\n<pre><code><li><a href=\"#fragment-1\">&l... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44984/"
] | I have designing the TabMenu Like following
```
<script type="text/javascript">
$(function() {
$('#container-1').tabs();
$('#container-2').tabs();
}
</script>
.....
<div id="container-1">
<ul>
<li><a href="#fragment-1"><span id="start">First</span></a></li>
</ul>
</div>
<div id="contai... | Can you clarify what you mean?
If you change this:
```
<li><a href="#fragment-1"><span id="end">Last</span></a></li>
```
to:
```
<li><a href="#fragment-2"><span id="end">Last</span></a></li>
```
Then it will load #fragment-2 when you click it.
If you actually want to get the data of the clicked tab, then you ca... |
358,501 | <p>I'm trying to add a custom font as a resource in my application.
I have a "CustomFont" directory in the application and all the fonts inside of it are set to "Resource"</p>
<pre><code><Window.Resources>
<Style x:Key="Gotham-XLight">
<Setter Property="TextElement.FontFamily"
... | [
{
"answer_id": 358511,
"author": "joshperry",
"author_id": 30587,
"author_profile": "https://Stackoverflow.com/users/30587",
"pm_score": 3,
"selected": false,
"text": "<p>Try this</p>\n\n<pre><code><Window.Resources>\n <Style x:Key=\"Gotham-XLight\">\n <Setter Pr... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22451/"
] | I'm trying to add a custom font as a resource in my application.
I have a "CustomFont" directory in the application and all the fonts inside of it are set to "Resource"
```
<Window.Resources>
<Style x:Key="Gotham-XLight">
<Setter Property="TextElement.FontFamily"
Value="/CustomFonts;Compon... | You may want to check the name of the font, you need to specify the name of the font not the name of the file.
Double click on the font file and it should show a "Font name:" that's what you want to make sure is specified in your style. |
358,542 | <p>How to find fifth highest salary in a single query in SQL Server</p>
| [
{
"answer_id": 358547,
"author": "Jayden",
"author_id": 44873,
"author_profile": "https://Stackoverflow.com/users/44873",
"pm_score": 5,
"selected": false,
"text": "<p>In SQL Server 2005 & 2008, create a ranked subselect query, then add a where clause where the rank = 5.</p>\n\n<pre>... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45241/"
] | How to find fifth highest salary in a single query in SQL Server | In SQL Server 2005 & 2008, create a ranked subselect query, then add a where clause where the rank = 5.
```
select
*
from
(
Select
SalesOrderID, CustomerID, Row_Number() Over (Order By SalesOrderID) as RunningCount
From
Sales.SalesOrderHeader
Where
SalesOrderID > 10000
Order By
SalesOrderID
... |
358,546 | <p>Sorry, I thought this was an inheritance question: it was an ArrayList question all along!</p>
<p>Ok, my problem is more specific than I thought. So I have two families of classes. Cards, and Zones. Zones are boxes for holding card. </p>
<p>The first two subClasses of Zone, ZoneList and ZoneMap are meant to be two... | [
{
"answer_id": 358579,
"author": "Scanningcrew",
"author_id": 45219,
"author_profile": "https://Stackoverflow.com/users/45219",
"pm_score": 1,
"selected": false,
"text": "<p>This is going to depend on what the access control is on the Arraylist in <code>Zonelist</code>. My assumption fro... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29182/"
] | Sorry, I thought this was an inheritance question: it was an ArrayList question all along!
Ok, my problem is more specific than I thought. So I have two families of classes. Cards, and Zones. Zones are boxes for holding card.
The first two subClasses of Zone, ZoneList and ZoneMap are meant to be two different ways o... | If I understand you correctly, you should probably declare:
```
public class ZoneList<T extends Card> {
protected List<T> cardBox;
}
public class PokerHand extends ZoneList<PokerCard> {
public PokerHand() {
cardBox = new ArrayList<PokerCard>();
}
}
``` |
358,557 | <p>Let's say I have 3 point clouds: first that has 3 points {x1,y1,z1}, {x2,y2,z2}, {x3,y3,z3} and second point cloud that has same points as {xx1, yy1, zz1}, {xx2,yy2,zz2}, {xx3,yy3,zz3}... I assume to align second point cloud to first I have to multiply second one's points by T[3x3matrix]. </p>
<p>1) So how do I fin... | [
{
"answer_id": 358570,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 3,
"selected": true,
"text": "<p>The transformation matrix T1 that takes the unit vectors {1, 0, 0}, {0, 1, 0}, and {0, 0, 1} to {x1, y1, z1}, {x2,... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358557",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37141/"
] | Let's say I have 3 point clouds: first that has 3 points {x1,y1,z1}, {x2,y2,z2}, {x3,y3,z3} and second point cloud that has same points as {xx1, yy1, zz1}, {xx2,yy2,zz2}, {xx3,yy3,zz3}... I assume to align second point cloud to first I have to multiply second one's points by T[3x3matrix].
1) So how do I find this tra... | The transformation matrix T1 that takes the unit vectors {1, 0, 0}, {0, 1, 0}, and {0, 0, 1} to {x1, y1, z1}, {x2, y2, z2}, {x3, y3, z3} is simply
```
| x1 x2 x3 |
T1 = | y1 y2 y3 |
| z1 z2 z3 |
```
And likewise the transformation T2 that takes those 3 unit vectors to the second set of points is
```
... |
358,591 | <p>Let's say I have two tables: </p>
<ul>
<li>Report</li>
<li>Comment</li>
</ul>
<p>And assuming I have a database context:</p>
<pre><code>var reports = db.Reports();
</code></pre>
<p>How can I make sure all Comments for each report are loaded as well?</p>
<p>At this point I want to disconnect from the database bu... | [
{
"answer_id": 358631,
"author": "Dave",
"author_id": 22018,
"author_profile": "https://Stackoverflow.com/users/22018",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not aware of a \"startup Project\" settting in VB6, but you can select the \"Startup Object\" by opening the Project m... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28149/"
] | Let's say I have two tables:
* Report
* Comment
And assuming I have a database context:
```
var reports = db.Reports();
```
How can I make sure all Comments for each report are loaded as well?
At this point I want to disconnect from the database but still
have access to the comments. (For example:)
```
reports[... | Dave and OneDayWhen are correct in saying that you need to right click the desired project in the IDE and select Set as Start Up when you have multiple projects loaded and you want to choose which one is executed.
>
> Anyone know how I can set the VB6 IDE
> to load either the last project loaded
> or change the def... |
358,601 | <p>There are 2 radiobutton and a hyperlink.
if select 'radiobutton1' the hyperlink is enabled.
if select 'radiobutton2' the hyperlink is disabled.
i can use jquery to disable the hyperlink, but can't enable it.
How to enable the hyperlink with jquery?</p>
| [
{
"answer_id": 358665,
"author": "seanb",
"author_id": 3354,
"author_profile": "https://Stackoverflow.com/users/3354",
"pm_score": 2,
"selected": false,
"text": "<p>You could try adding a click event handler and return true or false from the click handler based on the state of the radio ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | There are 2 radiobutton and a hyperlink.
if select 'radiobutton1' the hyperlink is enabled.
if select 'radiobutton2' the hyperlink is disabled.
i can use jquery to disable the hyperlink, but can't enable it.
How to enable the hyperlink with jquery? | You could try adding a click event handler and return true or false from the click handler based on the state of the radio buttons.
Returning false should cancel the click on the link, something like:
```
$("#hyperlink1").click(function(){
// return true or false based on your radio button... |
358,609 | <p>I am developing a Tool in vb.net and need find out Activex Controls from MS Access DB forms. I am able to conut number of controls in form, but unable to get the Activex Controls only from the form. Can any one have any idea how to achieve this, please suggest. </p>
| [
{
"answer_id": 359240,
"author": "Gary Kindel",
"author_id": 44597,
"author_profile": "https://Stackoverflow.com/users/44597",
"pm_score": 0,
"selected": false,
"text": "<p>I am not sure what your are wanting is possible.<br>\nTry this: go into MS access and create new property that is t... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45255/"
] | I am developing a Tool in vb.net and need find out Activex Controls from MS Access DB forms. I am able to conut number of controls in form, but unable to get the Activex Controls only from the form. Can any one have any idea how to achieve this, please suggest. | Can you access the controltype property? If so, I cannot help with vb.net, but here is some VBA that may help.
```
ActiveXCount = 0
For Each ctl In Screen.ActiveForm
If ctl.ControlType = 119 Then 'Custom control'
'Debug.Print ctl.Class'
ActiveXCount = ActiveXCount + 1
End If
Next
``` |
358,617 | <p>How can I create a file dsn for connecting to an AS400 system using the iSeries ODBC driver?</p>
<p>The iSeries ODBC driver allows many settings to be configured. Where can I find a list of all properties that can be set in the file DSN?</p>
| [
{
"answer_id": 358628,
"author": "Gustavo Rubio",
"author_id": 14533,
"author_profile": "https://Stackoverflow.com/users/14533",
"pm_score": 2,
"selected": false,
"text": "<p><em>Driver={iSeries Access ODBC Driver};System=server;Uid=user;Pwd=password;</em></p>\n\n<p>Where server is the s... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I create a file dsn for connecting to an AS400 system using the iSeries ODBC driver?
The iSeries ODBC driver allows many settings to be configured. Where can I find a list of all properties that can be set in the file DSN? | *Driver={iSeries Access ODBC Driver};System=server;Uid=user;Pwd=password;*
Where server is the system to connect (either IP address or hostname), username and password.
You can have a .dsn file like this:
```
[ODBC]
DRIVER=iSeries Access ODBC Driver
System=server;
Uid=user;
Pwd=password;
Initial Catalog=library;
``... |
358,654 | <p>I need to specify path to dlls referenced by assembly in .config file.
Problem is that path can be found in env. variable.
Is it possible to use some sort of %DLLPATH% macro in .config file?</p>
| [
{
"answer_id": 358673,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>Is this a configuration entry that <em>you're</em> reading, or is .NET reading it? If you're reading it yourself, you... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35425/"
] | I need to specify path to dlls referenced by assembly in .config file.
Problem is that path can be found in env. variable.
Is it possible to use some sort of %DLLPATH% macro in .config file? | Yes, that's possible! Suppose you have something like that in your config:
```
<configuration>
<appSettings>
<add key="mypath" value="%DLLPATH%\foo\bar"/>
</appSettings>
</configuration>
```
Then you can easily get the path with:
```
var pathFromConfig = ConfigurationManager.AppSettings["mypath"];
var expan... |
358,663 | <p>this question can create a misunderstanding: I know I have to use CSS to validate successfully my document as XHTML 1.0 Transitional. The fact is that I have to embed in my webpage a picture composed by zeros and ones created with <a href="http://www.text-image.com/index.html" rel="noreferrer" title="text image">tex... | [
{
"answer_id": 358667,
"author": "Ryan Doherty",
"author_id": 956,
"author_profile": "https://Stackoverflow.com/users/956",
"pm_score": 6,
"selected": true,
"text": "<p>You could replace</p>\n\n<p><code><font color=\"#000000\">0001100000101101100011</font></code></p>\n\n<p>wi... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41977/"
] | this question can create a misunderstanding: I know I have to use CSS to validate successfully my document as XHTML 1.0 Transitional. The fact is that I have to embed in my webpage a picture composed by zeros and ones created with [text image](http://www.text-image.com/index.html "text image"), and the problem is that ... | You could replace
`<font color="#000000">0001100000101101100011</font>`
with
`<span style="color:#000000">0001100000101101100011</span>`
etc...
\*Edit: I know this is CSS, but it doesn't involve a separate stylesheet like the question states, which may be ok. |
358,681 | <p>I'm trying to generate my models from a schema.xml file on OSX 10.5 with the latest versions of PHP & Propel 1.3 & Phing. All the model classes actually get created, then it just dies, right at the last step. I have already tried </p>
<blockquote>
<p>chmod -R 777 ./application/config</p>
</blockquote>
<p... | [
{
"answer_id": 360603,
"author": "lo_fye",
"author_id": 3407,
"author_profile": "https://Stackoverflow.com/users/3407",
"pm_score": 2,
"selected": true,
"text": "<p>I don't know how this happened, but my runtime-conf.xml file had a bad line in it:</p>\n\n<pre><code><datasource id=\"mo... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3407/"
] | I'm trying to generate my models from a schema.xml file on OSX 10.5 with the latest versions of PHP & Propel 1.3 & Phing. All the model classes actually get created, then it just dies, right at the last step. I have already tried
>
> chmod -R 777 ./application/config
>
>
>
but that didn't help. I have also tried... | I don't know how this happened, but my runtime-conf.xml file had a bad line in it:
```
<datasource id="models"> <!-- this ID must match <database name=""> in schema.xml -->
```
See how it says those things *must* match? Mine didn't. I must have hit a key when I wasn't paying attention, an accidentally edited it. Mat... |
358,687 | <p>I currently have a database that is 20GB in size.
I've run a few scripts which show on each tables size (and other incredibly useful information such as index stuff) and the biggest table is 1.1 million records which takes up 150MB of data. We have less than 50 tables most of which take up less than 1MB of data.</p>... | [
{
"answer_id": 358692,
"author": "Frans Bouma",
"author_id": 44991,
"author_profile": "https://Stackoverflow.com/users/44991",
"pm_score": 0,
"selected": false,
"text": "<p>Did you try the dbcc command to shrink the catalog? If you transfer all data to an empty catalog, is it also 20GB?<... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18217/"
] | I currently have a database that is 20GB in size.
I've run a few scripts which show on each tables size (and other incredibly useful information such as index stuff) and the biggest table is 1.1 million records which takes up 150MB of data. We have less than 50 tables most of which take up less than 1MB of data.
After... | Try this query:
```
SELECT object_name(object_id) AS name, rows, total_pages,
total_pages * 8192 / 1024 as [Size(Kb)]
FROM sys.partitions p
INNER JOIN sys.allocation_units a
ON p.partition_id = a.container_id
``` |
358,700 | <p>I have 3 projects in my VS solution. One of them is a Web app, the second one is a Windows Service and the last one a Setup project for my Web app. </p>
<p>What I want is by the end of the installation of the web app in my setup project, within my custom action to try and install my windows service given that I hav... | [
{
"answer_id": 358704,
"author": "lakshmanaraj",
"author_id": 44541,
"author_profile": "https://Stackoverflow.com/users/44541",
"pm_score": 5,
"selected": false,
"text": "<p>Please have a look at <a href=\"http://www.c-sharpcorner.com/UploadFile/sachin.nigam/InstallingWinServiceProgramma... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17443/"
] | I have 3 projects in my VS solution. One of them is a Web app, the second one is a Windows Service and the last one a Setup project for my Web app.
What I want is by the end of the installation of the web app in my setup project, within my custom action to try and install my windows service given that I have the loca... | Ok, here is what REALLY worked for me, it has been tested on multiple machines with different OS ( Vista, XP, Win2k, Win2003 server )
The code has been taken from [here](http://www.tech-archive.net/Archive/VB/microsoft.public.vb.winapi/2006-08/msg00238.html) so full credit goes to whoever wrote this piece of code.
On... |
358,712 | <p>I have a HttpModule with a filter (PageFilter) where the Writer method of PageFilter is called twice for every page request, unfortunately not with the same result.</p>
<p>The idea of the filter is to locate "" and insert some text/script in front of this. I have located a bunch of minor errors (and corrected them)... | [
{
"answer_id": 358988,
"author": "rajesh pillai",
"author_id": 34644,
"author_profile": "https://Stackoverflow.com/users/34644",
"pm_score": 2,
"selected": true,
"text": "<p>The Write method may be called multiple times for a single page. The HttpWriter object chunks together data and th... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42108/"
] | I have a HttpModule with a filter (PageFilter) where the Writer method of PageFilter is called twice for every page request, unfortunately not with the same result.
The idea of the filter is to locate "" and insert some text/script in front of this. I have located a bunch of minor errors (and corrected them), but this... | The Write method may be called multiple times for a single page. The HttpWriter object chunks together data and then writes it to its output stream. Each time the HttpWriter sends out a chunk of data your response filter's Write method is invoked.
Refer this for one kind of solution...
1. [HttpResponse.Filter write ... |
358,718 | <p>I have a fairly expensive array calculation (SpectralResponse) which I like to keep to a minimum. I figured the best way is to store them and bring it back up when same array is needed again in the future. The decision is made using BasicParameters.</p>
<p>So right now, I use a LinkedList of object for the arrays o... | [
{
"answer_id": 358726,
"author": "refrus",
"author_id": 37267,
"author_profile": "https://Stackoverflow.com/users/37267",
"pm_score": 3,
"selected": true,
"text": "<p>You are accessing a LinkedList by index, this is the worst possible way to access it ;)</p>\n\n<p>You should use ArrayLis... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9774/"
] | I have a fairly expensive array calculation (SpectralResponse) which I like to keep to a minimum. I figured the best way is to store them and bring it back up when same array is needed again in the future. The decision is made using BasicParameters.
So right now, I use a LinkedList of object for the arrays of Spectral... | You are accessing a LinkedList by index, this is the worst possible way to access it ;)
You should use ArrayList instead, or use iterators for all your lists.
Possibly you should merge the three objects into one, and keep them in a map with responseNum as key.
Hope this helps! |
358,764 | <p>I need to exclude files with the following pattern:</p>
<p>ProjectFoo.Data[0-9]{14}.lgp</p>
<p>How can I use RegEx for (Visual)SVN ignore list?</p>
| [
{
"answer_id": 358892,
"author": "Frans Bouma",
"author_id": 44991,
"author_profile": "https://Stackoverflow.com/users/44991",
"pm_score": 2,
"selected": false,
"text": "<p>As the file looks like an LLBLGen Pro project backup file, you can force llblgen pro to store backup files into a s... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2104/"
] | I need to exclude files with the following pattern:
ProjectFoo.Data[0-9]{14}.lgp
How can I use RegEx for (Visual)SVN ignore list? | The subversion ignore list doesn't support regular expressions. They are implemented as glob/file patterns.
These patterns don't support the {14} repeat construct.
The pattern
```
ProjectFoo.Data[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9].lgp
```
should do what you ask, but I would recom... |
358,772 | <p>With Symfony's Action Security if a user has not been identified he will be forwarded to the default login action as defined in the applications settings.yml file. How would I forward the user to the originally requested action after the user is successfully authenticated?</p>
| [
{
"answer_id": 364228,
"author": "deresh",
"author_id": 11851,
"author_profile": "https://Stackoverflow.com/users/11851",
"pm_score": 4,
"selected": true,
"text": "<p>On first hit to your login action, store referer to the user session:</p>\n\n<pre><code>if(!$this->getUser()->hasPa... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/200521/"
] | With Symfony's Action Security if a user has not been identified he will be forwarded to the default login action as defined in the applications settings.yml file. How would I forward the user to the originally requested action after the user is successfully authenticated? | On first hit to your login action, store referer to the user session:
```
if(!$this->getUser()->hasParameter('referer'))
{
$this->getUser()->setParameter('referer',$this->getRequest()->getReferer());
}
```
and then when login succeeds, redirect user to stored referer with:
```
$this->redirect($this->getUser()->ge... |
358,780 | <p>I have a method, which will accept a parameter of a JQuery Object and will calculate totals for a section. So if you give it a JQuery Object of a div containing the section it will calculate a total for it</p>
<p>so you can do this:</p>
<p>var $totalcompletion = CalculateSectionCompletion(jQuery("#Section1"));</p>... | [
{
"answer_id": 358806,
"author": "Strelok",
"author_id": 2788,
"author_profile": "https://Stackoverflow.com/users/2788",
"pm_score": 3,
"selected": true,
"text": "<p>You can wrap any DOM element in $(..), as you do with $(document).</p>\n\n<p>So I think you should be able to </p>\n\n<pre... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45279/"
] | I have a method, which will accept a parameter of a JQuery Object and will calculate totals for a section. So if you give it a JQuery Object of a div containing the section it will calculate a total for it
so you can do this:
var $totalcompletion = CalculateSectionCompletion(jQuery("#Section1"));
Now I have multiple... | You can wrap any DOM element in $(..), as you do with $(document).
So I think you should be able to
```
jQuery("div.SectionContainer").each( function(i, valueOfElement){
CalculateSectionCompletion($(valueOfElement));
});
``` |
358,783 | <p>I have a script which uses pexpect to start a CLI program. It works a bit like a shell where you get a prompt where you can enter some commands.</p>
<p>The problem I have, I think, is that this program uses a coloured prompt.</p>
<p>This is what I do </p>
<pre><code>import pprint
import pexpect
1 a = pexpect.spa... | [
{
"answer_id": 358794,
"author": "csl",
"author_id": 21028,
"author_profile": "https://Stackoverflow.com/users/21028",
"pm_score": 2,
"selected": false,
"text": "<p>Couldn't find anything in <a href=\"http://pexpect.sourceforge.net/pexpect.html\" rel=\"nofollow noreferrer\">the pexpect d... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12126/"
] | I have a script which uses pexpect to start a CLI program. It works a bit like a shell where you get a prompt where you can enter some commands.
The problem I have, I think, is that this program uses a coloured prompt.
This is what I do
```
import pprint
import pexpect
1 a = pexpect.spawn('program')
2 a.expect("pr... | Ok, I found the answer. csl's answer set me on the right path.
pexpect has a "env" option which I thought I could use. like this:
```
a = pexpect.spawn('program', env = {"TERM": "dumb"})
```
But this spawns a new shell which does not work for me, our development environment
depends on a lot of environmental variab... |
358,788 | <p>I've problem with sending HTML mails with <a href="http://phpmailer.worxware.com/index.php?pg=phpmailer" rel="nofollow noreferrer">PHPMailer</a>. I make a <a href="http://en.wikipedia.org/wiki/Smarty" rel="nofollow noreferrer">Smarty</a> template and I got all the HTML code from it. But when I send mail, I got the m... | [
{
"answer_id": 358801,
"author": "annakata",
"author_id": 13018,
"author_profile": "https://Stackoverflow.com/users/13018",
"pm_score": 1,
"selected": false,
"text": "<p>HTML and CSS is fraught with pain and frustration. Nothing to do with PHP, it's apparent that most implementations <em... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461736/"
] | I've problem with sending HTML mails with [PHPMailer](http://phpmailer.worxware.com/index.php?pg=phpmailer). I make a [Smarty](http://en.wikipedia.org/wiki/Smarty) template and I got all the HTML code from it. But when I send mail, I got the mail without included CSS (it's only background-color, font or something like ... | There's is a way...
```
$body = <<< YOUR_HTML_WITH_CSS_STYLE_TAGS
<html>
<head>
<style>
body * {width:1px;}
#adiv {padding:2px;}
.aclass {margin:3px;}
</style>
</head>
<body>
<div>
some html
</div>
<div id="adiv">
<p class="aclass">
</p>
</div... |
358,791 | <pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<link href="Stylesheet.css" rel="stylesheet" type... | [
{
"answer_id": 358811,
"author": "adam",
"author_id": 33604,
"author_profile": "https://Stackoverflow.com/users/33604",
"pm_score": 1,
"selected": false,
"text": "<p>Please clarify the browser you are trying to fix this in.</p>\n\n<p>You should be using <code><div></code>'s anyway ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<link href="Stylesheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table... | Please clarify the browser you are trying to fix this in.
You should be using `<div>`'s anyway if you want to do things properly ;) |
358,793 | <p>I am looking for a specific desgin pattern.</p>
<p>For example i have an article class, clsArticle. This class contains member variables like Id, title, author, article, and so on. Imagine i want to show all the articles in a list. So somewhere i have to create a method getAllArticles(). Since clsArticle is not res... | [
{
"answer_id": 358817,
"author": "OscarRyz",
"author_id": 20654,
"author_profile": "https://Stackoverflow.com/users/20654",
"pm_score": 3,
"selected": true,
"text": "<p>Yeap. That's correct. </p>\n\n<p>It may be either an AbstractFactory or a DataAccessObject.</p>\n\n<p>The first is when... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40676/"
] | I am looking for a specific desgin pattern.
For example i have an article class, clsArticle. This class contains member variables like Id, title, author, article, and so on. Imagine i want to show all the articles in a list. So somewhere i have to create a method getAllArticles(). Since clsArticle is not responsible f... | Yeap. That's correct.
It may be either an AbstractFactory or a DataAccessObject.
The first is when you want to let the implementation return different kinds of articles
For instance let's say you have a condition where the articles behave different according with the platform.
```
ArticleFactory.getAll(): Article[... |
358,802 | <p>In our project I have several <a href="http://www.junit.org/" rel="noreferrer">JUnit</a> tests that e.g. take every file from a directory and run a test on it. If I implement a <code>testEveryFileInDirectory</code> method in the <code>TestCase</code> this shows up as only one test that may fail or succeed. But I am ... | [
{
"answer_id": 358884,
"author": "Michael Borgwardt",
"author_id": 16883,
"author_profile": "https://Stackoverflow.com/users/16883",
"pm_score": 2,
"selected": false,
"text": "<p>Should be possible in JUnit 3 by inheriting from <code>TestSuite</code> and overriding the <code>tests()</cod... | 2008/12/11 | [
"https://Stackoverflow.com/questions/358802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21499/"
] | In our project I have several [JUnit](http://www.junit.org/) tests that e.g. take every file from a directory and run a test on it. If I implement a `testEveryFileInDirectory` method in the `TestCase` this shows up as only one test that may fail or succeed. But I am interested in the results on each individual file. Ho... | Take a look at **Parameterized Tests** in JUnit 4.
Actually I did this a few days ago. I'll try to explain ...
First build your test class normally, as you where just testing with one input file.
Decorate your class with:
```
@RunWith(Parameterized.class)
```
Build one constructor that takes the input that will ch... |