qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
103,519 | <p>I'm running some JUnit tests on my applications. Every test has a for loop calling respective method 10000 times.
The tested methods produce a lot of log.
These logs are also automatically collected by JUnit as test output.
This situation takes to OutOfMemoryError because the string buffer where JUnit keeps the output becomes too large.
I dont' need these logs during tests, so if there is a way to tell JUnit "don't keep program output" it would be enough.
Any ideas?</p>
| [
{
"answer_id": 103535,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://Stackoverflow.com/users/4249",
"pm_score": 1,
"selected": false,
"text": "-Xmx <some number>M"
},
{
"answer_id": 106252,
"author": "shoover",
"author_id": 18356,
"author_profile":... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18119/"
] |
103,532 | <p>If you need to open a SqlConnection before issuing queries, can you simply handle all non-Open ConnectionStates in the same way? For example:</p>
<pre><code> if (connection.State != ConnectionState.Open)
{
connection.Open();
}
</code></pre>
<p>I read somewhere that for ConnectionState.Broken the connection needs to be closed before its re-opened. Does anyone have experience with this? Thanks-</p>
| [
{
"answer_id": 103832,
"author": "Joe",
"author_id": 13087,
"author_profile": "https://Stackoverflow.com/users/13087",
"pm_score": 3,
"selected": false,
"text": "using(SqlConnection connection = new SqlConnection(...))\n{\n connection.Open();\n // ... do your stuff here\n\n} // Conn... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/815/"
] |
103,560 | <p>I have an ASP.net application that works fine in the development environment but in the production environment throws the following exception when clicking a link that performs a postback. Any ideas?</p>
<blockquote>
<p>Invalid postback or callback argument.
Event validation is enabled using
in configuration or <%@ Page
EnableEventValidation="true" %> in a
page. For security purposes, this
feature verifies that arguments to
postback or callback events originate
from the server control that
originally rendered them. If the data
is valid and expected, use the
ClientScriptManager.RegisterForEventValidation
method in order to register the
postback or callback data for
validation.</p>
</blockquote>
<p><strong>Edit:</strong> This seems to only be happening when viewed with IE6 but not with IE7, any ideas?</p>
| [
{
"answer_id": 103599,
"author": "azamsharp",
"author_id": 3797,
"author_profile": "https://Stackoverflow.com/users/3797",
"pm_score": 0,
"selected": false,
"text": "<%@ Page ... EnableEventValidation = \"false\" />\n"
},
{
"answer_id": 278893,
"author": "dnord",
"author_... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3111/"
] |
103,561 | <p>I am taking on a maintenance team and would like to introduce tools like FxCop and StyleCop to help improve the code and introduce the developers to better programming techniques and standards. Since we are maintaining code and not making significant enhancements, we will probably only deal with a couple of methods/routines at a time when making changes. </p>
<p>Is it possible to target FxCop/StyleCop to specific areas of code within Visual Studio to avoid getting overwhelmed with all of the issues that would get raised when analyzing a whole class or project? If it is possible, how do you go about it?</p>
<p>Thanks,
Matt</p>
| [
{
"answer_id": 168262,
"author": "alexandrul",
"author_id": 19756,
"author_profile": "https://Stackoverflow.com/users/19756",
"pm_score": 3,
"selected": true,
"text": "/types:<type list> [Short form: /t:<type list>]\nAnalyze only these types and members.\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/103561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3262/"
] |
103,564 | <p>I am working on an application and one design approach involves extremely heavy use of the <code>instanceof</code> operator. While I know that OO design generally tries to avoid using <code>instanceof</code>, that is a different story and this question is purely related to performance. I was wondering if there is any performance impact? Is is just as fast as <code>==</code>?</p>
<p>For example, I have a base class with 10 subclasses. In a single function that takes the base class, I do checks for if the class is an instance of the subclass and carry out some routine. </p>
<p>One of the other ways I thought of solving it was to use a "type id" integer primitive instead, and use a bitmask to represent categories of the subclasses, and then just do a bit mask comparison of the subclasses "type id" to a constant mask representing the category.</p>
<p>Is <code>instanceof</code> somehow optimized by the JVM to be faster than that? I want to stick to Java but the performance of the app is critical. It would be cool if someone that has been down this road before could offer some advice. Am I nitpicking too much or focusing on the wrong thing to optimize?</p>
| [
{
"answer_id": 103602,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 2,
"selected": false,
"text": "if (o instanceof Class1)\n doThis();\nelse if (o instanceof Class2)\n doThat();\n//...\n"
},
{
"answer_id":... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2204759/"
] |
103,569 | <p>I've looked for some other articles on this problem and even tried some of the ideas in <a href="https://stackoverflow.com/questions/8440/visual-studio-optimizations#8539">this thread</a>; however, nothing has solved the issue yet. So, on to the issue.</p>
<p>Something happens when working in Visual Studio (usually C#) that causes the IDE to become a bit wonky when saving a file. I will be working along just fine for a while then at some point I notice that every time I save a file (<kbd>Ctrl</kbd>+<kbd>S</kbd>) it becomes very slow.</p>
<p>The behavior I notice is this; I hit save in some fashion (<kbd>Ctrl</kbd>+<kbd>S</kbd>, menu, etc...) and in the status bar I see the word <strong>Searching</strong> show up. It looks like it is scanning through all of the loaded namespaces for something, although I have no idea for what or why it is doing so. It causes a real hiccup in workflow since typically I will hit <kbd>Ctrl</kbd>+<kbd>S</kbd> often and keep typing.</p>
<p>I have been unable to track down what exactly causes this to start happening. It has happened in multiple project types (web, WPF, console).</p>
<p>Has anyone seen this behavior or have any suggestions?</p>
| [
{
"answer_id": 13626423,
"author": "Yash Gadhiya",
"author_id": 1026511,
"author_profile": "https://Stackoverflow.com/users/1026511",
"pm_score": 3,
"selected": false,
"text": "<script src=\"//translate.google.com/translate_a..."
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/103569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/312/"
] |
103,575 | <p>I am trying to validate the WPF form against an object. The validation fires when I type something in the textbox lose focus come back to the textbox and then erase whatever I have written. But if I just load the WPF application and tab off the textbox without writing and erasing anything from the textbox, then it is not fired. </p>
<p>Here is the Customer.cs class: </p>
<pre><code>public class Customer : IDataErrorInfo
{
public string FirstName { get; set; }
public string LastName { get; set; }
public string Error
{
get { throw new NotImplementedException(); }
}
public string this[string columnName]
{
get
{
string result = null;
if (columnName.Equals("FirstName"))
{
if (String.IsNullOrEmpty(FirstName))
{
result = "FirstName cannot be null or empty";
}
}
else if (columnName.Equals("LastName"))
{
if (String.IsNullOrEmpty(LastName))
{
result = "LastName cannot be null or empty";
}
}
return result;
}
}
}
</code></pre>
<p>And here is the WPF code: </p>
<pre><code><TextBlock Grid.Row="1" Margin="10" Grid.Column="0">LastName</TextBlock>
<TextBox Style="{StaticResource textBoxStyle}" Name="txtLastName" Margin="10"
VerticalAlignment="Top" Grid.Row="1" Grid.Column="1">
<Binding Source="{StaticResource CustomerKey}" Path="LastName"
ValidatesOnExceptions="True" ValidatesOnDataErrors="True"
UpdateSourceTrigger="LostFocus"/>
</TextBox>
</code></pre>
| [
{
"answer_id": 914289,
"author": "w4g3n3r",
"author_id": 36745,
"author_profile": "https://Stackoverflow.com/users/36745",
"pm_score": 3,
"selected": false,
"text": "<Binding \n Source=\"{StaticResource CustomerKey}\" \n Path=\"LastName\" \n ValidatesOnExceptions=\"True\" \n ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3797/"
] |
103,576 | <p>I'm trying a very basic XPath on <a href="http://pastebin.com/f14a20a30" rel="noreferrer">this xml</a> (same as below), and it doesn't find anything.
I'm trying both .NET and <a href="http://www.xmlme.com/XpathTool.aspx" rel="noreferrer">this website</a>, and XPaths such as <code>//PropertyGroup</code>, <code>/PropertyGroup</code> and <code>//MSBuildCommunityTasksPath</code> are simply not working for me (they compiled but return zero results).</p>
<p>Source XML:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- $Id: FxCop.proj 114 2006-03-14 06:32:46Z pwelter34 $ -->
<PropertyGroup>
<MSBuildCommunityTasksPath>$(MSBuildProjectDirectory)\MSBuild.Community.Tasks\bin\Debug</MSBuildCommunityTasksPath>
</PropertyGroup>
<Import
Project="$(MSBuildProjectDirectory)\MSBuild.Community.Tasks\MSBuild.Community.Tasks.Targets" />
<Target Name="DoFxCop">
<FxCop TargetAssemblies="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.dll"
RuleLibraries="@(FxCopRuleAssemblies)"
AnalysisReportFileName="Test.html"
DependencyDirectories="$(MSBuildCommunityTasksPath)"
FailOnError="True"
ApplyOutXsl="True"
OutputXslFileName="C:\Program Files\Microsoft FxCop 1.32\Xml\FxCopReport.xsl" />
</Target>
</Project>
</code></pre>
| [
{
"answer_id": 103905,
"author": "Jesse Millikan",
"author_id": 7526,
"author_profile": "https://Stackoverflow.com/users/7526",
"pm_score": 2,
"selected": false,
"text": "using System;\nusing System.Xml;\n\npublic class XPathNamespace {\n public static void Main(string[] args) {\n ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11236/"
] |
103,583 | <p>This is written in PHP, but it's really language agnostic.</p>
<pre><code>try
{
try
{
$issue = new DM_Issue($core->db->escape_string($_GET['issue']));
}
catch(DM_Exception $e)
{
throw new Error_Page($tpl, ERR_NOT_FOUND, $e->getMessage());
}
}
catch(Error_Page $e)
{
die($e);
}
</code></pre>
<p>Is nested try, catch blocks a good practice to follow? It seems a little bulky just for an error page - however my Issue Datamanager throws an Exception if an error occurs and I consider that to be a good way of error detecting.</p>
<p>The Error_Page exception is simply an error page compiler.</p>
<p>I might just be pedantic, but do you think this is a good way to report errors and if so can you suggest a better way to write this?</p>
<p>Thanks</p>
| [
{
"answer_id": 103625,
"author": "oglester",
"author_id": 2017,
"author_profile": "https://Stackoverflow.com/users/2017",
"pm_score": 2,
"selected": false,
"text": "try{\n Something();\n}\ncatch( SpecificException se )\n{blah();}\ncatch( AnotherException ae )\n{blah();}\n"
},
{
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2025/"
] |
103,593 | <p>I have:</p>
<pre><code><?php
$file=fopen(date("Y-m-d").".txt","r+") or exit("Unable to open file!");
if ($_POST["lastname"] <> "")
{
fwrite($file,$_POST["lastname"]."\n");
}
fclose($file);
?>
</code></pre>
<p>but it overwrites the beginning of the file. How do I make it insert?</p>
| [
{
"answer_id": 103609,
"author": "ConroyP",
"author_id": 2287,
"author_profile": "https://Stackoverflow.com/users/2287",
"pm_score": 6,
"selected": true,
"text": "a+"
},
{
"answer_id": 103617,
"author": "SeanDowney",
"author_id": 5261,
"author_profile": "https://Stack... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
103,598 | <p>Why was the <code>arguments.callee.caller</code> property deprecated in JavaScript?</p>
<p>It was added and then deprecated in JavaScript, but it was omitted altogether by ECMAScript. Some browser (Mozilla, IE) have always supported it and don't have any plans on the map to remove support. Others (Safari, Opera) have adopted support for it, but support on older browsers is unreliable.</p>
<p>Is there a good reason to put this valuable functionality in limbo?</p>
<p>(Or alternately, is there a better way to grab a handle on the calling function?)</p>
| [
{
"answer_id": 103961,
"author": "Zach",
"author_id": 9128,
"author_profile": "https://Stackoverflow.com/users/9128",
"pm_score": 5,
"selected": false,
"text": " function foo () {\n ... foo() ...\n }\n"
},
{
"answer_id": 235760,
"author": "olliej",
"author_id": 784,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15992/"
] |
103,630 | <p>Is it possible to use an <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="noreferrer">ASP.NET</a> web.sitemap with a jQuery <a href="http://users.tpg.com.au/j_birch/plugins/superfish/" rel="noreferrer">Superfish</a> menu? </p>
<p>If not, are there any standards based browser agnostic plugins available that work with the web.sitemap file?</p>
| [
{
"answer_id": 647656,
"author": "Conceptdev",
"author_id": 25673,
"author_profile": "https://Stackoverflow.com/users/25673",
"pm_score": 6,
"selected": true,
"text": "siteMap"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/103630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3742/"
] |
103,633 | <p><a href="http://en.wikibooks.org/wiki/Combinatorics/Subsets_of_a_set-The_Binomial_Coefficient" rel="nofollow noreferrer">Pascal's rule</a> on counting the subset's of a set works great, when the set contains unique entities.</p>
<p>Is there a modification to this rule for when the set contains duplicate items?</p>
<p>For instance, when I try to find the count of the combinations of the letters A,B,C,D, it's easy to see that it's 1 + 4 + 6 + 4 + 1 (from Pascal's Triangle) = 16, or 15 if I remove the "use none of the letters" entry.</p>
<p>Now, what if the set of letters is A,B,B,B,C,C,D? Computing by hand, I can determine that the sum of subsets is: 1 + 4 + 8 + 11 + 11 + 8 + 4 + 1 = 48, but this doesn't conform to the Triangle I know.</p>
<p>Question: How do you modify Pascal's Triangle to take into account duplicate entities in the set?</p>
| [
{
"answer_id": 104046,
"author": "Thomas Andrews",
"author_id": 7061,
"author_profile": "https://Stackoverflow.com/users/7061",
"pm_score": 2,
"selected": false,
"text": "p1^a1.p2^a2....pn^an\n"
},
{
"answer_id": 104091,
"author": "user11318",
"author_id": 11318,
"aut... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13824/"
] |
103,654 | <p>In several modern programming languages (including C++, Java, and C#), the language allows <a href="http://en.wikipedia.org/wiki/Integer_overflow" rel="noreferrer">integer overflow</a> to occur at runtime without raising any kind of error condition.</p>
<p>For example, consider this (contrived) C# method, which does not account for the possibility of overflow/underflow. (For brevity, the method also doesn't handle the case where the specified list is a null reference.)</p>
<pre class="lang-c# prettyprint-override"><code>//Returns the sum of the values in the specified list.
private static int sumList(List<int> list)
{
int sum = 0;
foreach (int listItem in list)
{
sum += listItem;
}
return sum;
}
</code></pre>
<p>If this method is called as follows:</p>
<pre class="lang-c# prettyprint-override"><code>List<int> list = new List<int>();
list.Add(2000000000);
list.Add(2000000000);
int sum = sumList(list);
</code></pre>
<p>An overflow will occur in the <code>sumList()</code> method (because the <code>int</code> type in C# is a 32-bit signed integer, and the sum of the values in the list exceeds the value of the maximum 32-bit signed integer). The sum variable will have a value of -294967296 (not a value of 4000000000); this most likely is not what the (hypothetical) developer of the sumList method intended.</p>
<p>Obviously, there are various techniques that can be used by developers to avoid the possibility of integer overflow, such as using a type like Java's <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigInteger.html" rel="noreferrer"><code>BigInteger</code></a>, or the <a href="http://msdn.microsoft.com/en-us/library/74b4xzyw.aspx" rel="noreferrer"><code>checked</code></a> keyword and <a href="http://msdn.microsoft.com/en-us/library/h25wtyxf.aspx" rel="noreferrer"><code>/checked</code></a> compiler switch in C#.</p>
<p>However, the question that I'm interested in is why these languages were designed to by default allow integer overflows to happen in the first place, instead of, for example, raising an exception when an operation is performed at runtime that would result in an overflow. It seems like such behavior would help avoid bugs in cases where a developer neglects to account for the possibility of overflow when writing code that performs an arithmetic operation that could result in overflow. (These languages could have included something like an "unchecked" keyword that could designate a block where integer overflow is permitted to occur without an exception being raised, in those cases where that behavior is explicitly intended by the developer; C# actually <a href="http://msdn.microsoft.com/en-us/library/a569z7k8.aspx" rel="noreferrer">does have this</a>.)</p>
<p>Does the answer simply boil down to performance -- the language designers didn't want their respective languages to default to having "slow" arithmetic integer operations where the runtime would need to do extra work to check whether an overflow occurred, on every applicable arithmetic operation -- and this performance consideration outweighed the value of avoiding "silent" failures in the case that an inadvertent overflow occurs?</p>
<p>Are there other reasons for this language design decision as well, other than performance considerations?</p>
| [
{
"answer_id": 103711,
"author": "Doug T.",
"author_id": 8123,
"author_profile": "https://Stackoverflow.com/users/8123",
"pm_score": 4,
"selected": false,
"text": "int main()\n{\n uint32_t shipsHeadingInDegrees= 0;\n\n // Rotate by a bunch of degrees\n shipsHeadingInDegrees += 0... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103654",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12484/"
] |
103,679 | <p>First off: I'm using a rather obscure implementation of javascript embedded as a scripting engine for Adobe InDesign CS3. This implementation sometimes diverges from "standard" javascript, hence my problem.</p>
<p>I'm using <a href="http://ejohn.org/projects/javascript-diff-algorithm/" rel="nofollow noreferrer">John Resig's jsdiff library</a> (<a href="http://ejohn.org/files/jsdiff.js" rel="nofollow noreferrer">source here</a>) to compare selections of text between two documents. jsdiff uses vanilla objects as associative arrays to map a word from the text to another object. (See the "ns" and "os" variables in jsdiff.js, around line 129.)</p>
<p>My headaches start when the word "reflect" comes up in the text. "reflect" is a default, <em>read-only</em> property on <em>all</em> objects. When jsdiff tries to assign a value on the associative array to ns['reflect'], everything explodes.</p>
<p>My question: is there a way around this? Is there a way to do a hash table in javascript without using the obvious vanilla object?</p>
<p><strong>Ground rules:</strong> switching scripting engines isn't an option. :)</p>
| [
{
"answer_id": 104018,
"author": "Joel Anair",
"author_id": 7441,
"author_profile": "https://Stackoverflow.com/users/7441",
"pm_score": 1,
"selected": false,
"text": "if(object.hasOwnProperty('testProperty')){\n // do something\n}\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/103679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18950/"
] |
103,725 | <p>I'm working on a project that generates PDFs that can contain fairly complex math and science formulas. The text is rendered in Times New Roman, which has pretty good Unicode coverage, but not complete. We have a system in place to swap in a more Unicode complete font for code points that don't have a glyph in TNR (like most of the "stranger" math symbols,) but I can't seem to find a way to query the *.ttf file to see if a given glyph is present. So far, I've just hard-coded a lookup table of which code points are present, but I'd much prefer an automatic solution.</p>
<p>I'm using VB.Net in a web system under ASP.net, but solutions in any programming language/environment would be appreciated.</p>
<p>Edit: The win32 solution looks excellent, but the specific case I'm trying to solve is in an ASP.Net web system. Is there a way to do this without including the windows API DLLs into my web site?</p>
| [
{
"answer_id": 103858,
"author": "Scott Nichols",
"author_id": 4299,
"author_profile": "https://Stackoverflow.com/users/4299",
"pm_score": 4,
"selected": false,
"text": "[DllImport(\"gdi32.dll\")]\npublic static extern uint GetFontUnicodeRanges(IntPtr hdc, IntPtr lpgs);\n\n[DllImport(\"g... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19074/"
] |
103,727 | <p>As an example, Google App Engine uses Google Datastore, not a standard database, to store data. Does anybody have any tips for using Google Datastore instead of databases? It seems I've trained my mind to think 100% in object relationships that map directly to table structures, and now it's hard to see anything differently. I can understand some of the benefits of Google Datastore (e.g. performance and the ability to distribute data), but some good database functionality is sacrificed (e.g. joins).</p>
<p>Does anybody who has worked with Google Datastore or BigTable have any good advice to working with them?</p>
| [
{
"answer_id": 711322,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 5,
"selected": false,
"text": "class League(BaseModel):\n name = db.StringProperty() \n managers = db.ListProperty(db.Key) #all the users who can vi... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/681/"
] |
103,765 | <p>Here's the situation: I have a label's text set, immediately followed by a response.redirect() call as follows (this is just an example, but I believe it describes my situation accurately):</p>
<p>aspx:</p>
<pre><code><asp:Label runat="server" Text="default text" />
</code></pre>
<p>Code-behind (code called on an onclick event):</p>
<pre><code>Label.Text = "foo";
Response.Redirect("Default.aspx");
</code></pre>
<p>When the page renders, the label says "default text". What do I need to do differently? My understanding was that such changes would be done automatically behind the scenes, but apparently, not in this case. Thanks.</p>
<p>For a little extra background, the code-behind snippet is called inside a method that's invoked upon an onclick event. There is more to it, but I only included that which is of interest to this issue.</p>
| [
{
"answer_id": 103816,
"author": "Adrian Clark",
"author_id": 148,
"author_profile": "https://Stackoverflow.com/users/148",
"pm_score": 2,
"selected": false,
"text": "Response.Redirect"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/103765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13578/"
] |
103,766 | <p>I need to store user entered changes to a particular table, but not show those changes until they have been viewed and approved by an administrative user. While those changes are still in a pending state, I would still display the old version of the data. What would be the best way of storing these changes waiting for approval?</p>
<p>I have thought of several ways, but can't figure out what is the best method. This is a very small web app. One way would be to have a PendingChanges table that mimics the other table's schema, and then once the change is approved, I could update the real table with the information. Another approach would be to do some sort of record versioning where I store multiple versions of the data in the table and then always pull the record with the highest version number that has been marked approved. That would limit the number of extra tables (I need to do this for multiple tables), but would require me to do extra processing every time I pull out a set of records to make sure I get the right ones.</p>
<p>Any personal experiences with these methods or others that might be good?</p>
<p>Update: Just to clarify, in this particular situation I am not interested so much in historical data. I just need some way of approving any changes that are made by a user before they go live on the site. So, a user will edit their "profile" and then an administrator will look at that modification and approve it. Once approved, that will become the displayed value and the old version does not need to be kept.</p>
<p>Anybody tried the solution below where you store pending changes from any table that needs to track them as XML in a special PendingChanges table? Each record would have a column that said which table the changes were for, a column that maybe stored the id of the record that would be changed (null if it's a new record), a datetime column to store when the change was made, and a column to store the xml of the changed record (could maybe serialize my data object). Since I don't need history, after a change was approved, the real table would be updated and the PendingChange record could be deleted.</p>
<p>Any thoughts about that method? </p>
| [
{
"answer_id": 104402,
"author": "borjab",
"author_id": 16206,
"author_profile": "https://Stackoverflow.com/users/16206",
"pm_score": 2,
"selected": false,
"text": " CREATE OR REPLACE VIEW AS \n\n SELECT * FROM my_table where approved = 1\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/103766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19090/"
] |
103,785 | <p>I've found that on some occasions I can edit the source while debugging. Are there any other advantages of using the Visual Studio built-in webserver instead of a virtual directory in IIS?</p>
<p>I'm using Windows XP on my development environment, and a local instance of IIS 5. I work on several projects, so I use multiple virtual directories to manage all the different sites.</p>
<p>Are there any disadvantages?</p>
| [
{
"answer_id": 103879,
"author": "Simon_Weaver",
"author_id": 16940,
"author_profile": "https://Stackoverflow.com/users/16940",
"pm_score": 3,
"selected": false,
"text": "//"
},
{
"answer_id": 103959,
"author": "Simon_Weaver",
"author_id": 16940,
"author_profile": "ht... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5018/"
] |
103,791 | <p>A coworker has been struggling with this problem.</p>
<p>The desired result is an installable plugin for Notes that will add a button emails with attachments that will let users save the attachment to a document management system.</p>
<p>Finding documentation on doing this for Notes has been an uphill battle to say the least.</p>
<p>Writing the actual java to do the work isn't a problem, but figuring out how to extend Notes is.</p>
<p>So, is there a way to add a button/icon to the toolbar, or is it just a matter of adding a new toolbar? If we add a new toolbar then can we make it only visible (or just grey it out otherwise) when no email is open?</p>
| [
{
"answer_id": 1063575,
"author": "stwissel",
"author_id": 131021,
"author_profile": "https://Stackoverflow.com/users/131021",
"pm_score": 0,
"selected": false,
"text": "@Command([ToolsRunMacro];\"(ExportDocumentsTo[yourSystemNameHere])\")\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/103791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2719/"
] |
103,829 | <p>Given the following:</p>
<pre><code>declare @a table
(
pkid int,
value int
)
declare @b table
(
otherID int,
value int
)
insert into @a values (1, 1000)
insert into @a values (1, 1001)
insert into @a values (2, 1000)
insert into @a values (2, 1001)
insert into @a values (2, 1002)
insert into @b values (-1, 1000)
insert into @b values (-1, 1001)
insert into @b values (-1, 1002)
</code></pre>
<p>How do I query for all the values in @a that completely match up with @b? </p>
<p><code>{@a.pkid = 1, @b.otherID = -1}</code> would not be returned (only 2 of 3 values match)</p>
<p><code>{@a.pkid = 2, @b.otherID = -1}</code> would be returned (3 of 3 values match)</p>
<p>Refactoring tables can be an option.</p>
<p><strong>EDIT:</strong> I've had success with the answers from James and Tom H. </p>
<p>When I add another case in @b, they fall a little short.</p>
<pre><code>insert into @b values (-2, 1000)
</code></pre>
<p>Assuming this should return two additional rows (<code>{@a.pkid = 1, @b.otherID = -2}</code> and <code>{@a.pkid = 2, @b.otherID = -2}</code>, it doesn't work. However, for my project this is not an issue.</p>
| [
{
"answer_id": 103910,
"author": "Cruachan",
"author_id": 7315,
"author_profile": "https://Stackoverflow.com/users/7315",
"pm_score": 0,
"selected": false,
"text": "create view qryMyUinion as\nselect * from table1 \nunion all\nselect * from table2\n"
},
{
"answer_id": 104001,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4068/"
] |
103,844 | <p>List Comprehension for me seems to be like the opaque block of granite that regular expressions are for me. I need pointers.</p>
<p>Say, I have a 2D list:</p>
<pre><code>li = [[0,1,2],[3,4,5],[6,7,8]]
</code></pre>
<p>I would like to merge this either into one long list</p>
<pre><code>li2 = [0,1,2,3,4,5,6,7,8]
</code></pre>
<p>or into a string with separators:</p>
<pre><code>s = "0,1,2,3,4,5,6,7,8"
</code></pre>
<p>Really, I'd like to know how to do both.</p>
| [
{
"answer_id": 103873,
"author": "joeld",
"author_id": 19104,
"author_profile": "https://Stackoverflow.com/users/19104",
"pm_score": 0,
"selected": false,
"text": "import itertools\nitertools.flatten( li )\n"
},
{
"answer_id": 103883,
"author": "Eli Bendersky",
"author_id... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/577/"
] |
103,918 | <p>I am trying to install the ibm_db gem so that I can access DB2 from Ruby. When I try:</p>
<pre><code>sudo gem install ibm_db
</code></pre>
<p>I get the following request for clarification:</p>
<pre>
Select which gem to install for your platform (i486-linux)
1. ibm_db 0.10.0 (ruby)
2. ibm_db 0.10.0 (mswin32)
3. ibm_db 0.9.5 (mswin32)
4. ibm_db 0.9.5 (ruby)
5. Skip this gem
6. Cancel installation
</pre>
<p>I am always going to be installing the linux version (which I assume is the "ruby" version), so is there a way to pick which one I will install straight from the gem install command?</p>
<p>The reason this is a problem is that I need to automate this install via a bash script, so I would like to select that I want the "ruby" version ahead of time.</p>
| [
{
"answer_id": 104102,
"author": "John Topley",
"author_id": 1450,
"author_profile": "https://Stackoverflow.com/users/1450",
"pm_score": 1,
"selected": false,
"text": "sudo gem install --platform ruby ibm_db\n"
},
{
"answer_id": 104163,
"author": "paradoja",
"author_id": ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122/"
] |
103,919 | <p>I want to store the current URL in a session variable to reference the previous visited page.</p>
<p>If I store every URL (via a before_filter on ApplicationController), also actions which end in a redirect (create, update, etc) are considered as last visited page.</p>
<p>Is there a way to tell Rails only to execute a function if a template is rendered??</p>
<p><strong>Update</strong></p>
<p>Thanks for the after_filter tip... having written so many before_filters I didn't see the obvious. But the Trick with @performed_redirect doesn't work-</p>
<p>This is what I got so far</p>
<pre><code>class ApplicationController < ActionController::Base
after_filter :set_page_as_previous_page
def set_page_as_previous_page
unless @performed_redirect
flash[:previous_page] = request.request_uri
else
flash[:previous_page] = flash[:previous_page]
end
end
end
</code></pre>
<p>I need to implement a "Go Back" Link, without the use of Javascript, the HTTP Referer. Sorry If I should have mentioned that, I appreciate your help!</p>
<p><strong>Update 2</strong></p>
<p>I found a solution, which is not very elegant and only works if your app follows the standard naming scheme</p>
<pre><code>def after_filter
if File.exists?(File.join(Rails.root,"app","views", controller_path, action_name+".html.erb"))
flash[:previous_page] = request.request_uri
else
flash[:previous_page] = flash[:previous_page]
end
end
</code></pre>
| [
{
"answer_id": 103975,
"author": "kch",
"author_id": 13989,
"author_profile": "https://Stackoverflow.com/users/13989",
"pm_score": 0,
"selected": false,
"text": "@performed_render\n@performed_redirect\n"
},
{
"answer_id": 104460,
"author": "kch",
"author_id": 13989,
"... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11231/"
] |
103,938 | <p>I've been doing code review (mostly using tools like FindBugs) of one of our pet projects and FindBugs marked following code as erroneous (pseudocode):</p>
<pre><code>Connection conn = dataSource.getConnection();
try{
PreparedStatement stmt = conn.prepareStatement();
//initialize the statement
stmt.execute();
ResultSet rs = stmt.getResultSet();
//get data
}finally{
conn.close();
}
</code></pre>
<p>The error was that this code might not release resources. I figured out that the ResultSet and Statement were not closed, so I closed them in finally:</p>
<pre><code>finally{
try{
rs.close()
}catch(SqlException se){
//log it
}
try{
stmt.close();
}catch(SqlException se){
//log it
}
conn.close();
}
</code></pre>
<p>But I encountered the above pattern in many projects (from quite a few companies), and no one was closing ResultSets or Statements.</p>
<p>Did you have troubles with ResultSets and Statements not being closed when the Connection is closed? </p>
<p>I found only <a href="http://www.theserverside.com/discussions/thread.tss?thread_id=41036" rel="noreferrer">this</a> and it refers to Oracle having problems with closing ResultSets when closing Connections (we use Oracle db, hence my corrections). java.sql.api says nothing in Connection.close() javadoc.</p>
| [
{
"answer_id": 103994,
"author": "neu242",
"author_id": 13365,
"author_profile": "https://Stackoverflow.com/users/13365",
"pm_score": 5,
"selected": false,
"text": "\"ORA-01000: maximum open cursors exceeded\"\n"
},
{
"answer_id": 104123,
"author": "Aaron",
"author_id": 1... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7918/"
] |
103,945 | <p>I've implemented a custom item renderer that I'm using with a combobox on a flex project I'm working on. It displays and icon and some text for each item. The only problem is that when the text is long the width of the menu is not being adjusted properly and the text is being truncated when displayed. I've tried tweaking all of the obvious properties to alleviate this problem but have not had any success. Does anyone know how to make the combobox menu width scale appropriately to whatever data it's rendering?</p>
<p>My custom item renderer implementation is:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml"
styleName="plain" horizontalScrollPolicy="off">
<mx:Image source="{data.icon}" />
<mx:Label text="{data.label}" fontSize="11" fontWeight="bold" truncateToFit="false"/>
</mx:HBox>
</code></pre>
<p>And my combobox uses it like so:</p>
<pre><code> <mx:ComboBox id="quicklinksMenu" change="quicklinkHandler(quicklinksMenu.selectedItem.data);" click="event.stopImmediatePropagation();" itemRenderer="renderers.QuickLinkItemRenderer" width="100%"/>
</code></pre>
<p>EDIT:
I should clarify on thing: I can set the dropdownWidth property on the combobox to some arbitrarily large value - this will make everything fit, but it will be too wide. Since the data being displayed in this combobox is generic, I want it to automatically size itself to the largest element in the dataprovider (the flex documentation says it will do this, but I have the feeling my custom item renderer is somehow breaking that behavior)</p>
| [
{
"answer_id": 104314,
"author": "defmeta",
"author_id": 10875,
"author_profile": "https://Stackoverflow.com/users/10875",
"pm_score": 0,
"selected": false,
"text": "protected override function calculatePreferredSizeFromData(count:int):Object\n"
},
{
"answer_id": 1432078,
"au... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2327/"
] |
103,980 | <p>I'm working on a document "wizard" for the company that I work for. It's a .dot file with a header consisting of some text and some form fields, and a lot of VBA code. The body of the document is pulled in as an OLE object from a separate .doc file.</p>
<p>Currently, this is being done as a <code>Shape</code>, rather than an <code>InlineShape</code>. I did this because I can absolutely position the Shape, whereas the InlineShape always appears at the beginning of the document.</p>
<p>The problem with this is that a <code>Shape</code> doesn't move when the size of the header changes. If someone needs to add or remove a line from the header due to a special case, they also need to move the object that defines the body. This is a pain, and I'd like to avoid it if possible.</p>
<p>Long story short, how do I position an <code>InlineShape</code> using VBA in Word?</p>
<p>The version I'm using is Word 97.</p>
| [
{
"answer_id": 104116,
"author": "GSerg",
"author_id": 11683,
"author_profile": "https://Stackoverflow.com/users/11683",
"pm_score": 3,
"selected": true,
"text": "ThisDocument.Range(15).InlineShapes.AddPicture \"1.gif\"\n"
},
{
"answer_id": 128344,
"author": "Branan",
"au... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13894/"
] |
103,989 | <p>I need to implement an in-memory tuple-of-strings matching feature in C. There will be large list of tuples associated with different actions and a high volume of events to be matched against the list.</p>
<p>List of tuples:</p>
<pre><code>("one", "four")
("one")
("three")
("four", "five")
("six")
</code></pre>
<p>event ("one", "two", "three", "four") should match list item ("one", "four") and ("one") and ("three") but not ("four", "five") and not ("six")</p>
<p>my current approach uses a map of all tuple field values as keys for lists of each tuple using that value. there is a lot of redundant hashing and list insertion.</p>
<p>is there a right or classic way to do this?</p>
| [
{
"answer_id": 104182,
"author": "Frosty",
"author_id": 7476,
"author_profile": "https://Stackoverflow.com/users/7476",
"pm_score": 3,
"selected": true,
"text": "unsigned int hash(char *value){...}\n\ntypedef struct _tuple {\n unsigned int bitvalues;\n void * data\n} tuple;\n\ntupl... | 2008/09/19 | [
"https://Stackoverflow.com/questions/103989",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7223/"
] |
104,009 | <p>I'm wanting to get the full value of a char[] variable in the VC6 watch window, but it only shows a truncated version. I can copy the value from a debug memory window, but that contains mixed lines of hex and string values. Surely there is a better way??</p>
| [
{
"answer_id": 104045,
"author": "Doug T.",
"author_id": 8123,
"author_profile": "https://Stackoverflow.com/users/8123",
"pm_score": 1,
"selected": false,
"text": "char bigArray[1000];\n"
},
{
"answer_id": 104338,
"author": "nruessmann",
"author_id": 10329,
"author_pr... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19125/"
] |
104,022 | <p>I'm currently using <code>.resx</code> files to manage my server side resources for .NET.</p>
<p>the application that I am dealing with also allows developers to plugin JavaScript into various event handlers for client side validation, etc.. What is the best way for me to localize my JavaScript messages and strings? </p>
<p>Ideally, I would like to store the strings in the <code>.resx</code> files to keep them with the rest of the localized resources.</p>
<p>I'm open to suggestions.</p>
| [
{
"answer_id": 104051,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 2,
"selected": false,
"text": "var phrases={};\nphrases['fatalError'] ='On no!';\n"
},
{
"answer_id": 104080,
"author": "J... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7215/"
] |
104,055 | <p>I know how to use rpm to list the contents of a package (<code>rpm -qpil package.rpm</code>). However, this requires knowing the location of the .rpm file on the filesystem. A more elegant solution would be to use the package manager, which in my case is YUM. How can YUM be used to achieve this?</p>
| [
{
"answer_id": 104087,
"author": "Thomi",
"author_id": 1304,
"author_profile": "https://Stackoverflow.com/users/1304",
"pm_score": 5,
"selected": false,
"text": "rpm -qlp /path/to/fileToList.rpm\n"
},
{
"answer_id": 107520,
"author": "Thomas Vander Stichele",
"author_id":... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104055",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/742/"
] |
104,063 | <p>I noticed in another post, someone had done something like:</p>
<pre><code>double d = 3.1415;
int i = Convert.ToInt32(Math.Floor(d));
</code></pre>
<p>Why did they use the convert function, rather than:</p>
<pre><code>double d = 3.1415;
int i = (int)d;
</code></pre>
<p>which has an implicit floor and convert.</p>
<p>Also, more concerning, I noticed in some production code I was reading:</p>
<pre><code>double d = 3.1415;
float f = Convert.ToSingle(d);
</code></pre>
<p>Is that the same as:</p>
<pre><code>float f = (float)d;
</code></pre>
<p>Are all those otherwise implicit conversions just in the Convert class for completeness, or do they serve a purpose? I can understand a need for .ToString(), but not the rest.</p>
| [
{
"answer_id": 104180,
"author": "NotDan",
"author_id": 3291,
"author_profile": "https://Stackoverflow.com/users/3291",
"pm_score": 1,
"selected": false,
"text": "int i = Convert.ToInt32(\"1234\");\n"
},
{
"answer_id": 104387,
"author": "Michael L Perry",
"author_id": 766... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15261/"
] |
104,068 | <p>Let's say we have the following method declaration:</p>
<pre><code>Public Function MyMethod(ByVal param1 As Integer, _
Optional ByVal param2 As Integer = 0, _
Optional ByVal param3 As Integer = 1) As Integer
Return param1 + param2 + param3
End Function
</code></pre>
<p>How does VB.NET make the optional parameters work within the confines of the CLR? Are optional parameters CLS-Compliant?</p>
| [
{
"answer_id": 104094,
"author": "John Rudy",
"author_id": 14048,
"author_profile": "https://Stackoverflow.com/users/14048",
"pm_score": 3,
"selected": false,
"text": ".method public static int32 MyMethod(int32 param1,\n [opt] int32 param2,\n ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14048/"
] |
104,115 | <p>In most modern IDEs there is a parameter that you can set to ensure javac gets enough heap memory to do its compilation. For reasons that are not worth going into here, we are tied for the time being to JBuilder 2005/2006, and it appears the amount of source code has exceeded what can be handled by javac.</p>
<p>Please keep the answer specific to JBuilder 2005/2006 javac (we cannot migrate away right now, and the Borland Make compiler does not correctly support Java 1.6)</p>
<p>I realize how and what parameters <em>should</em> be passed to javac, the problem is the IDE doesn't seem to allow these to be set anywhere. A lot of configuration is hidden down in the Jbuilder Install\bin*.config files, I feel the answer may be in there somewhere, but have not found it.</p>
| [
{
"answer_id": 580326,
"author": "Alex B",
"author_id": 6180,
"author_profile": "https://Stackoverflow.com/users/6180",
"pm_score": 0,
"selected": false,
"text": "vmparam -Xms256m \nvmparam -Xmx256m\n"
},
{
"answer_id": 10959286,
"author": "lvr",
"author_id": 1445908,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17123/"
] |
104,122 | <p>I have a crash dump of an application that is supposedly leaking GDI. The app is running on XP and I have no problems loading it into WinDbg to look at it. Previously we have use the <a href="http://msdn.microsoft.com/en-us/library/cc267206.aspx" rel="noreferrer">Gdikdx.dll extension</a> to look at Gdi information but this extension is not supported on XP or Vista. </p>
<p>Does anyone have any pointers for finding GDI object usage in WinDbg. </p>
<p>Alternatively, I do have access to the failing program (and its stress testing suite) so I can reproduce on a running system if you know of any 'live' debugging tools for XP and Vista (or Windows 2000 though this is not our target).</p>
| [
{
"answer_id": 104150,
"author": "Kris Kumler",
"author_id": 4281,
"author_profile": "https://Stackoverflow.com/users/4281",
"pm_score": 3,
"selected": true,
"text": "!poolused"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5882/"
] |
104,158 | <p>I came across this recently, up until now I have been happily overriding the equality operator (<strong>==</strong>) and/or <strong>Equals</strong> method in order to see if two references types actually contained the same <strong>data</strong> (i.e. two different instances that look the same).</p>
<p>I have been using this even more since I have been getting more in to automated testing (comparing reference/expected data against that returned).</p>
<p>While looking over some of the <a href="http://msdn.microsoft.com/en-us/library/ms229042(VS.80).aspx" rel="noreferrer">coding standards guidelines in MSDN</a> I came across an <a href="http://msdn.microsoft.com/en-us/library/7h9bszxx(VS.80).aspx" rel="noreferrer">article</a> that advises against it. Now I understand <em>why</em> the article is saying this (because they are not the same <em>instance</em>) but it does not answer the question:</p>
<ol>
<li><strong>What is the best way to compare two reference types?</strong></li>
<li>Should we implement <a href="http://msdn.microsoft.com/en-us/library/system.icomparable.aspx" rel="noreferrer">IComparable</a>? (I have also seen mention that this should be reserved for value types only).</li>
<li>Is there some interface I don't know about?</li>
<li>Should we just roll our own?!</li>
</ol>
<p>Many Thanks ^_^</p>
<h2>Update</h2>
<p>Looks like I had mis-read some of the documentation (it's been a long day) and overriding <a href="http://msdn.microsoft.com/en-us/library/336aedhh(VS.71).aspx" rel="noreferrer">Equals</a> may be the way to go..</p>
<blockquote>
<p>If you are implementing reference
types, you should consider overriding
the Equals method on a reference type
if your type looks like a base type
such as a Point, String, BigNumber,
and so on. Most reference types should
not overload the <strong>equality</strong> operator,
even <strong>if they override Equals</strong>. However,
if you are implementing a reference
type that is intended to have value
semantics, such as a complex number
type, you should override the equality
operator.</p>
</blockquote>
| [
{
"answer_id": 104197,
"author": "Matt J",
"author_id": 18528,
"author_profile": "https://Stackoverflow.com/users/18528",
"pm_score": 6,
"selected": true,
"text": "class TwoDPoint : System.Object\n{\n public readonly int x, y;\n\n public TwoDPoint(int x, int y) //constructor\n ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/832/"
] |
104,184 | <p>There is a case where a map will be constructed, and once it is initialized, it will never be modified again. It will however, be accessed (via get(key) only) from multiple threads. Is it safe to use a <code>java.util.HashMap</code> in this way?</p>
<p>(Currently, I'm happily using a <code>java.util.concurrent.ConcurrentHashMap</code>, and have no measured need to improve performance, but am simply curious if a simple <code>HashMap</code> would suffice. Hence, this question is <em>not</em> "Which one should I use?" nor is it a performance question. Rather, the question is "Would it be safe?")</p>
| [
{
"answer_id": 1702190,
"author": "Will",
"author_id": 207084,
"author_profile": "https://Stackoverflow.com/users/207084",
"pm_score": 2,
"selected": false,
"text": "Collections.unmodifiableMap(originalMap)"
},
{
"answer_id": 39746361,
"author": "TomWolk",
"author_id": 10... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3093/"
] |
104,223 | <p>I have noticed that cURL in PHP returns different data when told to output to a file via <code>CURLOPT_FILE</code> as it does when told to send the output to a string via <code>CURLOPT_RETURNTRANSFER</code>.</p>
<p><code>_RETURNTRANSFER</code> seems to strip newlines and extra white space as if parsing it for display as standard HTML code. <code>_FILE</code> on the other hand preserves the file exactly as it was intended.</p>
<p>I have read through the documentation on php.net but haven't found anything that seems to solve my problem. Ideally, I would like to have <code>_RETURNTRANSFER</code> return the exact contents so I could eliminate an intermediate file, but I don't see any way of making this possible.</p>
<p>Here is the code I am using. The data in question is a CSV file with \r\n line endings.</p>
<pre><code>function update_roster() {
$url = "http://example.com/";
$userID = "xx";
$apikey = "xxx";
$passfields = "userID=$userID&apikey=$apikey";
$file = fopen("roster.csv","w+");
$ch = curl_init();
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $passfields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FILE, $file);
$variable_in_question = curl_exec ($ch);
curl_close ($ch);
fclose($file);
return $variable_in_question;
}
</code></pre>
<hr>
<p>Turns out, the error is not in what was being returned, but in the way I was going about parsing it. \r\n is not parsed the way I expected when put in single quotes, switching to double quotes solved my problem. I was not aware that this made a difference inside function calls like that.</p>
<p>This works just fine:<code>$cresult = split("\r\n", $cresult);</code></p>
<p>This does not: <code>$cresult = split('\r\n', $cresult);</code></p>
| [
{
"answer_id": 104750,
"author": "p4bl0",
"author_id": 12043,
"author_profile": "https://Stackoverflow.com/users/12043",
"pm_score": 0,
"selected": false,
"text": "ob_start();"
},
{
"answer_id": 106120,
"author": "Melikoth",
"author_id": 1536217,
"author_profile": "ht... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1536217/"
] |
104,224 | <p>I'm working on a WPF application that sometimes exhibits odd problems and appears to <em>hang</em> in the UI. It is inconsistent, it happens in different pages, but it happens often enough that it is a big problem. I should mention that it is not a true hang as described below.</p>
<p>My first thought was that the animations of some buttons was the problem since they are used on most pages, but after removing them the hangs still occur, although seemingly a bit less often. I have tried to break into the debugger when the hang occurs; however there is never any code to view. No code of mine is running. I have also noticed that the "hang" is not complete. I have code that lets me drag the form around (it has no border or title) which continues to work. I also have my won close button which functions when I click it. Clicking on buttons appears to actually work as my code runs, but the UI simply never updates to show a new page.</p>
<p>I'm looking for any advice, tools or techniques to track down this odd problem, so if you have any thoughts at all, I will greatly appreciate it.</p>
<p>EDIT: It just happened again, so this time when I tried to break into the debugger I chose to "show disassembly". It brings me to MS.Win32.UnsafeNativeMethods.GetMessageW. The stack trace follows:</p>
<pre><code>[Managed to Native Transition]
</code></pre>
<blockquote>
<p>WindowsBase.dll!MS.Win32.UnsafeNativeMethods.GetMessageW(ref System.Windows.Interop.MSG msg, System.Runtime.InteropServices.HandleRef hWnd, int uMsgFilterMin, int uMsgFilterMax) + 0x15 bytes<br>
WindowsBase.dll!System.Windows.Threading.Dispatcher.GetMessage(ref System.Windows.Interop.MSG msg, System.IntPtr hwnd, int minMessage, int maxMessage) + 0x48 bytes
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame = {System.Windows.Threading.DispatcherFrame}) + 0x8b bytes
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) + 0x49 bytes<br>
WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() + 0x4c bytes<br>
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) + 0x1e bytes<br>
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x6f bytes
PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) + 0x26 bytes
PresentationFramework.dll!System.Windows.Application.Run() + 0x19 bytes
WinterGreen.exe!WinterGreen.App.Main() + 0x5e bytes C#
[Native to Managed Transition]<br>
[Managed to Native Transition]<br>
mscorlib.dll!System.AppDomain.nExecuteAssembly(System.Reflection.Assembly assembly, string[] args) + 0x19 bytes
mscorlib.dll!System.Runtime.Hosting.ManifestRunner.Run(bool checkAptModel) + 0x6e bytes
mscorlib.dll!System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly() + 0x84 bytes
mscorlib.dll!System.Runtime.Hosting.ApplicationActivator.CreateInstance(System.ActivationContext activationContext, string[] activationCustomData) + 0x65 bytes
mscorlib.dll!System.Runtime.Hosting.ApplicationActivator.CreateInstance(System.ActivationContext activationContext) + 0xa bytes
mscorlib.dll!System.Activator.CreateInstance(System.ActivationContext activationContext) + 0x3e bytes<br>
Microsoft.VisualStudio.HostingProcess.Utilities.dll!Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone() + 0x23 bytes<br>
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state) + 0x66 bytes<br>
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x6f bytes<br>
mscorlib.dll!System.Threading.ThreadHelper.ThreadStart() + 0x44 bytes </p>
</blockquote>
| [
{
"answer_id": 1908286,
"author": "EightyOne Unite",
"author_id": 5559,
"author_profile": "https://Stackoverflow.com/users/5559",
"pm_score": 1,
"selected": false,
"text": "AllowsTransparency"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/312/"
] |
104,225 | <p>I have a co-worker that maintains that TRUE used to be defined as 0 and all other values were FALSE. I could swear that every language I've worked with, if you could even get a value for a boolean, that the value for FALSE is 0. Did TRUE used to be 0? If so, when did we switch?</p>
| [
{
"answer_id": 104274,
"author": "GSerg",
"author_id": 11683,
"author_profile": "https://Stackoverflow.com/users/11683",
"pm_score": 0,
"selected": false,
"text": "TRUE"
},
{
"answer_id": 104280,
"author": "Dima",
"author_id": 13313,
"author_profile": "https://Stackov... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10887/"
] |
104,230 | <p>Situation: A PHP application with multiple installable modules creates a new table in database for each, in the style of mod_A, mod_B, mod_C etc. Each has the column section_id.</p>
<p>Now, I am looking for all entries for a specific section_id, and I'm hoping there's another way besides "Select * from mod_a, mod_b, mod_c ... mod_xyzzy where section_id=value"... or even worse, using a separate query for each module.</p>
| [
{
"answer_id": 104257,
"author": "borjab",
"author_id": 16206,
"author_profile": "https://Stackoverflow.com/users/16206",
"pm_score": 1,
"selected": false,
"text": "SELECT * FROM mod_a WHERE section_id=value\nUNION ALL\nSELECT * FROM mod_b WHERE section_id=value\nUNION ALL\nSELECT * FROM... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4224/"
] |
104,235 | <p>What is the syntax and which namespace/class needs to be imported? Give me sample code if possible. It would be of great help.</p>
| [
{
"answer_id": 104262,
"author": "MagicKat",
"author_id": 8505,
"author_profile": "https://Stackoverflow.com/users/8505",
"pm_score": 5,
"selected": false,
"text": "System.Diagnostics.Debugger.Break();\n"
},
{
"answer_id": 104263,
"author": "Quintin Robinson",
"author_id"... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13432/"
] |
104,238 | <p>I'm having an issue with my regex.</p>
<p>I want to capture <% some stuff %> and i need what's inside the <% and the %></p>
<p>This regex works quite well for that.</p>
<pre><code>$matches = preg_split("/<%[\s]*(.*?)[\s]*%>/i",$markup,-1,(PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE));
</code></pre>
<p>I also want to catch <code>&amp;% some stuff %&amp;gt;</code> so I need to capture <code><% or &amp;lt;% and %> or %&amp;gt;</code> respectively. </p>
<p>If I put in a second set of parens, it makes preg_split function differently (because as you can see from the flag, I'm trying to capture what's inside the parens.</p>
<p>Preferably, it would only match <code>&amp;lt; to &amp;gt; and < to ></code> as well, but that's not completely necessary</p>
<p>EDIT: The SUBJECT may contain multiple matches, and I need all of them</p>
| [
{
"answer_id": 104295,
"author": "e-satis",
"author_id": 9951,
"author_profile": "https://Stackoverflow.com/users/9951",
"pm_score": 4,
"selected": true,
"text": "preg_match(\"#((?:<|<)%)([\\s]*(?:[^ø]*)[\\s]*?)(%(?:>|>))#i\",$markup, $out);\nprint_r($out);\n\nArray\n(\n [0] => ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144/"
] |
104,254 | <p>I use the Eclipse IDE to develop, compile, and run my Java projects. Today, I'm trying to use the <code>java.io.Console</code> class to manage output and, more importantly, user input.</p>
<p>The problem is that <code>System.console()</code> returns <code>null</code> when an application is run "through" Eclipse. Eclipse run the program on a background process, rather than a top-level process with the console window we're familiar with.</p>
<p>Is there a way to force Eclipse to run the program as a top level process, or at least create a Console that the JVM will recognize? Otherwise, I'm forced to jar the project up and run on a command-line environment external to Eclipse.</p>
| [
{
"answer_id": 105403,
"author": "McDowell",
"author_id": 304,
"author_profile": "https://Stackoverflow.com/users/304",
"pm_score": 7,
"selected": true,
"text": "java -cp workspace\\p1\\bin;workspace\\p2\\bin foo.Main\n"
},
{
"answer_id": 4491872,
"author": "Laplie Anderson",... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19147/"
] |
104,267 | <p>in short: <strong>is there any way to find the current directory full path of a xul application?</strong></p>
<p>long explanation:</p>
<p>I would like to open some html files in a xul browser application. The path to the html files should be set programmatically from the xul application. The html files reside outside the folder of my xul application, but at the same level. (users will checkout both folders from SVN, no installation available for the xul app)</p>
<p>It opened the files just fine if I set a full path like "file:///c:\temp\processing-sample\index.html"</p>
<p>what i want to do is to open the file relative to my xul application. </p>
<p>I found i can open the user's profile path:</p>
<pre><code>var DIR_SERVICE = new Components.Constructor("@mozilla.org/file/directory_service;1", "nsIProperties");
var path = (new DIR_SERVICE()).get("UChrm", Components.interfaces.nsIFile).path;
var appletPath;
// find directory separator type
if (path.search(/\\/) != -1)
{
appletPath = path + "\\myApp\\content\\applet.html"
}
else
{
appletPath = path + "/myApp/content/applet.html"
}
// Cargar el applet en el iframe
var appletFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);
appletFile.initWithPath(appletPath);
var appletURL = Components.classes["@mozilla.org/network/protocol;1?name=file"].createInstance(Components.interfaces.nsIFileProtocolHandler).getURLSpecFromFile(appletFile);
var appletFrame = document.getElementById("appletFrame");
appletFrame.setAttribute("src", appletURL);
</code></pre>
<p><strong>is there any way to find the current directory full path of a xul application?</strong></p>
| [
{
"answer_id": 104950,
"author": "rec",
"author_id": 14022,
"author_profile": "https://Stackoverflow.com/users/14022",
"pm_score": 3,
"selected": true,
"text": "var DIR_SERVICE = new Components.Constructor(\"@mozilla.org/file/directory_service;1\", \"nsIProperties\");\nvar path = (new DI... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14022/"
] |
104,293 | <p>I'm getting a 404 error when trying to run another web service on an IIS 6 server which is also running Sharepoint 2003. I'm pretty sure this is an issue with sharepoint taking over IIS configuration. Is there a way to make a certain web service or web site be ignored by whatever Sharepoint is doing?</p>
| [
{
"answer_id": 104410,
"author": "Stimy",
"author_id": 8852,
"author_profile": "https://Stackoverflow.com/users/8852",
"pm_score": 3,
"selected": true,
"text": "STSADM.EXE -o addpath -url http://localhost/<your web service/app> -type exclusion\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104293",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8852/"
] |
104,313 | <p>I'm implementing an Apache 2.0.x module in C, to interface with an existing product we have. I need to handle FORM data, most likely using POST but I want to handle the GET case as well.</p>
<p>Nick Kew's <A href="https://rads.stackoverflow.com/amzn/click/com/0132409674" rel="nofollow noreferrer" rel="nofollow noreferrer">Apache Modules</A> book has a section on handling form data. It provides code examples for POST and GET, which return an apr_hash_t of the key+value pairs in the form. parse_form_from_POST marshalls the bucket brigade and flattens it into a buffer, while parse_form_from_GET can simply reference the URL. Both routines rely on a parse_form_from_string routine to walk through each delimited field and extract the information into the hash table.</p>
<p>That would be fine, but it seems like there should be an easier way to do this than adding a couple hundred lines of code to my module. Is there an existing module or routines within apache, apr, or apr-util to extract the field names and associated data from a GET or POST FORM into a structure which C code can more easily access? I cannot find anything relevant, but this seems like a common need for which there should be a solution.</p>
| [
{
"answer_id": 12989352,
"author": "mlibby",
"author_id": 13468,
"author_profile": "https://Stackoverflow.com/users/13468",
"pm_score": 0,
"selected": false,
"text": "ap_parse_form_data"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4761/"
] |
104,322 | <p>How do you install Boost on MacOS?
Right now I can't find bjam for the Mac.</p>
| [
{
"answer_id": 104389,
"author": "dies",
"author_id": 19170,
"author_profile": "https://Stackoverflow.com/users/19170",
"pm_score": 8,
"selected": true,
"text": "sudo port install boost \n"
},
{
"answer_id": 104647,
"author": "dmckee --- ex-moderator kitten",
"author_id":... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15124/"
] |
104,323 | <p>I am quite new to JavaScript libraries. I wanted to replace my current code with jQuery. My current code looks like this:</p>
<pre><code>var req;
function createRequest() {
var key = document.getElementById("key");
var keypressed = document.getElementById("keypressed");
keypressed.value = key.value;
var url = "/My_Servlet/response?key=" + escape(key.value);
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.open("Get", url, true);
req.onreadystatechange = callback;
req.send(null);
}
function callback() {
if (req.readyState == 4) {
if (req.status == 200) {
var decimal = document.getElementById('decimal');
decimal.value = req.responseText;
}
}
clear();
}
</code></pre>
<p>I wanted to replace my code with something a little friendlier like jQuery's</p>
<pre><code>$.get(url, callback);
</code></pre>
<p>However it doesn't call my callback function.</p>
<p>Also I would like to call a function called <code>createRequest</code> continuously. Does jQuery have a nice way of doing that?
</p>
| [
{
"answer_id": 104347,
"author": "ceejayoz",
"author_id": 1902010,
"author_profile": "https://Stackoverflow.com/users/1902010",
"pm_score": 2,
"selected": false,
"text": "url, data, callback"
},
{
"answer_id": 104408,
"author": "Lasar",
"author_id": 9438,
"author_prof... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
104,329 | <p>What kind of performance implications are there to consider when using try-catch statements in php 5? </p>
<p>I've read some old and seemingly conflicting information on this subject on the web before. A lot of the framework I currently have to work with was created on php 4 and lacks many of the niceties of php 5. So, I don't have much experience myself in using try-catchs with php.</p>
| [
{
"answer_id": 445094,
"author": "jmucchiello",
"author_id": 44065,
"author_profile": "https://Stackoverflow.com/users/44065",
"pm_score": 6,
"selected": false,
"text": "function no_except($a, $b) { \n $a += $b;\n return $a;\n}\nfunction except($a, $b) { \n try {\n $a += ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14959/"
] |
104,330 | <p>I have a table with a "Date" column, and I would like to do a query that does the following:</p>
<p>If the date is a <strong>Monday</strong>, <strong>Tuesday</strong>, <strong>Wednesday</strong>, or <strong>Thursday</strong>, the displayed date should be shifted up by 1 day, as in <pre>DATEADD(day, 1, [Date])</pre> On the other hand, if it is a <strong>Friday</strong>, the displayed date should be incremented by 3 days (i.e. so it becomes the following <em>Monday</em>).</p>
<p>How do I do this in my SELECT statement? As in,</p>
<pre>SELECT somewayofdoingthis([Date]) FROM myTable</pre>
<p>(This is SQL Server 2000.)</p>
| [
{
"answer_id": 104362,
"author": "Dave Costa",
"author_id": 6568,
"author_profile": "https://Stackoverflow.com/users/6568",
"pm_score": 1,
"selected": false,
"text": "CASE\n WHEN [Date] is a Friday THEN DATEADD( day, 3, [Date] )\n ELSE DATEADD( day, 1, [Date] )\nEND\n"
},
{
"an... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10675/"
] |
104,339 | <p>I'm doing some Objective-C programming that involves parsing an NSXmlDocument and populating an objects properties from the result.</p>
<p>First version looked like this:</p>
<pre><code>if([elementName compare:@"companyName"] == 0)
[character setCorporationName:currentElementText];
else if([elementName compare:@"corporationID"] == 0)
[character setCorporationID:currentElementText];
else if([elementName compare:@"name"] == 0)
...
</code></pre>
<p>But I don't like the <code>if-else-if-else</code> pattern this produces. Looking at the <code>switch</code> statement I see that i can only handle <code>ints</code>, <code>chars</code> etc and not objects... so is there a better implementation pattern I'm not aware of?</p>
<p>BTW I did actually come up with a better solution for setting the object's properties, but I want to know specifically about the <code>if</code>-<code>else</code> vs <code>switch</code> pattern in Objective-C</p>
| [
{
"answer_id": 104610,
"author": "Palmin",
"author_id": 5949,
"author_profile": "https://Stackoverflow.com/users/5949",
"pm_score": 2,
"selected": false,
"text": "if-else"
},
{
"answer_id": 109702,
"author": "Barry Wark",
"author_id": 2140,
"author_profile": "https://... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18590/"
] |
104,363 | <p>I'm trying to upgrade a package using yum on Fedora 8. The package is <code>elfutils</code>. Here's what I have installed locally:</p>
<pre><code>$ yum info elfutils
Installed Packages
Name : elfutils
Arch : x86_64
Version: 0.130
Release: 3.fc8
Size : 436 k
Repo : installed
Summary: A collection of utilities and DSOs to handle compiled objects
</code></pre>
<p>There's a bug in this version, and according to the <a href="https://bugzilla.redhat.com/show_bug.cgi?id=377241" rel="nofollow noreferrer">bug report</a>, a newer version has been pushed to the Fedora 8 stable repository. But, if I try to update:</p>
<pre><code>$ yum update elfutils
Setting up Update Process
Could not find update match for elfutils
No Packages marked for Update
</code></pre>
<p>Here are my repositories:</p>
<pre><code>$ yum repolist enabled
repo id repo name status
InstallMedia Fedora 8 enabled
fedora Fedora 8 - x86_64 enabled
updates Fedora 8 - x86_64 - Updates enabled
</code></pre>
<p>What am I missing?</p>
| [
{
"answer_id": 104479,
"author": "ethyreal",
"author_id": 18159,
"author_profile": "https://Stackoverflow.com/users/18159",
"pm_score": 1,
"selected": false,
"text": "yum remove elfutils\n"
},
{
"answer_id": 104801,
"author": "Lorin Hochstein",
"author_id": 742,
"auth... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/742/"
] |
104,373 | <p>I wrote an application in Java and when it runs on one customer's computer running OS X The Save and Export buttons are disabled. (Everything else works in the application.)</p>
<p>Both of these buttons open up a standard save file dialog.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 104611,
"author": "Angelo van der Sijpt",
"author_id": 19144,
"author_profile": "https://Stackoverflow.com/users/19144",
"pm_score": 2,
"selected": false,
"text": "setEnabled"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/363822/"
] |
104,383 | <p>In Visual Basic 6, when I attempt to access <em>Project > References</em>, it throws an error:</p>
<blockquote>
<p>Error accessing system registry</p>
</blockquote>
<p>I am:</p>
<ul>
<li>Logged in as the local computer administrator </li>
<li>running Windows XP Professional and </li>
<li>I can execute <code>regedt32.exe</code> and access all the registry keys just fine. </li>
</ul>
<p>VB6 was installed as the local administrator. </p>
<p>Any idea why this happens? </p>
<hr>
<p>I'm running crystal reports 8.5 and it supposed to already have fixed that issue but apparently I still have the issue with 8.5 installed. I have also made the attempt of reinstalling crystal reports with no luck on the issue. </p>
| [
{
"answer_id": 1884282,
"author": "Jim Lang",
"author_id": 194002,
"author_profile": "https://Stackoverflow.com/users/194002",
"pm_score": 3,
"selected": false,
"text": "HKCR\\TypeLib\\{00020905-0000-0000-C000-000000000046}\\8.5"
},
{
"answer_id": 48155500,
"author": "Zeus",
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18853/"
] |
104,395 | <p>I need some info on how to use margins and how exactly <em>padding</em> works.</p>
<p>For example: Should I put a line to occupy the whole width of the page (no matter what resolution is used to display the web page) letting just a small border on each side, how could I achieve this?</p>
| [
{
"answer_id": 104536,
"author": "Thomas Koschel",
"author_id": 2012356,
"author_profile": "https://Stackoverflow.com/users/2012356",
"pm_score": 0,
"selected": false,
"text": "<table width=\"100%\" cellpadding=\"5\">\n <tr>\n <td>\nOne, two, three ... One, two, three ... One, two, t... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19159/"
] |
104,420 | <p>How do I generate all the permutations of a list? For example:</p>
<pre><code>permutations([])
[]
permutations([1])
[1]
permutations([1, 2])
[1, 2]
[2, 1]
permutations([1, 2, 3])
[1, 2, 3]
[1, 3, 2]
[2, 1, 3]
[2, 3, 1]
[3, 1, 2]
[3, 2, 1]
</code></pre>
| [
{
"answer_id": 104426,
"author": "Ricardo Reyes",
"author_id": 3399,
"author_profile": "https://Stackoverflow.com/users/3399",
"pm_score": 5,
"selected": false,
"text": "def permutations (orig_list):\n if not isinstance(orig_list, list):\n orig_list = list(orig_list)\n\n yie... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3399/"
] |
104,439 | <p>The Eclipse projects are all stored in the Eclipse Foundation CVS servers. Using the source is a great way to debug your code and to figure out how to do new things. </p>
<p>Unfortunately in a large software project like BIRT, it can be difficult to know which projects and versions are required for a particular build. So what is the best way to get the source for a particular build?</p>
| [
{
"answer_id": 104426,
"author": "Ricardo Reyes",
"author_id": 3399,
"author_profile": "https://Stackoverflow.com/users/3399",
"pm_score": 5,
"selected": false,
"text": "def permutations (orig_list):\n if not isinstance(orig_list, list):\n orig_list = list(orig_list)\n\n yie... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5412/"
] |
104,448 | <p>I'm trying to create a map application similar to <a href="http://flashden.net/item/zoom-pan-controls-with-dynamic-image-settings/15713" rel="nofollow noreferrer">this</a>. Click the SWF Preview tab on the left of the image. Specifically, noticed how you can pan around, and the clickable buttons on the map move with it. Basically, how do they do that?</p>
<p>My application has a map that you can click and pan around using a startDrag() function. I have a separate layer with other, clickable movie clips that I'd like to follow the pans of the map layer. Unfortunately, Flash limits you to dragging only <a href="http://www.adobe.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary681.html" rel="nofollow noreferrer">one movie clip at a time</a>. Somebody proposed a solution using a <a href="http://proto.layer51.com/d.aspx?f=845" rel="nofollow noreferrer">prototype</a>, but I can't get that working correctly, and I'm not sure if it's because I'm using ActionScript 3.0 or not.</p>
<p>Can anybody outline a better way for me to accomplish what I'm trying to do, or a better way to do what I'm currently doing? Appreciate it.</p>
| [
{
"answer_id": 104855,
"author": "hasseg",
"author_id": 4111,
"author_profile": "https://Stackoverflow.com/users/4111",
"pm_score": 2,
"selected": false,
"text": "_siblings"
},
{
"answer_id": 608092,
"author": "Community",
"author_id": -1,
"author_profile": "https://S... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/557/"
] |
104,458 | <p>How can styles be applied to CheckBoxList ListItems. Unlike other controls, such as the Repeater where you can specify <code><ItemStyle></code>, you can't seem to specify a style for each individual control.</p>
<p>Is there some sort of work around?</p>
| [
{
"answer_id": 104502,
"author": "Andrew Burgess",
"author_id": 12096,
"author_profile": "https://Stackoverflow.com/users/12096",
"pm_score": 4,
"selected": false,
"text": ".chkboxlist td \n{\n font-size:x-large;\n}\n"
},
{
"answer_id": 104589,
"author": "Cyberherbalist",
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12096/"
] |
104,485 | <p>I'm trying to skin HTML output which I don't have control over. One of the elements is a <code>div</code> with a <code>style="overflow: auto"</code> attribute.<br>
Is there a way in CSS to force that <code>div</code> to use <code>overflow: hidden;</code>?</p>
| [
{
"answer_id": 104499,
"author": "Magnar",
"author_id": 1123,
"author_profile": "https://Stackoverflow.com/users/1123",
"pm_score": 7,
"selected": true,
"text": "!important"
},
{
"answer_id": 104501,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "htt... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4898/"
] |
104,487 | <p>Right now I'm doing something like this:</p>
<pre><code>RewriteRule ^/?logout(/)?$ logout.php
RewriteRule ^/?config(/)?$ config.php
</code></pre>
<p>I would much rather have one rules that would do the same thing for each url, so I don't have to keep adding them every time I add a new file.</p>
<p>Also, I like to match things like '/config/new' to 'config_new.php' if that is possible. I am guessing some regexp would let me accomplish this?</p>
| [
{
"answer_id": 104596,
"author": "Jason Terk",
"author_id": 12582,
"author_profile": "https://Stackoverflow.com/users/12582",
"pm_score": 1,
"selected": false,
"text": "RewriteEngine on\nRewriteMap quux-map prg:/path/to/map.quux.pl\nRewriteRule ^/~quux/(.*)$ /~quux/${quux-map... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15000/"
] |
104,516 | <p>In PHP, the HEREDOC string declarations are really useful for outputting a block of html. You can have it parse in variables just by prefixing them with $, but for more complicated syntax (like $var[2][3]), you have to put your expression inside {} braces.</p>
<p>In PHP 5, it <em>is</em> possible to actually make function calls within {} braces inside a HEREDOC string, but you have to go through a bit of work. The function name itself has to be stored in a variable, and you have to call it like it is a dynamically-named function. For example:</p>
<pre><code>$fn = 'testfunction';
function testfunction() { return 'ok'; }
$string = <<< heredoc
plain text and now a function: {$fn()}
heredoc;
</code></pre>
<p>As you can see, this is a bit more messy than just:</p>
<pre><code>$string = <<< heredoc
plain text and now a function: {testfunction()}
heredoc;
</code></pre>
<p>There are other ways besides the first code example, such as breaking out of the HEREDOC to call the function, or reversing the issue and doing something like:</p>
<pre><code>?>
<!-- directly output html and only breaking into php for the function -->
plain text and now a function: <?PHP print testfunction(); ?>
</code></pre>
<p>The latter has the disadvantage that the output is directly put into the output stream (unless I'm using output buffering), which might not be what I want.</p>
<p>So, the essence of my question is: is there a more elegant way to approach this?</p>
<p><b>Edit based on responses:</b> It certainly does seem like some kind of template engine would make my life much easier, but it would require me basically invert my usual PHP style. Not that that's a bad thing, but it explains my inertia.. I'm up for figuring out ways to make life easier though, so I'm looking into templates now.</p>
| [
{
"answer_id": 104556,
"author": "boxxar",
"author_id": 15732,
"author_profile": "https://Stackoverflow.com/users/15732",
"pm_score": 6,
"selected": false,
"text": "$string = <<< heredoc\nplain text and now a function: %s\nheredoc;\n$string = sprintf($string, testfunction());\n"
},
{... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9330/"
] |
104,520 | <p>I have been seriously disappointed with WPF validation system. Anyway! How can I validate the complete form by clicking the "button"? </p>
<p>For some reason everything in WPF is soo complicated! I can do the validation in 1 line of code in ASP.NET which requires like 10-20 lines of code in WPF!!</p>
<p>I can do this using my own ValidationEngine framework: </p>
<pre><code>Customer customer = new Customer();
customer.FirstName = "John";
customer.LastName = String.Empty;
ValidationEngine.Validate(customer);
if (customer.BrokenRules.Count > 0)
{
// do something display the broken rules!
}
</code></pre>
| [
{
"answer_id": 157665,
"author": "Christopher Bennage",
"author_id": 6855,
"author_profile": "https://Stackoverflow.com/users/6855",
"pm_score": 0,
"selected": false,
"text": " <StackPanel> \n <TextBox Text=\"{Binding CurrentCustomer.FirstName}\" />\n <TextBox Text=\"{Binding Cur... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3797/"
] |
104,525 | <p>We have a warm sql backup. full backup nightly, txn logs shipped every so often during the day and restored. I need to move the data files to another disk. These DB's are in a "warm backup" state (such that I can't unmark them as read-only - "Error 5063: Database '<dbname>' is in warm standby. A warm-standby database is read-only.
") and am worried about detaching and re-attaching. </p>
<p>How do we obtain the "warm backup" status after detach/attach operations are complete?</p>
| [
{
"answer_id": 104762,
"author": "boes",
"author_id": 17746,
"author_profile": "https://Stackoverflow.com/users/17746",
"pm_score": 3,
"selected": true,
"text": "backup database activedb to disk='somefile'\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10235/"
] |
104,550 | <p>Are <code>.css</code> files always needed? Or may I have a <code>.css</code> "basic" file and define other style items inside the HTML page?</p>
<p>Does <code>padding</code>, <code>borders</code> and so on always have to be defined in a <code>.css</code> file that is stored separately, or may I embed then into an HTML page?</p>
| [
{
"answer_id": 104595,
"author": "Michael",
"author_id": 13379,
"author_profile": "https://Stackoverflow.com/users/13379",
"pm_score": 3,
"selected": false,
"text": "<style>"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19159/"
] |
104,568 | <p>Is there any way that my script can retrieve metadata values that are declared in its own header? I don't see anything promising in the API, except perhaps <code>GM_getValue()</code>. That would of course involve a special name syntax. I have tried, for example: <code>GM_getValue("@name")</code>.</p>
<p>The motivation here is to avoid redundant specification.</p>
<p>If GM metadata is not directly accessible, perhaps there's a way to read the body of the script itself. It's certainly in memory somewhere, and it wouldn't be too awfully hard to parse for <code>"// @"</code>. (That may be necessary in my case any way, since the value I'm really interested in is <code>@version</code>, which is an extended value read by <a href="http://userscripts.org/" rel="noreferrer">userscripts.org</a>.)</p>
| [
{
"answer_id": 104814,
"author": "Athena",
"author_id": 17846,
"author_profile": "https://Stackoverflow.com/users/17846",
"pm_score": 4,
"selected": true,
"text": "GM_info"
},
{
"answer_id": 10475344,
"author": "Brock Adams",
"author_id": 331508,
"author_profile": "ht... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14749/"
] |
104,587 | <p>Everywhere I look always the same explanation pop ups.<br/>
Configure the view resolver.</p>
<pre><code><bean id="viewMappings"
class="org.springframework.web.servlet.view.ResourceBundleViewResolver">
<property name="basename" value="views" />
</bean>
</code></pre>
<p>And then put a file in the classpath named view.properties with some key-value pairs (don't mind the names).<br/></p>
<pre><code>logout.class=org.springframework.web.servlet.view.JstlView
logout.url=WEB-INF/jsp/logout.jsp
</code></pre>
<p>What does <code>logout.class</code> and <code>logout.url</code> mean?<br/>
How does <code>ResourceBundleViewResolver</code> uses the key-value pairs in the file?<br/>
My goal is that when someone enters the URI <code>myserver/myapp/logout.htm</code> the file <code>logout.jsp</code> gets served.</p>
| [
{
"answer_id": 105554,
"author": "Brian Matthews",
"author_id": 1969,
"author_profile": "https://Stackoverflow.com/users/1969",
"pm_score": 0,
"selected": false,
"text": "logout"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2024/"
] |
104,599 | <p>I need to write a Java Comparator class that compares Strings, however with one twist. If the two strings it is comparing are the same at the beginning and end of the string are the same, and the middle part that differs is an integer, then compare based on the numeric values of those integers. For example, I want the following strings to end up in order they're shown:</p>
<ul>
<li>aaa</li>
<li>bbb 3 ccc</li>
<li>bbb 12 ccc</li>
<li>ccc 11</li>
<li>ddd</li>
<li>eee 3 ddd jpeg2000 eee</li>
<li>eee 12 ddd jpeg2000 eee</li>
</ul>
<p>As you can see, there might be other integers in the string, so I can't just use regular expressions to break out any integer. I'm thinking of just walking the strings from the beginning until I find a bit that doesn't match, then walking in from the end until I find a bit that doesn't match, and then comparing the bit in the middle to the regular expression "[0-9]+", and if it compares, then doing a numeric comparison, otherwise doing a lexical comparison.</p>
<p>Is there a better way?</p>
<p><strong>Update</strong> I don't think I can guarantee that the other numbers in the string, the ones that may match, don't have spaces around them, or that the ones that differ do have spaces.</p>
| [
{
"answer_id": 104693,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 0,
"selected": false,
"text": "int"
},
{
"answer_id": 104926,
"author": "Paul Brinkley",
"author_id": 18160,
"author_profile": "https:/... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3333/"
] |
104,601 | <p>I want to do a <code>Response.Redirect("MyPage.aspx")</code> but have it open in a new browser window. I've done this before without using the JavaScript register script method. I just can't remember how?</p>
| [
{
"answer_id": 104660,
"author": "JamesSugrue",
"author_id": 1075,
"author_profile": "https://Stackoverflow.com/users/1075",
"pm_score": 5,
"selected": false,
"text": "response.write(\"<script>\");\nresponse.write(\"window.open('page.html','_blank')\");\nresponse.write(\"</script>\");\n"... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
104,603 | <p>Is there a way to iterate (through foreach preferably) over a collection using reflection? I'm iterating over the properties in an object using reflection, and when the program gets to a type that is a collection, I'd like it to iterate over the contents of the collection and be able to access the objects in the collection.</p>
<p>At the moment I have an attribute set on all of my properties, with an IsCollection flag set to true on the properties that are collections. My code checks for this flag and if it's true, it gets the Type using reflection. Is there a way to invoke GetEnumerator or Items somehow on a collection to be able to iterate over the items?</p>
| [
{
"answer_id": 104664,
"author": "Darren Kopp",
"author_id": 77,
"author_profile": "https://Stackoverflow.com/users/77",
"pm_score": 6,
"selected": true,
"text": "if (item is IEnumerable)\n{\n foreach (object o in (item as IEnumerable))\n {\n\n }\n} else {\n // reflect over it... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12999/"
] |
104,612 | <p>I want to copy a live production database into my local development database. Is there a way to do this without locking the production database?</p>
<p>I'm currently using:</p>
<pre class="lang-none prettyprint-override"><code>mysqldump -u root --password=xxx -h xxx my_db1 | mysql -u root --password=xxx -h localhost my_db1
</code></pre>
<p>But it's locking each table as it runs.</p>
| [
{
"answer_id": 104628,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 10,
"selected": true,
"text": "--lock-tables=false"
},
{
"answer_id": 105207,
"author": "dvorak",
"author_id": 19235,
"author_pro... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13009/"
] |
104,618 | <p>I've been trying to get into F# on and off for a while but I keep getting put off. Why?</p>
<p>Because no matter which 'beginners' resource I try to look at I see very simple examples that start using the operator <code>-></code>.</p>
<p>However, nowhere have I found as yet that provides a clear simple explanation of what this operator means. It's as though it must be so obvious that it doesn't need explanation even to complete newbies.</p>
<p>I must therefore be really dense or perhaps it's nearly 3 decades of previous experience holding me back.</p>
<p>Can someone please, explain it or point to a truly accessible resource that explains it?</p>
| [
{
"answer_id": 104744,
"author": "Blair Conrad",
"author_id": 1199,
"author_profile": "https://Stackoverflow.com/users/1199",
"pm_score": 4,
"selected": false,
"text": "> List.map (fun x -> x % 2 = 0) [1 .. 10];;\nval it : bool list\n= [false; true; false; true; false; true; false; true;... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17516/"
] |
104,640 | <p>By default when using a webapp server in Eclipse Web Tools, the server startup will fail after a timeout of 45 seconds. I can increase this timeout in the server instance properties, but I don't see a way to disable the timeout entirely (useful when debugging application startup). Is there a way to do this?</p>
| [
{
"answer_id": 65708767,
"author": "Jason Pyeron",
"author_id": 58794,
"author_profile": "https://Stackoverflow.com/users/58794",
"pm_score": 0,
"selected": false,
"text": ".metadata/.plugins/org.eclipse.wst.server.core/servers.xml"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5586/"
] |
104,674 | <p>It's known that you should declare events that take as parameters <code>(object sender, EventArgs args)</code>. Why?</p>
| [
{
"answer_id": 105519,
"author": "fryguybob",
"author_id": 4592,
"author_profile": "https://Stackoverflow.com/users/4592",
"pm_score": 2,
"selected": false,
"text": "(sender, e)"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11236/"
] |
104,725 | <p>Joel Spolsky <a href="http://www.joelonsoftware.com/articles/PleaseLinker.html" rel="noreferrer">praised</a> native-code versions of programs that have no dependencies on runtimes. </p>
<p>What native-code compilers are available for functional languages?</p>
| [
{
"answer_id": 104956,
"author": "nlucaroni",
"author_id": 157,
"author_profile": "https://Stackoverflow.com/users/157",
"pm_score": 3,
"selected": false,
"text": "ocamlc"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17569/"
] |
104,747 | <p>I have a members table in MySQL</p>
<pre><code>CREATE TABLE `members` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(65) collate utf8_unicode_ci NOT NULL,
`order` tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
</code></pre>
<p>And I would like to let users order the members how they like.
I'm storing the order in <code>order</code> column.</p>
<p>I'm wondering how to insert new user to be added to the bottom of the list.
This is what I have today:</p>
<pre><code>$db->query('insert into members VALUES (0, "new member", 0)');
$lastId = $db->lastInsertId();
$maxOrder = $db->fetchAll('select MAX(`order`) max_order FROM members');
$db->query('update members
SET
`order` = ?
WHERE
id = ?',
array(
$maxOrder[0]['max_order'] + 1,
$lastId
));
</code></pre>
<p>But that's not really precise while when there are several users adding new members at the same time, it might happen the <code>MAX(order)</code> will return the same values.</p>
<p>How do you handle such cases?</p>
| [
{
"answer_id": 104961,
"author": "Harrison Fisk",
"author_id": 16111,
"author_profile": "https://Stackoverflow.com/users/16111",
"pm_score": 3,
"selected": true,
"text": "order"
},
{
"answer_id": 105217,
"author": "user10340",
"author_id": 10340,
"author_profile": "ht... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19217/"
] |
104,764 | <p>Are there any prebuilt modules for this? Is there an event thats called everytime a page is loaded? I'm just trying to secure one of my more important admin sections.</p>
| [
{
"answer_id": 104839,
"author": "AaronS",
"author_id": 26932,
"author_profile": "https://Stackoverflow.com/users/26932",
"pm_score": 0,
"selected": false,
"text": " Request.ServerVariables[\"REMOTE_ADDR\"]\n"
},
{
"answer_id": 105373,
"author": "Chris Cudmore",
"autho... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8456/"
] |
104,791 | <p>The SQL-LDR documentation states that you need to do a convetional Path Load:</p>
<blockquote>
<p>When you want to apply SQL functions
to data fields. SQL functions are not
available during a direct path load</p>
</blockquote>
<p>I have TimeStamp data stored in a CSV file that I'm loading with SQL-LDR by describing the fields as such:</p>
<pre><code>STARTTIME "To_TimeStamp(:STARTTIME,'YYYY-MM-DD HH24:MI:SS.FF6')",
COMPLETIONTIME "To_TimeStamp(:COMPLETIONTIME,'YYYY-MM-DD HH24:MI:SS.FF6')"
</code></pre>
<p>So my question is: Can you load timestamp data without a function, or is it the case that you can not do a Direct Path Load when Loading TimeStamp data?</p>
| [
{
"answer_id": 104839,
"author": "AaronS",
"author_id": 26932,
"author_profile": "https://Stackoverflow.com/users/26932",
"pm_score": 0,
"selected": false,
"text": " Request.ServerVariables[\"REMOTE_ADDR\"]\n"
},
{
"answer_id": 105373,
"author": "Chris Cudmore",
"autho... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9940/"
] |
104,797 | <p>What is the best way to create a webservice for accepting an image.
The image might be quite big and I do not want to change the default receive size for the web application.
I have written one that accepts a binary image but that I feel that there has to be a better alternative.</p>
| [
{
"answer_id": 104902,
"author": "core",
"author_id": 11574,
"author_profile": "https://Stackoverflow.com/users/11574",
"pm_score": 3,
"selected": true,
"text": "using System.Drawing;\nusing System.IO;\nusing System.Net;\nusing System.Net.Sockets;\n\n[OperationContract]\npublic void Fetc... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/403/"
] |
104,799 | <p>Why isn't <a href="http://java.sun.com/javase/6/docs/api/java/util/Collection.html#remove(java.lang.Object)" rel="noreferrer">Collection.remove(Object o)</a> generic? </p>
<p>Seems like <code>Collection<E></code> could have <code>boolean remove(E o);</code> </p>
<p>Then, when you accidentally try to remove (for example) <code>Set<String></code> instead of each individual String from a <code>Collection<String></code>, it would be a compile time error instead of a debugging problem later.</p>
| [
{
"answer_id": 104943,
"author": "noah",
"author_id": 12034,
"author_profile": "https://Stackoverflow.com/users/12034",
"pm_score": -1,
"selected": false,
"text": "Set stringSet = new HashSet();\n// do some stuff...\nObject o = \"foobar\";\nstringSet.remove(o);\n"
},
{
"answer_id... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15816/"
] |
104,803 | <p>I've got a (mostly) working plugin developed, but since its function is directly related to the project it processes, how do you develop unit and integration tests for the plugin. The best idea I've had is to create an integration test project for the plugin that uses the plugin during its lifecycle and has tests that report on the plugins success or failure in processing the data.</p>
<p>Anyone with better ideas?</p>
| [
{
"answer_id": 105259,
"author": "Brian Matthews",
"author_id": 1969,
"author_profile": "https://Stackoverflow.com/users/1969",
"pm_score": 4,
"selected": true,
"text": "src/test/resources"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17008/"
] |
104,837 | <p>I'd like to have some rails apps over different servers sharing the same session. I can do it within the same server but don't know if it is possible to share over different servers. Anyone already did or knows how to do it?</p>
<p>Thanks</p>
| [
{
"answer_id": 105001,
"author": "webmat",
"author_id": 6349,
"author_profile": "https://Stackoverflow.com/users/6349",
"pm_score": 3,
"selected": false,
"text": "rake db:sessions:create\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19224/"
] |
104,844 | <p>I'm looking for a way to find the name of the Windows default printer using unmanaged C++ (found plenty of .NET examples, but no success unmanaged). Thanks.</p>
| [
{
"answer_id": 104882,
"author": "Doug T.",
"author_id": 8123,
"author_profile": "https://Stackoverflow.com/users/8123",
"pm_score": 3,
"selected": true,
"text": "char szPrinterName[255];\nunsigned long lPrinterNameLength;\nGetDefaultPrinter( szPrinterName, &lPrinterNameLength );\nHDC hP... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8117/"
] |
104,850 | <p>I want to try to convert a string to a Guid, but I don't want to rely on catching exceptions (</p>
<ul>
<li>for performance reasons - exceptions are expensive</li>
<li>for usability reasons - the debugger pops up </li>
<li>for design reasons - the expected is not exceptional</li>
</ul>
<p>In other words the code:</p>
<pre><code>public static Boolean TryStrToGuid(String s, out Guid value)
{
try
{
value = new Guid(s);
return true;
}
catch (FormatException)
{
value = Guid.Empty;
return false;
}
}
</code></pre>
<p>is not suitable.</p>
<p>I would try using RegEx, but since the guid can be parenthesis wrapped, brace wrapped, none wrapped, makes it hard. </p>
<p>Additionally, I thought certain Guid values are invalid(?)</p>
<hr>
<p><strong>Update 1</strong></p>
<p><a href="https://stackoverflow.com/questions/104850/c-test-if-string-is-a-guid-without-throwing-exceptions#137829">ChristianK</a> had a good idea to catch only <code>FormatException</code>, rather than all. Changed the question's code sample to include suggestion.</p>
<hr>
<p><strong>Update 2</strong></p>
<p>Why worry about thrown exceptions? Am I really expecting invalid GUIDs all that often? </p>
<p>The answer is <em>yes</em>. That is why I am using TryStrToGuid - I <strong>am</strong> expecting bad data.</p>
<p><strong>Example 1</strong> <a href="http://msdn.microsoft.com/en-us/library/cc144096(VS.85).aspx" rel="noreferrer">Namespace extensions can be specified by appending a GUID to a folder name</a>. I might be parsing folder names, checking to see if the text after the final <strong>.</strong> is a GUID.</p>
<pre><code>c:\Program Files
c:\Program Files.old
c:\Users
c:\Users.old
c:\UserManager.{CE7F5AA5-6832-43FE-BAE1-80D14CD8F666}
c:\Windows
c:\Windows.old
</code></pre>
<p><strong>Example 2</strong> I might be running a heavily used web-server wants to check the validity of some posted back data. I don't want invalid data tying up resources 2-3 orders of magnitude higher than it needs to be.</p>
<p><strong>Example 3</strong> I might be parsing a search expression entered by a user. </p>
<p><img src="https://i.stack.imgur.com/Ghb12.png" alt="enter image description here"></p>
<p>If they enter GUID's I want to process them specially (such as specifically searching for that object, or highlight and format that specific search term in the response text.)</p>
<hr>
<p><strong>Update 3 - Performance benchmarks</strong></p>
<p>Test converting 10,000 good Guids, and 10,000 bad Guids.</p>
<pre><code>Catch FormatException:
10,000 good: 63,668 ticks
10,000 bad: 6,435,609 ticks
Regex Pre-Screen with try-catch:
10,000 good: 637,633 ticks
10,000 bad: 717,894 ticks
COM Interop CLSIDFromString
10,000 good: 126,120 ticks
10,000 bad: 23,134 ticks
</code></pre>
<p><em>p.s. I shouldn't have to justify a question.</em></p>
| [
{
"answer_id": 104932,
"author": "pdavis",
"author_id": 7819,
"author_profile": "https://Stackoverflow.com/users/7819",
"pm_score": 3,
"selected": false,
"text": "^[A-Fa-f0-9]{32}$|^({|\\\\()?[A-Fa-f0-9]{8}-([A-Fa-f0-9]{4}-){3}[A-Fa-f0-9]{12}(}|\\\\))?$|^({)?[0xA-Fa-f0-9]{3,10}(, {0,1}[0... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] |
104,854 | <p>When I start Tomcat (6.0.18) from Eclipse (3.4), I receive this message (first in the log):</p>
<blockquote>
<p>WARNING:
[SetPropertiesRule]{Server/Service/Engine/Host/Context}
Setting property 'source' to
'org.eclipse.jst.jee.server: (project name)'
did not find a matching property.</p>
</blockquote>
<p>Seems this message does not have any severe impact, however, does anyone know how to get rid of it?</p>
| [
{
"answer_id": 355378,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<wb-resource deploy-path=\"/WEB-INF/classes\" source-path=\"/src/main/resources\"/>\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17585/"
] |
104,866 | <p>Looking for C# class which wraps calls to do the following:</p>
<p>read and write a key value
read & write a key entry</p>
<p>enumerate the entries in a key. This is important. For example, need to list all entries in:
HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources</p>
<p>(I scanned through some codeproject.com registry classes and they didn't enumerate)</p>
| [
{
"answer_id": 104912,
"author": "Clinton Pierce",
"author_id": 8173,
"author_profile": "https://Stackoverflow.com/users/8173",
"pm_score": 2,
"selected": false,
"text": " Registry.CurrentUser.OpenSubKey()\n Registry.CurrentUser.CreateSubKey()\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5232/"
] |
104,872 | <p>I'm working on a <code>PHP</code> application that links into the <code>Protx VSP Direct payment gateway</code>. To handle "3D Secure" requests from the credit card processing company, I need to forward the user to a different website, mimicking a form that has been posted. I'm trying to use the <code>cURL</code> libraries, but seem to have hit a problem. My code is the following: </p>
<pre><code><?php
$ch = curl_init();
// Set the URL
curl_setopt($ch, CURLOPT_URL, 'http://www.google.com/');
// Perform a POST
curl_setopt($ch, CURLOPT_POST, 1);
// If not set, curl prints output to the browser
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 0);
// Set the "form fields"
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$output = curl_exec($ch);
curl_close($ch);
?>
</code></pre>
<p>All this does is grab the content of the URL passed through, and doesn't forward the user anywhere. I've tried Googling and reading up as much as I can, but can't figure out what i'm missing. Any ideas? I don't want to have to create a HTML form that auto-submits itself if I can avoid it.</p>
<p>Thanks for any help :-)</p>
| [
{
"answer_id": 104887,
"author": "neu242",
"author_id": 13365,
"author_profile": "https://Stackoverflow.com/users/13365",
"pm_score": 3,
"selected": true,
"text": "<html> \n <head> \n <title>Processing your request...</title> \n </head> \n <body OnLoad=\"OnLoadEvent();\">... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19232/"
] |
104,918 | <p>My question is related to the command pattern, where we have the following abstraction (C# code) :</p>
<pre><code>public interface ICommand
{
void Execute();
}
</code></pre>
<p>Let's take a simple concrete command, which aims to delete an entity from our application. A <code>Person</code> instance, for example.</p>
<p>I'll have a <code>DeletePersonCommand</code>, which implements <code>ICommand</code>. This command needs the <code>Person</code> to delete as a parameter, in order to delete it when <code>Execute</code> method is called.</p>
<p>What is the best way to manage parametrized commands ? How to pass parameters to commands, before executing them ?</p>
| [
{
"answer_id": 104940,
"author": "Matt Dillard",
"author_id": 863,
"author_profile": "https://Stackoverflow.com/users/863",
"pm_score": 0,
"selected": false,
"text": "DeletePersonCommand"
},
{
"answer_id": 104946,
"author": "Joel Martinez",
"author_id": 5416,
"author_... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4687/"
] |
104,952 | <p>I am using VS2005 VC++ for unmanaged C++. I have VSTS and am trying to use the code coverage tool to accomplish two things with regards to unit tests:</p>
<ol>
<li>See how much of my referenced code under test is getting executed</li>
<li>See how many methods of my code under test (if any) are not unit tested at all</li>
</ol>
<p>Setting up the VSTS code coverage tool (see the <a href="https://blogs.msdn.com/ms_joc/articles/406608.aspx" rel="nofollow noreferrer" title="MSDN Code Coverage Blog">link text</a>) and accomplishing task #1 was straightforward. However #2 has been a surprising challenge for me. Here is my test code. </p>
<pre><code>class CodeCoverageTarget
{
public:
std::string ThisMethodRuns() {
return "Running";
}
std::string ThisMethodDoesNotRun() {
return "Not Running";
}
};
#include <iostream>
#include "CodeCoverageTarget.h"
using namespace std;
int main()
{
CodeCoverageTarget cct;
cout<<cct.ThisMethodRuns()<<endl;
}
</code></pre>
<p>When both methods are defined within the class as above the compiler automatically eliminates the ThisMethodDoesNotRun() from the obj file. If I move it's definition outside the class then it is included in the obj file and the code coverage tool shows it has not been exercised at all. Under most circumstances I want the compiler to do this elimination for me but for the code coverage tool it defeats a significant portion of the value (e.g. finding untested methods). I have tried a number of things to tell the compiler to stop being smart for me and compile everything but I am stumped. It would be nice if the code coverage tool compensated for this (I suppose by scanning the source and matching it up with the linker output) but I didn't find anything to suggest it has a special mode to be turned on. Am I totally missing something simple here or is this not possible with the VC++ compiler + VSTS code coverage tool? </p>
<p>Thanks in advance,
KGB</p>
| [
{
"answer_id": 105238,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 1,
"selected": false,
"text": "\nint main(int argc, char **argv)\n{\n if(argv == NULL) // C runtime says this won't happen\n someMethodWhichIs... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
104,953 | <p>I'm trying to create a horizontal 100% stacked bar graph using HTML and CSS. I'd like to create the bars using <code>DIVs</code> with background colors and percentage widths depending on the values I want to graph. I also want to have a grid lines to mark an arbitrary position along the graph.</p>
<p>In my experimentation, I've already gotten the bars to stack horizontally by assigning the CSS property <code>float: left</code>. However, I'd like to avoid that, as it really seems to mess with the layout in confusing ways. Also, the grid lines don't seem to work very well when the bars are floated.</p>
<p>I think that CSS positioning should be able to handle this, but I don't yet know how to do it. I want to be able to specify the position of several elements relative to the top-left corner of their container. I run into this sort of issue regularly (even outside of this particular graph project), so I'd like a method that's:</p>
<ol>
<li>Cross-browser (ideally without too many browser hacks)</li>
<li>Runs in Quirks mode</li>
<li>As clear/clean as possible, to facilitate customizations</li>
<li>Done without JavaScript if possible.</li>
</ol>
| [
{
"answer_id": 104965,
"author": "Stephen Deken",
"author_id": 7154,
"author_profile": "https://Stackoverflow.com/users/7154",
"pm_score": 4,
"selected": false,
"text": "div.parent{\n position: relative;\n left: 0px; /* stick it wherever it was positioned by default */\n top: 0... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3488/"
] |
104,959 | <p>If I have a <code>std::vector</code> or <code>std::map</code> variable, and I want to see the contents, it's a big pain to see the nth element while debugging. Is there a plugin, or some trick to making it easier to watch STL container variables while debugging <code>(VS2003/2005/2008)</code>?</p>
| [
{
"answer_id": 105563,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 4,
"selected": false,
"text": "(v._Myfirst)[startIndex], count"
},
{
"answer_id": 29318546,
"author": "1''",
"author_id": 1397061,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10705/"
] |
104,960 | <p>What is the best way to interact with a database using Haskell? I'm accustomed to using some sort of ORM (Django's ORM, hibernate, etc.) and something similar would be nice when creating apps with <a href="http://www.happs.org/" rel="noreferrer">HAppS</a>.</p>
<p><strong>Edit:</strong> I'd like to be free to choose from Postgresql MySql and SQLite as far as the actual databases go. </p>
| [
{
"answer_id": 16802511,
"author": "John Wiegley",
"author_id": 370902,
"author_profile": "https://Stackoverflow.com/users/370902",
"pm_score": 3,
"selected": false,
"text": "User\n name Text\n age Int\n\nLogin\n user UserId\n login Text\n passwd Text\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/104960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3446/"
] |
104,967 | <p>As a pet-project, I'd like to attempt to implement a basic language of my own design that can be used as a web-scripting language. It's trivial to run a C++ program as an Apache CGI, so the real work lies in how to parse an input file containing non-code (HTML/CSS markup) and server-side code.</p>
<p>In my undergrad compiler course, we used <a href="http://www.gnu.org/software/flex/" rel="nofollow noreferrer">Flex</a> and <a href="http://www.gnu.org/software/bison/" rel="nofollow noreferrer">Bison</a> to generate a scanner and a parser for a simple language. We were given a copy of the grammar and wrote a parser that translated the simple language to a simple assembly for a virtual machine. The flex scanner tokenizes the input, and passes the tokens to the Bison parser.</p>
<p>The difference between that and what I'd like to do is that like PHP, this language could have plain HTML markup and the scripting language interspersed like the following:</p>
<pre><code><p>Hello,
<? echo "World ?>
</p>
</code></pre>
<p>Am I incorrect in assuming that it would be efficient to parse the input file as follows:</p>
<ol>
<li>Scan input until a script start tag is found ('
<li>Second scanner tokenizes the server-side script section of the input file (from the open tag: '') and passes the token to the parser, which has no need to know about the markup in the file.</li>
<li>Control is returned to the first scanner that continues this general pattern.</li>
</ol>
<p>Basically, the first scanner only differentiates between Markup (which is returned directly to the browser unmodified) and code, which is passed to the second scanner, which in turn tokenizes the code and passes the tokens to the parser. </p>
<p>If this is <em>not</em> a solid design pattern, how do languages such as PHP handle scanning input and parsing code efficiently?</p>
| [
{
"answer_id": 105082,
"author": "Kris Erickson",
"author_id": 3798,
"author_profile": "https://Stackoverflow.com/users/3798",
"pm_score": 2,
"selected": false,
"text": "zend_language_scanner.l"
},
{
"answer_id": 111218,
"author": "eduffy",
"author_id": 7536,
"author_... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8636/"
] |
104,971 | <p>I have a table with a "Date" column. Each Date may appear multiple times. How do I select only the dates that appear < k number of times?</p>
| [
{
"answer_id": 104984,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 3,
"selected": false,
"text": "SELECT * FROM [MyTable] WHERE [Date] IN\n(\n SELECT [Date] \n FROM [MyTable] \n GROUP By [Date] \n HAVING ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10675/"
] |
104,983 | <p>In Python specifically, how do variables get shared between threads?</p>
<p>Although I have used <code>threading.Thread</code> before I never really understood or saw examples of how variables got shared. Are they shared between the main thread and the children or only among the children? When would I need to use thread local storage to avoid this sharing?</p>
<p>I have seen many warnings about synchronizing access to shared data among threads by using locks but I have yet to see a really good example of the problem. </p>
<p>Thanks in advance!</p>
| [
{
"answer_id": 105025,
"author": "Thomas Wouters",
"author_id": 17624,
"author_profile": "https://Stackoverflow.com/users/17624",
"pm_score": 8,
"selected": true,
"text": "Thread"
},
{
"answer_id": 106560,
"author": "Aaron Maenpaa",
"author_id": 2603,
"author_profile"... | 2008/09/19 | [
"https://Stackoverflow.com/questions/104983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19215/"
] |
105,007 | <p>I have read <a href="https://stackoverflow.com/questions/34571/whats-the-best-way-of-unit-testing-private-methods">this post</a> about how to test private methods. I usually do not test them, because I always thought it's faster to test only public methods that will be called from outside the object. Do you test private methods? Should I always test them?</p>
| [
{
"answer_id": 7239814,
"author": "eddy147",
"author_id": 30759,
"author_profile": "https://Stackoverflow.com/users/30759",
"pm_score": 6,
"selected": false,
"text": "class Detective {\n public function investigate() {}\n private function sleepWithSuspect($suspect) {}\n}\nAltered versi... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13913/"
] |
105,014 | <p>A while ago I came across some code that marked a member variable of a class with the <code>mutable</code> keyword. As far as I can see it simply allows you to modify a variable in a <code>const</code> method:</p>
<pre><code>class Foo
{
private:
mutable bool done_;
public:
void doSomething() const { ...; done_ = true; }
};
</code></pre>
<p>Is this the only use of this keyword or is there more to it than meets the eye? I have since used this technique in a class, marking a <code>boost::mutex</code> as mutable allowing <code>const</code> functions to lock it for thread-safety reasons, but, to be honest, it feels like a bit of a hack.</p>
| [
{
"answer_id": 105052,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 5,
"selected": false,
"text": "const"
},
{
"answer_id": 105056,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile":... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9236/"
] |
105,031 | <p>Using C#, I want to get the total amount of RAM that my computer has.
With the PerformanceCounter I can get the amount of Available ram, by setting:</p>
<pre><code>counter.CategoryName = "Memory";
counter.Countername = "Available MBytes";
</code></pre>
<p>But I can't seem to find a way to get the total amount of memory. How would I go about doing this?</p>
<p><strong>Update:</strong></p>
<p>MagicKat: I saw that when I was searching, but it doesn't work - "Are you missing an assembly or reference?". I've looked to add that to the References, but I don't see it there.</p>
| [
{
"answer_id": 105084,
"author": "MagicKat",
"author_id": 8505,
"author_profile": "https://Stackoverflow.com/users/8505",
"pm_score": 8,
"selected": false,
"text": "Microsoft.VisualBasic"
},
{
"answer_id": 105099,
"author": "CodeRot",
"author_id": 14134,
"author_profi... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13713/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.