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 |
|---|---|---|---|---|---|---|
194,465 | <p>What's the C++ way of parsing a string (given as char *) into an int? Robust and clear error handling is a plus (instead of <a href="http://en.cppreference.com/w/cpp/string/byte/atoi" rel="noreferrer">returning zero</a>).</p>
| [
{
"answer_id": 194471,
"author": "Chris Arguin",
"author_id": 25704,
"author_profile": "https://Stackoverflow.com/users/25704",
"pm_score": 5,
"selected": false,
"text": "<p>The good 'old C way still works. I recommend strtol or strtoul. Between the return status and the 'endPtr', you ca... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3827/"
] | What's the C++ way of parsing a string (given as char \*) into an int? Robust and clear error handling is a plus (instead of [returning zero](http://en.cppreference.com/w/cpp/string/byte/atoi)). | In the new C++11 there are functions for that: stoi, stol, stoll, stoul and so on.
```
int myNr = std::stoi(myString);
```
It will throw an exception on conversion error.
Even these new functions still have the **same issue** as noted by Dan: they will happily convert the string "11x" to integer "11".
See more: <h... |
194,484 | <p>I collect a few corner cases and <a href="http://www.yoda.arachsys.com/csharp/teasers.html" rel="nofollow noreferrer">brain teasers</a> and would always like to hear more. The page only really covers C# language bits and bobs, but I also find core .NET things interesting too. For example, here's one which isn't on t... | [
{
"answer_id": 194671,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 10,
"selected": true,
"text": "<p>I think I showed you this one before, but I like the fun here - this took some debugging to track down! (the origi... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22656/"
] | I collect a few corner cases and [brain teasers](http://www.yoda.arachsys.com/csharp/teasers.html) and would always like to hear more. The page only really covers C# language bits and bobs, but I also find core .NET things interesting too. For example, here's one which isn't on the page, but which I find incredible:
`... | I think I showed you this one before, but I like the fun here - this took some debugging to track down! (the original code was obviously more complex and subtle...)
```
static void Foo<T>() where T : new()
{
T t = new T();
Console.WriteLine(t.ToString()); // works fine
Console.WriteLine... |
194,492 | <p>In visual C++, I can do things like this:</p>
<pre><code>template <class T>
class A{
protected:
T i;
};
template <class T>
class B : public A<T>{
T geti() {return i;}
};
</code></pre>
<p>If I try to compile this in g++, I get an error. I have to do this:</p>
<pre><code>template <cla... | [
{
"answer_id": 194640,
"author": "Brian R. Bondy",
"author_id": 3153,
"author_profile": "https://Stackoverflow.com/users/3153",
"pm_score": 4,
"selected": true,
"text": "<p>This used to be allowed, but changed in <a href=\"http://gcc.gnu.org/gcc-3.4/changes.html#cplusplus\" rel=\"norefer... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] | In visual C++, I can do things like this:
```
template <class T>
class A{
protected:
T i;
};
template <class T>
class B : public A<T>{
T geti() {return i;}
};
```
If I try to compile this in g++, I get an error. I have to do this:
```
template <class T>
class B : public A<T>{
T geti() {return A<T>::i;}... | This used to be allowed, but changed in [gcc 3.4](http://gcc.gnu.org/gcc-3.4/changes.html#cplusplus).
In a template definition, unqualified names will no longer find members of a dependent base (as specified by [temp.dep]/3 in the C++ standard). For example,
```
template <typename T> struct B {
int m;
... |
194,526 | <p>I recently turned on Windows Firewall logging on my computer and started tracking incoming and outgoing connections. Something curious about the logfiles is that I have noticed numerous UDP packets (in fact, it constitutes basically all of my incoming traffic) that don't have my host as destination or source showing... | [
{
"answer_id": 194535,
"author": "Nick",
"author_id": 26240,
"author_profile": "https://Stackoverflow.com/users/26240",
"pm_score": -1,
"selected": false,
"text": "<p>Hard to say without analyzing the log data, but they could be broadcast packets on the segment, in which case you're syst... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23845/"
] | I recently turned on Windows Firewall logging on my computer and started tracking incoming and outgoing connections. Something curious about the logfiles is that I have noticed numerous UDP packets (in fact, it constitutes basically all of my incoming traffic) that don't have my host as destination or source showing up... | The packets addressed to IPs starting with 239 and 224 are [multicast packets](http://en.wikipedia.org/wiki/Multicast). This is a way to address traffic to a group of computers without broadcasting it to an entire network. It is used by various legitimate protocols.
224.0.0.252 is the address used by the [Link Local N... |
194,528 | <p>I have a ASP.Net page using ADO to query MS access database and as a learning exercise i would like to incorporate LINQ. I have one simple table called Quotes.</p>
<p>The fields are: QuoteID, QuoteDescription, QuoteAuthor, QuoteDate. I would like to run simple queries like, "Give me all quotes after 1995". </p>
... | [
{
"answer_id": 194533,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>I don't <em>think</em> LINQ to SQL supports Access. However, if your table is sufficiently small to fit into memory, ... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | I have a ASP.Net page using ADO to query MS access database and as a learning exercise i would like to incorporate LINQ. I have one simple table called Quotes.
The fields are: QuoteID, QuoteDescription, QuoteAuthor, QuoteDate. I would like to run simple queries like, "Give me all quotes after 1995".
How would i inco... | LINQ to SQL doesn't support Access (that is, there's no Access/Jet provider for LINQ), but you can query a DataSet with LINQ. This means that you fill your DataSet with any possible data from your database that you might need in your results, and then you filter on the client side. After you have a typed DataSet, and y... |
194,534 | <p>I have been looking at various dependency injection frameworks for .NET as I feel the project I am working on would greatly benefit from it. While I think I have a good grasp of the <em>capabilities</em> of these frameworks, I am still a little unclear on how best to introduce them into a large system. Most demos (u... | [
{
"answer_id": 195411,
"author": "Peter Mounce",
"author_id": 20971,
"author_profile": "https://Stackoverflow.com/users/20971",
"pm_score": 2,
"selected": false,
"text": "<p><strong>First:</strong></p>\n\n<p>You might approach it by creating a container to hold your \"uninteresting\" dep... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7532/"
] | I have been looking at various dependency injection frameworks for .NET as I feel the project I am working on would greatly benefit from it. While I think I have a good grasp of the *capabilities* of these frameworks, I am still a little unclear on how best to introduce them into a large system. Most demos (understanda... | **First:** Add the simple dependencies to your constructor as needed. There is no need to add every type to every constructor, just add the ones you need. Need another one, just expand the constructor. Performance should not be a big thing as most of these types are likely to be singletons so already created after the ... |
194,565 | <p>I have to implement the VinPower application. They offer a Java version, a C dll and an ActiveX dll, if anyone has an idea on where I could begin, I'd appreciate it.</p>
| [
{
"answer_id": 194580,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 0,
"selected": false,
"text": "<p>A quick Google search shows that there is <a href=\"http://www.vinpowerdigital.com\" rel=\"nofollow noreferrer\">Vinpo... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26121/"
] | I have to implement the VinPower application. They offer a Java version, a C dll and an ActiveX dll, if anyone has an idea on where I could begin, I'd appreciate it. | First step would be to put the VinPOWER Jar file into your lib directory, then restart the server.
(Or, you can put the file in a different directory and then add the path in CF Administrator)
Then to use it... well, here is their Java sample in CFML:
```
<cfset vp = createObject("java","com.pki.vp4j.VinPower") />
... |
194,574 | <p>I was trying to insert new data into an existing XML file, but it's not working. Here's my xml file:</p>
<pre><code><list>
<activity>swimming</activity>
<activity>running</activity>
<list>
</code></pre>
<p>Now, my idea was making two files: an index page, where it displa... | [
{
"answer_id": 194637,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 4,
"selected": true,
"text": "<p>is your code block copy and pasted from your existing files? if so i see two potential issues:</p>\n\n<pre><code><form nam... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27090/"
] | I was trying to insert new data into an existing XML file, but it's not working. Here's my xml file:
```
<list>
<activity>swimming</activity>
<activity>running</activity>
<list>
```
Now, my idea was making two files: an index page, where it displays what's on the file and provides a field for inserting new e... | is your code block copy and pasted from your existing files? if so i see two potential issues:
```
<form name='input' action'insert.php' method='post'> // should be:
<form name="input" action="insert.php" method="post">
```
note: you're missing `action`**=**`"insert.php"`, which would cause the form to just reload i... |
194,579 | <p>I've got a php page which handles requets for file downloads. I need to be able to detect when a file has been downloaded successfully. How can this be done? Perhaps there's some means of detecting this client-side then sending a confirmation down to the server.</p>
<p>Thanks.</p>
<p>Edit:
By handle, I mean that t... | [
{
"answer_id": 194618,
"author": "Treb",
"author_id": 22114,
"author_profile": "https://Stackoverflow.com/users/22114",
"pm_score": 5,
"selected": true,
"text": "<p>Handle the download in a seperate php script (better do a little more than just <code>readfile($file);</code>, you can also... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19467/"
] | I've got a php page which handles requets for file downloads. I need to be able to detect when a file has been downloaded successfully. How can this be done? Perhaps there's some means of detecting this client-side then sending a confirmation down to the server.
Thanks.
Edit:
By handle, I mean that the page is doing ... | Handle the download in a seperate php script (better do a little more than just `readfile($file);`, you can also provide the ability to resume downloads like in this [question](https://stackoverflow.com/questions/157318/resumable-downloads-when-using-php-to-send-the-file)).
Then in this script, when you *read* the last... |
194,616 | <p>I have an application installed on my computer. How do I find out if it was compiled in DEBUG mode or not?</p>
<p>I've tried to use <a href="http://en.wikipedia.org/wiki/.NET_Reflector" rel="noreferrer">.NET Reflector</a>, but it does not show anything specific. Here is what I see:</p>
<pre><code>// Assembly APPLI... | [
{
"answer_id": 194625,
"author": "ZombieSheep",
"author_id": 377,
"author_profile": "https://Stackoverflow.com/users/377",
"pm_score": 5,
"selected": false,
"text": "<p>I <a href=\"http://chillijam.co.uk/?p=134\" rel=\"noreferrer\">blogged</a> this a long time ago, and I don't know if it... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an application installed on my computer. How do I find out if it was compiled in DEBUG mode or not?
I've tried to use [.NET Reflector](http://en.wikipedia.org/wiki/.NET_Reflector), but it does not show anything specific. Here is what I see:
```
// Assembly APPLICATION_NAME, Version 8.0.0.15072
Location: C:\APP... | I [blogged](http://chillijam.co.uk/?p=134) this a long time ago, and I don't know if it still valid or not, but the code is something like...
```
private void testfile(string file)
{
if(isAssemblyDebugBuild(file))
{
MessageBox.Show(String.Format("{0} seems to be a debug build",file));
}
else
... |
194,621 | <p>I know there are a few different <a href="http://en.wikipedia.org/wiki/Traveling_salesman_problem" rel="nofollow noreferrer">Traveling Salesman</a> projects out there and I've played with <a href="http://www.akira.ruc.dk/~keld/research/LKH/" rel="nofollow noreferrer">LKH</a> a bit, but I was wondering if anyone had ... | [
{
"answer_id": 194631,
"author": "Simon",
"author_id": 24039,
"author_profile": "https://Stackoverflow.com/users/24039",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"http://www.ics.forth.gr/~lourakis/levmar/\" rel=\"nofollow noreferrer\">This one</a> looks good. </p>\n\n<p>I ... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13676/"
] | I know there are a few different [Traveling Salesman](http://en.wikipedia.org/wiki/Traveling_salesman_problem) projects out there and I've played with [LKH](http://www.akira.ruc.dk/~keld/research/LKH/) a bit, but I was wondering if anyone had any recommendations on any other ones?
My project is GPL'ed so I would need ... | In general, [Space Filling Fractals](http://en.wikipedia.org/wiki/Special:Search?search=space+filling+fractal) will give you some of the best results at the lowest costs.
In particular, I would recommend the [Sierpiński curve](http://en.wikipedia.org/wiki/Sierpi%C5%84ski_curve).
Here is a sample implementation that u... |
194,650 | <p>Simply put, is there a way to create a 2D javascript array using similar syntax to this?</p>
<pre><code>var newArray = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8]
]
</code></pre>
| [
{
"answer_id": 194660,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>Yes. This works fine:</p>\n\n<pre><code><script>\nvar newArray = [\n [0, 1, 2],\n [3, 4, 5],\n [6, 7, 8]\n]\... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] | Simply put, is there a way to create a 2D javascript array using similar syntax to this?
```
var newArray = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8]
]
``` | You can create any n-dimensional arrays using *exactly* the format you suggest as in the following sample:
```
<script>
var newArray = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8]
]
var newArray3d =
[[[ 0, 1, 2],[ 3, 4, 5],[ 6, 7, 8]],
[[10, 11, 12],[13, 14, 15],[16, 17,... |
194,652 | <p>Is there any regular expression library written in T-SQL (no CLR, no extended <code>SP</code>, pure T-SQL) for SQL Server, and that should work with shared hosting?</p>
<p>Edit:</p>
<ul>
<li>Thanks, I know about <code>PATINDEX</code>, <code>LIKE</code>, <code>xp_</code> <code>sps</code> and CLR solutions</li>
<li>... | [
{
"answer_id": 194727,
"author": "Steven Murawski",
"author_id": 1233,
"author_profile": "https://Stackoverflow.com/users/1233",
"pm_score": 4,
"selected": false,
"text": "<p>There is some basic pattern matching available through using LIKE, where % matches any number and combination of ... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2622295/"
] | Is there any regular expression library written in T-SQL (no CLR, no extended `SP`, pure T-SQL) for SQL Server, and that should work with shared hosting?
Edit:
* Thanks, I know about `PATINDEX`, `LIKE`, `xp_` `sps` and CLR solutions
* I also know it is not the best place for regex, the question is theoretical :)
* Re... | How about the [PATINDEX](http://msdn.microsoft.com/en-us/library/ms188395.aspx) function?
The pattern matching in TSQL is not a complete regex library, but it gives you the basics.
(From Books Online)
```
Wildcard Meaning
% Any string of zero or more characters.
_ Any single character.
[ ] Any single character ... |
194,659 | <p>This might be an odd question, but when I scale my image in C# I need it to be pixelated and not anti-aliased. Just like in MSpaint when you scale.</p>
<p>I hope images anti-alias by default in C#, or else I changed something I didn't want to.</p>
<p>I've tried playing around with the <code>Graphics.InterpolationM... | [
{
"answer_id": 194662,
"author": "dicroce",
"author_id": 3886,
"author_profile": "https://Stackoverflow.com/users/3886",
"pm_score": 0,
"selected": false,
"text": "<p>Well, you could implement the scale yourself and do a simple linear interpolation (I.E. don't do any neighbor averaging l... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13115/"
] | This might be an odd question, but when I scale my image in C# I need it to be pixelated and not anti-aliased. Just like in MSpaint when you scale.
I hope images anti-alias by default in C#, or else I changed something I didn't want to.
I've tried playing around with the `Graphics.InterpolationMode` but no luck there... | Actually, you're right with InterpolationMode, as [the docs say](http://msdn.microsoft.com/en-us/library/k0fsyd4e.aspx). Just set it to InterpolationMode.NearestNeighbor. In your code sample, you never set m\_interpolationMode. |
194,663 | <p>I'm new to Flex SDK and trying to implement a simple project using <a href="http://dougmccune.com/blog/2007/11/19/flex-coverflow-performance-improvement-flex-carousel-component-and-vertical-coverflow/" rel="nofollow noreferrer">Doug Mccune's CoverFlow</a> widget. Most of the documentation out there on how to do thi... | [
{
"answer_id": 194670,
"author": "Simon",
"author_id": 24039,
"author_profile": "https://Stackoverflow.com/users/24039",
"pm_score": 1,
"selected": false,
"text": "<p>If it is an swc shouldn't you be using library-path rather than source-path and referencing the swc?</p>\n"
},
{
... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9974/"
] | I'm new to Flex SDK and trying to implement a simple project using [Doug Mccune's CoverFlow](http://dougmccune.com/blog/2007/11/19/flex-coverflow-performance-improvement-flex-carousel-component-and-vertical-coverflow/) widget. Most of the documentation out there on how to do this assumes that one is using Adobe's FlexB... | Here is a [link to the mxmlc command line tool docs from Adobe](http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_13.html) and a [direct link to the command line options reference.](http://livedocs.adobe.com/flex/3/html/help.html?content=compilers_14.html#157203) I also find `mxmlc -help list` to be a g... |
194,666 | <p>Is there a way to suppress warnings in Xcode?</p>
<p>For example I am calling an undocumented method and since the method is not in the header I get a warning on compile. I know I can add it to my header to stop the warning, but I am wondering if there is a way other than adding it to the header (so I can keep the ... | [
{
"answer_id": 196781,
"author": "robottobor",
"author_id": 10184,
"author_profile": "https://Stackoverflow.com/users/10184",
"pm_score": 7,
"selected": false,
"text": "<p>To disable warnings on a per-file basis, using Xcode 3 and llvm-gcc-4.2 you can use:</p>\n\n<pre><code>#pragma GCC d... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26728/"
] | Is there a way to suppress warnings in Xcode?
For example I am calling an undocumented method and since the method is not in the header I get a warning on compile. I know I can add it to my header to stop the warning, but I am wondering if there is a way other than adding it to the header (so I can keep the headers cl... | To disable warnings on a per-file basis, using Xcode 3 and llvm-gcc-4.2 you can use:
```
#pragma GCC diagnostic ignored "-Wwarning-flag"
```
Where warning name is some gcc warning flag.
This overrides any warning flags on the command line. It doesn't work with all warnings though. Add -fdiagnostics-show-option to y... |
194,698 | <p>I was asked to build a java system that will have the ability to load new code (expansions) while running.
How do I re-load a jar file while my code is running? or how do I load a new jar?</p>
<p>Obviously, since constant up-time is important, I'd like to add the ability to re-load existing classes while at it (if... | [
{
"answer_id": 194708,
"author": "Amir Arad",
"author_id": 11813,
"author_profile": "https://Stackoverflow.com/users/11813",
"pm_score": 2,
"selected": false,
"text": "<p>I googled a bit, and found this code <a href=\"https://community.oracle.com/message/5531305#5531305\" rel=\"nofollow ... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11813/"
] | I was asked to build a java system that will have the ability to load new code (expansions) while running.
How do I re-load a jar file while my code is running? or how do I load a new jar?
Obviously, since constant up-time is important, I'd like to add the ability to re-load existing classes while at it (if it does n... | Reloading existing classes with existing data is likely to break things.
You can load new code into new class loaders relatively easily:
```
ClassLoader loader = URLClassLoader.newInstance(
new URL[] { yourURL },
getClass().getClassLoader()
);
Class<?> clazz = Class.forName("mypackage.MyClass", true, loader);... |
194,725 | <p>I am a heavy command line user and use the <code>find</code> command extensively in my build system scripts. However on Mac OS X when I am not concentrating I often get output like this:</p>
<pre><code>$ find -name \*.plist
find: illegal option -- n
find: illegal option -- a
find: illegal option -- m
find: illegal ... | [
{
"answer_id": 194732,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 2,
"selected": false,
"text": "<pre><code>find ./ -name \"*.plist\"\n</code></pre>\n\n<p><strong>edit</strong>: hmm, i may have misunderstood the question! if... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6444/"
] | I am a heavy command line user and use the `find` command extensively in my build system scripts. However on Mac OS X when I am not concentrating I often get output like this:
```
$ find -name \*.plist
find: illegal option -- n
find: illegal option -- a
find: illegal option -- m
find: illegal option -- e
find: *.plist... | If you can't discipline yourself to use `find` 'correctly', then why not install GNU `find` (from `findutils`) in a directory on your PATH ahead of the system `find` command.
I used to have my own private variant of `cp` that would copy files to the current directory if the last item in the list was not a directory. I... |
194,733 | <p>If I have a method such as:</p>
<pre><code>private function testMethod(param:string):void
{
// Get the object that called this function
}
</code></pre>
<p>Inside the testMethod, can I work out what object called us? e.g.</p>
<pre><code>class A
{
doSomething()
{
var b:B = new B();
b.fooBar();
}
}
... | [
{
"answer_id": 194745,
"author": "James Fassett",
"author_id": 27081,
"author_profile": "https://Stackoverflow.com/users/27081",
"pm_score": 4,
"selected": true,
"text": "<p>Sorry the answer is no (see edit below). Functions received a special property called <code>arguments</code> and ... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986/"
] | If I have a method such as:
```
private function testMethod(param:string):void
{
// Get the object that called this function
}
```
Inside the testMethod, can I work out what object called us? e.g.
```
class A
{
doSomething()
{
var b:B = new B();
b.fooBar();
}
}
class B
{
fooBar()
{
// Can I... | Sorry the answer is no (see edit below). Functions received a special property called `arguments` and in AS2 it used to have the property `caller` that would do roughly what you want. Although the arguments object is still available in AS3 the caller property was removed from AS3 (and therefore Flex 3) so there is no d... |
194,742 | <p>What is the best way to determine whether there is an available Internet connection for a WinForms app. (Programatically of course) I want to disable/hide certain functions if the user is not connected to the Internet.</p>
| [
{
"answer_id": 194747,
"author": "QAZ",
"author_id": 14260,
"author_profile": "https://Stackoverflow.com/users/14260",
"pm_score": 3,
"selected": false,
"text": "<p>I'm not a c# developer but in C++ you can use the Win32 API (specifically from Wininet.dll) like this:</p>\n\n<pre><code>bo... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5019/"
] | What is the best way to determine whether there is an available Internet connection for a WinForms app. (Programatically of course) I want to disable/hide certain functions if the user is not connected to the Internet. | The following will determine if you are connected to a network, however, that doesn't necessarily mean that you are connected to the Internet:
```
NetworkInterface.GetIsNetworkAvailable()
```
Here is a C# translation of Steve's code that seems to be pretty good:
```
private static int ERROR_SUCCESS = 0;
public sta... |
194,765 | <p>At the moment a default entry looks something like this:</p>
<pre><code>Oct 12, 2008 9:45:18 AM myClassInfoHere
INFO: MyLogMessageHere
</code></pre>
<p>How do I get it to do this?</p>
<pre><code>Oct 12, 2008 9:45:18 AM myClassInfoHere - INFO: MyLogMessageHere
</code></pre>
<p>Clarification I'm using java.util.lo... | [
{
"answer_id": 194767,
"author": "Leigh Caldwell",
"author_id": 3267,
"author_profile": "https://Stackoverflow.com/users/3267",
"pm_score": -1,
"selected": false,
"text": "<p>This logging is specific to your application and not a general Java feature. What application(s) are you running?... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23120/"
] | At the moment a default entry looks something like this:
```
Oct 12, 2008 9:45:18 AM myClassInfoHere
INFO: MyLogMessageHere
```
How do I get it to do this?
```
Oct 12, 2008 9:45:18 AM myClassInfoHere - INFO: MyLogMessageHere
```
Clarification I'm using java.util.logging | As of Java 7, [java.util.logging.SimpleFormatter](http://docs.oracle.com/javase/7/docs/api/java/util/logging/SimpleFormatter.html#format%28java.util.logging.LogRecord%29) supports getting its [format](http://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html#syntax) from a system property, so adding something l... |
194,803 | <p>I'm currently developing a website and my client wants the text of various articles to overflow into two columns. Kind of like in a newspaper? So it would look like:</p>
<pre class="lang-none prettyprint-override"><code>Today in Wales, someone actually Nobody was harmed in
did something interesting. ... | [
{
"answer_id": 194816,
"author": "Kris",
"author_id": 18565,
"author_profile": "https://Stackoverflow.com/users/18565",
"pm_score": -1,
"selected": false,
"text": "<p>First off, i don't think just css can do that, but i would love to be proven wrong.</p>\n\n<p>Second, just counting parag... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12765/"
] | I'm currently developing a website and my client wants the text of various articles to overflow into two columns. Kind of like in a newspaper? So it would look like:
```none
Today in Wales, someone actually Nobody was harmed in
did something interesting. the incident, although one
Authorities are baff... | The good news is that there is a [CSS-only solution](http://www.w3.org/TR/css3-multicol/). If it was implemented, it would look like this:
```
div.multi {
column-count: 3
column-gap: 10px;
column-rule: 1px solid black;
}
``` |
194,828 | <p>Is it possible to initialize an array of pointers to structs?
Something like:</p>
<pre><code>struct country_t *countries[] = {
{"United States of America", "America"},
{"England", "Europe"},
{"Ethiopia", "Africa"}
}
</code></pre>
<p>I want to do that in order to get the entities in no... | [
{
"answer_id": 194840,
"author": "Jonathan Leffler",
"author_id": 15168,
"author_profile": "https://Stackoverflow.com/users/15168",
"pm_score": 5,
"selected": false,
"text": "<p>Well, your code uses structures rather than pointers to structures. There are ways to do what you seek, inclu... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194828",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is it possible to initialize an array of pointers to structs?
Something like:
```
struct country_t *countries[] = {
{"United States of America", "America"},
{"England", "Europe"},
{"Ethiopia", "Africa"}
}
```
I want to do that in order to get the entities in not-contiguous memory, and t... | Well, your code uses structures rather than pointers to structures. There are ways to do what you seek, including:
```
static struct country_t us = { "United States of America", "America" };
static struct country_t uk = { "England", "Europe" };
static struct country_t et = { "Ethiopia", ... |
194,846 | <p>Basically, I'm trying to create an object of unique objects, a set. I had the brilliant idea of just using a JavaScript object with objects for the property names. Such as,</p>
<pre><code>set[obj] = true;
</code></pre>
<p>This works, up to a point. It works great with string and numbers, but with other objects, th... | [
{
"answer_id": 194906,
"author": "eyelidlessness",
"author_id": 17964,
"author_profile": "https://Stackoverflow.com/users/17964",
"pm_score": 6,
"selected": true,
"text": "<p>JavaScript objects can only use strings as keys (anything else is converted to a string).</p>\n\n<p>You could, al... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16492/"
] | Basically, I'm trying to create an object of unique objects, a set. I had the brilliant idea of just using a JavaScript object with objects for the property names. Such as,
```
set[obj] = true;
```
This works, up to a point. It works great with string and numbers, but with other objects, they all seem to "hash" to t... | JavaScript objects can only use strings as keys (anything else is converted to a string).
You could, alternatively, maintain an array which indexes the objects in question, and use its index string as a reference to the object. Something like this:
```
var ObjectReference = [];
ObjectReference.push(obj);
set['Object... |
194,852 | <p>Consider a database table holding names, with three rows:</p>
<pre><code>Peter
Paul
Mary
</code></pre>
<p>Is there an easy way to turn this into a single string of <code>Peter, Paul, Mary</code>?</p>
| [
{
"answer_id": 194858,
"author": "Manu",
"author_id": 2133,
"author_profile": "https://Stackoverflow.com/users/2133",
"pm_score": 2,
"selected": false,
"text": "<p>One way you could do it in SQL Server would be to return the table content as XML (for XML raw), convert the result to ... | 2008/10/11 | [
"https://Stackoverflow.com/questions/194852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27109/"
] | Consider a database table holding names, with three rows:
```
Peter
Paul
Mary
```
Is there an easy way to turn this into a single string of `Peter, Paul, Mary`? | If you are on SQL Server 2017 or Azure, see [Mathieu Renda answer](https://stackoverflow.com/a/42778050/1178676).
I had a similar issue when I was trying to join two tables with one-to-many relationships. In SQL 2005 I found that `XML PATH` method can handle the concatenation of the rows very easily.
If there is a ta... |
194,863 | <p>I'm looking for some succinct, modern C# code to generate a random date between Jan 1 1995 and the current date.</p>
<p>I'm thinking some solution that utilizes Enumerable.Range somehow may make this more succinct.</p>
| [
{
"answer_id": 194868,
"author": "friol",
"author_id": 23034,
"author_profile": "https://Stackoverflow.com/users/23034",
"pm_score": 2,
"selected": false,
"text": "<p>Start with a fixed date object (Jan 1, 1995), and add a random number of days with AddDays (obviusly, pay attention not s... | 2008/10/12 | [
"https://Stackoverflow.com/questions/194863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/536/"
] | I'm looking for some succinct, modern C# code to generate a random date between Jan 1 1995 and the current date.
I'm thinking some solution that utilizes Enumerable.Range somehow may make this more succinct. | ```
private Random gen = new Random();
DateTime RandomDay()
{
DateTime start = new DateTime(1995, 1, 1);
int range = (DateTime.Today - start).Days;
return start.AddDays(gen.Next(range));
}
```
For better performance if this will be called repeatedly, create the `start` and `gen` (and maybe even... |
194,869 | <p>I am working on a project that does a large amount of hashing, signing, and both asymmetric and symmetric encryption. Since these steps have a significant effect on our performance and available load, I was wondering if there is a hardware based solution to offloading the work. </p>
<p>I have done some surfing to f... | [
{
"answer_id": 194868,
"author": "friol",
"author_id": 23034,
"author_profile": "https://Stackoverflow.com/users/23034",
"pm_score": 2,
"selected": false,
"text": "<p>Start with a fixed date object (Jan 1, 1995), and add a random number of days with AddDays (obviusly, pay attention not s... | 2008/10/12 | [
"https://Stackoverflow.com/questions/194869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/71994/"
] | I am working on a project that does a large amount of hashing, signing, and both asymmetric and symmetric encryption. Since these steps have a significant effect on our performance and available load, I was wondering if there is a hardware based solution to offloading the work.
I have done some surfing to find out, a... | ```
private Random gen = new Random();
DateTime RandomDay()
{
DateTime start = new DateTime(1995, 1, 1);
int range = (DateTime.Today - start).Days;
return start.AddDays(gen.Next(range));
}
```
For better performance if this will be called repeatedly, create the `start` and `gen` (and maybe even... |
194,890 | <p>I have a large project that I want to start using visual studio 2005 to edit. I want to tell it "Here are all the files I want you to track, now get on with it" and have them displayed as a directory tree, for example:</p>
<pre><code>Folder 1
- File A
- File B
- File C
Folder 2
- Folder 3
- File X
- File ... | [
{
"answer_id": 194897,
"author": "Manu",
"author_id": 2133,
"author_profile": "https://Stackoverflow.com/users/2133",
"pm_score": 3,
"selected": false,
"text": "<p>click on the 'show all files' icon in the solution explorer, then select the folders you want to include, right click and se... | 2008/10/12 | [
"https://Stackoverflow.com/questions/194890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13500/"
] | I have a large project that I want to start using visual studio 2005 to edit. I want to tell it "Here are all the files I want you to track, now get on with it" and have them displayed as a directory tree, for example:
```
Folder 1
- File A
- File B
- File C
Folder 2
- Folder 3
- File X
- File Y
- File D
-... | click on the 'show all files' icon in the solution explorer, then select the folders you want to include, right click and select 'include in project'. |
194,914 | <p>What's the best way of adding spaces between strings</p>
<pre><code>myString = string.Concat("a"," ","b")
</code></pre>
<p>or</p>
<pre><code>myString = string.Concat("a",Chr(9),"b")
</code></pre>
<p>I am using stringbuilder to build an XML file and looking for something efficient.</p>
<p>Thanks</p>
<p>Edit ~ L... | [
{
"answer_id": 194916,
"author": "Razor",
"author_id": 17211,
"author_profile": "https://Stackoverflow.com/users/17211",
"pm_score": 3,
"selected": false,
"text": "<p>Create your XML file with the XmlDocument class. Your wasting your time creating a string from scratch.</p>\n"
},
{
... | 2008/10/12 | [
"https://Stackoverflow.com/questions/194914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23667/"
] | What's the best way of adding spaces between strings
```
myString = string.Concat("a"," ","b")
```
or
```
myString = string.Concat("a",Chr(9),"b")
```
I am using stringbuilder to build an XML file and looking for something efficient.
Thanks
Edit ~ Language VB.NET | Well, for a start, chr(9) is a tab character - you would want to use chr(32) to get a space.
That said, the first option, **`string.Concat("a"," ","b")`**, is a more readable one. I would be concentrating on getting your code functionally correct to start with. Optimization should always be a last step and targeted on... |
194,930 | <p>I got one big question.</p>
<p>I got a linq query to put it simply looks like this:</p>
<pre><code>from xx in table
where xx.uid.ToString().Contains(string[])
select xx
</code></pre>
<p>The values of the <code>string[]</code> array would be numbers like (1,45,20,10,etc...)</p>
<p>the Default for <code>.Contains<... | [
{
"answer_id": 194939,
"author": "spoulson",
"author_id": 3347,
"author_profile": "https://Stackoverflow.com/users/3347",
"pm_score": 2,
"selected": false,
"text": "<p>How about:</p>\n\n<pre><code>from xx in table\nwhere stringarray.Contains(xx.uid.ToString())\nselect xx\n</code></pre>\n... | 2008/10/12 | [
"https://Stackoverflow.com/questions/194930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7644/"
] | I got one big question.
I got a linq query to put it simply looks like this:
```
from xx in table
where xx.uid.ToString().Contains(string[])
select xx
```
The values of the `string[]` array would be numbers like (1,45,20,10,etc...)
the Default for `.Contains` is `.Contains(string)`.
I need it to do this instead: ... | spoulson has it nearly right, but you need to create a `List<string>` from `string[]` first. Actually a `List<int>` would be better if uid is also `int`. `List<T>` supports `Contains()`. Doing `uid.ToString().Contains(string[])` would imply that the uid as a string contains all of the values of the array as a substring... |
194,944 | <p>I am creating a lightweight editor in C# and would like to know the best method for converting a string into a nicely formatted XML string. I would hope that there's a public method in the C# library like "public bool FormatAsXml(string text, out string formattedXmlText)", but it couldn't be that easy, could it?</p... | [
{
"answer_id": 194951,
"author": "rp.",
"author_id": 2536,
"author_profile": "https://Stackoverflow.com/users/2536",
"pm_score": 0,
"selected": false,
"text": "<p>Is the string valid XML? Do you mean how can you convert an XML string into an XML document? If so, do this:</p>\n\n<pre><cod... | 2008/10/12 | [
"https://Stackoverflow.com/questions/194944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27109/"
] | I am creating a lightweight editor in C# and would like to know the best method for converting a string into a nicely formatted XML string. I would hope that there's a public method in the C# library like "public bool FormatAsXml(string text, out string formattedXmlText)", but it couldn't be that easy, could it?
Very ... | ```
string unformattedXml = "<?xml version=\"1.0\"?><book><author>Lewis, C.S.</author><title>The Four Loves</title></book>";
string formattedXml = XElement.Parse(unformattedXml).ToString();
Console.WriteLine(formattedXml);
```
Output:
```
<book>
<author>Lewis, C.S.</author>
<title>The Four Loves</title>
</book>
... |
194,976 | <p>I thought the web page designer screen in 2005 was mediocre until I used the one in 2008 which I think is bad. There is an interesting white paper here:</p>
<p><a href="http://www.west-wind.com/weblog/posts/484172.aspx" rel="nofollow noreferrer">http://www.west-wind.com/weblog/posts/484172.aspx</a></p>
<p>I've g... | [
{
"answer_id": 194951,
"author": "rp.",
"author_id": 2536,
"author_profile": "https://Stackoverflow.com/users/2536",
"pm_score": 0,
"selected": false,
"text": "<p>Is the string valid XML? Do you mean how can you convert an XML string into an XML document? If so, do this:</p>\n\n<pre><cod... | 2008/10/12 | [
"https://Stackoverflow.com/questions/194976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I thought the web page designer screen in 2005 was mediocre until I used the one in 2008 which I think is bad. There is an interesting white paper here:
<http://www.west-wind.com/weblog/posts/484172.aspx>
I've gotten very used to these WYSIWYG designers over the years, but I am looking now for a new way.
I make bus... | ```
string unformattedXml = "<?xml version=\"1.0\"?><book><author>Lewis, C.S.</author><title>The Four Loves</title></book>";
string formattedXml = XElement.Parse(unformattedXml).ToString();
Console.WriteLine(formattedXml);
```
Output:
```
<book>
<author>Lewis, C.S.</author>
<title>The Four Loves</title>
</book>
... |
194,999 | <p>On an ASP.NET website, are static classes unique to each web request, or are they instantiated whenever needed and GCed whenever the GC decides to disposed of them?</p>
<p>The reason I ask is because I've written some static classes before in C# and the behavior is different than I would have expected. I would have... | [
{
"answer_id": 195003,
"author": "Sijin",
"author_id": 8884,
"author_profile": "https://Stackoverflow.com/users/8884",
"pm_score": 4,
"selected": false,
"text": "<p>Since the types are contained in an app domain, I would expect static classes to be present as long as the app domain is no... | 2008/10/12 | [
"https://Stackoverflow.com/questions/194999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] | On an ASP.NET website, are static classes unique to each web request, or are they instantiated whenever needed and GCed whenever the GC decides to disposed of them?
The reason I ask is because I've written some static classes before in C# and the behavior is different than I would have expected. I would have expected ... | Your static classes and static instance fields are shared between all requests to the application, and has the same lifetime as the application domain. Therefore, you should be careful when using static instances, since you might have synchronization issues and the like. Also bear in mind, that static instances will no... |
195,010 | <p>I have an array of 1000 or so entries, with examples below:</p>
<pre><code>wickedweather
liquidweather
driveourtrucks
gocompact
slimprojector
</code></pre>
<p>I would like to be able to split these into their respective words, as:</p>
<pre><code>wicked weather
liquid weather
drive our trucks
go compact
slim proje... | [
{
"answer_id": 195015,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "<p>I think you're right in thinking that it's not really a job for a regular expression. I would approach this using the ... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14728/"
] | I have an array of 1000 or so entries, with examples below:
```
wickedweather
liquidweather
driveourtrucks
gocompact
slimprojector
```
I would like to be able to split these into their respective words, as:
```
wicked weather
liquid weather
drive our trucks
go compact
slim projector
```
I was hoping a regular exp... | Can a human do it?
```
farsidebag
far sidebag
farside bag
far side bag
```
Not only do you have to use a dictionary, you might have to use a statistical approach to figure out what's most likely (or, god forbid, an actual HMM for your human language of choice...)
For how to do statistics that might be helpful, I t... |
195,020 | <p>I've just started using Java's enums in my own projects (I have to use JDK 1.4 at work) and I am confused as to the best practice of using JavaDoc for an enum.</p>
<p>I have found that this method works, but the resultant code is a little unrefined:</p>
<pre><code>/**
* Doc for enum
*/
public enum Something {
/**
... | [
{
"answer_id": 195074,
"author": "Mike Deck",
"author_id": 1247,
"author_profile": "https://Stackoverflow.com/users/1247",
"pm_score": 6,
"selected": true,
"text": "<p>To answer the first part of your question, you do have to separate each enum value with a comma. As far as I know, ther... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8026/"
] | I've just started using Java's enums in my own projects (I have to use JDK 1.4 at work) and I am confused as to the best practice of using JavaDoc for an enum.
I have found that this method works, but the resultant code is a little unrefined:
```
/**
* Doc for enum
*/
public enum Something {
/**
* First thing
*/
FIRS... | To answer the first part of your question, you do have to separate each enum value with a comma. As far as I know, there's no way around that.
Personally I don't have a problem with the code the way you've presented it. Seems like a perfectly reasonable way to document an enum to me. |
195,036 | <p>I've been researching PHP frameworks as of late for some personal projects, and it looks like most of them use a front controller to mimic a response. The controller gets the params from the request, and re-routes by sending the appropriate headers depending on the logic. This is the "response". Is this the best way... | [
{
"answer_id": 195047,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 3,
"selected": true,
"text": "<p>a front controller lends itself quite well to a web environment, allowing you to funnel all requests to your application. sin... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've been researching PHP frameworks as of late for some personal projects, and it looks like most of them use a front controller to mimic a response. The controller gets the params from the request, and re-routes by sending the appropriate headers depending on the logic. This is the "response". Is this the best way to... | a front controller lends itself quite well to a web environment, allowing you to funnel all requests to your application. since HTTP is stateless, and a user can, in a sense, inadvertently stumble upon parts of your app by accident (ie, hitting random URL's), a front controller allows you to determine the entry point o... |
195,058 | <p>Below is my $.ajax call, how do I put a selects (multiple) selected values in the data section?</p>
<pre><code>$.ajax({
type: "post",
url: "http://myServer" ,
dataType: "text",
data: {
'service' : 'myService',
'program' : 'myProgram',
'start' : start,
'end' : end ,
... | [
{
"answer_id": 195064,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 4,
"selected": true,
"text": "<p>how about using an array?</p>\n\n<pre><code>data: {\n ...\n 'select' : ['value1', 'value2', 'value3'],\n ...\n},\n</... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2755/"
] | Below is my $.ajax call, how do I put a selects (multiple) selected values in the data section?
```
$.ajax({
type: "post",
url: "http://myServer" ,
dataType: "text",
data: {
'service' : 'myService',
'program' : 'myProgram',
'start' : start,
'end' : end ,
},
s... | how about using an array?
```
data: {
...
'select' : ['value1', 'value2', 'value3'],
...
},
```
**edit**: ah sorry, here's the code, a few caveats:
```
'select' : $('#myselectbox').serializeArray(),
```
in order for serializeArray() to work though, all form elements must have a name attribute. the val... |
195,061 | <p>I have some assembly that references NUnit and creates a single test class with a single test method. I am able to get the file system path to this assembly (e.g. "C:...\test.dll"). I would like to programmatically use NUnit to run against this assembly.</p>
<p>So far I have:</p>
<pre><code>var runner = new Simple... | [
{
"answer_id": 195066,
"author": "Ash",
"author_id": 5023,
"author_profile": "https://Stackoverflow.com/users/5023",
"pm_score": 2,
"selected": false,
"text": "<p>\"What is the secret to getting Assembly.Load to work?\"</p>\n\n<p>System.Reflection.Assembly.Load takes an string containing... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195061",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12958/"
] | I have some assembly that references NUnit and creates a single test class with a single test method. I am able to get the file system path to this assembly (e.g. "C:...\test.dll"). I would like to programmatically use NUnit to run against this assembly.
So far I have:
```
var runner = new SimpleTestRunner();
runner.... | If you want to open in a *console mode*, add **nunit-console-runner.dll** reference and use:
```
NUnit.ConsoleRunner.Runner.Main(new string[]
{
System.Reflection.Assembly.GetExecutingAssembly().Location,
});
```
If you want to open in a *gui mode*, add **nunit-gui-runner.dll** reference and use:
```
NU... |
195,070 | <p>I would like the fastest and most accurate function <code>boolean isReachable(String host, int port)</code> that passes the following JUnit tests under the conditions below. Timeout values are specified by the JUnit test itself, and may be considered "unreachable."</p>
<p><strong>Please note:</strong> All answers m... | [
{
"answer_id": 195071,
"author": "grammar31",
"author_id": 12815,
"author_profile": "https://Stackoverflow.com/users/12815",
"pm_score": 0,
"selected": false,
"text": "<p>My most recent solution depends using a <code>TimedSocket</code> (<a href=\"http://www.javaworld.com/jw-09-1999/jw-09... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12815/"
] | I would like the fastest and most accurate function `boolean isReachable(String host, int port)` that passes the following JUnit tests under the conditions below. Timeout values are specified by the JUnit test itself, and may be considered "unreachable."
**Please note:** All answers must be platform-independent. This ... | Firstly you need to recognise that you have *potentially* conflicting requirements; IP sockets are not time deterministic. The quickest you can ever detect unreachability is after your elapsed timeout. You can only detect reachability quicker.
Assuming reachability/isReachable is your real objective, you should just u... |
195,072 | <p>I'm experiencing what I believe is a circular dependency issue with my PHP application. Please let me know if this is incorrect. Here is the situation:</p>
<p>Two classes, LogManager and DBSession.</p>
<p>DBSession is used to interact with the database, and LogManager is used to log to files. Both are widely used ... | [
{
"answer_id": 195076,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 1,
"selected": false,
"text": "<p>Maybe you can apply some pattern, like the <a href=\"http://en.wikipedia.org/wiki/Singleton_pattern\" rel=\"... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21263/"
] | I'm experiencing what I believe is a circular dependency issue with my PHP application. Please let me know if this is incorrect. Here is the situation:
Two classes, LogManager and DBSession.
DBSession is used to interact with the database, and LogManager is used to log to files. Both are widely used in my application... | Don't extend LogManager, let it be an aggregate type. And delay the choice of where you want to log, i.e.:
```
$logManager = new LogManager();
$dbSession = new DbSession($logManager);
$logManager->add(new FileLog($filename) );
$logManager->add(new DBLog($dbSession) );
```
Where of course FileLog and DBLog share a co... |
195,078 | <p>I need to hide (make private) the <code>-init</code> method of my class in Objective-C.</p>
<p>How can I do that?</p>
| [
{
"answer_id": 195107,
"author": "Matt Dillard",
"author_id": 863,
"author_profile": "https://Stackoverflow.com/users/863",
"pm_score": 2,
"selected": false,
"text": "<p>That depends on what you mean by \"make private\". In Objective-C, calling a method on an object might better be desc... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3740/"
] | I need to hide (make private) the `-init` method of my class in Objective-C.
How can I do that? | Objective-C, like Smalltalk, has no concept of "private" versus "public" methods. Any message can be sent to any object at any time.
What you can do is throw an `NSInternalInconsistencyException` if your `-init` method is invoked:
```
- (id)init {
[self release];
@throw [NSException exceptionWithName:NSIntern... |
195,114 | <p>I'm trying to do a custom button to my form (which has FormBorderStyle = none) using Visual Studio 2005. I have my 3 states button images in an ImageList linked to the button.</p>
<pre><code>this.btnClose.AutoSize = false;
this.btnClose.BackColor = System.Drawing.Color.Transparent;
this.btnClose.BackgroundImageLayo... | [
{
"answer_id": 195128,
"author": "faulty",
"author_id": 20007,
"author_profile": "https://Stackoverflow.com/users/20007",
"pm_score": 5,
"selected": true,
"text": "<p>The grey background is due to the setting of \"System.Windows.Forms.FlatStyle.Flat\", it's the default behaviour, since i... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4386/"
] | I'm trying to do a custom button to my form (which has FormBorderStyle = none) using Visual Studio 2005. I have my 3 states button images in an ImageList linked to the button.
```
this.btnClose.AutoSize = false;
this.btnClose.BackColor = System.Drawing.Color.Transparent;
this.btnClose.BackgroundImageLayout = System.Wi... | The grey background is due to the setting of "System.Windows.Forms.FlatStyle.Flat", it's the default behaviour, since it need to highlight the button when you hover. To eliminate that, you might have to write a custom button class, inherit from the original button and do some custom painting to achieve that.
Btw, inst... |
195,116 | <p>Does anyone know of a faster decimal implementation in python?</p>
<p>As the example below demonstrates, the standard library's decimal module is ~100 times slower than <code>float</code>.</p>
<pre class="lang-py prettyprint-override"><code>from timeit import Timer
def run(val, the_class):
test = the_class(1... | [
{
"answer_id": 195124,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 5,
"selected": true,
"text": "<p>The <a href=\"http://gmplib.org\" rel=\"noreferrer\">GMP</a> library is one of the best arbitrary precision math librar... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52490/"
] | Does anyone know of a faster decimal implementation in python?
As the example below demonstrates, the standard library's decimal module is ~100 times slower than `float`.
```py
from timeit import Timer
def run(val, the_class):
test = the_class(1)
for c in xrange(10000):
d = the_class(val)
d ... | The [GMP](http://gmplib.org) library is one of the best arbitrary precision math libraries around, and there is a Python binding available at [GMPY](http://www.aleax.it/gmpy.html). I would try that method. |
195,150 | <p>How can I raise an event from a SWF file loaded into a Flex application (using SWFLoader)?</p>
<p>I want to be able to detect</p>
<pre><code>a) when a button is pressed
b) when the animation ends
</code></pre>
| [
{
"answer_id": 195160,
"author": "Christophe Herreman",
"author_id": 17255,
"author_profile": "https://Stackoverflow.com/users/17255",
"pm_score": 2,
"selected": false,
"text": "<p>You'll need to do 2 things:</p>\n\n<ol>\n<li>Dispatch an event from the loaded swf. Make sure the event bub... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24727/"
] | How can I raise an event from a SWF file loaded into a Flex application (using SWFLoader)?
I want to be able to detect
```
a) when a button is pressed
b) when the animation ends
``` | You'll need to do 2 things:
1. Dispatch an event from the loaded swf. Make sure the event bubbles if you sent it from nested views. Bubbling can be set through the bubbles property of the event.
2. Listen to the event from your main application. I think you should be able to do that on the content property of the SWFL... |
195,151 | <p>I have a ListView in WPF that is databound to a basic table that I pull from the database. The code for the ListView is as follows:</p>
<pre><code><ListView Canvas.Left="402" Canvas.Top="480" Height="78" ItemsSource="{Binding}" Name="lsvViewEditCardPrint" Width="419">
<ListView.View>
<GridVi... | [
{
"answer_id": 195171,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 3,
"selected": true,
"text": "<p>This blog <a href=\"http://almosteric.wordpress.com/2008/06/24/databinding-to-foreign-keys-in-wpf/\" rel=\"nofollow ... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/71/"
] | I have a ListView in WPF that is databound to a basic table that I pull from the database. The code for the ListView is as follows:
```
<ListView Canvas.Left="402" Canvas.Top="480" Height="78" ItemsSource="{Binding}" Name="lsvViewEditCardPrint" Width="419">
<ListView.View>
<GridView>
<GridViewColumn ... | This blog [post](http://almosteric.wordpress.com/2008/06/24/databinding-to-foreign-keys-in-wpf/) may help:
>
> ...I assumed the foreign key should be bound to the ‘SelectedValue’ property,
> and there is an ItemSource that I can
> bind to my fact table so the drop down
> is populated.
>
>
> At this point my drop... |
195,173 | <p>When you run something similar to:</p>
<pre><code>UPDATE table SET datetime = NOW();
</code></pre>
<p>on a table with 1 000 000 000 records and the query takes 10 seconds to run, will all the rows have the exact same time (minutes and seconds) or will they have different times? In other words, will the time be whe... | [
{
"answer_id": 195179,
"author": "gizmo",
"author_id": 9396,
"author_profile": "https://Stackoverflow.com/users/9396",
"pm_score": 1,
"selected": false,
"text": "<p>They should have the same time, the update is supposed to be atomic, meaning that whatever how long it takes to perform, th... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5441/"
] | When you run something similar to:
```
UPDATE table SET datetime = NOW();
```
on a table with 1 000 000 000 records and the query takes 10 seconds to run, will all the rows have the exact same time (minutes and seconds) or will they have different times? In other words, will the time be when the query started or whe... | <http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_now>
>
> "NOW() returns a constant time that indicates the time at which the statement began to execute. (Within a stored routine or trigger, NOW() returns the time at which the routine or triggering statement began to execute.) This differ... |
195,177 | <p>I have a Zimbra installation and I need to programmaticaly update contacts in it. It seems that its REST interface is only working to add new contacts, but I need to update existing ones. Is there a way, tool or something, open-source, to do that ?</p>
| [
{
"answer_id": 195708,
"author": "edomaur",
"author_id": 14262,
"author_profile": "https://Stackoverflow.com/users/14262",
"pm_score": 3,
"selected": true,
"text": "<p>Well, I have an answer to my question : you may use the \"zmmailbox\" command. Under the Zimbra system user, it is possi... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14262/"
] | I have a Zimbra installation and I need to programmaticaly update contacts in it. It seems that its REST interface is only working to add new contacts, but I need to update existing ones. Is there a way, tool or something, open-source, to do that ? | Well, I have an answer to my question : you may use the "zmmailbox" command. Under the Zimbra system user, it is possible to modify content in a mailbox. Since quite everything is stored in the Zimbra mailbox, contacts can be edited. I need now to find a way to use this :
```
box$ zmmailbox help contact
autoComplet... |
195,207 | <p>Very simply put:</p>
<p>I have a class that consists mostly of static public members, so I can group similar functions together that still have to be called from other classes/functions.</p>
<p>Anyway, I have defined two static unsigned char variables in my class public scope, when I try to modify these values in ... | [
{
"answer_id": 195209,
"author": "Colin Jensen",
"author_id": 9884,
"author_profile": "https://Stackoverflow.com/users/9884",
"pm_score": 8,
"selected": true,
"text": "<p>If you are using <strong>C++ 17</strong> you can just use the <code>inline</code> specifier (see <a href=\"https://st... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Very simply put:
I have a class that consists mostly of static public members, so I can group similar functions together that still have to be called from other classes/functions.
Anyway, I have defined two static unsigned char variables in my class public scope, when I try to modify these values in the same class' c... | If you are using **C++ 17** you can just use the `inline` specifier (see <https://stackoverflow.com/a/11711082/55721>)
---
If using older versions of the C++ standard, you must add the definitions to match your declarations of X and Y
```
unsigned char test::X;
unsigned char test::Y;
```
somewhere. You might want ... |
195,240 | <p>I have the following template</p>
<pre><code><h2>one</h2>
<xsl:apply-templates select="one"/>
<h2>two</h2>
<xsl:apply-templates select="two"/>
<h2>three</h2>
<xsl:apply-templates select="three"/>
</code></pre>
<p>I would like to only display the headers (one,tw... | [
{
"answer_id": 195248,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": true,
"text": "<pre><code><xsl:if test=\"one\">\n <h2>one</h2>\n <xsl:apply-templates select=\"one\"/>\n<... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2133/"
] | I have the following template
```
<h2>one</h2>
<xsl:apply-templates select="one"/>
<h2>two</h2>
<xsl:apply-templates select="two"/>
<h2>three</h2>
<xsl:apply-templates select="three"/>
```
I would like to only display the headers (one,two,three) if there is at least one member of the corresponding template. How do I... | ```
<xsl:if test="one">
<h2>one</h2>
<xsl:apply-templates select="one"/>
</xsl:if>
<!-- etc -->
```
Alternatively, you could create a named template,
```
<xsl:template name="WriteWithHeader">
<xsl:param name="header"/>
<xsl:param name="data"/>
<xsl:if test="$data">
<h2><xsl:value-of select="$heade... |
195,267 | <p>I'm trying to use the Windows API to set the primary monitor. It doesn't seem to work - my screen just flicks and nothing happens.</p>
<pre><code> public const int DM_ORIENTATION = 0x00000001;
public const int DM_PAPERSIZE = 0x00000002;
public const int DM_PAPERLENGTH = 0x00000004;
public const int DM_PAPERWIDTH... | [
{
"answer_id": 195319,
"author": "tobsen",
"author_id": 27083,
"author_profile": "https://Stackoverflow.com/users/27083",
"pm_score": 2,
"selected": false,
"text": "<p>I can't really help you with the winapi-stuff but if you are using a Nvidia card you may have a look at the <a href=\"ht... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2972/"
] | I'm trying to use the Windows API to set the primary monitor. It doesn't seem to work - my screen just flicks and nothing happens.
```
public const int DM_ORIENTATION = 0x00000001;
public const int DM_PAPERSIZE = 0x00000002;
public const int DM_PAPERLENGTH = 0x00000004;
public const int DM_PAPERWIDTH = 0x00000008;... | I ran into exactly the same problem, both from C# and after following the advice here to try it in C++. I eventually discovered that the thing the Microsoft documentation doesn't make clear is that the request to set the primary monitor will be ignored (but with the operation reported as successful!) unless you also se... |
195,287 | <p>I'd like to get all the permutations of swapped characters pairs of a string. For example:</p>
<p>Base string: <code>abcd</code></p>
<p>Combinations:</p>
<ol>
<li><code>bacd</code></li>
<li><code>acbd</code></li>
<li><code>abdc</code></li>
</ol>
<p>etc.</p>
<h3>Edit</h3>
<p>I want to swap only letters that are next ... | [
{
"answer_id": 195295,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 3,
"selected": true,
"text": "<p>Edit: Markdown hates me today...</p>\n\n<pre><code>$input = \"abcd\";\n$len = strlen($input);\n$output = array();\n\nfor ($i... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27186/"
] | I'd like to get all the permutations of swapped characters pairs of a string. For example:
Base string: `abcd`
Combinations:
1. `bacd`
2. `acbd`
3. `abdc`
etc.
### Edit
I want to swap only letters that are next to each other. Like first with second, second with third, but not third with sixth.
What's the best wa... | Edit: Markdown hates me today...
```
$input = "abcd";
$len = strlen($input);
$output = array();
for ($i = 0; $i < $len - 1; ++$i) {
$output[] = substr($input, 0, $i)
. substr($input, $i + 1, 1)
. substr($input, $i, 1)
. substr($input, $i + 2);
}
print_r($output);
``` |
195,288 | <p>I'm working on an ASP.NET website where I am using an asp:repeater with paging done through a VB.NET code-behind file. I'm having trouble with the database connection though. As far as I can tell, the paging is working, but I can't get the data to be certain.</p>
<p>The database is a Microsoft Access database. The ... | [
{
"answer_id": 195300,
"author": "Sklivvz",
"author_id": 7028,
"author_profile": "https://Stackoverflow.com/users/7028",
"pm_score": 1,
"selected": false,
"text": "<p>If you need help with Connection Strings, this site is the ultimate resource!</p>\n\n<p><a href=\"http://www.connectionst... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17020/"
] | I'm working on an ASP.NET website where I am using an asp:repeater with paging done through a VB.NET code-behind file. I'm having trouble with the database connection though. As far as I can tell, the paging is working, but I can't get the data to be certain.
The database is a Microsoft Access database. The function t... | Problem solved! Pretty much banging my head against the wall now considering how simple it was. It was the Page\_Load, I changed it to the following:
```
Protected Sub Page_Load1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
doPaging()
End Sub
```
And voila, it works!
Also, for the connec... |
195,317 | <p>I am tryiing to create an "add to cart" button for each item that is displayed by an XSLT file. The button must be run at server (VB) and I need to pass parameters into the onlick, so that the requested item is added to the cart. Is this possible, and if so, how should I go about it?</p>
<p>When I try</p>
<pre><co... | [
{
"answer_id": 195384,
"author": "samjudson",
"author_id": 1908,
"author_profile": "https://Stackoverflow.com/users/1908",
"pm_score": 2,
"selected": false,
"text": "<p>XSLT can generate pretty much anything you want - but you need to know what you want to generate first.</p>\n\n<p>In AS... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am tryiing to create an "add to cart" button for each item that is displayed by an XSLT file. The button must be run at server (VB) and I need to pass parameters into the onlick, so that the requested item is added to the cart. Is this possible, and if so, how should I go about it?
When I try
```
<asp:Button id="Bu... | XSLT can generate pretty much anything you want - but you need to know what you want to generate first.
In ASP.Net I would recommend doing this using the CommandArgument and OnCommand event.
```
<asp:Button id="Button123"
Text="Add to Cart"
CommandName="AddToCart"
CommandArgument="123"
OnC... |
195,321 | <p><a href="https://stackoverflow.com/users/9931/ryan-delucchi">Ryan Delucchi</a> asked <a href="https://stackoverflow.com/questions/194698/how-to-load-a-jar-file-at-runtime#194712">here</a> in comment #3 to <a href="https://stackoverflow.com/users/4725/tom-hawtin-tackline">Tom Hawtin</a>'s answer:</p>
<blockquote>
... | [
{
"answer_id": 195328,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 7,
"selected": true,
"text": "<p>The Java API documentation explains why (<a href=\"http://java.sun.com/javase/6/docs/api/java/lang/Class.html#newInstance(... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11813/"
] | [Ryan Delucchi](https://stackoverflow.com/users/9931/ryan-delucchi) asked [here](https://stackoverflow.com/questions/194698/how-to-load-a-jar-file-at-runtime#194712) in comment #3 to [Tom Hawtin](https://stackoverflow.com/users/4725/tom-hawtin-tackline)'s answer:
>
> why is Class.newInstance() "evil"?
>
>
>
this ... | The Java API documentation explains why (<http://java.sun.com/javase/6/docs/api/java/lang/Class.html#newInstance()>):
>
> Note that this method propagates any exception thrown by the nullary constructor, including a checked exception. Use of this method effectively bypasses the compile-time exception checking that wo... |
195,323 | <p>I'd like to read whole content of a text file to a <code>std::string</code> object with c++. </p>
<p>With Python, I can write:</p>
<pre><code>text = open("text.txt", "rt").read()
</code></pre>
<p>It is very simple and elegant. I hate ugly stuff, so I'd like to know - what is the most elegant way to read a text fi... | [
{
"answer_id": 195349,
"author": "sharkin",
"author_id": 7891,
"author_profile": "https://Stackoverflow.com/users/7891",
"pm_score": 2,
"selected": false,
"text": "<p>You seem to speak of elegance as a definite property of \"little code\". This is ofcourse subjective in some extent. Some... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25077/"
] | I'd like to read whole content of a text file to a `std::string` object with c++.
With Python, I can write:
```
text = open("text.txt", "rt").read()
```
It is very simple and elegant. I hate ugly stuff, so I'd like to know - what is the most elegant way to read a text file with C++?
Thanks. | There are many ways, you pick which is the most elegant for you.
Reading into char\*:
```
ifstream file ("file.txt", ios::in|ios::binary|ios::ate);
if (file.is_open())
{
file.seekg(0, ios::end);
size = file.tellg();
char *contents = new char [size];
file.seekg (0, ios::beg);
file.read (contents, s... |
195,363 | <p>In IE when I insert text into a <code><pre></code> tag the newlines are ignored:</p>
<pre><code><pre id="putItHere"></pre>
<script>
function putText() {
document.getElementById("putItHere").innerHTML = "first line\nsecond line";
}
</script>
</code></pre>
<p>Using <code>\r\n</code>... | [
{
"answer_id": 195370,
"author": "GavinCattell",
"author_id": 21644,
"author_profile": "https://Stackoverflow.com/users/21644",
"pm_score": 2,
"selected": false,
"text": "<p><code><br/></code> shoud only output one line in all browsers. Of course remove the \\n as well, code should... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27198/"
] | In IE when I insert text into a `<pre>` tag the newlines are ignored:
```
<pre id="putItHere"></pre>
<script>
function putText() {
document.getElementById("putItHere").innerHTML = "first line\nsecond line";
}
</script>
```
Using `\r\n` instead of a plain `\n` does not work.
`<br/>` does work but inserts an ext... | These [quirksmode.org bug report and comments](http://www.quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html) about innerHTML behaviour of Internet Explorer could help:
"*IE applies **HTML normalization** to the data that is assigned to the innerHTML property. This causes incorrect display of whitespace i... |
195,368 | <p>How is it possible for this to be true</p>
<pre><code>XmlDocument d = BuildReportXML(schema);
DataSet ds = new DataSet();
ds.ReadXmlSchema(schema);
ds.ReadXml(new XmlNodeReader(d));
</code></pre>
<p>Schema is the schema location that I apply to the XmlDocument before I start setting data, assuring that all the col... | [
{
"answer_id": 195370,
"author": "GavinCattell",
"author_id": 21644,
"author_profile": "https://Stackoverflow.com/users/21644",
"pm_score": 2,
"selected": false,
"text": "<p><code><br/></code> shoud only output one line in all browsers. Of course remove the \\n as well, code should... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11137/"
] | How is it possible for this to be true
```
XmlDocument d = BuildReportXML(schema);
DataSet ds = new DataSet();
ds.ReadXmlSchema(schema);
ds.ReadXml(new XmlNodeReader(d));
```
Schema is the schema location that I apply to the XmlDocument before I start setting data, assuring that all the columns are of the correct ty... | These [quirksmode.org bug report and comments](http://www.quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html) about innerHTML behaviour of Internet Explorer could help:
"*IE applies **HTML normalization** to the data that is assigned to the innerHTML property. This causes incorrect display of whitespace i... |
195,377 | <p>I'm trying to debug an application (under PostgreSQL) and came across the following error:
"current transaction is aborted, commands ignored".</p>
<p>As far as I can understand a "transaction" is just a notion related to the underlying database connection.</p>
<p>If the connection has an auto commit "false", you c... | [
{
"answer_id": 195383,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 3,
"selected": true,
"text": "<p>That error means that one of the queries sent in a transaction has failed, so the rest of the queries are ignored ... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3887/"
] | I'm trying to debug an application (under PostgreSQL) and came across the following error:
"current transaction is aborted, commands ignored".
As far as I can understand a "transaction" is just a notion related to the underlying database connection.
If the connection has an auto commit "false", you can execute querie... | That error means that one of the queries sent in a transaction has failed, so the rest of the queries are ignored until the end of the current transaction (which will automatically be a rollback). To PostgreSQL the transaction has failed, and it will be rolled back in any case after the error with one exception. You ha... |
195,410 | <p>I am interested in what methods of logging is frequent in an Oracle database.
Our method is the following:</p>
<p>We create a log table for the table to be logged. The log table contains all the columns of the original table plus some special fields including timestamp, modification type (insert, update, delete), m... | [
{
"answer_id": 196331,
"author": "Matthew Watson",
"author_id": 3839,
"author_profile": "https://Stackoverflow.com/users/3839",
"pm_score": 0,
"selected": false,
"text": "<p>log4plsql is a completely different thing, its for logging debug info from PL/SQL</p>\n\n<p>For what you want, you... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21047/"
] | I am interested in what methods of logging is frequent in an Oracle database.
Our method is the following:
We create a log table for the table to be logged. The log table contains all the columns of the original table plus some special fields including timestamp, modification type (insert, update, delete), modifier's ... | It sounds like you are after 'auditing'. Oracle has a built-in feature called Fine Grain Auditing (FGA). In a nutshell you can audit everything or specific conditions. What is really cool is you can 'audit' selects as well as transactions. Simple command to get started with auditing:
```
audit UPDATE on SCOTT.EMP by a... |
195,437 | <p>Would it be possible to execute a JSP page and capture its output outside of a web application?
Mode specifically, in my case there still exists a usual web application, but it loads JSP pages not from its classpath, but from an arbitrary source. It seems like I cannot simply get RequestDispatcher and point it to ... | [
{
"answer_id": 195447,
"author": "Rodger Cooley",
"author_id": 5667,
"author_profile": "https://Stackoverflow.com/users/5667",
"pm_score": 0,
"selected": false,
"text": "<p>Correct me if I'm wrong, but I think you mean you want to capture the HTML... not the JSP. A JSP is processed (int... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6954/"
] | Would it be possible to execute a JSP page and capture its output outside of a web application?
Mode specifically, in my case there still exists a usual web application, but it loads JSP pages not from its classpath, but from an arbitrary source. It seems like I cannot simply get RequestDispatcher and point it to a JS... | I think you're better off with a templating engine like velocity. This provides a clean infrastructure for dynamic content that's clearly different from the jsp/servlet stuff that you are asking fore.
That said, I've seen applications that copy jsps into their deployed directory in order for the container to pick them... |
195,451 | <p>I use <code>public boolean mouseDown(Event ev, int x, int y)</code> to detect a click of the mouse.<br>
I can distinguish between the right mouse button (ev.metaDown() is true) and the left and middle.</p>
<p>How can i differentiate the left from the middle button?
Or if it is impossible with mouseDown, what should... | [
{
"answer_id": 195459,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>This might do it:</p>\n\n<p><a href=\"http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/SwingUtilities.html#isMiddleMouse... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12860/"
] | I use `public boolean mouseDown(Event ev, int x, int y)` to detect a click of the mouse.
I can distinguish between the right mouse button (ev.metaDown() is true) and the left and middle.
How can i differentiate the left from the middle button?
Or if it is impossible with mouseDown, what should i use? | Try using [ALT\_MASK](http://java.sun.com/javase/6/docs/api/java/awt/Event.html#ALT_MASK):
>
> This flag indicates that the Alt key was down when the event occurred. For mouse events, this flag indicates that the middle mouse button was pressed or released.
>
>
>
So your code might be:
```
if (ev.modifiers & Eve... |
195,454 | <p>How can I <strong>protect a ClickOnce deployed application with a password</strong>? Do I have to change the IIS settings of the web or is there a way to do it programmatically? I'm using Visual Studio 2005 (.NET 2.0).</p>
<p>If I have to use web credentials, are auto-updates of the application still possible?</p>
... | [
{
"answer_id": 195471,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not sure it can be done. I may be wrong, but I didn't think that would work. Apart from anything else, even if... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195454",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6461/"
] | How can I **protect a ClickOnce deployed application with a password**? Do I have to change the IIS settings of the web or is there a way to do it programmatically? I'm using Visual Studio 2005 (.NET 2.0).
If I have to use web credentials, are auto-updates of the application still possible?
Would be great if you coul... | I found a possible solution by myself in this MSDN article: [ClickOnce Deployment and Security](http://msdn.microsoft.com/en-us/library/76e4d2xw.aspx).
ASP.NET Form-Based Authentication
---------------------------------
If you want to control which deployments each user can access, you should **not enable anonymous a... |
195,455 | <p>I am writing a compiler in F# and I want to be able to access the <a href="http://msdn.microsoft.com/en-us/library/ms404384.aspx" rel="nofollow noreferrer">unmanaged metadata COM interfaces</a> in the .net runtime. Before anybody mentions it, <em>Reflection.Emit is not suitable for my purposes</em>, nor do I want to... | [
{
"answer_id": 195471,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not sure it can be done. I may be wrong, but I didn't think that would work. Apart from anything else, even if... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3394/"
] | I am writing a compiler in F# and I want to be able to access the [unmanaged metadata COM interfaces](http://msdn.microsoft.com/en-us/library/ms404384.aspx) in the .net runtime. Before anybody mentions it, *Reflection.Emit is not suitable for my purposes*, nor do I want to use any other method than the metadata COM int... | I found a possible solution by myself in this MSDN article: [ClickOnce Deployment and Security](http://msdn.microsoft.com/en-us/library/76e4d2xw.aspx).
ASP.NET Form-Based Authentication
---------------------------------
If you want to control which deployments each user can access, you should **not enable anonymous a... |
195,468 | <p>Basically, I have a class with 2 methods: one to serialize an object into an XML file and another to read an object from XML.
Here is an example of synchronized part from the method that restores an object:</p>
<pre><code> public T restore(String from) throws Exception {
// variables declaration
syn... | [
{
"answer_id": 195474,
"author": "Itay Maman",
"author_id": 27198,
"author_profile": "https://Stackoverflow.com/users/27198",
"pm_score": 2,
"selected": false,
"text": "<p>Given that the some parts of your code are missing, my bet is that the problem lies with synchronizing on a string. ... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15187/"
] | Basically, I have a class with 2 methods: one to serialize an object into an XML file and another to read an object from XML.
Here is an example of synchronized part from the method that restores an object:
```
public T restore(String from) throws Exception {
// variables declaration
synchronized (fro... | 1.
Yes, it's OK to synchronize on a String, however you'd need to synchronize on the string.[intern()](http://java.sun.com/javase/6/docs/api/java/lang/String.html#intern()) in order to always get the same Object
```
StringBuffer sb = new StringBuffer(); sb.append("a").append("b");
String a = new String(sb.toString());... |
195,483 | <p>Is there an easy way of programmatically checking if a serial COM port is already open/being used?</p>
<p>Normally I would use:</p>
<pre><code>try
{
// open port
}
catch (Exception ex)
{
// handle the exception
}
</code></pre>
<p>However, I would like to programatically check so I can attempt to use anoth... | [
{
"answer_id": 195493,
"author": "Fionn",
"author_id": 21566,
"author_profile": "https://Stackoverflow.com/users/21566",
"pm_score": 5,
"selected": true,
"text": "<p>I needed something similar some time ago, to search for a device.</p>\n\n<p>I obtained a list of available COM ports and t... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | Is there an easy way of programmatically checking if a serial COM port is already open/being used?
Normally I would use:
```
try
{
// open port
}
catch (Exception ex)
{
// handle the exception
}
```
However, I would like to programatically check so I can attempt to use another COM port or some such. | I needed something similar some time ago, to search for a device.
I obtained a list of available COM ports and then simply iterated over them, if it didn't throw an exception i tried to communicate with the device. A bit rough but working.
```
var portNames = SerialPort.GetPortNames();
foreach(var port in portNames)... |
195,537 | <p>I am working on an implementation for RSS feeds for a collaboration platform.
Say there are several thousands of different collaboration rooms where users can share information, and each needs to publish an RSS feed with news, changes, etc...</p>
<p>Using a plain servlet (i.e. <a href="http://www.site.com/RSSServle... | [
{
"answer_id": 195566,
"author": "Shimi Bandiel",
"author_id": 15100,
"author_profile": "https://Stackoverflow.com/users/15100",
"pm_score": 2,
"selected": false,
"text": "<p>You should try the <a href=\"https://rome.dev.java.net/\" rel=\"nofollow noreferrer\">ROME</a> framework. It is e... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24545/"
] | I am working on an implementation for RSS feeds for a collaboration platform.
Say there are several thousands of different collaboration rooms where users can share information, and each needs to publish an RSS feed with news, changes, etc...
Using a plain servlet (i.e. <http://www.site.com/RSSServlet/?id=roomID>) is ... | You say that a new http request to your servlet "will trigger the entire servlet lifecycle", which as Alexander has already pointed out, isn't exactly true. It will simply trigger another method call to your `doGet()` or `doPost()` methods.
I think what you mean to say is that if you have a `doGet`/`doPost` method wh... |
195,548 | <p>Due to company constraints out of my control, I have the following scenario:</p>
<p>A COM library that defines the following interface (no CoClass, just the interface):</p>
<pre><code>[
object,
uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx),
dual,
nonextensible,
helpstring("IService Interface"),
... | [
{
"answer_id": 195861,
"author": "Richard Nienaber",
"author_id": 9539,
"author_profile": "https://Stackoverflow.com/users/9539",
"pm_score": 1,
"selected": false,
"text": "<p>You may have to specify additional attributes on your class to have it marshal correctly. I would look through a... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25565/"
] | Due to company constraints out of my control, I have the following scenario:
A COM library that defines the following interface (no CoClass, just the interface):
```
[
object,
uuid(xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx),
dual,
nonextensible,
helpstring("IService Interface"),
pointer_default(uni... | It could be a problem with the name *IServiceProvider*. Check that you haven't already imported an interface with the same name.
When I create an COM Interface library using your IDL, and then try to import it from another client, I get the warning:
```
Warning 65 warning C4192: automatically excluding 'IServiceProv... |
195,549 | <p>Here's a problem I keep running into:</p>
<p>I have a lot of situations where I need to display some text with a styled container like so:</p>
<pre><code><mx:Canvas>
<mx:Text text="{text}" left="5" verticalCenter="0" right="5" />
</mx:Canvas>
</code></pre>
<p>As you can see - the text i... | [
{
"answer_id": 195561,
"author": "Stephen Cox",
"author_id": 534,
"author_profile": "https://Stackoverflow.com/users/534",
"pm_score": 1,
"selected": false,
"text": "<p>Take a look at the TextArea component.</p>\n"
},
{
"answer_id": 195570,
"author": "James Fassett",
"aut... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3435/"
] | Here's a problem I keep running into:
I have a lot of situations where I need to display some text with a styled container like so:
```
<mx:Canvas>
<mx:Text text="{text}" left="5" verticalCenter="0" right="5" />
</mx:Canvas>
```
As you can see - the text in constrained by the left and right margins of the ... | The Text component needs a width if you want it to automatically wrap for you. If you used a string with newlines in it it will work grow as you expected without a width. For you, use:
**Edit:** Ok, you want it centered in a canvas of varying size. Then you can:
```
<mx:HBox
width="500"
paddingLeft="5"
p... |
195,578 | <p>I got a problem like this (this is html/css menu):</p>
<p>Eshop | Another eshop | Another eshop</p>
<p>Client wants it work like this:</p>
<p>User comes to website, clicks on Eshop. Eshop changes to red color with red box outline. User decides to visit Another eshop, so Eshop will go back to normaln color without... | [
{
"answer_id": 195579,
"author": "Joe Skora",
"author_id": 14057,
"author_profile": "https://Stackoverflow.com/users/14057",
"pm_score": 1,
"selected": false,
"text": "<p>You can do this with CSS classes. For example, a <em>selected</em> class could identify the current shop, changing t... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21209/"
] | I got a problem like this (this is html/css menu):
Eshop | Another eshop | Another eshop
Client wants it work like this:
User comes to website, clicks on Eshop. Eshop changes to red color with red box outline. User decides to visit Another eshop, so Eshop will go back to normaln color without red box outline, and an... | The same that Joe Skora has written but more specific:
```
.red {
outline-color:red;
outline-width:10px;
}
```
Now you could use Javascript (in this example using [jQuery](http://jquery.com)) in the click-event-handler:
```
$('.red').removeClass('red'); // removes class red from all items with class red
$(t... |
195,582 | <p>I am taking my first steps programming in Lua and get this error when I run my script:</p>
<pre><code>attempt to index upvalue 'base' (a function value)
</code></pre>
<p>It's probably due to something very basic that I haven't grasped yet, but I can't find any good information about it when googling. Could someone... | [
{
"answer_id": 195599,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 5,
"selected": true,
"text": "<p>In this case it looks <code>base</code> is a function, but you're trying to index it like a table (eg. <code>base[5]</code> ... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22283/"
] | I am taking my first steps programming in Lua and get this error when I run my script:
```
attempt to index upvalue 'base' (a function value)
```
It's probably due to something very basic that I haven't grasped yet, but I can't find any good information about it when googling. Could someone explain to me what it mea... | In this case it looks `base` is a function, but you're trying to index it like a table (eg. `base[5]` or `base.somefield`).
The 'upvalue' part is just telling you what kind of variable `base` is, in this case an upvalue (aka external local variable). |
195,587 | <p>Got a class that serializes into xml with XMLEncoder nicely with all the variables there. Except for the one that holds <em>java.util.Locale</em>. What could be the trick?</p>
| [
{
"answer_id": 195646,
"author": "Miguel Ping",
"author_id": 22992,
"author_profile": "https://Stackoverflow.com/users/22992",
"pm_score": 0,
"selected": false,
"text": "<p>Sorry, don't you mean <em>java.util.Locale</em>? The javadocs say that <em>java.util.Locale</em> implements <em>Ser... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15187/"
] | Got a class that serializes into xml with XMLEncoder nicely with all the variables there. Except for the one that holds *java.util.Locale*. What could be the trick? | The problem is that java.util.Locale is not a [bean](http://java.sun.com/javase/technologies/desktop/javabeans/docs/spec.html). From the [XMLEncoder](http://java.sun.com/javase/6/docs/api/index.html?java/beans/XMLEncoder.html) doc:
>
> The XMLEncoder class is a
> complementary alternative to the
> ObjectOutputStrea... |
195,626 | <p>I have a python module that makes use of a huge dictionary global variable, currently I put the computation code in the top section, every first time import or reload of the module takes more then one minute which is totally unacceptable. How can I save the computation result somewhere so that the next import/reload... | [
{
"answer_id": 195645,
"author": "David Grant",
"author_id": 26829,
"author_profile": "https://Stackoverflow.com/users/26829",
"pm_score": 2,
"selected": false,
"text": "<p>I assume you've pasted the dict literal into the source, and that's what's taking a minute? I don't know how to get... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1925263/"
] | I have a python module that makes use of a huge dictionary global variable, currently I put the computation code in the top section, every first time import or reload of the module takes more then one minute which is totally unacceptable. How can I save the computation result somewhere so that the next import/reload do... | Just to clarify: the code in the body of a module is *not* executed every time the module is imported - it is run only once, after which future imports find the already created module, rather than recreating it. Take a look at sys.modules to see the list of cached modules.
However, if your problem is the time it takes... |
195,632 | <p>So, I can create an input button with an image using</p>
<pre><code><INPUT type="image" src="/images/Btn.PNG" value="">
</code></pre>
<p>But, I can't get the same behavior using CSS. For instance, I've tried</p>
<pre><code><INPUT type="image" class="myButton"... | [
{
"answer_id": 195637,
"author": "ceejayoz",
"author_id": 1902010,
"author_profile": "https://Stackoverflow.com/users/1902010",
"pm_score": 8,
"selected": true,
"text": "<p>If you're wanting to style the button using CSS, make it a type=\"submit\" button instead of type=\"image\". type=\... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1179/"
] | So, I can create an input button with an image using
```
<INPUT type="image" src="/images/Btn.PNG" value="">
```
But, I can't get the same behavior using CSS. For instance, I've tried
```
<INPUT type="image" class="myButton" value="">
```
where "myButton" is defined in the CSS file as
```
.myButton {
backgro... | If you're wanting to style the button using CSS, make it a type="submit" button instead of type="image". type="image" expects a SRC, which you can't set in CSS.
Note that Safari won't let you style any button in the manner you're looking for. If you need Safari support, you'll need to place an image and have an onclic... |
195,635 | <p>I am trying to figure out Messagebox( ownerWindow, ... ).</p>
<p>Using reflector I see that the ownerWindow defaults to the ActiveWindow for the thread.</p>
<p>So the only time I need the ownerWindow parameter is to call Show from another thread. </p>
<p>However when I try this, I get a cross threading exception... | [
{
"answer_id": 195640,
"author": "Patrik Svensson",
"author_id": 936,
"author_profile": "https://Stackoverflow.com/users/936",
"pm_score": 2,
"selected": false,
"text": "<p>You will have to do a BeginInvoke to marshal the call to the UI thread.</p>\n\n<p>The code below is a simple exampl... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14841/"
] | I am trying to figure out Messagebox( ownerWindow, ... ).
Using reflector I see that the ownerWindow defaults to the ActiveWindow for the thread.
So the only time I need the ownerWindow parameter is to call Show from another thread.
However when I try this, I get a cross threading exception.
```
private void b... | You may want to take a look at [Win32 Window Hierarchy and Styles](http://msdn.microsoft.com/en-us/library/ms997562.aspx) to understand the difference between owner and parent windows. It's not always necessary that the ActiveWindows needs to own the messagebox, I've worked on application where the ActiveWindow was not... |
195,639 | <p>I need a way to bind POJO objects to an external entity, that could be XML, YAML, structured text or anything easy to write and maintain in order to create Mock data for unit testing and TDD. Below are some libraries I tried, but the main problems with them were that I am stuck (for at least more 3 months) to Java 1... | [
{
"answer_id": 195680,
"author": "questzen",
"author_id": 25210,
"author_profile": "https://Stackoverflow.com/users/25210",
"pm_score": 3,
"selected": true,
"text": "<p>If the objects to be populated are simple beans it may be a good idea to look at apache common's BeanUtils class. The p... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14540/"
] | I need a way to bind POJO objects to an external entity, that could be XML, YAML, structured text or anything easy to write and maintain in order to create Mock data for unit testing and TDD. Below are some libraries I tried, but the main problems with them were that I am stuck (for at least more 3 months) to Java 1.4.... | If the objects to be populated are simple beans it may be a good idea to look at apache common's BeanUtils class. The populate() method might suit the described cases. Generally dependency injection frameworks like Spring can be very useful, but that might not be answer for the current problem. For input in form of xml... |
195,641 | <p>During the installation of Apache2 I got the following message into cmd window:</p>
<blockquote>
<p>Installing the Apache2.2 service The
Apache2.2 service is successfully
installed. Testing httpd.conf....</p>
<p>Errors reported here must be corrected
before the service can be started.
httpd.exe: Coul... | [
{
"answer_id": 195654,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 8,
"selected": true,
"text": "<p>There is some other program listening on port 80, usual suspects are</p>\n\n<ol>\n<li>Skype (Listens on port 80)</... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16039/"
] | During the installation of Apache2 I got the following message into cmd window:
>
> Installing the Apache2.2 service The
> Apache2.2 service is successfully
> installed. Testing httpd.conf....
>
>
> Errors reported here must be corrected
> before the service can be started.
> httpd.exe: Could not reliably
> de... | There is some other program listening on port 80, usual suspects are
1. Skype (Listens on port 80)
2. NOD32 (Add Apache to the IMON exceptions' list for it to allow apache to bind)
3. Some other antivirus (Same as above)
Way to correct it is either shutting down the program that's using the port 80 or configure it to... |
195,648 | <p>What's an example of something dangerous that would not be caught by the code below?</p>
<p>EDIT: After some of the comments I added another line, commented below. See Vinko's comment in David Grant's answer. So far only Vinko has answered the question, which asks for specific examples that would slip through th... | [
{
"answer_id": 195662,
"author": "David Grant",
"author_id": 26829,
"author_profile": "https://Stackoverflow.com/users/26829",
"pm_score": 2,
"selected": false,
"text": "<pre><code><a href=\"javascript:document.writeln('on' + 'unload' + ' and more malicious stuff here...');\">examp... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9328/"
] | What's an example of something dangerous that would not be caught by the code below?
EDIT: After some of the comments I added another line, commented below. See Vinko's comment in David Grant's answer. So far only Vinko has answered the question, which asks for specific examples that would slip through this function. ... | It's never enough – whitelist, don't blacklist
----------------------------------------------
For example `javascript:` pseudo-URL can be obfuscated with HTML entities, you've forgotten about `<embed>` and there are dangerous CSS properties like `behavior` and `expression` in IE.
There are [countless ways](http://ha... |
195,655 | <p>Is it possible to copy a single file to multiple directories using the cp command ?</p>
<p>I tried the following , which did not work: </p>
<pre><code>cp file1 /foo/ /bar/
cp file1 {/foo/,/bar}
</code></pre>
<p>I know it's possible using a for loop, or find. But is it possible using the gnu cp command?</p>
| [
{
"answer_id": 195663,
"author": "moonshadow",
"author_id": 11834,
"author_profile": "https://Stackoverflow.com/users/11834",
"pm_score": 8,
"selected": true,
"text": "<p>No, <code>cp</code> can copy multiple sources but will only copy to a single destination. You need to arrange to invo... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13523/"
] | Is it possible to copy a single file to multiple directories using the cp command ?
I tried the following , which did not work:
```
cp file1 /foo/ /bar/
cp file1 {/foo/,/bar}
```
I know it's possible using a for loop, or find. But is it possible using the gnu cp command? | No, `cp` can copy multiple sources but will only copy to a single destination. You need to arrange to invoke `cp` multiple times - once per destination - for what you want to do; using, as you say, a loop or some other tool. |
195,667 | <p>I have an iframe and couple of tables on my aspx page. Now when the page loads these tables are hidden. The iframe is used to upload file to database. Depending on the result of the event I have to show a particular table on my main page (these tables basically have "Retry","next" buttons...depending on whether or n... | [
{
"answer_id": 195675,
"author": "Dimitry",
"author_id": 27073,
"author_profile": "https://Stackoverflow.com/users/27073",
"pm_score": 0,
"selected": false,
"text": "<p>I am not sure what your problem is, but perhaps your approach should be a little different. Try putting code into the i... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an iframe and couple of tables on my aspx page. Now when the page loads these tables are hidden. The iframe is used to upload file to database. Depending on the result of the event I have to show a particular table on my main page (these tables basically have "Retry","next" buttons...depending on whether or not ... | mmm you said you're on aspx page,
I suppose that the iframe do a postback, so for this it reload the page.
If you can't avoid the postback, you've to set a flag on the main page just before posting back, and check against that while you're loading...
...something like:
```
mainpage.waitTillPostBack = true
YourFunct... |
195,682 | <p>Here's my issue, I'd like to mock a class that creates a thread at initialization and closes it at destruction. There's no reason for my mock class to actually create and close threads. But, to mock a class, I have inherit from it. When I create a new instance of my mock class, the base classes constructor is cal... | [
{
"answer_id": 195747,
"author": "hazzen",
"author_id": 5066,
"author_profile": "https://Stackoverflow.com/users/5066",
"pm_score": 5,
"selected": true,
"text": "<p>You instead make an interface that describes the type, and have both the real class and the mock class inherit from that. S... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23071/"
] | Here's my issue, I'd like to mock a class that creates a thread at initialization and closes it at destruction. There's no reason for my mock class to actually create and close threads. But, to mock a class, I have inherit from it. When I create a new instance of my mock class, the base classes constructor is called, c... | You instead make an interface that describes the type, and have both the real class and the mock class inherit from that. So if you had:
```
class RAIIClass {
public:
RAIIClass(Foo* f);
~RAIIClass();
bool DoOperation();
private:
...
};
```
You would make an interface like:
```
class MockableInterface {
... |
195,688 | <p>I have a string(char*), and i need to find its underlying datatype such as int, float, double, short, long, or just a character array containing alphabets with or with out digits(like varchar in SQL).
For ex: </p>
<pre><code> char* str1 = "12312"
char* str2 = "231.342"
char* str3 = "234234243234"
cha... | [
{
"answer_id": 195732,
"author": "Pitarou",
"author_id": 1260685,
"author_profile": "https://Stackoverflow.com/users/1260685",
"pm_score": 1,
"selected": false,
"text": "<p>First, check whether the problem hasn't already been solved for you. It could be that your library functions for c... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195688",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27221/"
] | I have a string(char\*), and i need to find its underlying datatype such as int, float, double, short, long, or just a character array containing alphabets with or with out digits(like varchar in SQL).
For ex:
```
char* str1 = "12312"
char* str2 = "231.342"
char* str3 = "234234243234"
char* str4 = "43... | In C (not in C++), I would use a combination of strtod/strol and max values from <limits.h> and <float.h>:
```
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
#include <float.h>
/* Now, we know the following values:
INT_MAX, INT_MIN, SHRT_MAX, SHRT_MIN, CHAR_MAX, CHAR_MIN, etc. */
typedef unio... |
195,696 | <p>While researching this issue, I found multiple mentions of the following scenario online, invariably as unanswered questions on programming forums. I hope that posting this here will at least serve to document my findings.</p>
<p>First, the symptom: While running pretty standard code that uses waveOutWrite() to out... | [
{
"answer_id": 199762,
"author": "dmazzoni",
"author_id": 7193,
"author_profile": "https://Stackoverflow.com/users/7193",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure about this particular problem, but have you considered using a higher-level, cross-platform audio library? The... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9047/"
] | While researching this issue, I found multiple mentions of the following scenario online, invariably as unanswered questions on programming forums. I hope that posting this here will at least serve to document my findings.
First, the symptom: While running pretty standard code that uses waveOutWrite() to output PCM au... | You're not alone with this issue:
<http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100589> |
195,697 | <p>I have an XML file, which I open in F# like this:</p>
<pre><code>let Bookmarks(xmlFile:string) =
let xml = XDocument.Load(xmlFile)
</code></pre>
<p>Once I have the XDocument I need to navigate it using LINQ to XML and extract all specific tags. Part of my solution is:</p>
<pre><code>let xname (tag:string) = ... | [
{
"answer_id": 195859,
"author": "Brian",
"author_id": 19299,
"author_profile": "https://Stackoverflow.com/users/19299",
"pm_score": 2,
"selected": false,
"text": "<p>Caveat: I've never done linq-to-xml before, but looking through other posts on the topic, this snippet has some F# code t... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18619/"
] | I have an XML file, which I open in F# like this:
```
let Bookmarks(xmlFile:string) =
let xml = XDocument.Load(xmlFile)
```
Once I have the XDocument I need to navigate it using LINQ to XML and extract all specific tags. Part of my solution is:
```
let xname (tag:string) = XName.Get(tag)
let tagUrl (tag:XEleme... | ```
#light
open System
open System.Xml.Linq
let xname s = XName.Get(s)
let bookmarks (xmlFile : string) =
let xd = XDocument.Load xmlFile
xd.Descendants <| xname "bookmark"
```
This will find all the descendant elements of "bookmark". If you only want direct descendants, use the Elements method (xd.Root.Ele... |
195,709 | <p>After switching back and forth between several scripting languages this week, I found myself thinking how similar they all are. Yet I'm always reaching for Google (or nowadays SO) to remember details like what the local equivalents of "instanceof" and "endswith" are, or the right syntax to declare an interface, or ... | [
{
"answer_id": 195715,
"author": "Marcin",
"author_id": 21640,
"author_profile": "https://Stackoverflow.com/users/21640",
"pm_score": 2,
"selected": false,
"text": "<p>I would suggest that the main problem is recognising what the syntax of each statement is supposed to be. </p>\n\n<p>In ... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4540/"
] | After switching back and forth between several scripting languages this week, I found myself thinking how similar they all are. Yet I'm always reaching for Google (or nowadays SO) to remember details like what the local equivalents of "instanceof" and "endswith" are, or the right syntax to declare an interface, or what... | I would suggest that the main problem is recognising what the syntax of each statement is supposed to be.
In any case, what is the point? Almost all scripting languages have facilities to do much the same things, which is why people tend to master one that they use consistently, and stick with it. |
195,714 | <p>I'm writing an editor for large <em>archive files</em> (see below) of 4GB+, in native&managed C++.</p>
<p>For accessing the files, I'm using <em>file mapping</em> (see below) like any sane person. This is absolutely great for reading data, but a problem arises in actually editing the archive.
File mapping does ... | [
{
"answer_id": 195757,
"author": "Diomidis Spinellis",
"author_id": 20520,
"author_profile": "https://Stackoverflow.com/users/20520",
"pm_score": 2,
"selected": false,
"text": "<p>What do you mean by 'editor software'? If this is a text file, have you tried existing production-quality ... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15477/"
] | I'm writing an editor for large *archive files* (see below) of 4GB+, in native&managed C++.
For accessing the files, I'm using *file mapping* (see below) like any sane person. This is absolutely great for reading data, but a problem arises in actually editing the archive.
File mapping does not allow resizing a file wh... | What I do is to close view handle(s) and FileMapping handle, set the file size then reopen mapping / view handles.
```
// Open memory mapped file
HANDLE FileHandle = ::CreateFileW(file_name, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
size_t Size = ::GetFileSize(FileHandle, 0);
HANDLE MappingHa... |
195,740 | <p>I'm writing a Rails application, but can't seem to find how to do relative time, i.e. if given a certain Time class, it can calculate "30 seconds ago" or "2 days ago" or if it's longer than a month "9/1/2008", etc.</p>
| [
{
"answer_id": 195743,
"author": "TonyLa",
"author_id": 1295,
"author_profile": "https://Stackoverflow.com/users/1295",
"pm_score": 4,
"selected": false,
"text": "<p>You can use the arithmetic operators to do relative time.</p>\n\n<pre><code>Time.now - 2.days \n</code></pre>\n\n<p>Will g... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm writing a Rails application, but can't seem to find how to do relative time, i.e. if given a certain Time class, it can calculate "30 seconds ago" or "2 days ago" or if it's longer than a month "9/1/2008", etc. | Sounds like you're looking for the [`time_ago_in_words`](http://apidock.com/rails/ActionView/Helpers/DateHelper/time_ago_in_words) method (or [`distance_of_time_in_words`](http://apidock.com/rails/ActionView/Helpers/DateHelper/distance_of_time_in_words)), from ActiveSupport. Call it like this:
```
<%= time_ago_in_word... |
195,741 | <p>I'm trying to compile/link a <strong>very</strong> old piece of software on a linux system and I can't for some reason link with a shared library that's installed on my system.</p>
<p>I get the following error from the linker:</p>
<pre><code>/usr/bin/ld: cannot find -lXaw
</code></pre>
<p>However, the lib itself ... | [
{
"answer_id": 195762,
"author": "ejgottl",
"author_id": 9808,
"author_profile": "https://Stackoverflow.com/users/9808",
"pm_score": 3,
"selected": true,
"text": "<p>The linker may be looking, literally, for \"libXaw.so\". Is that in /usr/lib? If not, you could try adding it as another... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15955/"
] | I'm trying to compile/link a **very** old piece of software on a linux system and I can't for some reason link with a shared library that's installed on my system.
I get the following error from the linker:
```
/usr/bin/ld: cannot find -lXaw
```
However, the lib itself is installed. If I run
```
ldconfig -v | gre... | The linker may be looking, literally, for "libXaw.so". Is that in /usr/lib? If not, you could try adding it as another soft link from libXaw7.so.7.0.0. |
195,742 | <p>I can run the server on my local machine and connect to it on the same machine, but when I try to connect to it from a different computer over the internet, there is not sign of activity on my server, nor a response from the server on the computer I'm testing it on. I've tried both XP and Vista, turn off firewalls, ... | [
{
"answer_id": 195746,
"author": "Justin Bozonier",
"author_id": 9401,
"author_profile": "https://Stackoverflow.com/users/9401",
"pm_score": -1,
"selected": false,
"text": "<p>If you are trying to host at home, your ISP may be restricting you.</p>\n"
},
{
"answer_id": 195749,
... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22582/"
] | I can run the server on my local machine and connect to it on the same machine, but when I try to connect to it from a different computer over the internet, there is not sign of activity on my server, nor a response from the server on the computer I'm testing it on. I've tried both XP and Vista, turn off firewalls, ope... | I think that the problem is in your router, not your computer. When packets come from the Internet, it should be routed to an specific server. You have to configure your router to redirect the traffic on port `3326` to your server. |
195,764 | <p>Here's the XML file i'm working on:</p>
<pre><code><list>
<activity>swimming</activity>
<activity>running</activity>
<activity>soccer</activity>
</list>
</code></pre>
<p>The index.php, page that shows the list of activities with checkboxes, a button to de... | [
{
"answer_id": 195774,
"author": "Czimi",
"author_id": 3906,
"author_profile": "https://Stackoverflow.com/users/3906",
"pm_score": 3,
"selected": true,
"text": "<p>the DOMNodeList items are indexed starting with 0;\nYou need to move the $count++ to the end of the while loop in the output... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27090/"
] | Here's the XML file i'm working on:
```
<list>
<activity>swimming</activity>
<activity>running</activity>
<activity>soccer</activity>
</list>
```
The index.php, page that shows the list of activities with checkboxes, a button to delete the checked activities, and a field to add new activities:
```
<html... | the DOMNodeList items are indexed starting with 0;
You need to move the $count++ to the end of the while loop in the output step. |
195,768 | <p>I'm in search of a JavaScript month selection tool. I'm already using jQuery on the website, so if it were a jQuery plugin, that would fit nicely. I'm open to other options, as well.</p>
<p>Basically, I'm after a simplified version of the <a href="http://docs.jquery.com/UI/Datepicker" rel="noreferrer">jQuery UI Dat... | [
{
"answer_id": 196077,
"author": "Paolo Bergantino",
"author_id": 16417,
"author_profile": "https://Stackoverflow.com/users/16417",
"pm_score": 2,
"selected": false,
"text": "<p>I used <a href=\"http://www.mattkruse.com/javascript/calendarpopup/\" rel=\"nofollow noreferrer\">this script<... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195768",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/751/"
] | I'm in search of a JavaScript month selection tool. I'm already using jQuery on the website, so if it were a jQuery plugin, that would fit nicely. I'm open to other options, as well.
Basically, I'm after a simplified version of the [jQuery UI Date Picker](http://docs.jquery.com/UI/Datepicker). I don't care about the d... | To anyone *still* looking forward into this (as I was), here is an beautiful, easy to use, jQuery UI compatible, well documented, tested alternative:

Its default usage is simple as doing the following:
```
$("input[type='month']").MonthPicker();
```
* [G... |
195,794 | <p>Assuming Visual C/C++ 6, I have a complex data structure of 22399 elements that looks like this:</p>
<pre><code>{
{ "(SAME", "AS", "U+4E18)", "HILLOCK", "OR", "MOUND"},
{ "TO", "LICK;", {1, 1, 0}, "TASTE,", "A", "MAT,", "BAMBOO", "BARK"},
{ "(J)", "NON-STANDARD", "FORM", "OF", "U+559C", ",", {1, 1, 0}, "LIKE,", "LO... | [
{
"answer_id": 195805,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "<p>In C, you can only leave out the <em>first</em> dimension when declaring an array:</p>\n\n<pre><code>char * abbrevs3[]... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426/"
] | Assuming Visual C/C++ 6, I have a complex data structure of 22399 elements that looks like this:
```
{
{ "(SAME", "AS", "U+4E18)", "HILLOCK", "OR", "MOUND"},
{ "TO", "LICK;", {1, 1, 0}, "TASTE,", "A", "MAT,", "BAMBOO", "BARK"},
{ "(J)", "NON-STANDARD", "FORM", "OF", "U+559C", ",", {1, 1, 0}, "LIKE,", "LOVE,", "ENJOY;"... | I just read your new posts and re-read the original post, and I think I just fully understood the goal here. Sorry it took so long, I'm kind of slow.
To paraphrase the question, on line 4 of the original example:
```
{ "(AN", "ANCIENT", {1, 2, 2}, {1, 2, 3}, "U+4E94)", "FIVE"},
```
You'd want to translate the tripl... |
195,802 | <p>I was wondering if there was any difference in the way the following code was compiled into assembly. I've heard that switch-case is more efficient than if else, but in this example I am not quite sure if that would be the case.</p>
<pre><code>if(x==1){
...
}else if(x==2){
...
}else{
...
}
</code></pre>
<p>and</p>... | [
{
"answer_id": 195810,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 2,
"selected": false,
"text": "<p>In <em>this</em> specific case, the <code>switch</code> can be turned into a jump table. The <code>if</code> statement (i... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17162/"
] | I was wondering if there was any difference in the way the following code was compiled into assembly. I've heard that switch-case is more efficient than if else, but in this example I am not quite sure if that would be the case.
```
if(x==1){
...
}else if(x==2){
...
}else{
...
}
```
and
```
switch(x){
case 1:
...... | A compiler will sometimes turn a switch into a jump-table, if the entries are contiguous (or nearly so). Or it could theoretically use a binary search to find the case instead of a linear series of tests, which would be faster if you had a large number of cases.
On the other hand, there's nothing stopping the compiler... |
195,809 | <p>I am thinking of developing a web search engine using Erlang, Mnesia & Yaws. Is it possible to make a powerful and the fastest web search engine using these software? What will it need to accomplish this and how what do I start with? </p>
| [
{
"answer_id": 195828,
"author": "dimus",
"author_id": 23080,
"author_profile": "https://Stackoverflow.com/users/23080",
"pm_score": 2,
"selected": false,
"text": "<p>As far as I know <a href=\"http://www.powerset.com\" rel=\"nofollow noreferrer\">Powerset</a>'s natural language procesin... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24813/"
] | I am thinking of developing a web search engine using Erlang, Mnesia & Yaws. Is it possible to make a powerful and the fastest web search engine using these software? What will it need to accomplish this and how what do I start with? | Erlang can make the most powerful web crawler today. Let me take you through my simple crawler.
Step 1. I create a simple parallelism module, which i call *mapreduce*
```
-module(mapreduce).
-export([compute/2]).
%%=====================================================================
%% usage example
%% Module = st... |
195,820 | <p>I'm experimenting with the iPhone SDK and doing some TDD ala Dr. Nic's rbiPhoneTest project. I'm wondering how many, if any, have been successful using this or any other testing framework for iPhone/Cocoa? More important, I'd like to know how to best assert a proprietary binary request/response protocol. The idea is... | [
{
"answer_id": 195832,
"author": "zoul",
"author_id": 17279,
"author_profile": "https://Stackoverflow.com/users/17279",
"pm_score": 4,
"selected": false,
"text": "<p>I don’t know much about Ruby or binary protocols, but if You’re interested in unit testing on iPhone, You might want to ch... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10631/"
] | I'm experimenting with the iPhone SDK and doing some TDD ala Dr. Nic's rbiPhoneTest project. I'm wondering how many, if any, have been successful using this or any other testing framework for iPhone/Cocoa? More important, I'd like to know how to best assert a proprietary binary request/response protocol. The idea is to... | I don’t know much about Ruby or binary protocols, but if You’re interested in unit testing on iPhone, You might want to check out the [Google Toolbox for Mac](http://code.google.com/p/google-toolbox-for-mac/). I am having great success testing my OpenGL ES application with it. |
195,842 | <p>I want to capture as a bitmap the system cursor on Windows OSes as accurately as possible.
The provided API for this is to my knowledge GetCursorInfo, DrawIconEx.</p>
<p>The simple chain of actions is:</p>
<ul>
<li>Get cursor by using GetCursorInfo</li>
<li>Paint the cursor in a memory DC by using DrawIconEx.</li>... | [
{
"answer_id": 196879,
"author": "David L Morris",
"author_id": 3137,
"author_profile": "https://Stackoverflow.com/users/3137",
"pm_score": 0,
"selected": false,
"text": "<p>I suspect you are missing a step.</p>\n\n<p>You need to create a bitmap to select into your device context otherwi... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24873/"
] | I want to capture as a bitmap the system cursor on Windows OSes as accurately as possible.
The provided API for this is to my knowledge GetCursorInfo, DrawIconEx.
The simple chain of actions is:
* Get cursor by using GetCursorInfo
* Paint the cursor in a memory DC by using DrawIconEx.
Here is how the code looks roug... | Unfortunately, I don't think there's a Windows API that discloses the current frame of the cursor animation. I assume that's what you're after: the look of the cursor at the instant you make the snapshot. |
195,849 | <p>Is there a way to programmatically find the location of the current user's Outlook .pst file(s) through an API call or registry entry?</p>
| [
{
"answer_id": 195876,
"author": "Node",
"author_id": 7190,
"author_profile": "https://Stackoverflow.com/users/7190",
"pm_score": 0,
"selected": false,
"text": "<p>The path should be somewhere under:</p>\n\n<blockquote>\n <p>[HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\n NT\\Curren... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27236/"
] | Is there a way to programmatically find the location of the current user's Outlook .pst file(s) through an API call or registry entry? | With [Outlook Redemption](http://www.dimastr.com/redemption/), you can iterate the message stores in VBA using `RDOStores`collection, accessible via the `RDOSession.Stores` property.
I am looking into the possibility of doing something similar in out-of-the-box VBA...
EDIT:
Obviously, the path to the PST is encoded ... |
195,886 | <p>I've searched around a bit, but haven't found a satisfactory answer, so I'd like to hear your opinions on this.</p>
<p>I have a couple of tools which I have to update and deploy to a few servers every now and then. The source is managed in a SVN repository.</p>
<p>To save myself the bother of copying the binaries ... | [
{
"answer_id": 195891,
"author": "zigdon",
"author_id": 4913,
"author_profile": "https://Stackoverflow.com/users/4913",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure why you don't want to put the binaries under the trunk/project1/binaries tree? That said, nothing should stop y... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2899/"
] | I've searched around a bit, but haven't found a satisfactory answer, so I'd like to hear your opinions on this.
I have a couple of tools which I have to update and deploy to a few servers every now and then. The source is managed in a SVN repository.
To save myself the bother of copying the binaries to the production... | There's nothing weird about your setup (I'm doing similar things with both build tools and build artifacts when I need to preserve the exact bits.) The layout you want is definitely possible - to "include" specific versions of other branches or tags in your tags/project1/release2, all you need to do is set [svn:externa... |
195,919 | <p>When uninstalling my application, I'd like to configure the <a href="http://en.wikipedia.org/wiki/WiX" rel="noreferrer">Wix</a> setup to remove all the files that were added <strong>after the original installation</strong>. It seems like the uninstaller removes only the directories and files that were originally ins... | [
{
"answer_id": 196149,
"author": "Pavel Chuchuva",
"author_id": 14131,
"author_profile": "https://Stackoverflow.com/users/14131",
"pm_score": 7,
"selected": true,
"text": "<p>Use <a href=\"http://wixtoolset.org/documentation/manual/v3/xsd/wix/removefile.html\" rel=\"noreferrer\">RemoveFi... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23609/"
] | When uninstalling my application, I'd like to configure the [Wix](http://en.wikipedia.org/wiki/WiX) setup to remove all the files that were added **after the original installation**. It seems like the uninstaller removes only the directories and files that were originally installed from the MSI file and it leaves every... | Use [RemoveFile element](http://wixtoolset.org/documentation/manual/v3/xsd/wix/removefile.html) with On="**uninstall**". Here's an example:
```
<Directory Id="CommonAppDataFolder" Name="CommonAppDataFolder">
<Directory Id="MyAppFolder" Name="My">
<Component Id="MyAppFolder" Guid="*">
<CreateFolder />
... |
195,951 | <p>How can I change the class of an HTML element in response to an <code>onclick</code> or any other events using JavaScript?</p>
| [
{
"answer_id": 195961,
"author": "Jon Galloway",
"author_id": 5,
"author_profile": "https://Stackoverflow.com/users/5",
"pm_score": -1,
"selected": false,
"text": "<p>This is easiest with a library like jQuery:</p>\n\n<pre><code><input type=\"button\" onClick=\"javascript:test_byid();... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4998/"
] | How can I change the class of an HTML element in response to an `onclick` or any other events using JavaScript? | Modern HTML5 Techniques for changing classes
--------------------------------------------
Modern browsers have added [**classList**](https://developer.mozilla.org/en-US/docs/DOM/element.classList) which provides methods to make it easier to manipulate classes without needing a library:
```
document.getElementById("My... |
195,975 | <p>For example, how to avoid writing the 'func_name' twice?</p>
<pre><code>#ifndef TEST_FUN
# define TEST_FUN func_name
# define TEST_FUN_NAME "func_name"
#endif
</code></pre>
<p>I'd like to follow the <a href="http://en.wikipedia.org/wiki/Single_Point_of_Truth" rel="noreferrer">Single Point of Truth</a> rule.</p>
... | [
{
"answer_id": 195980,
"author": "shoosh",
"author_id": 9611,
"author_profile": "https://Stackoverflow.com/users/9611",
"pm_score": -1,
"selected": false,
"text": "<p><code>#define TEST_FUN_NAME #FUNC_NAME</code></p>\n\n<p>see <a href=\"http://en.wikipedia.org/wiki/C_preprocessor#Indirec... | 2008/10/12 | [
"https://Stackoverflow.com/questions/195975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4279/"
] | For example, how to avoid writing the 'func\_name' twice?
```
#ifndef TEST_FUN
# define TEST_FUN func_name
# define TEST_FUN_NAME "func_name"
#endif
```
I'd like to follow the [Single Point of Truth](http://en.wikipedia.org/wiki/Single_Point_of_Truth) rule.
Version of C preprocessor:
```
$ cpp --version
cpp (GCC... | [He who is Shy](https://stackoverflow.com/users/9611/shoosh)\* gave you the germ of an [answer](https://stackoverflow.com/a/195980/15168), but only the germ. The basic technique for converting a value into a string in the C pre-processor is indeed via the '#' operator, but a simple transliteration of the proposed solut... |