qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
199,180 | <p>The only thing I can get python omnicomplete to work with are system modules. I get nothing for help with modules in my site-packages or modules that I'm currently working on.</p>
| [
{
"answer_id": 200227,
"author": "Simon Peverett",
"author_id": 6063,
"author_profile": "https://Stackoverflow.com/users/6063",
"pm_score": 0,
"selected": false,
"text": " set iskeyword+=.\n"
},
{
"answer_id": 201420,
"author": "Jeremy Cantrell",
"author_id": 18866,
"... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1367022/"
] |
199,182 | <p>I'm working on a program that is form based but I have been asked to add some command line support, this works fine apart from the form flashes up and closes down when running from the command line. Is there anyway to hide the form whilst the command line is running? Some code does refer to controls so the gui would need to be accessible but not visible, is this workable?</p>
| [
{
"answer_id": 199198,
"author": "benPearce",
"author_id": 4490,
"author_profile": "https://Stackoverflow.com/users/4490",
"pm_score": 2,
"selected": false,
"text": "main = new MainForm();\n"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/199182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
199,184 | <p>How do I check if a number is a palindrome?</p>
<p>Any language. Any algorithm. (except the algorithm of making the number a string and then reversing the string).</p>
| [
{
"answer_id": 199218,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 8,
"selected": false,
"text": "n = num;\nrev = 0;\nwhile (num > 0)\n{\n dig = num % 10;\n rev = rev * 10 + dig;\n num = num / 10;\n}\n"
}... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/781/"
] |
199,219 | <p>Im getting frustrated because of OpenDNS and other services (ie: roadrunner) that now always returns a ping even if you type any invalid url ie: lkjsdaflkjdsjf.com --- I had created software for my own use that would ping a url to verify if the site was up or not. This no longer works. Does anyone have any ideas about this?</p>
<p>Requirements:</p>
<ol>
<li>It should work with any valid web site, even ones i dont control</li>
<li>It should be able to run from any network that has internet access</li>
</ol>
<p>I would greatly appreciate to hear how others now handle this. I would like to add, im attempting to do this using System.Net in c#</p>
<p>Thank you greatly :-)</p>
<p>New addition: Looking for a solution that i can either buy and run on my windows machine, or program in c#. :-)</p>
<p><strong>Update:</strong></p>
<p>Thank you all very much for your answers. Ultimately i ended up creating a solution by doing this:</p>
<ol>
<li>Creating a simple webclient that downloaed the specified page from the url (may change to just headers or use this to notify of page changes)</li>
<li>Read in xml file that simply lists the full url to the site/pages to check</li>
<li>Created a windows service to host the solution so it would recover server restarts.</li>
<li>On error an email and text message is sent to defined list of recipients</li>
<li>Most values (interval, smtp, to, from, etc) are defined in the .config for easy change</li>
</ol>
<p>I will be taking some of your advice to add 'features' to this later, which includes:</p>
<ul>
<li>AJAX page for real-time monitoring. I will use WCF to connect to the existing windows service from the asp.net page</li>
<li>Download Headers only (with option for page change comparison)</li>
<li>make more configurable (ie: retries on failure before notification)</li>
</ul>
| [
{
"answer_id": 199254,
"author": "IAmCodeMonkey",
"author_id": 27613,
"author_profile": "https://Stackoverflow.com/users/27613",
"pm_score": 3,
"selected": true,
"text": "<html>\n <head>\n <script language=\"javascript\" type=\"text/javascript\">\n <!--\n var ajax = new X... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26685/"
] |
199,235 | <p>I am using Oracle adapter from the BizTalk Adapter Pack (WCF based for BTS 2006 R2). In the configuration of the "solicit-response" send ports, I have used Oracle's username and password to connect to the database. </p>
<p>Now I would like to change that and use the SSO. So far I have created the Affiliate application and mapped the BTS Host Instance "user id" to the Oracle database user details.</p>
<p>When I run the application I am constantly getting the error: "Unable to redeem ticket, no ticket exists in the message".</p>
<p>reading through the BTS documentation I found the following at "ms-help://MS.BTS.2006/BTS06CoreDocs/html/c7bf755c-c37d-4b19-9817-a7f42e1e9656.htm":
In scenarios where an orchestration invokes the send adapter, the BizTalk Messaging Engine sends the message to the MessageBox database. The orchestration should ensure that both the <strong>SSOTicket</strong> context property and the <strong>Microsoft.BizTalk.XLANGs.BTXEngine.OriginatorSID</strong> context property of the message that contains the ticket are maintained. When the adapter receives this message from the MessageBox database, the adapter calls the RedeemTicket method with the encrypted ticket to retrieve the back-end credentials from the SSO store. The user designing the orchestration should specifically copy this property to the message.</p>
<p>But I receive a message through SQL integrated connection, that doesn't have the SSO Ticket.</p>
<p>Please help to resolve this issue?</p>
| [
{
"answer_id": 2384200,
"author": "Sam",
"author_id": 47636,
"author_profile": "https://Stackoverflow.com/users/47636",
"pm_score": 2,
"selected": false,
"text": " public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage pInMsg)\n {\n ISSOTicket ssoTicket = new IS... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199235",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
199,238 | <p>I'm writing a lightweight XML editor, and in cases where the user's input is not well formed, I would like to indicate to the user where the problem is, or at least where the first problem is. Does anyone know of an existing algorithm for this? If looking at code helps, if I could fill in the FindIndexOfInvalidXml method (or something like it), this would answer my question.</p>
<pre><code>using System;
namespace TempConsoleApp
{
class Program
{
static void Main(string[] args)
{
string text = "<?xml version=\"1.0\"?><tag1><tag2>Some text.</taagg2></tag1>";
int index = FindIndexOfInvalidXml(text);
Console.WriteLine(index);
}
private static int FindIndexOfInvalidXml(string theString)
{
int index = -1;
//Some logic
return index;
}
}
}
</code></pre>
| [
{
"answer_id": 199332,
"author": "Pseudo Masochist",
"author_id": 8529,
"author_profile": "https://Stackoverflow.com/users/8529",
"pm_score": 4,
"selected": true,
"text": "string s = \"<?xml version=\\\"1.0\\\"?><tag1><tag2>Some text.</taagg2></tag1>\";\nSystem.Xml.XmlDocument doc = new ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27109/"
] |
199,241 | <p>How can i generate bytecode (Byte[]) from a String at runtime, without using a "javac" process or something of this sort? is there a simple way of calling the compiler like that?</p>
<p>later addition:</p>
<p>I chose to <a href="https://stackoverflow.com/questions/200833/when-should-i-accept-an-answer">accept the solution that actually best fits <strong>my</strong> situation</a>. my application is a hobby-project still in design sketch phase, and it is the right time to consider inserting new technology. also, since the guy that's supposed to help me with BL is a JavaScript developer, the idea of using a JavaScript interpreter instead of a stub compiler+classLoader seems more appealing to me in this situation. other (unaccepted) answers of this question are informative and, as far as i can tell, answer my question very well, so thanks, but I'm going to try <a href="http://www.mozilla.org/rhino/" rel="nofollow noreferrer">Rhino</a> :)</p>
| [
{
"answer_id": 199314,
"author": "William",
"author_id": 9193,
"author_profile": "https://Stackoverflow.com/users/9193",
"pm_score": 0,
"selected": false,
"text": "eval()"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/199241",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11813/"
] |
199,252 | <p>I'm considering the best way to design a permissions system for an "admin" web application. The application is likely to have many users, each of whom could be assigned a certain role; some of these users could be permitted to perform specific tasks outside the role.</p>
<p>I can think of two ways to design this: one, with a "permissions" table with a row for every user, and boolean columns, one for each task, that assign them permissions to perform those tasks. Like this:</p>
<pre>
User ID Manage Users Manage Products Manage Promotions Manage Orders
1 true true true true
2 false true true true
3 false false false true
</pre>
<p>Another way I thought of was to use a bit mask to store these user permissions. This would limit the number of tasks that could be managed to 31 for a 32-bit signed integer, but in practice we're unlikely to have more than 31 specific tasks that a user could perform. This way, the database schema would be simpler, and we wouldn't have to change the table structure every time we added a new task that would need access control. Like this: </p>
<pre>
User ID Permissions (8-bit mask), would be ints in table
1 00001111
2 00000111
3 00000001
</pre>
<p>What mechanisms have people here typically used, and why?</p>
<p>Thanks!</p>
| [
{
"answer_id": 199272,
"author": "Dimitry",
"author_id": 27073,
"author_profile": "https://Stackoverflow.com/users/27073",
"pm_score": 0,
"selected": false,
"text": "create table permissions (\n user_id INT NOT Null,\n permission VARCHAR(255) NOT NULL,\n value TINYINT(1) NULL\n)... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27649/"
] |
199,260 | <p>Recently, someone asked about an <a href="https://stackoverflow.com/questions/198199/how-do-you-reverse-a-string-in-place-in-c-or-c">algorithm for reversing a string in place in C</a>. Most of the proposed solutions had troubles when dealing with non single-byte strings. So, I was wondering what could be a good algorithm for dealing specifically with utf-8 strings.</p>
<p>I came up with some code, which I'm posting as an answer, but I'd be glad to see other people's ideas or suggestions. I preferred to use actual code, so I've chosen C#, as it seems to be one of the most popular language in this site, but I don't mind if your code is in another language, as long as it could be reasonably understood by anyone who is familiar with an imperative language. And, as this is intended to see how such an algorithm could be implemented at a low-level (by low-level I just mean dealing with bytes), the idea is to avoid using libraries for the core code.</p>
<p><strong>Notes:</strong></p>
<p>I'm interested in the algorithm itself, its performance and how could it be optimized (I mean algorithm-level optimization, not replacing i++ with ++i and such; I'm not really interested in actual benchmarks either).</p>
<p>I don't mean to actually use it in production code or "reinventing the wheel". This is just out of curiosity and as an exercise.</p>
<p>I'm using C# byte arrays so I'm assuming you can get the length of the string without running though the string until you find a NUL.
That is, I'm not accounting for the complexity of finding the length of the string. But if you're using C, for instance, you could factor that out by using strlen() before calling the core code. </p>
<p><strong>Edit:</strong></p>
<p>As Mike F points out, my code (and other people's code posted here) is not dealing with composite characters. Some info about those <a href="http://www.unicode.org/faq/char_combmark.html" rel="nofollow noreferrer">here</a>. I'm not familiar with the concept, but if that means that there are "combining characters", i.e., characters / code points that are only valid in combination with other "base" characters / code points, a look-up table of such characters could be used to preserve the order of the "global" character ("base" + "combining" characters) when reversing.</p>
| [
{
"answer_id": 199280,
"author": "Juan Pablo Califano",
"author_id": 24170,
"author_profile": "https://Stackoverflow.com/users/24170",
"pm_score": 3,
"selected": false,
"text": "class UTF8Utils {\n\n\n public static void Reverse(byte[] str) {\n int len = str.Length;\n in... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24170/"
] |
199,266 | <p>How can I make xargs execute the command exactly once for each line of input given?
It's default behavior is to chunk the lines and execute the command once, passing multiple lines to each instance. </p>
<blockquote>
<p>From <a href="http://en.wikipedia.org/wiki/Xargs" rel="noreferrer">http://en.wikipedia.org/wiki/Xargs</a>: </p>
<p>find /path -type f -print0 | xargs -0 rm</p>
<p>In this example, find feeds the input of xargs with a long list of file names. xargs then splits this list into sublists and calls rm once for every sublist. This is more efficient than this functionally equivalent version:</p>
<p>find /path -type f -exec rm '{}' \;</p>
</blockquote>
<p>I know that find has the "exec" flag. I am just quoting an illustrative example from another resource.</p>
| [
{
"answer_id": 199270,
"author": "Draemon",
"author_id": 26334,
"author_profile": "https://Stackoverflow.com/users/26334",
"pm_score": 10,
"selected": true,
"text": "xargs -L 1\nxargs --max-lines=1 # synonym for the -L option\n"
},
{
"answer_id": 199293,
"author": "readonly",... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4883/"
] |
199,321 | <p>What is the best way to write data to the text console at arbitrary locations on the screen and with custom fore/background colors?</p>
| [
{
"answer_id": 22065166,
"author": "Igor Kostomin",
"author_id": 1119537,
"author_profile": "https://Stackoverflow.com/users/1119537",
"pm_score": 2,
"selected": false,
"text": "WriteConsoleOutput"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/199321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4435/"
] |
199,333 | <p>I was writing a program in C++ to find all solutions of <em>a</em><sup><em>b</em></sup> = <em>c</em>, where <em>a</em>, <em>b</em> and <em>c</em> together use all the digits 0-9 exactly once. The program looped over values of <em>a</em> and <em>b</em>, and it ran a digit-counting routine each time on <em>a</em>, <em>b</em> and <em>a<sup>b</sup></em> to check if the digits condition was satisfied.</p>
<p>However, spurious solutions can be generated when <em>a</em><sup><em>b</em></sup> overflows the integer limit. I ended up checking for this using code like:</p>
<pre><code>unsigned long b, c, c_test;
...
c_test=c*b; // Possible overflow
if (c_test/b != c) {/* There has been an overflow*/}
else c=c_test; // No overflow
</code></pre>
<p>Is there a better way of testing for overflow? I know that some chips have an internal flag that is set when overflow occurs, but I've never seen it accessed through C or C++.</p>
<hr>
<p>Beware that <strong><em>signed</em> <code>int</code> overflow is undefined behaviour in C and C++</strong>, and thus you have to detect it without actually causing it. For signed int overflow before addition, see <em><a href="https://stackoverflow.com/questions/3944505/detecting-signed-overflow-in-c-c">Detecting signed overflow in C/C++</a></em>.</p>
| [
{
"answer_id": 199354,
"author": "Andrew Edgecombe",
"author_id": 11694,
"author_profile": "https://Stackoverflow.com/users/11694",
"pm_score": 4,
"selected": false,
"text": "unsigned long"
},
{
"answer_id": 199355,
"author": "Nils Pipenbrinck",
"author_id": 15955,
"a... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23732/"
] |
199,336 | <p>How would I print a spinning curser in a utility that runs in a terminal using standard C?</p>
<p>I'm looking for something that prints: \ | / - over and over in the same position on the screen?</p>
<p>Thanks </p>
| [
{
"answer_id": 199344,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 6,
"selected": true,
"text": "\\b"
},
{
"answer_id": 199380,
"author": "Dan Lenski",
"author_id": 20789,
"author_profile": "https://... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3467/"
] |
199,348 | <p>Is there a way (hacky will do) to allow a user to go back to a previous version of a <a href="http://en.wikipedia.org/wiki/ClickOnce" rel="noreferrer">ClickOnce</a> network deployed application?</p>
<p>I've looked in the docs and API and there seems to be no way. You <b>can</b> selectively choose if you would like to update, but once updated there is, seemingly, no way back.</p>
| [
{
"answer_id": 1664121,
"author": "Jason Hornor",
"author_id": 201263,
"author_profile": "https://Stackoverflow.com/users/201263",
"pm_score": 7,
"selected": false,
"text": "[appName].application"
},
{
"answer_id": 11238554,
"author": "Hasani Blackwell",
"author_id": 7966... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/460845/"
] |
199,390 | <p>I have an application used by pretty tech-savey people and they want small island of programmability so I've used embedded Iron Python.</p>
<p>However, since IronPython 2.0 Eval() doesn't work any more. Specifically I can't both load modules and inject local variables.</p>
<p>There is a work around where I can still call Execute(), print out my answer and listen to StandardOut, but then it comes out as a string and I've lost the type.</p>
<p>Not a disaster for a long, but a huge pain for more complex objects.</p>
<p>Does anyone know how to get Eval() working again in 2.0 like it did in 1.x?</p>
<p>Cheers,
Jan</p>
| [
{
"answer_id": 199406,
"author": "Curt Hagenlocher",
"author_id": 533,
"author_profile": "https://Stackoverflow.com/users/533",
"pm_score": 3,
"selected": true,
"text": "ScriptEngine engine = Python.CreateEngine();\nScriptSource source = engine.CreateScriptSourceFromString(\"2 + 5\", Sou... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/460845/"
] |
199,403 | <p>I would like to load a BMP file, do some operations on it in memory, and output a new BMP file using C++ on Windows (Win32 native). I am aware of <a href="http://www.imagemagick.org/" rel="nofollow noreferrer">ImageMagick</a> and it's C++ binding <a href="http://www.imagemagick.org/Magick%2B%2B/" rel="nofollow noreferrer">Magick++</a>, but I think it's an overkill for this project since I am currently not interested in other file formats or platforms.</p>
<p>What would be the simplest way in terms of code setup to read and write BMP files? The answer may be "just use Magick++, it's the simplest."</p>
<p>Related Question: <a href="https://stackoverflow.com/questions/158756/what-is-the-best-image-manipulation-library">What is the best image manipulation library?</a></p>
| [
{
"answer_id": 200113,
"author": "user27732",
"author_id": 27732,
"author_profile": "https://Stackoverflow.com/users/27732",
"pm_score": 2,
"selected": false,
"text": "#include <windows.h>\n"
},
{
"answer_id": 11961825,
"author": "Mike C",
"author_id": 800151,
"author... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3827/"
] |
199,418 | <p>I have a C++ library that provides various classes for managing data. I have the source code for the library.</p>
<p>I want to extend the C++ API to support C function calls so that the library can be used with C code and C++ code at the same time.</p>
<p>I'm using GNU tool chain (gcc, glibc, etc), so language and architecture support are not an issue.</p>
<p>Are there any reasons why this is <strong>technically</strong> not possible?</p>
<p>Are there any <strong>gotcha's</strong> that I need to watch out for?</p>
<p>Are there resources, example code and/or documentation available regarding this?</p>
<hr>
<p>Some other things that I have found out:</p>
<ol>
<li>Use the following to wrap your C++ headers that need to be used by C code.</li>
</ol>
<p></p>
<pre><code>#ifdef __cplusplus
extern "C" {
#endif
//
// Code goes here ...
//
#ifdef __cplusplus
} // extern "C"
#endif
</code></pre>
<ol start="2">
<li>Keep "real" C++ interfaces in separate header files that are not included by C. Think <a href="http://en.wikipedia.org/wiki/Private_class_data_pattern" rel="noreferrer">PIMPL principle</a> here. Using <code>#ifndef __cplusplus #error</code> stuff helps here to detect any craziness.</li>
<li>Careful of C++ identifiers as names in C code</li>
<li>Enums varying in size between C and C++ compilers. Probably not an issue if you're using GNU tool chain, but still, be careful.</li>
<li><p>For structs follow the following form so that C does not get confused.</p>
<pre><code>typedef struct X { ... } X
</code></pre></li>
<li><p>Then use pointers for passing around C++ objects, they just have to be declared in C as struct X where X is the C++ object.</p></li>
</ol>
<p>All of this is courtesy of a friend who's a wizard at C++.</p>
| [
{
"answer_id": 199422,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 7,
"selected": true,
"text": "extern \"C\""
},
{
"answer_id": 199438,
"author": "David Nehme",
"author_id": 14167,
"author_profile":... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3467/"
] |
199,426 | <p>I am new to Java and am trying to run a program using Eclipse. But I have no idea how to get the command prompt running in with Eclipse...</p>
<p>I did some online research and couldn't get anything consolidated!</p>
<h3>Update:</h3>
<p>I'm not using an applet. It's a normal Java program trying to read a line from command prompt. I'm trying to do system programming.</p>
| [
{
"answer_id": 199444,
"author": "Pablo Fernandez",
"author_id": 7595,
"author_profile": "https://Stackoverflow.com/users/7595",
"pm_score": 0,
"selected": false,
"text": "Try this:\n\n\nimport java.util.Scanner;\n\n public class ReadFromPrompt{\n\n public static void main(Strin... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21968/"
] |
199,428 | <p>I Have one entity [Project] that contains a collection of other entities [Questions].</p>
<p>I have mapped the relation with a cascade attribute of "all-delete-orphan".</p>
<p>In my DB the relation is mapped with a project_id (FK) field on the questions table. this field cannot be null since I don't want a Question without a Project.</p>
<p>When I do <code>session.delete(project)</code> it throws an exception saying that <code>project_id</code> cant be <code>null</code>, but if I remove the <code>not-null</code> constraint to that field, the deletion works nice.</p>
<p>Anyone knows how to solve this?</p>
| [
{
"answer_id": 199683,
"author": "abarax",
"author_id": 24390,
"author_profile": "https://Stackoverflow.com/users/24390",
"pm_score": 4,
"selected": false,
"text": "Parent p = (Parent) session.Load(typeof(Parent), pid);\n// Get one child out of the set\nIEnumerator childEnumerator = p.Ch... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7595/"
] |
199,468 | <p>Why am I getting an out of memory exception?</p>
<p>So this dies in C# on the first time through:</p>
<p><strong>splitBitmaps.Add(neededImage.Clone(rectDimensions, neededImage.PixelFormat));</strong> </p>
<p>Where splitBitmaps is a List<BitMap> BUT this works in VB for at least 4 iterations:</p>
<p><strong>arlSplitBitmaps.Add(Image.Clone(rectDimensions, Image.PixelFormat))</strong></p>
<p>Where arlSplitBitmaps is a simple array list. (And yes I've tried arraylist in c#)</p>
<p>This is the fullsection:</p>
<pre><code>for (Int32 splitIndex = 0; splitIndex <= numberOfResultingImages - 1; splitIndex++)
{
Rectangle rectDimensions;
if (splitIndex < numberOfResultingImages - 1)
{
rectDimensions = new Rectangle(splitImageWidth * splitIndex, 0,
splitImageWidth, splitImageHeight);
}
else
{
rectDimensions = new Rectangle(splitImageWidth * splitIndex, 0,
sourceImageWidth - (splitImageWidth * splitIndex), splitImageHeight);
}
splitBitmaps.Add(neededImage.Clone(rectDimensions, neededImage.PixelFormat));
</code></pre>
<p>} </p>
<p>neededImage is a Bitmap by the way. </p>
<p>I can't find any useful answers on the intarweb, especially not why it works just fine in VB.</p>
<p><strong>Update:</strong></p>
<p>I actually found a reason (sort of) for this working but forgot to post it. It has to do with converting the image to a bitmap instead of just trying to clone the raw image if I remember.</p>
| [
{
"answer_id": 29024741,
"author": "dellyjm",
"author_id": 1810774,
"author_profile": "https://Stackoverflow.com/users/1810774",
"pm_score": 2,
"selected": false,
"text": "int totalWidth = rect.Left + rect.Width; //think -the same as Right property\n\nint allowableWidth = localImage.Widt... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21691/"
] |
199,469 | <p>I need to change the capitalization of a set of files in a subversion working copy, like so:</p>
<pre>
svn mv test.txt Test.txt
svn mv test2.txt Test2.txt
svn mv testn.txt Testn.txt
...
svn commit -m "caps"
</pre>
<p>How can I automate this process? Standard linux install tools available.</p>
| [
{
"answer_id": 199510,
"author": "UnkwnTech",
"author_id": 115,
"author_profile": "https://Stackoverflow.com/users/115",
"pm_score": 2,
"selected": false,
"text": "#!/usr/bin/python\nfrom os import rename, listdir\npath = \"/path/to/folder\"\ntry:\n dirList = listdir(path)\nexcept:\n ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27667/"
] |
199,470 | <ul>
<li>What is the main difference between <code>int.Parse()</code> and <code>Convert.ToInt32()</code>?</li>
<li>Which one is to be preferred</li>
</ul>
| [
{
"answer_id": 199482,
"author": "shahkalpesh",
"author_id": 23574,
"author_profile": "https://Stackoverflow.com/users/23574",
"pm_score": 7,
"selected": false,
"text": "Convert.ToInt32()"
},
{
"answer_id": 199484,
"author": "Dave Markle",
"author_id": 24995,
"author_... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14752/"
] |
199,483 | <p>This is the constraint I have on the Customers table.</p>
<pre><code>ALTER TABLE Customers
ADD CONSTRAINT CN_CustomerPhone
CHECK (Phone LIKE '([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]')
</code></pre>
<p>Why does this fail?</p>
<pre><code>INSERT INTO Customers
(CustomerName, Address, City, State, Zip, Phone)
VALUES
('Some Name','An Address', 'City goes here', 'WI', 12345, '(800) 555-1212')
</code></pre>
<p>With this error message.</p>
<blockquote>
<p>Msg 547, Level 16, State 0, Line 1 The
INSERT statement conflicted with the
CHECK constraint "CN_CustomerPhoneNo".
The conflict occurred in database
"Accounting", table "dbo.Customers",
column 'Phone'. The statement has been
terminated.</p>
</blockquote>
<p>I'm sure I'm missing something really simple, but I can't find it.</p>
<p>I've tried simplifying the constraint to only 'Phone LIKE '[0-9]'' and inserting a single digit, but it still fails. WTF?</p>
| [
{
"answer_id": 199500,
"author": "shahkalpesh",
"author_id": 23574,
"author_profile": "https://Stackoverflow.com/users/23574",
"pm_score": 4,
"selected": true,
"text": "\ncreate table #temp\n(phone varchar(15))\n\nALTER TABLE #temp\n ADD CONSTRAINT CN_CustomerPhone\n CHECK (Phone L... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/100/"
] |
199,488 | <p>For some reason I am having troubles with a DBI handle. Basically what happened was that I made a special connect function in a perl module and switched from doing:</p>
<pre><code>do 'foo.pl'
</code></pre>
<p>to</p>
<pre><code>use Foo;
</code></pre>
<p>and then I do</p>
<pre><code>$dbh = Foo->connect;
</code></pre>
<p>And now for some reason I keep getting the error:</p>
<blockquote>
<p>Can't locate object method "rollback" via package "Foo" at ../Foo.pm line 171.</p>
</blockquote>
<p>So the weird thing is that $dbh is definitely not a Foo, it's just defined in foo. Anyway, I haven't had any troubles with it up until now. Any ideas what's up?</p>
<p><strong>Edit</strong>: @Axeman: <code>connect</code> did not exist in the original. Before we just had a string that we used like this:</p>
<pre><code>do 'foo.pl';
$dbh = DBI->connect($DBConnectString);
</code></pre>
<p>and so <code>connect</code> is something like this</p>
<pre><code>sub connect {
my $dbh = DBI->connect('blah');
return $dbh;
}
</code></pre>
| [
{
"answer_id": 199635,
"author": "Axeman",
"author_id": 11289,
"author_profile": "https://Stackoverflow.com/users/11289",
"pm_score": 3,
"selected": true,
"text": "do 'foo.pl'"
},
{
"answer_id": 200016,
"author": "Frentos",
"author_id": 23978,
"author_profile": "https... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12448/"
] |
199,498 | <p>I'm just getting started working with foreign keys for the first time and I'm wondering if there's a standard naming scheme to use for them?</p>
<p>Given these tables:</p>
<pre><code>task (id, userid, title)
note (id, taskid, userid, note);
user (id, name)
</code></pre>
<p>Where Tasks have Notes, Tasks are owned by Users, and Users author Notes.</p>
<p>How would the three foreign keys be named in this situation? Or alternatively, <em>does it even matter at all</em>?</p>
<p><em>Update</em>: This question is about foreign key names, not field names!</p>
| [
{
"answer_id": 199504,
"author": "EvilTeach",
"author_id": 7734,
"author_profile": "https://Stackoverflow.com/users/7734",
"pm_score": 4,
"selected": false,
"text": "FK_TABLENAME_COLUMNNAME"
},
{
"answer_id": 199506,
"author": "Steve Moyer",
"author_id": 17008,
"autho... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] |
199,499 | <p>I'm creating a custom Java Struts tag that is for building and formatting an html select box in a standardised way (part of our usability guidelines).</p>
<p>Each select box has an additional/initial value which describes the requirement of the value returned by the select element, i.e.:</p>
<ul>
<li><i>Mandatory</i> - with the label "Please Select"
<li><i>Optional</i> - "None Selected"
<li><i>Select All</i> - "Select All"
</ul>
<p>The custom tag will have a property that controls which of these are to be used.</p>
<p>So the problem is, I need to think of a variable name that can adequately explain that is is holding one of these three values!<br>
I will be commenting the code in any case, but I'd prefer that co-workers didn't have to look up the source code to remember what the tag variable's purpose is.</p>
<p><strong>Edit:</strong> To put some context around this problem, the usability strategy that I'm implementing here is that if there are more than 5 items that can be selected, the options should appear as a select box. 5 or less items will appear as radio buttons.<br>
When radio buttons are being used, the mandatory label won't be displayed (form validation will complain if there's no value selected anyway). </p>
| [
{
"answer_id": 199572,
"author": "Mike Spross",
"author_id": 17862,
"author_profile": "https://Stackoverflow.com/users/17862",
"pm_score": 4,
"selected": true,
"text": "requirementConstraint"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/199499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6340/"
] |
199,508 | <p>Is it possible to show other processes in progress on an Oracle database? Something like Sybases <code>sp_who</code></p>
| [
{
"answer_id": 199523,
"author": "jim",
"author_id": 27628,
"author_profile": "https://Stackoverflow.com/users/27628",
"pm_score": 3,
"selected": false,
"text": "SELECT sid,\n opname,\n sofar,\n totalwork,\n units,\n elapsed_seconds,\n time_remaining\n... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14952/"
] |
199,518 | <p>In WinXP (SP2) you can store mapped network passwords...</p>
<p>Start->Control Panel->User Accounts->Pick one then choose "Manage my network passwords" from Related Tasks.</p>
<p>I normally have about 25-30 servers mapped this way to a few different accounts/domains. The problem is that at some point during our policy updates they get wiped out and it's a real PITA to add them all back again.</p>
<p>Does anyone know how to add them programatically using some sort of script?</p>
<p>Just to clarify, the end goal is not to map drives, it's to actually create the entries in that section. This allows us to use Windows authentication for connecting to our servers (via Dameware, SSMS etc.).</p>
<p><strong>Addendum:</strong></p>
<p>Mark's CredWrite tip led me here...</p>
<p><a href="http://www.pinvoke.net/default.aspx/advapi32/CredWrite.html" rel="nofollow noreferrer">pinvoke.net -- CredWrite (advapi32)</a></p>
<p>Which in turn led me here...</p>
<p><a href="http://blogs.msdn.com/peerchan/pages/487834.aspx" rel="nofollow noreferrer">Peer Channel Blog -- Application Password Security</a></p>
<p>Both have proved very helpful.</p>
| [
{
"answer_id": 199766,
"author": "Mark Brackett",
"author_id": 2199,
"author_profile": "https://Stackoverflow.com/users/2199",
"pm_score": 3,
"selected": true,
"text": "CRED_PERSIST_SESSION"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/199518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842/"
] |
199,521 | <p>I have a form with a "Clear" button.</p>
<p>When the user clicks "Clear", I want to clear the value of all the visible elements on the form. In the case of date controls, I want to reset them to the current date.</p>
<p>All of my controls are contained on a Panel.</p>
<p>Right now, I'm doing this with the below code. Is there an easier way than manually checking for each control type? This method seems excessively unwieldy.</p>
<p>To make matters worse, in order to recursively clear controls inside sub-containers (i.e., a group box within the panel) I have to repeat the whole monster with an overloaded "GroupBox" version.</p>
<p><em>Edit: Thanks to your suggestions, the below code is greatly simplified.</em></p>
<pre><code>Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
'User clicks Clear, so clear all the controls within this panel
ClearAllControls(panMid, True) 'True indicates that yes, i want to recurse through sub-containers
End Sub
ClearAllControls(ByRef container As Panel, Optional Recurse As Boolean = True)
'Clear all of the controls within the container object
'If "Recurse" is true, then also clear controls within any sub-containers
Dim ctrl As Control
For Each ctrl In container.Controls
If (ctrl.GetType() Is GetType(TextBox)) Then
Dim txt As TextBox = CType(ctrl, TextBox)
txt.Text = ""
End If
If (ctrl.GetType() Is GetType(CheckBox)) Then
Dim chkbx As CheckBox = CType(ctrl, CheckBox)
chkbx.Checked = False
End If
If (ctrl.GetType() Is GetType(ComboBox)) Then
Dim cbobx As ComboBox = CType(ctrl, ComboBox)
cbobx.SelectedIndex = -1
End If
If (ctrl.GetType() Is GetType(DateTimePicker)) Then
Dim dtp As DateTimePicker = CType(ctrl, DateTimePicker)
dtp.Value = Now()
End If
If Recurse Then
If (ctrl.GetType() Is GetType(Panel)) Then
Dim pnl As Panel = CType(ctrl, Panel)
ClearAllControls(pnl, Recurse)
End If
If ctrl.GetType() Is GetType(GroupBox) Then
Dim grbx As GroupBox = CType(ctrl, GroupBox)
ClearAllControls(grbx, Recurse)
End If
End If
Next
End Sub
</code></pre>
<p>@Theraccoonbear: I like your suggestion, but when I change the declaration to this:</p>
<pre><code>Private Sub ClearAllControls(ByRef controls As ControlCollection, Optional ByVal Recurse As Boolean = True)
</code></pre>
<p>Then this line gives me "Unable to cast object of type 'ControlCollection' to type 'ControlCollection'.":</p>
<pre><code> ClearAllControls(panMid.Controls)
</code></pre>
| [
{
"answer_id": 199553,
"author": "Mark Brackett",
"author_id": 2199,
"author_profile": "https://Stackoverflow.com/users/2199",
"pm_score": 5,
"selected": true,
"text": "Dim dtp as DateTimePicker = TryCast(ctrl, DateTimePicker)\nIf dtp IsNot Nothing then dtp.Value = Now()\n"
},
{
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199521",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/672/"
] |
199,527 | <p><code>$0</code> is the variable for the top level Ruby program, but is there one for the current method?</p>
| [
{
"answer_id": 199550,
"author": "Mark A. Nicolosi",
"author_id": 1103052,
"author_profile": "https://Stackoverflow.com/users/1103052",
"pm_score": 5,
"selected": false,
"text": "module Kernel\nprivate\n def this_method_name\n caller[0] =~ /`([^']*)'/ and $1\n end\nend\n\nclas... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757/"
] |
199,528 | <p>I know how to program Console application with parameters, example : myProgram.exe param1 param2.</p>
<p>My question is, how can I make my program works with |, example : echo "word" | myProgram.exe?</p>
| [
{
"answer_id": 199534,
"author": "Matthew Scharley",
"author_id": 15537,
"author_profile": "https://Stackoverflow.com/users/15537",
"pm_score": 7,
"selected": true,
"text": "Console.Read()"
},
{
"answer_id": 2151545,
"author": "Alex N",
"author_id": 207445,
"author_pr... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13913/"
] |
199,564 | <p>My professor wrote this shell script to time my program, and display the results. For some reason it just outputs 0s with my program. He provided the following files:</p>
<pre><code>timeit.csh
sequence
ecoli2500.txt
ecoli3000.txt
ecoli5000.txt
ecoli7000.txt
ecoli8000.txt
ecoli9000.txt
ecoli10000.txt
</code></pre>
<p>Here are the contents of sequence</p>
<pre><code>java EditDistance
</code></pre>
<p>The contents of timeit.csh are further below.</p>
<p>java EditDistance < ecoli2500.txt works as expected</p>
<p>In fact the program executes flawlessly with each of the above files other than sequence.</p>
<p>What I don't understand is why </p>
<pre><code>./timeit.csh sequence
</code></pre>
<p>produces all zeros</p>
<p>Here is timeit.csh... (further below is EditDistance.java):</p>
<pre><code>#!/bin/csh
#
# A Unix script to time programs.
#
# Command line: timeit sequence
# the array of programs from the commandline
set program = $argv[1]
# adjust as needed
set CPULIMIT = 120
limit cpu $CPULIMIT seconds
limit core 0
# input files
set input = ( stx1230.txt \
ecoli2500.txt \
ecoli3000.txt \
ecoli5000.txt \
ecoli7000.txt \
ecoli8000.txt \
ecoli9000.txt \
ecoli10000.txt)
# adjust as needed
set inputpath = `pwd`
# print header
printf "CPU limit = %d seconds\n\n" $CPULIMIT
printf "%-25s" "Data File"
foreach program ($argv)
printf "%16s" $program
end
printf "\n"
# print right number of = for table
@ i = 25 + 16 * $#argv
while ($i > 0)
printf "="
@ i = $i - 1
end
printf "\n"
# time it and print out row for each data file and column for each program
foreach datafile ($input)
printf "%-25s" $datafile
if (-f $inputpath/$datafile) then
foreach program ($argv)
# printing running time of program on datafile
# -p flag with time to ensure its output is measured in seconds and not minutes
nice /usr/bin/time -p $program < \
$inputpath/$datafile |& \
egrep '^user[ ]*[0-9]' | \
awk '{ if ($2 >= '$CPULIMIT') printf " CPU limit"; else printf("%16.2f", $2) }'
# egrep, awk commands extract second column of row corresponding to user time
end
else printf "could not open" $datafile
endif
printf "\n"
end
</code></pre>
<p>Here is EditDistance.java</p>
<pre><code>import java.util.*;
class EditDistance {
public static int min(int a, int b, int c) {
return Math.min(a,Math.min(b,c));
}
public static int distance(String one, String two) {
if (one.length()>two.length()) {
String temp1 = one;
String temp2 = two;
one = temp2;
two = temp1;
}
int[][] d = new int[one.length()+1][two.length()+1];
d[0][0] = 0;
int top, left, topleft, cost;
for (int i = 1; i <= one.length(); i++) {
d[0][i] = 2*i;
d[i][0] = 2*i;
}
for (int i = 1; i <= one.length(); i++) {
for (int j = 1; j <= two.length(); j++) {
if (one.charAt(i-1) == two.charAt(j-1))
cost = 0;
else
cost = 1;
top = d[i][j-1];
left = d[i-1][j];
topleft = d[i-1][j-1];
d[i][j] = min(top+2,left+2,topleft+cost);
}
}
return d[one.length()][two.length()];
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String one = scanner.next();
String two = scanner.next();
System.out.println(distance(one,two));
}
}
</code></pre>
<p>Any Ideas why things aren't working? I don't know much about shell scripts, but this section of the shell script:</p>
<pre><code>nice /usr/bin/time -p $program < \
$inputpath/$datafile |& \
egrep '^user[ ]*[0-9]' | \
awk '{ if ($2 >= '$CPULIMIT') printf " CPU limit"; else printf("%16.2f", $2) }'
</code></pre>
<p>confirms in my mind that my program should be expecting this command: </p>
<pre><code>java EditDistance < ecoli2500.txt
java EditDistance...etc. etc.
</code></pre>
<p>but the program works with those commands. I need to set up my program to respond correctly to the shell script. Maybe some of you can help. </p>
| [
{
"answer_id": 202628,
"author": "objectivesea",
"author_id": 27763,
"author_profile": "https://Stackoverflow.com/users/27763",
"pm_score": 1,
"selected": false,
"text": " nice /usr/bin/time -p $program < \n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/199564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
199,597 | <p>I have a table ("venues") that stores all the possible venues a volunteer can work, each volunteer is assigned to work one venue each.</p>
<p>I want to create a select drop down from the venues table.</p>
<p>Right now I can display the venue each volunteer is assigned, but I want it to display the drop down box, with the venue already selected in the list.</p>
<pre><code><form action="upd.php?id=7">
<select name="venue_id">
<?php //some sort of loop goes here
print '<option value="'.$row['venue_id'].'">'.$row['venue_name'].'</option>';
//end loop here ?>
</select>
<input type="submit" value="submit" name="submit">
</form>
</code></pre>
<p>For example, volunteer with the id of 7, is assigned to venue_id 4</p>
<pre><code><form action="upd.php?id=7">
<select name="venue_id">
<option value="1">Bagpipe Competition</option>
<option value="2">Band Assistance</option>
<option value="3">Beer/Wine Pouring</option>
<option value="4" selected>Brochure Distribution</option>
<option value="5">Childrens Area</option>
<option value="6">Cleanup</option>
<option value="7">Cultural Center Display</option>
<option value="8">Festival Merch</option>
</select>
<input type="submit" value="submit" name="submit">
</form>
Brochure Distribution option will already be selected when it displays the drop down list, because in the volunteers_2009 table, column venue_id is 4.
</code></pre>
<p>I know it will take a form of a for or while loop to pull the list of venues from the venues table</p>
<p>My query is:</p>
<pre><code>$query = "SELECT volunteers_2009.id, volunteers_2009.comments, volunteers_2009.choice1, volunteers_2009.choice2, volunteers_2009.choice3, volunteers_2009.lname, volunteers_2009.fname, volunteers_2009.venue_id, venues.venue_name FROM volunteers_2009 AS volunteers_2009 LEFT OUTER JOIN venues ON (volunteers_2009.venue_id = venues.id) ORDER by $order $sort";
</code></pre>
<p>How do I populate the select drop down box with the venues (<strong>volunteers_2009.venue_id</strong>, <strong>venues.id</strong>) from the venues table and have it pre-select the venue in the list?</p>
| [
{
"answer_id": 199614,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 5,
"selected": true,
"text": "$query = \"SELECT volunteers_2009.id, volunteers_2009.comments, volunteers_2009.choice1, volunteers_2009.choice2, volunteers_20... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26130/"
] |
199,603 | <p>I want to be able to write a lambda/Proc in my Ruby code, serialize it so that I can write it to disk, and then execute the lambda later. Sort of like...</p>
<pre><code>x = 40
f = lambda { |y| x + y }
save_for_later(f)
</code></pre>
<p>Later, in a separate run of the Ruby interpreter, I want to be able to say...</p>
<pre><code>f = load_from_before
z = f.call(2)
z.should == 42
</code></pre>
<p>Marshal.dump does not work for Procs. I know Perl has <a href="http://search.cpan.org/~yves/Data-Dump-Streamer-2.08-40/lib/Data/Dump/Streamer.pm" rel="nofollow noreferrer">Data::Dump::Streamer</a>, and in Lisp this is trivial. But is there a way to do it in Ruby? In other words, what would be the implementation of <code>save<code>_</code>for<code>_</code>later</code>?</p>
<p><strong>Edit</strong>: <a href="https://stackoverflow.com/questions/199603/how-do-you-stringize-serialize-ruby-code/199803#199803">My answer below</a> is nice, but it does not close over free variables (like <code>x</code>) and serialize them along with the lambda. So in my example ...</p>
<pre><code>x = 40
s = save_for_later { |y| x + y }
# => "lambda { |y|\n (x + y)\n}"
</code></pre>
<p>... the string output does not include a definition for <code>x</code>. Is there a solution that takes this into account, perhaps by serializing the symbol table? Can you access that in Ruby?</p>
<p><strong>Edit 2</strong>: I updated my answer to incorporate serializing local variables. This seems acceptable.</p>
| [
{
"answer_id": 199803,
"author": "Jonathan Tran",
"author_id": 12887,
"author_profile": "https://Stackoverflow.com/users/12887",
"pm_score": 5,
"selected": true,
"text": "def save_for_later(&block)\n return nil unless block_given?\n\n c = Class.new\n c.class_eval do\n define_method... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12887/"
] |
199,606 | <p>C++ is mostly a superset of C, but not always. In particular, while enumeration values in both C and C++ implicitly convert into int, the reverse isn't true: only in C do ints convert back into enumeration values. Thus, bitflags defined via enumeration declarations don't work correctly. Hence, this is OK in C, but not in C++:</p>
<pre><code>typedef enum Foo
{
Foo_First = 1<<0,
Foo_Second = 1<<1,
} Foo;
int main(void)
{
Foo x = Foo_First | Foo_Second; // error in C++
return 0;
}
</code></pre>
<p>How should this problem be handled efficiently and correctly, ideally without harming the debugger-friendly nature of using Foo as the variable type (it decomposes into the component bitflags in watches etc.)?</p>
<p>Consider also that there may be hundreds of such flag enumerations, and many thousands of use-points. Ideally some kind of efficient operator overloading would do the trick, but it really ought to be efficient; the application I have in mind is compute-bound and has a reputation of being fast.</p>
<p>Clarification: I'm translating a large (>300K) C program into C++, so I'm looking for an efficient translation in both run-time and developer-time. Simply inserting casts in all the appropriate locations could take weeks.</p>
| [
{
"answer_id": 199618,
"author": "Ferruccio",
"author_id": 4086,
"author_profile": "https://Stackoverflow.com/users/4086",
"pm_score": 4,
"selected": true,
"text": "Foo x = Foo(Foo_First | Foo_Second);\n"
},
{
"answer_id": 199619,
"author": "ejgottl",
"author_id": 9808,
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199606",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3712/"
] |
199,612 | <p>So far I've figured out how to pass Unicode strings, bSTRs, to and from a Euphoria DLL using a Typelib. What I can't figure out, thus far, is how to create and pass back an array of BSTRs.</p>
<p>The code I have thus far (along with <code>include</code>s for EuCOM itself and parts of Win32lib):</p>
<pre><code>global function REALARR()
sequence seq
atom psa
atom var
seq = { "cat","cow","wolverine" }
psa = create_safearray( seq, VT_BSTR )
make_variant( var, VT_ARRAY + VT_BSTR, psa )
return var
end function
</code></pre>
<p>Part of the typelib is:</p>
<pre><code> [
helpstring("get an array of strings"),
entry("REALARR")
]
void __stdcall REALARR( [out,retval] VARIANT* res );
</code></pre>
<p>And the test code, in VB6 is:</p>
<pre><code>...
Dim v() as String
V = REALARR()
...
</code></pre>
<p>So far all I've managed to get is an error '0' from the DLL. Any ideas? Anyone?</p>
| [
{
"answer_id": 211288,
"author": "bugmagnet",
"author_id": 426,
"author_profile": "https://Stackoverflow.com/users/426",
"pm_score": 0,
"selected": false,
"text": "global function REALARR() \n atom psa \n atom var \n atom bounds_ptr \n atom dim \n atom bstr \n object void \n\n dim... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/426/"
] |
199,624 | <p>What is the best method of performing an scp transfer via the Java programming language? It seems I may be able to perform this via JSSE, JSch or the bouncy castle java libraries. None of these solutions seem to have an easy answer.</p>
| [
{
"answer_id": 14034420,
"author": "Will",
"author_id": 557117,
"author_profile": "https://Stackoverflow.com/users/557117",
"pm_score": 3,
"selected": false,
"text": "// create secure context\nSecureContext context = new SecureContext(\"userName\", \"localhost\");\n\n// set optional secu... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4229/"
] |
199,627 | <p>How would you go about converting a reasonably large (>300K), fairly mature C codebase to C++?</p>
<p>The kind of C I have in mind is split into files roughly corresponding to modules (i.e. less granular than a typical OO class-based decomposition), using internal linkage in lieu private functions and data, and external linkage for public functions and data. Global variables are used extensively for communication between the modules. There is a very extensive integration test suite available, but no unit (i.e. module) level tests.</p>
<p>I have in mind a general strategy:</p>
<ol>
<li>Compile everything in C++'s C subset and get that working.</li>
<li>Convert modules into huge classes, so that all the cross-references are scoped by a class name, but leaving all functions and data as static members, and get that working.</li>
<li>Convert huge classes into instances with appropriate constructors and initialized cross-references; replace static member accesses with indirect accesses as appropriate; and get that working.</li>
<li>Now, approach the project as an ill-factored OO application, and write unit tests where dependencies are tractable, and decompose into separate classes where they are not; the goal here would be to move from one working program to another at each transformation.</li>
</ol>
<p>Obviously, this would be quite a bit of work. Are there any case studies / war stories out there on this kind of translation? Alternative strategies? Other useful advice?</p>
<p>Note 1: the program is a compiler, and probably millions of other programs rely on its behaviour not changing, so wholesale rewriting is pretty much not an option.</p>
<p>Note 2: the source is nearly 20 years old, and has perhaps 30% code churn (lines modified + added / previous total lines) per year. It is heavily maintained and extended, in other words. Thus, one of the goals would be to increase mantainability.</p>
<p>[For the sake of the question, assume that translation into <strong>C++</strong> is mandatory, and that leaving it in C is <strong>not</strong> an option. The point of adding this condition is to weed out the "leave it in C" answers.]</p>
| [
{
"answer_id": 199911,
"author": "Head Geek",
"author_id": 12193,
"author_profile": "https://Stackoverflow.com/users/12193",
"pm_score": 5,
"selected": true,
"text": "struct"
},
{
"answer_id": 1351659,
"author": "Paul Biggar",
"author_id": 104021,
"author_profile": "h... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199627",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3712/"
] |
199,629 | <p>I am working with an existing code base made up of some COM interfaces written in C++ with a C# front end. There is some new functionality that needs to be added, so I'm having to modify the COM portions. In one particular case, I need to pass an array (allocated from C#) to the component to be filled.</p>
<p>What I would like to do is to be able to pass an array of int to the method from C#, something like:</p>
<pre><code>// desired C# signature
void GetFoo(int bufferSize, int[] buffer);
// desired usage
int[] blah = ...;
GetFoo(blah.Length, blah);
</code></pre>
<p>A couple of wrenches in the works:</p>
<ul>
<li>C++/CLI or Managed C++ can't be used (COM could be done away with in this case).</li>
<li>The C# side can't be compiled with /unsafe (using Marshal is allowed).</li>
</ul>
<p>The COM interface is only used (an will only ever be used) by the C# part, so I'm less concerned with interoperability with other COM consumers. Portability between 32 and 64 bit is also not a concern (everything is being compiled and run from a 32 bit machine, so code generators are converting pointers to integers). Eventually, it will be replaced by just C++/CLI, but that is a ways off.</p>
<hr />
<h2>My initial attempt</h2>
<p>is something similar to:</p>
<pre><code>HRESULT GetFoo([in] int bufferSize, [in, size_is(bufferSize)] int buffer[]);
</code></pre>
<p>And the output TLB definition is (seems reasonable):</p>
<pre><code>HRESULT _stdcall GetFoo([in] int bufferSize, [in] int* buffer);
</code></pre>
<p>Which is imported by C# as (not so reasonable):</p>
<pre><code>void GetFoo(int bufferSize, ref int buffer);
</code></pre>
<p>Which I <em>could</em> use with</p>
<pre><code>int[] b = ...;
fixed(int *bp = &b[0])
{
GetFoo(b.Length, ref *bp);
}
</code></pre>
<p>...except that I can't compile with /unsafe.</p>
<hr />
<h2>At the moment</h2>
<p>I am using:</p>
<pre><code>HRESULT GetFoo([in] int bufferSize, [in] INT_PTR buffer);
</code></pre>
<p>Which imports as:</p>
<pre><code>void GetFoo(int bufferSize, int buffer);
</code></pre>
<p>And I need use use it like:</p>
<pre><code>int[] b = ...;
GCHandle bPin = GCHandle.Alloc(b, GCHandleType.Pinned);
try
{
GetFoo(b.Length, (int)Marshal.UnsafeAddrOfPinnedArrayElement(b, 0));
}
finally
{
bPin.Free();
}
</code></pre>
<p>Which works..., but I'd like to find a cleaner way.</p>
<hr />
<h2>So, the question is</h2>
<p>Is there an IDL definition that is friendly to the C# import from TLB generator for this case? If not, what can be done on the C# side to make it a little safer?</p>
| [
{
"answer_id": 199767,
"author": "Corey Ross",
"author_id": 5927,
"author_profile": "https://Stackoverflow.com/users/5927",
"pm_score": 1,
"selected": true,
"text": "HRESULT GetFoo([in] int bufferSize, [in, size_is(bufferSize)] int buffer[]);\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/199629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5927/"
] |
199,642 | <p>I have a combo box on a WinForms app in which an item may be selected, but it is not mandatory. I therefore need an 'Empty' first item to indicate that no value has been set.</p>
<p>The combo box is bound to a DataTable being returned from a stored procedure (I offer no apologies for Hungarian notation on my UI controls :p ):</p>
<pre><code> DataTable hierarchies = _database.GetAvailableHierarchies(cmbDataDefinition.SelectedValue.ToString()).Copy();//Calls SP
cmbHierarchies.DataSource = hierarchies;
cmbHierarchies.ValueMember = "guid";
cmbHierarchies.DisplayMember = "ObjectLogicalName";
</code></pre>
<p>How can I insert such an empty item?</p>
<p>I do have access to change the SP, but I would really prefer not to 'pollute' it with UI logic.</p>
<p><strong>Update:</strong> It was the DataTable.NewRow() that I had blanked on, thanks. I have upmodded you all (all 3 answers so far anyway). I am trying to get the Iterator pattern working before I decide on an 'answer'</p>
<p><strong>Update:</strong> I think this edit puts me in Community Wiki land, I have decided not to specify a single answer, as they all have merit in context of their domains. Thanks for your collective input.</p>
| [
{
"answer_id": 199695,
"author": "Jason Jackson",
"author_id": 13103,
"author_profile": "https://Stackoverflow.com/users/13103",
"pm_score": 3,
"selected": false,
"text": "DataTable hierarchies = _database.GetAvailableHierarchies(cmbDataDefinition.SelectedValue.ToString()).Copy();//Calls... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5302/"
] |
199,651 | <p>I'm looking for a generic "Row Picker" for JQuery.</p>
<p>We've all seen the cool "Picker" tools like date pickers, color pickers, time pickers, etc, where you click in a text box and a little calendar or color palate or clock or something comes up. You select something (like a date) and the text box is then populated with a value.</p>
<p>I really need an all-purpose "row picker" where you can populate something (a table, divs, etc) with some rows of data (say a list of timezones). This would be linked to a text field and would pop up when the user clicks in the field.</p>
<p>They would click a row (say a timezone), and the timezone id would be passed back to the field.</p>
<p>Anyone know of anything that does this? </p>
<p>Thanks!</p>
| [
{
"answer_id": 199710,
"author": "Duncan",
"author_id": 25035,
"author_profile": "https://Stackoverflow.com/users/25035",
"pm_score": 3,
"selected": true,
"text": "<script type=\"text/javascript\"> $(function() {\n $('table#data_table tr').click(function() {\n alert($... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27580/"
] |
199,661 | <p>I've used bash, csh, and tcsh. But I asked <a href="http://web.archive.org/web/20151121164806/http://stackoverflow.com/questions/198723/whats-in-your-cshrc" rel="nofollow noreferrer">this question</a>, and Jonathan informed me that csh isn't to be trusted. So what Linux shell is good for development. and why?</p>
| [
{
"answer_id": 199835,
"author": "Jonathan Leffler",
"author_id": 15168,
"author_profile": "https://Stackoverflow.com/users/15168",
"pm_score": 4,
"selected": false,
"text": "vim"
},
{
"answer_id": 596823,
"author": "Jon Ericson",
"author_id": 1438,
"author_profile": ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6688/"
] |
199,665 | <p>I have a SOAP client in Ruby that I'm trying to get working with a Ruby SOAP server, to no avail. The client works fine over SSL with a Python SOAP server, but not with the Ruby version. Here's what the server looks like:</p>
<pre><code>require 'soap/rpc/standaloneServer'
require 'soap/rpc/driver'
require 'rubygems'
require 'httpclient'
def cert(filename)
OpenSSL::X509::Certificate.new(File.open("path to cert.cert") { |f|
f.read
})
end
def key(filename)
OpenSSL::PKey::RSA.new(File.open("path to rsaprivate.key") { |f|
f.read
})
end
class Server < SOAP::RPC::HTTPServer
~code snipped for readability~
end
server = Server.new(:BindAddress => HelperFunctions.local_ip, :Port => 1234, :SSLCertificate => cert("path to cert"), :SSLPrivateKey => key("path to rsa private key"))
new_thread = Thread.new { server.start }
</code></pre>
<p>I've trimmed some of the code out for readability's sake (e.g., I have some methods in there I expose) and it works fine with SSL off. But when the client tries to connect, it sees this:</p>
<pre><code>warning: peer certificate won't be verified in this SSL session
/usr/lib/ruby/1.8/net/http.rb:567: warning: using default DH parameters.
/usr/lib/ruby/1.8/net/http.rb:586:in `connect': unknown protocol (OpenSSL::SSL::SSLError)
</code></pre>
<p>I tried taking some advice from <a href="https://stackoverflow.com/questions/128660/how-can-i-make-rubys-soaprpcdriver-work-with-self-signed-certificates">this post</a> and now I see this message:</p>
<pre><code>/usr/lib/ruby/1.8/soap/httpconfigloader.rb:64:in `set_ssl_config': SSL not supported (NotImplementedError)
</code></pre>
<p>Any ideas on how to fix this would be greatly appreciated.</p>
| [
{
"answer_id": 199817,
"author": "Chris Bunch",
"author_id": 422,
"author_profile": "https://Stackoverflow.com/users/422",
"pm_score": 3,
"selected": true,
"text": "require 'webrick/https'\n"
},
{
"answer_id": 765311,
"author": "Community",
"author_id": -1,
"author_pr... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/422/"
] |
199,677 | <p>I am trying to help someone write a program that I thought would be easy, but of course it never is :)</p>
<p>I am trying to take a class roster (usually between 10-20 students) and effectivly uniquely pair off each classmate to another to make unique groups. Therefore in a class of 10 people, you can have 9 groups.</p>
<p>It needs to be able to handle odd number of students too, adding to my confusion.</p>
<p>I was looking at doing this in Java, but that is flexible. Any ideas on an algorithmic way to guarantee a)not infinite looping (ending with 2 people who have already been partners) and b) I am aiming for more efficent time than space, since class size will be small!</p>
<p>Thanks!</p>
| [
{
"answer_id": 199894,
"author": "Moishe Lettvin",
"author_id": 23786,
"author_profile": "https://Stackoverflow.com/users/23786",
"pm_score": 1,
"selected": false,
"text": "// create all the edges\nfor i := 1 to number_of_students - 1\n for j := i + 1 to number_of_students\n edges.ad... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
199,687 | <p>At the moment I use the <a href="http://msdn.microsoft.com/en-us/library/ms646310.aspx" rel="nofollow noreferrer"><code>SendInput()</code></a> function but if you install a low level mouse hook the <code>LLMHF_INJECTED</code> is set indicating that the input was injected into the stream. Is there a way of sending mouse and keyboard input so that <code>LLMHF_INJECTED</code> is not set?</p>
| [
{
"answer_id": 199894,
"author": "Moishe Lettvin",
"author_id": 23786,
"author_profile": "https://Stackoverflow.com/users/23786",
"pm_score": 1,
"selected": false,
"text": "// create all the edges\nfor i := 1 to number_of_students - 1\n for j := i + 1 to number_of_students\n edges.ad... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
199,692 | <p>I have only a basic knowledge of css, is it possible to inherit a property from one style into another style. So for instance I could inherit the font size specified in my default paragrah tag settings into my hyperlink tags.</p>
<p>The reason I want to do this is to make it easier to maintain multiple styles.</p>
| [
{
"answer_id": 199714,
"author": "leek",
"author_id": 3765,
"author_profile": "https://Stackoverflow.com/users/3765",
"pm_score": 4,
"selected": true,
"text": "p, a {\n font-size: 1em;\n}\n"
},
{
"answer_id": 199719,
"author": "timmfin",
"author_id": 27488,
"author... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16989/"
] |
199,718 | <p>Since Object Initializers are very similar to JSON, and now there are Anonymous Types in .NET. It would be cool to be able to take a string, such as JSON, and create an Anonymous Object that represents the JSON string.</p>
<p>Use Object Initializers to create an Anonymous Type:</p>
<pre><code>var person = new {
FirstName = "Chris",
LastName = "Johnson"
};
</code></pre>
<p>It would be awesome if you could pass in a string representation of the Object Initializer code (preferably something like JSON) to create an instance of an Anonymous Type with that data.</p>
<p>I don't know if it's possible, since C# isn't dynamic, and the compiler actually converts the Object Initializer an<a href="http://www.developer.com/net/csharp/article.php/3589916" rel="noreferrer">d Anonymous Type into strongly typed code that can run. This is explained in</a> this article.</p>
<p>Maybe functionality to take JSON and create a key/value Dictionary with it would work best.</p>
<p>I know you can serialize/deserializer an object to JSON in .NET, but what I'm look for is a way to create an object that is essentially loosely typed, similarly to how JavaScript works.</p>
<p>Does anyone know the best solution for doing this in .NET?</p>
<p>UPDATE: Too clarify the context of why I'm asking this... I was thinking of how C# could better support JSON at the language level (possibly) and I was trying to think of ways that it could be done today, for conceptual reasons. So, I thought I'd post it here to start a discussion.</p>
| [
{
"answer_id": 199797,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 4,
"selected": true,
"text": " T deserialize<T>(string jsonStr, T obj) { /* ... */}\n\n var jsonString = \"{FirstName='Chris', LastName='Johnson, Other... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7831/"
] |
199,723 | <p>I found a wonderful open source Java program that I'm translating into C#. The built-in translator in Visual Studio got me started and I've now spent about a month translating the rest manually line by line. I've completed over 15,000 lines of translation and the only thing that remains is trying to figure out how to convert their MemoryImageSource stuff into C#/.NET.</p>
<p>What's the .NET equivalent way of implementing this stuff? Is there a native .NET library already?</p>
| [
{
"answer_id": 199750,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 3,
"selected": true,
"text": "System.Drawing."
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/199723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/356/"
] |
199,728 | <p>How do I set gc.reflogExpire so that items will never expire?<br>
What other time interval formats does it accept?</p>
<p>The man page says that you can set it to "90 days or 3 months," but doesn't specify what format it expects.</p>
| [
{
"answer_id": 199927,
"author": "Aristotle Pagaltzis",
"author_id": 9410,
"author_profile": "https://Stackoverflow.com/users/9410",
"pm_score": 3,
"selected": false,
"text": "git reflog"
},
{
"answer_id": 202947,
"author": "CB Bailey",
"author_id": 19563,
"author_pro... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4883/"
] |
199,731 | <p>How do you track outbound links for your web site, since the request is logged on the destination server, not yours? </p>
| [
{
"answer_id": 33357842,
"author": "Justin Tanner",
"author_id": 609,
"author_profile": "https://Stackoverflow.com/users/609",
"pm_score": 2,
"selected": false,
"text": "target=\"_blank\""
},
{
"answer_id": 73474345,
"author": "Steffen Wenzel",
"author_id": 204558,
"a... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8161/"
] |
199,747 | <p>Is there a standard way to see how much stack space your app has and what the highest watermark for stack usage is during a run?</p>
<p>Also in the dreaded case of actual overflow what happens? </p>
<p>Does it crash, trigger an exception or signal? Is there a standard or is it different on all systems and compilers?</p>
<p>I'm looking specifically for Windows, Linux and Macintosh. </p>
| [
{
"answer_id": 199809,
"author": "jussij",
"author_id": 14738,
"author_profile": "https://Stackoverflow.com/users/14738",
"pm_score": 4,
"selected": false,
"text": "#include <stdio.h>\n#include <windows.h>\n\nvoid StackOverFlow()\n{\n CONTEXT context;\n\n // we are interested control r... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13676/"
] |
199,761 | <p><sup><strong>Note:</strong> This question was asked at a time when C# did not yet support optional parameters (i.e. before C# 4).</sup></p>
<p>We're building a web API that's programmatically generated from a C# class. The class has method <code>GetFooBar(int a, int b)</code> and the API has a method <code>GetFooBar</code> taking query params like <code>&a=foo &b=bar</code>. </p>
<p>The classes needs to support optional parameters, which isn't supported in C# the language. What's the best approach?</p>
| [
{
"answer_id": 199765,
"author": "Kalid",
"author_id": 109,
"author_profile": "https://Stackoverflow.com/users/109",
"pm_score": 6,
"selected": false,
"text": "using System.Runtime.InteropServices;\npublic void Foo(int a, int b, [Optional] int c)\n{\n ...\n}\n"
},
{
"answer_id":... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109/"
] |
199,769 | <p>I'm on a Hardy Heron Ubuntu build, BTW.</p>
| [
{
"answer_id": 201055,
"author": "pk.",
"author_id": 10615,
"author_profile": "https://Stackoverflow.com/users/10615",
"pm_score": 1,
"selected": false,
"text": "Enable the use of the mouse. Only works for certain terminals\n(xterm, MS-DOS, Win32 |win32-mouse|, qnx pterm, and Linux cons... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20273/"
] |
199,774 | <p>I'm trying to get a postgres jdbc connection working in eclipse. It would be nice to use the Data Source Explorer, but for now I'm just trying to get a basic connection. What I have done so far is download the postgres JDBC connector. I then tried two different things. First, Preferences-> Data Management, I tried to add the postgres connector. Second, I added the jar to my project and tried to load the driver using Class.forName("org.postgresql.Driver"); but neither worked. Does anyone have any ideas?</p>
<p>Thanks,
Charlie</p>
| [
{
"answer_id": 211512,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": -1,
"selected": false,
"text": "org.postgresql.ds.PGSimpleDataSource"
},
{
"answer_id": 214750,
"author": "eflles",
"author_id": 26567,
"... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27689/"
] |
199,792 | <p>I can no longer use / at the windows xp command prompt, and it seems to have started after a botched cygwin installation, e.g. cd /windows won't work, but used to.</p>
<p>Can anyone think of how this might have happened?</p>
<p><strong>OOPS! It doesn't normally work in XP</strong>, though I had read that it does in Vista. I simplified my problem and it was wrong. <strong>The real problem is:</strong></p>
<p>I was using the cwrsync binaries (meant for cygwin use) that can be used at the command prompt in a way such as: </p>
<blockquote>
<p>ssh -i /keydir/keyfile user@server</p>
</blockquote>
<p>but after doing something (seems like it was installing cygwin), and even after reinstalling the cwrsync files, I can now only do:</p>
<blockquote>
<p>ssh -i \keydir\keyfile user@server, i.e. I have to use the windows convention when referring to local files.</p>
</blockquote>
<p>I posted this on the cwrsync forum, but it's not very active, so I was hoping someone might recognize what's going on here, I should maybe try the cygwin forum too.</p>
| [
{
"answer_id": 200075,
"author": "Hugh Allen",
"author_id": 15069,
"author_profile": "https://Stackoverflow.com/users/15069",
"pm_score": 1,
"selected": false,
"text": "C:\\"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/199792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23119/"
] |
199,823 | <p>I am looking out for some good practices on naming assemblies and versioning them. How often do you increment the major or minor versions?</p>
<p>In some cases, I have seen releases going straight from version 1.0 to 3.0. In other cases, it seems to be stuck at version 1.0.2.xxxx.</p>
<p>This will be for a shared assembly used in multiple projects across the company. Looking forward to some good inputs.</p>
| [
{
"answer_id": 199844,
"author": "Scott Dorman",
"author_id": 1559,
"author_profile": "https://Stackoverflow.com/users/1559",
"pm_score": 3,
"selected": false,
"text": "CompanyName.Framework.Core \n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/199823",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4337/"
] |
199,832 | <p>Is there a way I can control columns from code. </p>
<p>I had a drop drop box with select : Daily and weekend and the gridview column with Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,sunday.
If the user selects Daily i want to show columns only from Monday to Friday.</p>
<p>It is possible to control from the code. Oh i am using this griview in my webpage and coding in done using C#. </p>
<p>help!</p>
| [
{
"answer_id": 199946,
"author": "Pavel Chuchuva",
"author_id": 14131,
"author_profile": "https://Stackoverflow.com/users/14131",
"pm_score": 4,
"selected": true,
"text": "GridView1.Columns[5].Visible = false\nGridView1.Columns[6].Visible = false\n"
},
{
"answer_id": 199956,
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14752/"
] |
199,847 | <p>I have the following fields:</p>
<ul>
<li>Inventory control (16 byte record)
<ul>
<li>Product ID code (int – 4 bytes)</li>
<li>Quantity in stock (int – 4 bytes)</li>
<li>Price (double – 8 bytes)</li>
</ul></li>
</ul>
<p>How do I create a fixed length random access file using the above lengths? I tried some examples online, but I either get an EOF exception or random address values when I try to access them.</p>
<p>I tried some more examples and couldn't understand the concept very well. I'm trying a project with it and will try to explore more on it.</p>
<p>Here is some example data. There might be holes in the data where <code>No. in stock</code> could be <code>23 == 023</code>.</p>
<pre><code> Quantity
ID. No. In Stock Price
------- -------- ------
1001 476 $28.35
1002 240 $32.56
1003 517 $51.27
1004 284 $23.75
1005 165 $32.25
</code></pre>
<p>Thanks for the help.</p>
| [
{
"answer_id": 199954,
"author": "Aaron Maenpaa",
"author_id": 2603,
"author_profile": "https://Stackoverflow.com/users/2603",
"pm_score": 4,
"selected": true,
"text": "package test;\n\nimport java.io.IOException;\nimport java.io.RandomAccessFile;\n\npublic class Raf {\n private stati... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21968/"
] |
199,866 | <p>I am just starting out with Silverlight (2 RC0) and can’t seem to get the following to work. I want to create a simple image button user control.</p>
<p>My xaml for the user control is as follows:</p>
<pre><code> <Button>
<Button.Template>
<ControlTemplate>
<Image Source="{TemplateBinding ImageSource}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" />
</ControlTemplate>
</Button.Template>
</Button>
</code></pre>
<p>The code behind is as follows:</p>
<pre><code>public partial class ImageButtonUserControl : UserControl
{
public ImageButtonUserControl()
{
InitializeComponent();
}
public Image Source
{
get { return base.GetValue(SourceProperty) as Image; }
set { base.SetValue(SourceProperty, value); }
}
public static readonly DependencyProperty SourceProperty =
DependencyProperty.Register("SourceProperty", typeof(Image), typeof(ImageButtonUserControl),null);
}
</code></pre>
<p>I want to be able to dynamically create the ImageButtons and stuff them in a container like a WrapPanel:
Assume we have an image named “image” already:</p>
<pre><code>ImageButtonUserControl imageButton = new ImageButtonUserControl();
imageButton.Source = image;
this.thumbnailStackPanel.Children.Add(imageButton);
</code></pre>
<p>What do I need to do to get the image to display? I'm assuming I need to do something with DataContext, but I'm not quite sure what or where.</p>
<p>Thanks for any help</p>
| [
{
"answer_id": 200013,
"author": "Jobi Joy",
"author_id": 8091,
"author_profile": "https://Stackoverflow.com/users/8091",
"pm_score": 4,
"selected": true,
"text": " <ControlTemplate x:Key=\"btn_template\"> \n <Image Source=\"{TemplateBinding Content}\" /> \n </ControlTemplate... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67719/"
] |
199,876 | <p>Is there a way to change the color of the background for a MDIParent windows in MFC (2005)?</p>
<p>I have tried intercepting ON_WM_CTLCOLOR AND ON_WM_ERASEBKGND but neither work. OnEraseBkgnd does work, but then it gets overwritten by the standard WM_CTL color.</p>
<p>Cheers</p>
| [
{
"answer_id": 200780,
"author": "Aidan Ryan",
"author_id": 1042,
"author_profile": "https://Stackoverflow.com/users/1042",
"pm_score": 2,
"selected": false,
"text": "afx_msg BOOL OnEraseBkgnd(CDC* pDC);\nafx_msg void OnPaint(void);\nafx_msg void OnSize(UINT nType, int cx, int cy);\n"
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1075/"
] |
199,879 | <p>I have a div that contains several child elements, one of which is a flash movie.</p>
<p>When rolling over this div, I want it to change style to indicate it is rolled over. My problem is that the <code>mouseover</code> and <code>mouseout</code> events don't always trigger, especially if the user moves the mouse over the flash element too quickly.</p>
<p>Any suggestions for how I can ensure that a <code>mouseover</code> event always get triggered.</p>
<p>I can't add an event to the flash movie itself because it is proprietary code that I don't have the source for.</p>
<p>Also I can't cover the flash movie in a div/image because I need rollover and click events to occur within the flash itself.</p>
| [
{
"answer_id": 200026,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 1,
"selected": false,
"text": "onmouseover"
},
{
"answer_id": 223568,
"author": "Claudio",
"author_id": 30122,
"author_profile": "https:/... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20851/"
] |
199,889 | <p>I'm trying to do a domain lookup in vba with something like this:</p>
<pre><code>DLookup("island", "villages", "village = '" & txtVillage & "'")
</code></pre>
<p>This works fine until txtVillage is something like Dillon's Bay, when the apostrophe is taken to be a single quote, and I get a run-time error.</p>
<p>I've written a trivial function that escapes single quotes - it replaces "'" with "''". This seems to be something that comes up fairly often, but I can't find any reference to a built-in function that does the same. Have I missed something?</p>
| [
{
"answer_id": 199900,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": false,
"text": "'); DROP TABLE [YourTable]\n"
},
{
"answer_id": 199904,
"author": "inglesp",
"author_id": 10439,
"... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10439/"
] |
199,896 | <p>As the title: How would I tell NHibernate, once and for all, that all table and column names are to be quoted in the SQL it generates?</p>
| [
{
"answer_id": 2883057,
"author": "pvasek",
"author_id": 1185225,
"author_profile": "https://Stackoverflow.com/users/1185225",
"pm_score": 2,
"selected": false,
"text": "<property name=\"hbm2ddl.keywords\">auto-quote</property>\n"
},
{
"answer_id": 6339548,
"author": "Newbie"... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12349/"
] |
199,905 | <p>Is it possible to add comments somehow, somewhere? </p>
<p>I don't pretend to be any sort of expert when using MySQL and certainly don't spend all day in it. More often than I would like I forget how I intend to use a column (usally the bit ones) and would be very excited if I could add a comment to remind me if 1 is good or bad, for example. </p>
<p>I'd be happy if it only showed up in something like 'show create table', but any obscure place within the table structures would be better and easier to find than the current post-it notes on my desk.</p>
| [
{
"answer_id": 199920,
"author": "micahwittman",
"author_id": 11181,
"author_profile": "https://Stackoverflow.com/users/11181",
"pm_score": 5,
"selected": false,
"text": "table_option:\n {ENGINE|TYPE} [=] engine_name\n | AUTO_INCREMENT [=] value\n | AVG_ROW_LENGTH [=] value\n | [DE... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1444/"
] |
199,918 | <p>I have been trying to explain the difference between switch statements and pattern matching(F#) to a couple of people but I haven't really been able to explain it well..most of the time they just look at me and say "so why don't you just use if..then..else".</p>
<p>How would you explain it to them? </p>
<p>EDIT! Thanks everyone for the great answers, I really wish I could mark multiple right answers. </p>
| [
{
"answer_id": 200277,
"author": "Bruno De Fraine",
"author_id": 6918,
"author_profile": "https://Stackoverflow.com/users/6918",
"pm_score": 5,
"selected": false,
"text": "type expr =\n | Int of int\n | Var of string\n | Add of expr * expr\n | Mul of expr * expr;;\n\nlet rec ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6335/"
] |
199,936 | <p>I am currently trying to program my first ajax interface using Rails.</p>
<p>The application currently shows a table populated with list items. The user has to approve or reject each of the list items. I currently have an edit link at the end of each row that shows a form in which I can approve the list item.</p>
<p>I am thinking on using a checkbox instead of the edit link. When the user clicks the checkbox I want to update the database with the status, user name and date/time without leaving this page.</p>
<ol>
<li>What steps should I follow? </li>
<li>Can I use a checkbox or am I
restricted to buttons?</li>
<li>What xxx_remote helper should I use?</li>
<li>How can I update the checkbox state with the results of the ajax call?</li>
</ol>
| [
{
"answer_id": 200071,
"author": "Andrew",
"author_id": 17408,
"author_profile": "https://Stackoverflow.com/users/17408",
"pm_score": 4,
"selected": true,
"text": "...\n<tr id=\"item1\">\n <td>Accept or Reject</td>\n <td>\n link_to_remote 'accept', :action => :accept, :id => 1, :met... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14755/"
] |
199,953 | <p>I have 2 tables. One (domains) has domain ids, and domain names (dom_id, dom_url).</p>
<p>the other contains actual data, 2 of which columns require a TO and FROM domain names. So I have 2 columns rev_dom_from and rev_dom_for, both of which store the domain name id, from the domains table.</p>
<p>Simple.</p>
<p>Now I need to actually display both domain names on the webpage. I know how to display one or the other, via the LEFT JOIN domains ON reviews.rev_dom_for = domains.dom_url query, and then you echo out the dom_url, which would echo out the domain name in the rev_dom_for column.</p>
<p>But how would I make it echo out the 2nd domain name, in the dom_rev_from column?</p>
| [
{
"answer_id": 199958,
"author": "Stephen Wrighton",
"author_id": 7516,
"author_profile": "https://Stackoverflow.com/users/7516",
"pm_score": 8,
"selected": true,
"text": "SELECT toD.dom_url AS ToURL, \n fromD.dom_url AS FromUrl, \n rvw.*\n\nFROM reviews AS rvw\n\nLEFT JOIN domain ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
199,959 | <p>In C# there is a method <code>SetApartmentState</code> in the class <code>Thread</code>.
How do I do the same thing in C++?</p>
| [
{
"answer_id": 200034,
"author": "Shog9",
"author_id": 811,
"author_profile": "https://Stackoverflow.com/users/811",
"pm_score": 4,
"selected": true,
"text": "CoInitializeEx()"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/199959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11238/"
] |
199,961 | <p>How can I find out the folder where the windows service .exe file is installed dynamically?</p>
<pre><code>Path.GetFullPath(relativePath);
</code></pre>
<p>returns a path based on <code>C:\WINDOWS\system32</code> directory.</p>
<p>However, the <code>XmlDocument.Load(string filename)</code> method appears to be working against relative path inside the directory where the service .exe file is installed to.</p>
| [
{
"answer_id": 199976,
"author": "Greg Dean",
"author_id": 1200558,
"author_profile": "https://Stackoverflow.com/users/1200558",
"pm_score": 7,
"selected": true,
"text": "System.Reflection.Assembly.GetEntryAssembly().Location\n"
},
{
"answer_id": 199991,
"author": "TheSoftwar... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/437435/"
] |
199,966 | <p>The <code>gcc -S</code> option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two?</p>
| [
{
"answer_id": 200028,
"author": "Jason Dagit",
"author_id": 5113,
"author_profile": "https://Stackoverflow.com/users/5113",
"pm_score": 9,
"selected": true,
"text": "-masm=intel"
},
{
"answer_id": 5638826,
"author": "phoxis",
"author_id": 702361,
"author_profile": "h... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1841/"
] |
200,020 | <p>In many symbolic math systems, such as Matlab or Mathematica, you can use a variable like <code>Ans</code> or <code>%</code> to retrieve the last computed value. Is there a similar facility in the Python shell?</p>
| [
{
"answer_id": 200027,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 9,
"selected": true,
"text": ">>> 5+5\n10\n>>> _\n10\n>>> _ + 5\n15\n>>> _\n15\n"
},
{
"answer_id": 200045,
"author": "Peter Hoffmann",
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23845/"
] |
200,037 | <p>I have developed an installer class which removes certain folders from the base dir.However,I also want to remove the entry of another application from add/remove programs through the inst class.Could anyone suggest the solution.</p>
<p>Regards,
Harsh Suman</p>
| [
{
"answer_id": 18649680,
"author": "Kevin M",
"author_id": 1838481,
"author_profile": "https://Stackoverflow.com/users/1838481",
"pm_score": 1,
"selected": false,
"text": " public static void RemoveControlPanelProgram(string apllicationName)\n {\n string InstallerRegLoc = @\"S... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
200,049 | <p>I want to be able to capture my iPhone's screen as a video, but I'm not sure the best way to do this.</p>
<p>Can anyone help guide me on how to best do this <em>without jailbreak?</em></p>
| [
{
"answer_id": 10104878,
"author": "Balan Prabhu",
"author_id": 1310087,
"author_profile": "https://Stackoverflow.com/users/1310087",
"pm_score": 2,
"selected": false,
"text": " -(void)playvideo\n{\n\n MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContent... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23294/"
] |
200,056 | <p>I have access to an Oracle server that has some databases that I would like to access. However, the machine that I have access from has none of the oracle client software. Is there any alternative to oracle's client software the provides the functionality of something like MySQL's mysql or Postgres' psql? I'd like to be able to poke around a bit in the database before writing software against it.</p>
| [
{
"answer_id": 200069,
"author": "David Webb",
"author_id": 3171,
"author_profile": "https://Stackoverflow.com/users/3171",
"pm_score": 4,
"selected": true,
"text": "sqlplus"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/200056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/85/"
] |
200,066 | <p>In C#, how do I get the name of the drive that the Operating System is installed on?</p>
| [
{
"answer_id": 200068,
"author": "TheSoftwareJedi",
"author_id": 18941,
"author_profile": "https://Stackoverflow.com/users/18941",
"pm_score": 5,
"selected": false,
"text": "Path.GetPathRoot(Environment.SystemDirectory)\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/200066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
200,079 | <p>Given the following inheritance tree, what would be the best way of implementing it in a way that works?</p>
<pre><code>abstract class Foo<T> : IEnumerable<T>
{
public abstract Bar CreateBar();
}
class Bar<T> : Foo<T>
{
// Bar's provide a proxy interface to Foo's and limit access nicely.
// The general public shouldn't be making these though, they have access
// via CreateBar()
protected Bar(Foo base)
{
// snip...
}
}
class Baz<T> : Foo<T>
{
public Bar CreateBar()
{
return new Bar(this);
}
}
</code></pre>
<p>This fails with: <code>'Bar.Bar()' is inaccessible due to its protection level</code>.</p>
<p>I don't want the constructor being public, only classes that inherit from <code>Foo</code> should be able to create <code>Bar</code>s. <code>Bar</code> is a specialised <code>Foo</code>, and any type of <code>Foo</code> should be able to create one. Public internal is an 'option' here, as the majority of the predefined extensions to <code>Foo</code> will be internal to the DLL, but I consider this a sloppy answer, since anyone who comes along later who wants to create their own type of <code>Foo</code> or <code>Baz</code> (which is likely to happen) will be stuck with a default <code>CreateBar()</code> implementation, which may or may not meet their needs.</p>
<p>Perhaps there is a way of refactoring this to make it work nicely? I'm banging my head on the wall trying to design this so it'll work though.</p>
<p><strong>Edit (More info):</strong></p>
<p>Slightly more concrete: Foo is implementing IEnumerable and long story short, Bar is providing the same interface, but to a limited subset of that enumerable object. All Foo's should be able to create subsets of themselves (ie. Bar) and return it. But I don't want to have everyone who ever wants to implement a Foo to have to worry about this, because Bar will do the proxying and worry about limiting the range, etc.</p>
| [
{
"answer_id": 200129,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 1,
"selected": false,
"text": "abstract class Foo<T> : IEnumerable<T>\n{\n public abstract Bar<T> CreateBar();\n\n protected Bar<T> CreateBar(Foo<T> ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200079",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15537/"
] |
200,090 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/194465/how-to-parse-a-string-to-an-int-in-c">How to parse a string to an int in C++?</a> </p>
</blockquote>
<p>How do you convert a C++ string to an int?</p>
<p>Assume you are expecting the string to have actual numbers in it ("1", "345", "38944", for example).</p>
<p>Also, let's assume you don't have boost, and you really want to do it the C++ way, not the crufty old C way.</p>
| [
{
"answer_id": 200095,
"author": "Martin York",
"author_id": 14065,
"author_profile": "https://Stackoverflow.com/users/14065",
"pm_score": 5,
"selected": false,
"text": "std::string plop(\"123\");\nstd::stringstream str(plop);\nint x;\n\nstr >> x;\n\n/* Lets not forget to error che... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27729/"
] |
200,093 | <p>What is the difference between UTF and UCS.</p>
<p>What are the best ways to represent not European character sets (using UTF) in C++ strings. I would like to know your recommendations for:</p>
<ul>
<li>Internal representation inside the code
<ul>
<li>For string manipulation at run-time</li>
<li>For using the string for display purposes.</li>
</ul></li>
<li>Best storage representation (<b>i.e.</b> In file)</li>
<li>Best on wire transport format (Transfer between application that may be on different architectures and have a different standard locale)</li>
</ul>
| [
{
"answer_id": 200102,
"author": "Randy Sugianto 'Yuku'",
"author_id": 11238,
"author_profile": "https://Stackoverflow.com/users/11238",
"pm_score": 0,
"selected": false,
"text": "wchar_t"
},
{
"answer_id": 200103,
"author": "Greg Hewgill",
"author_id": 893,
"author_p... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14065/"
] |
200,106 | <p>Ok so ive got a swing app going using the "System" look and feel. Now, I want to change the background colour of the main panels to black. Too easy right?</p>
<pre><code>UIManager.put("Panel.background", Color.BLACK);
</code></pre>
<p>Well yeah, except now the controls in the app look stupid, because their 'shadows', for want of a better word, are graduated to fade towards the old system default colour(gross windows grey). So there are light grey 'corners' on all the controls, especially the tabs on JTabbedPane.
I know it can be fixed, because if you change the windowsXP theme to one with a different default application colour, the controls take on this changed colour and their shadows 'fade' towards it.</p>
<p>But I have no idea what UIManager key it is, or even if you can do it with UIManger.</p>
<p>I dont really want to change the L&F engine, because apart from this it looks good.</p>
| [
{
"answer_id": 200130,
"author": "RodeoClown",
"author_id": 943,
"author_profile": "https://Stackoverflow.com/users/943",
"pm_score": 1,
"selected": false,
"text": "for (Object key: UIManager.getDefaults().keySet())\n{\n System.out.println(key);\n}\n"
},
{
"answer_id": 210058,... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16925/"
] |
200,140 | <p>In my code, I want to view all data from a CSV in table form, but it only displays the last line. How about lines 1 and 2? Here's the data:</p>
<pre><code>1,HF6,08-Oct-08,34:22:13,df,jhj,fh,fh,ffgh,gh,g,rt,ffgsaf,asdf,dd,yoawa,DWP,tester,Pattern
2,hf35,08-Oct-08,34:12:13,dg,jh,fh,fgh,fgh,gh,gfh,re,fsaf,asdf,dd,yokogawa,DWP,DWP,Pattern
3,hf35,08-Oct-08,31:22:03,dg,jh,fh,fgh,gh,gh,gh,rte,ffgsaf,asdf,dfffd,yokogawa,DWP,DWP,ghh
</code></pre>
<p>Here's the code:</p>
<pre><code>#! /usr/bin/perl
print "Content-type:text/html\r\n\r\n";
use CGI qw(:standard);
use strict;
use warnings;
my $line;
my $file;
my ($f1,$f2,$f3,$f4,$f5,$f6,$f7,$f8,$f9,$f10,$f11,$f12,$f13,$f14,$f15,$f16,$f17,$f18,$f19);
$file='MyFile.txt';
open(F,$file)||die("Could not open $file");
while ($line=<F>)
{
($f1,$f2,$f3,$f4,$f5,$f6,$f7,$f8,$f9,$f10,$f11,$f12,$f13,$f14,$f15,$f16,$f17,$f18,$f19)= split ',',$line;
}
close(F);
print "<HTML>";
print "<head>";
print "<body bgcolor='#4682B4'>";
print "<title>FUSION SHIFT REPORT</title>";
print "<div align='left'>";
print "<TABLE CELLPADDING='1' CELLSPACING='1' BORDER='1' bordercolor=black width='100%'>";
print "<TR>";
print "<td width='12%'bgcolor='#00ff00'><font size='2'>RECORD No.</td>";
print "<td width='12%'bgcolor='#00ff00'><font size='2'>TESTER No.</td>";
print "<td width='12%'bgcolor='#00ff00'><font size='2'>DATE</td>";
print "<td width='13%'bgcolor='#00ff00'><font size='2'>TIME</td>";
print "<td width='11%'bgcolor='#00ff00'><font size='2'>DEVICE NAME</td>";
print "<td bgcolor='#00ff00'><font size='2'>TEST PROGRAM</td>";
print "<td bgcolor='#00ff00'><font size='2'>DEVICE FAMILY</td>";
print "<td width='13%'bgcolor='#00ff00'><font size='2'>SMSLOT</td>";
print "<td width='13%'bgcolor='#00ff00'><font size='2'>DIE LOT</td>";
print "<td width='12%'bgcolor='#00ff00'><font size='2'>LOADBOARD</td>";
print "<td width='12%'bgcolor='#00ff00'><font size='2'>TESTER </td>";
print "<td width='12%'bgcolor='#00ff00'><font size='2'>SERIAL NUMBER</td>";
print "<td width='13%'bgcolor='#00ff00'><font size='2'>TESTER CONFIG</td>";
print "<td width='11%'bgcolor='#00ff00'><font size='2'>SMSLOT</td>";
print "<td bgcolor='#00ff00'><font size='2'>PACKAGE</td>";
print "<td bgcolor='#00ff00'><font size='2'>SOCKET</td>";
print "<td width='13%'bgcolor='#00ff00'><font size='2'>ROOT CAUSE 1</td>";
print "<td width='13%'bgcolor='#00ff00'><font size='2'>ROOT CAUSE 2</td>";
print "<td width='13%'bgcolor='#00ff00'><font size='2'>ROOT CAUSE 3</td>";
print "</tr>";
print "<TR>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f1</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f2</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f3</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f4</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f5</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f6</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f7</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f8</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f9</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f10</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f11</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f12</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f13</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f14</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f15</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f16</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f17</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f18</TD>";
print "<TD bgcolor='#ADD8E6'><font size='2'>$f19</TD>";
print "</tr>";
print "</TABLE>";
print "</body>";
print "<html>";
</code></pre>
| [
{
"answer_id": 200175,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 3,
"selected": false,
"text": "my $f;\nwhile ($line = <F>) {\n $f = $line;\n}\nprint $f;\n"
},
{
"answer_id": 200181,
"author": "Paul Dix... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
200,147 | <p>I'm an absolute n00b into the java platform
I would like to know whether I need to change anything in my code to get the benefits of 64bit JRE ? </p>
<p>or is it something like when I initiate it with "java -d64" its gonna run in some turbo mode?</p>
<p>Your help is highly appreciated</p>
| [
{
"answer_id": 21392637,
"author": "larsolsen",
"author_id": 3242291,
"author_profile": "https://Stackoverflow.com/users/3242291",
"pm_score": 0,
"selected": false,
"text": "public class Benchmark {\npublic static void main(String args[]) {\nlong time = System.currentTimeMillis();\nfor (... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
200,150 | <p>i am using the apache commons httpclient in a lotus notes java agent and it works fine. BUT when establishing a proxy connection the log will be spamed with the following line :</p>
<pre><code>[INFO] AuthChallengeProcessor - basic authentication scheme selected
</code></pre>
<p>Do you know how to disable the integrated loging or how to set a lower debug level ?
Its a "feature" from the httpclient itself, so code from my side is not needed :-)</p>
<p>Thanks.</p>
| [
{
"answer_id": 200269,
"author": "JimmyTudeski",
"author_id": 27181,
"author_profile": "https://Stackoverflow.com/users/27181",
"pm_score": -1,
"selected": false,
"text": "client.getState().setProxyCredentials(\n new AuthScope(conParm.getProxyServer(), conParm.... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27181/"
] |
200,151 | <p>Is it possible to search for an object by one of its properties in a Generic List?</p>
<pre><code>Public Class Customer
Private _id As Integer
Private _name As String
Public Property ID() As Integer
Get
Return _id
End Get
Set
_id = value
End Set
End Property
Public Property Name() As String
Get
Return _name
End Get
Set
_name = value
End Set
End Property
Public Sub New(id As Integer, name As String)
_id = id
_name = name
End Sub
End Class
</code></pre>
<p>Then loading and searching</p>
<pre><code>Dim list as new list(Of Customer)
list.Add(New Customer(1,"A")
list.Add(New Customer(2,"B")
</code></pre>
<p>How can I return customer object with id =1? Does this have to do with the "Predicate" in Generics?</p>
<p>Note: I am doing this in VB.NET.</p>
| [
{
"answer_id": 200161,
"author": "Aleris",
"author_id": 20417,
"author_profile": "https://Stackoverflow.com/users/20417",
"pm_score": 0,
"selected": false,
"text": "Find"
},
{
"answer_id": 200165,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://S... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23667/"
] |
200,162 | <p>The WebBrowser control has a property called "IsWebBrowserContextMenuEnabled" that disables all ability to right-click on a web page and see a context menu. This is very close to what I want (I don't want anyone to be able to right-click and print, hit back, hit properties, view source, etc).</p>
<p>The only problem is this also disables the context menu that appears in TextBoxes for copy/paste, etc.</p>
<p>To make this clearer, this is what I don't want:<br>
<a href="http://www.flickr.com/photos/24262860@N00/2941073716/" rel="nofollow noreferrer" title="badcontext by andersonimes, on Flickr"><img src="https://farm4.static.flickr.com/3047/2941073716_0c51ab4b3c_m.jpg" width="124" height="240" alt="badcontext" /></a></p>
<p>This is what I do want:<br>
<a href="http://www.flickr.com/photos/24262860@N00/2941073720/" rel="nofollow noreferrer" title="goodcontext by andersonimes, on Flickr"><img src="https://farm4.static.flickr.com/3024/2941073720_8aedaf9b06_o.png" width="104" height="144" alt="goodcontext" /></a></p>
<p>I would like to disable the main context menu, but allow the one that appears in TextBoxes. Anyone know how I would do that? The WebBrowser.Document.ContextMenuShowing event looks promising, but doesn't seem to properly identify the element the user is right-clicking on, either through the HtmlElementEventArgs parameter's "FromElement" and "ToElement" properties, nor is the sender anything but the HtmlDocument element.</p>
<p>Thanks in advance!</p>
| [
{
"answer_id": 200194,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": " CopiedTxt = document.selection.createRange();\n CopiedTxt.execCommand(\"Copy\");\n"
},
{
"answer_id": 1723195,
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3244/"
] |
200,163 | <p>I am currently writing a little bootstrap code for a service that can be run in the console. It essentially boils down to calling the OnStart() method instead of using the ServiceBase to start and stop the service (because it doesn't run the application if it isn't installed as a service and makes debugging a nightmare).</p>
<p>Right now I am using Debugger.IsAttached to determine if I should use ServiceBase.Run or [service].OnStart, but I know that isn't the best idea because some times end users want to run the service in a console (to see the output etc. realtime).</p>
<p>Any ideas on how I could determine if the Windows service controller started 'me', or if the user started 'me' in the console? Apparantly <a href="http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/99c4594b-e6c9-424f-bfe1-c7261bba24d3/" rel="noreferrer" title="forum thread">Environment.IsUserInteractive</a> is not the answer. I thought about using commandline args, but that seems 'dirty'.</p>
<p>I could always see about a try-catch statement around ServiceBase.Run, but that seems dirty. Edit: Try catch doesn't work.</p>
<p>I have a solution: putting it up here for all the other interested stackers:</p>
<pre><code> public void Run()
{
if (Debugger.IsAttached || Environment.GetCommandLineArgs().Contains<string>("-console"))
{
RunAllServices();
}
else
{
try
{
string temp = Console.Title;
ServiceBase.Run((ServiceBase[])ComponentsToRun);
}
catch
{
RunAllServices();
}
}
} // void Run
private void RunAllServices()
{
foreach (ConsoleService component in ComponentsToRun)
{
component.Start();
}
WaitForCTRLC();
foreach (ConsoleService component in ComponentsToRun)
{
component.Stop();
}
}
</code></pre>
<p>EDIT: There was another question on StackOverflow where the guy had problems with the Environment.CurrentDirectory being "C:\Windows\System32" looks like that may be the answer. I will test today.</p>
| [
{
"answer_id": 208073,
"author": "gyrolf",
"author_id": 23772,
"author_profile": "https://Stackoverflow.com/users/23772",
"pm_score": 4,
"selected": false,
"text": "Environment.UserInteractive"
},
{
"answer_id": 218954,
"author": "Kramii",
"author_id": 11514,
"author_... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24064/"
] |
200,178 | <p>So what's the best way to create new tables in a Sqlite database in Rails 2. I have created the database using rake db:migrate command. So should I write individual sql scripts to create a database or use rake somehow. I don't need scaffolding.</p>
| [
{
"answer_id": 200214,
"author": "hectorsq",
"author_id": 14755,
"author_profile": "https://Stackoverflow.com/users/14755",
"pm_score": 1,
"selected": false,
"text": "script/generate migration"
},
{
"answer_id": 200592,
"author": "robintw",
"author_id": 1912,
"author_... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1688440/"
] |
200,195 | <p>I have a Stored procedure which schedules a job. This Job takes a lot of time to get completed (approx 30 to 40 min). I need to get to know the status of this Job.
Below details would help me</p>
<p>1) How to see the list of all jobs that have got scheduled for a future time and are yet to start</p>
<p>2) How to see the the list of jobs running and the time span from when they are running</p>
<p>3) How to see if the job has completed successfully or has stoped in between because of any error.</p>
| [
{
"answer_id": 200280,
"author": "Tim C",
"author_id": 7585,
"author_profile": "https://Stackoverflow.com/users/7585",
"pm_score": 7,
"selected": true,
"text": "EXEC msdb.dbo.sp_help_job @Job_name = 'Your Job Name'\n"
},
{
"answer_id": 238001,
"author": "piers7",
"author_... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20951/"
] |
200,200 | <p>I need to use an alias in the WHERE clause, but It keeps telling me that its an unknown column. Is there any way to get around this issue? I need to select records that have a rating higher than x. Rating is calculated as the following alias:</p>
<pre><code>sum(reviews.rev_rating)/count(reviews.rev_id) as avg_rating
</code></pre>
| [
{
"answer_id": 200203,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 9,
"selected": true,
"text": " HAVING avg_rating>5\n"
},
{
"answer_id": 200220,
"author": "Torbjörn Gyllebring",
"author_id": 21182,
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
200,205 | <p>I'm experimenting with an updated build system at work; currently, I'm trying to find a good way to set compiler & flags depending on the target platform. </p>
<p>What I would like to do is something like</p>
<pre><code>switch $(PLATFORM)_$(BUILD_TYPE)
case "Linux_x86_release"
CFLAGS = -O3
case "Linux_x86_debug"
CFLAGS = -O0 -g
case "ARM_release"
CC = armcc
AR = armlink
CFLAGS = -O2 -fx
...
</code></pre>
<p>which is not supported by GNU Make. Now, my first thought was to just do</p>
<pre><code>-include $(PLATFORM)_$(BUILD_TYPE)
</code></pre>
<p>which is a pretty decent solution, however, it makes it hard to get an overview of what differs between files, not to mention that I'm looking forward to writing & maintaining a good 60-80 files, each containing a set of variable definitions.</p>
<p>Does anyone happen to know a better way to accomplish this? I.e. setting a set of flags and other options based on another variable?</p>
| [
{
"answer_id": 200222,
"author": "Bruno De Fraine",
"author_id": 6918,
"author_profile": "https://Stackoverflow.com/users/6918",
"pm_score": 3,
"selected": false,
"text": "configure"
},
{
"answer_id": 200241,
"author": "Martin York",
"author_id": 14065,
"author_profil... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15514/"
] |
200,213 | <p>I've a small project that I want to share with a few others on a machine that we all have access to. I created a bare copy of the local repo with</p>
<pre><code>git clone --bare --no-hardlinks path/to/.git/ repoToShare.git
</code></pre>
<p>I then moved repoToShare.git to the server.</p>
<p>I can check it out with the following:</p>
<pre><code>git clone ssh://user@address/opt/gitroot/repoToShare.git/ test
</code></pre>
<p>I can then see everything in the local repo and make commits against that. When I try to push changes back to the remote server I get the following error.</p>
<pre><code>*** Project description file hasn't been set
error: hooks/update exited with error code 1
error: hook declined to update refs/heads/master
</code></pre>
<p>Any ideas?</p>
| [
{
"answer_id": 509398,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": ".git"
},
{
"answer_id": 7122006,
"author": "rodrigomanhaes",
"author_id": 362945,
"author_profile": "https... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/85/"
] |
200,219 | <p>I would like to develop Adobe Flex applications using Linux and a free environment. I'd prefer a free as in freedom alternative, but as in beer would work as well. ;-)</p>
<p>Are any of you developing Adobe Flex rich internet applications using such an environment? Or should I face the "facts" that Flex Builder is an essential tool for Flex development and that I'm more or less lost without it?</p>
| [
{
"answer_id": 200684,
"author": "Yaba",
"author_id": 7524,
"author_profile": "https://Stackoverflow.com/users/7524",
"pm_score": 2,
"selected": false,
"text": "mvn package"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/200219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
200,225 | <p>In a C++ project (i.e. no .NET) on Windows Mobile, I am looking for a way to easily communicate between two independently running applications. Application A would run a service, whereas application B would provide the user some functionality - for which B has to call some of A's functions. I would rather not go through implementing anything in COM. </p>
<p>In fact, I would prefer not to do any kind of serialization or similar (i.e. this would exclude using sockets/pipes/files), but rather have B pass all parameters and pointers over to A, just like if A were part of B. Also, apps C, D and E should be able to do the same with only one instance of A running.</p>
<p>I should add that B sometimes is supposed to return an array (or std::vector or std::map) to A where the size is not previously known. </p>
<p>Is this possible on Windows Mobile and possibly other platforms?</p>
| [
{
"answer_id": 277209,
"author": "Johann Gerell",
"author_id": 6345,
"author_profile": "https://Stackoverflow.com/users/6345",
"pm_score": 0,
"selected": false,
"text": "CreateFile"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/200225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27101/"
] |
200,229 | <p>Can Eclipse make parameters for generated methods (overwriting, implementing interface, etc.) final, and if so, how?</p>
<p>If I'm not mistaken, IntelliJ had an option for it. I could not find something similar in Eclipse.</p>
<p>I have become accustomed to making parameters final manually, but I am hoping for an automatic solution.</p>
| [
{
"answer_id": 200275,
"author": "Guido",
"author_id": 12388,
"author_profile": "https://Stackoverflow.com/users/12388",
"pm_score": 5,
"selected": true,
"text": "Window > Preferences > Java > Editor > Templates or under Window > Preferences > Java > Code Style > Code Templates"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/200229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/706/"
] |
200,239 | <p>I'm using the MIDP 2.0 (JSR 118) and I just noticed that there is no reader for strings in J2ME.</p>
<p>Does anyone know how you are supposed to read Strings from an <code>InputStream</code> or <code>InputStreamReader</code> in a platform independent way (i.e. between two java enabled cell phones of different models)?</p>
| [
{
"answer_id": 200644,
"author": "tonys",
"author_id": 35439,
"author_profile": "https://Stackoverflow.com/users/35439",
"pm_score": 3,
"selected": true,
"text": "DataInputStream.readUTF()"
},
{
"answer_id": 261027,
"author": "Community",
"author_id": -1,
"author_prof... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3713/"
] |
200,247 | <p>I don't understand it. </p>
<p>The ids of html elements in the master page are changed by the same id but with a prefix and it's breaking the css design.</p>
<p>In the master page I have:</p>
<pre><code><div id="container" runat="server">
<asp:ContentPlaceHolder ...
...
</code></pre>
<p>The above code is rendered</p>
<pre><code><div id="ctl00_ctloo_container">
...
</code></pre>
<p>And the CSS styles are gone obviously.</p>
<p>How do I stop it?</p>
<p>Thanks!</p>
| [
{
"answer_id": 200263,
"author": "Biri",
"author_id": 968,
"author_profile": "https://Stackoverflow.com/users/968",
"pm_score": 1,
"selected": false,
"text": "<asp:Whatever runat=\"server\" id=\"whatever\" CssClass=\"whateverClass\">\n"
},
{
"answer_id": 200300,
"author": "Ja... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/460927/"
] |
200,257 | <p>i've never created a shopping cart, or forum in php. aside from viewing and analyzing another persons project or viewing tutorials that display how to make such a project or how to being such a project. how would a person know how to design the database structure to create such a thing? im guessing its probbably through trial and error...</p>
| [
{
"answer_id": 200262,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 4,
"selected": false,
"text": "students\n student_id\n student_name\n student_class\n student_grade\n"
}
] | 2008/10/14 | [
"https://Stackoverflow.com/questions/200257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27751/"
] |
200,286 | <p>we had a heated discussion about a method name. </p>
<p>We have a class <code>User</code>. There is property called "Groups" on the user. It contains all groups that contain the user directly. That's ok. What we have problem with, is the name of the method that would recursively list all user's groups and their "parent" groups and return list of all groups, of which the user can be considered as member.</p>
<pre><code>User u = <get user>;
IList<UserGroup> groups = u.XYZ();
Console.WriteLine("User {0} is member of: ", u);
foreach(UserGroup g in groups)
Console.WriteLine("{0}", g);
</code></pre>
<p>My colleagues brought:</p>
<pre><code>u.GetAllGroups(); // what groups?
u.GetMemberOfGroups(); // doesn't make sense
u.GroupsIAmMemberOf(); // long
u.MemberOf(); // short, but the description is wrong
u.GetRolesForUser(); // we don't work with roles, so GetGroupsForUser ?
u.GetOccupiedGroups(); // is the meaning correct?
</code></pre>
<p>What name would you propose?</p>
| [
{
"answer_id": 200288,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 1,
"selected": false,
"text": "u.GetGroupMembership()\n"
},
{
"answer_id": 200296,
"author": "Owen",
"author_id": 4853,
"author_prof... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75224/"
] |
200,292 | <p>I'm producing a hex file to run on an ARM processor which I want to keep below 32K. It's currently a lot larger than that and I wondered if someone might have some advice on what's the best approach to slim it down?</p>
<p>Here's what I've done so far</p>
<ol>
<li>So I've run 'size' on it to determine how big the hex file is. </li>
<li>Then 'size' again to see how big each of the object files are that link to create the hex files. It seems the majority of the size comes from external libraries.</li>
<li>Then I used 'readelf' to see which functions take up the most memory. </li>
<li>I searched through the code to see if I could eliminate calls to those functions.</li>
</ol>
<p>Here's where I get stuck, there's some functions which I don't call directly (e.g. _vfprintf) and I can't find what calls it so I can remove the call (as I think I don't need it).</p>
<p>So what are the next steps?</p>
<p>Response to answers:</p>
<ul>
<li>As I can see there are functions being called which take up a lot of memory. I cannot however find what is calling it. </li>
<li>I want to omit those functions (if possible) but I can't find what's calling them! Could be called from any number of library functions I guess.</li>
<li>The linker is working as desired, I think, it only includes the relevant library files. How do you know if only the relevant functions are being included? Can you set a flag or something for that?</li>
<li>I'm using GCC</li>
</ul>
| [
{
"answer_id": 200600,
"author": "Andrew Edgecombe",
"author_id": 11694,
"author_profile": "https://Stackoverflow.com/users/11694",
"pm_score": 5,
"selected": true,
"text": "strip"
},
{
"answer_id": 10340204,
"author": "Russ",
"author_id": 465838,
"author_profile": "h... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/76121/"
] |
200,305 | <p>I want an <strong>simple IDE/editor for C</strong> in <strong>Linux</strong> to which I <strong>can add features easily</strong>. For example: I want to add a right click menu item and a related action for the editor. It should be easy to extent and add any desirable functionality. I tried eclipse CDT but its to much of learning(I mean knowing the eclipse plug-in architecture and the CDT extension points and stuff) to do for the small modification/s I want to do. </p>
<p>Thanks,
Sachin</p>
| [
{
"answer_id": 201034,
"author": "Peter Miehle",
"author_id": 27800,
"author_profile": "https://Stackoverflow.com/users/27800",
"pm_score": 2,
"selected": false,
"text": ";; the indention-thing needs refining\n(defun pm-if ()\n \"generates if stub\"\n (interactive)\n (insert \"if () {\")... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2745562/"
] |
200,309 | <p>How to create a table with a timestamp column that defaults to <code>DATETIME('now')</code>?</p>
<p>Like this:</p>
<pre><code>CREATE TABLE test (
id INTEGER PRIMARY KEY AUTOINCREMENT,
t TIMESTAMP DEFAULT DATETIME('now')
);
</code></pre>
<p>This gives an error.</p>
| [
{
"answer_id": 200329,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 9,
"selected": true,
"text": "CURRENT_TIMESTAMP"
},
{
"answer_id": 228070,
"author": "rev",
"author_id": 30455,
"author_profile": "https:/... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13262/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.