qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
105,034 | <p>How do I create GUIDs (globally-unique identifiers) in JavaScript? The GUID / UUID should be at least 32 characters and should stay in the ASCII range to avoid trouble when passing them around.</p>
<p>I'm not sure what routines are available on all browsers, how "random" and seeded the built-in random number generator is, etc.</p>
| [
{
"answer_id": 105074,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 12,
"selected": true,
"text": "xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx"
},
{
"answer_id": 105078,
"author": "Prestaul",
"author_id": 562... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4926/"
] |
105,075 | <p>I'd like to run a long rsync command in Cygwin by double clicking on a .sh file in Windows. It must start in the file's containing directory (e.g. /cygdrive/c/scripts/) so that relative paths work. Anyone gotten this to work?</p>
<p>Note: I've just found <a href="http://web.archive.org/web/20121204091631/http://blog.chavez.ws:80/2008/03/cygwin-command-here.html" rel="nofollow noreferrer">here</a>, a Cygwin package that manages Windows context menus (Bash Prompt Here). It might have some clues.</p>
| [
{
"answer_id": 105304,
"author": "Vladimir",
"author_id": 9641,
"author_profile": "https://Stackoverflow.com/users/9641",
"pm_score": 0,
"selected": false,
"text": ".bat"
},
{
"answer_id": 105364,
"author": "Sparr",
"author_id": 13675,
"author_profile": "https://Stack... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1701/"
] |
105,095 | <p>If you are relying on an implementation of Python that has a Global Interpreter Lock (i.e. CPython) and writing multithreaded code, do you really need locks at all?</p>
<p>If the GIL doesn't allow multiple instructions to be executed in parallel, wouldn't shared data be unnecessary to protect?</p>
<p>sorry if this is a dumb question, but it is something I have always wondered about Python on multi-processor/core machines. </p>
<p>same thing would apply to any other language implementation that has a GIL.</p>
| [
{
"answer_id": 105369,
"author": "Will Harris",
"author_id": 4702,
"author_profile": "https://Stackoverflow.com/users/4702",
"pm_score": 7,
"selected": true,
"text": "#!/usr/bin/env python\nimport threading\n\nshared_balance = 0\n\nclass Deposit(threading.Thread):\n def run(self):\n ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16148/"
] |
105,100 | <p>What is the difference between display:block and display:inline</p>
| [
{
"answer_id": 105126,
"author": "ethyreal",
"author_id": 18159,
"author_profile": "https://Stackoverflow.com/users/18159",
"pm_score": 2,
"selected": false,
"text": "<p>"
},
{
"answer_id": 105210,
"author": "Jim",
"author_id": 8427,
"author_profile": "https://Stackov... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2486/"
] |
105,113 | <p>Most of us have already used the casual patterns such as <a href="https://stackoverflow.com/questions/26685/what-is-mvc-and-what-are-the-advantages-of-it">MVC</a>, <a href="https://stackoverflow.com/questions/91932?sort=votes#sort-top">strategy</a>, etc.</p>
<p>But there must be some unusual solutions to unusual problems, and I'd like to hear about it.</p>
| [
{
"answer_id": 105188,
"author": "scubabbl",
"author_id": 9450,
"author_profile": "https://Stackoverflow.com/users/9450",
"pm_score": 3,
"selected": false,
"text": "char getNextChar(char previous) {\n\nswitch (previous)\ncase 'a': return b;\ncase 'b': return c;\n...\ncase 'z': return a;\... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9951/"
] |
105,121 | <p>Is there any way to capture the trace statements of your Flex app while not running in debug mode?</p>
<p>Or is there any other way to output logging information when not running a debugger?</p>
<p>Currently I'm trying to fix a bug that only presents itself in very specific deployment scenario, but I could see this being useful in some instances for customers to send logs to tech support when they are reporting bugs or other problems.</p>
| [
{
"answer_id": 105611,
"author": "hasseg",
"author_id": 4111,
"author_profile": "https://Stackoverflow.com/users/4111",
"pm_score": 3,
"selected": true,
"text": "Log"
},
{
"answer_id": 191534,
"author": "Mike Deck",
"author_id": 1247,
"author_profile": "https://Stacko... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1247/"
] |
105,125 | <p>Our project uses Cruise Control to both build and hot deploy a web application to a remote server (via FTP) running Tomcat in the form of a .war file. Unfortunately, "hot" deploys don't appear to work properly, causing us to reboot Tomcat in response to each deployment. We would really like to do this auto-magically, much like the build itself. Is there an easy way to do this?</p>
<p>Side note: both machines are running Windows (XP or server, I think).</p>
<p>Side note 2: Performance doesn't really matter. This is an integration box.</p>
| [
{
"answer_id": 105289,
"author": "ethyreal",
"author_id": 18159,
"author_profile": "https://Stackoverflow.com/users/18159",
"pm_score": 1,
"selected": false,
"text": "crontab -e\n"
},
{
"answer_id": 2110708,
"author": "BalusC",
"author_id": 157882,
"author_profile": "... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7357/"
] |
105,130 | <p>What are the major reasons for using <a href="http://en.wikipedia.org/wiki/WinDbg" rel="noreferrer">WinDbg</a> vs the Visual Studio debugger?</p>
<p>And is it commonly used as a complete replacement for the Visual Studio debugger, or more for when the need arises.</p>
| [
{
"answer_id": 119993,
"author": "Martin",
"author_id": 1529,
"author_profile": "https://Stackoverflow.com/users/1529",
"pm_score": 3,
"selected": false,
"text": ".loadby sos mscorwks\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19263/"
] |
105,147 | <p>Working on a new back end system for my company, and one of their requests is for a window to become locked down and for the user to be sent to the login screen if they leave it idle for to long.</p>
<p>I figure I'd do this with JavaScript by attaching listeners to clicks, mouse moves and key-ups but I worry about messing with other scripts.</p>
<p>Any suggestions?
</p>
| [
{
"answer_id": 119993,
"author": "Martin",
"author_id": 1529,
"author_profile": "https://Stackoverflow.com/users/1529",
"pm_score": 3,
"selected": false,
"text": ".loadby sos mscorwks\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9176/"
] |
105,198 | <p>I'm still a little unclear and when to wrap a <em>lock</em> around some code. My general rule-of-thumb is to wrap an operation in a lock when it reads or writes to a static variable. But when a static variable is ONLY read (e.g. it's a readonly that is set during type initialization), accessing it doesn't need to be wrapped in a lock statement, right? I recently saw some code that looked like the following example, and it made me think there may be some gaps in my multithreading knowledge:</p>
<pre><code>class Foo
{
private static readonly string bar = "O_o";
private bool TrySomething()
{
string bar;
lock(Foo.objectToLockOn)
{
bar = Foo.bar;
}
// Do something with bar
}
}
</code></pre>
<p>That just doesn't make sense to me--why would there by concurrency issues with READING a register?</p>
<p>Also, this example brings up another question. Is one of these better than the other? (E.g. example two holds the lock for less time?) I suppose I could disassemble the MSIL...</p>
<pre><code>class Foo
{
private static string joke = "yo momma";
private string GetJoke()
{
lock(Foo.objectToLockOn)
{
return Foo.joke;
}
}
}
</code></pre>
<p>vs.</p>
<pre><code>class Foo
{
private static string joke = "yo momma";
private string GetJoke()
{
string joke;
lock(Foo.objectToLockOn)
{
joke = Foo.joke;
}
return joke;
}
}
</code></pre>
| [
{
"answer_id": 105650,
"author": "Matt Howells",
"author_id": 16881,
"author_profile": "https://Stackoverflow.com/users/16881",
"pm_score": 6,
"selected": true,
"text": "class Foo\n{\n private int count = 0;\n public void TrySomething() \n {\n count++;\n }\n}\n"
}... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11574/"
] |
105,212 | <p>Suppose I have a directory <code>/dir</code> inside which there are 3 symlinks to other directories
<code>/dir/dir11</code>, <code>/dir/dir12</code>, and <code>/dir/dir13</code>. I want to list all the files in <code>dir</code> including the ones in <code>dir11</code>, <code>dir12</code> and <code>dir13</code>.</p>
<p>To be more generic, I want to list all files including the ones in the directories which are symlinks. <code>find .</code>, <code>ls -R</code>, etc stop at the symlink without navigating into them to list further.</p>
| [
{
"answer_id": 105249,
"author": "Michael Ridley",
"author_id": 4838,
"author_profile": "https://Stackoverflow.com/users/4838",
"pm_score": 9,
"selected": true,
"text": "-L"
},
{
"answer_id": 105251,
"author": "pjz",
"author_id": 8002,
"author_profile": "https://Stack... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18072/"
] |
105,252 | <p>How do I convert between big-endian and little-endian values in C++?</p>
<p>For clarity, I have to translate binary data (double-precision floating point values and 32-bit and 64-bit integers) from one CPU architecture to another. This doesn't involve networking, so ntoh() and similar functions won't work here.</p>
<hr />
<p>Note: The answer I accepted applies directly to compilers I'm targeting (which is why I chose it). However, there are other very good, more portable answers here.</p>
| [
{
"answer_id": 105319,
"author": "Mark",
"author_id": 4405,
"author_profile": "https://Stackoverflow.com/users/4405",
"pm_score": 4,
"selected": false,
"text": "// Specialization for 2-byte types.\ntemplate<>\ninline void endian_byte_swapper< 2 >(char* dest, char const* src)\n{\n // U... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19129/"
] |
105,264 | <p>I'm new to the WCSF and can't seem to find anything related to "building a custom template" for creating the views/presenters/code-behinds/etc with your own flavor ...</p>
<p>Can anyone point me in the right direction?</p>
| [
{
"answer_id": 105319,
"author": "Mark",
"author_id": 4405,
"author_profile": "https://Stackoverflow.com/users/4405",
"pm_score": 4,
"selected": false,
"text": "// Specialization for 2-byte types.\ntemplate<>\ninline void endian_byte_swapper< 2 >(char* dest, char const* src)\n{\n // U... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2701/"
] |
105,308 | <p>I want to take the url:
<a href="http://www.mydomain.com/signup-12345" rel="nofollow noreferrer">http://www.mydomain.com/signup-12345</a></p>
<p>And actually give them:
<a href="http://www.mydomain.com/signup/?aff=12345" rel="nofollow noreferrer">http://www.mydomain.com/signup/?aff=12345</a></p>
<p>I have NO history with mod_rewrite, HELP!</p>
| [
{
"answer_id": 111010,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": "RewriteCond %{query_string}& ^aff=((.+&)|&)$ \nRewriteRule ^/signup-old-script.asp$ /signup-new-script.php?affID=%2 [L,R]\... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13704/"
] |
105,311 | <p>What is a "table-driven method"?</p>
<p>As mentioned by Bill Gates in the <a href="https://www.youtube.com/watch?v=nNOohFst9Lc" rel="nofollow noreferrer">second Windows Vista commercial</a> at 1:05.</p>
| [
{
"answer_id": 118492,
"author": "David Medinets",
"author_id": 219658,
"author_profile": "https://Stackoverflow.com/users/219658",
"pm_score": 2,
"selected": false,
"text": "hash[tv] = process_tv_records\nhash[cable] = process_cable_records\n"
},
{
"answer_id": 28268626,
"au... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19272/"
] |
105,330 | <p>I have a dev, that will get around our code coverage by writing tests that never fail.</p>
<p>The code is just atrocious, but the tests never catch it because they assert(true).</p>
<p>I code review, but I can't do everyones work for them, all the time. How do you get people like this motivated to make good software?</p>
<p>Is there a build plugin for detecting tests that can't fail?</p>
<p>C#, mbUnit tests.</p>
| [
{
"answer_id": 105351,
"author": "Eli Bendersky",
"author_id": 8206,
"author_profile": "https://Stackoverflow.com/users/8206",
"pm_score": 0,
"selected": false,
"text": "assert(true)"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1220/"
] |
105,349 | <p>I am using bash in os X Terminal app, and my custom $PS1 breaks when I scroll through my history.</p>
<pre><code>PS1="${BLUE}\u${CYAN}@${RED}\h${BLUE}\w\n\[${red}\$${NC}\]"
</code></pre>
<p>also tried
PS1="${BLUE}\u${CYAN}@${RED}\h${BLUE}\w\r\n[${red}\$${NC}]" </p>
<p>The problem seems to be in the newline. I have used this bash prompt on Slackware no prob.</p>
| [
{
"answer_id": 105658,
"author": "dF.",
"author_id": 3002,
"author_profile": "https://Stackoverflow.com/users/3002",
"pm_score": 0,
"selected": false,
"text": "\\["
},
{
"answer_id": 105922,
"author": "Milhous",
"author_id": 17712,
"author_profile": "https://Stackover... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17712/"
] |
105,372 | <p>How can you enumerate an <code>enum</code> in C#?</p>
<p>E.g. the following code does not compile:</p>
<pre class="lang-cs prettyprint-override"><code>public enum Suit
{
Spades,
Hearts,
Clubs,
Diamonds
}
public void EnumerateAllSuitsDemoMethod()
{
foreach (Suit suit in Suit)
{
DoSomething(suit);
}
}
</code></pre>
<p>And it gives the following compile-time error:</p>
<blockquote>
<p>'Suit' is a 'type' but is used like a 'variable'</p>
</blockquote>
<p>It fails on the <code>Suit</code> keyword, the second one.</p>
| [
{
"answer_id": 105401,
"author": "Tom Carr",
"author_id": 14954,
"author_profile": "https://Stackoverflow.com/users/14954",
"pm_score": 6,
"selected": false,
"text": "Enum.GetNames(Suit)\n"
},
{
"answer_id": 105402,
"author": "jop",
"author_id": 11830,
"author_profile... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] |
105,400 | <p>I am maintaining a pretty sizable application and database and am noticing some poor database performance in a few of our stored procedures.</p>
<p>I always hear that "adding an index" can be done to help performance. I am certainly no DBA, and I do not understand what indexes are, why they help, and how to create them.</p>
<p>I basically need an indexes 101. </p>
<p>Can anyone give me resources so that I can learn?</p>
| [
{
"answer_id": 105503,
"author": "TrevorD",
"author_id": 12492,
"author_profile": "https://Stackoverflow.com/users/12492",
"pm_score": 0,
"selected": false,
"text": "create index <indexname> on <tablename>(<column1>[,<column2>...])\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638/"
] |
105,418 | <p>I want to be able to figure out what port a particular program is using. Are there any programs available online or that come with windows that will tell me which processes are using which ports on my computer?</p>
<p>PS - before you downmod this for not being a programming question, I'm looking for the program to test some networking code.</p>
| [
{
"answer_id": 105447,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 2,
"selected": false,
"text": "netstat"
},
{
"answer_id": 105448,
"author": "Graeme Perrow",
"author_id": 1821,
"author_profile... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5021/"
] |
105,477 | <p>I think I've got it down to the most basic case:</p>
<pre><code>int main(int argc, char ** argv) {
int * arr;
foo(arr);
printf("car[3]=%d\n",arr[3]);
free (arr);
return 1;
}
void foo(int * arr) {
arr = (int*) malloc( sizeof(int)*25 );
arr[3] = 69;
}
</code></pre>
<p>The output is this:</p>
<pre class="lang-none prettyprint-override"><code>> ./a.out
car[3]=-1869558540
a.out(4100) malloc: *** error for object 0x8fe01037: Non-aligned pointer
being freed
*** set a breakpoint in malloc_error_break to debug
>
</code></pre>
<p>If anyone can shed light on where my understanding is failing, it'd be greatly appreciated.</p>
| [
{
"answer_id": 105507,
"author": "terminus",
"author_id": 9232,
"author_profile": "https://Stackoverflow.com/users/9232",
"pm_score": 3,
"selected": false,
"text": "void foo( int ** arr) {\n *arr = (int *)malloc( sizeof(int) * 25 );\n (*arr)[3] = 69;\n}\n"
},
{
"answer_id":... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
105,479 | <p>We want to maintain 3 webservices for the different steps of deployment, but how do we define in our application which service to use? Do we just maintain 3 web references and ifdef the uses of them somehow?</p>
| [
{
"answer_id": 107077,
"author": "Jay Bazuzi",
"author_id": 5314,
"author_profile": "https://Stackoverflow.com/users/5314",
"pm_score": 2,
"selected": false,
"text": "msbuild /t:deploy"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105479",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17176/"
] |
105,499 | <p>I have a problem to connect to my WCF service if customer is using proxy with credentials. I'm unable to find the way to set credential to generated client proxy. </p>
<p>If I use the web service, then it is possible to set proxy. </p>
| [
{
"answer_id": 108530,
"author": "Toran Billups",
"author_id": 2701,
"author_profile": "https://Stackoverflow.com/users/2701",
"pm_score": 1,
"selected": false,
"text": " Dim client As ProductServiceClient = New ProductServiceClient(\"wsHttpProductService\")\n client.ClientCredenti... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105499",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19146/"
] |
105,504 | <p>When retrieving a lookup code value from a table, some folks do this...</p>
<pre><code>Dim dtLookupCode As New LookupCodeDataTable()
Dim taLookupCode AS New LookupCodeTableAdapter()
Dim strDescription As String
dtLookupCode = taLookupCode.GetDataByCodeAndValue("EmpStatus", "FULL")
strDescription = dtLookupCode.Item(0).Meaning
</code></pre>
<p>...however, I've also seen things done "chained" like this...</p>
<pre><code>strDescription = taLookupCode.GetDataByCodeAndValue("EmpStatus", "FULL").Item(0).Meaning
</code></pre>
<p>...which bypasses having a lookup code data table in the first place since the table adapter knows what the structure of its result set looks like.</p>
<p>Does using the "chained" method save the overhead of creating the data table object, or does it effectively get created anyway in order to properly handle the .Item(0).Meaning statement?</p>
| [
{
"answer_id": 105548,
"author": "core",
"author_id": 11574,
"author_profile": "https://Stackoverflow.com/users/11574",
"pm_score": 2,
"selected": false,
"text": "if (ConfigurationManager.AppSettings(\"ConnectionString\") == null)\n{\n throw new MissingConfigSettingException(\"Connect... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/71/"
] |
105,522 | <p>OK, so things have progressed significantly with my DSL since I asked <a href="https://stackoverflow.com/questions/82776/how-do-i-reference-a-diagram-in-a-dsl-t4-template">this question</a> a few days ago.</p>
<p>As soon as I've refactored my code, I'll post my own answer to that one, but for now, I'm having another problem.</p>
<p>I'm dynamically generating sub-diagrams from a DSL-created model, saving those diagrams as images and then generating a Word document with those images embedded. So far, so good.</p>
<p> But where my shapes have compartments (for examples, Operations on a Service Contract - can you guess what it is, yet?), the compartment header is displayed but <b>none of the items</b>.</p>
<p>If I examine my shape object, it has a single nested child - an ElementListCompartment which in turn, has a number of items that I'm expecting to be displayed. The ElementListCompartment.IsExpanded property is set to true (and the compartment header has a little 'collapse' icon on it) but where, oh where, are my items?</p>
<p>The shape was added to the diagram using</p>
<pre><code>parentShape.FixupChildShapes(modelElement);
</code></pre>
<p>So, can anyone guide me on my merry way?</p>
| [
{
"answer_id": 1068424,
"author": "Eugene Burmako",
"author_id": 131615,
"author_profile": "https://Stackoverflow.com/users/131615",
"pm_score": 3,
"selected": true,
"text": "private Store LoadStore()\n{\n var store = new Store();\n store.LoadDomainModels(typeof(CoreDesignSurfaceDo... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5806/"
] |
105,535 | <p>I have a VmWare virtual machine that is coming dangerously close to it's primarry HDD's limit and I need to extend it. How do I do this? I'm working with VmWare Workstation 6.0.5</p>
| [
{
"answer_id": 105547,
"author": "pkaeding",
"author_id": 4257,
"author_profile": "https://Stackoverflow.com/users/4257",
"pm_score": 3,
"selected": true,
"text": "vmware-vdiskmanager -x 12GB path\\to\\disk.vmdk\n"
},
{
"answer_id": 105571,
"author": "Paul Mrozowski",
"au... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1980/"
] |
105,556 | <p>We are attempting to use a SQL Server 2003 database for our test records and want a quick way to take NUnit and NAnt output and produce SQL schema and data. Is there a simple way to generate SQL Schema using the XSD file describing these XML documents?</p>
| [
{
"answer_id": 105591,
"author": "Cyberherbalist",
"author_id": 16964,
"author_profile": "https://Stackoverflow.com/users/16964",
"pm_score": 2,
"selected": true,
"text": "I:\\>xsd\nMicrosoft (R) Xml Schemas/DataTypes support utility\n[Microsoft (R) .NET Framework, Version 1.0.3705.0]\nC... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13688/"
] |
105,564 | <p>The original query looks like this (MySQL):</p>
<pre><code>SELECT *
FROM books
WHERE title LIKE "%text%" OR description LIKE "%text%"
ORDER BY date
</code></pre>
<p>Would it be possible to rewrite it (without unions or procedures), so that result will look like this:</p>
<ul>
<li>list of books where title matches query ordered by date, followed by:</li>
<li>list of books where description matches query ordered by date</li>
</ul>
<p>So basically just give a higher priority to matching titles over descriptions.</p>
| [
{
"answer_id": 105580,
"author": "Stephen Wrighton",
"author_id": 7516,
"author_profile": "https://Stackoverflow.com/users/7516",
"pm_score": -1,
"selected": false,
"text": "SELECT *, 1 as order from books where title like '%text%'\nunion\nSELECT *, 2 as order from books where descriptio... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20128/"
] |
105,572 | <p>Is there a <code>SQL</code> or <code>PHP</code> script that I can run that will change the default collation in all tables and fields in a database?</p>
<p>I can write one myself, but I think that this should be something that readily available at a site like this. If I can come up with one myself before somebody posts one, I will post it myself.</p>
| [
{
"answer_id": 105614,
"author": "Rich Adams",
"author_id": 10018,
"author_profile": "https://Stackoverflow.com/users/10018",
"pm_score": 4,
"selected": false,
"text": "<?php\n// your connection\nmysql_connect(\"localhost\",\"root\",\"***\");\nmysql_select_db(\"db1\");\n\n// convert code... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
105,602 | <p>I have inherited a monster.</p>
<p>It is masquerading as a .NET 1.1 application processes text files that conform to Healthcare Claim Payment (ANSI 835) standards, but it's a monster. The information being processed relates to healthcare claims, EOBs, and reimbursements. These files consist of records that have an identifier in the first few positions and data fields formatted according to the specs for that type of record. Some record ids are Control Segment ids, which delimit groups of records relating to a particular type of transaction.</p>
<p>To process a file, my little monster reads the first record, determines the kind of transaction that is about to take place, then begins to process other records based on what kind of transaction it is currently processing. To do this, it uses a nested if. Since there are a number of record types, there are a number decisions that need to be made. Each decision involves some processing and 2-3 other decisions that need to be made based on previous decisions. That means the nested if has a lot of nests. That's where my problem lies.</p>
<p>This one nested if is 715 lines long. Yes, that's right. Seven-Hundred-And-Fif-Teen Lines. I'm no code analysis expert, so I downloaded a couple of freeware analysis tools and came up with a McCabe Cyclomatic Complexity rating of 49. They tell me that's a pretty high number. High as in pollen count in the Atlanta area where 100 is the standard for high and the news says "Today's pollen count is 1,523". This is one of the finest examples of the Arrow Anti-Pattern I have ever been priveleged to see. At its highest, the indentation goes 15 tabs deep.</p>
<p>My question is, what methods would you suggest to refactor or restructure such a thing?</p>
<p>I have spent some time searching for ideas, but nothing has given me a good foothold. For example, substituting a guard condition for a level is one method. I have only one of those. One nest down, fourteen to go.</p>
<p>Perhaps there is a design pattern that could be helpful. Would Chain of Command be a way to approach this? Keep in mind that it must stay in .NET 1.1.</p>
<p>Thanks for any and all ideas.</p>
| [
{
"answer_id": 106482,
"author": "craigb",
"author_id": 18590,
"author_profile": "https://Stackoverflow.com/users/18590",
"pm_score": 4,
"selected": false,
"text": "if"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19304/"
] |
105,604 | <p>I've just installed MediaWiki on a web server. Obviously it needs lots of privileges during installation to set up its database correctly. Now that it's installed can I safely revoke some privileges (e.g. create table, drop table?) Or might it need to create more tables later (when they are first needed?) If not then I would prefer to grant it as few privileges as possible.</p>
| [
{
"answer_id": 105952,
"author": "hoyhoy",
"author_id": 3499,
"author_profile": "https://Stackoverflow.com/users/3499",
"pm_score": 3,
"selected": true,
"text": "grant select,lock tables,insert on media_wiki_db.* to 'wiki'@'localhost' identified by 'password';\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12048/"
] |
105,607 | <p>I love BlogEngine. But from what I can se it does not collect the standard information about the visitors I would like to see (referrer, browser-type and so on). </p>
<p>When I log in as Admin I have a menu item named "Referrer". I can choose a weekday and then I'll be presented with 1 or 2 rows with </p>
<p>"google.com 4 hits, "itmaskinen.se 6 hits" and so on, But that's not what I want to se, I want to se where my visitors come from, country, IP if possible, how many visitors and so on. </p>
<p>If someone of you are familiar with Blogengine.Net and can point me in the right direction to where I would put my own log-code or if you know any visitor-statistic-extension that can do it for me, I would be really happy to know. I prefer an extension, because if I make changes myself to BlogEngine it may break later updates I install. </p>
<p>Blogengine.Net is a blog software made in .Net found here: <a href="http://www.dotnetblogengine.net/" rel="noreferrer">http://www.dotnetblogengine.net/</a> </p>
<p>And yes, I prefer to take this question here rather then in the Blogengine.Net forum, you know why. ;) </p>
<p>(Anyone, feel free to edit my (bad) english in this post and after that delete this sentence) </p>
| [
{
"answer_id": 224194,
"author": "Rafe",
"author_id": 27497,
"author_profile": "https://Stackoverflow.com/users/27497",
"pm_score": 3,
"selected": false,
"text": "<script type=\"text/javascript\">\n var pageTracker = _gat._getTracker(\"UA-129049-25\");\n var userDefinedValue = '<%=... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19307/"
] |
105,609 | <p>I have an enum that looks as follows:</p>
<pre><code>public enum TransactionStatus { Open = 'O', Closed = 'C'};
</code></pre>
<p>and I'm pulling data from the database with a single character indicating - you guessed it - whether 'O' the transaction is open or 'C' the transaction is closed.</p>
<p>now because the data comes out of the database as an object I am having a heck of a time writing comparison code.</p>
<p>The best I can do is to write:</p>
<pre><code>protected bool CharEnumEqualsCharObj(TransactionStatus enum_status, object obj_status) {
return ((char)enum_status).ToString() == obj_status.ToString();
}
</code></pre>
<p>However, this is not the only character enum that I have to deal with, I have 5 or 6 and writting the same method for them is annoying to say the least. <a href="http://blogs.msdn.com/abhinaba/archive/2006/01/14/enumerting-all-values-of-an-enum.aspx" rel="nofollow noreferrer">Supposedly all enums inherit from System.Enum</a> but if I try to set that as the input type I get compilation errors. This is also in .NET 1.1 so generics are out of the question.</p>
<p>I've been struggling with this for a while. Does anyone have a better way of writing this method? Also, can anyone clarify the whole enums inherit from System.Enum but are not polymorphic thing?</p>
| [
{
"answer_id": 105638,
"author": "Jake Pearson",
"author_id": 632,
"author_profile": "https://Stackoverflow.com/users/632",
"pm_score": -1,
"selected": false,
"text": "TransactionStatus status = (TransactionStatus)Enum.Parse(typeof(TransactionStatus), obj.ToString());\n"
},
{
"an... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] |
105,610 | <p>I am using VSTO with Excel 2007 to generate PivotTables and PivotCharts dynamically.
I am having a problem when I need to have a PivotField in more than one column. </p>
<p>To accomplish this I create a PivotTable in Excel and serialize its properties into an XML document, which I then use to rebuild the PivotTable.</p>
<p>Ie: as a Value and as a Column</p>
<p>This is possible when building the PivotTable in Excel. Has found a way to do this using C# ?</p>
<p><a href="http://blogs.msdn.com/andreww/archive/2008/07/25/creating-a-pivottable-programmatically.aspx" rel="nofollow noreferrer">Creating a PivotTable Programmatically</a></p>
| [
{
"answer_id": 149068,
"author": "Alexandre Brisebois",
"author_id": 18619,
"author_profile": "https://Stackoverflow.com/users/18619",
"pm_score": 0,
"selected": false,
"text": "for (int cIndex = 1; cIndex < 1 + columns; cIndex++)\n sheet.Cells.set_Item(4, cIndex, data.Columns[cIndex ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18619/"
] |
105,613 | <p>Is it possible to use XPath to select only the nodes that have a particular child elements? For example, from this XML I only want the elements in pets that have a child of 'bar'. So the resulting dataset would contain the <code>lizard</code> and <code>pig</code> elements from this example:</p>
<pre><code><pets>
<cat>
<foo>don't care about this</foo>
</cat>
<dog>
<foo>not this one either</foo>
</dog>
<lizard>
<bar>lizard should be returned, because it has a child of bar</bar>
</lizard>
<pig>
<bar>return pig, too</bar>
</pig>
</pets>
</code></pre>
<p>This Xpath gives me all pets: <code>"/pets/*"</code>, but I only want the pets that have a child node of name <code>'bar'</code>.</p>
| [
{
"answer_id": 105628,
"author": "Chris Marasti-Georg",
"author_id": 96,
"author_profile": "https://Stackoverflow.com/users/96",
"pm_score": 7,
"selected": true,
"text": "/pets/*[bar]\n"
},
{
"answer_id": 433246,
"author": "Community",
"author_id": -1,
"author_profile... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10876/"
] |
105,642 | <p><strong>Update</strong>: Looks like the query does not throw any timeout. The connection is timing out.</p>
<p>This is a sample code for executing a query. Sometimes, while executing time consuming queries, it throws a timeout exception.</p>
<p>I <strong>cannot</strong> use any of these techniques:
1) Increase timeout.
2) Run it asynchronously with a callback. This needs to run in a synchronous manner.</p>
<p>please suggest any other techinques to keep the connection alive while executing a time consuming query?</p>
<pre><code>private static void CreateCommand(string queryString,
string connectionString)
{
using (SqlConnection connection = new SqlConnection(
connectionString))
{
SqlCommand command = new SqlCommand(queryString, connection);
command.Connection.Open();
command.ExecuteNonQuery();
}
}
</code></pre>
| [
{
"answer_id": 105655,
"author": "core",
"author_id": 11574,
"author_profile": "https://Stackoverflow.com/users/11574",
"pm_score": 0,
"selected": false,
"text": "command.CommandTimeout *= 2;\n"
},
{
"answer_id": 106116,
"author": "Geir-Tore Lindsve",
"author_id": 4582,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19306/"
] |
105,645 | <p>Tackling a strange scenario here. </p>
<p>We use a proprietary workstation management application which uses mySQL to store its data. Within the application they provide number of reports, such as which user logged into which machine at what time, all the software products installed on the monitored machines, so on and so forth. We are looking to do a different set of reports, however, they do not support custom reports.</p>
<p>Since their data is being stored in mySQL, I gather I can do the reporting manually. I don't have valid credentials to connect to the mySQL server though. <b>Is there anyway for me to create a user account in the mySQL server?</b> I do not want to reset the root password or anything account that might be in there, as it might break the application.</p>
<hr>
<p>I have full access to the Windows 2003 server. I can stop and restart services, including the mySQL server. To the actual mySQL server, I only have basic access through the GUI provided by the software. I can't connect to it directly through CLI or through another tool (due to the lack of credentials). </p>
<hr>
<p>I apologize if it came off as if I'm trying to get unauthorized access to the mySQL server. I have contacted the software company, and as of today it's been two weeks without a response from them. I need to get to the data. I have full access to the physical box, I have admin privileges on it.</p>
| [
{
"answer_id": 105674,
"author": "Tnilsson",
"author_id": 4165,
"author_profile": "https://Stackoverflow.com/users/4165",
"pm_score": 0,
"selected": false,
"text": "p'; INSERT INTO user VALUES\n"
},
{
"answer_id": 105804,
"author": "John Millikin",
"author_id": 3560,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16522/"
] |
105,651 | <p>How can I print wstring in gdb?</p>
| [
{
"answer_id": 105900,
"author": "Jesse Beder",
"author_id": 112,
"author_profile": "https://Stackoverflow.com/users/112",
"pm_score": 1,
"selected": false,
"text": "std::wstring str"
},
{
"answer_id": 1406427,
"author": "Ben Bryant",
"author_id": 28953,
"author_profi... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18382/"
] |
105,653 | <p>I'm having some issues with producing an int matrix without creating memory leaks. I want to be able to make a given (global) matrix into any size dynamically via read_matrix(). But then i want to be able to free the memory later on. So in my main method the second printf should result in a bus error since it should not have any memory allocated to it. How would i go about creating this?</p>
<pre><code>int** first_matrix;
int** second_matrix;
int** result_matrix;
int** read_matrix(int size_x, int size_y)
{
int** matrix;
matrix = calloc(size_x, sizeof(int*));
for(int i = 0;i<size_x;i++) {
matrix[i] = calloc(size_y, sizeof(int));
}
for(int i = 0;i<size_x;i++) {
for(int j = 0;j<size_y;j++) {
matrix[i][j] = i*10+j;
}
}
return matrix;
}
int main(int stackc, char** stack)
{
first_matrix = read_matrix(10,10);
printf("9:3 %d - 4:6 %d \n", first_matrix[9][3], first_matrix[4][6]);
free(*first_matrix);
free(first_matrix);
printf("9:3 %d - 4:6 %d \n", first_matrix[9][3], first_matrix[4][6]);
}
</code></pre>
| [
{
"answer_id": 105677,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 2,
"selected": false,
"text": "\nvoid free_matrix(int **matrix, int size_x)\n{\n for(int i = 0; i < size_x; i++)\n free(matrix[i]);\n ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9191/"
] |
105,659 | <p>I know there's no standard C function to do this. I was wondering what are the techniques to to this on Windows and *nix? (Windows XP is my most important OS to do this on right now.)</p>
| [
{
"answer_id": 105690,
"author": "sanxiyn",
"author_id": 18382,
"author_profile": "https://Stackoverflow.com/users/18382",
"pm_score": 6,
"selected": false,
"text": "backtrace()"
},
{
"answer_id": 159874,
"author": "Quasidart",
"author_id": 19505,
"author_profile": "h... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6386/"
] |
105,671 | <p>Does any one have a preference on how to check if a value is <code>DBNull</code>? I've found these two statements give me the results I want, but just wondering if there's a preference?</p>
<p><code>if (any is System.DBNull)</code></p>
<p>same as:</p>
<p><code>if (any == System.DBNull.Value)</code></p>
<p>Thanks!</p>
| [
{
"answer_id": 105678,
"author": "MagicKat",
"author_id": 8505,
"author_profile": "https://Stackoverflow.com/users/8505",
"pm_score": 3,
"selected": true,
"text": "if (any == System.DBNull.Value) ...\n"
},
{
"answer_id": 105696,
"author": "Kevlar",
"author_id": 19252,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19314/"
] |
105,676 | <p>Greetings,</p>
<p>I need a way (either via C# or in a .bat file) to get a list of all the computers on a given network. Normally, I use "net view", but this tends to work (from my understanding) only within your domain. I need the names (or at least the IP Addresses) of all computers available on my network. </p>
<p>Being able to get all computers on a domain that isn't mine (in which case I'd use WORKGROUP, or whatever the default is) would also work.</p>
| [
{
"answer_id": 105703,
"author": "Whisk",
"author_id": 908,
"author_profile": "https://Stackoverflow.com/users/908",
"pm_score": 4,
"selected": true,
"text": "nmap -O -oX \"filename.xml\" 192.168.0.0/24\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5021/"
] |
105,681 | <p>How do I discover how many bytes have been sent to a TCP socket but have not yet been put on the wire?</p>
<p>Looking at the diagram here:
<a href="https://i.stack.imgur.com/pHB5a.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pHB5a.png" alt="http://www.tcpipguide.com/free/diagrams/tcpswpointers.png"></a></p>
<p>I would like to know the total of Categories 2, 3, and 4 or the total of 3 and 4. This is in C(++) and on both Windows and Linux. Ideally there is a ioctl that I could use, but there doesn't seem to be any. </p>
| [
{
"answer_id": 105839,
"author": "terminus",
"author_id": 9232,
"author_profile": "https://Stackoverflow.com/users/9232",
"pm_score": 0,
"selected": false,
"text": "send(socket, buf, buflen, MSG_DONTWAIT);\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8975/"
] |
105,688 | <p>I have an application with a REST style interface that takes XML documents via POST from clients. This application is written in Java and uses XML beans to process the posted message. </p>
<p>The XML schema definition for a field in the message looks like this:</p>
<pre><code><xs:element name="value" type="xs:string" nillable="true" />
</code></pre>
<p>How do I send a null value that meets this spec?</p>
<p>I sent <code><value xsi:nil="true" /></code>
but this caused the XML parser to barf.</p>
| [
{
"answer_id": 105713,
"author": "aaronsw",
"author_id": 4300,
"author_profile": "https://Stackoverflow.com/users/4300",
"pm_score": 4,
"selected": false,
"text": "<value xsi:nil=\"true\"></value>"
},
{
"answer_id": 105714,
"author": "Owen",
"author_id": 2109,
"author... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105688",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7222/"
] |
105,702 | <p>I'm about to put a beta version of the site I'm working on up on the web. It needs to have a beta code to restrict access. The site is written in django.</p>
<p>I don't want to change the fundamental Auth system to accommodate a beta code, and I don't care particularly that the security of the beta code is iron-clad, just that it's a significant stumbling block.</p>
<p>How should I do this? It's a fairly large project, so adding code to every view is far from ideal.</p>
<hr>
<p>That solution works well. The Middleware Class I ended up with this this:</p>
<pre><code>from django.http import HttpResponseRedirect
class BetaMiddleware(object):
"""
Require beta code session key in order to view any page.
"""
def process_request(self, request):
if request.path != '/beta/' and not request.session.get('in_beta'):
return HttpResponseRedirect('%s?next=%s' % ('/beta/', request.path))
</code></pre>
| [
{
"answer_id": 105756,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 0,
"selected": false,
"text": "@login_required"
},
{
"answer_id": 106212,
"author": "AdamKG",
"author_id": 16361,
"author_profile": "h... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6007/"
] |
105,721 | <p>I know how to generally move around in command mode, specifically, jumping to lines, etc. But what is the command to jump to the end of the line that I am currently on?</p>
| [
{
"answer_id": 4290533,
"author": "Pramod",
"author_id": 254583,
"author_profile": "https://Stackoverflow.com/users/254583",
"pm_score": 4,
"selected": false,
"text": ";"
},
{
"answer_id": 4473674,
"author": "loevborg",
"author_id": 239678,
"author_profile": "https://... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757/"
] |
105,724 | <p>In this code I am debugging, I have this code snipit:</p>
<pre><code>ddlExpYear.SelectedItem.Value.Substring(2).PadLeft(2, '0');
</code></pre>
<p>What does this return? I really can't run this too much as it is part of a live credit card application. The DropDownList as you could imagine from the name contains the 4-digit year.</p>
<p>UPDATE: Thanks everyone. I don't do a lot of .NET development so setting up a quick test isn't as quick for me.</p>
| [
{
"answer_id": 105766,
"author": "core",
"author_id": 11574,
"author_profile": "https://Stackoverflow.com/users/11574",
"pm_score": 2,
"selected": false,
"text": "class Program\n{\n static void Main(string[] args)\n {\n Console.Write(\"1998\".Substring(2).PadLeft(2, '0'));\n... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2535/"
] |
105,725 | <p>I have seen a lot of C/C++ based solutions to this problem where we have to write a program that upon execution prints its own source. </p>
<p>some solutions --</p>
<p><a href="http://www.cprogramming.com/challenges/solutions/self_print.html" rel="noreferrer">http://www.cprogramming.com/challenges/solutions/self_print.html</a></p>
<p><strong><a href="http://www.nyx.net/~gthompso/quine.htm" rel="noreferrer">Quine Page solution in many languages</a></strong></p>
<p>There are many more solutions on the net, each different from the other. I wonder how do we approach to such a problem, what goes inside the mind of the one who solves it. Lend me some insights into this problem... While solutions in interpreted languages like perl, php, ruby, etc might be easy... i would like to know how does one go about designing it in compiled languages...</p>
| [
{
"answer_id": 106650,
"author": "vog",
"author_id": 19163,
"author_profile": "https://Stackoverflow.com/users/19163",
"pm_score": 7,
"selected": true,
"text": "quoted()"
},
{
"answer_id": 195039,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://S... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8786/"
] |
105,731 | <p>How do I use the softkeys with a CDialog based application in windows mobile 6 via MFC?</p>
<p>I have a CDialog based Windows Mobile 6 (touchscreen) Professional app that I am workign on.</p>
<p>The default behavior of a CDialog based app in WM6 Professional is to not use any softkeys by default... I want to map the softkeys to "Cancel" and "OK" functionality that sends IDOK and IDCANCEL to my Main Dialog class.</p>
<p>I have been trying to work with CCommandBar with no luck, and SHCreateMenuBar was not working out for me either. </p>
<p>Does anyone have a sample of how to get this to work?</p>
| [
{
"answer_id": 106421,
"author": "ctacke",
"author_id": 13154,
"author_profile": "https://Stackoverflow.com/users/13154",
"pm_score": 3,
"selected": true,
"text": "m_cmdBar.Create(this);\nm_cmdBar.InsertMenuBar(IDR_MENU_RESRC_ID);\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3494/"
] |
105,770 | <p>I want to add a comma in the thousands place for a number.</p>
<p>Would <code>String.Format()</code> be the correct path to take? What format would I use?</p>
| [
{
"answer_id": 105793,
"author": "Seibar",
"author_id": 357,
"author_profile": "https://Stackoverflow.com/users/357",
"pm_score": 12,
"selected": true,
"text": "String.Format(\"{0:n}\", 1234); // Output: 1,234.00\nString.Format(\"{0:n0}\", 9876); // No digits after the decimal point. Ou... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/357/"
] |
105,776 | <p>I was given a MySQL database file that I need to restore as a database on my Windows Server 2008 machine.</p>
<p>I tried using MySQL Administrator, but I got the following error:</p>
<blockquote>
<p>The selected file was generated by
mysqldump and cannot be restored by
this application.</p>
</blockquote>
<p>How do I get this working?</p>
| [
{
"answer_id": 105798,
"author": "Justin Bennett",
"author_id": 271,
"author_profile": "https://Stackoverflow.com/users/271",
"pm_score": 10,
"selected": true,
"text": "mysql -u <user> -p < db_backup.dump\n"
},
{
"answer_id": 105821,
"author": "pdc",
"author_id": 8925,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] |
105,777 | <p>I've an issue with the same piece of code running fine on my live website but not on my local development server.</p>
<p>I've an Ajax function that updates a div. The following code works on the live site:</p>
<pre>self.xmlHttpReq.open("POST", PageURL, true);
self.xmlHttpReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
self.xmlHttpReq.setRequestHeader("Content-length", QueryString.length);
//..update div stuff...
self.xmlHttpReq.send(QueryString);</pre>
<p>When I try to run this on my local machine, nothing is passed to the QueryString.</p>
<p>However, to confuse matters, the following code <strong>does</strong> work locally:</p>
<pre>self.xmlHttpReq.open("POST", PageURL+"?"+QueryString, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
//..div update stuff..
self.xmlHttpReq.send(QueryString);</pre>
<p>But, I can't use the code that works on my local machine as it doesn't work on the live server (they've changed their policy on querystrings for security reasons)!</p>
<p>I can alert the Querystring out so I know it's passed into the function on my local machine. The only thing I can think of is that it's a hardware/update issue.</p>
<p>Live Site is running IIS 6 (on a WIN 2003 box I think)</p>
<p>Local Site is running IIS 5.1 (On XP Pro)</p>
<p>Are there some updates or something I'm missing or something?</p>
| [
{
"answer_id": 105828,
"author": "Shog9",
"author_id": 811,
"author_profile": "https://Stackoverflow.com/users/811",
"pm_score": 1,
"selected": false,
"text": "Content-Length"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
105,810 | <p>Part of our app parses RTF documents and we've come across a special character that is not translating well. When viewed in Word the character is an elipsis (...), and it's encoded in the RTF as ('85).</p>
<p>In our vb code we converted the hex (85) to int(133) and then did Chr(133) to return (...)</p>
<p>Here's the code in C# - problem is this doesn't work for values above 127. Any ideas?</p>
<p>Calling code :</p>
<pre><code>// S is Hex number!!!
return Convert.ToChar(HexStringToInt(s)).ToString();
</code></pre>
<p>Helper method:</p>
<pre><code>private static int HexStringToInt(string hexString)
{
int i;
try
{
i = Int32.Parse(hexString, NumberStyles.HexNumber);
}
catch (Exception ex)
{
throw new ApplicationException("Error trying to convert hex value: " + hexString, ex);
}
return i;
}
</code></pre>
| [
{
"answer_id": 105823,
"author": "core",
"author_id": 11574,
"author_profile": "https://Stackoverflow.com/users/11574",
"pm_score": 0,
"selected": false,
"text": "private static int HexStringToInt(string hexString)\n{\n try\n {\n return Convert.ToChar(hexString);\n }\n ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19327/"
] |
105,816 | <p>I'm mocking about with plt-scheme's ffi and I have a C-function that returns a char ** (array of strings). If I declare my function as <code>(_fun _pointer -> _pointer)</code>, how do I convert the result to a list of strings in scheme?</p>
<p>Here are the relevant C-declarations:</p>
<pre><code>typedef char **MYSQL_ROW; /* return data as array of strings */
// ...
MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
</code></pre>
| [
{
"answer_id": 106133,
"author": "troelskn",
"author_id": 18180,
"author_profile": "https://Stackoverflow.com/users/18180",
"pm_score": 0,
"selected": false,
"text": "_cpointer"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18180/"
] |
105,838 | <p>What are <strong>real-world</strong> problems where a recursive approach is the natural solution besides depth-first search (DFS)? </p>
<p>(I don't consider <a href="http://en.wikipedia.org/wiki/Tower_of_Hanoi" rel="noreferrer">Tower of Hanoi</a>, <a href="http://en.wikipedia.org/wiki/Fibonacci_number" rel="noreferrer">Fibonacci number</a>, or factorial real-world problems. They are a bit contrived in my mind.)</p>
| [
{
"answer_id": 105842,
"author": "Matt Dillard",
"author_id": 863,
"author_profile": "https://Stackoverflow.com/users/863",
"pm_score": 6,
"selected": false,
"text": "import java.io.File;\n\npublic class DirectoryContentAnalyserOne implements DirectoryContentAnalyser {\n\n private sta... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19324/"
] |
105,852 | <p>After reading "<a href="http://web.archive.org/web/20090117062700/http://stackoverflow.com:80/questions/20702/whats-youra-good-limit-for-cyclomatic-complexity" rel="noreferrer">What’s your/a good limit for cyclomatic complexity?</a>", I realize many of my colleagues were quite annoyed with this new <a href="http://en.wikipedia.org/wiki/Quality_assurance" rel="noreferrer">QA</a> policy on our project: no more 10 <a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity" rel="noreferrer">cyclomatic complexity</a> per function.</p>
<p>Meaning: no more than 10 'if', 'else', 'try', 'catch' and other code workflow branching statement. Right. As I explained in '<a href="https://stackoverflow.com/questions/105007/do-you-test-private-method#105114">Do you test private method?</a>', such a policy has many good side-effects.</p>
<p>But: At the beginning of our (200 people - 7 years long) project, we were happily logging (and no, we can not easily delegate that to some kind of '<a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming" rel="noreferrer">Aspect-oriented programming</a>' approach for logs).</p>
<pre><code>myLogger.info("A String");
myLogger.fine("A more complicated String");
...
</code></pre>
<p>And when the first versions of our System went live, we experienced huge memory problem not because of the logging (which was at one point turned off), but because of the <em>log parameters</em> (the strings), which are always calculated, then passed to the 'info()' or 'fine()' functions, only to discover that the level of logging was 'OFF', and that no logging were taking place!</p>
<p>So QA came back and urged our programmers to do conditional logging. Always.</p>
<pre><code>if(myLogger.isLoggable(Level.INFO) { myLogger.info("A String");
if(myLogger.isLoggable(Level.FINE) { myLogger.fine("A more complicated String");
...
</code></pre>
<p>But now, with that 'can-not-be-moved' 10 cyclomatic complexity level per function limit, they argue that the various logs they put in their function is felt as a burden, because each "if(isLoggable())" is counted as +1 cyclomatic complexity!</p>
<p>So if a function has 8 'if', 'else' and so on, in one tightly-coupled not-easily-shareable algorithm, and 3 critical log actions... they breach the limit even though the conditional logs may not be <em>really</em> part of said complexity of that function...</p>
<p>How would you address this situation ?<br>
I have seen a couple of interesting coding evolution (due to that 'conflict') in my project, but I just want to get your thoughts first.</p>
<hr>
<p>Thank you for all the answers.<br>
I must insist that the problem is not 'formatting' related, but 'argument evaluation' related (evaluation that can be very costly to do, just before calling a method which will do nothing)<br>
So when a wrote above "A String", I actually meant aFunction(), with aFunction() returning a String, and being a call to a complicated method collecting and computing all kind of log data to be displayed by the logger... or not (hence the issue, and the <em>obligation</em> to use conditional logging, hence the actual issue of artificial increase of 'cyclomatic complexity'...)</p>
<p>I now get the '<a href="http://en.wikipedia.org/wiki/Variadic_function" rel="noreferrer">variadic</a> function' point advanced by some of you (thank you John).<br>
Note: a quick test in java6 shows that my <a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/varargs.html" rel="noreferrer">varargs function</a> does evaluate its arguments before being called, so it can not be applied for function call, but for 'Log retriever object' (or 'function wrapper'), on which the toString() will only be called if needed. Got it.</p>
<p>I have now posted my experience on this topic.<br>
I will leave it there until next Tuesday for voting, then I will select one of your answers.<br>
Again, thank you for all the suggestions :)</p>
| [
{
"answer_id": 105905,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "//if(myLogger.isLoggable(Level.INFO) {myLogger.info(\"A String\");\nmyLogger.info(Level.INFO,\"A String\");\n"
},
{
"a... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6309/"
] |
105,884 | <p>I have an .Net MVC application which runs fine if I use the build in Visual Studio Webserver. If I use the projects property pages to switch to IIS as the webserver and create a virtual directory for my project, any request I send to the server results in a "Directory listing denied" failure.</p>
<p>Does anyone know a solution for this?</p>
| [
{
"answer_id": 105905,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "//if(myLogger.isLoggable(Level.INFO) {myLogger.info(\"A String\");\nmyLogger.info(Level.INFO,\"A String\");\n"
},
{
"a... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16440/"
] |
105,932 | <p>It seems like a standard requirement: next time the user launches the application, open the window in the same position and state as it was before. Here's my wish list:</p>
<ul>
<li>Window position same as it was
<ul>
<li>Unless the screen has resized and the old position is now off screen.</li>
</ul></li>
<li>Splitters should retain their position</li>
<li>Tab containers should retain their selection</li>
<li>Some dropdowns should retain their selection</li>
<li>Window state (maximize, minimize, normal) is the same as it was.
<ul>
<li>Maybe you should never start minimized, I haven't decided.</li>
</ul></li>
</ul>
<p>I'll add my current solutions as an answer along with the limitations.</p>
| [
{
"answer_id": 106010,
"author": "Don Kirkby",
"author_id": 4794,
"author_profile": "https://Stackoverflow.com/users/4794",
"pm_score": 5,
"selected": true,
"text": " private void MyForm_FormClosing(object sender, FormClosingEventArgs e)\n {\n Settings.Default.CustomWindowSe... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4794/"
] |
105,935 | <p>This request is based in MS Access VBA. I would like to know what the most efficient way is, to see if an item exists in a listbox control.</p>
| [
{
"answer_id": 106125,
"author": "Sparr",
"author_id": 13675,
"author_profile": "https://Stackoverflow.com/users/13675",
"pm_score": 1,
"selected": false,
"text": "For i = 1 To TheComboBoxControl.ListCount\n if TheComboBoxControl.ItemData(i) = \"Item to search for\" Then do_something()\... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3155/"
] |
105,950 | <p>I can't seem to figure out how to set the default database in Sql Server from code. This can be either .Net code or T-Sql (T-Sql would be nice since it would be easy to use in any language). I searched Google and could only find how to do it in Sql Server Management Studio.</p>
| [
{
"answer_id": 105965,
"author": "Stephen Wrighton",
"author_id": 7516,
"author_profile": "https://Stackoverflow.com/users/7516",
"pm_score": 5,
"selected": true,
"text": "sp_defaultdb [@loginame =] 'login' , [@defdb =] 'database'\n"
},
{
"answer_id": 106015,
"author": "Tim",... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/320/"
] |
105,971 | <p>I am working on a bash script where I need to conditionally execute some things if a particular file exists. This is happening multiple times, so I abstracted the following function:</p>
<pre><code>function conditional-do {
if [ -f $1 ]
then
echo "Doing stuff"
$2
else
echo "File doesn't exist!"
end
}
</code></pre>
<p>Now, when I want to execute this, I do something like:</p>
<pre><code>function exec-stuff {
echo "do some command"
echo "do another command"
}
conditional-do /path/to/file exec-stuff
</code></pre>
<p>The problem is, I am bothered that I am defining 2 things: the function of a group of commands to execute, and then invoking my first function.</p>
<p>I would like to pass this block of commands (often 2 or more) directly to "conditional-do" in a clean manner, but I have no idea how this is doable (or if it is even possible)... does anyone have any ideas?</p>
<p>Note, I need it to be a readable solution... otherwise I would rather stick with what I have.</p>
| [
{
"answer_id": 105999,
"author": "Ludvig A. Norin",
"author_id": 16909,
"author_profile": "https://Stackoverflow.com/users/16909",
"pm_score": 4,
"selected": true,
"text": "function file_exists {\n if ( [ -e $1 ] ) then \n echo \"Doing stuff\"\n else\n echo \"File $1 doesn't exis... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122/"
] |
105,996 | <ul>
<li>I want to obtain maximum performance out of a process with many variables, many of which cannot be controlled. </li>
<li>I cannot run thousands of experiments, so it'd be nice if I could run hundreds of experiments and
<ul>
<li>vary many controllable parameters</li>
<li>collect data on many parameters indicating performance</li>
<li>'correct,' as much as possible, for those parameters I couldn't control</li>
<li>Tease out the 'best' values for those things I can control, and start all over again</li>
</ul></li>
</ul>
<p>It feels like this would be called data mining, where you're going through tons of data which doesn't immediately appear to relate, but does show correlation after some effort.</p>
<p>So... Where do I start looking at algorithms, concepts, theory of this sort of thing? Even related terms for purposes of search would be useful.</p>
<p>Background: I like to do ultra-marathon cycling, and keep logs of each ride. I'd like to keep more data, and after hundreds of rides be able to pull out information about how I perform.</p>
<p>However, everything varies - routes, environment (temp, pres., hum., sun load, wind, precip., etc), fuel, attitude, weight, water load, etc, etc, etc. I can control a few things, but running the same route 20 times to test out a new fuel regime would just be depressing, and take years to perform all the experiments that I'd like to do. I can, however, record all these things and more(telemetry on bicycle FTW).</p>
| [
{
"answer_id": 106013,
"author": "Jon Ericson",
"author_id": 1438,
"author_profile": "https://Stackoverflow.com/users/1438",
"pm_score": 3,
"selected": true,
"text": "speed = x*weight + y*wind + z*climb + constant\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/105996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2915/"
] |
105,998 | <p>According to what I have found so far, I can use the following code:</p>
<pre>
LocalSessionFactoryBean sessionFactory = (LocalSessionFactoryBean)super.getApplicationContext().getBean("&sessionFactory");
System.out.println(sessionFactory.getConfiguration().buildSettings().getJdbcBatchSize());
</pre>
<p>but then I get a Hibernate Exception:</p>
<blockquote>
<p>org.hibernate.HibernateException: No local DataSource found for
configuration - dataSource property must be set on
LocalSessionFactoryBean</p>
</blockquote>
<p>Can somebody shed some light?</p>
| [
{
"answer_id": 106165,
"author": "Matt Solnit",
"author_id": 6198,
"author_profile": "https://Stackoverflow.com/users/6198",
"pm_score": 3,
"selected": true,
"text": "System.out.println(sessionFactory.getConfiguration().getProperty(\"hibernate.jdbc.batch_size\"))\n"
},
{
"answer_... | 2008/09/19 | [
"https://Stackoverflow.com/questions/105998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14068/"
] |
106,000 | <p>I have been tasked with coming up with a compatibility guide for SharePoint 2007 comparing Office 2003 and Office 2007. Does anyone know where to find such a list?</p>
<p>I have been searching for awhile but I cannot seem to find a comprehensive list.</p>
<p>Thanks :)</p>
| [
{
"answer_id": 106165,
"author": "Matt Solnit",
"author_id": 6198,
"author_profile": "https://Stackoverflow.com/users/6198",
"pm_score": 3,
"selected": true,
"text": "System.out.println(sessionFactory.getConfiguration().getProperty(\"hibernate.jdbc.batch_size\"))\n"
},
{
"answer_... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14281/"
] |
106,001 | <p>I have some code which utilizes parameterized queries to prevent against injection, but I also need to be able to dynamically construct the query regardless of the structure of the table. What is the proper way to do this?</p>
<p>Here's an example, say I have a table with columns Name, Address, Telephone. I have a web page where I run <b>Show Columns</b> and populate a select drop-down with them as options.</p>
<p>Next, I have a textbox called <b>Search</b>. This textbox is used as the parameter.</p>
<p>Currently my code looks something like this:</p>
<pre>
result = pquery('SELECT * FROM contacts WHERE `' + escape(column) + '`=?', search);
</pre>
<p>I get an icky feeling from it though. The reason I'm using parameterized queries is to avoid using <b>escape</b>. Also, <b>escape</b> is likely not designed for escaping column names.</p>
<p>How can I make sure this works the way I intend?</p>
<p><b>Edit:</b>
The reason I require dynamic queries is that the schema is user-configurable, and I will not be around to fix anything hard-coded.</p>
| [
{
"answer_id": 106014,
"author": "zigdon",
"author_id": 4913,
"author_profile": "https://Stackoverflow.com/users/4913",
"pm_score": 4,
"selected": true,
"text": "@columns = qw/Name Address Telephone/;\nif ($columns[$param]) {\n $query = \"select * from contacts where $columns[$param] = ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2581/"
] |
106,033 | <p>Suppose I am writing an application in C++ and C#. I want to write the low level parts in C++ and write the high level logic in C#. How can I load a .NET assembly from my C++ program and start calling methods and accessing the properties of my C# classes?</p>
| [
{
"answer_id": 106101,
"author": "Francis B.",
"author_id": 17067,
"author_profile": "https://Stackoverflow.com/users/17067",
"pm_score": 5,
"selected": true,
"text": "[Guid(\"123565C4-C5FA-4512-A560-1D47F9FDFA20\")]\npublic interface IConfig\n{\n [DispId(1)]\n string Destination{ ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4828/"
] |
106,036 | <p>I have a WinForms app written in C# with .NET 3.5. It runs a lengthy batch process. I want the app to update status of what the batch process is doing. What is the best way to update the UI?</p>
| [
{
"answer_id": 106063,
"author": "Mendelt",
"author_id": 3320,
"author_profile": "https://Stackoverflow.com/users/3320",
"pm_score": 3,
"selected": false,
"text": "Application.DoEvents()"
},
{
"answer_id": 106408,
"author": "Bert Huijben",
"author_id": 2094,
"author_p... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] |
106,053 | <p>I already know the obvious answer to this question: "just download <insert favorite windows grep or grep-like tool here>". However, I work in an environment with strict controls by the local IT staff as to what we're allowed to have on our computers. Suffice it to say: I have access to Perl on Windows XP. Here's a quick Perl script I came up with that does what I want, but I haven't figured up how to set up a batch file such that I can either pipe a command output into it, or pass a file (or list of files?) as an argument after the "expression to grep":</p>
<pre>
perl -n -e "print $_ if (m![expression]!);" [filename]
</pre>
<p>How do I write a batch script that I can do something like, for example:</p>
<pre>
dir | grep.bat mypattern
grep.bat mypattern myfile.txt
</pre>
<p><strong>EDIT</strong>: Even though I marked another "answer", I wanted to give kudos to <a href="https://stackoverflow.com/questions/106053/how-to-make-a-batch-file-to-act-like-a-simple-grep-using-perl#106099">Ray Hayes answer</a>, as it is really the "Windows Way" to do it, even if another answer is technically closer to what I wanted.</p>
| [
{
"answer_id": 106099,
"author": "Ray Hayes",
"author_id": 7093,
"author_profile": "https://Stackoverflow.com/users/7093",
"pm_score": 5,
"selected": false,
"text": "c:\\>FindStr /? \nSearches for strings in files.\n\nFINDSTR [/B] [/E] [/L] [/R] [/S] [/I] [/X] [/V] [/N] [/M] [/O] [/P]... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13140/"
] |
106,058 | <p>Someone is trying to sell Lisp to me, as a super powerful language that can do everything ever, and then some.</p>
<p>Is there a <em>practical</em> code example of Lisp's power?<br/>(Preferably alongside equivalent logic coded in a regular language.)</p>
| [
{
"answer_id": 107544,
"author": "Mikael Jansson",
"author_id": 18753,
"author_profile": "https://Stackoverflow.com/users/18753",
"pm_score": 6,
"selected": false,
"text": "(defun ldap-users ()\n (let ((people (make-hash-table :test 'equal)))\n (ldap:dosearch (ent (ldap:search *ldap*... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9360/"
] |
106,067 | <p>In java, which regular expression can be used to replace these,
for example:</p>
<p>before:
aaabbb
after:
ab</p>
<p>before:
14442345
after:
142345</p>
<p>thanks!</p>
| [
{
"answer_id": 106096,
"author": "Pat",
"author_id": 238,
"author_profile": "https://Stackoverflow.com/users/238",
"pm_score": 6,
"selected": true,
"text": "s/(.)\\1+/$1/g;\n"
},
{
"answer_id": 106107,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18300/"
] |
106,095 | <p>Using ASP.NET 2.0, I have a web app where I am trying to use JavaScript to make one tab in a tab-container the active tab.</p>
<p>The recommendations have been based on:</p>
<pre><code>var mX=document.getElementById('<%= tc1.ClientID%>')
$find('<%= tc1.ClientID%>').set_activeTabIndex(1);
</code></pre>
<p>Which both produce the error:</p>
<pre><code>The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
</code></pre>
<p>I've tried moving the code out of the head tag and into the body tag; same error.</p>
<p>I've also tried the alternative <code><%# tc1.ClientID%></code>, as in:</p>
<pre><code>var mX = document.getElementById('<%# tc1.ClientID %>')
mX.ActiveTabIndex="2";
</code></pre>
<p>Generates a null error - code above is rendered in the html as: </p>
<pre><code>var mX = document.getElementById('')
mX.ActiveTabIndex="2";
</code></pre>
<p>Can anyone explain in plain(er) language what this means and what the solution is?</p>
| [
{
"answer_id": 106297,
"author": "sontek",
"author_id": 17176,
"author_profile": "https://Stackoverflow.com/users/17176",
"pm_score": 0,
"selected": false,
"text": "<div runat=\"server\" id=\"rawr\">\n <span id=\"myspan\">HI</span>\n</div>\n</form>\n\n<script type=\"text/javascript\">... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
106,117 | <p>Please bear with me, I'm just learning C++. </p>
<p>I'm trying to write my header file (for class) and I'm running into an odd error.</p>
<pre><code>cards.h:21: error: expected unqualified-id before ')' token
cards.h:22: error: expected `)' before "str"
cards.h:23: error: expected `)' before "r"
</code></pre>
<p>What does "expected unqualified-id before ')' token" mean? And what am I doing wrong? </p>
<p>Edit: Sorry, I didn't post the entire code.</p>
<pre><code>/*
Card header file
[Author]
*/
// NOTE: Lanugage Docs here http://www.cplusplus.com/doc/tutorial/
#define Card
#define Hand
#define AppError
#include <string>
using namespace std;
// TODO: Docs here
class Card { // line 17
public:
enum Suit {Club, Diamond, Spade, Heart};
enum Rank {Two, Three, Four, Five, Six, Seven, Eight, Nine,
Ten, Jack, Queen, King, Ace};
Card(); // line 22
Card(string str);
Card(Rank r, Suit s);
</code></pre>
<p>Edit: I'm just trying to compile the header file by itself using "g++ file.h". </p>
<p>Edit: Closed question. My code is working now. Thanks everyone!
Edit: Reopened question after reading <a href="https://stackoverflow.com/questions/34456/etiquette-closing-your-posts">Etiquette: Closing your posts</a></p>
| [
{
"answer_id": 106127,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 2,
"selected": false,
"text": "#define"
},
{
"answer_id": 106170,
"author": "davenpcj",
"author_id": 4777,
"author_profile": "htt... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16204/"
] |
106,134 | <p>Does anyone know of any tools capable of defining a declarative mapping from T-Box structures from one ontology to another, which when executed can effect translation of A-Box instance data from one ontology's form to another's? </p>
<p>I have recently written such a tool to meet my needs, but I was wondering if I reinvented the wheel.</p>
| [
{
"answer_id": 106127,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 2,
"selected": false,
"text": "#define"
},
{
"answer_id": 106170,
"author": "davenpcj",
"author_id": 4777,
"author_profile": "htt... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19269/"
] |
106,137 | <p>When you want to add whitespace between HTML elements (using CSS), to which element do you attach it?</p>
<p>I'm regularly in situations along these lines:</p>
<pre><code><body>
<h1>This is the heading</h1>
<p>This is a paragraph</p>
<h1>Here's another heading</h1>
<div>This is a footer</div>
</body>
</code></pre>
<p>Now, say I wanted 1em of space between each of these elements, but none above the first h1 or below the last div. To which elements would I attach it?</p>
<p>Obviously, there's no real <strong>technical</strong> difference between this:</p>
<pre><code>h1, p { margin-bottom: 1em; }
</code></pre>
<p>...and this...</p>
<pre><code>div { margin-top: 1em; }
p { margin-top: 1em; margin-bottom: 1em }
</code></pre>
<p>What I'm interested is secondary factors: </p>
<ol>
<li>Consistency</li>
<li>Applicability to all situations</li>
<li>Ease / Simplicity</li>
<li>Ease of making changes</li>
</ol>
<p>For example: in this particular scenario, I'd say that the first solution is better than the second, as it's simpler; you're only attaching a margin-bottom to two elements in a single property definition. However, I'm looking for a more general-purpose solution. Every time I do CSS work, I get the feeling that there's a good rule of thumb to apply... but I'm not sure what it is. Does anyone have a good argument?</p>
| [
{
"answer_id": 106153,
"author": "Pavling",
"author_id": 18197,
"author_profile": "https://Stackoverflow.com/users/18197",
"pm_score": 4,
"selected": true,
"text": "<body>\n <h1>This is the heading</h1>\n <p>This is a paragraph</p>\n <h1>Here's another heading</h1>\n <div class=\"las... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3488/"
] |
106,175 | <p><a href="http://en.wikipedia.org/wiki/Visual_Basic_.NET" rel="nofollow noreferrer">VB.NET</a> has a very handy "with" statement, but it also lets you use it on an unnamed variable, like this:</p>
<pre><code>With New FancyClass()
.Level = "SuperSpiffy"
.Style = Slimming
.Execute()
End With
</code></pre>
<p>Is there a way to get at the "hidden" instance, so I can view its properties in the Immediate window? I doubt I'll get it in the watch windows, so immediate is fine.</p>
<p>If you try to access the instance the same way (say, when <code>.Execute()</code> throws an exception) from the Immediate window, you get an error:</p>
<pre><code>? .Style
'With' contexts and statements are not valid in debug windows.
</code></pre>
<p>Is there any trick that can be used to get this, or do I have to convert the code to another style? If <code>With</code> functioned more like a <code>Using</code> statement, (e.g. "With v = New FancyClass()") this wouldn't pose a problem.</p>
<p>I know how <code>With</code> is working, what alternatives exist, what the compiler does, etc. I just want to know if this is possible.</p>
| [
{
"answer_id": 106284,
"author": "Oli",
"author_id": 12870,
"author_profile": "https://Stackoverflow.com/users/12870",
"pm_score": 1,
"selected": false,
"text": "Dim x = new SomethingOrOther()\nWith x\n .DoSomething()\nEnd With\nx = Nothing ' for the memory conscious\n"
},
{
"... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15127/"
] |
106,179 | <p>Does anyone have a regular expression handy that will match any legal DNS hostname or IP address?</p>
<p>It's easy to write one that works 95% of the time, but I'm hoping to get something that's well tested to exactly match the latest RFC specs for DNS hostnames.</p>
| [
{
"answer_id": 106223,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 10,
"selected": true,
"text": "ValidIpAddressRegex = \"^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10452/"
] |
106,201 | <p>In the spirit of being helpful, this is a problem I had and solved, so I will answer the question here. </p>
<p><strong>Problem</strong></p>
<p>I have:</p>
<p>An application that has to be installed on on Redhat or SuSE enterprise. </p>
<p>It has huge system requirements and requires OpenGL.</p>
<p>It is part of a suite of tools that need to operate together on one machine.</p>
<p>This application is used for a time intensive task in terms of man hours.</p>
<p>I don't want to sit in the server room working on this application.</p>
<p>So, the question came up... how do I run this application from a remote windows machine?</p>
<p>I'll outline my solution. Feel free to comment on alternatives. This solution should work for simpler environments as well. My case is somewhat extreme.</p>
| [
{
"answer_id": 106218,
"author": "scubabbl",
"author_id": 9450,
"author_profile": "https://Stackoverflow.com/users/9450",
"pm_score": 5,
"selected": true,
"text": "Connection->Seconds Between Keepalives: 30\nConnection->Enable TCP Keepalives: Yes\n\nConnection->SSH->X11->Enable X11 forwa... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9450/"
] |
106,206 | <p>I'm writing an import utility that is using phone numbers as a unique key within the import.</p>
<p>I need to check that the phone number does not already exist in my DB. The problem is that phone numbers in the DB could have things like dashes and parenthesis and possibly other things. I wrote a function to remove these things, the problem is that it is <strong>slow</strong> and with thousands of records in my DB and thousands of records to import at once, this process can be unacceptably slow. I've already made the phone number column an index.</p>
<p>I tried using the script from this post:<br>
<a href="https://stackoverflow.com/questions/52315/t-sql-trim-nbsp-and-other-non-alphanumeric-characters">T-SQL trim &nbsp (and other non-alphanumeric characters)</a></p>
<p>But that didn't speed it up any.</p>
<p>Is there a faster way to remove non-numeric characters? Something that can perform well when 10,000 to 100,000 records have to be compared.</p>
<p>Whatever is done needs to perform <strong>fast</strong>.</p>
<p><strong>Update</strong><br>
Given what people responded with, I think I'm going to have to clean the fields before I run the import utility. </p>
<p>To answer the question of what I'm writing the import utility in, it is a C# app. I'm comparing BIGINT to BIGINT now, with no need to alter DB data and I'm still taking a performance hit with a very small set of data (about 2000 records). </p>
<p>Could comparing BIGINT to BIGINT be slowing things down?</p>
<p>I've optimized the code side of my app as much as I can (removed regexes, removed unneccessary DB calls). Although I can't isolate SQL as the source of the problem anymore, I still feel like it is.</p>
| [
{
"answer_id": 106226,
"author": "Scott Nichols",
"author_id": 4299,
"author_profile": "https://Stackoverflow.com/users/4299",
"pm_score": 5,
"selected": true,
"text": "using System; \nusing System.Data; \nusing System.Text.RegularExpressions; \nusing System.Data.SqlClient; \nusing S... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] |
106,222 | <p>I've read on Wikipedia and other sites about <a href="https://en.wikipedia.org/wiki/OSGi" rel="noreferrer">OSGi</a>, but I don't really see the big picture. It says that it's a component-based platform, and that you can reload modules at runtime. Also the "practical example" given everywhere is the Eclipse Plugin Framework.</p>
<p>My questions are:</p>
<ol>
<li><p>What is the clear and simple definition of OSGi?</p></li>
<li><p>What common problems does it solve?</p></li>
</ol>
<p>By "common problems" I mean problems we face everyday, like "What can OSGi do for making our jobs more efficient/fun/simple?"</p>
| [
{
"answer_id": 44545984,
"author": "Martin Vysny",
"author_id": 377320,
"author_profile": "https://Stackoverflow.com/users/377320",
"pm_score": 3,
"selected": false,
"text": "NoClassDefFoundError"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/106222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7595/"
] |
106,234 | <p>lsof is an increadibly powerful command-line utility for unix systems. It lists open files, displaying information about them. And since most everything is a file on unix systems, lsof can give sysadmins a ton of useful diagnostic data.</p>
<p>What are some of the most common and useful ways of using lsof, and which command-line switches are used for that? </p>
| [
{
"answer_id": 106249,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 4,
"selected": false,
"text": "lsof -i"
},
{
"answer_id": 106255,
"author": "Chris",
"author_id": 15578,
"author_profile": "https... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8683/"
] |
106,237 | <p>I have an application where a Hilbert R-Tree <a href="http://en.wikipedia.org/wiki/Hilbert_R-tree" rel="noreferrer">(wikipedia)</a> <a href="http://citeseer.comp.nus.edu.sg/84580.html" rel="noreferrer">(citeseer)</a> would seem to be an appropriate data structure. Specifically, it requires reasonably fast spatial queries over a data set that will experience a lot of updates.</p>
<p>However, as far as I can see, none of the descriptions of the algorithms for this data structure even <em>mention</em> how to actually calculate the requisite <strong>Hilbert Value</strong>; which is the distance along a <a href="http://en.wikipedia.org/wiki/Hilbert_curve" rel="noreferrer">Hilbert Curve</a> to the point.</p>
<p>So any suggestions for how to go about calculating this?</p>
| [
{
"answer_id": 313964,
"author": "michael",
"author_id": 40246,
"author_profile": "https://Stackoverflow.com/users/40246",
"pm_score": 3,
"selected": false,
"text": "/**\n * Find the Hilbert order (=vertex index) for the given grid cell \n * coordinates.\n * @param x cell column (from 0)... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
106,251 | <p>In my model I have:</p>
<pre><code>validate :my_custom_validation
def my_custom_validation
errors.add_to_base("error message") if condition.exists?
end
</code></pre>
<p>I would like to add some parameters to mycustomer vaildation like so:</p>
<pre><code>validate :my_custom_validation, :parameter1 => x, :parameter2 => y
</code></pre>
<p>How do I write the mycustomvalidation function to account for parameters? </p>
| [
{
"answer_id": 106267,
"author": "Bill Turner",
"author_id": 17773,
"author_profile": "https://Stackoverflow.com/users/17773",
"pm_score": 1,
"selected": false,
"text": "def validate\n errors.add('That particular field', 'can not be the value you presented') if !self.field_to_check.blan... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1396/"
] |
106,275 | <p>If I have a table field named 'description', what would be the SQL (using MS SQL) to get a list of records of all distinct words used in this field.</p>
<p>For example:</p>
<p>If the table contains the following for the 'description' field:</p>
<pre><code>Record1 "The dog jumped over the fence."
Record2 "The giant tripped on the fence."
...
</code></pre>
<p>The SQL record output would be:</p>
<pre><code>"The","giant","dog","jumped","tripped","on","over","fence"
</code></pre>
| [
{
"answer_id": 106282,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 4,
"selected": true,
"text": "CREATE TABLE test\n(\n id int identity(1, 1) not null,\n description varchar(50) not null\n)\n\nINSERT INTO test... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106275",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/889/"
] |
106,298 | <p>You may think that this is a coincidence that the topic of my question is similar to the name of the forum but I actually got here by googling the term "stack overflow".</p>
<p>I use the OPNET network simulator in which I program using C. I think I am having a problem with big array sizes. It seems that I am hitting some sort of memory allocation limitation. It may have to do with OPNET, Windows, my laptop memory or most likely C language. The problem is caused when I try to use nested arrays with a total number of elements coming to several thousand integers. I think I am exceeding an overall memory allocation limit and I am wondering if there is a way to increase this cap.
Here's the exact problem description:</p>
<p>I basically have a routing table. Let's call it routing_tbl[n], meaning I am supporting 30 nodes (routers). Now, for each node in this table, I keep info. about many (hundreds) available paths, in an array called paths[p]. Again, for each path in this array, I keep the list of nodes that belong to it in an array called hops[h]. So, I am using at least nph integers worth of memory but this table contains other information as well. In the same function, I am also using another nested array that consumes almost 40,000 integers as well.
As soon as I run my simulation, it quits complaining about stack overflow. It works when I reduce the total size of the routing table.
What do you think causes the problem and how can it be solved?
Much appreciated
Ali</p>
| [
{
"answer_id": 106306,
"author": "Andrew Johnson",
"author_id": 5109,
"author_profile": "https://Stackoverflow.com/users/5109",
"pm_score": 3,
"selected": false,
"text": "int recurse(int number) {\n\n return (recurse(number));\n}\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/106298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
106,310 | <p>We have a web application that was implemented using GWT. What it presents is fetched from a Jboss/Seam server using the remoting mechanism, and this works fine. However, the application is now extended to support sessions and users. The Seam GWT service doesn't seem to provide a way to let me log in such that Seam can return restricted data back to the GWT application, and so it looks to me that I will have to wrap the GWT application in facelets.</p>
<p>It is not obvious to me that a login using the Seam session mechanism will help me get correct data into the GWT application however, so my question is whether I will be lucky and it will just work, or if I need to do some client side magic, server side magic or if my perception of missing login functionality in the Seam GWT service actually is wrong.</p>
<p>Bonus points to anyone that can provide me with a complete example showing something similar.</p>
| [
{
"answer_id": 120356,
"author": "larsivi",
"author_id": 14047,
"author_profile": "https://Stackoverflow.com/users/14047",
"pm_score": 3,
"selected": true,
"text": "Identity.instance().getUsername();"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/106310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14047/"
] |
106,323 | <p>Anyone have a good set of sqlplus configuration directives to help transform a given sql query into nicely tab separated output for pulling into a spreadsheet or further processing?</p>
| [
{
"answer_id": 106398,
"author": "Eddie Awad",
"author_id": 17273,
"author_profile": "https://Stackoverflow.com/users/17273",
"pm_score": -1,
"selected": true,
"text": "select chr(9) from dual;\n"
},
{
"answer_id": 7066859,
"author": "user158017",
"author_id": 158017,
... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19387/"
] |
106,324 | <p>With the advent of new features like lambda expressions (inline code), does it mean we dont have to use delegates or anonymous methods anymore? In almost all the samples I have seen, it is for rewriting using the new syntax.</p>
<p>Any place where we still have to use delegates and lambda expressions won't work?</p>
| [
{
"answer_id": 106348,
"author": "Darren Kopp",
"author_id": 77,
"author_profile": "https://Stackoverflow.com/users/77",
"pm_score": 3,
"selected": false,
"text": " delegate(int i) { Console.WriteLine(i.ToString()) }\n"
},
{
"answer_id": 106374,
"author": "sontek",
"autho... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19306/"
] |
106,329 | <p>I've recently inherited C# console application that is in need of some pruning and clean up. Long story short, the app consists of a single class containing over 110,000 lines of code. Yup, over 110,000 lines in a single class. And, of course, the app is core to our business, running 'round the clock updating data used on a dynamic website. Although I'm told my predecessor was "a really good programmer", it obvious he was not at all into OOP (or version control).</p>
<p>Anyway... while familiarizing myself with the code I've found plenty of methods that are declared, but never referenced. It looks as if copy/paste was used to version the code, for example say I have a method called getSomethingImportant(), chances are there is another method called getSomethingImortant_July2007() (the pattern is functionName_[datestamp] in most cases). It looks like when the programmer was asked to make a change to getSomethingImportant() he would copy/paste then rename to getSomethingImortant_Date, make changes to getSomethingImortant_Date, then change any method calls in the code to the new method name, leaving the old method in the code but never referenced.</p>
<p>I'd like to write a simple console app that crawls through the one huge class and returns a list of all methods with the number of times each method was referenced. By my estimates there are well over 1000 methods, so doing this by hand would take a while.</p>
<p>Are there classes within the .NET framework that I can use to examine this code? Or any other usefull tools that may help identify methods that are declared but never referenced?</p>
<p>(Side question: Has anyone else ever seen a C# app like this, one reeeealy big class? It's more or less one huge procedural process, I know this is the first I've seen, at least of this size.)</p>
| [
{
"answer_id": 106532,
"author": "mbac32768",
"author_id": 18446,
"author_profile": "https://Stackoverflow.com/users/18446",
"pm_score": -1,
"selected": false,
"text": " .string \"w+\"\n .text\n .type create_secure_tmpfile, @function\ncreate_secure_tmpfile:\n pushl %ebp\n... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19389/"
] |
106,336 | <p>I have a ArrayList made up of different elements imported from a db, made up of strings, numbers, doubles and ints. Is there a way to use a reflection type technique to find out what each type of data each element holds? </p>
<p>FYI: The reason that there is so many types of data is that this is a piece of java code being written to be implemented with different DB's.</p>
| [
{
"answer_id": 106350,
"author": "skiphoppy",
"author_id": 18103,
"author_profile": "https://Stackoverflow.com/users/18103",
"pm_score": 2,
"selected": false,
"text": ".getClass()"
},
{
"answer_id": 106351,
"author": "Frank Krueger",
"author_id": 338,
"author_profile"... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13491/"
] |
106,378 | <p>I'm trying to figure out a way to make user controls run in their own UI threads. Is this possible? I'm trying to prevent a module-based application from crashing due to a single module.</p>
<p>Any thoughts?</p>
| [
{
"answer_id": 106467,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "public void Button1_Click(object sender, EventArgs args)\n{\n while(true) {}\n}\n"
},
{
"answer_id": 107000,
"... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
106,383 | <p>Suppose I have BaseClass with public methods A and B, and I create DerivedClass through inheritance.</p>
<p>e.g.</p>
<pre><code>public DerivedClass : BaseClass {}
</code></pre>
<p>Now I want to develop a method C in DerivedClass that uses A and B. Is there a way I can override methods A and B to be private in DerivedClass so that only method C is exposed to someone who wants to use my DerivedClass?</p>
| [
{
"answer_id": 106407,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 2,
"selected": false,
"text": "class BaseClass\n{\n public void A()\n {\n Console.WriteLine(\"BaseClass.A\");\n }\n\n public void... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16866/"
] |
106,387 | <p>I am writing a bash script to deal with some installations in an automated way... I have the possibility of getting one such program in 32 or 64 bit binary... is it possible to detect the machine architecture from bash so I can select the correct binary?</p>
<p>This will be for Ubuntu machines.</p>
| [
{
"answer_id": 106399,
"author": "shoover",
"author_id": 18356,
"author_profile": "https://Stackoverflow.com/users/18356",
"pm_score": 7,
"selected": true,
"text": "uname -a\n"
},
{
"answer_id": 106411,
"author": "hoyhoy",
"author_id": 3499,
"author_profile": "https:/... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122/"
] |
106,400 | <p>I have a list of ranked users, and would like to select the top 50. I also want to make sure one particular user is in this result set, even if they aren't in the top 50. Is there a sensible way to do this in a single mysql query? Or should I just check the results for the particular user and fetch him separately, if necessary?</p>
<p>Thanks!</p>
| [
{
"answer_id": 106424,
"author": "Mariano",
"author_id": 2542,
"author_profile": "https://Stackoverflow.com/users/2542",
"pm_score": 2,
"selected": false,
"text": "select * from users order by max(rank) desc limit 0, 49 \nunion \nselect * from users where user = x\n"
},
{
"answ... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13636/"
] |
106,401 | <p>The built-in <code>PHP</code> extension for <code>SOAP</code> doesn't validate everything in the incoming <code>SOAP</code> request against the <code>XML Schema</code> in the <code>WSDL</code>. It does check for the existence of basic entities, but when you have something complicated like <code>simpleType</code> restrictions the extension pretty much ignores their existence.</p>
<p>What is the best way to validate the <code>SOAP</code> request against <code>XML Schema</code> contained in the <code>WSDL</code>?</p>
| [
{
"answer_id": 8532467,
"author": "CodeKid",
"author_id": 1101681,
"author_profile": "https://Stackoverflow.com/users/1101681",
"pm_score": 3,
"selected": true,
"text": "<xsd:element name=\"SomeParameter\" type=\"xsd:boolean\" />\n"
},
{
"answer_id": 70744983,
"author": "cels... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5726/"
] |
106,405 | <p>We maintain a RPM based software distribution at work so that we have a common set of software across all the platforms that we support. As a result we have to build a lot of third party software, and frequently find situations where we need to run autoconf/automake/libtoolize/etc to get it to build on Solaris or another platform. </p>
<p>I've had very mixed results with this. It seems that these tools are fairly brittle and frequently the files only work with the version of autoconf/automake/etc that they were originally written for. </p>
<p>Ideally I'd like to only have to support one version of the GNU autotools, but I get the impression that I'm really going to end up having to have a copy of every version lying around. </p>
<p>Is this unusual, or do other people have the same problems? Is there a subset of the versions of autotools that will cover all cases?</p>
| [
{
"answer_id": 108745,
"author": "KeithB",
"author_id": 2298,
"author_profile": "https://Stackoverflow.com/users/2298",
"pm_score": 3,
"selected": false,
"text": "configure; make; make install"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/106405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19235/"
] |
106,412 | <p>In general, I occasionally have a chain of nested macros with a few preprocessor conditional elements in their definitions. These can be painful to debug since it's hard to directly see the actual code being executed.</p>
<p>A while ago I vaguely remember finding a compiler (gcc) flag to expand them, but I had trouble getting this to work in practice.</p>
| [
{
"answer_id": 107350,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "gcc -E foo.cpp\n"
}
] | 2008/09/19 | [
"https://Stackoverflow.com/questions/106412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3561/"
] |
106,425 | <p>How can I load an external JavaScript file using a bookmarklet? This would overcome the URL length limitations of IE and generally keep things cleaner.</p>
| [
{
"answer_id": 106438,
"author": "Miguel Ventura",
"author_id": 19401,
"author_profile": "https://Stackoverflow.com/users/19401",
"pm_score": 8,
"selected": true,
"text": "javascript:(function(){document.body.appendChild(document.createElement('script')).src='** your external file URL he... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/401774/"
] |
106,437 | <p>I have a stateless bean something like:</p>
<pre><code>@Stateless
public class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote {
@PersistenceContext(unitName="myPC")
private EntityManager mgr;
@TransationAttribute(TransactionAttributeType.SUPPORTED)
public void processObjects(List<Object> objs) {
// this method just processes the data; no need for a transaction
for(Object obj : objs) {
this.process(obj);
}
}
@TransationAttribute(TransactionAttributeType.REQUIRES_NEW)
public void process(Object obj) {
// do some work with obj that must be in the scope of a transaction
this.mgr.merge(obj);
// ...
this.mgr.merge(obj);
// ...
this.mgr.flush();
}
}
</code></pre>
<p>The typically usage then is the client would call processObjects(...), which doesn't actually interact with the entity manager. It does what it needs to do and calls process(...) individually for each object to process. The duration of process(...) is relatively short, but processObjects(...) could take a very long time to run through everything. Therefore I don't want it to maintain an open transaction. I <em>do</em> need the individual process(...) operations to operate within their own transaction. This should be a new transaction for every call. Lastly I'd like to keep the option open for the client to call process(...) directly.</p>
<p>I've tried a number of different transaction types: never, not supported, supported (on processObjects) and required, requires new (on process) but I get TransactionRequiredException every time merge() is called.</p>
<p>I've been able to make it work by splitting up the methods into two different beans:</p>
<pre><code>@Stateless
@TransationAttribute(TransactionAttributeType.NOT_SUPPORTED)
public class MyStatelessBean1 implements MyStatelessLocal1, MyStatelessRemote1 {
@EJB
private MyStatelessBean2 myBean2;
public void processObjects(List<Object> objs) {
// this method just processes the data; no need for a transaction
for(Object obj : objs) {
this.myBean2.process(obj);
}
}
}
@Stateless
public class MyStatelessBean2 implements MyStatelessLocal2, MyStatelessRemote2 {
@PersistenceContext(unitName="myPC")
private EntityManager mgr;
@TransationAttribute(TransactionAttributeType.REQUIRES_NEW)
public void process(Object obj) {
// do some work with obj that must be in the scope of a transaction
this.mgr.merge(obj);
// ...
this.mgr.merge(obj);
// ...
this.mgr.flush();
}
}
</code></pre>
<p>but I'm still curious if it's possible to accomplish this in one class. It looks to me like the transaction manager only operates at the bean level, even when individual methods are given more specific annotations. So if I mark one method in a way to prevent the transaction from starting calling other methods within that same instance will also not create a transaction, no matter how they're marked?</p>
<p>I'm using JBoss Application Server 4.2.1.GA, but non-specific answers are welcome / preferred.</p>
| [
{
"answer_id": 511912,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 6,
"selected": true,
"text": "@EJB"
},
{
"answer_id": 2660238,
"author": "bluecarbon",
"author_id": 149895,
"author_profile": "https://St... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1458/"
] |
106,446 | <p><strong>Before you answer: Yes I have read the jtable tutorial over at Sun</strong>. No, it did not help me. Yes, I am a dolt. <strong>Please don't answer with a reference to that document</strong>. What I am specifically interested in is how to dynamically add rows and columns to my Jtable via the Netbeans IDE. I already have an object that contains a hashmap with my data. I can't figure out where or what object I should be passing that object to. Thanks for your time! </p>
<p>I have a vector that contains a series (of length l) of objects (each one corresponding to a row). How do I get that vector object to display on the JTable?</p>
| [
{
"answer_id": 106462,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 2,
"selected": false,
"text": "JTable"
},
{
"answer_id": 106493,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://S... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19398/"
] |
106,453 | <p>I've been working on an embedded C/C++ project recently using the shell in Tornado 2 as a way of debugging what's going on in our kit. The only problem with this approach is that it's a complicated system and as a result, has a fair bit of output. Tornado 'helpfully' scrolls the window every time some new information arrives which means that if you spot an error, it disappears out of site too quickly to see. Each time you scroll up to look, the system adds more information, so the only way to view it is to disconnect the hardware.</p>
<p>I'd love to know if anyone has a way of redirecting the output from Tornado?</p>
<p>I was hoping there might be a way to log it all from a small python app so that I can apply filters to the incoming information. I've tried connecting into the Tornado process, but the window with the information isn't a standard CEditCtrl so extracting the text that way was a dead end.</p>
<p>Any ideas anyone?</p>
<p><strong>[Edit]</strong> I should have mentioned that we're only running Tornado 2.1.0 and upgrading to a more recent version is beyond my control.</p>
<p><strong>[Edit2]</strong> The window in question in Tornado is an 'AfxFrameOrView42' according to WinID.</p>
| [
{
"answer_id": 106626,
"author": "Benoit",
"author_id": 10703,
"author_profile": "https://Stackoverflow.com/users/10703",
"pm_score": 2,
"selected": false,
"text": "\n-> ?shConfig\n...\nRECORD = off\nRECORD_FILE = C:/test.txt\nRECORD_TYPE = output\n...\n\n-> ?shConfig RECORD_TYPE all\n->... | 2008/09/19 | [
"https://Stackoverflow.com/questions/106453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15369/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.