qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
374,709
<p>When I use A.column name, B.Column name where A = Table A and B = Table B , what is the technical name for the A.Column name? Is it a prefix, identifier or what else? </p>
[ { "answer_id": 374871, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "correlation correlated subquery correlation SELECT EMPNO, LASTNAME, WORKDEPT, EDLEVEL\nFROM EMPLOYEE\nWHERE EDLEVEL >\n ...
2008/12/17
[ "https://Stackoverflow.com/questions/374709", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
374,715
<p>I am trying to add enhancements to a 4 year old VC++ 6.0 program. The debug build runs from the command line but not in the debugger: it crashes with an access violation inside printf(). If I skip the printf, then it crashes in malloc() (called from within fopen()) and I can't skip over that.</p> <p>This means I cannot run in the debugger and have to rely on the old printf statements to see what's going on. This obviously makes it a lot harder.</p> <p>Any idea why printf() and malloc() would fail when running under the VC++ debugger? I am no good at this low level stuff!</p> <p>Here is the call stack after the access violation:</p> <pre><code>_heap_alloc_dbg(unsigned int 24, int 2, const char * 0x0046b3d8 `string', int 225) line 394 + 8 bytes _nh_malloc_dbg(unsigned int 24, int 0, int 2, const char * 0x0046b3d8 `string', int 225) line 242 + 21 bytes _malloc_dbg(unsigned int 24, int 2, const char * 0x0046b3d8 `string', int 225) line 163 + 27 bytes _lock(int 2) line 225 + 19 bytes _getstream() line 55 + 7 bytes _fsopen(const char * 0x00468000 `string', const char * 0x00466280 `string', int 64) line 61 + 5 bytes fopen(const char * 0x00468000 `string', const char * 0x00466280 `string') line 104 + 15 bytes open_new_log(const char * 0x00468000 `string') line 66 + 14 bytes log_open(const char * 0x00468000 `string', int 0) line 106 + 9 bytes Xlog_open(const char * 0x00468000 `string', int 0) line 51 + 13 bytes service_start(unsigned long 1, char * * 0x009a0e50) line 3152 + 12 bytes service_init2(char * 0x00471fcc char * NTPROGRAM, char * 0x004723c4 char * NTSERVICE, char * 0x00466540 `string', unsigned long 1, char * * 0x009a0e50) line 508 + 13 bytes service_init(char * 0x00471fcc char * NTPROGRAM, char * 0x004723c4 char * NTSERVICE, unsigned long 2, char * * 0x009a0e50) line 548 main(unsigned long 2, char * * 0x009a0e50) line 3131 mainCRTStartup() line 206 + 25 bytes KERNEL32! 7c817067() </code></pre> <p>Here is the debug dissassembly up to the operation that fails:</p> <pre><code>0041EA7E jmp _heap_alloc_dbg+2B3h (0041eb23) 0041EA83 mov edx,dword ptr [_lTotalAlloc (004b4294)] 0041EA89 add edx,dword ptr [nSize] 0041EA8C mov dword ptr [_lTotalAlloc (004b4294)],edx 0041EA92 mov eax,[_lCurAlloc (004b429c)] 0041EA97 add eax,dword ptr [nSize] 0041EA9A mov [_lCurAlloc (004b429c)],eax 0041EA9F mov ecx,dword ptr [_lCurAlloc (004b429c)] 0041EAA5 cmp ecx,dword ptr [_lMaxAlloc (004b42a0)] 0041EAAB jbe _heap_alloc_dbg+249h (0041eab9) 0041EAAD mov edx,dword ptr [_lCurAlloc (004b429c)] 0041EAB3 mov dword ptr [_lMaxAlloc (004b42a0)],edx 0041EAB9 cmp dword ptr [_pFirstBlock (004b4298)],0 0041EAC0 je _heap_alloc_dbg+25Fh (0041eacf) 0041EAC2 mov eax,[_pFirstBlock (004b4298)] 0041EAC7 mov ecx,dword ptr [pHead] 0041EACA mov dword ptr [eax+4],ecx </code></pre> <p>Here is our source for that calls fopen() and fails in malloc()</p> <pre><code>FILE *open_new_log( const char *logfile ) { FILE *fp; int retry = 0; while( ( fp = fopen( logfile, "w" ) ) == NULL &amp;&amp; ++retry &lt; 300 ) Sleep( 1000 ); return( fp ); } </code></pre> <p>The error I get is</p> <pre><code>Unhandled exception inPISCOOP.exe: 0xC00000005: Access Violation </code></pre> <p>Regards,</p> <p>--- Alistair.</p>
[ { "answer_id": 374820, "author": "jmatthias", "author_id": 2768, "author_profile": "https://Stackoverflow.com/users/2768", "pm_score": 1, "selected": false, "text": "open_new_log()" }, { "answer_id": 374916, "author": "Adam Rosenfield", "author_id": 9530, "author_prof...
2008/12/17
[ "https://Stackoverflow.com/questions/374715", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41013/" ]
374,734
<p>I'm calling a WebService exposed by Oracle that accepts an input of an ItemID and returns to me the corresponding Item Number. I want to grab the Item Number that has been returned out of the XML contained in the response.</p> <p>The XML looks like this:</p> <pre><code>&lt;env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://dev1/MyWebService1.wsdl"&gt; &lt;env:Header&gt; &lt;wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" env:mustUnderstand="1"/&gt; &lt;/env:Header&gt; &lt;env:Body&gt; &lt;ns0:getItemNbrByItemIdResponseElement&gt; &lt;ns0:result&gt;1010603&lt;/ns0:result&gt; &lt;/ns0:getItemNbrByItemIdResponseElement&gt; &lt;/env:Body&gt; &lt;/env:Envelope&gt; </code></pre> <p>I'm interested in grabbing only the <code>&lt;ns0:result&gt;1010603&lt;/ns0:result&gt;</code> particularly only the 1010603.</p> <p>I haven't done a lot of work parsing XML using C# and I'm playing around with a few different methods so far. What is the recommended way to do this?</p> <p>I'm on VS2008 (so XPath is available etc.)</p>
[ { "answer_id": 374750, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": true, "text": "XNamespace ns0 = \"http://dev1/MyWebService1.wsdl\";\n\nString result = doc.Descendants(ns0 + \"result\").First().Value;\...
2008/12/17
[ "https://Stackoverflow.com/questions/374734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26853/" ]
374,740
<p>I need to write a unit test for a method that will print a document. Is there an easy way to send the output to the Windows equivalent of /dev/null? I'm guessing that having our build server print a document on every check in is going to get expensive quickly. ;)</p> <p>Ideally, this would work on both our build server (which has no default printer) and our development machines (which do), so I'd prefer not to change the default printer.</p> <p>Thanks for all the wonderful answers that will undoubtedly follow this fascinating question.</p>
[ { "answer_id": 374765, "author": "Campbell", "author_id": 942, "author_profile": "https://Stackoverflow.com/users/942", "pm_score": 2, "selected": true, "text": "Mock mock = MockManager.Mock<PrintManager>();\nmock.ExpectCall(\"Print\");\n" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/374740", "https://Stackoverflow.com", "https://Stackoverflow.com/users/549/" ]
374,746
<p>I understand the best way to count the number of rows in an SQL table is count(*) (or equivalently count(PrimaryKey)).</p> <ol> <li>Is this O(1)?</li> <li>If not, why not?</li> </ol> <p>Why not just implement a counter and return it for this specific query? Is it because this query is not a common use case?</p> <p>If the answers vary according to SQL engine, I'd like to hear the differences - but in any case, I'm interested in the actual implementation in production SQL engines.</p>
[ { "answer_id": 374815, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 0, "selected": false, "text": "select count(*) From MyTable select count(*) from MyTable where Category = 5" }, { "answer_id": 374844, "...
2008/12/17
[ "https://Stackoverflow.com/questions/374746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11236/" ]
374,760
<p>I say properly because everyone I have spoken to in the past said running Django on IIS was a hack. I had it working somewhat but it never did quite right and did feel like a hack. I like python but had to give it up because I could never make Django work with IIS and Django was my excuse to use Python in production web apps. But it was so messy that I could not in good conscience sell it to the group. So, I figured why fight it, just stick to asp.net, IIS, roll your own or use frameworks from MS. Just wondering if anything had changed. BTW, not knocking asp.net. I just wanted to use Python.</p> <p>Thank you.</p> <p>EDIT - Are there any new plans to officially support IIS yet?</p>
[ { "answer_id": 1349946, "author": "Nick Bolton", "author_id": 47775, "author_profile": "https://Stackoverflow.com/users/47775", "pm_score": 1, "selected": false, "text": "PyISAPIe\n0x8007007e\n" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/374760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28045/" ]
374,761
<p>I'm using Visual C++ (VS2005) and compiling the project in Multibyte Character Set (MBCS). However, the program needs to communicate with a webapp (which is in utf-8) via XMLRPC. So I'm thinking maybe I can use MBCS internally and convert the strings to utf-8 before sending them to the xmlrpc module and converting them back to MBCS after receiving from the webapi.</p> <p>I'm wondering what's the best way to convert between MBCS and UTF-8 in VC++?</p> <p>Thanks all.</p>
[ { "answer_id": 375122, "author": "Rob", "author_id": 9236, "author_profile": "https://Stackoverflow.com/users/9236", "pm_score": 1, "selected": false, "text": "CT2A pszUTF8(_T(\"My DBCS string\"), CP_UTF8);\n// pszUTF8.m_psz contains the UTF8 string.\n CA2T pszT(_T(\"My UTF8 string\"), C...
2008/12/17
[ "https://Stackoverflow.com/questions/374761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
374,762
<p>I am looking to export a few files into Excel from MS Access based on querying a table.</p> <p>It's like this the query will be </p> <pre><code>select * from table where field = 0 </code></pre> <p>I would like to loop the query till field is 9 and I want to save each result in a different name like field1, field2</p> <p>How will this have to be modified?</p> <pre><code>strqry = "select * from table where field = 1" DoCmd.TransferSpreadsheet acExport, _ acSpreadsheetTypeExcel9, _ "strqry", _ "C:\Reports\Data_Analysis1.xls", _ True </code></pre> <p>Also how do I name the first sheet as field1 and in next loop field2</p>
[ { "answer_id": 374835, "author": "LeppyR64", "author_id": 16592, "author_profile": "https://Stackoverflow.com/users/16592", "pm_score": 1, "selected": false, "text": "DoCmd.TransferSpreadsheet acExport, _\n acSpreadsheetTypeExcel9, _\n ...
2008/12/17
[ "https://Stackoverflow.com/questions/374762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31132/" ]
374,763
<p>In Python properties are used instead of the Java-style getters, setters. So one rarely sees get... or set.. methods in the public interfaces of classes.</p> <p>But in cases were a property is not appropriate one might still end up with methods that behave like getters or setters. Now my questions: Should these method names start with <code>get_</code> / <code>set_</code>? Or is this unpythonic vebosity since it is often obvious what is meant (and one can still use the docstring to clarify non-obvious situations)?</p> <p>This might be a matter of personal taste, but I would be interested in what the majority thinks about this? What would you prefer as an API user?</p> <p>Example: Say we have an object representing multiple cities. One might have a method <code>get_city_by_postalcode(postalcode)</code> or one could use the shorter name <code>city_by_postalcode</code>. I tend towards the later.</p>
[ { "answer_id": 374860, "author": "mipadi", "author_id": 28804, "author_profile": "https://Stackoverflow.com/users/28804", "pm_score": 1, "selected": false, "text": "foo()/set_foo() get_city_by_postalcode() translate_postalcode" }, { "answer_id": 375160, "author": "Jeremy Cant...
2008/12/17
[ "https://Stackoverflow.com/questions/374763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11992/" ]
374,768
<p>I have the following code (adapted from an example given in <a href="http://diveintopython.net/file_handling/file_objects.html#d0e14928" rel="nofollow noreferrer">Dive Into Python</a>) that reads the entire contents of a file into a buffer.</p> <pre><code>buffer = "" try: file = open(postFileName, 'rU') try: # Read the entire POST log file into a buffer buffer += file.read() finally: file.close() except IOError: buffer += "The POST file could not be opened." </code></pre> <p>What's bothering me about this code is the inner try/finally block without an except block. Do I need an except block in there? Can the call to <code>read()</code> fail after the call to <code>open()</code> was successful? I know the try-except-finally is now unified, so adding one, at least syntactically, is not a problem.</p> <p>If I add an except block, under what conditions will it be executed, and how do I write a test to make sure it runs under those conditions?</p> <p>Additionally, if I <em>don't</em> need an except block, then why do I need the inner try/finally block at all?</p>
[ { "answer_id": 374821, "author": "Oli", "author_id": 22035, "author_profile": "https://Stackoverflow.com/users/22035", "pm_score": 0, "selected": false, "text": "try:\n non_existing_var\nexcept:\n print 'error'\nfinally:\n print 'finished'\n" }, { "answer_id": 374895, "aut...
2008/12/17
[ "https://Stackoverflow.com/questions/374768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
374,770
<p>Imagine this case where I have an object that I need to check a property. However, the object can currently have a null value.</p> <p>How can I check these two conditions in a single &quot;if&quot; condition?</p> <p>Currently, I have to do something like this:</p> <pre class="lang-cs prettyprint-override"><code>if (myObject != null) { if (myObject.Id != pId) { myObject.Id = pId; myObject.Order = pOrder; } } </code></pre> <p>I would like something like this:</p> <pre class="lang-cs prettyprint-override"><code>if (myObject != null &amp;&amp; myObject.Id != pId) </code></pre> <p>I want to evaluate the second condition only if the first was true.</p>
[ { "answer_id": 374776, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 6, "selected": true, "text": "if (myObject != null && myObject.Id != pId)\n{\n myObject.Id = pId;\n myObject.Order = pOrder;\n}\n && a & b bool"...
2008/12/17
[ "https://Stackoverflow.com/questions/374770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29544/" ]
374,786
<p>I've been at this for several days and searches including here haven't give me any solutions yet.</p> <p>I am creating a Bookmarklet which is to interact with a POST API. I've gotten most of it working except the most important part; the sending of data from the iframe (I know horrible! If anyone knows a better solution please let me know) to the javascript on my domain (same domain as API so the communication with the API is no problem). </p> <p>From the page the user clicks on the bookmarklet I need to get the following data to the javascript that is included in the iFrame.</p> <pre><code> var title = pageData[0].title; var address = pageData[0].address; var lastmodified = pageData[0].lastmodified; var referralurl = pageData[0].referralurl; </code></pre> <p>I first fixed it with parsing this data as JSON and sending it through the name="" attribute of the iFrame but realized on about 20% of webpages this breaks. I get an access denied; also it's not a very pretty method.</p> <p>Does anyone have anyidea on how I can solve this. I am not looking to use POSTS that redirect I want it all to be AJAX and as unobtrusive as possible. It's also worth noting I use the jQuery library.</p> <p>Thank you very much,</p> <p>Ice</p>
[ { "answer_id": 375311, "author": "singpolyma", "author_id": 8611, "author_profile": "https://Stackoverflow.com/users/8611", "pm_score": 0, "selected": false, "text": "DATA_FOR_IFRAME = ({'whatever': 'stuff'});\n window.parent.DATA_FOR_IFRAME;\n" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/374786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
374,790
<p>I understand that boxing and unboxing is about casting (real type to object... object to real type). But I do not understand what the MSDN say about it with the Nullable. Here is the text I do not understand:</p> <blockquote> <p>When a nullable type is boxed, the common language runtime automatically boxes the underlying value of the Nullable object, not the Nullable object itself. That is, if the HasValue property is true, the contents of the Value property is boxed. When the underlying value of a nullable type is unboxed, the common language runtime creates a new Nullable structure initialized to the underlying value. <a href="http://msdn.microsoft.com/en-us/library/b3h38hb0.aspx" rel="noreferrer">Source</a></p> </blockquote> <p>When you change your object to a real type, the real type variable that was nullable will be the type of object? I do not get it?</p>
[ { "answer_id": 374801, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": true, "text": "int? x = 5;\nobject y = x; // Boxing\n int Nullable<int> int? x = null; // Same as new Nullable<int>() - HasValue = false...
2008/12/17
[ "https://Stackoverflow.com/questions/374790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46827/" ]
374,791
<p>I've had to move my page title into my node to accommodate a client need, but I'm unable to now get a title to display on a page view of my views list. The argument I have to display title on edit, admin and track pages is:</p> <pre><code>&lt;?php if ($title &amp;&amp; ((arg(2) == 'track') || (arg(2) == 'edit') || (arg(0) == 'admin'))): ?&gt; &lt;h1 class="title"&gt;&lt;?php echo $title; ?&gt;&lt;/h1&gt; &lt;?php endif; ?&gt; </code></pre> <p>and I'm wondering if there's a generic argument to include either all views list pages, or, the inverse, just exclude all node pages (NB: I'm using CCK, so have a lot of content types)?</p> <hr> <p>Sniffing out other possibilities...</p> <p>I know that I can create different page templates for my content-types, but can I create one different page template for ALL my CCK content-types?</p> <p>Here's the code I'd through into template.php to get the ability to add individual content-type templates:</p> <pre><code>function _phptemplate_variables($hook, $vars) { switch ($hook) { case 'page': if ($vars['node'] &amp;&amp; arg(2) != 'edit') { $vars['template_files'][] = 'page-'. $vars['node']-&gt;type; } break; } return $vars; } </code></pre> <p>Cheers<br /> Steve</p>
[ { "answer_id": 375387, "author": "Steve Perks", "author_id": 16124, "author_profile": "https://Stackoverflow.com/users/16124", "pm_score": 3, "selected": true, "text": "!node->type <?php if ($title && ((arg(2) == 'track') || (arg(2) == 'edit') \n || (arg(0) == 'admin') || !$node->type))...
2008/12/17
[ "https://Stackoverflow.com/questions/374791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16124/" ]
374,797
<p>I'm using Zend Studio 6.1 for Eclipse, which comes bundled with the Subversive plug-in.</p> <p>My repo layout is:</p> <pre><code>/trunk/ /branches/ /tags/ </code></pre> <p>My application code is in:</p> <pre><code>/trunk/application </code></pre> <p>I'm trying to add some view templates in:</p> <pre><code>/trunk/application/views/tags/index.tpl </code></pre> <p>BUT Subversive won't let me commit any of the files in that folder. The message it gives me is: </p> <blockquote> <p>"You are going to modify the tag on the repository. Do you want to continue?"</p> </blockquote> <p>So I say "no". It seems to be confusing my 'tags' folder with SVN's concept of tags.</p> <p>I can't rename the folder because the framework I'm using enforces strict naming conventions between controller &amp; view. I have a tagsController, so my views must be in /views/tags</p> <p>I could rename the controller to something other than 'tags', but that sucks, because a tag is a tag, not a schmag ;)</p> <p>Any ideas on how to get around this?</p>
[ { "answer_id": 374810, "author": "RB.", "author_id": 15393, "author_profile": "https://Stackoverflow.com/users/15393", "pm_score": 4, "selected": false, "text": "/trunk\n/tags\n/branches\n" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/374797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3407/" ]
374,818
<p>I have a .net project in subversion which is contineously integrated with Cruisecontrol.net.</p> <p>i use Svn source control CCNET task.</p> <p>The .net project library directory with set of reusable components configured as subversion externals.</p> <p>ProjectA\libraries {reusable components directory} ProjectA\libraries\component1 ProjectA\libraries\component2 ProjectA\libraries\component3</p> <p>projectA\Src { source code directory}</p> <p>when the subversion externals are changed the build is not triggered, as it is not detecting the changes happened in extern folders.</p> <p>How to make subversion ccnet task to build immediately when there is change in configured components as externals.</p>
[ { "answer_id": 374880, "author": "Alex", "author_id": 26564, "author_profile": "https://Stackoverflow.com/users/26564", "pm_score": 4, "selected": true, "text": "<checkExternals>True</checkExternals>\n<checkExternalsRecursive>True</checkExternalsRecursive>\n" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/374818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32670/" ]
374,824
<p>Here is classical object model:</p> <pre><code> class ViewBase { void DoSomethingForView() { } //May be virtual } class View1 : ViewBase //(derived class from ViewBase) { void DoSomethingForView() { } void DoSomethingForView1Special() { } } class View2: ViewBase //(another derived class from ViewBase) { void DoSomethingForView2Special() { } } class Application { void Print() { } void DoSomething() { } //Do some magic to create a view object (View1 or View2) and return //Something which I don't know to describe. Its like dynamically //returning object of View1 or View2 at runtime } </code></pre> <p>I want to convert this to Perl Moose class model. </p> <p>So that,</p> <p>I will call the view methods like</p> <pre><code>void Main() { App = new Application(); App-&gt;View1-&gt;DoSomethingForView(); App-&gt;View1-&gt;DoSomethingForView1Special(); App-&gt;View2-&gt;DoSomethingForView(); App-&gt;View2-&gt;DoSomethingForView2Special(); </code></pre> <p>}</p> <p>I will not know which View to be called. But at runtime, View1/View2 instance must be created &amp; DoSomethingForView() must be called.</p> <p>The above code is not exactly Perl. How to translate &amp; achieve this in Perl.</p> <p>An Application object shall have View object, but we will not know the type of the view at compile time. We have a test application, development in Perl. </p> <p>You can imagine Application is a GUI application, and View is what you are seeing in the application window. User can select any view. </p> <p>I am sorry about my English. Please let me know If I need to provide more text.</p>
[ { "answer_id": 376250, "author": "Axeman", "author_id": 11289, "author_profile": "https://Stackoverflow.com/users/11289", "pm_score": 3, "selected": true, "text": "do_something_for_view View2 view1 view2 package ViewBase;\n\nsub do_something_for_view { \n Carp::croak \"ViewBase::do_so...
2008/12/17
[ "https://Stackoverflow.com/questions/374824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43056/" ]
374,833
<p>I just want to know how I can start derby in network server mode and still be able to get an embedded connection?</p> <p>Thank you.</p>
[ { "answer_id": 22641222, "author": "trooper", "author_id": 975741, "author_profile": "https://Stackoverflow.com/users/975741", "pm_score": 2, "selected": false, "text": " derby.jar derbynet.jar\n -Dderby.drda.startNetworkServer=true \n -Dderby.drda.portNumber=8011\n netsta...
2008/12/17
[ "https://Stackoverflow.com/questions/374833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
374,841
<p>I have a coldfusion web site I need to change. Have no idea or experience with this environment (I do know ASP.NET). All I need to do is to write a condition based on the referral value (the URL) of the page, and redirect to another page in some cases. Can anyone give me an example of the syntax that would perform this?</p>
[ { "answer_id": 374892, "author": "DanSingerman", "author_id": 43965, "author_profile": "https://Stackoverflow.com/users/43965", "pm_score": 1, "selected": false, "text": "<cfif some_condition_based_on_your_url>\n <cflocation url=\"http://where_your_referrals_go\">\n</cfif>\n<!--- contin...
2008/12/17
[ "https://Stackoverflow.com/questions/374841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1363/" ]
374,843
<p><strong>The cause was probably that I ran out of disk space, causing everything to work strangely. I will leave this question up anyways in case anyone else has a similar issue.</strong></p> <p>I have a few PHP scripts that have hung for a long time, but apparently they are not really using much CPU time as they don't get killed. Still they are making it impossible for lighttpd to spawn any more PHP processes as the maximum amount of them has been spawned already.</p> <p>I'm aware of the set_time_limit that can be used as a function or put into php.ini to control the maximum CPU time a script can run. What I want is to limit all PHP scripts run by my web server (lighttpd) not in CPU time, but clock time.</p> <p>In case it matters, this is the PHP part from my lighttpd config file.</p> <pre><code>fastcgi.server = (".php" =&gt; (( "bin-path" =&gt; "/opt/local/bin/php5-cgi", "socket" =&gt; "/tmp/php.socket" + var.PID, "min-procs" =&gt; 16, "max-procs" =&gt; 16, "idle-timeout" =&gt; 15, ))) </code></pre> <p>Here is my server-status from lighttpd. You can see that PHP has been running much longer than I bargained for and has caused the server to clog up. Strangely there also seem to be more PHP procs than my max-procs.</p> <pre><code>legend . = connect, C = close, E = hard error r = read, R = read-POST, W = write, h = handle-request q = request-start, Q = request-end s = response-start, S = response-end 388 connections hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhrhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhhhrhhhhhhhhhhhhhhhhhhhhhhhhrhhhhhhhhhhh hhhhrhhhhhhhhhhrhrhhhrrhrhhhhhrhhhrhhhhhhrhhhrrrhr rrhrrrhrhhhhrrhrrhhrrhrrhrrrrrrrrrrrrh Connections Client IP: Read: Written: State: Time: Host: URI: File: 204.16.33.51 0/0 0/0 handle-req 1361 ... (a PHP script) 204.16.33.46 0/0 0/0 handle-req 1420 ... (another PHP script) ... gazillion lines removed ... </code></pre> <p>Any ideas that could help me set up a configuration that I don't have to constantly babysit would be much appreciated!</p>
[ { "answer_id": 374892, "author": "DanSingerman", "author_id": 43965, "author_profile": "https://Stackoverflow.com/users/43965", "pm_score": 1, "selected": false, "text": "<cfif some_condition_based_on_your_url>\n <cflocation url=\"http://where_your_referrals_go\">\n</cfif>\n<!--- contin...
2008/12/17
[ "https://Stackoverflow.com/questions/374843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8005/" ]
374,846
<p>I have a 3 table SQLServer Database.</p> <pre><code>Project ProjectID ProjectName Thing ThingID ThingName ProjectThingLink ProjectID ThingID CreatedDate </code></pre> <p>When a Thing is ascribed to a Project an entry is put in the ProjectThingLink table. Things can move between Projects. The CreatedDate is used to know which Project a Thing was last moved too.</p> <p>I am trying to create a list of all Projects with which Things are currently linked to them, but my brain is failing.</p> <p>Is there an easy way of doing this?</p>
[ { "answer_id": 374868, "author": "Tony Andrews", "author_id": 18747, "author_profile": "https://Stackoverflow.com/users/18747", "pm_score": 3, "selected": true, "text": "select p.projectName, t.ThingName\nfrom projects p\njoin projectThingLink l on l.projectId = p.projectId\njoin thing t...
2008/12/17
[ "https://Stackoverflow.com/questions/374846", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5552/" ]
374,885
<p>I'm looking into a restful design and would like to use the HTTP methods (<code>POST</code>, <code>GET</code>, ...) and HTTP headers as much as possible. I already found out that the HTTP methods <code>PUT</code> and <code>DELETE</code> are not supported from the browser.</p> <p>Now I'm looking to get different representations of the same resource and would like to do this by changing the <code>Accept</code> header of the request. Depending on this <code>Accept</code> header, the server can serve a different view on the same resource.</p> <p>Problem is that I didn't find a way to tell my browser to change this header. </p> <p>The <code>&lt;a..&gt;</code> tag has a <a href="http://www.w3.org/TR/html401/struct/links.html#adef-type-A" rel="noreferrer">type attribute</a>, that can have a mime type, looked like a good candidate but the header was still the browser default (in Firefox it can be changed in <code>about:config</code> with the <code>network.http.accept.default</code> key).</p>
[ { "answer_id": 374957, "author": "Milan Novota", "author_id": 26123, "author_profile": "https://Stackoverflow.com/users/26123", "pm_score": 4, "selected": true, "text": "/resources/resource\n GET /resources/resource /resources/resource.xml\n" }, { "answer_id": 398156, "author...
2008/12/17
[ "https://Stackoverflow.com/questions/374885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15490/" ]
374,886
<p>I'm trying to setup Spring using Hibernate and JPA, but when trying to persist an object, nothing seems to be added to the database.</p> <p>Am using the following:</p> <pre><code>&lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt; &lt;property name="url" value="${jdbc.url}"/&gt; &lt;property name="driverClassName" value="${jdbc.driverClassName}"/&gt; &lt;property name="username" value="${jdbc.username}"/&gt; &lt;property name="password" value="${jdbc.password}"/&gt; &lt;/bean&gt; &lt;bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"&gt; &lt;property name="dataSource" ref="dataSource" /&gt; &lt;property name="persistenceUnitName" value="BankingWeb" /&gt; &lt;property name="jpaVendorAdapter"&gt; &lt;bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"&gt; &lt;property name="generateDdl" value="true" /&gt; &lt;property name="showSql" value="true" /&gt; &lt;property name="databasePlatform" value="${hibernate.dialect}" /&gt; &lt;/bean&gt; &lt;/property&gt; &lt;/bean&gt; &lt;tx:annotation-driven/&gt; &lt;bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager"&gt; &lt;property name="entityManagerFactory" ref="entityManagerFactory"/&gt; &lt;/bean&gt; &lt;bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" /&gt; &lt;bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/&gt; &lt;bean name="accountManager" class="ssel.banking.dao.jpa.AccountManager" /&gt; &lt;bean name="userManager" class="ssel.banking.dao.jpa.UserManager" /&gt; </code></pre> <p>And in AccountManager, I'm doing:</p> <pre><code>@Repository public class AccountManager implements IAccountManager { @PersistenceContext private EntityManager em; /* -- 8&lt; -- Query methods omitted -- 8&lt; -- */ public Account storeAccount(Account ac) { ac = em.merge(ac); em.persist(ac); return ac; } } </code></pre> <p>Where ac comes from:</p> <pre><code> Account ac = new Account(); ac.setId(mostRecent.getId()+1); ac.setUser(user); ac.setName(accName); ac.setDate(new Date()); ac.setValue(0); ac = accountManager.storeAccount(ac); return ac; </code></pre> <p>Is there anyone who can point out what I'm doing wrong? The persist call returns without throwing exceptions. If afterwards I do <code>em.contains(ac)</code>, this returns true.</p> <p>In case anyone needed, here's how Account is defined:</p> <pre><code>@SuppressWarnings("serial") @Entity @NamedQueries({ @NamedQuery(name = "Account.AllAccounts", query = "SELECT a FROM Account a"), @NamedQuery(name = "Account.Accounts4User", query = "SELECT a FROM Account a WHERE user=:user"), @NamedQuery(name = "Account.Account4Name", query = "SELECT a FROM Account a WHERE name=:name"), @NamedQuery(name = "Account.MaxId", query = "SELECT MAX(a.id) FROM Account a"), @NamedQuery(name = "Account.Account4Id", query = "SELECT a FROM Account a WHERE id=:id"), }) public class Account extends AbstractNamedDomain { @Temporal(TemporalType.DATE) @Column(name = "xdate") private Date date; private double value; @ManyToOne(cascade={CascadeType.PERSIST, CascadeType.MERGE}) @JoinColumn(name="userid") private User user; public User getUser() { return user; } public void setUser(User user) { this.user = user; } @OneToMany(cascade={CascadeType.PERSIST, CascadeType.MERGE}, fetch=FetchType.EAGER) @OrderBy("date") private List&lt;AccountActivity&gt; accountActivity = new ArrayList&lt;AccountActivity&gt;(); public List&lt;AccountActivity&gt; getAccountActivity() { return accountActivity; } public void setAccountActivity(List&lt;AccountActivity&gt; accountActivity) { this.accountActivity = accountActivity; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } public double getValue() { return value; } public void setValue(double value) { this.value = value; } public void addAccountActivity(AccountActivity activity) { // Make sure ordering is maintained, JPA only does this on loading int i = 0; while (i &lt; getAccountActivity().size()) { if (getAccountActivity().get(i).getDate().compareTo(activity.getDate()) &lt;= 0) break; i++; } getAccountActivity().add(i, activity); } } @MappedSuperclass public abstract class AbstractNamedDomain extends AbstractDomain { private String name; public AbstractNamedDomain() { } public AbstractNamedDomain(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } } @MappedSuperclass public abstract class AbstractDomain implements Serializable { @Id @GeneratedValue private long id = NEW_ID; public static long NEW_ID = -1; public long getId() { return id; } public void setId(long id) { this.id = id; } public boolean isNew() { return id==NEW_ID; } } </code></pre>
[ { "answer_id": 374913, "author": "Juan Manuel", "author_id": 47033, "author_profile": "https://Stackoverflow.com/users/47033", "pm_score": 1, "selected": false, "text": "@TransactionManagement(TransactionManagementType.BEAN)\npublic class AccountManager implements IAccountManager { ..}\n...
2008/12/17
[ "https://Stackoverflow.com/questions/374886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32713/" ]
374,906
<p>We use a customized installation of SugarCRM and I need to make a change to the "Convert Lead to Contact" form. On the form, only "last name" is marked as required, but if the user does not enter a salutation or first name, Sugar will throw an SQL error on the insert (because salutation and first name are required fields for contacts). </p> <p>I've tried adding this line to "modules/Contacts/metadata/editviewdefs.php" and "modules/Contacts/metadata/quickcreatedefs.php":</p> <pre><code>array ( 'name' =&gt; 'first_name', 'displayParams'=&gt;array('required'=&gt;true), ) </code></pre> <p>I'm trying other modifications but I can't find anything online yet on this exact problem. I will update this question with my findings. Thanks!</p> <p>Update: Added "first_name" and "salutation" to the 'required_fields' array in "modules/Contacts/field_arrays.php", did not help. </p> <p>Update: This is on SugarCRM 5.1. This work is happening during the upgrade to 5.1. </p> <p>Update: Added the following line to "modules/Contacts/vardefs.php" the "email_and_name1" array, did not help.</p> <pre><code>'required' =&gt; 'true', </code></pre>
[ { "answer_id": 375729, "author": "Ed Schwehm", "author_id": 1206, "author_profile": "https://Stackoverflow.com/users/1206", "pm_score": 2, "selected": true, "text": "<?php\n$dictionary['Contact']['fields']['salutation']['required'] = true;\n$dictionary['Contact']['fields']['first_name'][...
2008/12/17
[ "https://Stackoverflow.com/questions/374906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1206/" ]
374,930
<p>I have a .NET webform that has a file upload control that is tied to a regular expression validator. This validator needs to validate that only certain filetypes should be allowed for upload (jpg,gif,doc,pdf)</p> <p>The current regular expression that does this is:</p> <pre> <code> ^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.jpg|.JPG|.gif|.GIF|.doc|.DOC|.pdf|.PDF)$ </code> </pre> <p>However this does not seem to be working... can anyone give me a little reg ex help?</p>
[ { "answer_id": 374956, "author": "Dario Solera", "author_id": 16026, "author_profile": "https://Stackoverflow.com/users/16026", "pm_score": 9, "selected": true, "text": "^.*\\.(jpg|JPG|gif|GIF|doc|DOC|pdf|PDF)$\n" }, { "answer_id": 374985, "author": "Joseph Ferris", "auth...
2008/12/17
[ "https://Stackoverflow.com/questions/374930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
374,940
<p>As input I get an int (well, actually a string I should convert to an int).<br> This int should be converted to bits.<br> For each bit position that has a 1, I should get the position.<br> In my database, I want all records that have an int value field that has this position as value.<br> I currently have the following naive code that should ask my entity(holding the databaseValue) if it matches the position, but obviously doesn't work correctly:</p> <pre><code>Byte[] bits = BitConverter.GetBytes(theDatabaseValue); return bits[position].equals(1); </code></pre> <p>Firstly, I have an array of byte because there apparantly is no bit type. Should I use Boolean[] ? Then, how can I fill this array? Lastly, if previous statements are solved, I should just return bits[position]</p> <p>I feel like this should somehow be solved with bitmasks, but I don't know where to start..</p> <p>Any help would be appreciated</p>
[ { "answer_id": 374955, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "for (int i=0; i < 32; i++)\n{\n if ((value & (1 << i)) != 0)\n {\n Console.WriteLine(\"Bit {0} was set!\", ...
2008/12/17
[ "https://Stackoverflow.com/questions/374940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11333/" ]
374,943
<p>I have a question about <a href="https://stackoverflow.com/questions/372812/how-do-get-some-of-the-object-from-a-list-without-linq">this question</a>. I posted a reply there but since it's been marked as answered, I don't think I'll get a response to my post there.</p> <blockquote> <p>I am running C# framework 2.0 and I would like to get some of the data from a list? The list is a List&lt;>. How can I do that without looping and doing comparaison manually on each element of the List&lt;>?</p> </blockquote> <p>It really looks like the answers are just a more elegant ways of comparing every element of the List. Given that the list is not guaranteed to be sorted prior to the search, do any of the methods provided in the original post ensure that they are looking at a smaller subset of the original list?</p> <p>EDIT: One thing to note is that I'm not trying to do anything here. I just want to know if the solutions provided in another question truly do what the OP asked, with regards to looping through the whole list. In general, to search an unsorted list (at least it's not required given the data structure), you will have to search the entire list. However, <strong>do any of the solutions on the other thread have an underlying optimization to prevent searching the entire list?</strong> </p> <p>EDIT: I really didn't get any answers that were all that helpful but I will give credit to the answer that at least confirmed my common sense belief. If I notice a new answer that is better, I will change my vote.</p>
[ { "answer_id": 376613, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 1, "selected": false, "text": " list = list.FindAll(yourFilterCriteria);\n Predicate<SimpleObject> yourFilterCriteria = delegate(SimpleObj...
2008/12/17
[ "https://Stackoverflow.com/questions/374943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4068/" ]
374,946
<p>I wonder what the best approach is for a situation where I want to have the user type in</p> <p><a href="http://myserver/something/20" rel="nofollow noreferrer">http://myserver/something/20</a></p> <p>and get redirected (301 or 302) to </p> <p><a href="http://someotherserver/applications/something/modules/default.aspx?id=20" rel="nofollow noreferrer">http://someotherserver/applications/something/modules/default.aspx?id=20</a></p> <p>For .net 3.5 and IIS 7 I found some solutions, but unfortunately I am stuck with .net 3.0 and IIS 6.0 on Windows 2003, and I do not want to install anything on the server if possible. I can change the settings for the Virtual Directory though, and if I have to for the entire site.</p> <p>HTTPModules and web.config are ASP.net only If I am not completely mistaken, hence that will not help as /20 is not sent to ASP.net per Default?</p> <p>Can anyone give me some tips where I can set up something like that?</p>
[ { "answer_id": 375144, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": 1, "selected": false, "text": "<%\n\nDim id : id = CLng(Mid(Request.QueryString, InStrRev(Request.QueryString, \"/\")+1))\nResponse.Redirect \"http...
2008/12/17
[ "https://Stackoverflow.com/questions/374946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
374,952
<p>I'm trying to use Live Search 2.0 but even a simple example doesn't seem to work. Microsoft only has example code for 1.1 and they're not giving out AppIDs for that version.</p> <p>Here's what I'm trying with:</p> <pre><code>&lt;?php $server = new SoapClient('http://soap.search.msn.com/webservices.asmx?wsdl'); class Search { public $Request; } class SearchRequest { public $AppID; public $Query; public $CultureInfo; public $SafeSearch; public $Flags; public $Location; public $Requests; } class SourceRequest { public $Source; public $Offset; public $Count; public $FileType; public $SortBy; public $ResultFields; public $SearchTagFilters; } $searchRequest = new SourceRequest(); $searchRequest-&gt;Source = 'Web'; $searchRequest-&gt;Offset = 0; $searchRequest-&gt;Count = 5; $searchRequest-&gt;ResultFields = 'All SearchTagsArray'; $request = new SearchRequest(); $request-&gt;AppID = '...'; $request-&gt;Query = 'Bill Gates'; $request-&gt;CultureInfo = 'en-US'; $request-&gt;SafeSearch = 'Off'; $request-&gt;Flags = ''; $request-&gt;Requests = array($searchRequest); $search = new Search(); $search-&gt;Request = $request; $server-&gt;Search($search); ?&gt; </code></pre> <p>AppID is correctly specified in the code: I just erased it from here. I'm getting the following error:</p> <pre><code>Array ( [0] =&gt; SearchResponse Search(Search $parameters) ) Fatal error: Uncaught SoapFault exception: [soapenv:Client] Client Error in /Users/thardas/Sites/vt9/widgets/ms_livesearch.php:41 Stack trace: #0 [internal function]: SoapClient-&gt;__call('Search', Array) #1 /Users/thardas/Sites/vt9/widgets/ms_livesearch.php(41): SoapClient-&gt;Search(Object(SearchRequest)) #2 /Users/thardas/Sites/vt9/index.php(23): include('/Users/thardas/...') #3 {main} thrown in /Users/thardas/Sites/vt9/widgets/ms_livesearch.php on line 41 </code></pre>
[ { "answer_id": 385399, "author": "Marek", "author_id": 34452, "author_profile": "https://Stackoverflow.com/users/34452", "pm_score": 3, "selected": true, "text": "$appid = 'Your app id';\n$searchitem = 'PHP Manual';\n $request = 'http://api.search.live.net/json.aspx?Appid=' . $appid ....
2008/12/17
[ "https://Stackoverflow.com/questions/374952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27736/" ]
374,997
<p>I've a process name and I've to send a <code>kill()</code> signal to that process but I need its PID to call <code>kill()</code>. I would only like to use:</p> <pre><code>popen("pidof process_name"); </code></pre> <p>as the last thing. Is there any other way to find out the process' PID? One way I could think of is to send a socket request to that process and ask to its PID.</p> <p>The other way is a little too complicated for a simple code I'm writing: to do what <a href="http://www.koders.com/c/fid80C38C715E43CB80C4E15CB469AE652F16FFB551.aspx?s=pidof#L3" rel="noreferrer">pidof command's source code</a> is actually doing (it uses a function call <code>find_pid_by_name()</code> but that's doing a lot of things).</p> <p>If no simple solution is possible, I've to do this:</p> <pre><code>system("pkill &lt;process_name&gt;"); </code></pre> <p>and check its return code. But will pkill be available for sure on all Linux machines?</p>
[ { "answer_id": 375096, "author": "partoa", "author_id": 23857, "author_profile": "https://Stackoverflow.com/users/23857", "pm_score": 0, "selected": false, "text": "system(\"killall -s 9 process_name\");\n" }, { "answer_id": 891381, "author": "cjs", "author_id": 107294, ...
2008/12/17
[ "https://Stackoverflow.com/questions/374997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7205/" ]
375,009
<p>I have simple regex</p> <pre><code>"\".*\"" </code></pre> <p>for me its says select everything between " and ", but it also catches</p> <pre><code>"text") != -1 || file.indexOf(".exe" </code></pre> <p>for me its two strings, for regex its one. how can i make regex to see that its two strings?</p> <p>P.S. I'm using Java.</p>
[ { "answer_id": 375024, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 3, "selected": false, "text": "\"\\\"[^\\\"]*\\\"\"\n" }, { "answer_id": 375030, "author": "Douglas Leeder", "author_id": 3978, "a...
2008/12/17
[ "https://Stackoverflow.com/questions/375009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
375,014
<p>I would like to be able to refactor out the <strong>OrderBy</strong> clause in a linq expression. </p> <p>Here is an example of a refactor of the <strong>where</strong> clause </p> <p>before:</p> <pre><code>results = ctx.ActiveUsers .Where(u =&gt; u.CompanyID != 1 &amp;&amp; (u.LastName.ToLower().Contains(searchString) || u.Email.ToLower().Contains(searchString) || u.Company.Name.ToLower().Contains(searchString))) .OrderBy(u =&gt; u.LastName ).ThenBy(u =&gt; u.FirstName) .Select(u =&gt; new Employee { ID = u.ID , FirstName = u.FirstName , LastName = u.LastName , Email = u.Email , CompanyName = u.Company.Name , CompanyID = u.CompanyID.ToString() }); </code></pre> <hr> <p>after:</p> <pre><code>results = ctx.ActiveUsers .Where(Employee.GetExpression(searchString)) .OrderBy(u =&gt; u.LastName ).ThenBy(u =&gt; u.FirstName) .Select(u =&gt; new Employee { ID = u.ID , FirstName = u.FirstName , LastName = u.LastName , Email = u.Email , CompanyName = u.Company.Name , CompanyID = u.CompanyID.ToString() }); </code></pre> <hr> <pre><code>private static Expression&lt;Func&lt;User, bool&gt;&gt; GetExpression(string searchString) { Expression&lt;Func&lt;User, bool&gt;&gt; p = (u =&gt; u.CompanyID != 1 &amp;&amp; (u.LastName.ToLower().Contains(searchString) || u.Email.ToLower().Contains(searchString) || u.Company.Name.ToLower().Contains(searchString))); return p; } </code></pre> <p>I was wondering if the same type of thing would be possible except I would like to refactor the <strong>Orderby</strong> expression.</p> <p>Thank you in advance</p>
[ { "answer_id": 375074, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "var unordered = ctx.ActiveUsers\n .Where(Employee.GetExpression(searchString))\n .Ord...
2008/12/17
[ "https://Stackoverflow.com/questions/375014", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31470/" ]
375,053
<p>The goal is to take the current working directory split it at <code>/clients/</code> and see if the user is in</p> <pre>[something]/clients/[their username]/[something]</pre> <p>for example, the goal would be for input:</p> <pre><code>cwd = "/volumes/raid0/www/clients/mikey/test_folder/" $session-&gt;username = "mikey" </code></pre> <p>to return with </p> <pre><code>$authorized = true </code></pre> <p>I would like this to recognize both UNIX and Windows paths, so it should look for "/" or "\". It is assumed that filenames won't contain these characters.</p> <p>Also, the <code>isAdmin()</code> bit is supposed to give admins access to all directories.</p> <p>right now, PHP says:</p> <blockquote> <p>Warning: unexpected regex error (8) in c:\apache\htdocs\clients\mikey\index.php on line 69</p> </blockquote> <p>here's the code as it stands. (line 69 is noted in the comments.)</p> <pre><code>if($session-&gt;isAdmin()) { $authorized = true; } else { // split cwd at the first instance of /clients/ $dir = spliti('%(\/|\\)clients(\/|\\)%',getcwd(),2); //this is line 69 if(count($dir) == 2) // if /clients/ was in cwd { // check if the second piece of cwd starts with the username. $authorized = (preg_match('/^'.$session-&gt;username.'//*.$/', $dir[1])); } else $authorized = false; } </code></pre>
[ { "answer_id": 375089, "author": "Ruben Vermeersch", "author_id": 32713, "author_profile": "https://Stackoverflow.com/users/32713", "pm_score": 1, "selected": false, "text": "<?php\n$regex = '%(.+)(/|\\\\\\\\)clients(/|\\\\\\\\)(.+)(/|\\\\\\\\)(.+)(/|\\\\\\\\)%';\n\npreg_match($regex, \"...
2008/12/17
[ "https://Stackoverflow.com/questions/375053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
375,066
<p>I'm working with an application that logs to Windows Application Log regularly (viewable through the Event Viewer administrative tool), and I'm looking for a way to back it up on a daily basis. This is important because we sometimes discover a problem with the application - and to investigate further we need information that was logged a week ago. The events we are looking for aren't necessarily still around ... I've tried increasing the size and all that, but I think an automated backup would facilitate the process. We wouldn't end up with huge logs, but rather, multiple moderately-sized logs.</p> <p>I would <em>prefer</em> a simple solution like batch file + Windows Scheduler, but would also be interested in other approaches.</p> <p>Thanks</p>
[ { "answer_id": 375131, "author": "Stanislas Biron", "author_id": 43311, "author_profile": "https://Stackoverflow.com/users/43311", "pm_score": 3, "selected": true, "text": "dim strComputer = \".\" 'Define here the Remote IP Address or Computername\ndim objWMIService\ndim colLogFiles\ndim...
2008/12/17
[ "https://Stackoverflow.com/questions/375066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21263/" ]
375,068
<p>Right now we just use something like this</p> <pre><code> stopWatch.Start(); try { method(); } finally { stopWatch.Stop(); } </code></pre> <p>Which works fine for synchronous methods, but some are executing asynchronously, so the time is skewed when multiple threads are executing. Is there an equivalent to System.Diagnostics.Stopwatch that will measure only time spend in the current thread?</p> <p>We want to collect data over an extended period of time in our internal beta(alpha?) release, and running under a profiler full time isn't a feasible option.</p> <p>Edit: To clarify, we want to only measure the time spent executing method(), so if Method1() and Method2() both start at the same time and Method1 finishes at the 2 second mark and Method2 finishes at the 4 second mark, I want something that would tell me that Method1 spent about 1 second executing and Method2 spend about 3 seconds executing (Assuming during the first 2 seconds they shared the (assumed single core) processor equally.</p>
[ { "answer_id": 375225, "author": "Neil Barnwell", "author_id": 26414, "author_profile": "https://Stackoverflow.com/users/26414", "pm_score": 1, "selected": false, "text": "ThreadStatic" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/375068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23822/" ]
375,079
<p>How do I create an asp:Menu that has a horizontal submenu rather then a vertical one while keeping the top menu horizontal?</p>
[ { "answer_id": 375740, "author": "slf", "author_id": 13263, "author_profile": "https://Stackoverflow.com/users/13263", "pm_score": 0, "selected": false, "text": "<div id=\"nav\"><asp:menu .... /></div>\n #nav table { display: inline-block }\n#nav tr { display: inline-block }\n#nav td { d...
2008/12/17
[ "https://Stackoverflow.com/questions/375079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34281/" ]
375,083
<p>Hey all, I have something of an interesting requirement for my project. I need a <code>has_one</code> relationship where it is either one class or the other, but without inheritance. I could get away with inheritance if it is the only way, but the two associate records have completely different data and aren't related at all.</p> <p>What I need to figure out is something like the following.</p> <pre><code># 1. Foo never belongs to anything. # 2. Foo MUST have one assigned sub-record for validity. # 3. Foo can only have either Bar or Baz assigned. # 4. Bar and Baz have only ONE common property, and aren't # related in either data or implementation. class Foo &lt; ActiveRecord::Base # Attributes: id, name, value has_one :assignment, :foreign_key =&gt; 'assigned_to', :readonly =&gt; true # Could really use an :object_type for has_one here... end class Bar &lt; ActiveRecord::Base # Attributes: name,... end class Baz &lt; ActiveRecord::Base # Attributes: name,... end </code></pre> <p>Where <code>Foo</code> has one assignment, of type either <code>Bar</code> or <code>Baz</code>; they only share one common column, so perhaps I can make a parent object from that. However, if I make them inherit from a common object (when the data they contain really is oranges and apples) must I make a table for the record? Can I perhaps get away with it if the record is an abstract record, but the children aren't?</p> <p>I suppose by now you can see my difficulty. I'm rather new to RoR but loving it so far. I'm sure there's a way around this, but I'll be darned if I can't figure out what it is.</p>
[ { "answer_id": 375167, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 4, "selected": true, "text": "has_one" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/375083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24950/" ]
375,086
<p>I am trying to use the actual numerical value for the month on a sql query to pull results. Is there any way to do this without having a function to change the numbers to actual month names, then back to month numbers? The following code works for Names, what works for numbers?</p> <blockquote> <p>datename(month,(convert(datetime,DTSTAMP)))= 'October'</p> </blockquote>
[ { "answer_id": 376402, "author": "Jamal Hansen", "author_id": 2035722, "author_profile": "https://Stackoverflow.com/users/2035722", "pm_score": 0, "selected": false, "text": "DATEPART(mm, convert(datetime,DTSTAMP))\n" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/375086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
375,093
<p>I'm trying to achieve something google isn't able to give answer. I'm trying to create an asp.net usercontrol that when I put content into it's open close tag will include it for me to be still able to acess it's content by ID from the Parent. Here is an exemple of what I want to achieve.</p> <p>Usercontrol:</p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="ctrlGENE_CollapsiblePanel.ascx.cs" Inherits="Controls_GenericsControls_ctrlGENE_CollapsiblePanel" %&gt; &lt;asp:Panel ID="pnlHeader" CssClass="SnapPanelHeader" runat="server"&gt; &lt;h3&gt; &lt;asp:Literal ID="litTitle" Text='&lt;%# Text %&gt;' runat="server" /&gt; &lt;/h3&gt; &lt;div class="SnapPanelHeader-img"&gt; &lt;img id="imgOpenClose" src="/images/application/close.jpg" alt="" /&gt; &lt;/div&gt; &lt;/asp:Panel&gt; &lt;asp:PlaceHolder runat="server" ID="pnlContent"&gt; // **HERE I WANT TO INCLUDE THE INSIDE MARKUP** &lt;/asp:PlaceHolder&gt; &lt;act:CollapsiblePanelExtender runat="server" TargetControlID="pnlContent" ImageControlID="imgOpenClose" ExpandControlID="imgOpenClose" CollapseControlID="imgOpenClose" CollapsedImage="/images/application/open.jpg" ExpandedImage="/images/application/close.jpg" CollapsedSize="0" TextLabelID="litTitle"&gt; &lt;/act:CollapsiblePanelExtender&gt; </code></pre> <p>Parent Page that include control :</p> <pre><code>&lt;uc:MyUserControl ID="clpTest" runat="server"&gt; &lt;asp:Literal ID="litText" runat="server" /&gt; &lt;/uc:MyUserControl&gt; </code></pre> <p>Like this I would be able in the Parent.cs file to do :</p> <pre><code>litText.Text = "Anything"; </code></pre> <p>I know we can achieve something similiar with the ITemplate interface as show here : <a href="http://msdn.microsoft.com/en-us/library/36574bf6.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/36574bf6.aspx</a></p> <p>That would look like this:</p> <pre><code>&lt;uc:MyUserControl ID="clpTest" runat="server"&gt; &lt;ItemTemplate&gt; &lt;asp:Literal ID="litText" runat="server" /&gt; &lt;/ItemTemplate&gt; &lt;/uc:MyUserControl&gt; </code></pre> <p>But If I do this I wouldn't be able to access the property of litText and the only way I could reach it is with a FindControl, which I want to avoid.</p> <p>Anyone have a hint on this if I can reach my goal one way or another?</p> <p>Thank you</p>
[ { "answer_id": 376304, "author": "jpsimard-nyx", "author_id": 47109, "author_profile": "https://Stackoverflow.com/users/47109", "pm_score": 3, "selected": true, "text": "<asp:PlaceHolder runat=\"server\" ID=\"plhContent\" />\n [ParseChildren(false)]\n[PersistChildren(true)]\n public void...
2008/12/17
[ "https://Stackoverflow.com/questions/375093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47109/" ]
375,100
<p>When I set a component to visible=false the component hides, but how do I get it to take no space (get the container it belongs to to resize??)</p> <p></p> <pre><code>&lt;mx:HBox width="100%" height="100%"&gt; ... &lt;/mx:HBox&gt; &lt;mx:HBox width="100%" id="boxAddComment" visible="false" &gt; &lt;mx:TextArea id="txtComment"/&gt; &lt;mx:Button label="Spara" click="addComment();"/&gt; &lt;/mx:HBox&gt; </code></pre> <p></p> <p>When boxAddComment is visible=false I want the first HBox to take 100% height.</p>
[ { "answer_id": 375123, "author": "mmattax", "author_id": 1638, "author_profile": "https://Stackoverflow.com/users/1638", "pm_score": 6, "selected": true, "text": "\n<mx:HBox width=\"100%\" height=\"100%\">\n...\n</mx:HBox>\n\n<mx:HBox width=\"100%\" id=\"boxAddComment\" visible=\"false\"...
2008/12/17
[ "https://Stackoverflow.com/questions/375100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40939/" ]
375,104
<p>If I'm trying to match a quote-delimited string with a regex, which of the following is "better" (where "better" means both more efficient and less likely to do something unexpected):</p> <pre><code>/"[^"]+"/ # match quote, then everything that's not a quote, then a quote </code></pre> <p>or</p> <pre><code>/".+?"/ # match quote, then *anything* (non-greedy), then a quote </code></pre> <p>Assume for this question that empty strings (i.e. "") are not an issue. It seems to me (no regex newbie, but certainly no expert) that these will be equivalent. </p> <p><strong>Update</strong>: Upon reflection, I think changing the <code>+</code> characters to <code>*</code> will handle empty strings correctly anyway.</p>
[ { "answer_id": 375126, "author": "PEZ", "author_id": 44639, "author_profile": "https://Stackoverflow.com/users/44639", "pm_score": 2, "selected": false, "text": "/\".*?\"/\n" }, { "answer_id": 375146, "author": "Douglas Leeder", "author_id": 3978, "author_profile": "h...
2008/12/17
[ "https://Stackoverflow.com/questions/375104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1821/" ]
375,129
<p>I am writing a client for a backup server. My client schedules some folders for backup. (ex: every friday at hour X). I am using for scheduling <strong>cron4j</strong> (a port of Linux cron to java).</p> <p>Everything works nice until i schedule at the same time multiple upload jobs, then due to the multiple threads it gets messy.</p> <p>Can anyone help me with a solution for multi-threaded uploads to a ftp server ? (each thread has the job to upload a directory on the Ftp server).</p>
[ { "answer_id": 3686160, "author": "brown.2179", "author_id": 443434, "author_profile": "https://Stackoverflow.com/users/443434", "pm_score": 0, "selected": false, "text": "public class ServerConnection extends Thread {\n\n// the connection to the ftp server\nprivate final Ftp connection...
2008/12/17
[ "https://Stackoverflow.com/questions/375129", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47117/" ]
375,132
<p>I have a page generated by php which includes two drop-down lists (SELECTs) which contain a lot of items (about 2,000 each). The page is fine, but when it loads in Firefox, there's a delay during the load, and then it seems to refresh the entire page. If a user tries to click on anything before the "reload" occurs, it has no effect.</p> <p>In Explorer, each drop-down just takes a while (a second or two) to appear, which is fine.</p> <p>Anyone know what this is? And aside from using AJAX to dynamically fill the drop-down list, is there an easy way to avoid it?</p> <p>EDIT: Additional information. I have got my PHP script to output to a log file whenever it is called, so I can now see that what seems to be happening is this:</p> <p>A call is made to the PHP script, and the page starts to load. After a few seconds, another identical call is made to the PHP script, at which point the page starts to load again. This time it completes loading. So I guess it seems like the browser refreshes the page automatically for some reason before the page finishes loading.</p>
[ { "answer_id": 3686160, "author": "brown.2179", "author_id": 443434, "author_profile": "https://Stackoverflow.com/users/443434", "pm_score": 0, "selected": false, "text": "public class ServerConnection extends Thread {\n\n// the connection to the ftp server\nprivate final Ftp connection...
2008/12/17
[ "https://Stackoverflow.com/questions/375132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
375,133
<p>If I have the following nvarchar variable - BTA200, how can I extract just the BTA from it?</p> <p>Also, if I have varying lengths such as BTA50, BTA030, how can I extract just the numeric part?</p>
[ { "answer_id": 375145, "author": "RB.", "author_id": 15393, "author_profile": "https://Stackoverflow.com/users/15393", "pm_score": 2, "selected": false, "text": "SELECT LEFT(MyField, 3)\nFROM MyTable\n SELECT RIGHT(MyField, LEN(MyField) - 3)\nFROM MyTable\nWHERE MyField LIKE 'BTA%' \n--O...
2008/12/17
[ "https://Stackoverflow.com/questions/375133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
375,141
<p>I've trying to achieve something like this:</p> <pre><code>class Base { public: Base(string S) { ... }; } class Derived: Base { public: int foo; string bar() { return stringof(foo); // actually, something more complex }; Derived(int f) : foo(f), Base(bar()) { }; } </code></pre> <p>Now, this doesn't work as I want, because bar() is called in the Derived constructor before foo is initialized. </p> <p>I considered adding a static function similar to bar() which takes foo as a parameter - and using that in the initialization list, but thought I'd ask if there were any other techniques that could be used to dig myself out of this one...</p> <p><strong>Edit</strong>: Thanks for feedback - here's how I was going to handle the static function. Not sure if the overload between a static and non-static function is too clever, but...</p> <pre><code>class Derived: Base { public: int foo; static string bar(int f) { return stringof(f); // actually, something more complex } string bar() { return bar(foo); }; Derived(int f) : Base(bar(f)) , foo(f) { }; } </code></pre>
[ { "answer_id": 375171, "author": "Judge Maygarden", "author_id": 1491, "author_profile": "https://Stackoverflow.com/users/1491", "pm_score": 3, "selected": true, "text": "Derived(int f) : Base(stringof(f)), foo(f) {}\n class Base {\npublic:\n Base(string S) { ... }\n void bat() {...
2008/12/17
[ "https://Stackoverflow.com/questions/375141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1737/" ]
375,150
<p>As the title says, whats the difference between</p> <pre><code>MyFunction = function() { } </code></pre> <p>and</p> <pre><code>function MyFunction() { } </code></pre> <p>Nothing?</p> <p><strong>Duplicate:</strong> <a href="https://stackoverflow.com/questions/336859/javascript-var-functionname-function-vs-function-functionname">var functionName = function() {} vs function functionName() {}</a></p>
[ { "answer_id": 375162, "author": "singpolyma", "author_id": 8611, "author_profile": "https://Stackoverflow.com/users/8611", "pm_score": 0, "selected": false, "text": "var MyFunction = function() {\n}\n" }, { "answer_id": 375180, "author": "Jimmy", "author_id": 4435, "...
2008/12/17
[ "https://Stackoverflow.com/questions/375150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39655/" ]
375,154
<p>Assuming the file exists (using <code>os.path.exists(filename)</code> to first make sure that it does), how do I display the time a file was last modified? This is on Linux if that makes any difference.</p>
[ { "answer_id": 375168, "author": "Douglas Leeder", "author_id": 3978, "author_profile": "https://Stackoverflow.com/users/3978", "pm_score": 7, "selected": true, "text": "import os\nfilename = \"/etc/fstab\"\nstatbuf = os.stat(filename)\nprint(\"Modification time: {}\".format(statbuf.st_m...
2008/12/17
[ "https://Stackoverflow.com/questions/375154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
375,164
<p>I am using jqGrid of which I downloaded from here <a href="http://www.trirand.com/blog" rel="nofollow noreferrer">http://www.trirand.com/blog</a> . I followed the tutorial word by word to test out the grid. Now the alterations I did is that the page from which the grid gets the data is in asp.net instead of php. </p> <p>The problem is that the grid loads fine and there is a response with the xml data that I generated but for some reason isnt being loaded on the grid itself (ie im left with a blank grid.</p> <p>The code that i used is </p> <pre><code>&lt;link rel="stylesheet" type="text/css" media="screen" href="js/themes/basic/grid.css" /&gt; &lt;link rel="stylesheet" type="text/css" media="screen" href="js/themes/jqModal.css" /&gt; &lt;script src="js/jquery.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/jquery.jqGrid.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/js/jqModal.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/js/jqDnR.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; jQuery(document).ready(function(){ jQuery("#list").jqGrid({ url:'nrGetjqgridXML.aspx', datatype: "xml", colNames:['Dummy ID','Dummy String','Dummy Int','Dummy Char','Dummy Bool','Dummy Date','Dummy Float'],colModel :[{name:'dummyID', index:'dummyID' , width:100, sortable:true},{name:'dummyString', index:'dummyString' , width:100, sortable:true},{name:'dummyInt', index:'dummyInt' , width:100, sortable:true},{name:'dummyChar', index:'dummyChar' , width:100, sortable:true},{name:'dummyBool', index:'dummyBool' , width:100, sortable:true},{name:'dummyDate', index:'dummyDate' , width:100, sortable:true},{name:'dummyFloat', index:'dummyFloat' , width:100, sortable:true}], rowNum: 10, rowList:[10,20,30], imgpath: 'js/themes/basic/images', pager: jQuery('#pager'), sortname: 'dummyid', viewrecords: true, sortorder: "desc", caption: 'Test Grid' }).navGrid('#pager', {edit:false , add:false, del:false}); }); &lt;/script&gt; </code></pre> <p>and this is the response of nrGetjqgridXML :</p> <pre><code>&lt;xml version='1.0' encoding = 'utf-8'?&gt; &lt;rows&gt; &lt;page&gt;1&lt;/page&gt; &lt;total&gt;2&lt;/total&gt; &lt;records&gt;15&lt;/records &gt; &lt;row id = '15'&gt; &lt;cell&gt;15&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test15]]&gt;&lt;/cell&gt; &lt;cell&gt;15&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[o]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[False]]&gt;&lt;/cell&gt; &lt;cell&gt;15/03/2005 00:00:00&lt;/cell&gt; &lt;cell&gt;15.15&lt;/cell&gt; &lt;/row&gt; &lt;row id = '14'&gt; &lt;cell&gt;14&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test14]]&gt;&lt;/cell&gt; &lt;cell&gt;14&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[n]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[False]]&gt;&lt;/cell&gt; &lt;cell&gt;14/02/2004 00:00:00&lt;/cell&gt; &lt;cell&gt;14.14&lt;/cell&gt; &lt;/row&gt;&lt;row id = '13'&gt; &lt;cell&gt;13&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test13]]&gt;&lt;/cell&gt; &lt;cell&gt;13&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[m]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[True]]&gt;&lt;/cell&gt; &lt;cell&gt;13/01/2003 00:00:00&lt;/cell&gt; &lt;cell&gt;13.13&lt;/cell&gt; &lt;/row&gt; &lt;row id = '12'&gt; &lt;cell&gt;12&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test12]]&gt;&lt;/cell&gt; &lt;cell&gt;12&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[l]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[False]]&gt;&lt;/cell&gt; &lt;cell&gt;12/12/2002 00:00:00&lt;/cell&gt; &lt;cell&gt;12.12&lt;/cell&gt; &lt;/row&gt;&lt;row id = '11'&gt; &lt;cell&gt;11&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test11]]&gt;&lt;/cell&gt; &lt;cell&gt;11&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[k]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[True]]&gt;&lt;/cell&gt; &lt;cell&gt;11/11/2001 00:00:00&lt;/cell&gt; &lt;cell&gt;11.11&lt;/cell&gt; &lt;/row&gt; &lt;row id = '10'&gt; &lt;cell&gt;10&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test10]]&gt;&lt;/cell&gt; &lt;cell&gt;10&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[j]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[False]]&gt;&lt;/cell&gt; &lt;cell&gt;10/10/2000 00:00:00&lt;/cell&gt; &lt;cell&gt;10.1&lt;/cell&gt; &lt;/row&gt; &lt;row id = '9'&gt; &lt;cell&gt;9&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test9]]&gt;&lt;/cell&gt; &lt;cell&gt;9&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[i]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[False]]&gt;&lt;/cell&gt; &lt;cell&gt;09/09/1999 00:00:00&lt;/cell&gt; &lt;cell&gt;9.9&lt;/cell&gt; &lt;/row&gt; &lt;row id = '8'&gt; &lt;cell&gt;8&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test8]]&gt;&lt;/cell&gt; &lt;cell&gt;8&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[h]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[False]]&gt;&lt;/cell&gt; &lt;cell&gt;08/08/1998 00:00:00&lt;/cell&gt; &lt;cell&gt;8.8&lt;/cell&gt; &lt;/row&gt; &lt;row id = '7'&gt; &lt;cell&gt;7&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test7]]&gt;&lt;/cell&gt; &lt;cell&gt;7&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[g]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[True]]&gt;&lt;/cell&gt; &lt;cell&gt;07/07/1997 00:00:00&lt;/cell&gt; &lt;cell&gt;7.7&lt;/cell&gt; &lt;/row&gt; &lt;row id = '6'&gt; &lt;cell&gt;6&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test6]]&gt;&lt;/cell&gt; &lt;cell&gt;6&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[f]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[True]]&gt;&lt;/cell&gt; &lt;cell&gt;06/06/1996 00:00:00&lt;/cell&gt; &lt;cell&gt;6.6&lt;/cell&gt; &lt;/row&gt; &lt;row id = '5'&gt; &lt;cell&gt;5&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test5]]&gt;&lt;/cell&gt; &lt;cell&gt;5&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[e]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[False]]&gt;&lt;/cell&gt; &lt;cell&gt;05/05/1995 00:00:00&lt;/cell&gt; &lt;cell&gt;5.5&lt;/cell&gt; &lt;/row&gt; &lt;row id = '4'&gt; &lt;cell&gt;4&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test4]]&gt;&lt;/cell&gt; &lt;cell&gt;4&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[d]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[True]]&gt;&lt;/cell&gt; &lt;cell&gt;04/04/1994 00:00:00&lt;/cell&gt; &lt;cell&gt;4.4&lt;/cell&gt; &lt;/row&gt; &lt;row id = '3'&gt; &lt;cell&gt;3&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test3]]&gt;&lt;/cell&gt; &lt;cell&gt;3&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[c]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[False]]&gt;&lt;/cell&gt; &lt;cell&gt;03/03/1993 00:00:00&lt;/cell&gt; &lt;cell&gt;3.3&lt;/cell&gt; &lt;/row&gt; &lt;row id = '2'&gt; &lt;cell&gt;2&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test2]]&gt;&lt;/cell&gt; &lt;cell&gt;2&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[b]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[False]]&gt;&lt;/cell&gt; &lt;cell&gt;02/02/1992 00:00:00&lt;/cell&gt; &lt;cell&gt;2.2&lt;/cell&gt; &lt;/row&gt; &lt;row id = '1'&gt; &lt;cell&gt;1&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[Test1]]&gt;&lt;/cell&gt; &lt;cell&gt;1&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[a]]&gt;&lt;/cell&gt; &lt;cell&gt;&lt;![CDATA[True]]&gt;&lt;/cell&gt; &lt;cell&gt;01/01/1991 00:00:00&lt;/cell&gt; &lt;cell&gt;1.1&lt;/cell&gt; &lt;/row&gt; &lt;/rows&gt; </code></pre> <p>This is how the grid is showing up : <a href="http://img132.imageshack.us/img132/6671/testgridol7.jpg" rel="nofollow noreferrer">alt text http://img132.imageshack.us/img132/6671/testgridol7.jpg</a></p>
[ { "answer_id": 376774, "author": "Christian Payne", "author_id": 5188, "author_profile": "https://Stackoverflow.com/users/5188", "pm_score": 1, "selected": false, "text": "<script src=\"grid/js/jqDnR.js\" type=\"text/javascript\">\n</script>\n </rows>\n" }, { "answer_id": 530598,...
2008/12/17
[ "https://Stackoverflow.com/questions/375164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45471/" ]
375,165
<p>I would like to create a visual effect when an item in a listbox is double clicked. So far I have drag and drop functionality where the item is visually attached to the mouse and can be moved to a drop target. From that functionality I am able to animate the item using the same logic of getting the item container, however I am not able to leave the items control. Is there any way to remove the item from the ListBox and visually animate it to another location? Basically the main list box is a hand of cards. When a card is double-clicked I want it to visually move from the hand listbox to a discard listbox. As of now, the logic for moving the item from one collection to another is no problem, however I would really like an animated visual representation of this event. Any ideas or references on how to do something like this would be appreciated. </p> <p>Thanks, Brandon</p> <p>Further Details on what I have attempted: There are some concepts that I do not yet have a strong grasp of yet, which has led me to run face first into this wall. I have a method that I pass in(some may be unnecessary) the ListBox as an ItemsControl, a FrameworkElement that is the listbox item, and the data object associated with the ListBox item. What I attempted to do was FindVisualChild of the ListBoxItem that is a canvas. I can do that. In my mind I was wanting to somehow clone the canvas either as a canvas or as a bitmap, add it to the children of the child of the page in the same location, remove the ListBoxItem from the ListBox, and animate the clone to the discard pile. When the animation completes the clone will be removed or hidden, and as that object is added to the discard pile collection it will effectively take the replace the clone.</p> <p>My problem with this, is that I feel like there really is a simpler way of doing this using the adorner layer or something. I also, don't know how I would position the clone at the exact same position in the element further up the visual tree. I am going to keep working on it and researching other approaches, and I will just hope that someone will share some insight on this.</p>
[ { "answer_id": 418918, "author": "jlew", "author_id": 7450, "author_profile": "https://Stackoverflow.com/users/7450", "pm_score": 3, "selected": true, "text": " public static BitmapSource CreateBitmapFromElement(FrameworkElement element, Double dpiX, Double dpiY)\n {\n ...
2008/12/17
[ "https://Stackoverflow.com/questions/375165", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42858/" ]
375,178
<p>I can't find any post regarding the cache on logout so I'm going to ask this question. If there is a similar question. Please let me know.</p> <p>I have a Logout page that basically call FormAuthentications signout method then redirect the user to the login page. It work fine but the problem is user can click on the browser's back button and get the cached page. I tried to set the no-cache header on my master page but that doesn't work.</p> <p>Can someone point me to a article or tutorial or post some tips on how you handle this situation?</p> <p>thank</p>
[ { "answer_id": 375686, "author": "Darin Dimitrov", "author_id": 29407, "author_profile": "https://Stackoverflow.com/users/29407", "pm_score": 2, "selected": false, "text": "// Prevent the browser from caching the ASPX page\nResponse.Cache.SetNoStore();\n <meta http-equiv=\"Cache-Control\...
2008/12/17
[ "https://Stackoverflow.com/questions/375178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28647/" ]
375,194
<p>suppose that I have this RDBM table (<a href="http://en.wikipedia.org/wiki/Entity-attribute-value_model" rel="nofollow noreferrer">Entity-attribute-value_model</a>):</p> <pre><code>col1: entityID col2: attributeName col3: value </code></pre> <p>and I want to use HBase due to scaling issues.</p> <p>I know that the only way to access Hbase table is using a primary key (cursor). you can get a cursor for a specific key, and iterate the rows one-by-one . </p> <p>The issue is, that in my case, I want to be able to iterate on all 3 columns. for example :</p> <ul> <li>for a given an entityID I want to get all its attriutes and values</li> <li>for a give attributeName and value I want to all the entitiIDS ...</li> </ul> <p>so one idea I had is to build one Hbase table that will hold the data (table DATA, with entityID as primary index), and 2 "index" tables one with attributeName as a primary key, and the other one with value</p> <p>each index table will hold a list of pointers (entityIDs) for the DATA table.</p> <p>Is it a reasonable approach ? or is is an 'abuse' of Hbase concepts ?</p> <p>In this <a href="http://blog.rapleaf.com/dev/?p=26" rel="nofollow noreferrer">blog</a> the <a href="http://blog.rapleaf.com/dev/?author=7" rel="nofollow noreferrer">author</a> say:</p> <blockquote> <p>HBase allows get operations by primary key and scans (think: cursor) over row ranges. (If you have both scale and need of secondary indexes, don’t worry - Lucene to the rescue! But that’s another post.)</p> </blockquote> <p>Do you know how Lucene can help ? </p> <p>-- Yonatan</p>
[ { "answer_id": 16921162, "author": "Suman", "author_id": 1203129, "author_profile": "https://Stackoverflow.com/users/1203129", "pm_score": 0, "selected": false, "text": "entityID1 {\n attribute1: value1;\n attribute2: value2;\n ...\n}\n attribute1_value1 {\n entityID1;\n}\nattribute2...
2008/12/17
[ "https://Stackoverflow.com/questions/375194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20065/" ]
375,203
<p>my ruby (on rails) class looks like:</p> <p>class Foo def self.method1 someAction end</p> <p>def self.method2 someAction end</p> <p>def someAction //doSmth end end</p> <p>any ideas how to make this work or achieve the same behavior some other way?</p> <p>thanks!</p>
[ { "answer_id": 375224, "author": "Hates_", "author_id": 3410, "author_profile": "https://Stackoverflow.com/users/3410", "pm_score": 1, "selected": false, "text": "class Foo \n\n def self.method1 \n myFoo = Foo.new\n myFoo.someAction \n end\n\n def someAction \n ...
2008/12/17
[ "https://Stackoverflow.com/questions/375203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47124/" ]
375,204
<p>I have a problem. I built a script to make a request to an internal link that sends back a response. This is what the script looks like:</p> <pre><code>jQuery.get(callUrl, function(data) { console.log(typeof data); jQuery.each(data.items, function(i, item) { console.log(i); }); }, 'json'); </code></pre> <p>and the response that the server sends back looks like this:</p> <pre><code>{"items":[ { "src": "gallery_item_data_Jc4EaLP6vlwd_large.jpg", "id": "83", "gallery_id": "30", "username": "admin" }] } </code></pre> <p>My problem is when I parse the "data" its type is always string. I need for it to be an object so that I can query it and parse it with my script. To get to the bottom of the problem, I've tried comparing my script to the example on jQuery's documentation page: </p> <p><a href="http://docs.jquery.com/Ajax/jQuery.getJSON" rel="nofollow noreferrer">http://docs.jquery.com/Ajax/jQuery.getJSON</a></p> <p>The main differences with the request on this page and my request is that it uses the getJSON method. When I tried to use that with the url to my server, I have gotten no response at all, so that is the main reason I opted for the get method, and specifying the return type as "json."</p> <p>Another thing I tried: I checked out the <a href="http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&amp;tagmode=any&amp;format=json&amp;jsoncallback=?" rel="nofollow noreferrer">Flickr feed</a> that the jQuery example uses to look for the Content-type header that it sends back, thinking maybe my feed had the wrong header, and it is this on the Flickr feed:</p> <pre><code>Content-Type application/x-javascript; charset=utf-8 </code></pre> <p>This is exactly the same header on my own feed. So I am puzzled. Does anyone know why this is happening?</p>
[ { "answer_id": 375236, "author": "Mark Bell", "author_id": 43140, "author_profile": "https://Stackoverflow.com/users/43140", "pm_score": 4, "selected": true, "text": "({\"items\":[ \n {\n \"src\": \"gallery_item_data_Jc4EaLP6vlwd_large.jpg\",\n \"id\": \"83\",\n \"galle...
2008/12/17
[ "https://Stackoverflow.com/questions/375204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32816/" ]
375,221
<p>In the unmanaged development world, you could observe the DWORD return value of a method by typing '@eax' into the watch window of the debugger.</p> <p>Does anyone know of an equivalent shortcut in managed code?</p> <p>Related point: I have learned that VS2008 SP1 supports <b>$exception</b> as a magic word in the watch window. Are there any other shortcuts that you know of?</p>
[ { "answer_id": 375396, "author": "John Mulder", "author_id": 2242, "author_profile": "https://Stackoverflow.com/users/2242", "pm_score": 2, "selected": false, "text": " $ADDRESS address of current instruction\n $CALLER name of the previous function on the call stack\n $CALL...
2008/12/17
[ "https://Stackoverflow.com/questions/375221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47114/" ]
375,223
<p>I have a Panel with a collection of controls in it. How can I get the index of a specific control when iterating through them? I'm using <code>foreach</code> to iterate, but there's no Index property. Should I use <code>for x = 0...</code> and return <code>x</code> when my match is made, or what?</p>
[ { "answer_id": 375242, "author": "Steven Behnke", "author_id": 42588, "author_profile": "https://Stackoverflow.com/users/42588", "pm_score": 3, "selected": false, "text": "panel.Controls.IndexOf(control);\n" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/375223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28240/" ]
375,248
<p>I came across a problem in my current application that required fiddling with the query string in a base <code>Page</code> class (which all my pages inherit from) to solve the problem. Since some of my pages use the query string I was wondering if there is any class that provides clean and simple query string manipulation.</p> <p>Example of code:</p> <pre><code>// What happens if I want to future manipulate the query string elsewhere // (e.g. maybe rewrite when the request comes back in) // Or maybe the URL already has a query string (and the ? is invalid) Response.Redirect(Request.Path + "?ProductID=" + productId); </code></pre>
[ { "answer_id": 375304, "author": "technophile", "author_id": 23029, "author_profile": "https://Stackoverflow.com/users/23029", "pm_score": 3, "selected": true, "text": "HttpUtility.ParseQueryString HttpValueCollection NameValueCollection ToString HttpValueCollection ToString" }, { ...
2008/12/17
[ "https://Stackoverflow.com/questions/375248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40007/" ]
375,252
<p>I have a java applet that is embedded in html using the <code>object-comment-embed</code> method. I would like to resize the applet whenever the browser window is resized. I have found solutions around the internet, but they all work based on the deprecated <code>applet</code> tag.</p> <p>Also, when trying a <code>setSize()</code> call on my <code>embed</code> element in FireBug, it will resize the content of the applet, but not the applet viewport. That is, the area of the display that is given over to java does not change.</p> <p>Current code looks something like this:</p> <pre><code>&lt;object id='MyApplet1' width='300' height='200' classid='clsid:XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' codebase='http://java.sun.com/update/1.6.0/jinstall-6-windows-i586.cab#Version=1,6,0,0'&gt; &lt;param name='type' value='application/x-java-applet;version=1.6'&gt; &lt;param name='scriptable' value='false'&gt; &lt;param name='codebase' value='foo'&gt; &lt;param name='code' value='bar'&gt; &lt;param name='archive' value='baz'&gt; &lt;param name='arg1' value='A'&gt; &lt;param name='arg2' value='B'&gt; &lt;comment&gt; &lt;embed id='MyApplet2' width='300' height='200' pluginspage='http://java.sun.com/products/plugin/index.html#download' type='application/x-java-applet;version=1.6' scriptable='false' codebase='foo' code='bar' archive='baz' arg1='A' arg2='B'&gt; &lt;noembed&gt; &lt;/noembed&gt; &lt;/embed&gt; &lt;/comment&gt; &lt;/object&gt; &lt;script type="text/javascript"&gt; function resize() { min_width = 300; min_height = 200; frame_width = 0; frame_height = 0; if(parseInt(navigator.appVersion) &gt; 3) { if(navigator.appName=='Netscape') { frame_width = window.innerWidth; frame_height = window.innerHeight; } if (navigator.appName.indexOf('Microsoft') != -1) { frame_width = document.body.offsetWidth; frame_height = document.body.offsetHeight; } } frame_width *= 0.78; frame_height *= 0.78; applet_width = frame_width &gt; min_width ? frame_width : min_width; applet_height = frame_height &gt; min_height ? frame_height : min_height; document.getElementById('MyApplet1').setSize(applet_width, applet_height); document.getElementById('MyApplet2').setSize(applet_width, applet_height); } window.onResize = resize; window.onLoad = resize; &lt;/script&gt; </code></pre>
[ { "answer_id": 375290, "author": "Jack", "author_id": 24998, "author_profile": "https://Stackoverflow.com/users/24998", "pm_score": 2, "selected": false, "text": "document.getElementById('MyApplet1').setSize(applet_width, applet_height);\ndocument.getElementById('MyApplet2').setSize(appl...
2008/12/17
[ "https://Stackoverflow.com/questions/375252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7161/" ]
375,259
<p>I'm working on an embedded device that does not support unaligned memory accesses. </p> <p>For a video decoder I have to process pixels (one byte per pixel) in 8x8 pixel blocks. The device has some SIMD processing capabilities that allow me to work on 4 bytes in parallel.</p> <p>The problem is, that the 8x8 pixel blocks aren't guaranteed to start on an aligned address and the functions need to read/write up to three of these 8x8 blocks. </p> <p>How would you approach this if you want very good performance? After a bit of thinking I came up with the following three ideas:</p> <ol> <li><p>Do all memory accesses as bytes. This is the easiest way to do it but slow and it does not work well with the SIMD capabilites (it's what I'm currently do in my reference C-code). </p></li> <li><p>Write four copy-functions (one for each alignment case) that load the pixel-data via two 32-bit reads, shift the bits into the correct position and write the data to some aligned chunk of scratch memory. The video processing functions can then use 32 bit accesses and SIMD. Drawback: The CPU will have no chance to hide the memory latency behind the processing.</p></li> <li><p>Same idea as above, but instead of writing the pixels to scratch memory do the video-processing in place. This may be the fastest way, but the number of functions that I have to write for this approach is high (around 60 I guess).</p></li> </ol> <p>Btw: I will have to write all functions in assembler because the compiler generates horrible code when it comes to the SIMD extension. </p> <p>Which road would you take, or do you have another idea how to approach this?</p>
[ { "answer_id": 375693, "author": "strager", "author_id": 39992, "author_profile": "https://Stackoverflow.com/users/39992", "pm_score": 2, "selected": false, "text": "memcpy malloc" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/375259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15955/" ]
375,262
<p>Let's say I have a payments table like so:</p> <pre><code>CREATE TABLE Payments ( PaymentID INT, CustomerID INT, Value INT, PaidOn DATE ); INSERT INTO Payments VALUES (1, 1, 5, '2000-01-01'), (2, 1, 10, '2000-02-01'), (3, 2, 10, '2000-01-02'), (4, 2, 10, '2000-01-20'), (5, 2, 5, '2000-02-02'), </code></pre> <p>And I want to run a query for the entire row for the maximum payment made by each customer. Is this possible using a single SQL query, to avoid having to dig through every row that I'm not interested -- or worse, run a query for each customer?</p> <p>The best I have come up with so far is:</p> <pre><code>SELECT CustomerID, MAX(Value) FROM Payments GROUP BY CustomerID; </code></pre> <p>But this does not give me the <code>PaymentId</code> or <code>PaidOn</code> values for the rows it finds.</p>
[ { "answer_id": 375271, "author": "RB.", "author_id": 15393, "author_profile": "https://Stackoverflow.com/users/15393", "pm_score": 3, "selected": true, "text": "SELECT *\nFROM payments p\nWHERE NOT EXISTS (\n SELECT *\n FROM payments p2\n WHERE p2.CustomerID = p.CustomerId\n ...
2008/12/17
[ "https://Stackoverflow.com/questions/375262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/420/" ]
375,265
<p>I've implemented my own event handler and added it to the selection model of the table:</p> <pre><code>table.getSelectionModel().addListSelectionListener(event); </code></pre> <p>And implemented the method for "event" (mentioned above):</p> <pre><code>public void valueChanged(ListSelectionEvent e) { log.debug("value changed"); } </code></pre> <p>Unfortunately the event fires twice if I chance the selection and it doesn't seem possible to find the associated table, because e.getSource provides javax.swing.DefaultListSelectionModel.</p> <p>Hence my questions are:</p> <p>1) Why does it fire twice although the eventListener is only registered once?</p> <p>2) How can I find the table for which the selection applies? The DefaultListSelectionModel doesn't seem to offer any getSource() or similar.</p> <p>Many thanks!</p>
[ { "answer_id": 10186239, "author": "Think Force", "author_id": 1337987, "author_profile": "https://Stackoverflow.com/users/1337987", "pm_score": 4, "selected": false, "text": "vMachinesTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {\n\n public void val...
2008/12/17
[ "https://Stackoverflow.com/questions/375265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33429/" ]
375,273
<p>I've long used cygwin's nm command for all my .lib symbol debugging needs, but recently I thought about referring to it in a SO answer and realized that most Windows developers don't have cygwin installed.</p> <p>So what is the Microsoft equivalent to nm, i.e., what command will list the symbols exported by a .lib file, the undefined symbols in the .lib, and so forth?</p> <p>For the curious, a sample nm man page is <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?nm" rel="noreferrer">here</a>.</p>
[ { "answer_id": 53478427, "author": "rashok", "author_id": 596370, "author_profile": "https://Stackoverflow.com/users/596370", "pm_score": 3, "selected": false, "text": "vcvarsall.bat dumpbin.exe D:>\"D:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\vcvarsall.bat\" x86 dumpbin.exe d...
2008/12/17
[ "https://Stackoverflow.com/questions/375273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34502/" ]
375,287
<p>Is there a way to determine in the child page's code behind that is was opened by the window.open() javascript command from the parent page?</p> <p>The pop-up page contains a user control that is used by other pages that are not spawned from a window.open() command and I want to dynamically add functionality to close the page after the user has completed their task in the child page.</p> <p>It is an ASP.NET C# 3.5 application. </p>
[ { "answer_id": 375307, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 1, "selected": false, "text": "Referer window.opener" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/375287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
375,291
<p>I am using a ScrollViewer as part of my Silverlight application. It has a horizontal orientation, and I would like it to appear such that only the scroll buttons appear, but not the scroll bar itself. Something like this crude ASCII rendering:</p> <pre><code>------------------------------------------------------ | | | | | &lt; | Content Here | &gt; | | | | | ------------------------------------------------------ </code></pre> <p>I know I could use the templating functionality, but all the samples I've seen only change the look of all the elements, and not their raw positioning, or whether they even appear. Is it possible to do this, and could someone provide an outline of what the template might look like?</p>
[ { "answer_id": 375794, "author": "Bryant", "author_id": 10893, "author_profile": "https://Stackoverflow.com/users/10893", "pm_score": 1, "selected": false, "text": "<Canvas x:Name=\"root\">\n <Button x:Name=\"left\" Content=\"<\"/>\n <Button x:Name=\"right\" Content=\">\"/>\n <ScrollV...
2008/12/17
[ "https://Stackoverflow.com/questions/375291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22407/" ]
375,300
<p>I want to decode all the HTML entities in a complicated data structure. Basically I'm looking for a "super map()" function. Here's what I have so far:</p> <pre><code>sub _html_decode { my $self = shift; my $ref = shift; if (ref($ref) eq "HASH") { $self-&gt;_html_decode_hash($ref) } if (ref($ref) eq "ARRAY") { $self-&gt;_html_decode_array($ref); } } sub _html_decode_array { my $self = shift; my $ref = shift; unless (@$ref) {return;} foreach (0 .. (scalar(@$ref) - 1)) { if (ref($ref-&gt;[$_]) eq "HASH") { $self-&gt;_html_decode_hash($ref-&gt;[$_]); } if (ref($ref-&gt;[$_]) eq "ARRAY") { $self-&gt;_html_decode_array($ref-&gt;[$_]); } else { $ref-&gt;[$_] = decode_entities($ref-&gt;[$_]); } } } sub _html_decode_hash { my $self = shift; my $ref = shift; unless (%$ref) {return;} while (my ($k, $v) = each %$ref) { if (ref($v) eq "HASH") { $self-&gt;_html_decode_hash($v); } if (ref($v) eq "ARRAY") { $self-&gt;_html_decode_array($v) } else { $ref-&gt;{$k} = decode_entities($v); } } } </code></pre>
[ { "answer_id": 375342, "author": "Leon Timmermans", "author_id": 4727, "author_profile": "https://Stackoverflow.com/users/4727", "pm_score": 2, "selected": false, "text": "sub _html_decode {\n my ($self, $ref) = @_;\n\n if (ref($ref) eq \"HASH\") {\n for my $value (values %{...
2008/12/17
[ "https://Stackoverflow.com/questions/375300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25068/" ]
375,316
<p>Okay, so basically I want to be able to retrieve keyboard text. Like entering text into a text field or something. I'm only writing my game for windows. I've disregarded using Guide.BeginShowKeyboardInput because it breaks the feel of a self contained game, and the fact that the Guide always shows XBOX buttons doesn't seem right to me either. Yes it's the easiest way, but I don't like it.</p> <p>Next I tried using System.Windows.Forms.NativeWindow. I created a class that inherited from it, and passed it the Games window handle, implemented the WndProc function to catch WM_CHAR (or WM_KEYDOWN) though the WndProc got called for other messages, WM_CHAR and WM_KEYDOWN never did. So I had to abandon that idea, and besides, I was also referencing the whole of Windows forms, which meant unnecessary memory footprint bloat.</p> <p>So my last idea was to create a Thread level, low level keyboard hook. This has been the most successful so far. I get WM_KEYDOWN message, (not tried WM_CHAR yet) translate the virtual keycode with Win32 funcation MapVirtualKey to a char. And I get my text! (I'm just printing with Debug.Write at the moment)</p> <p>A couple problems though. It's as if I have caps lock on, and an unresponsive shift key. (Of course it's not however, it's just that there is only one Virtual Key Code per key, so translating it only has one output) and it adds overhead as it attaches itself to the Windows Hook List and isn't as fast as I'd like it to be, but the slowness could be more due to Debug.Write.</p> <p>Has anyone else approached this and solved it, without having to resort to an on screen keyboard? or does anyone have further ideas for me to try?</p> <p>thanks in advance.</p> <p>Question asked by Jimmy</p> <blockquote> <p>Maybe I'm not understanding the question, but why can't you use the XNA Keyboard and KeyboardState classes?</p> </blockquote> <p>My comment:</p> <blockquote> <p>It's because though you can read keystates, you can't get access to typed text as and how it is typed by the user.</p> </blockquote> <p>So let me further clarify. I want to implement being able to read text input from the user as if they are typing into textbox is windows. The keyboard and KeyboardState class get states of all keys, but I'd have to map each key and combination to it's character representation. This falls over when the user doesn't use the same keyboard language as I do especially with symbols (my double quotes is shift + 2, while american keyboards have theirs somewhere near the return key).</p> <hr> <p>it seems my window hook was the way to go, just the reason I wasn't getting WM_CHAR is because the XNA message pump doesn't do translate message. </p> <p>Adding TranslateMessage in whenever I received a WM<code>_</code>KEYDOWN message meant I got my WM_CHAR message, I then used this to fire a character typed event in my MessageHook class which my KeyboardBuffer class had subscribed to, which then buffers that to a text buffer :D (or StringBuilder, but the result is the same)</p> <p>So I have it all working as I want.</p> <p>Many thanks to Jimmy for a link to a very informative thread.</p>
[ { "answer_id": 647273, "author": "Sekhat", "author_id": 1610, "author_profile": "https://Stackoverflow.com/users/1610", "pm_score": 3, "selected": false, "text": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Runtime.InteropService...
2008/12/17
[ "https://Stackoverflow.com/questions/375316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1610/" ]
375,320
<p><img src="https://farm4.static.flickr.com/3200/3116366800_570cc971b9_m.jpg" alt="Screenshot of Drop Down" /></p> <p>This would be my issue I have a drop down that's not displaying fully. I'm not sure even where to start so here's the HTML surronding the drop down and I'll provide the CSS also.</p> <p>HTML</p> <pre><code>&lt;div id=&quot;add_item&quot;&gt; &lt;ul class=&quot;vert&quot;&gt; &lt;li&gt; &lt;ul class=&quot;horz&quot;&gt; &lt;li class=&quot;name&quot;&gt; &lt;select style=&quot;width: 195px; padding: 0px; margin: 0px;&quot; disabled=&quot;disabled&quot;&gt; &lt;option value=&quot;&quot;&gt;&lt;/option&gt; &lt;option value=&quot;0&quot;&gt;0&lt;/option&gt; &lt;/select&gt; &lt;/li&gt; &lt;li class=&quot;quantity&quot;&gt; &lt;select style=&quot;width: 50px; padding: 0px; margin: 0px;&quot; disabled=&quot;disabled&quot;&gt; &lt;option value=&quot;&quot;&gt;&lt;/option&gt; &lt;option value=&quot;0&quot;&gt;0&lt;/option&gt; &lt;/select&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>The reason the code has the drop down as being disabled is because it's dynamic, the surrounding HTML is the same except for having options to choose from and no longer being disabled.</p> <p>CSS</p> <pre><code>div#byitem ul.horz li.name { background:transparent none repeat scroll 0 0; display:block; font-size:11px; font-weight:bold; width:195px; } div#byitem ul.horz { background:transparent none repeat scroll 0 0; clear:left; list-style-type:none; margin:0; padding:0; } div#byitem ul.vert li { background:transparent none repeat scroll 0 0; height:14px; margin:0; padding:0; } div#byitem ul.vert { background:transparent none repeat scroll 0 0; list-style-type:none; margin:0; padding:0; width:540px; } element.style { margin-bottom:0; margin-left:0; margin-right:0; margin-top:0; padding-bottom:0; padding-left:0; padding-right:0; padding-top:0; width:195px; } #content form select { margin:0 0 4px 4px; z-index:1; } html, body, div, p, form, input, select, textarea, fieldset { -x-system-font:none; color:#333333; font-family:Arial,Helvetica,Verdana,sans-serif; font-size:11px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:normal; line-height:15px; } * { margin:0; padding:0; } </code></pre> <p>Thanks for any suggestions.</p> <h1>Edit</h1> <p>I've added the CSS for the divs that the drop downs are contained in. Also changing the line height doesn't make a difference. The only difference between the two drop downs (Item and Quantity) is the width. Changing the width on Item doesn't make a difference.</p> <p>Took out the Add another item link as that was suspected to be a problem no change. Also I am doing my development in Firefox I just posted the screenshot from Safari.</p>
[ { "answer_id": 375669, "author": "Jeromy Irvine", "author_id": 8223, "author_profile": "https://Stackoverflow.com/users/8223", "pm_score": 0, "selected": false, "text": "LI li.name div#byitem ul.horz li.name display: block" }, { "answer_id": 376197, "author": "palehorse", ...
2008/12/17
[ "https://Stackoverflow.com/questions/375320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/657/" ]
375,332
<p>I am sorry, my question is stupid, but I am not able to answer it, as a java illiterate. I run a tomcat (5) on CentOS5 (for a CAS server), and when I try to open this URL <a href="http://192.168.1.17:8080/cas-server-webapp-3.3.1/login" rel="nofollow noreferrer">http://192.168.1.17:8080/cas-server-webapp-3.3.1/login</a> I get this error : </p> <p>first error: java.lang.NoClassDefFoundError: Could not initialize class <strong>org.springframework.webflow.util.RandomGuid</strong></p> <p>and root error: org.springframework.web.util.NestedServletException: Handler processing failed; nested exception is java.lang.NoClassDefFoundError: Could not initialize class org.springframework.webflow.util.RandomGuid</p> <p>$CLASSPATH is empty, and it seems to be a problem, but I don't know what to put in it.</p> <p>EDIT: Jared is right, my hosts files defined 127.0.0.1 as localhost, and now it work very well!</p>
[ { "answer_id": 436550, "author": "Jared", "author_id": 44757, "author_profile": "https://Stackoverflow.com/users/44757", "pm_score": 6, "selected": true, "text": "java.lang.ClassNotFoundException java.lang.NoClassDefFoundError /etc/hosts %WINDOWS%/system32/drivers/etc/HOSTS 127.0.0.1 loc...
2008/12/17
[ "https://Stackoverflow.com/questions/375332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8404/" ]
375,341
<p>we're in the process of migrating our web app from ASP.NET 1.1 to ASP.NET 3.5. Our app runs on multiple servers through DNS round robin, so every browser request may end up on a different server. We do have a in our web.config to prevent validation errors.</p> <p>However, our plan was to migrate one server at a time. Now it looks like when a user loads the page on a 1.1. server and then the page ends up on a 3.5 server on postback, the viewstate validation fails.</p> <p>I haven't been able to find anything on the web regarding this issue - it's just my guess that the viewstate validation is incompatible between 1.1. and 3.5, i.e. a viewstate generated by 1.1 will not validate on 3.5 even with the same machineKey and vice versa.</p> <p>Can anyone confirm this suspicion?</p> <p>Thanks</p>
[ { "answer_id": 375377, "author": "Chris Van Opstal", "author_id": 7264, "author_profile": "https://Stackoverflow.com/users/7264", "pm_score": 0, "selected": false, "text": "<machineKey validation=\"3DES\">\n" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/375341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47149/" ]
375,345
<p>I'm using .Net 2.0 and this is driving me crazy but there's probably some easy thing I'm not doing that I am now too confused to see.</p> <p>I have an application that has a bespoke collection of objects in it, only the main form should be able to change the contents of that collection and all other forms should be able to read from it. </p> <p>Actually there's only one other form but I need it to have the capability of being called multiple times as it edits different items in the bespoke collection. To make the child form a dialog is therefore impractical. The ability to open multiple instances of this form containing different items from the collection is necessary.</p> <p>I just can't seem to think of a way of making all forms revolve around the same instance of the collection. Like I say I'm probably missing something obvious but I have ceased to be able to think about the problem properly.</p> <p>EDIT: Yikes! I can't have explained myself very well. All subforms should be able to read and write collection items, but I want to only use one instance of the collection at a time whilst the programme is running.</p> <p>EDIT 2: It turned out that what I needed was a singleton. I have implemented a similar solution in a different project now. Thanks to the commenter below who didn't actually leave an answer I can mark as the correct one, even though they nailed it.</p>
[ { "answer_id": 375386, "author": "BenAlabaster", "author_id": 40650, "author_profile": "https://Stackoverflow.com/users/40650", "pm_score": 3, "selected": true, "text": "private myCollection _MyCollection; \npublic myCollection MyCollection { \n get { return _MyCollection.AsReadOnly()...
2008/12/17
[ "https://Stackoverflow.com/questions/375345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
375,348
<p>I am fairly new to using infragistics controls (started yesterday). While they are (very) impressive they do add another layer of complexity, which I am muddeling through. So I am asking what I feel to be a fairly simple issue:</p> <p>I am trying to get the value from another column besides the one that is displayed in the combobox. So far all my attempts have only grabbed the value of the header column not the value in the row column that was selected. </p> <p>Specifically I want to take from my ultracombobox the value from the lastname column when a row is selected and place it in a textbox. The below code I have so far retruns the header column (LastName) and nothing else no matter which row I select.</p> <pre><code>Private Sub ucboPatientInfo_RowSelected(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.RowSelectedEventArgs) Handles ucboPatientInfo.RowSelected ucboPatientInfo.ValueMember = "accounts" LastName = ucboPatientInfo.SelectedRow.Band.Columns(1).ToString </code></pre> <p>I added the: "ucboPatientInfo.ValueMember = 'accounts'" to help clarify what my code is doing it is not actually in this part of the code.</p> <p>Please help</p>
[ { "answer_id": 376186, "author": "Sean", "author_id": 5578, "author_profile": "https://Stackoverflow.com/users/5578", "pm_score": 1, "selected": true, "text": "LastName = ucboPatientInfo.Cells(5).Value\n" }, { "answer_id": 448198, "author": "Tj Kellie", "author_id": 54055...
2008/12/17
[ "https://Stackoverflow.com/questions/375348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5578/" ]
375,351
<p>I need to randomly 'sort' a list of integers (0-1999) in the most efficient way possible. Any ideas?</p> <p>Currently, I am doing something like this:</p> <pre><code>bool[] bIndexSet = new bool[iItemCount]; for (int iCurIndex = 0; iCurIndex &lt; iItemCount; iCurIndex++) { int iSwapIndex = random.Next(iItemCount); if (!bIndexSet[iSwapIndex] &amp;&amp; iSwapIndex != iCurIndex) { int iTemp = values[iSwapIndex]; values[iSwapIndex] = values[iCurIndex]; values[iCurIndex] = values[iSwapIndex]; bIndexSet[iCurIndex] = true; bIndexSet[iSwapIndex] = true; } } </code></pre>
[ { "answer_id": 375400, "author": "Joseph Ferris", "author_id": 15906, "author_profile": "https://Stackoverflow.com/users/15906", "pm_score": 2, "selected": false, "text": "private ArrayList ShuffleArrayList(ArrayList source)\n{\n ArrayList sortedList = new ArrayList();\n Random gen...
2008/12/17
[ "https://Stackoverflow.com/questions/375351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44626/" ]
375,355
<p>I work on a database driven website. Most pages' titles are the names of partners we have, and served from a database using php.</p> <p>For example one page might be called "Experian". The problem is that some of the values for partner names don't work because the values are things like </p> <pre><code> $partnername22 = Discover&lt;sup&gt;tm&lt;/sup&gt; Magazine </code></pre> <p>I can't use this for a title because superscript can't show up in a title, and I can't change the value because many other things depend on it. Is there a trick I can pull to make the browser ignore the superscript tags if they are in the title?</p>
[ { "answer_id": 375380, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 1, "selected": false, "text": "$partnername22 = strip_tags('Discover<sup>tm</sup> Magazine'); window.title = window.title.replace(/<sup.*?</sup>/, '');\n" ...
2008/12/17
[ "https://Stackoverflow.com/questions/375355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43035/" ]
375,356
<p>I have a simple cart page that displays items that are in someones cart, and having it display via an ASP while from my table. I have a column where a user can delete an entry. I have the ASP working properly, now I am trying to add some AJAX in to it. I have the following code:</p> <pre><code>$("img.delete").click(function() { var id = $('#id').attr('value'); $.ajax({ type: "POST", url: "delete.php", data: "id="+ id, success: function(){ $('tr.selector').remove(); $('div.success').fadeIn(); } }); return false; }); </code></pre> <p>The thing is, how wouild I go about setting it up for each value, because if I use the above, I click one and they will all go. I am confused on how to set it up to work with numerous rows.</p>
[ { "answer_id": 375382, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 3, "selected": true, "text": " $(\"img.delete\").click(function() {\n var row = $(this).parents('tr:first');\n\n ...\n\n success: fu...
2008/12/17
[ "https://Stackoverflow.com/questions/375356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
375,365
<p>I am trying to make one field in a datagrid editable with a numeric stepper. My current attempts look like they are working, but the dataProvider is not actually being changed.</p> <p>Based on what I have read in a billion different places, the syntax should be </p> <pre>&lt; mx:DataGridColumn dataField="a" itemRenderer="mx.controls.NumericStepper" rendererIsEditor="true" editorDataField="value" / &gt; </pre> <p>I have tried several variations on this theme, and nothing seems to work. What am I missing?</p>
[ { "answer_id": 375382, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 3, "selected": true, "text": " $(\"img.delete\").click(function() {\n var row = $(this).parents('tr:first');\n\n ...\n\n success: fu...
2008/12/17
[ "https://Stackoverflow.com/questions/375365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40397/" ]
375,368
<p>Is it possible with the wmd editor to add a button to let the user upload an image to the web server and place the corresponding img markdown in the textbox? If not, will another good inplace editor do it? Context: I'm using asp.net mvc, C# and I am a true beginner with javascript.</p>
[ { "answer_id": 375448, "author": "Aaron Maenpaa", "author_id": 2603, "author_profile": "https://Stackoverflow.com/users/2603", "pm_score": 1, "selected": false, "text": "<img src=\"http://your.server.com/path/to/attachments/...\" />\n" }, { "answer_id": 501495, "author": "Chr...
2008/12/17
[ "https://Stackoverflow.com/questions/375368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29244/" ]
375,383
<p>I'm executing the following query:</p> <pre><code>Select guiPolygonID, dbo.fn_Yval(p1X, p1Y, p2X, p2Y, 4.003318) From [vPolygonSegments] Where dbo.fn_Yval(p1X, p1Y, p2X, p2Y, 4.003318) &gt; 0 </code></pre> <p>The important parts of function fn_Yval (all params are of type float):</p> <pre><code>set @m = (@p2Y - @p1Y)/(@p2X - @p1X) set @b = @p1Y - (@m*@p1X) set @result = (@m*@xval+@b) </code></pre> <p>The view vPolygonSegments contains no records where p1X = p2X (those records are excluded). Yet, when I execute my query, SQL Server returns an error: "Divide by zero error encountered." Curiously, if I execute only the first two lines (without the where clause), the query returns results just fine.</p> <p>How do I fix this, and/or what is causing this behavior?</p> <p><strong>Edit:</strong> Here is my view:</p> <pre><code>Select P1.guiPolygonID, P1.decX as p1X, P1.decY as p1Y, P2.decX as p2X, P2.decY as p2Y From PolygonPoints P1, PolygonPoints P2 Where P1.guiPolygonID = P2.guiPolygonID and ( P1.lPointNumber - P2.lPointNumber = 1 or ( -- Some other unimportant code ) ) and P1.decX &lt;&gt; P2.decX </code></pre>
[ { "answer_id": 375411, "author": "D'Arcy Rittich", "author_id": 39430, "author_profile": "https://Stackoverflow.com/users/39430", "pm_score": 2, "selected": false, "text": "Select guiPolygonID, dbo.fn_Yval(p1X, p1Y, p2X, p2Y, 4.003318)\nFrom [vPolygonSegments]\nWhere p2X <> p1X and dbo.f...
2008/12/17
[ "https://Stackoverflow.com/questions/375383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3420/" ]
375,390
<p>I have a MOSS 07 site that is configured for anonymous access. There is a document library within this site that also has anonymous access enabled. When an anonymous user clicks on a PDF file in this library, he or she can read or download it with no problem. When a user clicks on an Office document, he or she is prompted with a login box. The user can cancel out of this box without entering a log in, and will be taken to the document.</p> <p>This happens in IE but not FireFox.</p> <p>I see some references to this question on the web but no clear solutions: <a href="http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sharepoint.windowsservices.development&amp;tid=5452e093-a0d7-45c5-8ed0-96551e854cec&amp;cat=en_US_CC8402B4-DC5E-652D-7DB2-0119AFB7C906&amp;lang=en&amp;cr=US&amp;sloc=&amp;p=1" rel="noreferrer">http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=microsoft.public.sharepoint.windowsservices.development&amp;tid=5452e093-a0d7-45c5-8ed0-96551e854cec&amp;cat=en_US_CC8402B4-DC5E-652D-7DB2-0119AFB7C906&amp;lang=en&amp;cr=US&amp;sloc=&amp;p=1</a></p> <p><a href="http://www.sharepointu.com/forums/t/5779.aspx" rel="noreferrer">http://www.sharepointu.com/forums/t/5779.aspx</a></p> <p><a href="http://www.eggheadcafe.com/software/aspnet/30817418/anonymous-users-getting-p.aspx" rel="noreferrer">http://www.eggheadcafe.com/software/aspnet/30817418/anonymous-users-getting-p.aspx</a></p>
[ { "answer_id": 421914, "author": "savageguy", "author_id": 52555, "author_profile": "https://Stackoverflow.com/users/52555", "pm_score": 1, "selected": false, "text": "<add verb=\"OPTIONS,PROPFIND,PUT,LOCK,UNLOCK....." }, { "answer_id": 6305153, "author": "deepti", "autho...
2008/12/17
[ "https://Stackoverflow.com/questions/375390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
375,395
<p>What is a very good jsp framework to use with Spring MVC. Are the only candidates SiteMesh and Tiles, and others?</p>
[ { "answer_id": 421914, "author": "savageguy", "author_id": 52555, "author_profile": "https://Stackoverflow.com/users/52555", "pm_score": 1, "selected": false, "text": "<add verb=\"OPTIONS,PROPFIND,PUT,LOCK,UNLOCK....." }, { "answer_id": 6305153, "author": "deepti", "autho...
2008/12/17
[ "https://Stackoverflow.com/questions/375395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13143/" ]
375,398
<p>I'd like to use my own diff when working in a clearcase snapshot view. </p> <p>As far as I can see, there is no way to specify a diff tool when running "<code>cleartool diff</code>", so I was thinking I could run something like "<code>mydiff &lt;predecessor file&gt; &lt;modified file in my view&gt;</code>", but I don't know enough about ClearCase to be able to find the "predecessor file" to diff against. </p> <p>Any way to do this?</p> <p>Forgot to mention (until now, after reading the first two responses dealing with windows) that this is on Unix, and I am not allowed to muck with the ClearCase configuration.</p>
[ { "answer_id": 375437, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 6, "selected": false, "text": "text_file_delta compare ..\\..\\bin\\cleardiff.exe\ntext_file_delta xcompare ..\\..\\bin\\cleardiffmrg.exe...
2008/12/17
[ "https://Stackoverflow.com/questions/375398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47152/" ]
375,406
<p>What is the best way to close an ASPX page from the code-behind? </p> <p>I have a button event handler that I want to close the page after the user has clicked an ASP.NET button on the page. I have tried to programmatically add a JavaScript method that contains a <code>window.close()</code> command to the <code>OnClientClick</code> event to close the page but it does not work. The button is also a <code>asp:AsyncPostBoskTrigger</code> for an AJAX Update Panel.</p> <p>The application uses .NET Framework 3.5.</p>
[ { "answer_id": 375424, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 3, "selected": false, "text": "ClientScript.RegisterStartupScript()" }, { "answer_id": 375441, "author": "EndangeredMassa", "author_i...
2008/12/17
[ "https://Stackoverflow.com/questions/375406", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
375,408
<p>If I have 3 different views which are defined in 3 corresponding functions, namely:</p> <pre><code>- (UIView *)getView1 { /*...*/ } - (UIView *)getView2 { /*...*/ } - (UIView *)getView3 { /*...*/ } </code></pre> <p>These are added to <code>self.view</code> when a particular view is required.</p> <p>My question is, how do we know which of these views is currently being displayed? Is there a parameter that will identify which view is the current view?</p>
[ { "answer_id": 375690, "author": "codelogic", "author_id": 43427, "author_profile": "https://Stackoverflow.com/users/43427", "pm_score": 3, "selected": false, "text": "self.view #define TAG_VIEW_1 1\n#define TAG_VIEW_2 2\n#define TAG_VIEW_3 3\n...\n[ [self getView1()] setTag:TAG_VIEW_1 ]...
2008/12/17
[ "https://Stackoverflow.com/questions/375408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47156/" ]
375,420
<p>I'm in the process of moving an application from PHP to Java and there is heavy use of regular expressions in the code. I've run across something in PHP that doesn't seem to have a java equivalent:</p> <pre><code>preg_replace_callback() </code></pre> <p>For every match in the regex, it calls a function that is passed the match text as a parameter. As an example usage:</p> <pre><code>$articleText = preg_replace_callback("/\[thumb(\d+)\]/",'thumbReplace', $articleText); # ... function thumbReplace($matches) { global $photos; return "&lt;img src=\"thumbs/" . $photos[$matches[1]] . "\"&gt;"; } </code></pre> <p>What would be the ideal way to do this in Java?</p>
[ { "answer_id": 375479, "author": "jdmichal", "author_id": 12275, "author_profile": "https://Stackoverflow.com/users/12275", "pm_score": 6, "selected": true, "text": "import java.util.regex.*;\n\npublic class CallbackMatcher\n{\n public static interface Callback\n {\n public ...
2008/12/17
[ "https://Stackoverflow.com/questions/375420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36316/" ]
375,427
<p>I'm using the <a href="http://docs.python.org/library/subprocess.html" rel="noreferrer">subprocess module</a> to start a subprocess and connect to its output stream (standard output). I want to be able to execute non-blocking reads on its standard output. Is there a way to make .readline non-blocking or to check if there is data on the stream before I invoke <code>.readline</code>? I'd like this to be portable or at least work under Windows and Linux.</p> <p>Here is how I do it for now (it's blocking on the <code>.readline</code> if no data is available):</p> <pre><code>p = subprocess.Popen('myprogram.exe', stdout = subprocess.PIPE) output_str = p.stdout.readline() </code></pre>
[ { "answer_id": 375503, "author": "monkut", "author_id": 24718, "author_profile": "https://Stackoverflow.com/users/24718", "pm_score": 3, "selected": false, "text": "f = open('myprogram_output.txt','w')\np = subprocess.Popen('myprogram.exe', stdout=f)\np.wait()\nf.close()\n\n\nstr = open(...
2008/12/17
[ "https://Stackoverflow.com/questions/375427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5861/" ]
375,449
<p>I have two fields in a table. One contains values such as BTA, BEA, REA. The other contains values such as 1,2,63,103.</p> <p>I want to combine the 2 fields so they look like this BTA001, BTA002, BTA063, BTA103.</p> <p>Notice how if the numbers are not 3 characters in length, I want to pad some 0's to the left of the number to make it equal to 3.</p> <p>How would I go about doing this? The fields in the table are called Type which correspond to BTA, BEA, and REA and Id is the field that corresponds to 1, 2, 63, and 103.</p>
[ { "answer_id": 375459, "author": "D'Arcy Rittich", "author_id": 39430, "author_profile": "https://Stackoverflow.com/users/39430", "pm_score": 4, "selected": true, "text": "select Type + right('00' + cast(id as varchar(10)), 3)\nfrom ...\n select Type + right('00' + cast(isnull(id, 0) as ...
2008/12/17
[ "https://Stackoverflow.com/questions/375449", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
375,450
<p>This recent question about <a href="https://stackoverflow.com/questions/375351/most-efficient-way-to-randomly-sort-shuffle-a-list-of-integers-in-c">sorting randomly using C#</a> got me thinking about the way I've sometimes shuffled my arrays in Perl.</p> <pre><code>@shuffled = sort { rand() &lt;=&gt; rand() } @array; </code></pre> <p>The proposed solution in the mentioned question is <a href="http://en.wikipedia.org/wiki/Fisher-Yates_shuffle" rel="nofollow noreferrer">Fisher-Yates shuffle</a>, which works in a linear time.</p> <p>The question is: how efficient is my snippet and is such shuffle "really" random?</p>
[ { "answer_id": 375476, "author": "Adam Bellaire", "author_id": 21632, "author_profile": "https://Stackoverflow.com/users/21632", "pm_score": 2, "selected": false, "text": "sort rand()" }, { "answer_id": 375500, "author": "Greg Hewgill", "author_id": 893, "author_profi...
2008/12/17
[ "https://Stackoverflow.com/questions/375450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40657/" ]
375,455
<p>I'm hooked on bitwise for a new security paradigm I'm creating called VMAC. Variable Matrix Access Control. I want to do logical implication on to bit strings. Just trying to avoid echoeureka (reinventing the wheel). </p> <ol> <li><p>Before I reinvent the wheel, is there an established shortcut to emulate &rArr; (logical implication) using AND and OR and NOT or other basic SQL binary operators?</p></li> <li><p>XNOR would allow me to cut &rArr; emulation down to four operations: NOT, XOR, OR, AND. But it is not widely available. Any known shortcuts to XNOR? I was thinking of something like AND operation on operands plus NOTted operands off the top of my head.</p></li> <li><p>Any comments on efficiency achieved by implementation of bitwise data structures on a 64-bit platform, or on the speed of multi-threaded apps using concurrent threads operating on word-size segments of larger data object?</p></li> </ol> <p>(Sorry, I'm not a computer scientist)</p>
[ { "answer_id": 375496, "author": "Eclipse", "author_id": 8701, "author_profile": "https://Stackoverflow.com/users/8701", "pm_score": 1, "selected": false, "text": "x -> y \n ~x | y\n" }, { "answer_id": 12115036, "author": "Fernando Cuadrado", "author_id": 1564377, "au...
2008/12/17
[ "https://Stackoverflow.com/questions/375455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
375,457
<p>Using VS 2008, here is my COM object</p> <pre><code>using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Windows.Forms; namespace TestCom { [Guid("9E5E5FB2-219D-4ee7-AB27-E4DBED8E123E")] [ClassInterface(ClassInterfaceType.AutoDual)] [ProgId("Test9.COMINT")] public class TestComClass { public void Init(string userid, string password) { MessageBox.Show(string.Format("{0}/{1}", userid, password)); } } } </code></pre> <p>If I build this and register it on a production machine as follows</p> <pre><code>REGASM /CODEBASE TESTCOM.DLL </code></pre> <p>From a simple VB6 app this works fine</p> <pre><code>Private Sub Form_Load() Dim o As Object Set o = CreateObject("Test9.COMINT") o.Init "A", "B" End Sub </code></pre> <p>This exact same code called from VBA in Excel gives </p> <blockquote> <p>"automation error" (0x80131700)</p> </blockquote> <p>Everything works fine on a development machine, just not on a production machine with just .NET and MS Office installed.</p> <h2>Update</h2> <p>I think this is something to do with the .NET framework not being initialized properly, when running under Excel. If I use Filemon I can see it skip around looking for MSCORWKS.DLL. When I call the same object from VBScript, it finds MSCorwks.dll fine.</p> <p>When I called <code>CorBindToCurrentRunTime</code> from VBA to try to forcibly load the CLR, interestingly I get the exact same <code>HRESULT (0x80131700)</code> as when I do <code>CreateObject()</code> in VBA.</p> <p>Therefore I think it is a framework initialization issue.</p>
[ { "answer_id": 375694, "author": "JoshBerke", "author_id": 26160, "author_profile": "https://Stackoverflow.com/users/26160", "pm_score": 1, "selected": false, "text": "Dim o As Object \nSet o = CreateObject(\"Test9.COMINT\") \no.Init \"A\", \"B\"\n" }, { "answer_id": 375995, ...
2008/12/17
[ "https://Stackoverflow.com/questions/375457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
375,508
<p>How do I remove items from, or add items to, a select box? I'm running jQuery, should that make the task easier. Below is an example select box.</p> <pre><code>&lt;select name="selectBox" id="selectBox"&gt; &lt;option value="option1"&gt;option1&lt;/option&gt; &lt;option value="option2"&gt;option2&lt;/option&gt; &lt;option value="option3"&gt;option3&lt;/option&gt; &lt;option value="option4"&gt;option4&lt;/option&gt; &lt;/select&gt; </code></pre>
[ { "answer_id": 375573, "author": "dsimard", "author_id": 42866, "author_profile": "https://Stackoverflow.com/users/42866", "pm_score": 10, "selected": true, "text": "$(\"#selectBox option[value='option1']\").remove(); <script src=\"https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquer...
2008/12/17
[ "https://Stackoverflow.com/questions/375508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
375,512
<p>I have a custom sharepoint web part that is throwing the following exception:</p> <pre><code>System.Security.SecurityException: Request for the permission of type 'Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' failed. at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) at Waverly.SharePoint.Features.WebParts.SearchesListWebPart.Render(HtmlTextWriter writer) The action that failed was: Demand The type of the first permission that failed was: Microsoft.SharePoint.Security.SharePointPermission The Zone of the assembly that failed was: MyComputer </code></pre> <p>My theory is that Sharepoint does not have the trust level to run the web part but I'm having difficulty figuring out how to debug this problem. Anyone have any experience debugging something like this?</p>
[ { "answer_id": 1062146, "author": "Janis Veinbergs", "author_id": 50173, "author_profile": "https://Stackoverflow.com/users/50173", "pm_score": 2, "selected": false, "text": "using (SPSite site = new SPSite(parentWebUrl))\n Exception: SecurityException\nMessage: Request failed.\nAction: ...
2008/12/17
[ "https://Stackoverflow.com/questions/375512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/285/" ]
375,518
<p>In my code attached below, I'm trying to upload a file via ASP.NET. I am dynamically creating the FileUpload control so that means it's not in my ViewState which (I think) means I can't use the control for uploading files unless I use the old fashioned multipat/form-data way which I don't want to do. I need to be able to allow the user to create multiple FileUpload fields and then when they click the Upload File(s) button, it loops through all the FileUpload fields and uploads them to the server.</p> <p>I'm sure there's a way to do this that I'm just not thinking of - TIA!</p> <pre><code>&lt;%@ Page Language="VB" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;script runat="server"&gt; Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim fup As New FileUpload() fup.ID = "FileUpload1" PlaceHolder1.Controls.Add(fup) End Sub Protected Sub btnUploadFile_Click(ByVal sender As Object, ByVal e As System.EventArgs) ' HOW DO I GET THE FILE THAT WAS SELECTED IN THE DYNAMICALLY CREATE FILEUPLOAD CONTROL? End Sub &lt;/script&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div style="padding:13px"&gt; &lt;asp:Button ID="btnAdd" runat="server" Text="Add FileUpload Control" OnClick="btnAdd_Click" /&gt; &lt;br /&gt;&lt;br /&gt; &lt;asp:PlaceHolder ID="PlaceHolder1" runat="server" /&gt; &lt;br /&gt;&lt;br /&gt; &lt;asp:Button ID="btnUploadFile" runat="server" Text="Upload File(s)" OnClick="btnUploadFile_Click" /&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
[ { "answer_id": 375538, "author": "thinkbeforecoding", "author_id": 47001, "author_profile": "https://Stackoverflow.com/users/47001", "pm_score": 2, "selected": false, "text": "foreach(HttpPostedFile file in Request.Files)\n file.SaveAs(...);\n" }, { "answer_id": 375623, "aut...
2008/12/17
[ "https://Stackoverflow.com/questions/375518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47167/" ]
375,520
<p>How can i get all the class properties and its sub classes with properties from an RDF datasource using SPARQL query given a class name and namespace?</p>
[ { "answer_id": 636619, "author": "Simon Gibbs", "author_id": 13935, "author_profile": "https://Stackoverflow.com/users/13935", "pm_score": 2, "selected": false, "text": "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\nSELECT ?subClass ?predicate \nWHERE {\n ?subClass rdfs:subClas...
2008/12/17
[ "https://Stackoverflow.com/questions/375520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43049/" ]
375,524
<p>I have a ASP.NET page which allows an administrator to change the password for a user. Since the administrator does not know the user's password, I am using the following:</p> <pre><code>MembershipUser member = Membership.GetUser(_usernameTextBox.Text); member.ChangePassword(member.ResetPassword(), _passNewTextBox.Text); </code></pre> <p>-- as described by this <a href="https://stackoverflow.com/questions/287320/how-do-you-change-a-hashed-password-using-aspnet-membership-provider-if-you-don">SO question</a>. </p> <p>If the new password does not meet the complexity requirements which are configured in the web.config file, then the password will have been reset, but not changed to the desired one. If the new password does not meet complexity requirements, then the password should not change at all.</p> <p>Is there an easy way to test the new password against the complexity requirements?</p>
[ { "answer_id": 897465, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": "/// <summary>\n/// Checks password complexity requirements for the actual membership provider\n/// </summary>\n/// <param name...
2008/12/17
[ "https://Stackoverflow.com/questions/375524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24970/" ]
375,525
<p>I have a conflict when trying to mix those plugins, i have based my script in some demos. The problem is that when i drag something inside the same list it triggers the drop event and that item is added to the end of the list, wich is correct if the item is dropped in another list, but not in the same, when i drop it in the same list i want to insert it in that position (it works if i disable the drop event)</p> <p>js code:</p> <pre><code>$(document).ready(function() { $("#sortlist1").treeview(); $("#sortlist1").droppable({ accept: ".item", drop: function(ev, ui) { alert(ui.sender) $("#sortlist1").append($(ui.draggable)); } }); $("#sortlist2").droppable({ accept: ".item", drop: function(ev, ui) { $("#sortlist2").append($(ui.draggable)); } }); $("#sortlist3").droppable({ accept: ".item", drop: function(ev, ui) { $("#sortlist3").append($(ui.draggable)); } }); $('.sortlist').sortable({ handle : '.icono', update : function () { $('input#sortlist').val($('.sortlist').sortable('serialize')); } }); }); </code></pre> <p>And html:</p> <pre><code>&lt;ul class="sortlist treeview lista" id="sortlist1"&gt; &lt;li id="listItem_1" class="expandable closed item"&gt; &lt;div class="hitarea closed-hitarea expandable-hitarea lastExpandable-hitarea"&gt; &lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt; &lt;/div&gt; numero 1&lt;input type="checkbox" /&gt; &lt;ul class="sortlist" id="sublist"&gt; &lt;li id="sublistItem_1"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 1&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="sublistItem_2"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 2&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/li&gt; &lt;li id="listItem_2" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 2&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_3" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 3&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_4" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 4&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_5" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 5&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_6" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 6&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_7" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 7&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_8" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 8&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_9" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 9&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_10" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 10&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;li id="listItem_11" class="item"&gt;&lt;img src="img/arrow_out.png" class="icono" alt="move" /&gt;numero 11&lt;input type="checkbox" /&gt;&lt;/li&gt; &lt;/ul&gt; &lt;ul class="sortlist treeview lista" id="sortlist2"&gt; &lt;/ul&gt; &lt;ul class="sortlist treeview lista" id="sortlist3"&gt; &lt;/ul&gt; </code></pre>
[ { "answer_id": 6958398, "author": "Daniel", "author_id": 880817, "author_profile": "https://Stackoverflow.com/users/880817", "pm_score": 0, "selected": false, "text": "<li> connectWith sortable()" } ]
2008/12/17
[ "https://Stackoverflow.com/questions/375525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43304/" ]
375,548
<p>I recently asked this question: <a href="https://stackoverflow.com/questions/368521/api-design-expose-xml-or-objects" title="Expose XML or Objects">Expose XML or Objects</a> - thanks all for the responses.</p> <p>One point to clarify.</p> <ul> <li>The API will always be accessed remotely (i.e. as a service), most probably via webservices or WCF.</li> </ul> <p>I agree that in theory a strongly typed API exposing objects as the inputs/outputs is the <em>right</em> way to go. However, I feel that there is still an argument to be made for exposing XML. As I see it the reasons for using XML are:</p> <ol> <li>The business rules can be written by business analysts in Schematron.</li> <li>The interface is weakly typed, but as soon as it is called the data can be validated against data and business rules.</li> <li>The service's implementation will be simpler. There won't be any need to create an domain object model.</li> <li>The XML schema is already defined (we have a data dictionary of schema).</li> <li><p>Using web services technology means that an XML based API will not need to change as new car 'types' are added, e.g. </p> <pre><code>void AddNewCar( string newCarXml ) string[] GetCars( /* some query conditions */ ) </code></pre> <p>If we used an object based API then adding a new type would require a new query method defining the possible derived types that could be returned (see <a href="https://stackoverflow.com/questions/374253/extend-webservice-without-impacting-existing-clients-returning-derived-types-fr" title="extending webservices">extending web services</a>). Updating the web service like this would require this services and <em>all</em> existing clients to be rebuilt and redeployed.</p></li> </ol> <p>What does an object based API give us? A strongly typed declarative interface. It does not provide any more abstraction than XML (XML is itself an abstraction). What does the object based API cost? It costs an entire set of domain objects which will need business rules and data validation.</p> <p>So, what is my question? Give me an un-defeatble, unarguable reason why I should go with objects.</p>
[ { "answer_id": 375609, "author": "JeeBee", "author_id": 17832, "author_profile": "https://Stackoverflow.com/users/17832", "pm_score": 1, "selected": false, "text": "void addCar(Car newCar);\nCar getCar(String make, String model, String year);\nvoid removeCar(...);\nList<Car> getAllCars()...
2008/12/17
[ "https://Stackoverflow.com/questions/375548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36860/" ]
375,552
<p>I have a 3rd party XLL addin I'd like to wrap in my own custom vba function. How would I call the 3rd party function from my code?</p>
[ { "answer_id": 375753, "author": "e.James", "author_id": 33686, "author_profile": "https://Stackoverflow.com/users/33686", "pm_score": 6, "selected": true, "text": "Application.Run(...) Public Function myVBAFunction(A as Integer, B as String, C as Double)\n myVBAFunction = Application...
2008/12/17
[ "https://Stackoverflow.com/questions/375552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1946/" ]
375,563
<p>I am a bit of a newbie to Reg Ex and don't fully understand the difference between the different flavors. However, I have a basic Reg Ex that works when I try it via the UNIX system (vi and grep) but not when I try to to use it in PHP's ereg functions. I suspect there is something different about the PHP ereg function that is making this not work:</p> <pre><code>&lt;?php $string = 'Feugiat &lt;em&gt;hendrerit&lt;/em&gt; sit iriuredolor aliquam.'; $string = ereg_replace("&lt;em\b[^&gt;]*&gt;(.*?)&lt;/em&gt;","\\1",$string); echo $string; ?&gt; </code></pre> <p>I would like this to output <strong>Feugiat hendrerit sit iriuredolor aliquam.</strong> without the em tags. However it just returns an empty string.</p>
[ { "answer_id": 375568, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 2, "selected": false, "text": "$string = ereg_replace(\"<em\\\\b[^>]*>(.*?)</em>\",\"\\\\1\",$string);\n \\b \\b \\\\ ereg_replace() \"\\\\1\" $string <...
2008/12/17
[ "https://Stackoverflow.com/questions/375563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45838/" ]
375,567
<p>I want to do something like this: </p> <p>page A has a link to page B<br> page B gets content from a database and processes it<br> the result from page B is displayed on a div in page A </p> <p>Please notice that I don't want to leave page A while page B processes the information of the database.</p> <p>What I'm really trying to do is avoid using frames in the site, and I want to make the pages appear in a <code>div</code>. Is this possible?</p> <p>I'm guessing its kinda of a newbie question, but it's really bugging me and i don't even know where to start looking.</p>
[ { "answer_id": 375919, "author": "feihtthief", "author_id": 320070, "author_profile": "https://Stackoverflow.com/users/320070", "pm_score": 1, "selected": false, "text": "<html>\n<body>\n<script type=\"text/javascript\" src=\"stuff.js\"></script>\nData to process please: <input type=\"te...
2008/12/17
[ "https://Stackoverflow.com/questions/375567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24098/" ]
375,583
<p>I have a nib that I load the usual way</p> <p><code>[NSBundle loadNibNamed:@"AuthorizationWindow" owner:self];</code></p> <p>and I see the window show on the screen briefly, and using NSLog() I can confirm that -awakeFromNib is called, but I can't figure out why the window does not stay on the screen. I had it working correctly for a bit, but now I'm not sure what I changed that messed it up. Thoughts of where to start looking?</p>
[ { "answer_id": 375696, "author": "e.James", "author_id": 33686, "author_profile": "https://Stackoverflow.com/users/33686", "pm_score": 0, "selected": false, "text": "self" }, { "answer_id": 375864, "author": "Boaz Stuller", "author_id": 1464654, "author_profile": "htt...
2008/12/17
[ "https://Stackoverflow.com/questions/375583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34386/" ]
375,588
<p>Helvetica is available in one form or another on Windows, Mac OS X, and Linux. Under Windows, I can see it from Microsoft Word. On the two UNIX platforms, I can find it with xlsfonts | grep -i helvetica; the name seems to be adobe-helvetica.</p> <p>But the JDK can't find it! It's not listed from GraphicsEnvironment.getAllFonts(), nor does it come up when I call new Font("Helvetica", ...) [using several name variants, either, like "Adobe Helvetica"]; instead I get defaulted to "Dialog" font and it seems to name it with whatever name I used.</p> <p>This font is available on every relevant Java target platform today. How do I use it from within Java?</p>
[ { "answer_id": 375632, "author": "John T", "author_id": 36457, "author_profile": "https://Stackoverflow.com/users/36457", "pm_score": 2, "selected": false, "text": "Font f = new Font(\"Helvetica\", Font.PLAIN, 10); // make a new font object\n\nObjectName.setFont(f); // set the objects f...
2008/12/17
[ "https://Stackoverflow.com/questions/375588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18103/" ]
375,589
<p>I am getting comfortable writing regular queries in SPARQL, but I'm still having trouble with fancier stuff. My latest problem is trying to select everything except stuff that matches the where clause. For instance, say I want to find all the husbands who like a car color that their wife doesn't like (I'm working on a proprietary model, so excuse the example and just trust that it makes sense in the real model).</p> <p>I might have:</p> <pre><code>&lt;bob&gt; &lt;spouse&gt; &lt;alice&gt; &lt;bob&gt; &lt;likes&gt; &lt;red&gt; &lt;alice&gt; &lt;likes&gt; &lt;red&gt; &lt;carl&gt; &lt;spouse&gt; &lt;dorothy&gt; &lt;carl&gt; &lt;likes&gt; &lt;blue&gt; &lt;dorothy&gt; &lt;likes&gt; &lt;yellow&gt; &lt;eric&gt; &lt;spouse&gt; &lt;fannie&gt; &lt;eric&gt; &lt;likes&gt; &lt;black&gt; </code></pre> <p>What's the query that selects carl and eric, but not bob? Bonus points if you can select blue and black in the same query. Selecting bob would be simply:</p> <pre><code>select ?husband ?color where {?husband &lt;spouse&gt; ?wife . ?husband &lt;likes&gt; ?color . ?wife &lt;likes&gt; ?color} </code></pre> <p>What I'm looking for is:</p> <pre><code>select ?husband ?color where {?husband &lt;spouse&gt; ?wife . ?husband &lt;likes&gt; ?color . NOT (?wife &lt;likes&gt; ?color)} </code></pre> <p>but obviously that's wrong. So what's right?</p>
[ { "answer_id": 375632, "author": "John T", "author_id": 36457, "author_profile": "https://Stackoverflow.com/users/36457", "pm_score": 2, "selected": false, "text": "Font f = new Font(\"Helvetica\", Font.PLAIN, 10); // make a new font object\n\nObjectName.setFont(f); // set the objects f...
2008/12/17
[ "https://Stackoverflow.com/questions/375589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35600/" ]