qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
142,252 | <p>This code works (C# 3)</p>
<pre><code>double d;
if(d == (double)(int)d) ...;
</code></pre>
<ol>
<li>Is there a better way to do this?</li>
<li>For extraneous reasons I want to avoid the double cast so; what nice ways exist other than this? (even if they aren't as good)</li>
</ol>
<p><em>Note:</em> Several people pointed out the (important) point that == is often problematic regrading floating point. In this cases I expect values in the range of 0 to a few hundred and they are supposed to be integers (non ints are errors) so if those points "shouldn't" be an issue for me.</p>
| [
{
"answer_id": 142262,
"author": "swilliams",
"author_id": 736,
"author_profile": "https://Stackoverflow.com/users/736",
"pm_score": 2,
"selected": false,
"text": "if (d == (int)d) {\n //...\n}\n"
},
{
"answer_id": 142263,
"author": "Community",
"author_id": -1,
"auth... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1343/"
] |
142,261 | <p>Is there a way to get the C/C++ preprocessor or a template or such to mangle/hash the __FILE__ and __LINE__ and perhaps some other external input like a build-number into a single short number that can be quoted in logs or error messages?</p>
<p>(The intention would be to be able to reverse it (to a list of candidates if its lossy) when needed when a customer quotes it in a bug report.)</p>
| [
{
"answer_id": 142328,
"author": "Mike G.",
"author_id": 18901,
"author_profile": "https://Stackoverflow.com/users/18901",
"pm_score": 0,
"selected": false,
"text": "typedef union ErrorCode {\n struct {\n unsigned int file: 15;\n unsigned int line: 12; /* Better than 5 b... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15721/"
] |
142,273 | <p>We are beginning to go down the path of mobile browser support for an enterprise e-commerce webapp (Java/Servlet based). Of course there are many decisions to be made, but it seems to me the cornerstone is to be able to reliably detect mobile browsers, and make decisions on the content to be returned accordingly. Is there a standard way to make this determination (quickly) based on the http request, and ideally glean more information about the given browser and device making the request (screen size, html capabilities, etc?).</p>
<p>I would also appreciate any supplemental information that would be of use from someone who has gone down this path of taking an existing large scale enterprise webapp and architect-ing out mobile browser support from the development side.</p>
<p>[edit] I certainly understand the request header and the information about a database of standard user agents is a great help. For those talking about 'other' request header properties, if you could include similar standardized name / resource of values that would be a big help.</p>
<p>[edit] Several users have proposed solutions that involve a call over the wire to some web service that will do the detection. While I'm sure this works, it is not a good solution for an enterprise e-commerce site for two reasons: 1) speed. A call over the wire for every page request to a third party would have huge performance implications. 2) dependency/legal. We'd tie our website response time and key functionality to their service, which is horrible for legal and risk reasons.</p>
| [
{
"answer_id": 1555338,
"author": "Dave DuPlantis",
"author_id": 8174,
"author_profile": "https://Stackoverflow.com/users/8174",
"pm_score": 2,
"selected": false,
"text": "HTTP_X_WAP_PROFILE"
},
{
"answer_id": 7988637,
"author": "ian",
"author_id": 335555,
"author_pro... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17123/"
] |
142,282 | <p>If I have a <code>UIView</code> (or <code>UIView</code> subclass) that is visible, how can I tell if it's currently being shown on the screen (as opposed to, for example, being in a section of a scroll view that is currently off-screen)?</p>
<p>To maybe give you a better idea of what I mean, <code>UITableView</code> has a couple of methods for determining the set of currently visible cells. I'm looking for some code that can make a similar determination for any given <code>UIView</code>.</p>
| [
{
"answer_id": 145040,
"author": "schwa",
"author_id": 23113,
"author_profile": "https://Stackoverflow.com/users/23113",
"pm_score": 5,
"selected": true,
"text": "CGRectIntersectsRect()"
},
{
"answer_id": 11855952,
"author": "Steven Hepting",
"author_id": 98855,
"auth... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142282",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/544/"
] |
142,317 | <p>I have the following code that shows either a bug or a misunderstanding on my part.</p>
<p>I sent the same list, but modified over an ObjectOutputStream. Once as [0] and other as [1]. But when I read it, I get [0] twice. I think this is caused by the fact that I am sending over the same object and ObjectOutputStream must be caching them somehow.</p>
<p>Is this work as it should, or should I file a bug?</p>
<pre>
import java.io.*;
import java.net.*;
import java.util.*;
public class OOS {
public static void main(String[] args) throws Exception {
Thread t1 = new Thread(new Runnable() {
public void run() {
try {
ServerSocket ss = new ServerSocket(12344);
Socket s= ss.accept();
ObjectOutputStream oos = new ObjectOutputStream(s.getOutputStream());
List same = new ArrayList();
same.add(0);
oos.writeObject(same);
same.clear();
same.add(1);
oos.writeObject(same);
} catch(Exception e) {
e.printStackTrace();
}
}
});
t1.start();
Socket s = new Socket("localhost", 12344);
ObjectInputStream ois = new ObjectInputStream(s.getInputStream());
// outputs [0] as expected
System.out.println(ois.readObject());
// outputs [0], but expected [1]
System.out.println(ois.readObject());
System.exit(0);
}
}
</pre>
| [
{
"answer_id": 142704,
"author": "Pyrolistical",
"author_id": 21838,
"author_profile": "https://Stackoverflow.com/users/21838",
"pm_score": 3,
"selected": false,
"text": "public void writeUnshared(Object obj);\n"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/142317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21838/"
] |
142,319 | <p>This is a new gmail labs feature that lets you specify an RSS feed to grab random quotes from to append to your email signature. I'd like to use that to generate signatures programmatically based on parameters I pass in, the current time, etc. (For example, I have a script in pine that appends the current probabilities of McCain and Obama winning, fetched from intrade's API. See below.) But it seems gmail caches the contents of the URL you specify. Any way to control that or anyone know how often gmail looks at the URL?</p>
<p>ADDED: Here's the program I'm using to test this. This file lives at <a href="http://kibotzer.com/sigs.php" rel="nofollow noreferrer">http://kibotzer.com/sigs.php</a>. The no-cache header idea, taken from here -- <a href="http://mapki.com/wiki/Dynamic_XML" rel="nofollow noreferrer">http://mapki.com/wiki/Dynamic_XML</a> -- seems to not help.</p>
<pre><code><?php
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");
//XML Header
header("content-type:text/xml");
?>
<!DOCTYPE rss PUBLIC "-//Netscape Communications//DTD RSS 0.91//EN" "http://my.netscape.com/publish/formats/rss-0.91.dtd">
<rss version="0.91">
<channel>
<title>Dynamic Signatures</title>
<link>http://kibotzer.com</link>
<description>Blah blah</description>
<language>en-us</language>
<pubDate>26 Sep 2008 02:15:01 -0000</pubDate>
<webMaster>dreeves@kibotzer.com</webMaster>
<managingEditor>dreeves@kibotzer.com (Daniel Reeves)</managingEditor>
<lastBuildDate>26 Sep 2008 02:15:01 -0000</lastBuildDate>
<image>
<title>Kibotzer Logo</title>
<url>http://kibotzer.com/logos/kibo-logo-1.gif</url>
<link>http://kibotzer.com/</link>
<width>120</width>
<height>60</height>
<description>Kibotzer</description>
</image>
<item>
<title>
Dynamic Signature 1 (<?php echo gmdate("H:i:s"); ?>)
</title>
<link>http://kibotzer.com</link>
<description>This is the description for Signature 1 (<?php echo gmdate("H:i:s"); ?>) </description>
</item>
<item>
<title>
Dynamic Signature 2 (<?php echo gmdate("H:i:s"); ?>)
</title>
<link>http://kibotzer.com</link>
<description>This is the description for Signature 2 (<?php echo gmdate("H:i:s"); ?>) </description>
</item>
</channel>
</rss>
</code></pre>
<pre>
--
http://ai.eecs.umich.edu/people/dreeves - - search://"Daniel Reeves"
Latest probabilities from intrade...
42.1% McCain becomes president (last trade 18:07 FRI)
57.0% Obama becomes president (last trade 18:34 FRI)
17.6% US recession in 2008 (last trade 16:24 FRI)
16.1% Overt air strike against Iran in '08 (last trade 17:39 FRI)
</pre>
| [
{
"answer_id": 142704,
"author": "Pyrolistical",
"author_id": 21838,
"author_profile": "https://Stackoverflow.com/users/21838",
"pm_score": 3,
"selected": false,
"text": "public void writeUnshared(Object obj);\n"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/142319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4234/"
] |
142,320 | <p>I'm setting up our new Dev server, what is the easiest way to assign multiple IP addresses to Windows 2008 Server Network Adapter?</p>
<p>I'm setting up our development machine, running IIS 7 and want to have the range between 192.168.1.200 - .254 available when I'm setting up a new website in IIS 7.</p>
| [
{
"answer_id": 142411,
"author": "Adam Mitz",
"author_id": 2574,
"author_profile": "https://Stackoverflow.com/users/2574",
"pm_score": 2,
"selected": false,
"text": "> netsh interface ipv4 add address \"Local Area Connection\" 192.168.1.201 255.255.255.0\n"
},
{
"answer_id": 1424... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3747/"
] |
142,340 | <p>I understand that Microsoft uses this template when versioning their products: Major.Minor.Build.Revision. </p>
<p>Major is changed when the "developers" want to show that there is a big change in the software and backward compatibility cannot be assumed. Maybe a major rewrite of the code is done. </p>
<p>Minor number represents a significant enhancement with the intention of backward compatibility. </p>
<p>Build number is a small change, for example a recompilation of the same source. </p>
<p>Revision is used to fix a security hole and should be fully interchangeable. Both Build and Revision are optional. This information is based on <a href="http://msdn.microsoft.com/en-us/library/system.version.aspx" rel="noreferrer">MSDN Version Class</a>. </p>
<p>How do you version your projects and why do you version them this way?</p>
| [
{
"answer_id": 142425,
"author": "Bernard",
"author_id": 61,
"author_profile": "https://Stackoverflow.com/users/61",
"pm_score": 0,
"selected": false,
"text": "001"
},
{
"answer_id": 142615,
"author": "Jonathan Lonowski",
"author_id": 15031,
"author_profile": "https:/... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4093/"
] |
142,356 | <p>What is the most efficient way to get the default constructor (i.e. instance constructor with no parameters) of a System.Type?</p>
<p>I was thinking something along the lines of the code below but it seems like there should be a simplier more efficient way to do it.</p>
<pre><code>Type type = typeof(FooBar)
BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;
type.GetConstructors(flags)
.Where(constructor => constructor.GetParameters().Length == 0)
.First();
</code></pre>
| [
{
"answer_id": 142362,
"author": "Curt Hagenlocher",
"author_id": 533,
"author_profile": "https://Stackoverflow.com/users/533",
"pm_score": 8,
"selected": true,
"text": "type.GetConstructor(Type.EmptyTypes)\n"
},
{
"answer_id": 142442,
"author": "Alex Lyman",
"author_id":... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12784/"
] |
142,357 | <p>What are the best JVM settings you have found for running Eclipse?</p>
| [
{
"answer_id": 142596,
"author": "Stephen Denne",
"author_id": 11721,
"author_profile": "https://Stackoverflow.com/users/11721",
"pm_score": 4,
"selected": false,
"text": "Workspace name (shown in window title)"
},
{
"answer_id": 144349,
"author": "VonC",
"author_id": 630... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15352/"
] |
142,391 | <p>I am making extensive use of <code>boost:shared_ptr</code> in my code. In fact, most of the objects that are allocated on the heap are held by a <code>shared_ptr</code>. Unfortunately this means that I can't pass <code>this</code> into any function that takes a <code>shared_ptr</code>. Consider this code:</p>
<pre><code>void bar(boost::shared_ptr<Foo> pFoo)
{
...
}
void Foo::someFunction()
{
bar(this);
}
</code></pre>
<p>There are two problems here. First, this won't compile because the T* constructor for <code>shared_ptr</code> is explicit. Second, if I force it to build with <code>bar(boost::shared_ptr<Foo>(this))</code> I will have created a second shared pointer to my object that will eventually lead to a double-delete.</p>
<p>This brings me to my question: Is there any standard pattern for getting a copy of the existing shared pointer you know exists from inside a method on one of those objects? Is using intrusive reference counting my only option here?</p>
| [
{
"answer_id": 142401,
"author": "Brian R. Bondy",
"author_id": 3153,
"author_profile": "https://Stackoverflow.com/users/3153",
"pm_score": 8,
"selected": true,
"text": "#include <boost/enable_shared_from_this.hpp>\n\nclass Y: public boost::enable_shared_from_this<Y>\n{\npublic:\n\n s... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1031/"
] |
142,400 | <p>I've had a hard time finding good ways of taking a time format and easily determining if it's valid then producing a resulting element that has some formatting using XSLT 1.0.</p>
<p>Given the following xml:</p>
<pre><code><root>
<srcTime>2300</srcTime>
</root>
</code></pre>
<p>It would be great to produce the resulting xml:</p>
<pre><code><root>
<dstTime>23:00</dstTime>
</root>
</code></pre>
<p>However, if the source xml contains an invalid 24 hour time format, the resulting <em>dstTime</em> element should be blank.</p>
<p>For example, when the invalid source xml is the following:</p>
<pre><code><root>
<srcTime>NOON</srcTime>
</root>
</code></pre>
<p>The resulting xml should be:</p>
<pre><code><root>
<dstTime></dstTime>
</root>
</code></pre>
<p>The question is, what's the <strong>best XSLT 1.0</strong> fragment that could be written to produce the desired results? The hope would be to keep it quite simple and not have to parse the every piece of the time (i.e. pattern matching would be sweet if possible).</p>
| [
{
"answer_id": 144536,
"author": "JeniT",
"author_id": 6739,
"author_profile": "https://Stackoverflow.com/users/6739",
"pm_score": 4,
"selected": true,
"text": "<srcTime>23:00</srcTime>"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/142400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4916/"
] |
142,407 | <p>I am testing a Ruby Rails website and wanted to get started with Unit and Functional testing.</p>
| [
{
"answer_id": 142540,
"author": "Sam Stokes",
"author_id": 20131,
"author_profile": "https://Stackoverflow.com/users/20131",
"pm_score": 3,
"selected": false,
"text": "describe \"hello_world\"\n it \"should say hello to the world\" do\n # RSpec comes with its own mock-object framewo... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22883/"
] |
142,417 | <p>Recently, <a href="https://stackoverflow.com/users/5200/lee-baldwin">Lee Baldwin</a> showed how to write a <a href="https://stackoverflow.com/questions/129877/how-do-i-write-a-generic-memoize-function#141689">generic, variable argument memoize function</a>. I thought it would be better to return a simpler function where only one parameter is required. Here is my total bogus attempt:</p>
<pre><code>local function memoize(f)
local cache = {}
if select('#', ...) == 1 then
return function (x)
if cache[x] then
return cache[x]
else
local y = f(x)
cache[x] = y
return y
end
end
else
return function (...)
local al = varg_tostring(...)
if cache[al] then
return cache[al]
else
local y = f(...)
cache[al] = y
return y
end
end
end
end
</code></pre>
<p>Obviously, <code>select('#', ...)</code> fails in this context and wouldn't really do what I want anyway. Is there any way to tell inside <strong>memoize</strong> how many arguments <strong>f</strong> expects? </p>
<hr>
<p>"No" is a fine answer if you know for sure. It's not a big deal to use two separate <strong>memoize</strong> functions.</p>
| [
{
"answer_id": 24216007,
"author": "Tom Blodget",
"author_id": 2226988,
"author_profile": "https://Stackoverflow.com/users/2226988",
"pm_score": 2,
"selected": false,
"text": "debug.getlocal"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/142417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1438/"
] |
142,420 | <p>I have a method lets say:</p>
<pre><code>private static String drawCellValue(
int maxCellLength, String cellValue, String align) { }
</code></pre>
<p>and as you can notice, I have a parameter called align. Inside this method I'm going to have some if condition on whether the value is a 'left' or 'right'.. setting the parameter as String, obviously I can pass any string value.. I would like to know if it's possible to have an Enum value as a method parameter, and if so, how?</p>
<p>Just in case someone thinks about this; I thought about using a Boolean value but I don't really fancy it. First, how to associate true/false with left/right ? (Ok, I can use comments but I still find it dirty) and secondly, I might decide to add a new value, like 'justify', so if I have more than 2 possible values, Boolean type is definitely not possible to use.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 142428,
"author": "Carra",
"author_id": 21679,
"author_profile": "https://Stackoverflow.com/users/21679",
"pm_score": 7,
"selected": true,
"text": "private enum Alignment { LEFT, RIGHT }; \nString drawCellValue (int maxCellLength, String cellValue, Alignment align){\n ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6618/"
] |
142,431 | <p>I'm setting up a server to offer JIRA and SVN. I figure, I'll use LDAP to keep the identity management simple. </p>
<p>So, before I write one.... is there a good app out there to let users change their ldap password? I want something that lets a user authenticate with ldap and update their password. A form with username, old password, new password and verification would be enough. </p>
<p>I can write my own, but it seems silly to do so if there's already a good app out there that handles this....</p>
<p>Thanks for the help.</p>
| [
{
"answer_id": 142428,
"author": "Carra",
"author_id": 21679,
"author_profile": "https://Stackoverflow.com/users/21679",
"pm_score": 7,
"selected": true,
"text": "private enum Alignment { LEFT, RIGHT }; \nString drawCellValue (int maxCellLength, String cellValue, Alignment align){\n ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9950/"
] |
142,452 | <p>There are many scenarios where it would be useful to call a Win32 function or some other DLL from a PowerShell script. to Given the following function signature:</p>
<pre><code>bool MyFunction( char* buffer, int* bufferSize )
</code></pre>
<p>I hear there is something that makes this easier in PowerShell CTP 2, but I'm curious how this is <strong>best done in PowerShell 1.0</strong>. The fact that the function needing to be called <strong><em>is using pointers</em></strong> could affect the solution (yet I don't really know).</p>
<p>So the question is what's the best way to write a PowerShell script that can call an exported Win32 function like the one above?</p>
<p><strong>Remember for PowerShell 1.0.</strong></p>
| [
{
"answer_id": 142516,
"author": "Bruno Gomes",
"author_id": 8669,
"author_profile": "https://Stackoverflow.com/users/8669",
"pm_score": 3,
"selected": false,
"text": "PS C:\\> Invoke-Win32 \"msvcrt.dll\" ([Int32]) \"puts\" ([String]) \"Test\"\nTest\n0\n"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/142452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4916/"
] |
142,478 | <p>In handling a WM_GETMINMAXINFO message, I attempt to alter the parameter MINMAXINFO structure by changing the ptMaxSize. It doesn't seem to have any effect. When I receive the WM_SIZE message, I always get the same value, no matter whether I increase or decrease the ptMaxSize in the WM_GETMINMAXINFO.</p>
| [
{
"answer_id": 61550191,
"author": "metablaster",
"author_id": 12091999,
"author_profile": "https://Stackoverflow.com/users/12091999",
"pm_score": 0,
"selected": false,
"text": "WS_THICKFRAME"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/142478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965047/"
] |
142,481 | <p>Is there such a thing as unit test generation? If so...</p>
<p>...does it work well? </p>
<p>...What are the auto generation solutions that are available for .NET?</p>
<p>...are there examples of using a technology like this?</p>
<p>...is this only good for certain types of applications, or could it be used to replace all manually written unit testing?</p>
| [
{
"answer_id": 40569949,
"author": "johng",
"author_id": 2390625,
"author_profile": "https://Stackoverflow.com/users/2390625",
"pm_score": 2,
"selected": false,
"text": "ErrorUnit"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/142481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19854/"
] |
142,504 | <h3>What are some methods of utilising Eclipse for Dependency Management?</h3>
| [
{
"answer_id": 203256,
"author": "Ken Liu",
"author_id": 25688,
"author_profile": "https://Stackoverflow.com/users/25688",
"pm_score": 2,
"selected": false,
"text": "mvn eclipse:eclipse"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/142504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4857/"
] |
142,508 | <p>I need my code to do different things based on the operating system on which it gets compiled. I'm looking for something like this:</p>
<pre><code>#ifdef OSisWindows
// do Windows-specific stuff
#else
// do Unix-specific stuff
#endif
</code></pre>
<p>Is there a way to do this? Is there a better way to do the same thing?</p>
| [
{
"answer_id": 142522,
"author": "davenpcj",
"author_id": 4777,
"author_profile": "https://Stackoverflow.com/users/4777",
"pm_score": 0,
"selected": false,
"text": "__WIN32__"
},
{
"answer_id": 142524,
"author": "devio",
"author_id": 21336,
"author_profile": "https://... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10601/"
] |
142,527 | <p>Is it possible to highlight text inside of a textarea using javascript? Either changing the background of just a portion of the text area or making a portion of the text <em>selected</em>?</p>
| [
{
"answer_id": 7599199,
"author": "Julien L",
"author_id": 690236,
"author_profile": "https://Stackoverflow.com/users/690236",
"pm_score": 4,
"selected": false,
"text": "<html>\n <head>\n <title></title>\n <!-- Load jQuery -->\n <script type=\"text/javascript\" sr... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/80/"
] |
142,545 | <p>The <code>__debug__</code> variable is handy in part because it affects every module. If I want to create another variable that works the same way, how would I do it?</p>
<p>The variable (let's be original and call it 'foo') doesn't have to be truly global, in the sense that if I change foo in one module, it is updated in others. I'd be fine if I could set foo before importing other modules and then they would see the same value for it.</p>
| [
{
"answer_id": 142561,
"author": "awatts",
"author_id": 22847,
"author_profile": "https://Stackoverflow.com/users/22847",
"pm_score": 1,
"selected": false,
"text": "__builtin__"
},
{
"answer_id": 142566,
"author": "Curt Hagenlocher",
"author_id": 533,
"author_profile"... | 2008/09/26 | [
"https://Stackoverflow.com/questions/142545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22897/"
] |
142,548 | <p>Is there a way to deploy a given war file on Tomcat server? I want to do this without using the web interface.</p>
| [
{
"answer_id": 142554,
"author": "anjanb",
"author_id": 11142,
"author_profile": "https://Stackoverflow.com/users/11142",
"pm_score": 2,
"selected": false,
"text": " <Context path=\"/strutsDisplayTag\" \n reloadable=\"true\" \n docBase=\"C:\\work\\learn\\jsp\\strutsDispl... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17712/"
] |
142,559 | <p>I have pushed my .htaccess files to the production severs, but they don't work. Would a restart be the next step, or should I check something else.</p>
| [
{
"answer_id": 142576,
"author": "Milen A. Radev",
"author_id": 15785,
"author_profile": "https://Stackoverflow.com/users/15785",
"pm_score": 6,
"selected": false,
"text": ".htaccess"
},
{
"answer_id": 43694908,
"author": "Abhishek Gurjar",
"author_id": 5345150,
"auth... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22325/"
] |
142,602 | <p>I was a C++ developer (mostly ATL/COM stuff) until, as many of us, I switched to C# in 2001. I didn't do much C++ programming since then.</p>
<p>Do you have any tips on how to revive my C++ skills? What has changed in C++ in the last years? Are there good books, articles or blogs covering the language. The problem is that most material I could find either targets people who are new to the language or those with a lot of experience.</p>
<p>Which C++ libraries are popular these days? I guess I will need to read on the STL because I didn't use it much. What else? Boost? ATL? WTL?</p>
| [
{
"answer_id": 142871,
"author": "Pat Notz",
"author_id": 825,
"author_profile": "https://Stackoverflow.com/users/825",
"pm_score": 2,
"selected": false,
"text": "gtest"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/142602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/712/"
] |
142,614 | <p>Does anyone have C# code handy for doing a ping and traceroute to a target computer? I am looking for a pure code solution, not what I'm doing now, which is invoking the ping.exe and tracert.exe program and parsing the output. I would like something more robust.</p>
| [
{
"answer_id": 2688152,
"author": "Scott",
"author_id": 6042,
"author_profile": "https://Stackoverflow.com/users/6042",
"pm_score": 6,
"selected": false,
"text": "using System.Collections.Generic;\nusing System.Net.NetworkInformation;\nusing System.Text;\nusing System.Net;\n\nnamespace A... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
142,633 | <p>I have a Button inside an UpdatePanel. The button is being used as the OK button for a ModalPopupExtender. For some reason, the button click event is not firing. Any ideas? Am I missing something?</p>
<pre><code><asp:updatepanel id="UpdatePanel1" runat="server">
<ContentTemplate>
<cc1:ModalPopupExtender ID="ModalDialog" runat="server"
TargetControlID="OpenDialogLinkButton"
PopupControlID="ModalDialogPanel" OkControlID="ModalOKButton"
BackgroundCssClass="ModalBackground">
</cc1:ModalPopupExtender>
<asp:Panel ID="ModalDialogPanel" CssClass="ModalPopup" runat="server">
...
<asp:Button ID="ModalOKButton" runat="server" Text="OK"
onclick="ModalOKButton_Click" />
</asp:Panel>
</ContentTemplate>
</asp:updatepanel>
</code></pre>
| [
{
"answer_id": 142656,
"author": "Kyle Trauberman",
"author_id": 21461,
"author_profile": "https://Stackoverflow.com/users/21461",
"pm_score": 3,
"selected": false,
"text": "OkControlID=\"ModalOKButton\"\n"
},
{
"answer_id": 383911,
"author": "balexandre",
"author_id": 28... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21461/"
] |
142,644 | <p>We recently attempted to break apart some of our Visual Studio projects into libraries, and everything seemed to compile and build fine in a test project with one of the library projects as a dependency. However, attempting to run the application gave us the following nasty run-time error message:</p>
<blockquote>
<p>Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function pointer declared with a different calling convention.</p>
</blockquote>
<p>We have never even specified calling conventions (__cdecl etc.) for our functions, leaving all the compiler switches on the default. I checked and the project settings are consistent for calling convention across the library and test projects.</p>
<p>Update: One of our devs changed the "Basic Runtime Checks" project setting from "Both (/RTC1, equiv. to /RTCsu)" to "Default" and the run-time vanished, leaving the program running apparently correctly. I do not trust this at all. Was this a proper solution, or a dangerous hack?</p>
| [
{
"answer_id": 142893,
"author": "Alex M",
"author_id": 9652,
"author_profile": "https://Stackoverflow.com/users/9652",
"pm_score": 1,
"selected": false,
"text": "esp"
},
{
"answer_id": 143387,
"author": "Mike Dimmick",
"author_id": 6970,
"author_profile": "https://St... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11180/"
] |
142,653 | <p>I have DocumentRoot /var/www/test in my .htaccess file. This is causing the apache server to give me a 500 internal server error.</p>
<p>The error log file shows:
alert] [client 127.0.0.1] /var/www/.htaccess: DocumentRoot not allowed here</p>
<p>AllowOveride All is set in my conf file.</p>
<p>Any idea why this is happening?</p>
| [
{
"answer_id": 142657,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 5,
"selected": true,
"text": ".htaccess"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/142653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
142,693 | <p>You know those websites that let you type in your checking account number and the routing number, and then they can transfer money to and from your account?</p>
<p>How does that work? Any good services or APIs for doing that? Any gotchas?</p>
| [
{
"answer_id": 13636783,
"author": "Christopher Ashley",
"author_id": 654553,
"author_profile": "https://Stackoverflow.com/users/654553",
"pm_score": 1,
"selected": false,
"text": "<?php\n\nrequire \"../mpgClasses.php\";\n\n/************************ Request Variables ********************... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17076/"
] |
142,708 | <p>I can't seem to find any <em>useful</em> documentation from Microsoft about how one would use the <code>Delimiter</code> and <code>InheritsFromParent</code> attributes in the <code>UserMacro</code> element when defining user Macros in <code>.vsprops</code> property sheet files for Visual Studio.</p>
<p>Here's sample usage:</p>
<pre><code><UserMacro Name="INCLUDEPATH" Value="$(VCROOT)\Inc"
InheritsFromParent="TRUE" Delimiter=";"/>
</code></pre>
<p>From the above example, I'm guessing that <em>"inherit"</em> really means <em>"a) if definition is non-empty then append delimiter, and b) append new definition"</em> where as the non-inherit behavior would be to simply replace any current macro definition. Does anyone know for sure? Even better, does anyone have any suggested source of alternative documentation for Visual Studio <code>.vsprops</code> files and macros?</p>
<p>NOTE: this is <em>not</em> the same as the <code>InheritedPropertySheets</code> attribute of the <code>VisualStudioPropertySheet</code> element, for example:</p>
<pre><code><VisualStudioPropertySheet ... InheritedPropertySheets=".\my.vsprops">
</code></pre>
<p>In this case <em>"inherit"</em> basically means <em>"include"</em>.</p>
| [
{
"answer_id": 145260,
"author": "jwfearn",
"author_id": 10559,
"author_profile": "https://Stackoverflow.com/users/10559",
"pm_score": 4,
"selected": true,
"text": "InheritsFromParent"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/142708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10559/"
] |
142,710 | <p>A legacy embedded system is implemented using a cooperative multi-tasking scheduler. </p>
<p>The system essentially works along the following lines:</p>
<ul>
<li>Task A does work</li>
<li>When Task A is done, it yields the processor.</li>
<li>Task B gets the processor and does work.</li>
<li>Task B yields<br>
... </li>
<li>Task n yields</li>
<li>Task A gets scheduled and does work</li>
</ul>
<p>One big Circular Queue: A -> B -> C -> ... -> n -> A</p>
<p>We are porting the system to a new platform and want to minimize system redesign.</p>
<p>Is there a way to implement that type of cooperative multi-tasking in vxWorks?</p>
| [
{
"answer_id": 313159,
"author": "Richard Harrison",
"author_id": 19624,
"author_profile": "https://Stackoverflow.com/users/19624",
"pm_score": 0,
"selected": false,
"text": "void scheduler()\n{\n while (1)\n {\n int st = microseconds();\n a();\n b();\n ... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10703/"
] |
142,740 | <p>I want to do something like the following in spring:</p>
<pre><code><beans>
...
<bean id="bean1" ... />
<bean id="bean2">
<property name="propName" value="bean1.foo" />
...
</code></pre>
<p>I would think that this would access the getFoo() method of bean1 and call the setPropName() method of bean2, but this doesn't seem to work.</p>
| [
{
"answer_id": 142765,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": -1,
"selected": false,
"text": "foo"
},
{
"answer_id": 142796,
"author": "Pablo Fernandez",
"author_id": 7595,
"author_profile": "https... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22063/"
] |
142,750 | <p>I'm trying to get either CreateProcess or CreateProcessW to execute a process with a name < MAX_PATH characters but in a path that's greater than MAX_PATH characters. According to the docs at: <a href="http://msdn.microsoft.com/en-us/library/ms682425.aspx" rel="nofollow noreferrer"><a href="http://msdn.microsoft.com/en-us/library/ms682425.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms682425.aspx</a></a>, I need to make sure lpApplicationName isn't NULL and then lpCommandLine can be up to 32,768 characters.</p>
<p>I tried that, but I get ERROR_PATH_NOT_FOUND.</p>
<p>I changed to CreateProcessW, but still get the same error. When I prefix lpApplicationName with \\?\ as described in <a href="http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx" rel="nofollow noreferrer"><a href="http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa365247(VS.85).aspx</a></a> when calling CreateProcessW I get a different error that makes me think I'm a bit closer: ERROR_SXS_CANT_GEN_ACTCTX.</p>
<p>My call to CreateProcessW is:</p>
<p><code>
CreateProcessW(w_argv0,arg_string,NULL,NULL,0,NULL,NULL,&si,&ipi);
</code></p>
<p>where w_argv0 is <code>\\?\<long absolute path>\foo.exe.</code></p>
<p>arg_string contains "<long absolute path>\foo.exe" foo </p>
<p>si is set as follows:</p>
<pre>
memset(&si,0,sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;>
</pre>
<p>and pi is empty, as in:</p>
<pre>
memset(&pi,0,sizeof(pi));
</pre>
<p>I looked in the system event log and there's a new entry each time I try this with event id 59, source SideBySide: Generate Activation Context failed for .Manifest. Reference error message: The operation completed successfully.</p>
<p>The file I'm trying to execute runs fine in a path < MAX_PATH characters.</p>
<p>To clarify, no one component of <long absolute path> is greater than MAX_PATH characters. The name of the executable itself certainly isn't, even with .manifest on the end. But, the entire path together is greater than MAX_PATH characters long.</p>
<p>I get the same error whether I embed its manifest or not. The manifest is named foo.exe.manifest and lives in the same directory as the executable when it's not embedded. It contains:</p>
<pre>
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32' name='Microsoft.VC80.DebugCRT' version='8.0.50727.762' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b' />
</dependentAssembly>
</dependency>
</assembly>
</pre>
<p>Anyone know how to get this to work? Possibly:</p>
<ul>
<li><p>some other way to call CreateProcess or CreateProcessW to execute a process in a path > MAX_PATH characters</p></li>
<li><p>something I can do in the manifest file</p></li>
</ul>
<p>I'm building with Visual Studio 2005 on XP SP2 and running native.</p>
<p>Thanks for your help.</p>
| [
{
"answer_id": 143399,
"author": "Zooba",
"author_id": 891,
"author_profile": "https://Stackoverflow.com/users/891",
"pm_score": 1,
"selected": false,
"text": "MAX_PATH"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/142750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9572/"
] |
142,764 | <p>I'd like to how to upgrade the default python installation(2.5.2) supplied with ubuntu 8.04 to python 2.6rc2. I'd like to make 2.6 the default python version on the system and migrate all the other useful installed python libraries installed on 2.5.2 to python 2.6rc2. Please let me know how I can achieve this.</p>
<p>Thanks
Dirk</p>
| [
{
"answer_id": 142770,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 5,
"selected": true,
"text": "./configure && make && sudo make install"
},
{
"answer_id": 142777,
"author": "Mez",
"author_id": 20010... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
142,789 | <p>From the reading that I have done, Core Audio relies heavily on callbacks (and C++, but that's another story). </p>
<p>I understand the concept (sort of) of setting up a function that is called by another function repeatedly to accomplish a task. I just don't understand how they get set up and how they actually work. Any examples would be appreciated.</p>
| [
{
"answer_id": 142792,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 2,
"selected": false,
"text": "on_event()"
},
{
"answer_id": 142809,
"author": "aib",
"author_id": 1088,
"author_profile": "https... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22913/"
] |
142,812 | <p>I need a compact representation of an array of booleans, does Python have a builtin bitfield type or will I need to find an alternate solution?</p>
| [
{
"answer_id": 265491,
"author": "MattG",
"author_id": 23048,
"author_profile": "https://Stackoverflow.com/users/23048",
"pm_score": 3,
"selected": false,
"text": "testA = 2**0\ntestB = 2**1\ntestC = 2**3\n"
},
{
"answer_id": 1574928,
"author": "Scott Griffiths",
"author_... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10471/"
] |
142,813 | <p>I want to convert a number between 0 and 4096 ( 12-bits ) to its 3 character hexadecimal string representation in C#. </p>
<p>Example:</p>
<pre>
2748 to "ABC"
</pre>
| [
{
"answer_id": 142819,
"author": "Muxa",
"author_id": 10793,
"author_profile": "https://Stackoverflow.com/users/10793",
"pm_score": 3,
"selected": true,
"text": "2748.ToString(\"X\")\n"
},
{
"answer_id": 142828,
"author": "Adam Davis",
"author_id": 2915,
"author_profi... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/609/"
] |
142,820 | <p>I've create a WinForms control that inherits from System.Windows.Forms.UserControl...I've got some custom events on the control that I would like the consumer of my control to be able to see. I'm unable to actually get my events to show up in the Events tab of the Properties window during design time. This means the only way to assign the events is to programmatically write </p>
<pre><code>myUserControl.MyCustomEvent += new MyUserControl.MyCustomEventHandler(EventHandlerFunction);
</code></pre>
<p>this is fine for me I guess but when someone else comes to use my UserControl they are not going to know that these events exist (unless they read the library doco...yeah right). I know the event will show up using Intellisense but it would be great if it could show in the properties window too.</p>
| [
{
"answer_id": 142823,
"author": "Phil Wright",
"author_id": 6276,
"author_profile": "https://Stackoverflow.com/users/6276",
"pm_score": 6,
"selected": true,
"text": "[Browsable(true)]\npublic event EventHandler MyCustomEvent;\n"
},
{
"answer_id": 41104603,
"author": "Pierre-... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4403/"
] |
142,826 | <p>I've been working on a web crawling .NET app in my free time, and one of the features of this app that I wanted to included was a pause button to pause a specific thread.</p>
<p>I'm relatively new to multi-threading and I haven't been able to figure out a way to pause a thread indefinitely that is currently supported. I can't remember the exact class/method, but I know there is a way to do this but it has been flagged as obsolete by the .NET framework.</p>
<p>Is there any good general purpose way to indefinitely pause a worker thread in C# .NET.</p>
<p>I haven't had a lot of time lately to work on this app and the last time I touched it was in the .NET 2.0 framework. I'm open to any new features (if any) that exist in the .NET 3.5 framework, but I'd like to know of solution that also works in the 2.0 framework since that's what I use at work and it would be good to know just in case.</p>
| [
{
"answer_id": 143153,
"author": "Brannon",
"author_id": 5745,
"author_profile": "https://Stackoverflow.com/users/5745",
"pm_score": 8,
"selected": true,
"text": "Thread.Suspend"
},
{
"answer_id": 11320956,
"author": "Matthias",
"author_id": 568266,
"author_profile": ... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] |
142,830 | <p>I have seen the other questions <em>but I am still not satisfied with the way this subject is covered</em>.</p>
<p><strong>I would like to extract a distiled list of things to check on comments at a code inspection.</strong> </p>
<p>I am sure people will say things that will just cancel each other. But hey, maybe we can build a list for each camp. For those who don't comment at all the list will just be very short :)</p>
| [
{
"answer_id": 142876,
"author": "Mez",
"author_id": 20010,
"author_profile": "https://Stackoverflow.com/users/20010",
"pm_score": 1,
"selected": false,
"text": "/**\n * Class to clean variables\n *\n * @package Majyk\n * @author Martin Meredith <martin@sourceguru.net>\n * @lice... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14921/"
] |
142,844 | <p>I would like to drag and drop my data file onto a Python script and have it process the file and generate output. The Python script accepts the name of the data file as a command-line parameter, but Windows Explorer doesn't allow the script to be a drop target.</p>
<p>Is there some kind of configuration that needs to be done somewhere for this work?</p>
| [
{
"answer_id": 142854,
"author": "Blair Conrad",
"author_id": 1199,
"author_profile": "https://Stackoverflow.com/users/1199",
"pm_score": 7,
"selected": true,
"text": "Windows Registry Editor Version 5.00\n\n[HKEY_CLASSES_ROOT\\Python.File\\shellex\\DropHandler]\n@=\"{60254CA5-953B-11CF-... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4859/"
] |
142,845 | <p>I'm working on an application that consists of an overall Quartz-based scheduler and "CycledJob" run using CronTriggers. The purpose of the application is to process inputs from different email inboxes based on the source country. </p>
<p>Based on the country that it comes in from (i.e. US, UK, FR, etc.) the application triggers one job thread to run each country's processing cycle, so there would be a UK Worker thread, one for US, France, etc. When formatting the output to log4j, I'm using the thread parameter, so it emits [ApplicationName_Worker-1], [ApplicationName_Worker-2] etc. Try as I might, I can't find a way to name the threads since they're pulled out of Quartz's Thread Pools. Although I could possibly go so far as to extend Quartz, I'd like to work out a different solution instead of messing with the standard library.</p>
<p>Here's the problem: When using log4j, I'd like to have all log items from the US thread output to a US only file, likewise for each of the country threads. I don't care if they stay in one unified ConsoleAppender, the FileAppender split is what I'm after here. I already know how to specify multiple file appenders and such, my issue is I can't differentiate based on country. There are 20+ classes within the application that can be on the execution chain, very few of which I want to burden with the knowledge of passing an extra "context" parameter through EVERY method... I've considered a Strategy pattern extending a log4j wrapper class, but unless I can let every class in the chain know which thread it's on to parameterize the logger call, that seems impossible. Without being able to name the thread also creates a challenge (or else this would be easy!).</p>
<p>So here's the question: What would be a suggested approach to allow many subordinate classes in an application that are each used for every different thread to process the input know that they are within the context of a particular country thread when they are logging?</p>
<p>Good luck understanding, and please ask clarifying questions! I hope someone is able to help me figure out a decent way to tackle this. All suggestions welcome.</p>
| [
{
"answer_id": 143018,
"author": "jt.",
"author_id": 4362,
"author_profile": "https://Stackoverflow.com/users/4362",
"pm_score": 1,
"selected": false,
"text": "log4j.additivity.my-us-logger=false\n"
},
{
"answer_id": 144184,
"author": "erickson",
"author_id": 3474,
"a... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18402/"
] |
142,855 | <p>What programming languages support arbitrary precision arithmetic and could you give a short example of how to print an arbitrary number of digits?</p>
| [
{
"answer_id": 142866,
"author": "torial",
"author_id": 13990,
"author_profile": "https://Stackoverflow.com/users/13990",
"pm_score": 3,
"selected": false,
"text": "from math import log as _flog\nfrom decimal import getcontext, Decimal\n\ndef log(x):\n if x < 0:\n return Decima... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10577/"
] |
142,863 | <p><em>Comment on Duplicate Reference: Why would this be marked duplicate when it was asked years prior to the question referenced as a duplicate? I also believe the question, detail, and response is much better than the referenced question.</em></p>
<p>I've been a C++ programmer for quite a while but I'm new to Java and new to Eclipse. I want to use the <a href="http://sourceforge.net/project/showfiles.php?group_id=30469&package_id=23976" rel="nofollow noreferrer">touch graph "Graph Layout" code</a> to visualize some data I'm working with.</p>
<p>This code is organized like this:</p>
<pre><code>./com
./com/touchgraph
./com/touchgraph/graphlayout
./com/touchgraph/graphlayout/Edge.java
./com/touchgraph/graphlayout/GLPanel.java
./com/touchgraph/graphlayout/graphelements
./com/touchgraph/graphlayout/graphelements/GESUtils.java
./com/touchgraph/graphlayout/graphelements/GraphEltSet.java
./com/touchgraph/graphlayout/graphelements/ImmutableGraphEltSet.java
./com/touchgraph/graphlayout/graphelements/Locality.java
./com/touchgraph/graphlayout/graphelements/TGForEachEdge.java
./com/touchgraph/graphlayout/graphelements/TGForEachNode.java
./com/touchgraph/graphlayout/graphelements/TGForEachNodePair.java
./com/touchgraph/graphlayout/graphelements/TGNodeQueue.java
./com/touchgraph/graphlayout/graphelements/VisibleLocality.java
./com/touchgraph/graphlayout/GraphLayoutApplet.java
./com/touchgraph/graphlayout/GraphListener.java
./com/touchgraph/graphlayout/interaction
./com/touchgraph/graphlayout/interaction/DragAddUI.java
./com/touchgraph/graphlayout/interaction/DragMultiselectUI.java
./com/touchgraph/graphlayout/interaction/DragNodeUI.java
./com/touchgraph/graphlayout/interaction/GLEditUI.java
./com/touchgraph/graphlayout/interaction/GLNavigateUI.java
./com/touchgraph/graphlayout/interaction/HVRotateDragUI.java
./com/touchgraph/graphlayout/interaction/HVScroll.java
./com/touchgraph/graphlayout/interaction/HyperScroll.java
./com/touchgraph/graphlayout/interaction/LocalityScroll.java
./com/touchgraph/graphlayout/interaction/RotateScroll.java
./com/touchgraph/graphlayout/interaction/TGAbstractClickUI.java
./com/touchgraph/graphlayout/interaction/TGAbstractDragUI.java
./com/touchgraph/graphlayout/interaction/TGAbstractMouseMotionUI.java
./com/touchgraph/graphlayout/interaction/TGAbstractMousePausedUI.java
./com/touchgraph/graphlayout/interaction/TGSelfDeactivatingUI.java
./com/touchgraph/graphlayout/interaction/TGUIManager.java
./com/touchgraph/graphlayout/interaction/TGUserInterface.java
./com/touchgraph/graphlayout/interaction/ZoomScroll.java
./com/touchgraph/graphlayout/LocalityUtils.java
./com/touchgraph/graphlayout/Node.java
./com/touchgraph/graphlayout/TGAbstractLens.java
./com/touchgraph/graphlayout/TGException.java
./com/touchgraph/graphlayout/TGLayout.java
./com/touchgraph/graphlayout/TGLensSet.java
./com/touchgraph/graphlayout/TGPaintListener.java
./com/touchgraph/graphlayout/TGPanel.java
./com/touchgraph/graphlayout/TGPoint2D.java
./com/touchgraph/graphlayout/TGScrollPane.java
./TG-APACHE-LICENSE.txt
./TGGL ReleaseNotes.txt
./TGGraphLayout.html
./TGGraphLayout.jar
</code></pre>
<p>How do I add this project in Eclipse and get it compiling and running quickly?</p>
| [
{
"answer_id": 142881,
"author": "Kevin Day",
"author_id": 10973,
"author_profile": "https://Stackoverflow.com/users/10973",
"pm_score": 5,
"selected": true,
"text": "./com/*"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/142863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22917/"
] |
142,868 | <p>How do I change Oracle from port 8080? My Eclipse is using 8080, so I can't use that.</p>
| [
{
"answer_id": 143090,
"author": "tardate",
"author_id": 6329,
"author_profile": "https://Stackoverflow.com/users/6329",
"pm_score": 1,
"selected": false,
"text": "<web-site xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:noNamespaceSchemaLocation=\"http://xmlns.oracle.com/o... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22916/"
] |
142,877 | <p>I have a very large codebase (read: thousands of modules) that has code shared across numerous projects that all run on different operating systems with different C++ compilers. Needless to say, maintaining the build process can be quite a chore. </p>
<p>There are several places in the codebase where it would clean up the code substantially if only there were a way to make the pre-processor ignore certain <code>#includes</code> if the file didn't exist in the current folder. Does anyone know a way to achieve that?</p>
<p>Presently, we use an <code>#ifdef</code> around the <code>#include</code> in the shared file, with a second project-specific file that #defines whether or not the <code>#include</code> exists in the project. This works, but it's ugly. People often forget to properly update the definitions when they add or remove files from the project. I've contemplated writing a pre-build tool to keep this file up to date, but if there's a platform-independent way to do this with the preprocessor I'd much rather do it that way instead. Any ideas?</p>
| [
{
"answer_id": 142884,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "#define EXISTS_FILE1_C\n#define EXISTS_FILE1_H\n#define EXISTS_FILE2_C\n"
},
{
"answer_id": 142921,
"author":... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
142,903 | <p>I started playing around with Linq today and ran into a problem I couldn't find an answer to. I was querying a simple SQL Server database that had some employee records. One of the fields is the full name (cn). I thought it would be interesting to group by the first name by splitting the full name at the first space. I tried</p>
<pre><code>group by person.cn.Split(separators)[0]
</code></pre>
<p>but ran into a lengthy runtime exception (looked a lot like a C++ template instantiation error).</p>
<p>Then I tried grouping by a few letters of the first name:</p>
<pre><code>group by person.cn.Substring(0,5)
</code></pre>
<p>and that worked fine but is not what I want.</p>
<p>I'm wondering about two things:</p>
<ul>
<li>Why does the first example not work when it looks so close to the second?</li>
<li>Knowing that behind the scenes it's SQL stuff going on, what's a good way to do this kind of thing efficiently</li>
</ul>
<p>Thanks,</p>
<p>Andrew</p>
| [
{
"answer_id": 143078,
"author": "Amy B",
"author_id": 8155,
"author_profile": "https://Stackoverflow.com/users/8155",
"pm_score": 2,
"selected": false,
"text": "string oneSpace = \" \";\nstring fiftySpace = \" \";\n\nvar query = \n from ... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18321/"
] |
142,944 | <p>I remember seeing the code for a Highpass filter a few days back somewhere in the samples, however I can't find it anywhere now! Could someone remember me where the Highpass filter implementation code was?</p>
<p>Or better yet post the algorithm?</p>
<p>Thanks!</p>
| [
{
"answer_id": 142962,
"author": "Adam Davis",
"author_id": 2915,
"author_profile": "https://Stackoverflow.com/users/2915",
"pm_score": 6,
"selected": true,
"text": "#define kFilteringFactor 0.1\nstatic UIAccelerationValue rollingX=0, rollingY=0, rollingZ=0;\n\n\n- (void)accelerometer:(U... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15124/"
] |
142,965 | <p>An existing Java site is designed to run under "/" on tomcat and there are many specific references to fixed absolute paths like "/dir/dir/page".</p>
<p>Want to migrate this to Java EE packaging, where the site will need to run under a context-root e.g. "/dir/dir/page" becomes "/my-context-root/dir/dir/page"</p>
<p>Now, the context-root can be easily with ServletRequest.getContextPath(), but that still means a lot of code changes to migrate a large code base. Most of these references are in literal HTML.</p>
<p>I've experimented with using servlet filters to do rewrites on the oubound HTML, and that seems to work fine. But it does introduce some overhead, and I wouldn't see it as a permanent solution. (see <a href="http://github.com/tardate/sources/tree/master%2FEnforceContextRootFilter-1.0-src.zip?raw=true" rel="nofollow noreferrer">EnforceContextRootFilter-1.0-src.zip</a> for the servlet filter approach).</p>
<p>Are there any better approaches to solving this problem? Anything obvious I'm missing? All comments appreciated!</p>
| [
{
"answer_id": 143136,
"author": "Will Hartung",
"author_id": 13663,
"author_profile": "https://Stackoverflow.com/users/13663",
"pm_score": 2,
"selected": true,
"text": "sed -e 's/<a/<t:a/g' -e 's/<\\/a>/<\\/t:a>/g' old/x.jsp > new/x.jsp\n"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/142965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6329/"
] |
142,972 | <p>I have a series of ASCII flat files coming in from a mainframe to be processed by a C# application. A new feed has been introduced with a Packed Decimal (COMP-3) field, which needs to be converted to a numerical value.</p>
<p>The files are being transferred via FTP, using ASCII transfer mode. I am concerned that the binary field may contain what will be interpreted as very-low ASCII codes or control characters instead of a value - Or worse, may be lost in the FTP process.</p>
<p>What's more, the fields are being read as strings. I may have the flexibility to work around this part (i.e. a stream of some sort), but the business will give me pushback.</p>
<p>The requirement read "Convert from HEX to ASCII", but clearly that didn't yield the correct values. Any help would be appreciated; it need not be language-specific as long as you can explain the logic of the conversion process.</p>
| [
{
"answer_id": 143001,
"author": "Jason Stevenson",
"author_id": 13368,
"author_profile": "https://Stackoverflow.com/users/13368",
"pm_score": 2,
"selected": false,
"text": "Imports System\nImports System.IO\nImports System.Text\nImports System.Text.Encoding\n\n\n\n'4/20/07 submission in... | 2008/09/27 | [
"https://Stackoverflow.com/questions/142972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11112/"
] |
143,025 | <pre><code>struct a
{
char *c;
char b;
};
</code></pre>
<p>What is sizeof(a)? </p>
| [
{
"answer_id": 143048,
"author": "Simon Buchan",
"author_id": 20135,
"author_profile": "https://Stackoverflow.com/users/20135",
"pm_score": 5,
"selected": false,
"text": "#include <stdio.h>\n\ntypedef struct { char* c; char b; } a;\n\nint main()\n{\n printf(\"sizeof(a) == %d\", sizeof... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
143,032 | <p>I am developing a TCP/IP client that has to deal with a proprietary binary protocol. I was considering using user-defined types to represent the protocol headers, and using CopyMemory to shuffle data to and from the UDT and a byte array. However, it appears that VB6 adds padding bytes to align user-defined types. Is there any way to force VB6 to not pad UDT's, similar to the <code>#pragma pack</code> directive available in many C/C++ compilers? Perhaps a special switch passed to the compiler?</p>
| [
{
"answer_id": 143055,
"author": "Uhall",
"author_id": 19129,
"author_profile": "https://Stackoverflow.com/users/19129",
"pm_score": 4,
"selected": true,
"text": "#pragma pack"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/143032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17862/"
] |
143,058 | <p>ToolStripItems show Active highlighting when you mouse over them, even if the form they are in is not in focus. They do not, however, show their tooltips, unless the form is focused. I have seen the <a href="http://blogs.msdn.com/rickbrew/archive/2006/01/09/511003.aspx" rel="noreferrer">ToolStrip 'click-though' hack</a>. Anyone know how to make a ToolStripButton show its tooltip when its parent form is not in focus?</p>
<p>Thanks!</p>
| [
{
"answer_id": 145483,
"author": "Matthew Scharley",
"author_id": 15537,
"author_profile": "https://Stackoverflow.com/users/15537",
"pm_score": 2,
"selected": false,
"text": "public Form1()\n{\n InitializeComponent();\n\n tooltip = new ToolTip();\n tooltip.ShowAlways = true;\n}\... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22539/"
] |
143,063 | <p>I've recently seen the light of EventWaitHandle's powerful behavior in C# and decided to move some functionality in a sister application to do the same. The only problem is that the sister app is written in C.</p>
<p>No big deal, I'm using pthreads, which have a pthread_cond_t datatype that allows for signalling. My only question is, is it possible for a cond to be 'signalled' before something is waiting on it?</p>
<p>Right now my testing says no. That is, if ThreadA fires a signal before ThreadB is waiting, ThreadB will wait indefinately. Is there another pthread type that I can use that behaves closer to the functionality of the EventWaitHandle in C#? An object is signalled, meaning that the first thread to wait on it, will pass immediately, and set it to unsignalled.</p>
<p>Wrapping the pthread_cond into another data structure wouldn't be too hard to achieve this. But again, is this functionality already available in the pthread library?</p>
| [
{
"answer_id": 143161,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 3,
"selected": true,
"text": "lock(lockobj);\nwhile (!signalled) {\n wait(condvar);\n}\nsignalled = false;\nunlock(lockobj);\n"
},
{
"answer_id"... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8945/"
] |
143,072 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/91071/emacs-switch-to-previous-window">Emacs, switch to previous window</a> </p>
</blockquote>
<p><code>other-window</code> advances me to the next window in the current frame, but I also want a way to move back to the previous window.</p>
<p>Emacs has <code>next-buffer</code> and <code>previous-buffer</code>, but no analogous interactive functions for window navigation. Just <code>other-window</code>.</p>
| [
{
"answer_id": 143080,
"author": "Matt Curtis",
"author_id": 17221,
"author_profile": "https://Stackoverflow.com/users/17221",
"pm_score": 6,
"selected": true,
"text": "(other-window -1)"
},
{
"answer_id": 153941,
"author": "Florian Jenn",
"author_id": 23813,
"author_... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143072",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8913/"
] |
143,073 | <p>Windbg fans claim that it is quite powerful and I tend to agree. But when it comes to debugging STL containers, I am always stuck. If the variable is on the stack, the <code>!stl</code> extension sometimes figures it out, but when a container with a complex type (e.g. <code>std::vector<TemplateField, std::allocator<TemplateField> ></code>) is on the heap or part of some other structure, I just don't know how to view its contents.</p>
<p>Appreciate any tips, pointers.</p>
| [
{
"answer_id": 143382,
"author": "Harald Scheirich",
"author_id": 22080,
"author_profile": "https://Stackoverflow.com/users/22080",
"pm_score": 0,
"selected": false,
"text": "toString()"
},
{
"answer_id": 4604630,
"author": "kizzx2",
"author_id": 111021,
"author_profi... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15071/"
] |
143,075 | <p>I'm trying to print out the date in a certain format:</p>
<pre><code>NSDate *today = [[NSDate alloc] init];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyyMMddHHmmss"];
NSString *dateStr = [dateFormatter stringFromDate:today];
</code></pre>
<p>If the iPhone is set to 24 hour time, this works fine, if on the other hand the user has set it to 24 hour time, then back to AM/PM (it works fine until you toggle this setting) then it appends the AM/PM on the end even though I didn't ask for it:</p>
<pre><code>20080927030337 PM
</code></pre>
<p>Am I doing something wrong or is this a bug with firmware 2.1?</p>
<p>Edit 1: Made description clearer</p>
<p>Edit 2 workaround: It turns out this is a bug, to fix it I set the AM and PM characters to "":</p>
<pre><code>[dateFormatter setAMSymbol:@""];
[dateFormatter setPMSymbol:@""];
</code></pre>
| [
{
"answer_id": 143114,
"author": "Mike McMaster",
"author_id": 544,
"author_profile": "https://Stackoverflow.com/users/544",
"pm_score": 5,
"selected": true,
"text": "NSLog(@\"%@\", dateStr);\n"
},
{
"answer_id": 3174866,
"author": "jbg",
"author_id": 91420,
"author_p... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6044/"
] |
143,084 | <p>Let's say I have one class <code>Foo</code> that has a bunch of logic in it and another class <code>Bar</code> which is essentially the same. However, as <code>Foo</code> and <code>Bar</code> are different (but related) entities I need the difference to be apparent from my code (i.e. I can tell whether an instance is a <code>Foo</code> or a <code>Bar</code>)</p>
<p>As I was whacking this together without much thought I ended up with the following:</p>
<pre><code>public class Foo {
/* constructors, fields, method, logic and what-not */
}
public class Bar extends Foo {
/* nothing here but constructors */
}
</code></pre>
<p>Is this OK? Is it better to make <code>Bar</code> a composite class? e.g:</p>
<pre><code>public class Bar {
private Foo foo;
/* constructors and a bunch of wrapper methods that call
into foo */
}
</code></pre>
<p>Or even, while we're at it, something much more low-tech:</p>
<pre><code>public class Foo {
/* constructors, fields, method, logic and what-not */
private boolean isABar; // Could be an enum
}
</code></pre>
<p>What do you think? <strong>How do you deal with these 'marker classes'?</strong></p>
<hr>
<p>As an example of how my code may wish to treat <code>Foo</code> and <code>Bar</code> differently, my code would need to be able to do stuff like <code>List<Foo></code> and <code>List<Bar></code>. A <code>Foo</code> couldn't go in a <code>List<Bar></code> and vice versa.</p>
| [
{
"answer_id": 143091,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 5,
"selected": true,
"text": "Foo"
},
{
"answer_id": 143135,
"author": "csmba",
"author_id": 350,
"author_profile": "https://Stackoverf... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1666/"
] |
143,087 | <p>I was recently tasked to document a large JavaScript application I have been maintaining for some time. So I do have a good knowledge of the system.</p>
<p>But due the sheer size of the application, it will probably take a lot of time even with prior knowledge around the code and the source code itself in uncompressed form.</p>
<p>So I'm looking for tools that would help me explore classes and methods and their relationships in JavaScript and if possible, document them along the way, is there one available?</p>
<p>Something like object browser in VS would be nice, but any tools that help me get things done faster will do.</p>
<p>Thanks!</p>
| [
{
"answer_id": 143217,
"author": "Jonny Buchanan",
"author_id": 6760,
"author_profile": "https://Stackoverflow.com/users/6760",
"pm_score": 4,
"selected": true,
"text": "window"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/143087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3055/"
] |
143,108 | <p>Just as in title. Is suspect it is, but I couldn't find it anywhere explicitly stated. And for this property I wouldn't like to rely on speculations.</p>
| [
{
"answer_id": 143116,
"author": "mmcdole",
"author_id": 2635,
"author_profile": "https://Stackoverflow.com/users/2635",
"pm_score": 2,
"selected": false,
"text": "rand()"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/143108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9403/"
] |
143,122 | <p>Is it possible to use PHP's SimpleXML functions to create an XML object from scratch? Looking through the function list, there's ways to import an existing XML string into an object that you can then manipulate, but if I just want to generate an XML object programmatically from scratch, what's the best way to do that?</p>
<p>I figured out that you can use simplexml_load_string() and pass in the root string that you want, and then you've got an object you can manipulate by adding children... although this seems like kind of a hack, since I have to actually hardcode some XML into the string before it can be loaded.</p>
<p>I've done it using the <a href="http://us3.php.net/manual/en/book.domxml.php" rel="noreferrer">DOMDocument functions</a>, although it's a little confusing because I'm not sure what the DOM has to do with creating a pure XML document... so maybe it's just badly named :-)</p>
| [
{
"answer_id": 143192,
"author": "DreamWerx",
"author_id": 15487,
"author_profile": "https://Stackoverflow.com/users/15487",
"pm_score": 8,
"selected": true,
"text": "<?php\n$newsXML = new SimpleXMLElement(\"<news></news>\");\n$newsXML->addAttribute('newsPagePrefix', 'value goes here');\... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20903/"
] |
143,123 | <p>Using C / C++ socket programming, and the "read(socket, buffer, BUFSIZE)" method. What exactly is the "buffer" I know that char and byte are the same thing, but does it matter how many elements the byte array has in it? Does the buffer need to be able to hold the entire message until the null character?</p>
| [
{
"answer_id": 143127,
"author": "Adam Pierce",
"author_id": 5324,
"author_profile": "https://Stackoverflow.com/users/5324",
"pm_score": 5,
"selected": true,
"text": "#define MY_BUFFER_SIZE 1024\n\nchar mybuffer[MY_BUFFER_SIZE];\nint nBytes = read(sck, mybuffer, MY_BUFFER_SIZE);\n"
},
... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3484/"
] |
143,130 | <p>My company has a subsidiary with a slow Internet connection. Our developers there suffer to interact with our central <a href="http://en.wikipedia.org/wiki/Subversion_%28software%29" rel="noreferrer">Subversion</a> server. Is it possible to configure a slave/mirror for them? They would interact locally with the server and all the commits would be automatically synchronized to the master server. </p>
<p>This should work as transparently as possible for the developers. Usability is a must.</p>
<p>Please, no suggestions to change our version control system.</p>
| [
{
"answer_id": 143163,
"author": "Jean",
"author_id": 7898,
"author_profile": "https://Stackoverflow.com/users/7898",
"pm_score": 6,
"selected": false,
"text": "svn mirror"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/143130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10335/"
] |
143,140 | <p>Can anyone tell me, where on the web I can find an explanation for Bron-Kerbosch algorithm for clique finding or explain here how it works?</p>
<p>I know it was published in "Algorithm 457: finding all cliques of an undirected graph" book, but I can't find free source that will describe the algorithm.</p>
<p>I don't need a source code for the algorithm, I need an explanation of how it works.</p>
| [
{
"answer_id": 9047013,
"author": "Amol",
"author_id": 91966,
"author_profile": "https://Stackoverflow.com/users/91966",
"pm_score": 0,
"selected": false,
"text": "def bron(compsub, _not, candidates, graph, cliques):\n if len(candidates) == 0 and len(_not) == 0:\n cliques.appen... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11525/"
] |
143,171 | <p>I'm trying to copy a bunch of files below a directory and a number of the files have spaces and single-quotes in their names. When I try to string together <code>find</code> and <code>grep</code> with <code>xargs</code>, I get the following error:</p>
<pre><code>find .|grep "FooBar"|xargs -I{} cp "{}" ~/foo/bar
xargs: unterminated quote
</code></pre>
<p>Any suggestions for a more robust usage of xargs?</p>
<p>This is on <a href="http://en.wikipedia.org/wiki/Mac_OS_X_Leopard" rel="noreferrer">Mac OS X 10.5.3</a> (Leopard) with BSD <code>xargs</code>.</p>
| [
{
"answer_id": 143172,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 7,
"selected": false,
"text": "find . -print0 | grep --null 'FooBar' | xargs -0 ..."
},
{
"answer_id": 143222,
"author": "godbyk",
"author_... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17339/"
] |
143,174 | <p>Is there a platform-agnostic and filesystem-agnostic method to obtain the full path of the directory from where a program is running using C/C++? Not to be confused with the current working directory. (Please don't suggest libraries unless they're standard ones like clib or STL.)</p>
<p>(If there's no platform/filesystem-agnostic method, suggestions that work in Windows and Linux for specific filesystems are welcome too.)</p>
| [
{
"answer_id": 143188,
"author": "Paige Ruten",
"author_id": 813,
"author_profile": "https://Stackoverflow.com/users/813",
"pm_score": 3,
"selected": false,
"text": "#include <stdio.h>\n#include <unistd.h>\n#include <string.h>\n\nint main(int argc, char **argv) {\n char the_path[256];... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1630/"
] |
143,181 | <p>If you have a project, that releases a library and an application, how you handle version-numbers between the two.</p>
<p>Example: Your project delivers a library, that convert different file-formats into each other. The library is released for inclusion into other applications. But you also release a command-line-application, that uses this library and implements an interface to the functionality.</p>
<p>New releases of the library lead to new releases of the application (to make use of all new features), but new releases of the application may not trigger new releases of the library. Now how are the versions numbers handled: Completely independent or should library- and application-version be dependent in some way?</p>
| [
{
"answer_id": 143452,
"author": "Steve Jessop",
"author_id": 13005,
"author_profile": "https://Stackoverflow.com/users/13005",
"pm_score": 2,
"selected": true,
"text": "$ xsltproc --version\nUsing libxml 20628, libxslt 10120 and libexslt 813\nxsltproc was compiled against libxml 20628, ... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21005/"
] |
143,194 | <p>I have a pretty complicated Linq query that I can't seem to get into a LinqDataSsource for use in a GridView:</p>
<pre><code>IEnumerable<ticket> tikPart = (
from p in db.comments where
p.submitter == me.id &&
p.ticket.closed == DateTime.Parse("1/1/2001") &&
p.ticket.originating_group != me.sub_unit
select p.ticket
).Distinct();
</code></pre>
<p>How can I get this into a GridView? Thank you!</p>
| [
{
"answer_id": 143195,
"author": "leppie",
"author_id": 15541,
"author_profile": "https://Stackoverflow.com/users/15541",
"pm_score": 2,
"selected": false,
"text": "gridview.DataSource = tikPart.ToList();\ngridview.DataBind();\n"
},
{
"answer_id": 143210,
"author": "Aaron Pow... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14777/"
] |
143,206 | <p>I want to obtain the current number of window handles and the system-wide window handle limit in C#. How do I go about this?</p>
| [
{
"answer_id": 534991,
"author": "Robert Rossney",
"author_id": 19403,
"author_profile": "https://Stackoverflow.com/users/19403",
"pm_score": 4,
"selected": false,
"text": "using System;\nusing System.Runtime.InteropServices;\n\nnamespace StreamWrite.Proceedings.Client\n{\n public cla... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
143,215 | <p>I've been trying to display text using a Quartz context, but no matter what I've tried I simply haven't had luck getting the text to display (I'm able to display all sorts of other Quartz objects though). Anybody knows what I might be doing wrong?</p>
<p>example:</p>
<pre><code>-(void)drawRect:(CGRect)rect
{
// Drawing code
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSelectFont(context, "Arial", 24, kCGEncodingFontSpecific);
CGContextSetTextPosition(context,80,80);
CGContextShowText(context, "hello", 6);
//not even this works
CGContextShowTextAtPoint(context, 1,1, "hello", 6);
}
</code></pre>
| [
{
"answer_id": 143352,
"author": "Darron",
"author_id": 22704,
"author_profile": "https://Stackoverflow.com/users/22704",
"pm_score": 4,
"selected": true,
"text": "UIColor *mainTextColor = [UIColor whiteColor];\n[mainTextColor set];\ndrawTextLjust(@\"Sample Text\", 8, 50, 185, 18, 16);\n... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15124/"
] |
143,226 | <p>let's assume i have a self referencing hierarchical table build the classical way like this one:</p>
<pre><code>CREATE TABLE test
(name text,id serial primary key,parent_id integer
references test);
insert into test (name,id,parent_id) values
('root1',1,NULL),('root2',2,NULL),('root1sub1',3,1),('root1sub2',4,1),('root
2sub1',5,2),('root2sub2',6,2);
testdb=# select * from test;
name | id | parent_id
-----------+----+-----------
root1 | 1 |
root2 | 2 |
root1sub1 | 3 | 1
root1sub2 | 4 | 1
root2sub1 | 5 | 2
root2sub2 | 6 | 2
</code></pre>
<p>What i need now is a function (preferrably in plain sql) that would take the id of a test record and
clone all attached records (including the given one). The cloned records need to have new ids of course. The desired result
would like this for example:</p>
<pre><code>Select * from cloningfunction(2);
name | id | parent_id
-----------+----+-----------
root2 | 7 |
root2sub1 | 8 | 7
root2sub2 | 9 | 7
</code></pre>
<p>Any pointers? Im using PostgreSQL 8.3.</p>
| [
{
"answer_id": 143313,
"author": "njr101",
"author_id": 9625,
"author_profile": "https://Stackoverflow.com/users/9625",
"pm_score": 3,
"selected": false,
"text": "name | id | parent_id | upchain\nroot1 | 1 | NULL | 1:\nroot2 | 2 | NULL | 2:\nroot1sub1 | 3 | 1 | 1:3:\nroot1sub2 | 4 | 1 | ... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
143,231 | <p>One of our next projects is supposed to be a MS Windows based game (written in C#, with a winform GUI and an integrated DirectX display-control) for a customer who wants to give away prizes to the best players. This project is meant to run for a couple of years, with championships, ladders, tournaments, player vs. player-action and so on.</p>
<p>One of the main concerns here is cheating, as a player would benefit dramatically if he was able to - for instance - let a custom made bot play the game for him (more in terms of strategy-decisions than in terms of playing many hours).</p>
<p>So my question is: what technical possibilites do we have to detect bot activity? We can of course track the number of hours played, analyze strategies to detect anomalies and so on, but as far as this question is concerned, I would be more interested in knowing details like</p>
<ul>
<li>how to detect if another application makes periodical screenshots?</li>
<li>how to detect if another application scans our process memory?</li>
<li>what are good ways to determine whether user input (mouse movement, keyboard input) is human-generated and not automated?</li>
<li>is it possible to detect if another application requests informations about controls in our application (position of controls etc)?</li>
<li>what other ways exist in which a cheater could gather informations about the current game state, feed those to a bot and send the determined actions back to the client?</li>
</ul>
<p>Your feedback is highly appreciated!</p>
| [
{
"answer_id": 143273,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 0,
"selected": false,
"text": "* how to detect if another application makes periodical screenshots?\n* how to detect if another application scans o... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17378/"
] |
143,233 | <p>I am using <a href="http://cxxtest.tigris.org/" rel="nofollow noreferrer">cxxtest</a> as the test framework for my C++ classes, and would like to figure out a way to simulate sending data to classes which would normally expect to receive it from standard input. I have several different files which I would like to send to the classes during different tests, so redirection from the command line to the test suite executable is not an option.</p>
<p>Basically, what I would really like to do is find a way to redefine or redirect the 'stdin' handle to some other value that I create inside of my program, and then use fwrite() from these tests so that the corresponding fread() inside of the class pulls the data from within the program, not from the actual standard I/O handles associated with the executable.</p>
<p>Is this even possible? Bonus points for a platform-independent solution, but at a very minimum, I need this to work with Visual Studio 9 under Windows.</p>
| [
{
"answer_id": 143262,
"author": "Pat Notz",
"author_id": 825,
"author_profile": "https://Stackoverflow.com/users/825",
"pm_score": 2,
"selected": false,
"text": "std::cin"
},
{
"answer_id": 143948,
"author": "Rexxar",
"author_id": 10016,
"author_profile": "https://St... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14302/"
] |
143,234 | <p>In Lua, using the = operator without an l-value seems to be equivalent to a print(r-value), here are a few examples run in the Lua standalone interpreter:</p>
<pre><code>> = a
nil
> a = 8
> = a
8
> = 'hello'
hello
> = print
function: 003657C8
</code></pre>
<p>And so on...</p>
<p>My question is : where can I find a detailed description of this use for the = operator? How does it work? Is it by implying a special default l-value? I guess the root of my problem is that I have no clue what to type in Google to find info about it :-)</p>
<p><strong>edit</strong>:</p>
<p>Thanks for the answers, you are right it's a feature of the interpreter. Silly question, for I don't know which reason I completely overlooked the obvious. I should avoid posting before the morning coffee :-) For completeness, here is the code dealing with this in the interpreter:</p>
<pre><code>while ((status = loadline(L)) != -1) {
if (status == 0) status = docall(L, 0, 0);
report(L, status);
if (status == 0 && lua_gettop(L) > 0) { /* any result to print? */
lua_getglobal(L, "print");
lua_insert(L, 1);
if (lua_pcall(L, lua_gettop(L)-1, 0, 0) != 0)
l_message(progname, lua_pushfstring(L,
"error calling " LUA_QL("print") " (%s)",
lua_tostring(L, -1)));
}
}
</code></pre>
<p><strong>edit2</strong>:</p>
<p>To be really complete, the whole trick about pushing values on the stack is in the "pushline" function:</p>
<pre><code>if (firstline && b[0] == '=') /* first line starts with `=' ? */
lua_pushfstring(L, "return %s", b+1); /* change it to `return' */
</code></pre>
| [
{
"answer_id": 143268,
"author": "Arle Nadja",
"author_id": 17774,
"author_profile": "https://Stackoverflow.com/users/17774",
"pm_score": 0,
"selected": false,
"text": "Lua"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/143234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12291/"
] |
143,285 | <p>For example if I have an Enum with two cases, does it make take more memory than a boolean? Languages: Java, C++</p>
| [
{
"answer_id": 143298,
"author": "coobird",
"author_id": 17172,
"author_profile": "https://Stackoverflow.com/users/17172",
"pm_score": 7,
"selected": true,
"text": "enum"
},
{
"answer_id": 143306,
"author": "Patrick",
"author_id": 429,
"author_profile": "https://Stack... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
143,296 | <p>I've got such a simple code:</p>
<pre><code><div class="div1">
<div class="div2">Foo</div>
<div class="div3">
<div class="div4">
<div class="div5">
Bar
</div>
</div>
</div>
</div>
</code></pre>
<p>and this CSS:</p>
<pre class="lang-css prettyprint-override"><code>.div1{
position: relative;
}
.div1 .div3 {
position: absolute;
top: 30px;
left: 0px;
width: 250px;
display: none;
}
.div1:hover .div3 {
display: block;
}
.div2{
width: 200px;
height: 30px;
background: red;
}
.div4 {
background-color: green;
color: #000;
}
.div5 {}
</code></pre>
<p>The problem is: When I move the cursor from <code>.div2</code> to <code>.div3</code> (<code>.div3</code> should stay visible because it's the child of <code>.div1</code>) then the hover is disabled. I'm testing it in IE7, in FF it works fine. What am I doing wrong? I've also realized that when i remove <code>.div5</code> tag than it's working. Any ideas?</p>
| [
{
"answer_id": 143309,
"author": "Ross",
"author_id": 2025,
"author_profile": "https://Stackoverflow.com/users/2025",
"pm_score": 0,
"selected": false,
"text": " <style type=\"text/css\">\n * {\n color: #fff;\n }\n .wrapper {\n\n }\n\n .tr... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20403/"
] |
143,320 | <p>I am trying to write a cronjob controller, so I can call one website and have all modules cronjob.php executed. Now my problem is how do I do that?</p>
<p>Would curl be an option, so I also can count the errors and successes?</p>
<p>[Update]</p>
<p>I guess I have not explained it enough. </p>
<p>What I want to do is have one file which I can call like from <a href="http://server/cronjob" rel="noreferrer">http://server/cronjob</a> and then make it execute every /application/modules/*/controller/CronjobController.php or have another way of doing it so all the cronjobs aren't at one place but at the same place the module is located. This would offer me the advantage, that if a module does not exist it does not try to run its cronjob.</p>
<p>Now my question is how would you execute all the modules CronjobController or would you do it a completly different way so it still stays modular?</p>
<p>And I want to be able to giveout how many cronjobs ran successfully and how many didn't</p>
| [
{
"answer_id": 144235,
"author": "Stefan Gehrig",
"author_id": 11354,
"author_profile": "https://Stackoverflow.com/users/11354",
"pm_score": 0,
"selected": false,
"text": "Zend_Http_Client"
},
{
"answer_id": 733148,
"author": "Community",
"author_id": -1,
"author_prof... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19929/"
] |
143,365 | <p>I have a flash application running Flash 9 (CS3). Application is able to control the Softkeys when this flash application is loaded in the supported mobile device. But, the application doesn't have control when the same is embedded in HTML page and browsed via supported mobile device. Any ideas how to make this work?</p>
<p>Thanks
Keerthi</p>
| [
{
"answer_id": 144130,
"author": "fenomas",
"author_id": 10651,
"author_profile": "https://Stackoverflow.com/users/10651",
"pm_score": 1,
"selected": false,
"text": "var myListener = new Object();\nmyListener.onKeyDown = function() {\n var code = Key.getCode();\n if (code==Extended... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
143,390 | <p>I'm now in search for a Java Text to Speech (TTS) framework. During my investigations I've found several JSAPI1.0-(partially)-compatible frameworks listed on <a href="http://java.sun.com/products/java-media/speech/reference/codesamples/index.html" rel="noreferrer">JSAPI Implementations page</a>, as well as a pair of Java TTS frameworks which do not appear to follow JSAPI spec (<a href="http://mary.dfki.de/" rel="noreferrer">Mary</a>, <a href="http://www.say-it-now.com/mainsite.htm" rel="noreferrer">Say-It-Now</a>). I've also noted that currently no reference implementation exists for JSAPI.</p>
<p>Brief tests I've done for FreeTTS (first one listed in JSAPI impls page) show that it is far from reading simple and obvious words (examples: ABC, blackboard). Other tests are currently in progress.</p>
<p>And here goes the question (6, actually):</p>
<ol>
<li>Which of the Java-based TTS frameworks have you used?</li>
<li>Which ones, by your opinion, are capable of reading the largest wordbase?</li>
<li>What about their voice quality?</li>
<li>What about their performance?</li>
<li>Which non-Java frameworks with Java bindings are there on the scene?</li>
<li>Which of them would you recommend?</li>
</ol>
<p>Thank you in advance for your comments and suggestions.</p>
| [
{
"answer_id": 148089,
"author": "DiaWorD",
"author_id": 17707,
"author_profile": "https://Stackoverflow.com/users/17707",
"pm_score": 1,
"selected": false,
"text": "java -jar freetts.jar some-more-args-here"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/143390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17707/"
] |
143,405 | <p>What are the differences in implementing interfaces <strong>implicitly</strong> and <strong>explicitly</strong> in C#?</p>
<p>When should you use implicit and when should you use explicit?</p>
<p>Are there any pros and/or cons to one or the other?</p>
<hr>
<p>Microsoft's official guidelines (from first edition <a href="https://rads.stackoverflow.com/amzn/click/com/0321246756" rel="noreferrer" rel="nofollow noreferrer">Framework Design Guidelines</a>) states that <strong>using explicit implementations are not recommended</strong>, since it gives the code unexpected behaviour.</p>
<p>I think this guideline is very <strong>valid in a pre-IoC-time</strong>, when you don't pass things around as interfaces.</p>
<p>Could anyone touch on that aspect as well?</p>
| [
{
"answer_id": 143423,
"author": "mattlant",
"author_id": 14642,
"author_profile": "https://Stackoverflow.com/users/14642",
"pm_score": 10,
"selected": true,
"text": "IList.CopyTo"
},
{
"answer_id": 143483,
"author": "Matthew Scharley",
"author_id": 15537,
"author_pro... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2429/"
] |
143,420 | <p>Does anyone know how to modify an existing import specification in Microsoft Access 2007 or 2010? In older versions there used to be an Advanced button presented during the import wizard that allowed you to select and edit an existing specification. I no longer see this feature but hope that it still exists and has just been moved somewhere else.</p>
| [
{
"answer_id": 14443025,
"author": "Mike Hansen",
"author_id": 1997691,
"author_profile": "https://Stackoverflow.com/users/1997691",
"pm_score": 3,
"selected": false,
"text": "Public Sub MyExcelTransfer(myTempTable As String, myPath As String)\nOn Error GoTo ERR_Handler:\n Dim mySpec ... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143420",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
143,429 | <p>We all know that commenting our code is an important part of coding style for making our code understandable to the next person who comes along, or even ourselves in 6 months or so.</p>
<p>However, sometimes a comment just doesn't cut the mustard. I'm not talking about obvious jokes or vented frustraton, I'm talking about comments that appear to be making an attempt at explanation, but do it so poorly they might as well not be there. Comments that are <strong>too short</strong>, are <strong>too cryptic</strong>, or are <strong>just plain wrong</strong>. </p>
<p>As a cautonary tale, could you share something you've seen that was really just <strong>that bad</strong>, and if it's not obvious, show the code it was referring to and point out what's wrong with it? What <strong>should</strong> have gone in there instead?</p>
<p>See also: </p>
<ul>
<li><a href="https://stackoverflow.com/questions/163600/when-not-to-comment-code">When NOT to comment your code</a></li>
<li><a href="https://stackoverflow.com/questions/121945/how-do-you-like-your-comments-best-practices">How do you like your comments? (Best Practices)</a></li>
<li><a href="https://stackoverflow.com/questions/184618/what-is-the-best-comment-in-source-code-you-have-ever-encountered">What is the best comment in source code you have ever encountered?</a></li>
</ul>
| [
{
"answer_id": 143439,
"author": "Rich Bradshaw",
"author_id": 16511,
"author_profile": "https://Stackoverflow.com/users/16511",
"pm_score": 8,
"selected": true,
"text": "$i = 0; //set i to 0\n\n$i++; //use sneaky trick to add 1 to i!\n\nif ($i==$j) { // I made sure to use == rather than... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21632/"
] |
143,486 | <p>I've recently read the Yahoo manifesto <a href="http://developer.yahoo.com/performance/rules.html#postload" rel="noreferrer">Best Practices for Speeding Up Your Web Site</a>. They recommend to put the JavaScript inclusion at the bottom of the HTML code when we can.</p>
<p>But where exactly and when?</p>
<p>Should we put it before closing <code></html></code> or after ? And above all, when should we still put it in the <code><head></code> section?</p>
| [
{
"answer_id": 143496,
"author": "Rich Bradshaw",
"author_id": 16511,
"author_profile": "https://Stackoverflow.com/users/16511",
"pm_score": 2,
"selected": false,
"text": "</html>"
},
{
"answer_id": 143508,
"author": "Laurie Young",
"author_id": 7473,
"author_profile"... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9951/"
] |
143,487 | <p>I'm using netbeans on ubuntu, I would like to add some fonts to it. Could anyone tell me how this is done ?</p>
| [
{
"answer_id": 143496,
"author": "Rich Bradshaw",
"author_id": 16511,
"author_profile": "https://Stackoverflow.com/users/16511",
"pm_score": 2,
"selected": false,
"text": "</html>"
},
{
"answer_id": 143508,
"author": "Laurie Young",
"author_id": 7473,
"author_profile"... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11234/"
] |
143,523 | <p>Any recommended crypto libraries for Java. What I need is the ability to parse X.509 Certificates to extract the information contained in them.</p>
<p>Thanks</p>
| [
{
"answer_id": 144128,
"author": "erickson",
"author_id": 3474,
"author_profile": "https://Stackoverflow.com/users/3474",
"pm_score": 3,
"selected": false,
"text": "java.security.cert.X509Certificate"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/143523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12344/"
] |
143,530 | <p>I'm having a problem with my compiler telling me there is an 'undefined reference to' a function I want to use in a library. Let me share some info on the problem:</p>
<ul>
<li>I'm cross compiling with gcc for C.</li>
<li>I am calling a library function which is accessed through an included header which includes another header, which contains the prototype.</li>
<li>I have included the headers directory using -I and i'm sure it's being found.</li>
<li>I'm first creating the .o files then linking them in a separate command.</li>
</ul>
<p>So my thought is it might be the order in which I include the library files, but i'm not sure what is the correct way to order them. I tried with including the headers folder both before and after the .o file.</p>
<p>Some suggests would be great, and maybe and explanation of how the linker does its thing.</p>
<p>Thanks!</p>
<hr>
<p>Response to answers</p>
<ul>
<li>there is no .a library file, just .h and .c in the library, so -l isn't appropriate</li>
<li>my understanding of a library file is that it is just a collection of header and source files, but maybe it's a collection of .o files created from the source?!</li>
<li>there is no library object file being created, maybe there should be?? Yes seems I don't understand the difference between includes and libraries...i'll work on that :-)</li>
</ul>
<p>Thanks for all the responses! I learned a lot about libraries. I'd like to put all the responses as the accepted answer :-)</p>
| [
{
"answer_id": 143537,
"author": "jk.",
"author_id": 21284,
"author_profile": "https://Stackoverflow.com/users/21284",
"pm_score": 0,
"selected": false,
"text": "gcc -c mylib.c -o mylib.o\nar rcs libmylib.a mylib.o\n"
},
{
"answer_id": 143541,
"author": "Diomidis Spinel... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/76121/"
] |
143,552 | <p>In MySQL, If I have a list of date ranges (range-start and range-end). e.g.</p>
<pre><code>10/06/1983 to 14/06/1983
15/07/1983 to 16/07/1983
18/07/1983 to 18/07/1983
</code></pre>
<p>And I want to check if another date range contains ANY of the ranges already in the list, how would I do that?</p>
<p>e.g.</p>
<pre><code>06/06/1983 to 18/06/1983 = IN LIST
10/06/1983 to 11/06/1983 = IN LIST
14/07/1983 to 14/07/1983 = NOT IN LIST
</code></pre>
| [
{
"answer_id": 143568,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 10,
"selected": true,
"text": " |-------------------| compare to this one\n |---------| contained wi... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] |
143,554 | <p>I have written a ruby script which opens up dlink admin page in firefox and does a ADSL connection or disconnection.</p>
<p>I could run this script in the terminal without any problem. But if I put it as cron job, it doesn't fire up firefox.</p>
<p>This is the entry I have in <em>crontab</em></p>
<pre><code># connect to dataone
55 17 * * * ruby /home/raguanu/Dropbox/nettie.rb >> /tmp/cron_test
</code></pre>
<p>I see the following entries in /tmp/cron_test. So it looks like the script indeed ran.</p>
<pre><code>PROFILE:
i486-linux
/usr/bin/firefox -jssh
</code></pre>
<p>But I couldn't figure out why I didn't see firefox opening up, for this automation to work. Here is <em>/home/raguanu/Dropbox/nettie.rb</em></p>
<pre><code>#!/usr/bin/ruby -w
require 'rubygems'
require 'firewatir'
require 'optiflag'
module Options extend OptiFlagSet
character_flag :d do
long_form 'disconnect'
description 'Mention this flag if you want to disconnect dataone'
end
flag :l do
optional
long_form 'admin_link'
default 'http://192.168.1.1'
description 'Dlink web administration link. Defaults to http://192.168.1.1'
end
flag :u do
optional
long_form 'user'
default 'admin'
description 'Dlink administrator user name. Defaults to "admin"'
end
flag :p do
optional
long_form 'password'
default 'admin'
description 'Dlink administrator password. Defaults to "admin"'
end
flag :c do
optional
long_form 'connection_name'
default 'bsnl'
description 'Dataone connection name. Defaults to "bsnl"'
end
extended_help_flag :h do
long_form 'help'
end
and_process!
end
class DlinkAdmin
include FireWatir
def initialize(admin_link = "http://192.168.1.1", user = 'admin', pwd = 'admin')
@admin_link, @user, @pwd = admin_link, user, pwd
end
def connect( connection_name = 'bsnl' )
goto_connection_page connection_name
# disconnect prior to connection
@browser.button(:value, 'Disconnect').click
# connect
@browser.button(:value, 'Connect').click
# done!
@browser.close
end
def disconnect( connection_name = 'bsnl' )
goto_connection_page connection_name
# disconnect
@browser.button(:value, 'Disconnect').click
# done!
@browser.close
end
private
def goto_connection_page( connection_name = 'bsnl')
@browser ||= Firefox.new
@browser.goto(@admin_link)
# login
@browser.text_field(:name, 'uiViewUserName').set(@user)
@browser.text_field(:name, 'uiViewPassword').set(@pwd)
@browser.button(:value,'Log In').click
# setup > dataone
@browser.image(:alt, 'Setup').click
@browser.link(:text, connection_name).click
end
end
admin = DlinkAdmin.new(Options.flags.l, Options.flags.u, Options.flags.p)
unless Options.flags.d?
admin.connect( Options.flags.c )
else
admin.disconnect( Options.flags.c )
end
</code></pre>
<p>Any help is appreciated.</p>
| [
{
"answer_id": 143596,
"author": "mana",
"author_id": 12016,
"author_profile": "https://Stackoverflow.com/users/12016",
"pm_score": 0,
"selected": false,
"text": "#min hour day month dow user command\n55 17 * * * ur_user_is_missing ruby /home/raguanu... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15139/"
] |
143,566 | <p>I've been thinking a lot lately about a music-oriented project I'd like to work on. Kind of like a game... kind of like a studio workstation (FL Studio, Reason).</p>
<p>I guess the best way to describe it would be: like "Guitar Hero", but with no canned tracks. All original music--composed by you, on the fly--but the software would use its knowledge of music theory (as well as some supervised learning algorithms) to make sure that your input gets turned into something that sounds great.</p>
<p>It sounds a little silly, explaining it like that, but there ya go. It's something I think would make an interesting side project.</p>
<p>Anyhow, I'm looking for a Java library for generating the actual audio. Browsing around on sourceforge, there are countless software synths, and I have no idea which to choose.</p>
<p>My top priority is that it should sound incredible... Really rich, layered, textured synths, with gobs of configurable parameters. Emulation of acoustic instruments is not important to me.</p>
<p>My second priority is that it ought to be straightforward to use strictly as a library, with no GUI involved at all. (If there's a synth with really breathtaking output, but it's tightly-coupled with a GUI, then I might consider ripping the audio portion out of the application, but I'd rather start with a nicely contained library).</p>
<p>I know I could send MIDI to a standalone synth, but I think it'd be cool to read the actual synth code and learn a little DSP while I'm at it.</p>
<p>Any suggestions?</p>
<p>Oh yeah, I'm on Windows, so posix-only stuff is a no go.</p>
<p>Thanks!</p>
| [
{
"answer_id": 143634,
"author": "benjismith",
"author_id": 22979,
"author_profile": "https://Stackoverflow.com/users/22979",
"pm_score": 2,
"selected": false,
"text": "Synth s = new Synth();\nInstrument i = s.getInstrument(\"Robot Bass\");\ni.makeAwesome(true);\n"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/143566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22979/"
] |
143,571 | <p>I'm building my first ASP.NET MVC application and I am having some troubles with Partial Views.</p>
<p>If I, as an example, want to put a "Footer" as a Partial I create an "MVC View User Control" in "/Views/Shared/Footer.ascx". (I leave it empty for now)</p>
<p>What is the correct way for adding it to my Layout? </p>
<p>I have tried:</p>
<pre><code><%=Html.RenderPartial("Footer")%>
</code></pre>
<p>and:</p>
<pre><code><%=Html.RenderPartial("~/Views/Shared/Footer.ascx")%>
</code></pre>
<p>For each one I get an exception: </p>
<blockquote>
<p>"CS1502: The best overloaded method
match for
'System.IO.TextWriter.Write(char)' has
some invalid arguments"</p>
</blockquote>
<p>What is the correct way to deal with partials in ASP.NET MVC?</p>
| [
{
"answer_id": 143594,
"author": "Ricky",
"author_id": 653,
"author_profile": "https://Stackoverflow.com/users/653",
"pm_score": 4,
"selected": false,
"text": "<% Html.RenderPartial(\"~/Views/Shared/Footer.ascx\"); %>\n"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/143571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
143,622 | <p>This may seem like a programming 101 question and I had thought I knew the answer but now find myself needing to double check. In this piece of code below, will the exception thrown in the first catch block then be caught by the general Exception catch block below?</p>
<pre><code>try {
// Do something
} catch(IOException e) {
throw new ApplicationException("Problem connecting to server");
} catch(Exception e) {
// Will the ApplicationException be caught here?
}
</code></pre>
<p>I always thought the answer would be no, but now I have some odd behaviour that could be caused by this. The answer is probably the same for most languages but I'm working in Java.</p>
| [
{
"answer_id": 143628,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 9,
"selected": true,
"text": "throw"
},
{
"answer_id": 143671,
"author": "Tom Hawtin - tackline",
"author_id": 4725,
"author_profile": ... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/270/"
] |
143,632 | <p>Any recommended crypto libraries for Python. I know I've asked something similar in <a href="https://stackoverflow.com/questions/143523/">x509 certificate parsing libraries for Java</a>, but I should've split the question in two.</p>
<p>What I need is the ability to parse X.509 Certificates to extract the information contained in them.</p>
<p>Looking around, I've found two options:</p>
<ul>
<li>Python OpenSSL Wrappers (<a href="http://sourceforge.net/projects/pow" rel="nofollow noreferrer" title="Python OpenSSL Wrappers">http://sourceforge.net/projects/pow</a>)</li>
<li><a href="https://github.com/pyca/pyopenssl" rel="nofollow noreferrer">pyOpenSSL</a></li>
</ul>
<p>Of the two, pyOpenSSL seems to be the most "maintained", but I'd like some feedback on anybody who might have experience with them?</p>
| [
{
"answer_id": 70135187,
"author": "Saikat",
"author_id": 1594823,
"author_profile": "https://Stackoverflow.com/users/1594823",
"pm_score": 0,
"selected": false,
"text": "keyczar"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/143632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12344/"
] |
143,651 | <p>I have written an application which has a modal form. How can I ensure that this form does not lose the focus even when an other application is started?</p>
| [
{
"answer_id": 143698,
"author": "faulty",
"author_id": 20007,
"author_profile": "https://Stackoverflow.com/users/20007",
"pm_score": 0,
"selected": false,
"text": "SetForegroundWindow(Me.Handle)\n"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/143651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
143,680 | <p>It seems that most of the installers for Perl are centered around installing Perl modules, not applications. Things like ExtUtils::MakeMaker and Module::Build are very well suited for modules, but require some additional work for Web Apps.</p>
<p>Ideally it would be nice to be able to do the following after checking out the source from the repository:</p>
<ul>
<li>Have missing dependencies detected</li>
<li>Download and install dependencies from CPAN</li>
<li>Run a command to "Build" the source into a final state (perform any source parsing or configuration necessary for the local environment).</li>
<li>Run a command to install the built files into the appropriate locations. Not only the perl modules, but also things like template (.tt) files, and CGI scripts, JS and image files that should be web-accessible.</li>
<li>Make sure proper permissions are set on installed files (and SELinux context if necessary).</li>
</ul>
<p>Right now we have a system based on <strong>Module::Build</strong> that does most of this. The work was done by done by my co-worker who was learning to use <strong>Module::Build</strong> at the time, and we'd like some advice on generalizing our solution, since it's fairly app-specific right now. In particular, our system requires us to install dependencies by hand (although it does detect them).</p>
<p>Is there any particular system you've used that's been particularly successful? Do you have to write an installer based on <strong>Module::Build</strong> or <strong>ExtUtils::MakeMaker</strong> that's particular to your application, or is something more general available?</p>
<p><strong>EDIT:</strong> To answer brian's questions below:</p>
<ul>
<li>We can log into the machines</li>
<li>We do not have root access to the machines</li>
<li>The machines are all (ostensibly) identical builds of RHEL5 with SELinux enabled</li>
<li>Currently, the people installing the machines are only programmers from our group, and our source is not available to the general public. However, it's conceivable our source could eventually be installed on someone else's machines in our organization, to be installed by their programmers or systems people.</li>
<li>We install by checking out from the repository, though we'd like to have the option of using a distributed archive (see above).</li>
</ul>
| [
{
"answer_id": 144216,
"author": "brian d foy",
"author_id": 2766176,
"author_profile": "https://Stackoverflow.com/users/2766176",
"pm_score": 4,
"selected": true,
"text": "MakeMaker"
}
] | 2008/09/27 | [
"https://Stackoverflow.com/questions/143680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21632/"
] |
143,712 | <p>Is there a way of comparing two bitmasks in Transact-SQL to see if any of the bits match? I've got a User table with a bitmask for all the roles the user belongs to, and I'd like to select all the users that have <em>any</em> of the roles in the supplied bitmask. So using the data below, a roles bitmask of 6 (designer+programmer) should select Dave, Charlie and Susan, but not Nick.</p>
<pre>User Table
----------
ID Username Roles
1 Dave 6
2 Charlie 2
3 Susan 4
4 Nick 1
Roles Table
-----------
ID Role
1 Admin
2 Programmer
4 Designer</pre>
<p>Any ideas? Thanks.</p>
| [
{
"answer_id": 143919,
"author": "Sklivvz",
"author_id": 7028,
"author_profile": "https://Stackoverflow.com/users/7028",
"pm_score": 0,
"selected": false,
"text": "SELECT * FROM UserTable WHERE Roles & 2 = 2\n"
},
{
"answer_id": 3561763,
"author": "ScottE",
"author_id": 1... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14072/"
] |
143,714 | <p>In PHP, a string enclosed in "double quotes" will be parsed for variables to replace whereas a string enclosed in 'single quotes' will not. In Python, does this also apply?</p>
| [
{
"answer_id": 143719,
"author": "Milen A. Radev",
"author_id": 15785,
"author_profile": "https://Stackoverflow.com/users/15785",
"pm_score": 8,
"selected": true,
"text": "'"
},
{
"answer_id": 143730,
"author": "Bryan Oakley",
"author_id": 7432,
"author_profile": "htt... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183/"
] |
143,736 | <p>I have a simple message box in a WPF application that is launched as below:</p>
<pre><code>private void Button_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Howdy", "Howdy");
}
</code></pre>
<p>I can get <a href="http://www.codeplex.com/white" rel="nofollow noreferrer" title="white">white</a> to click my button and launch the message box. </p>
<p>UISpy shows it as a child of my window I couldn't work out the method to access it.</p>
<p>How do I get access to my MessageBox to verify its contents?</p>
| [
{
"answer_id": 143766,
"author": "Brownie",
"author_id": 6600,
"author_profile": "https://Stackoverflow.com/users/6600",
"pm_score": 3,
"selected": true,
"text": " var app = Application.Launch(@\"c:\\ApplicationPath.exe\");\n var window = app.GetWindow(\"Window1\");\n ... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6600/"
] |
143,739 | <p>How do you do your own fonts? I don't want a heavyweight algorithm (freetype, truetype, adobe, etc) and would be fine with pre-rendered bitmap fonts.</p>
<p>I do want anti-aliasing, and would like proportional fonts if possible.</p>
<p>I've heard I can use Gimp to do the rendering (with some post processing?)</p>
<p>I'm developing for an embedded device with an LCD. It's got a 32 bit processor, but I don't want to run Linux (overkill - too much code/data space for too little functionality that I would use)</p>
<p>C. C++ if necessary, but C is preferred. Algorithms and ideas/concepts are fine in any language...</p>
<p>-Adam</p>
| [
{
"answer_id": 143810,
"author": "SteinNorheim",
"author_id": 19220,
"author_profile": "https://Stackoverflow.com/users/19220",
"pm_score": 3,
"selected": true,
"text": "LetterA db 01111100b\n db 11000110b\n db 11000110b\n db 11111110b\n db 11000110b\n ... | 2008/09/27 | [
"https://Stackoverflow.com/questions/143739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2915/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.