qid
int64
4
19.1M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
399,893
<p>I want to use php in console mode and create an environment to test my functions. </p> <p>I do not want to be forced to use a web browser and create a new file each time I want to test a function. </p> <p>I want to access the function in the console and then it return the result.</p> <p>How do I do this?</p> <p><strong>Update:</strong></p> <p>Perhaps I have explained this badly. I only want to see what result the function's return.</p> <p>Maybe I have to learn unit testing but for the moment I only want an interactive console which allows me to test all functions one by one. </p> <p>In my case I have to load the wordpress functions (I know how do it with a regular <code>.php</code> file and then a browser to parse the file) but i don't if it is possible to do it with php from the command line.</p>
[ { "answer_id": 400019, "author": "PEZ", "author_id": 44639, "author_profile": "https://Stackoverflow.com/users/44639", "pm_score": 0, "selected": false, "text": "php -a\n" }, { "answer_id": 400020, "author": "mark", "author_id": 47573, "author_profile": "https://Stack...
2008/12/30
[ "https://Stackoverflow.com/questions/399893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47090/" ]
399,897
<p>After having solved the problem of getting the editor to launch when there's a merge conflict - <a href="https://stackoverflow.com/questions/399606/mercurial-no-editor-appears-when-merge-conflicts-are-detected">Mercurial: No editor appears when merge conflicts are detected</a></p> <p>I now have another problem, the editor now launches but opens the files in the following order:</p> <p>hello.c hello.c~base.???? hello.c~other.????</p> <p>But what I really want to see is the file that highlights the conflicts, which I expect should be the first one hello.c, but instead hello.c just shows the tip.</p> <p>Any advice?</p> <p>Regards,</p> <p>Chris</p>
[ { "answer_id": 400019, "author": "PEZ", "author_id": 44639, "author_profile": "https://Stackoverflow.com/users/44639", "pm_score": 0, "selected": false, "text": "php -a\n" }, { "answer_id": 400020, "author": "mark", "author_id": 47573, "author_profile": "https://Stack...
2008/12/30
[ "https://Stackoverflow.com/questions/399897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37196/" ]
399,907
<p>I'm writing a sparse matrix class in C++ in which every row and column are arrays of linked lists from a class I created (aptly named: LinkedList).</p> <p>I want to write a class that is a "smart" pointer to one cell in this matrix.</p> <p>In that class, let say <code>LIPointer</code>, I will implement a <code>++</code> operator function for moving in the linked lists of the matrix.</p> <p>Is there an elegant way of doing this without moving the references of the matrix arrays and sized elements each time I create a <code>linkedlistPointer</code>?</p> <p>I can't use <code>stl::array</code> etc. because I have to build them myself.</p> <p>Here are the declarations:</p> <hr> <pre><code>class LinkedItem { private: int Column, Row; double Value; LinkedItem* Right; LinkedItem* Down; public: ... }; </code></pre> <hr> <pre><code>class SparseLinkedMatrix { private: //members int ColSize; int RowSize; LinkedItem ** Columns; LinkedItem ** Rows; public: //functions SparseLinkedMatrix(); ... }; </code></pre> <hr> <pre><code>class LIPointer; private: LinkedItem * CellPointer; public: LIPointer(); void operator++();//??? ... }; </code></pre> <p>Any advice or direction would be appreciated.</p> <p><strong>Update</strong>: It needs to run on the whole matrix. That is why I think I need to move (by reference) the arrays and the size of the matrix. The intended effect is that this would from the last cell in the linked list of the first row to the first cell in the second row.</p>
[ { "answer_id": 400019, "author": "PEZ", "author_id": 44639, "author_profile": "https://Stackoverflow.com/users/44639", "pm_score": 0, "selected": false, "text": "php -a\n" }, { "answer_id": 400020, "author": "mark", "author_id": 47573, "author_profile": "https://Stack...
2008/12/30
[ "https://Stackoverflow.com/questions/399907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49500/" ]
399,910
<p>I am trying to create a form in Rails 2.2.2 that populates a field based on a choice a user has made in an 'auto_complete' field. It looks as though the observe_field functionality is what I need to use but I'm stuck on how to update the value of an existing text field.</p> <p>The sequence of events I am trying to model is follows:</p> <p>1) Use types some characters into a auto_complete field, is given a list of options and selected the relevant option.</p> <p>2) The option corresponds to an ActiveRecord model and I would like to populate another field in the same form (i.e. set a default) using information from the selected ActiveRecord.</p> <p>Thanks for any guidance</p> <p>David</p>
[ { "answer_id": 400019, "author": "PEZ", "author_id": 44639, "author_profile": "https://Stackoverflow.com/users/44639", "pm_score": 0, "selected": false, "text": "php -a\n" }, { "answer_id": 400020, "author": "mark", "author_id": 47573, "author_profile": "https://Stack...
2008/12/30
[ "https://Stackoverflow.com/questions/399910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6218/" ]
399,914
<p>Whats the best practice approach to creating a form that is used to both create new models and edit existing models?</p> <p>Are there any tutorials that people can point me in the direction of?</p>
[ { "answer_id": 4874247, "author": "Mariano Desanze", "author_id": 146513, "author_profile": "https://Stackoverflow.com/users/146513", "pm_score": 5, "selected": false, "text": "<%@ Page Language=\"C#\" Inherits=\"System.Web.Mvc.ViewPage<NerdDinner.Models.Dinner>\" MasterPageFile=\"~/View...
2008/12/30
[ "https://Stackoverflow.com/questions/399914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46616/" ]
399,932
<p>So, I have been working on this domain name regular expression. So far, it seems to pick up domain names with SLDs and TLDs (with the optional ccTLD), but there is duplication of the TLD listing. Can this be refactored any further?</p> <pre><code>params[:domain_name].downcase.strip.match(/^[a-z0-9\-]{2,63} \.((a[cdefgilmnoqrstuwxz]|aero|arpa)|(b[abdefghijmnorstvwyz]|biz)| (c[acdfghiklmnorsuvxyz]|cat|com|coop)|d[ejkmoz]|(e[ceghrstu]|edu)|f[ijkmor]| (g[abdefghilmnpqrstuwy]|gov)|h[kmnrtu]|(i[delmnoqrst]|info|int)| (j[emop]|jobs)|k[eghimnprwyz]|l[abcikrstuvy]| (m[acdghklmnopqrstuvwxyz]|me|mil|mobi|museum)|(n[acefgilopruz]|name|net)|(om|org)| (p[aefghklmnrstwy]|pro)|qa|r[eouw]|s[abcdeghijklmnortvyz]| (t[cdfghjklmnoprtvwz]|travel)|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]) (\.((a[cdefgilmnoqrstuwxz]|aero|arpa)|(b[abdefghijmnorstvwyz]|biz)| (c[acdfghiklmnorsuvxyz]|cat|com|coop)|d[ejkmoz]|(e[ceghrstu]|edu)|f[ijkmor]| (g[abdefghilmnpqrstuwy]|gov)|h[kmnrtu]|(i[delmnoqrst]|info|int)| (j[emop]|jobs)|k[eghimnprwyz]|l[abcikrstuvy]| m[acdghklmnopqrstuvwxyz]|mil|mobi|museum)| (n[acefgilopruz]|name|net)|(om|org)| (p[aefghklmnrstwy]|pro)|qa|r[eouw]|s[abcdeghijklmnortvyz]| (t[cdfghjklmnoprtvwz]|travel)|u[agkmsyz]|v[aceginu]|w[fs]|y[etu]|z[amw]))?$/) </code></pre>
[ { "answer_id": 399949, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": -1, "selected": false, "text": "(\\.<tldpart>){1,2}" }, { "answer_id": 401499, "author": "Steve Losh", "author_id": 13498, "author_p...
2008/12/30
[ "https://Stackoverflow.com/questions/399932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40644/" ]
399,937
<p>I need a method that takes a linkedlist as a parameter and return true or false if it is circular or not.</p> <p>ex:circular linkedlist means there is node pointes to any previous node. I forgot to tell some constraints, I can not use any datastructure or dynmaic memory allocations. I can use local variables only and the alogrithm can be done in n steps as someone said to me (I am thinking now to use two pointers?)</p>
[ { "answer_id": 399968, "author": "Cheery", "author_id": 21711, "author_profile": "https://Stackoverflow.com/users/21711", "pm_score": 0, "selected": false, "text": "previousnodes ← set()\npreviousnodes.add(firstnode)\ncurrentnode ← firstnode.next\nwhile (currentnode in previousnodes) || ...
2008/12/30
[ "https://Stackoverflow.com/questions/399937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42749/" ]
399,942
<p>In the following code, g++ gives this error : 1.cpp: In member function <code>void W::test()': 1.cpp:6: error:</code>int F::glob' is private 1.cpp:19: error: within this context</p> <p>But, shouldn't the globally declared variable 'glob' be used here, instead of the "private" "glob"?</p> <pre><code> #include &lt;iostream.h&gt; int glob; class F { int glob; public: void readIt() { cin &gt;&gt; glob; } }; class W : public F { public: void test() { glob--; } }; int main() { } </code></pre>
[ { "answer_id": 399947, "author": "Marc", "author_id": 27947, "author_profile": "https://Stackoverflow.com/users/27947", "pm_score": 2, "selected": false, "text": "::glob--;" }, { "answer_id": 399960, "author": "strager", "author_id": 39992, "author_profile": "https://...
2008/12/30
[ "https://Stackoverflow.com/questions/399942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49560/" ]
399,946
<p>I just started reading Effective C++ today and got to the point where the author talks about the operator new.</p> <p>The book explains very well how you can catch (with various degrees of elegance) the std::bad_alloc exception that the operator new can raise if you run out of memory.</p> <p>My question is: How often do you check for the case when there isn't enough memory to instantiate a object, if at all? and why? Is it worth the hassle?</p>
[ { "answer_id": 400007, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "malloc() NULL std::bad_alloc std::bad_alloc" }, { "answer_id": 400074, "author": "Johannes Schaub - litb", "au...
2008/12/30
[ "https://Stackoverflow.com/questions/399946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23824/" ]
399,956
<p>A little background:</p> <ul> <li><a href="http://www.python.org/dev/peps/pep-0008/" rel="noreferrer">PEP 8</a> is the <em>Style Guide for Python Code</em>. It contains the conventions all python programmers should follow.</li> <li><a href="http://pypi.python.org/pypi/pep8" rel="noreferrer">pep8.py</a> is a (very useful) script that checks the code formating of a given python script, according to PEP 8.</li> <li><a href="http://www.eclipse.org/" rel="noreferrer">Eclipse</a> is a great IDE. With the <a href="http://pydev.sourceforge.net/" rel="noreferrer">Pydev</a> extension, it that can be used to develop Python</li> </ul> <p>I run pep8.py manually when I'm scripting, but with bigger projects I prefer to use Eclipse. It would be really useful to integrate pep8.py in Eclipse/Pydev, so it can be run automatically in all the files in the project, and point to the lines containing the warnings. Maybe there is an obvious way to do it, but I haven't found it yet.</p> <p>Question is: <strong>How to integrate pep8.py in Eclipse?</strong></p>
[ { "answer_id": 2296249, "author": "Dmitry Kochkin", "author_id": 153623, "author_profile": "https://Stackoverflow.com/users/153623", "pm_score": 5, "selected": false, "text": "pycodestyle pep8 $ sudo pip install --upgrade pycodestyle\n pycodestyle ${system_path:pycodestyle} ${container_l...
2008/12/30
[ "https://Stackoverflow.com/questions/399956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30300/" ]
399,957
<p>I'm trying to write a circuit schematic drawing tool in Python. I'm creating a simple database based on dictionaries which holds all the components and their properties. I'm also trying to create a simple query language where you can select, for example, all resistors with value>100ohms or footprint='0402' </p> <p>So far, I can select things using some primitive predicate search and then union and intersection for more complex things. </p> <p>However, I'm having trouble defining what the semantics ought to be for a purely negative search. For instance, something like </p> <p>footprint != '0402' </p> <p>should select all items with footprint not equal to 0402. But doing this with only intersection gives me a blank result. For this to work I need to select <em>all</em> components, then intersect with "not 0402" to remove the ones I don't want.</p> <p>But this seems kind of brute force and seems like a fishy solution. I'm not interested in using a "real" database and query language, so please don't suggest that. I'm looking for the proper engineering rationale here, not necessarily a workaround to the problem.</p> <p>This problem was covered to some degree in SICP book, but I got very confused, since I think they were also using continuations and stuff, which I don't get yet.</p> <p>Can someone please explain what the 'proper' usage ought to be for negatively selecting stuff. I tried this in a commercial cad tool and it worked as expected, but then I've seen some SQL query examples (I think), which selected things <em>first</em>, then removed the unwanted ones.</p> <p>thanks<br> michael</p>
[ { "answer_id": 399997, "author": "James Brady", "author_id": 29903, "author_profile": "https://Stackoverflow.com/users/29903", "pm_score": 2, "selected": false, "text": "components = [\n { 'name': 'resistor', 'footprint': '0402', },\n { 'name': 'LED', 'footprint': '0100', },\n {...
2008/12/30
[ "https://Stackoverflow.com/questions/399957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
399,971
<p>I need a script to run on Vista Ultimate to share an external drive and assign full control to Everyone. I've got a batch file to create the share using <code>net share</code>, but there doesn't seem to be a way to change the permissions. I reckon this must be possible in PowerShell, but I have no idea where to start.</p>
[ { "answer_id": 12166869, "author": "Aaron Jensen", "author_id": 125356, "author_profile": "https://Stackoverflow.com/users/125356", "pm_score": 3, "selected": false, "text": "Install-SmbShare -Name MyShare -Path X:\\ -FullAccess 'Everybody' `\n -Description 'My super-awes...
2008/12/30
[ "https://Stackoverflow.com/questions/399971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5744/" ]
399,972
<p>I'm setting up a new 64 bit machine to run as a build server. When I try to load my NUnit test assembly into NUnit GUI I get the following error.</p> <p>There is nothing obvious missing, all the dependencies seem to be present. All the DLLs are compiled for the x86 platform.</p> <p>Using NUnit 2.4.7. I have tried upgrading to 2.4.8 but the same error occurs.</p> <blockquote> <p>System.IO.FileNotFoundException: Could not load file or assembly 'MyTestProject' or one of it's dependencies. The system cannot find the file specified.</p> </blockquote> <p>System.IO.FileNotFoundException...</p> <pre><code>Server stack trace: at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection) at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection) at System.Reflection.Assembly.Load(String assemblyString) at NUnit.Core.Builders.TestAssemblyBuilder.Load(String path) at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites) at NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites) at NUnit.Core.TestSuiteBuilder.BuildSingleAssembly(TestPackage package) at NUnit.Core.TestSuiteBuilder.Build(TestPackage package) at NUnit.Core.SimpleTestRunner.Load(TestPackage package) at NUnit.Core.ProxyTestRunner.Load(TestPackage package) at NUnit.Core.ProxyTestRunner.Load(TestPackage package) at NUnit.Core.RemoteTestRunner.Load(TestPackage package) at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]&amp; outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext) Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type) at NUnit.Core.TestRunner.Load(TestPackage package) at NUnit.Util.TestDomain.Load(TestPackage package) at NUnit.Util.TestLoader.LoadTest(String testName) </code></pre>
[ { "answer_id": 399981, "author": "David Schmitt", "author_id": 4918, "author_profile": "https://Stackoverflow.com/users/4918", "pm_score": 2, "selected": false, "text": "fuslogvw.exe" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/399972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44950/" ]
399,975
<p>I am new to Excel macros. I have some columns with headings scattered in many sheets. I would like to type a heading in some column which has the cursor and have the column with that heading copy-pasted to the column with the cursor. </p> <p>Is it possible to do this by recording a macro? How? If not, how do I do it programmatically?</p>
[ { "answer_id": 401983, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 2, "selected": true, "text": "Dim ws As Worksheet\nDim r As Range\nDim CopyTo As String\n\n'You must run the code from a suitable active cell '\nstrFind ...
2008/12/30
[ "https://Stackoverflow.com/questions/399975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34596/" ]
399,982
<p>I've realised for the first time a couple of weeks ago that when setting an http cookie, while the domain name is not case sensitive, the path is. </p> <p>So a while a cookie stored for</p> <p><code>http://SomeWebSite.com</code></p> <p>can be read using</p> <p><code>http://somewebsite.com</code></p> <p>a cookie stored for</p> <p><code>http://somewebsite.com/SomePath</code></p> <p><em>cannot</em> be read using</p> <p><code>http://somewebsite.com/somepath</code></p> <p>It would simply not be found.</p> <p>As this is clearly stated in the RFC (see point 3.3.3 <a href="http://www.ietf.org/rfc/rfc2965.txt" rel="noreferrer">here</a>) I doubt that's an oversight, but as a user I'm not trained to treat urls as case sensitive text and web servers, as far as I can tell, don't seem to mind either way, and would serve pages just fine; so I'm left wondering - what is the rationale behind this decision? </p> <p>Anyone can shed some light?</p>
[ { "answer_id": 400013, "author": "strager", "author_id": 39992, "author_profile": "https://Stackoverflow.com/users/39992", "pm_score": 5, "selected": true, "text": "http://example.com/x http://example.com/x/ http://stackoverflow.com/ABOUT http://stackoverflow.com/about http://stackoverfl...
2008/12/30
[ "https://Stackoverflow.com/questions/399982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43541/" ]
399,991
<p>When I pass the options in the program (a computational biology experiment) I usually pass them through a .py file.<br> So I have this .py file that reads like:</p> <pre><code>starting_length=9 starting_cell_size=1000 LengthofExperiments=5000000 </code></pre> <p>Then I execute the file and get the data. Since the program is all on my machine and no one else has access to it, it is secure in a trivial way.<br> I can also write a similar file very easily:</p> <pre><code>def writeoptions(directory): options="" options+="starting_length=%s%s"%(starting_length,os.linesep) options+="starting_cell_size=%s%s"%(starting_cell_size,os.linesep) options+="LengthofExperiments=%s%s"%(LengthofExperiments,os.linesep) ... open("%s%soptions.py"%(directory,os.sep),'w').write(options) </code></pre> <p>I want to pass a function as one of the parameters:</p> <pre><code>starting_length=9 starting_cell_size=1000 LengthofExperiments=5000000 def pippo(a,b): return a+b functionoperator=pippo </code></pre> <p>And of course in the real experiment the function pippo will be much more complex. And different from experiment to experiment.</p> <p>But what I am unable to do is to write the function automatically. In short I don't know how to generalise the writeoptions function to keep on writing the options, if one of the options is a function. I could of course copy the original file, but this is inelegant, inefficient (because it contains a lot of extra options that are not being used), and generally does not solve the question.</p> <p>How do you get python to write down the code of a function, as it writes down the value of a variable?</p>
[ { "answer_id": 400046, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 0, "selected": false, "text": "def writeoptions(directory):\n options=\"\"\n options+=\"starting_length=%s%s\"%(starting_length,os.linesep)\n opt...
2008/12/30
[ "https://Stackoverflow.com/questions/399991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46634/" ]
400,016
<p>I want to record audio using the iphone (&lt; 2 minutes) and save it to a file. I looked at SpeakHere, but it confuses me. Which classes do I use? What delegate methods do I create?</p> <p>Thanks!</p>
[ { "answer_id": 10908060, "author": "Bharathi D", "author_id": 1409804, "author_profile": "https://Stackoverflow.com/users/1409804", "pm_score": 2, "selected": false, "text": "NSMutableDictionary* recordSetting = [[NSMutableDictionary alloc] init];\n [recordSetting setValue :[NSNum...
2008/12/30
[ "https://Stackoverflow.com/questions/400016", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
400,022
<p>What is the point of having a dynamic class on which you can call methods that may, or may not be there?</p>
[ { "answer_id": 400039, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "FindByAuthor" }, { "answer_id": 6718767, "author": "konrad.kruczynski", "author_id": 549315, "author_...
2008/12/30
[ "https://Stackoverflow.com/questions/400022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
400,050
<p>Using Python, how would I go about reading in (be from a string, file or url) a mathematical expression (1 + 1 is a good start) and executing it? </p> <p>Aside from grabbing a string, file or url I have no idea of where to start with this.</p>
[ { "answer_id": 400062, "author": "Alex Coventry", "author_id": 1941213, "author_profile": "https://Stackoverflow.com/users/1941213", "pm_score": 1, "selected": false, "text": "eval >>> eval('1+1')\n2\n" }, { "answer_id": 400081, "author": "Cheery", "author_id": 21711, ...
2008/12/30
[ "https://Stackoverflow.com/questions/400050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
400,051
<p>I have a basic test web form with a DataList and a DetailsView and two XmlDataSource components for each of them.</p> <p>The binding of the DataList to the underlying XML document was easy to set up, but I'm struggling with getting the DetailsView hooked up. The idea is that there is a master/details relationship between the two bindable controls, so I guess I should hook onto the OnSelectedItemIndexChanged on the DataList to do the binding of the currently selected item in the DetailsView. But what is the correlating key / how do I set a DataKeyField when I use a XmlDataSource to get this to work?</p> <p>cheers,</p> <p>--larsw</p>
[ { "answer_id": 400062, "author": "Alex Coventry", "author_id": 1941213, "author_profile": "https://Stackoverflow.com/users/1941213", "pm_score": 1, "selected": false, "text": "eval >>> eval('1+1')\n2\n" }, { "answer_id": 400081, "author": "Cheery", "author_id": 21711, ...
2008/12/30
[ "https://Stackoverflow.com/questions/400051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2732/" ]
400,097
<p>I'm currently using NHibernate as my data access layer, using Fluent NHibernate to create the mapping files for me. I have two classes, TripItem and TripItemAttributeValue, which have a many-to-many relation between them.</p> <p>The mapping is as follows:</p> <pre><code>public class TripItemMap : ClassMap&lt;TripItem2&gt; { public TripItemMap() { WithTable("TripItemsInt"); NotLazyLoaded(); Id(x =&gt; x.ID).GeneratedBy.Identity().WithUnsavedValue(0); Map(x =&gt; x.CreateDate, "CreatedOn").CanNotBeNull(); Map(x =&gt; x.ModifyDate, "LastModified").CanNotBeNull(); /* snip */ HasManyToMany&lt;TripItemAttributeValue&gt;(x =&gt; x.Attributes).AsBag() .WithTableName("TripItems_TripItemAttributeValues_Link") .WithParentKeyColumn("TripItemId") .WithChildKeyColumn("TripItemAttributeValueId") .LazyLoad(); } } public class TripItemAttributeValueMap : ClassMap&lt;TripItemAttributeValue&gt; { public TripItemAttributeValueMap() { WithTable("TripItemAttributeValues"); Id(x =&gt; x.Id).GeneratedBy.Identity(); Map(x =&gt; x.Name).CanNotBeNull(); HasManyToMany&lt;TripItem2&gt;(x =&gt; x.TripItems).AsBag() .WithTableName("TripItems_TripItemAttributeValues_Link") .WithParentKeyColumn("TripItemAttributeValueId") .WithChildKeyColumn("TripItemId") .LazyLoad(); } } </code></pre> <p>At some point in my application I fetch existing attributes from the database, add them to tripItem.Attributes, then save the tripItem object. In the end, the TripItems_TripItemAttributeValues_Link never gets any new records, resulting in the relations not being persisted.</p> <p>If it helps, these are the mapping files generated by Fluent NHibernate for these classes:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="true" assembly="ETP.Core" namespace="ETP.Core.Domain"&gt; &lt;class name="TripItem2" table="TripItemsInt" xmlns="urn:nhibernate-mapping-2.2" lazy="false"&gt; &lt;id name="ID" column="ID" type="Int32" unsaved-value="0"&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="CreateDate" column="CreatedOn" type="DateTime" not-null="true"&gt; &lt;column name="CreatedOn" /&gt; &lt;/property&gt; &lt;property name="ModifyDate" column="LastModified" type="DateTime" not-null="true"&gt; &lt;column name="LastModified" /&gt; &lt;/property&gt; &lt;bag name="Attributes" lazy="true" table="TripItems_TripItemAttributeValues_Link"&gt; &lt;key column="TripItemId" /&gt; &lt;many-to-many column="TripItemAttributeValueId" class="ETP.Core.Domain.TripItemAttributeValue, ETP.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /&gt; &lt;/bag&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p>and</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" default-lazy="true" assembly="ETP.Core" namespace="ETP.Core.Domain"&gt; &lt;class name="TripItemAttributeValue" table="TripItemAttributeValues" xmlns="urn:nhibernate-mapping-2.2"&gt; &lt;id name="Id" column="Id" type="Int32"&gt; &lt;generator class="identity" /&gt; &lt;/id&gt; &lt;property name="Name" column="Name" length="100" type="String" not-null="true"&gt; &lt;column name="Name" /&gt; &lt;/property&gt; &lt;bag name="TripItems" lazy="true" table="TripItems_TripItemAttributeValues_Link"&gt; &lt;key column="TripItemAttributeValueId" /&gt; &lt;many-to-many column="TripItemId" class="ETP.Core.Domain.TripItem2, ETP.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" /&gt; &lt;/bag&gt; &lt;/class&gt; &lt;/hibernate-mapping&gt; </code></pre> <p>What am I doing wrong here ?</p>
[ { "answer_id": 406838, "author": "kͩeͣmͮpͥ ͩ", "author_id": 26479, "author_profile": "https://Stackoverflow.com/users/26479", "pm_score": 2, "selected": false, "text": "TripItems HasManyToMany<TripItem2>(x => x.TripItems).AsBag()\n .WithTableName(\"TripItems_TripItemAttributeValue...
2008/12/30
[ "https://Stackoverflow.com/questions/400097", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50145/" ]
400,099
<p>I'm trying to get a WCF Client assembly deploy in SQL 2005. This means I need to create/register the dependencies for my WCF Client, which are:</p> <ul> <li>System.Runtime.Serialization</li> <li>System.Web</li> <li>System.ServiceModel</li> </ul> <p>With this script:</p> <pre><code>CREATE ASSEMBLY System_Runtime_Serialization FROM 'C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\System.Runtime.Serialization.dll' WITH PERMISSION_SET = UNSAFE GO CREATE ASSEMBLY System_Web FROM 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Web.dll' WITH PERMISSION_SET = UNSAFE GO CREATE ASSEMBLY System_ServiceModel FROM 'C:\Windows\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\System.ServiceModel.dll' WITH PERMISSION_SET = UNSAFE GO </code></pre> <p>Registration of System.Web.dll fails with this error message:</p> <pre><code>Assembly 'System.Web' references assembly 'system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: version, culture or public key mismatch). Please load the referenced assembly into the current database and retry your request. </code></pre>
[ { "answer_id": 403837, "author": "Sander Rijken", "author_id": 5555, "author_profile": "https://Stackoverflow.com/users/5555", "pm_score": 4, "selected": true, "text": "CREATE ASSEMBLY System_Runtime_Serialization FROM 'C:\\Windows\\Microsoft.NET\\Framework\\v3.0\\Windows Communication F...
2008/12/30
[ "https://Stackoverflow.com/questions/400099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5555/" ]
400,100
<p>I have a Linq to Entities query like this one:</p> <pre><code>var results = from r in entities.MachineRevision where r.Machine.IdMachine == pIdMachine &amp;&amp; r.Category == (int)pCategory select r; </code></pre> <p>Usually, I use the code below to check if some results are returned:</p> <pre><code>if (results.Count() &gt; 0) { return new oMachineRevision(results.First().IdMachineRevision); } </code></pre> <p>However, I'm getting <strong>NotSupportedException</strong> in the <strong>if</strong> condition.</p> <p>The error message is: <em>Unable to create a constant value of type 'Closure type'. Only primitive types ('such as Int32, String, and Guid') are supported in this context.</em></p> <p>Note that <strong>pCategory</strong> is an Enum type.</p>
[ { "answer_id": 400105, "author": "NikolaiDante", "author_id": 39643, "author_profile": "https://Stackoverflow.com/users/39643", "pm_score": 0, "selected": false, "text": "IENumerable<MachineRevision> results = from r in entities.MachineRevision\n...\n" }, { "answer_id": 400124, ...
2008/12/30
[ "https://Stackoverflow.com/questions/400100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29544/" ]
400,113
<p>I'm looking for a best way to implement common Windows keyboard shortcuts (for example <kbd>Ctrl</kbd>+<kbd>F</kbd>, <kbd>Ctrl</kbd>+<kbd>N</kbd>) in my <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="noreferrer">Windows Forms</a> application in C#.</p> <p>The application has a main form which hosts many child forms (one at a time). When a user hits <kbd>Ctrl</kbd>+<kbd>F</kbd>, I'd like to show a custom search form. The search form would depend on the current open child form in the application.</p> <p>I was thinking of using something like this in the <em>ChildForm_KeyDown</em> event:</p> <pre><code> if (e.KeyCode == Keys.F &amp;&amp; Control.ModifierKeys == Keys.Control) // Show search form </code></pre> <p>But this doesn't work. The event doesn't even fire when you press a key. What is the solution?</p>
[ { "answer_id": 400119, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 4, "selected": false, "text": "Click" }, { "answer_id": 400325, "author": "Hans Passant", "author_id": 17034, "author_profile": ...
2008/12/30
[ "https://Stackoverflow.com/questions/400113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5290/" ]
400,114
<p>Looks like the TSQLConnection only connects to existing databases, and I could not find another component that allows me to send commands to the database server.</p> <p>I'm using Delphi 2009 with Firebird and MSSQL.</p> <p>One idea that came was to connect to a system database (master or tempdb in MSSQL for example) and then send create commands to the server. This could be an option for MSSQL, but I'm not sure for Firebird.</p> <p>I'm also aware of the new DBX metadata in Delphi 2009, but I couldn't find a way to create databases using it. All examples I've found is to modify existing databases.</p>
[ { "answer_id": 955631, "author": "user114285", "author_id": 114285, "author_profile": "https://Stackoverflow.com/users/114285", "pm_score": -1, "selected": false, "text": "dbxcommons.pas" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/400114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2089/" ]
400,115
<p>I need to work with MSMQ (Microsoft Message Queuing). What is it, what is it for, how does it work? How is it different from web services?</p>
[ { "answer_id": 400315, "author": "Ahmed", "author_id": 42749, "author_profile": "https://Stackoverflow.com/users/42749", "pm_score": 3, "selected": false, "text": "MessageQueue Receive Send" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/400115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22162/" ]
400,116
<p>What is the purpose of <code>__builtin_offsetof</code> operator (or <code>_FOFF</code> operator in Symbian) in C++?</p> <p>In addition what does it return? Pointer? Number of bytes?</p>
[ { "answer_id": 400127, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 5, "selected": true, "text": "offsetof struct abc1 { int a, b, c; };\nunion abc2 { int a, b, c; };\nstruct abc3 { abc3() { } int a, b, c; ...
2008/12/30
[ "https://Stackoverflow.com/questions/400116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16177/" ]
400,130
<p>Let's say I have a class that implements the <strong>IDisposable</strong> interface. Something like this:</p> <p><img src="https://farm4.static.flickr.com/3199/3149605015_f090f20185_o.png" alt="http://www.flickr.com/photos/garthof/3149605015/"></p> <p><strong>MyClass</strong> uses some unmanaged resources, hence the <em>Dispose()</em> method from <strong>IDisposable</strong> releases those resources. <strong>MyClass</strong> should be used like this:</p> <pre><code>using ( MyClass myClass = new MyClass() ) { myClass.DoSomething(); } </code></pre> <hr> <p>Now, I want to implement a method that calls <em>DoSomething()</em> asynchronously. I add a new method to <strong>MyClass</strong>:</p> <p><img src="https://farm4.static.flickr.com/3103/3149605005_bde86e4e0b_o.png" alt="http://www.flickr.com/photos/garthof/3149605005/"></p> <p>Now, from the client side, <strong>MyClass</strong> should be used like this:</p> <pre><code>using ( MyClass myClass = new MyClass() ) { myClass.AsyncDoSomething(); } </code></pre> <p>However, if I don't do anything else, this could fail as the object <em>myClass</em> might be disposed before <em>DoSomething()</em> is called (and throw an unexpected <strong>ObjectDisposedException</strong>). So, the call to the <em>Dispose()</em> method (either implicit or explicit) should be delayed until the asynchronous call to <em>DoSomething()</em> is done. </p> <p>I think the code in the <em>Dispose()</em> method should be executed <strong>in a asynchronous way, and only once all asynchronous calls are resolved</strong>. I'd like to know which could be the best way to accomplish this.</p> <p>Thanks.</p> <p><em>NOTE: For the sake of simplicity, I haven't entered in the details of how Dispose() method is implemented. In real life I usually follow the <a href="http://msdn.microsoft.com/en-us/library/fs2xkftw(VS.80).aspx" rel="noreferrer">Dispose pattern</a>.</em></p> <hr> <p><strong>UPDATE:</strong> Thank you so much for your responses. I appreciate your effort. As <a href="https://stackoverflow.com/users/3055/chakrit">chakrit</a> <a href="https://stackoverflow.com/questions/400130/how-to-dispose-asynchronously#400165">has commented</a>, I need that <strong>multiple calls to the async DoSomething can be made</strong>. Ideally, something like this should work fine:</p> <pre><code>using ( MyClass myClass = new MyClass() ) { myClass.AsyncDoSomething(); myClass.AsyncDoSomething(); } </code></pre> <p>I'll study the counting semaphore, it seems what I'm looking for. It could also be a design problem. If I find it convenient, I will share with you some bits of the real case and what <strong>MyClass</strong> really does.</p>
[ { "answer_id": 400145, "author": "Cristian Libardo", "author_id": 16526, "author_profile": "https://Stackoverflow.com/users/16526", "pm_score": 3, "selected": false, "text": "// The async method taks an on-completed callback delegate\nmyClass.AsyncDoSomething(delegate { myClass.Dispose()...
2008/12/30
[ "https://Stackoverflow.com/questions/400130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1679/" ]
400,135
<p>Can anyone explain to me why I would want to use IList over List in C#?</p> <p><em>Related question: <a href="https://stackoverflow.com/questions/387937">Why is it considered bad to expose <code>List&lt;T&gt;</code></a></em></p>
[ { "answer_id": 400144, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 10, "selected": true, "text": "List<T>" }, { "answer_id": 400147, "author": "Diadistis", "author_id": 47401, "author_profile": "ht...
2008/12/30
[ "https://Stackoverflow.com/questions/400135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47036/" ]
400,140
<p>What's a good way to ensure that a temp file is deleted if my application closes or crashes? Ideally, I would like to obtain a temp file, use it, and then forget about it.</p> <p>Right now, I keep a list of my temp files and delete them with an EventHandler that's triggered on Application.ApplicationExit.</p> <p>Is there a better way?</p>
[ { "answer_id": 400391, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 7, "selected": true, "text": "using using System;\nusing System.IO;\nsealed class TempFile : IDisposable\n{\n string path;\n public TempFile()...
2008/12/30
[ "https://Stackoverflow.com/questions/400140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17413/" ]
400,146
<p>I've got a couple of ASP.Net Usercontrols that I am using in different locations of my new website. These usercontrols had links like this : </p> <pre><code>&lt;a href="daily/panchang/"&gt;&lt;/a&gt; </code></pre> <p>If the usercontrol is used in pages in various subdirectories the relative path just doesn't work, and I don't want to provide my full website name in the path. So I did this</p> <pre><code>&lt;a href="~/daily/panchang/" runat="server"&gt; </code></pre> <p>and now the ASP.Net '~' marker works correctly to resolve the root path.</p> <p>Is it okay to mark all my HTML tags where I have the need to resolve the root path with runat="server" or do you know of a better, HTML way?</p> <p>Thanks</p>
[ { "answer_id": 400153, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 2, "selected": false, "text": "runat=\"server\"" }, { "answer_id": 400160, "author": "Diadistis", "author_id": 47401, "author_p...
2008/12/30
[ "https://Stackoverflow.com/questions/400146", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33052/" ]
400,167
<p>I want to move the form title, icon and close, and help buttons from left side to right side (change the layout).</p> <p>I moved the form controls manually to keep background image but now I want to change the form title.</p> <p>When I set rightToLeft property to yes and rightToLeftLayout to true in the form properties the background image disappears, but it uses the property "BackColor"</p> <p>My code is as follows:</p> <pre><code>if (_lang == 'Arabic') { this.RightToLeft = RightToLeft.Yes; this.RightToLeftLayout = true; } </code></pre> <p>But it keeps buttons image.</p> <p>So why is that?</p>
[ { "answer_id": 400358, "author": "Hans Passant", "author_id": 17034, "author_profile": "https://Stackoverflow.com/users/17034", "pm_score": 2, "selected": false, "text": "protected override void OnPaintBackground(PaintEventArgs e) {\n Rectangle rc = new Rectangle(Point.Empty, this.Clien...
2008/12/30
[ "https://Stackoverflow.com/questions/400167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42782/" ]
400,180
<p>I'm trying to create a Shared Addin using VS 2008 for Office XP (Excel to be precise). However, after creating the project in Visual studio and changing the references to Office XP (apart from Extensibility which I don't seem to be able to find a copy for office xp) and adding excel.exe to the references as well. I now don't seem to be able to get the addin to install on any computers.</p> <p>Does anyone have any guides on writing Office XP addins using VS 2008 (Com Addins I might add)?</p> <p>Does anyone know the reference that I'm meant to have or things prior that I'm meant to have installed on the pc?</p> <p>I have three test pcs, this one has office xp, 2003 and 2007 on it and I can write an addin using 2003 references that runs on this but no other box. One with just office xp on it but also office xp PIAs installed and .NET and another one just with office xp on.</p> <p>Any help would be very much appriciated.</p>
[ { "answer_id": 406456, "author": "Henry B", "author_id": 6414, "author_profile": "https://Stackoverflow.com/users/6414", "pm_score": 2, "selected": true, "text": "extensibilityMSM.msi - installs the extensibility.dll\nlockbagRegKey.msi - adds a fix to a registry key\n" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/400180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6414/" ]
400,181
<p>I've faced strange problem. While user change of check box input element on form produces adequate event programmatic change don't. How should I face this challenge? Code following:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; jQuery(document).ready( function() { jQuery("#cb").change( function() { alert("Changed!"); return true; } ); jQuery("#b").click( function() { var newState = !jQuery("#cb").attr('checked'); jQuery("#cb").attr('checked', newState); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form action="#"&gt; &lt;p&gt; &lt;input type="button" id="b" /&gt; &lt;input type="checkbox" id="cb" /&gt; &lt;/p&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Update</strong> I do not control element changes, I just need to handle them. It's general-propose code I write.</p>
[ { "answer_id": 400217, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": 1, "selected": false, "text": "jQuery(document).ready(\n function() {\n\n jQuery(\"#cb\").change(\n function() {\n changeLogicForcb...
2008/12/30
[ "https://Stackoverflow.com/questions/400181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2313/" ]
400,191
<p>In C++, how can I retrieve the location of a mounted drive? for example, if I have mounted drive s: to c:\temp (using subst in the command line) "subst c:\temp s:" how can I get "c:\temp" by passing "s:"</p> <p>I would also like to know how can it be done for a network drive. (if s: is mounted to "\MyComputer\Hello", then I want to retrieve "\MyComputer\Hello" and then to retrieve "c:\Hello" from that)</p> <p>It might be a very easy question but I just couldn't find information about it.</p> <p>Thanks,</p> <p>Adam</p>
[ { "answer_id": 400431, "author": "Stefan", "author_id": 48003, "author_profile": "https://Stackoverflow.com/users/48003", "pm_score": 0, "selected": false, "text": "wstring ConvertToUNC(wstring sPath)\n{\n WCHAR temp;\n UNIVERSAL_NAME_INFO * puni = NULL;\n DWORD bufsize = 0;\n ...
2008/12/30
[ "https://Stackoverflow.com/questions/400191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44521/" ]
400,197
<p>I have done jQuery and Ajax, but I am not able to get the response into a Div element. This is the code:</p> <p><strong>Index.html</strong></p> <pre><code>$.ajax({ type:"POST", url: "ajax.php", data:"id="+id , success: function(html){ $("#response").html(data); } }); </code></pre> <p>It is receiving the response to my <code>&lt;div id="response"&gt;&lt;/div&gt;</code>.</p> <p>The <code>ajax.php</code> returns following code to the <code>index.html</code> file:</p> <pre><code>&lt;div id ="one"&gt; OneVal &lt;/div&gt; &lt;div id ="sub"&gt; SubVal &lt;/div&gt; </code></pre> <p>Will I able to extract the OneVal and Subval into a variable, and how can I extract "OneVal" and "SubVal", instead of above response?</p>
[ { "answer_id": 400232, "author": "redsquare", "author_id": 6440, "author_profile": "https://Stackoverflow.com/users/6440", "pm_score": 7, "selected": true, "text": ".filter success: function(data){\n //Create jQuery object from the response HTML.\n var $response=$(data);\n\n //Q...
2008/12/30
[ "https://Stackoverflow.com/questions/400197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44984/" ]
400,209
<p>Given a collection of random points within a grid, how do you check <strong>efficiently</strong> that they are all lie within a fixed range of other points. ie: Pick any one random point you can then navigate to any other point in the grid.</p> <p>To clarify further: If you have a 1000 x 1000 grid and randomly placed 100 points in it how can you prove that any one point is within 100 units of a neighbour and all points are accessible by walking from one point to another?</p> <p>I've been writing some code and came up with an interesting problem: Very occasionally (just once so far) it creates an island of points which exceeds the maximum range from the rest of the points. I need to fix this problem but brute force doesn't appear to be the answer.</p> <p>It's being written in Java, but I am good with either pseudo-code or C++.</p>
[ { "answer_id": 400319, "author": "Jason S", "author_id": 44330, "author_profile": "https://Stackoverflow.com/users/44330", "pm_score": 2, "selected": false, "text": "P_j P_i P_i P_j P_i P_i P_j P_i" }, { "answer_id": 400411, "author": "Jason S", "author_id": 44330, "a...
2008/12/30
[ "https://Stackoverflow.com/questions/400209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/342/" ]
400,212
<p>How do I copy text to the clipboard (multi-browser)?</p> <p>Related: <em><a href="https://stackoverflow.com/questions/17527870/how-does-trello-access-the-users-clipboard">How does Trello access the user&#39;s clipboard?</a></em></p>
[ { "answer_id": 400252, "author": "bandi", "author_id": 49388, "author_profile": "https://Stackoverflow.com/users/49388", "pm_score": 7, "selected": false, "text": " <script type=\"text/javascript\">\n function select_all(obj) {\n var text_val=eval(obj);\n ...
2008/12/30
[ "https://Stackoverflow.com/questions/400212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4264/" ]
400,235
<p>I'm trying to get to grips with Java ME development for the Pocket PC. I'm running the NSIcom CrE-ME emulator and building my application with NetBeans 6.5.</p> <p>The application is based around three tab panels, each of which have Swing components. The contents Swing components are updated at various points in the application. These components include a JTextArea, JTextFields, and most significantly, a JTable within a JScrollPane.</p> <p>The JTable is causing problems. If I initialise it through Matisse with some sample data, it appears. But if I try to set the reference of the JTable at runtime in the populateFields() method below, nothing appears. Note that this is simply with the sample table data from the Sun tutorial, not even my custom TableModel.</p> <p>What am I doing wrong? Is there some obvious updating method I need to call, or some other glaring error/conecpt I've missed? I've tried practically every possible method I've come across that I thought might have something to do with it.</p> <p>The populateFields() method is called at various times during the program.</p> <pre><code> public void populateFields() { String[] columnNames = {"First Name", "Last Name","Sport", "# of Years", "Vegetarian"}; Object[][] data = { {"Mary", "Campione", "Snowboarding", new Integer(5), new Boolean(false)}, {"Alison", "Huml", "Rowing", new Integer(3), new Boolean(true)}, {"Kathy", "Walrath", "Knitting", new Integer(2), new Boolean(false)}, {"Sharon", "Zakhour", "Speed reading", new Integer(20), new Boolean(true)}, {"Philip", "Milne", "Pool", new Integer(10), new Boolean(false)} }; this.tableSurvey = new JTable(new DefaultTableModel(data, columnNames)); this.scrollPaneSurvey = new JScrollPane(this.tableSurvey); DefaultTableModel dtm = (DefaultTableModel) this.tableSurvey.getModel(); dtm.fireTableStructureChanged(); dtm.fireTableDataChanged(); this.scrollPaneSurvey.invalidate(); this.scrollPaneSurvey.validate(); this.panelSurvey.validate(); this.panelSurvey.repaint(); } </code></pre>
[ { "answer_id": 400709, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "this.tableSurvey = new JTable(new DefaultTableModel(data, columnNames)); \nthis.scrollPaneSurvey.setViewportView(this.ta...
2008/12/30
[ "https://Stackoverflow.com/questions/400235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
400,236
<p>I have a simple ASP.NET 3.5 SP1 Web Forms app... I've added the System.Web.Routing DLL, and I've made a simple route that returns a standard ASP.NET Page as the "IHttpHandler".</p> <p>All is good... except that HttpContext.Current.User is <strong>null</strong> ???</p> <p>So, I did a little more digging (I put breakpoints in all the events in the Global.asax file). Normally, these breakpoints get hit (when I navigate to a standard ".aspx" page):</p> <ul> <li>Application_BeginRequest</li> <li>Application_AuthenticateRequest</li> <li>Application_EndRequest</li> </ul> <p>But, when using ASP.NET Routing... none of those events are firing. Am I missing something?</p>
[ { "answer_id": 400289, "author": "Timothy Khouri", "author_id": 11917, "author_profile": "https://Stackoverflow.com/users/11917", "pm_score": 2, "selected": false, "text": "RouteTable.Routes.Add(\"Blah\", new Route(\"Blah/{reportName}\", new MyHandler());\n RouteTable.Routes.Add(\"Blah\"...
2008/12/30
[ "https://Stackoverflow.com/questions/400236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11917/" ]
400,240
<p>I would like to get a list of the wireless networks available. Ideally this would be via some C call, but I don't mind if I have to kludge it with a system call. Even better if the required C call or program doesn't require some exotic 3rd party package.</p> <p>The internet seems to suggest I use <code>sudo iwlist &lt;interface&gt; scan</code> which does seem to do the trick from the command line, but I'd rather not require root permissions. I only want to see the basics, not change anything.</p>
[ { "answer_id": 16752895, "author": "David Matlack", "author_id": 1437994, "author_profile": "https://Stackoverflow.com/users/1437994", "pm_score": 5, "selected": false, "text": "iw_set_ext iw_get_ext iw_scan -liw sudo #include <stdio.h>\n#include <time.h>\n#include <iwlib.h>\n\nint main(...
2008/12/30
[ "https://Stackoverflow.com/questions/400240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4596/" ]
400,242
<p>Can I call a remote webservice from a Stored Procedure and use the values that areretuned?</p>
[ { "answer_id": 400351, "author": "Cade Roux", "author_id": 18255, "author_profile": "https://Stackoverflow.com/users/18255", "pm_score": 0, "selected": false, "text": "sp_OACreate sp_OAMethod" }, { "answer_id": 5317860, "author": "Sunny Rajwadi", "author_id": 319544, ...
2008/12/30
[ "https://Stackoverflow.com/questions/400242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49971/" ]
400,255
<p>Is there any way to get around the Oracle 10g limitation of 1000 items in a static IN clause? I have a comma delimited list of many of IDs that I want to use in an IN clause, Sometimes this list can exceed 1000 items, at which point Oracle throws an error. The query is similar to this...</p> <pre><code>select * from table1 where ID in (1,2,3,4,...,1001,1002,...) </code></pre>
[ { "answer_id": 400267, "author": "rics", "author_id": 21047, "author_profile": "https://Stackoverflow.com/users/21047", "pm_score": 6, "selected": false, "text": "select * from table1 where ID in (1,2,3,4,...,1000)\nunion all\nselect * from table1 where ID in (1001,1002,...)\n" }, { ...
2008/12/30
[ "https://Stackoverflow.com/questions/400255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24908/" ]
400,256
<p>How can i draw a box in css? I want a box like the green one used to display the number of answers to a question in stackoverflow?</p>
[ { "answer_id": 400265, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "div display: block .box { border: 1px solid #088; font-size: 4em; }\n\n<div class=\"box\">6</div>\n" }, { "an...
2008/12/30
[ "https://Stackoverflow.com/questions/400256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20894/" ]
400,257
<p>I'm using an API that requires me to pass a function pointer as a callback. I'm trying to use this API from my class but I'm getting compilation errors. </p> <p>Here is what I did from my constructor:</p> <pre><code>m_cRedundencyManager-&gt;Init(this-&gt;RedundencyManagerCallBack); </code></pre> <p>This doesn't compile - I get the following error: </p> <blockquote> <p>Error 8 error C3867: 'CLoggersInfra::RedundencyManagerCallBack': function call missing argument list; use '&amp;CLoggersInfra::RedundencyManagerCallBack' to create a pointer to member</p> </blockquote> <p>I tried the suggestion to use <code>&amp;CLoggersInfra::RedundencyManagerCallBack</code> - didn't work for me. </p> <p>Any suggestions/explanation for this??</p> <p>I'm using VS2008.</p> <p>Thanks!!</p>
[ { "answer_id": 400261, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "Init this Init" }, { "answer_id": 400279, "author": "ofer", "author_id": 33030, "author_profile":...
2008/12/30
[ "https://Stackoverflow.com/questions/400257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33030/" ]
400,274
<p>I want to access the session of a user from a different domain than the one that I initiated the session. Can I use session.session_id of the user and then retrieve the session hash of that user ?</p> <p>Thank you</p>
[ { "answer_id": 401273, "author": "sammich", "author_id": 50276, "author_profile": "https://Stackoverflow.com/users/50276", "pm_score": -1, "selected": false, "text": "CGI::Session::ActiveRecordStore::SqlBypass::find_by_session_id(session_id)\n" }, { "answer_id": 401367, "auth...
2008/12/30
[ "https://Stackoverflow.com/questions/400274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1438479/" ]
400,276
<p>I´m trying to make a regular expression to match a whitespace and so far I´m doing this:</p> <pre><code>Powered[\s]*[bB]y.*MyBB </code></pre> <p>I know it should work because I've tried it with Regex Buddy and it says it does but when I try to run it with Eclipse it marks an error saying it's not a valid escape sequence and it automatically adds 2 ´\´ rendering the regex useless....could someone tell me what to do? I've so far ended up using a point instead of \s but what I really need is the \s...</p> <p>Thanks</p> <hr> <p><em>Added</em>:</p> <p>Well, I understand but, I though '<code>\s</code>' is used for any whitespace character and as I said, Regex Buddy also recognizes it as such, and if I use '<code>\s</code>' it is not recognized in Regex Buddy hence the test fails, but in eclipse it allows me to go on, even though it matches nothing... =/ or did I not get something?</p>
[ { "answer_id": 400305, "author": "Raymond Roestenburg", "author_id": 50142, "author_profile": "https://Stackoverflow.com/users/50142", "pm_score": 2, "selected": false, "text": "import java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\nimport org.junit.Assert;\nimport org.junit...
2008/12/30
[ "https://Stackoverflow.com/questions/400276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28586/" ]
400,283
<p>I want to filter values from database based on date.</p> <p>Date in a database contains values like this: 2008-12-28 18:00:00. And my class has a DateTime variable depending on which I want to filter. Ideally it would work like this: <code>myBindingSource.Filter = "DATE(myDateField) = myDateTime.Date"</code> + adjusting myDateTime.Date format as needed.</p> <p>But it throws an EvaluateException: "The expression contains undefined function call DATE()."</p> <p>Although if I execute the SQL statement directly, I can use the DATE() function in filter. </p> <p>P.S. I use MYSQL DB with the Connector/Net 5.2</p> <p>How can I solve this problem?</p> <p>Thank You all for suggestions.</p>
[ { "answer_id": 400344, "author": "DCNYAM", "author_id": 30419, "author_profile": "https://Stackoverflow.com/users/30419", "pm_score": 0, "selected": false, "text": "myBindingSource.Filter = \"myDateField = \" & myDateTime.Date.ToString()\n" }, { "answer_id": 400406, "author":...
2008/12/30
[ "https://Stackoverflow.com/questions/400283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50173/" ]
400,288
<p>I'm looking for an algorithm to efficiently place all-day/multi-day event banners, much like the month view in Outlook or Google Calendar. I have a number of events with a begin and end date, ordered by increasing begin (and then end) date (or any other order you please, I'm gathering events from a database table). I would like to minimize the average amount of vertical space used up, because after the event banners I will need to place other events just for that day (these always come after the banners for a given date). So, for example, if I had two events, one 1/10-1/11 and one 1/11-1/15, I would prefer to arrange them like so (each column is a single day):</p> <pre><code> bbbbb aa </code></pre> <p>and not like:</p> <pre><code>aa bbbbb </code></pre> <p>because when I add the events just for the day (x, y, and z), I can do this (I would prefer the first, do not want the second):</p> <pre><code> bbbbb vs. aa aa xyz bbbbb xyz </code></pre> <p>But it isn't as simple as placing the longer events first, because with 1/10-1/11, 1/13-1/14, and 1/11-1/13, I would want:</p> <pre><code>aa cc bbb </code></pre> <p>as opposed to:</p> <pre><code> bbb aa cc </code></pre> <p>because this would allow for events x and y:</p> <pre><code>aa cc vs. bbb xbbby aa cc x y </code></pre> <p>And of course I would prefer to do this in one pass. For the data structure, I'm currently using a map from date to list, where for each day of an event I add the event to the corresponding list. So a three-day event appears in three lists,each one under one of the days in the map. This is a convenient structure for transforming the result into visual output, but I'm open to other data structures as well. I'm currently using a greedy algorithm, where I just add each event in order, but that can produce unwanted artifacts like:</p> <pre><code>aa ccc bbbbb dd eeeeeeeeeeeeeeeee </code></pre> <p>This wastes a <em>lot</em> of space for most of the "e" event days.</p> <p>Any ideas?</p>
[ { "answer_id": 400445, "author": "Wes P", "author_id": 13611, "author_profile": "https://Stackoverflow.com/users/13611", "pm_score": 0, "selected": false, "text": " bbb\naa cc\n aa cc\n bbb\n x y bbb aa cc" }, { "answer_id": 404078, "author": "joel.neely", "author_id": 35...
2008/12/30
[ "https://Stackoverflow.com/questions/400288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50175/" ]
400,304
<p>When I run my tests in Visual Studio individually, they all pass without a problem. However, when I run all of them at once some pass and some fail. I tried putting in a pause of 1 second in between each test method with no success.</p> <p>Any ideas? Thanks in advance for your help...</p>
[ { "answer_id": 25435470, "author": "james2code", "author_id": 184390, "author_profile": "https://Stackoverflow.com/users/184390", "pm_score": 0, "selected": false, "text": "[ClassInitialize]\npublic static void ClassInit(TestContext testContext)\n{\n HttpContext.Current = new HttpCont...
2008/12/30
[ "https://Stackoverflow.com/questions/400304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50177/" ]
400,314
<p>I have a VB background and I'm converting to C# for my new job. I'm also trying to get better at .NET in general. I've seen the keyword "T" used a lot in samples people post. What does the "T" mean in C#? For example:</p> <pre><code>public class SomeBase&lt;T&gt; where T : SomeBase&lt;T&gt;, new() </code></pre> <p>What does <code>T</code> do? Why would I want to use it?</p>
[ { "answer_id": 400322, "author": "Rob Walker", "author_id": 3631, "author_profile": "https://Stackoverflow.com/users/3631", "pm_score": 6, "selected": false, "text": "Public Class SomeBase(Of T As {Class, New}))\n" }, { "answer_id": 400326, "author": "user39603", "author_...
2008/12/30
[ "https://Stackoverflow.com/questions/400314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/681/" ]
400,330
<p>While attempting to use the following code, I am receiving the following error : Already working for different url, error code 155000.</p> <pre><code>string targetPath = @"C:\Documents and Settings\Admin\My Documents\CPM Creator\"; //" for prettify client.Authenticatio​n.DefaultCredentials​ = new NetworkCredential("guestUser", "hjk$#&amp;123"); // Checkout the code to the specified directory client.CheckOut(new Uri("http://svn.peerlis.com:8080/CPM Creator"), targetPath); </code></pre>
[ { "answer_id": 400322, "author": "Rob Walker", "author_id": 3631, "author_profile": "https://Stackoverflow.com/users/3631", "pm_score": 6, "selected": false, "text": "Public Class SomeBase(Of T As {Class, New}))\n" }, { "answer_id": 400326, "author": "user39603", "author_...
2008/12/30
[ "https://Stackoverflow.com/questions/400330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
400,338
<p>This may be a naive question, but I am new to both the junit and hibernate frameworks and I was wondering what the best way to go about unit testing an application that is largely calls to hibernate, or if it is even necessary to do so? </p> <p>What is the best practice here?</p> <p><strong>EDIT:</strong><br> Spring seems to be the big suggestion here. Unfortunately this may be alittle too much to bite off for one project. Junit, Hibernate and Spring are all new to me, and while they are all technologies I want to get under my belt, I think trying to incorporate them all into one project may be too overwhelming for me.</p> <p>Links to tutorials and/or book suggestions are welcome.</p>
[ { "answer_id": 31351351, "author": "GlenPeterson", "author_id": 1128668, "author_profile": "https://Stackoverflow.com/users/1128668", "pm_score": 0, "selected": false, "text": "reallyUpdate if (reallyUpdate) {\n HibernateUtil.saveOrUpdate(theThing);\n}\n" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/400338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20774/" ]
400,346
<p>Does anyone know how to disable an ASP.NET validator using JavaScript? I'm using javascript style.display = 'none' to disable parts of a web page. However these disabled parts have asp.net validators that are still firing and I need to disable then without doing a round trip to the server. Thanks.</p>
[ { "answer_id": 400353, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 7, "selected": true, "text": "function doSomething()\n{\n var myVal = document.getElementById('myValidatorClientID');\n ValidatorEnable(myVal, fa...
2008/12/30
[ "https://Stackoverflow.com/questions/400346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47036/" ]
400,359
<p>Let's say that I have written a custom e-mail management application for the company that I work for. It reads e-mails from the company's support account and stores cleaned-up, plain text versions of them in a database, doing other neat things like associating it with customer accounts and orders in the process. When an employee replies to a message, my program generates an e-mail that is sent to the customer with a formatted version of the discussion thread. If the customer responds, the app looks for a unique number in the subject line to read the incoming message, strip out the previous discussion, and add it as a new item in the thread. For example:</p> <pre> This is a message from Contoso customer service. Recently, you requested customer support. Below is a summary of your request and our reply. -------------------------------------------------------------------- Contoso (Fred) on Tuesday, December 30, 2008 at 9:04 a.m. -------------------------------------------------------------------- John: I've modified your address. You can confirm my work by logging into "Your Account" on our Web site. Your order should ship out today. Thanks for shopping at Contoso. -------------------------------------------------------------------- You on Tuesday, December 30, 2008 at 8:03 a.m. -------------------------------------------------------------------- Oops, I entered my address incorrectly. Can you change it to Fred Smith 123 Main St Anytown, VA 12345 Thanks! -- Fred Smith Contoso Product Lover </pre> <p>Generally, this all works great, but there's one area that I've kind of putting off cleaning up for a while now, and it deals with text wrapping. In order to generate the pretty e-mail format like the one above, I need to re-wrap the text that the customer originally sent. </p> <p>I've written an algorithm that does this (though looking at the code, I'm not entirely sure how it works anymore--it could use some refactoring). <strong>But it can't distinguish between a hard-wrap newline, an "end of paragraph" newline, and a "semantic" newline.</strong> For example, a hard-wrap newline is one that the e-mail client inserted within a paragraph to wrap a long line of text, say, at 79 columns. An end of paragraph newline is one that the user added after the last sentence in a paragraph. And a semantic newline would be something like the <code>br</code> tag, such as the address that the Fred typed above.</p> <p>My algorithm instead only sees two newlines in a row as indicating a new paragraph, so it would make the customer's e-mail be formatted something like the following:</p> <pre> Oops, I entered my address incorrectly. Can you change it to Fred Smith 123 Main St Anytown, VA 12345 Thanks! -- Fred Smith Contoso Product Lover </pre> <p>Whenever I try to write a version that would re-wrap this text as intended, I basically hit a wall in that I need to know the semantics of the text, the difference between a "hard-wrap" newline and a "I really meant it like a <code>br</code>"-type newline, such as in the customer's address. (I use two newlines in a row to determine when to start a new paragraph, which coincides with how the majority of people seem to actually type e-mails.)</p> <p>Anyone have an algorithm that can re-wrap the text as intended? Or is this implementation "good enough" when weighing the complexity of any given solution?</p> <p>Thanks.</p>
[ { "answer_id": 400387, "author": "Ole", "author_id": 49540, "author_profile": "https://Stackoverflow.com/users/49540", "pm_score": 3, "selected": true, "text": "(maxlength - 15) <= length <= maxlength" }, { "answer_id": 401259, "author": "Nicholas Piasecki", "author_id": ...
2008/12/30
[ "https://Stackoverflow.com/questions/400359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32187/" ]
400,364
<h3>The Problem</h3> <p>What is the proper way to check for the <code>foo</code> parameter in the following url's querystring using asp.net? Is this even possible?</p> <pre><code>http://example.com?bar=3&amp;foo </code></pre> <p>I have tried checking <code>Request[&quot;foo&quot;]</code> as well as <code>Request.QueryString[&quot;foo&quot;]</code> and I get <code>null</code> for both. I have also tried populating a <code>List</code> with the values from the <code>QueryString</code> collection but as I mention below, it does not include the value.</p> <h3>The Question</h3> <p>I understand that there is no value, but shouldn't <code>Request[&quot;foo&quot;]</code> return an empty string rather than <code>null</code>? Is there a way to find out if a querystring key exists even if it has no value?</p> <h3>Notes</h3> <p>I found <a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=377511" rel="noreferrer">here</a> that <code>Request.QueryString.AllKeys</code> includes <code>null</code> for blank querystring parameters.</p> <h3>[edit]</h3> <p>As stated below by <a href="https://stackoverflow.com/users/12725/james-curran">James</a> and <a href="https://stackoverflow.com/users/44084/dreas-grech">Dreas</a> a Regex to parse the raw url might be the best (and possibly only) approach.</p> <pre><code>Regex.IsMatch(Request.RawUrl, &quot;[?&amp;]thumb([&amp;=]|$)&quot;) </code></pre>
[ { "answer_id": 400370, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 3, "selected": false, "text": "foo bool doesFooExist = Request.Url.AbsoluteUri.IndexOf(\"foo=\") >= 0 ? true : false;\n" }, { "answer_id": ...
2008/12/30
[ "https://Stackoverflow.com/questions/400364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208/" ]
400,395
<p>Using xaml ( wpf ) I'm trying to get rid of the line under the tab control as show in the "Illustration A" below so that it ends up looking like "Illustration B":</p> <p>Illustration A</p> <p><a href="http://www.arulerforwindows.com/images/peskylinea.png">http://www.arulerforwindows.com/images/peskylinea.png</a></p> <p>Illustration B</p> <p><a href="http://www.arulerforwindows.com/images/peskylineb.png">http://www.arulerforwindows.com/images/peskylineb.png</a></p> <p>The line shows up when I define the Tab Item but appears to be attached to the Tab Control, as a result changing BorderThickness on either or both the Tab Item or Tab Control doesn't seem to yield the desired result.</p> <p>I need to do this over a transparent background where a solid fill rectangle can't be used to mask the problem.</p> <p>Here's the code:</p> <pre><code>&lt;!--Tab Control--&gt; &lt;Style TargetType="{x:Type TabControl}"&gt; &lt;Setter Property="OverridesDefaultStyle" Value="True" /&gt; &lt;Setter Property="SnapsToDevicePixels" Value="True" /&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type TabControl}"&gt; &lt;Grid KeyboardNavigation.TabNavigation="Local"&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="Auto"/&gt; &lt;RowDefinition Height="*"/&gt; &lt;/Grid.RowDefinitions&gt; &lt;TabPanel Name="HeaderPanel" Grid.Row="0" Panel.ZIndex="1" Margin="0,0,0,-1" IsItemsHost="True" KeyboardNavigation.TabIndex="1" Background="Transparent" /&gt; &lt;Border Name="Border" Grid.Row="1" Background="{StaticResource WindowBackgroundBrush}" BorderBrush="{StaticResource DefaultSystemBrush}" BorderThickness="1,1,1,1" Margin="0,0,0,0" CornerRadius="4" KeyboardNavigation.TabNavigation="Local" KeyboardNavigation.DirectionalNavigation="Contained" KeyboardNavigation.TabIndex="2" &gt; &lt;ContentPresenter Name="PART_SelectedContentHost" Margin="4" ContentSource="SelectedContent" /&gt; &lt;/Border&gt; &lt;/Grid&gt; &lt;ControlTemplate.Triggers&gt; &lt;Trigger Property="IsEnabled" Value="False"&gt; &lt;Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}" /&gt; &lt;Setter TargetName="Border" Property="BorderBrush" Value="{StaticResource DisabledBorderBrush}" /&gt; &lt;/Trigger&gt; &lt;Trigger Property="IsEnabled" Value="False"&gt; &lt;Setter Property="Foreground" Value="{StaticResource DisabledForegroundBrush}" /&gt; &lt;Setter Property="BorderBrush" TargetName="Border" Value="{StaticResource DisabledBorderBrush}" /&gt; &lt;/Trigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; &lt;Style TargetType="{x:Type TabItem}"&gt; &lt;Setter Property="Template"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate TargetType="{x:Type TabItem}"&gt; &lt;Grid&gt; &lt;Border Name="Border" Background="Transparent" BorderBrush="{StaticResource DefaultSystemBrush}" BorderThickness="1,1,1,1" CornerRadius="6,6,0,0"&gt; &lt;ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Header" Margin="12,2,12,2"/&gt; &lt;/Border&gt; &lt;/Grid&gt; &lt;ControlTemplate.Triggers&gt; &lt;Trigger Property="IsSelected" Value="True"&gt; &lt;Setter Property="Panel.ZIndex" Value="100" /&gt; &lt;Setter TargetName="Border" Property="Background" Value="Transparent" /&gt; &lt;Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" /&gt; &lt;/Trigger&gt; &lt;Trigger Property="IsSelected" Value="False"&gt; &lt;Setter TargetName="Border" Property="Background" Value="LightGray" /&gt; &lt;Setter TargetName="Border" Property="BorderThickness" Value="1,1,1,0" /&gt; &lt;/Trigger&gt; &lt;/ControlTemplate.Triggers&gt; &lt;/ControlTemplate&gt; &lt;/Setter.Value&gt; &lt;/Setter&gt; &lt;/Style&gt; </code></pre> <p>Thanks in advance,</p> <p>Rob</p>
[ { "answer_id": 400601, "author": "Jab", "author_id": 29676, "author_profile": "https://Stackoverflow.com/users/29676", "pm_score": 2, "selected": false, "text": "<MultiTrigger>\n <MultiTrigger.Conditions>\n <Condition Property=\"Selector.IsSelected\">\n <Condition.Value>\n ...
2008/12/30
[ "https://Stackoverflow.com/questions/400395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18735/" ]
400,407
<p>I am writing a web server application in C# and using StreamReader class to read from an underlying NetworkStream:</p> <pre><code> NetworkStream ns = new NetworkStream(clientSocket); StreamReader sr = new StreamReader(ns); String request = sr.ReadLine(); </code></pre> <p>This code is prone to DoS attacks because if the attacker never disconnects we will never finish reading the line. Is there any way to limit the number of characters read by StreamReader.ReadLine() in .NET?</p>
[ { "answer_id": 400419, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "Read(char[], int, int) static IEnumerable<string> ReadLines(string path, int maxLineLength)\n{\n StringBuilder curr...
2008/12/30
[ "https://Stackoverflow.com/questions/400407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50191/" ]
400,413
<p>I've got a simple asmx web service that just needs to log some information to a transactional database. However it is timing out for the client. The call to update the database just calls 1 stored procedure and I don't beleive it could be optimized further for better performance. I've been reduced to just logging the run using log4net and then reading the log in by a separate process that updates the database. </p> <p>I was wondering if there is a better way to do this. I was wondering if there is a way to make my code do something like:</p> <pre><code>public bool method(...) { LogRun(...) Asynchronously call method to insert transaction return true; } </code></pre>
[ { "answer_id": 400419, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "Read(char[], int, int) static IEnumerable<string> ReadLines(string path, int maxLineLength)\n{\n StringBuilder curr...
2008/12/30
[ "https://Stackoverflow.com/questions/400413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50186/" ]
400,421
<p>In VB6 code, I have the following:</p> <pre><code>dim I as Long I = Weekday(Now, vbFriday) </code></pre> <p>I want the equivalent in C#. Can any one help?</p>
[ { "answer_id": 400426, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 2, "selected": false, "text": "DayOfWeek dow = DateTime.Now.DayOfWeek;\n" }, { "answer_id": 400429, "author": "Charles Bretana", "au...
2008/12/30
[ "https://Stackoverflow.com/questions/400421", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14299/" ]
400,428
<p>I can't seem to get my head around this one. I'm using HttpWebRequest to try and send some data out to another site. I'm attempting to figure out the best way to get our firewalls configured, but I'm at a loss. By watching the NetMon trace, it appears as though it's ignoring what I tell it; the HTTP headers I see go out from the request (not the browser-to-my-server request, but the my-server-to-remote-server request) don't add up.</p> <pre><code>Http: Request, CONNECT some.random.url:443 Command: CONNECT URI: some.random.url:443 Location: some.random.url:443 ProtocolVersion: HTTP/1.1 Host: some.random.url ProxyConnection: Keep-Alive HeaderEnd: CRLF </code></pre> <p>The TCP DstPort also seems to always start with HTTP(80). I can't seem to get it to handle 443 initially, no matter what; does SSL start out with a port 80 negotiate before it begins "real" transmission? To boot, this request seems to ignore any HttpWebRequest settings I try to set before initiating the request: even if I set HTTP 1.0, or keep-alive to false, it still starts off with the above headers.</p> <p>What's it doing? I'd like to know how to let it through, but I'm not sure why it's exhibiting that behavior?</p> <p>Code below, if it helps.</p> <pre><code>Uri newUri = new Uri("https://some.random.url:443/random"); System.Net.HttpWebRequest wr = (HttpWebRequest)WebRequest.Create(newUri); wr.Method = "POST"; wr.ContentType = "application/x-www-form-urlencoded"; ASCIIEncoding encoding = new ASCIIEncoding(); byte[] requestBytes = encoding.GetBytes("test"); wr.ContentLength = requestBytes.Length; System.IO.Stream stream = wr.GetRequestStream(); //FAILS HERE, ServerProtocolViolation </code></pre> <p>I've scoured over Google and other SSL/HttpWebRequest problems, but can't come up with a silver bullet.</p>
[ { "answer_id": 400474, "author": "Wes P", "author_id": 13611, "author_profile": "https://Stackoverflow.com/users/13611", "pm_score": 0, "selected": false, "text": "HttpWebRequest https" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/400428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1212/" ]
400,432
<p>I have this <code>If</code> condition in VB6 </p> <pre><code>If ( X AND ( 2 ^ Y)) Then a = a + " 1" Else a = a + " 0" </code></pre> <p>I want the same equivalent in C# </p> <p>I tried doing like </p> <pre><code>if ( X &amp;&amp; ( 2 ^ Y)) // ERROR: &amp;&amp; can not be used between int to int a = a + "1"; else a = a + "0"; </code></pre> <p>but this thing is giving me an error.</p> <p>Here is my complete VB code that I want to convert into C#</p> <pre><code>For i = 7 To 0 Step -1 If intNumber And (2 ^ i) Then ' Use the logical "AND" operator. bin = bin + "1" Else bin = bin + "0" End If Next </code></pre> <p>In above code <code>intNumber</code> could be any number.</p>
[ { "answer_id": 400440, "author": "Stefan", "author_id": 48003, "author_profile": "https://Stackoverflow.com/users/48003", "pm_score": 0, "selected": false, "text": "if ( 1 & ( 2 ^ 1))\n a = a + \"1\";\nelse\n a= a+ \"0\";\n" }, { "answer_id": 400441, "author": "Michael Mead...
2008/12/30
[ "https://Stackoverflow.com/questions/400432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14299/" ]
400,464
<p>The following code loads a gig, clears out the gigs acts collection and then adds a new act.</p> <pre><code> Data.LinqToSQL.Gig dbGig = DBContext.Gigs.Where(x =&gt; x.ID == myGigID).SingleOrDefault(); //Remove all references to the current acts if(dbGig.Acts!=null) { DBContext.Acts.DeleteAllOnSubmit(dbGig.Acts); } Data.LinqToSQL.Act dbAct = new ListenTo.Data.LinqToSQL.Act(); dbAct.ID = Guid.NewGuid(); DBContext.Acts.InsertOnSubmit(dbAct); DBContext.SubmitChanges(); </code></pre> <p>Please note that everytime I run this code, the value of myGigID is the same, so its always the same gig that I load.</p> <p>The first time I run this code it works fine and I have a gig with 1 act.</p> <p>The second time, dbGig.Acts (a collection) has a count of 0 and so the DeleteAllOnSubmit does not remove any acts. However in the database there is 1 act for this gig! Hence I end up with 2 acts once this code has run.</p> <p>If I run it a 3rd time, I end up with 3 acts in total.</p> <p>Any ideas what I'm doing wrong?</p>
[ { "answer_id": 400486, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 0, "selected": false, "text": "dbGig.Acts.Add(dbAct);\n dbAct.Gig = dbGig;\n" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/400464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46616/" ]
400,475
<p>I want a hyperlink on my main page to launch an HTML help page in a new browser window. However I want the new window to only have an address bar, i.e. not have a menu, toolbars or status bar, and better still not even have an editable address bar. </p> <p>I have seen this done on quite a few sites but can't figure out what I need to do to launch the new window in that state.</p> <p>Any clues?</p>
[ { "answer_id": 400478, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 3, "selected": false, "text": "<SCRIPT LANGUAGE=\"javascript\">\n<!--\nwindow.open ('titlepage.html', 'newwindow', config='height=100,\nwidth=400, t...
2008/12/30
[ "https://Stackoverflow.com/questions/400475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24039/" ]
400,495
<p>How can I retuen a Object from a web service:</p> <p>[WebMethod] public DataSet GetVendors(string Database) { SqlConnection sqlConn = new SqlConnection();</p> <pre><code> sqlConn.ConnectionString = GetConnString(Database); // build query string strSQL = @" SELECT [No_] AS [VendorNo], LTRIM([Name]) AS [VendorName] FROM [********_$Vendor] WHERE LEN(RTRIM([Name])) &gt; 0 /* avoid blank names */ AND [Vendor Posting Group] = 'VEND' ORDER BY LTRIM([Name]) ASC; /* LTRIM fixes spaces before name */ "; SqlDataAdapter da = new SqlDataAdapter(strSQL, sqlConn); DataSet ds = new DataSet(); da.Fill(ds, "Vendors"); return (ds); } </code></pre>
[ { "answer_id": 400523, "author": "Wes P", "author_id": 13611, "author_profile": "https://Stackoverflow.com/users/13611", "pm_score": 2, "selected": true, "text": "DataSet object" }, { "answer_id": 400605, "author": "Alex Fort", "author_id": 12624, "author_profile": "h...
2008/12/30
[ "https://Stackoverflow.com/questions/400495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49971/" ]
400,522
<p>I'm trying to match the parts of a version number (Major.Minor.Build.Revision) with C# regular expressions. However, I'm pretty new to writing Regex and even using Expresso is proving to be a little difficult. Right now, I have this:</p> <pre><code>(?&lt;Major&gt;\d*)\.(?&lt;Minor&gt;\d*)\.(?&lt;Build&gt;\d*)\.(?&lt;Revision&gt;\d*) </code></pre> <p>This works, but requires that every part of the version number exists. What I would like to do is also match versions like:</p> <pre><code>2.13 </code></pre> <p>In this case, the Build and Revision groups need to return null values. Feel free to suggest a better method if I'm going about this all wrong.</p>
[ { "answer_id": 400534, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 5, "selected": true, "text": "(?<Major>\\d*)\\.(?<Minor>\\d*)(\\.(?<Build>\\d*)(\\.(?<Revision>\\d*))?)?\n" }, { "answer_id": 400547, ...
2008/12/30
[ "https://Stackoverflow.com/questions/400522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31516/" ]
400,552
<p>I can't seem to find a .NET answer to this problem, which I would have thought would be fairly common.<br> What is the best pattern for unit testing an asynchronous method?</p> <p>Obviously I need to call the method and then see if the callback fires, but is there a better way than simply sleeping for a bit and then checking for a flag that is set by the callback? Managing the flags gets a bit messy where there are multiple tests running.</p>
[ { "answer_id": 400578, "author": "ctacke", "author_id": 13154, "author_profile": "https://Stackoverflow.com/users/13154", "pm_score": 4, "selected": true, "text": "[TestMethod]\n[WorkItem(244)]\n[Description(\"Ensures calling SetRemoteTableName with a valid name works \n AND...
2008/12/30
[ "https://Stackoverflow.com/questions/400552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50204/" ]
400,557
<p>How can i convert this to a decimal in SQL? Below is the equation and i get the answer as 78 (integer) but the real answer is 78.6 (with a decimal) so i need to show this as otherwise the report won't tally up to 100%</p> <pre><code>(100 * [TotalVisit1]/[TotalVisits]) AS Visit1percent </code></pre>
[ { "answer_id": 400573, "author": "LeppyR64", "author_id": 16592, "author_profile": "https://Stackoverflow.com/users/16592", "pm_score": 5, "selected": false, "text": "(100.0 * [TotalVisit1]/[TotalVisits]) AS Visit1percent\n" }, { "answer_id": 400590, "author": "Kent Fredric",...
2008/12/30
[ "https://Stackoverflow.com/questions/400557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
400,562
<p>I have a table where one column has duplicate records but other columns are distinct. so something like this</p> <p>Code SubCode version status</p> <p>1234 D1 1 A</p> <p>1234 D1 0 P</p> <p>1234 DA 1 A</p> <p>1234 DB 1 P</p> <p>5678 BB 1 A</p> <p>5678 BB 0 P</p> <p>5678 BP 1 A</p> <p>5678 BJ 1 A</p> <p>0987 HH 1 A</p> <p>So in the above table. subcode and Version are unique values whereas Code is repeated. I want to transfer records from the above table into a temporary table. Only records I would like to transfer are where ALL the subcodes for a code have status of 'A' and I want them in the temp table only once. </p> <p>So from example above. the temporary table should only have 5678 and 0987 since all the subcodes relative to 5678 have status of 'A' and all subcodes for 0987 (it only has one) have status of A. 1234 is ommited because its subcode 'DB' has status of 'P'</p> <p>I'd appreciate any help!</p>
[ { "answer_id": 400596, "author": "Charles Bretana", "author_id": 32632, "author_profile": "https://Stackoverflow.com/users/32632", "pm_score": 0, "selected": false, "text": "Select [stuff]\nFrom Table T\nWhere Exists\n (Select * From Table \n Where Code = T.Code\n And Statu...
2008/12/30
[ "https://Stackoverflow.com/questions/400562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
400,565
<p>I'm currently trying to modify some HttpWebRequest functions, but I can't do it through inheritance because HttpWebRequest has no public constructors (besides the deserialization constructor). Is there a workaround to do this?</p> <p>My objective is to code something like the example below, but this class objects must inherit the HttpWebRequest properties and methods:</p> <pre><code>using System; using System.Net; using System.Threading; public class AsyncWebRequest:WebRequest { private readonly AsyncCallback getResponseCallback; private readonly Uri uri; private volatile int RetriesLeft = 3; private volatile WebRequest request; public AsyncWebRequest(string uri, AsyncCallback getResponseCallback) :this(new Uri(uri), getResponseCallback) { } public AsyncWebRequest(Uri uri, AsyncCallback getResponseCallback):base() { this.uri = uri; this.getResponseCallback = getResponseCallback; } private IAsyncResult BeginGetResponse() { request = HttpWebRequest.CreateDefault(uri); ((HttpWebRequest)request).ReadWriteTimeout = Timeout; var result = request.BeginGetResponse(GetResponseCallback, null); ThreadPool.RegisterWaitForSingleObject(result.AsyncWaitHandle, GetResponseTimeout, null, Timeout, true); return result; } private void GetResponseTimeout(object state, bool timedOut) { if (timedOut) { Retry(); } } private void Retry() { request.Abort(); bool retry = false; lock (request) { if (RetriesLeft &gt; 0) { Interlocked.Decrement(ref RetriesLeft); retry = true; } } if (retry) { BeginGetResponse(); } else { getResponseCallback(null); } } private void GetResponseCallback(IAsyncResult AsyncResult) { try { getResponseCallback(AsyncResult); } catch(WebException webException) { Retry(); } } } </code></pre>
[ { "answer_id": 400757, "author": "Raymond Roestenburg", "author_id": 50142, "author_profile": "https://Stackoverflow.com/users/50142", "pm_score": 4, "selected": false, "text": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Net;\nusing System.Text;\n\...
2008/12/30
[ "https://Stackoverflow.com/questions/400565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
400,566
<p>Does anyone know of existing code that lets you draw fully justified text in Java2D?</p> <p>For example, if I said, <code>drawString("sample text here", x, y, width)</code>, is there an existing library that could figure out how much of that text fits within the width, do some inter-character spacing to make the text look good, and automatically do basic word wrapping?</p>
[ { "answer_id": 400676, "author": "coobird", "author_id": 17172, "author_profile": "https://Stackoverflow.com/users/17172", "pm_score": 5, "selected": true, "text": "Font Graphics FontMetrics public void drawString(Graphics g, String s, int x, int y, int width)\n{\n // FontMetrics give...
2008/12/30
[ "https://Stackoverflow.com/questions/400566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2197/" ]
400,567
<p>Our ssl certificate recently expired, so we were issued a new one by the CA. Unfortunately, when biztalk uses this certificate to access a server, the server rejects it, giving us a 403.17 error (Expired or not yet valid). </p> <p>So I checked the dates of the certificate and it seems okay. But to really check if the certificate was working, we loaded it into IE7 and tried to access the server. Doing so works.</p> <p>Biztalk looks at a hard-coded location for the certificate, but we've already replaced that file with the new one.</p> <p>Any idea why when Biztalk tries to access the server, it gets rejected?</p>
[ { "answer_id": 400676, "author": "coobird", "author_id": 17172, "author_profile": "https://Stackoverflow.com/users/17172", "pm_score": 5, "selected": true, "text": "Font Graphics FontMetrics public void drawString(Graphics g, String s, int x, int y, int width)\n{\n // FontMetrics give...
2008/12/30
[ "https://Stackoverflow.com/questions/400567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20526/" ]
400,575
<p>I'm not quite sure when selecting only a certain number of rows would be better than simply making a more specific select statement. I have a feeling I'm missing something pretty straight forward but I can't figure it out. I have less than 6 months experience with any SQL and it's been cursory at that so I'm sorry if this is a really simple question but I couldn't find a clear answer.</p>
[ { "answer_id": 400811, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 4, "selected": true, "text": "SELECT top 10 CustomerName\nFROM Customer\nWHERE CustomerID > 200 --start of page\nORDER BY CustomerID\n --give me some custome...
2008/12/30
[ "https://Stackoverflow.com/questions/400575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33911/" ]
400,609
<p>In my work I have come across syntax like global:: (C#) or G:Loading($value) in Php, what do they mean?</p>
[ { "answer_id": 400626, "author": "Greg Beech", "author_id": 13552, "author_profile": "https://Stackoverflow.com/users/13552", "pm_score": 4, "selected": true, "text": ":: global Foo.Bar Baz.Foo.Bar Foo.Bar Foo.Bar Baz global::Foo.Bar" }, { "answer_id": 400629, "author": "bioz...
2008/12/30
[ "https://Stackoverflow.com/questions/400609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
400,616
<p>Like every other web developer on the planet, I have an issue with users double clicking the submit button on my forms. My understanding is that the conventional way to handle this issue, is to disable the button immediately after the first click, however when I do this, <strong>it doesn't post</strong>.</p> <p>I did do some research on this, god knows there's enough information, but other questions like <a href="https://stackoverflow.com/questions/106509/disable-button-on-form-submission">Disable button on form submission</a>, disabling the button appears to work. The original poster of <a href="https://stackoverflow.com/questions/286149/disable-button-after-submit">Disable button after submit</a> appears to have had the same problem as me, but there is no mention on how/if he resolved it.</p> <p>Here's some code on how to repeat it (tested in IE8 Beta2, but had same problem in IE7)</p> <p>My aspx code</p> <pre><code>&lt;%@ Page Language="C#" CodeFile="Default.aspx.cs" Inherits="_Default" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;script language="javascript" type="text/javascript"&gt; function btn_onClick() { var chk = document.getElementById("chk"); if(chk.checked) { var btn = document.getElementById("btn"); btn.disabled = true; } } &lt;/script&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;asp:Literal ID="lit" Text="--:--:--" runat="server" /&gt; &lt;br /&gt; &lt;asp:Button ID="btn" Text="Submit" runat="server" /&gt; &lt;br /&gt; &lt;input type="checkbox" id="chk" /&gt;Disable button on first click &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>My cs code</p> <pre><code>using System; public partial class _Default : System.Web.UI.Page { protected override void OnInit(EventArgs e) { base.OnInit(e); btn.Click += new EventHandler(btn_Click); btn.OnClientClick = "btn_onClick();"; } void btn_Click(object sender, EventArgs e) { lit.Text = DateTime.Now.ToString("HH:mm:ss"); } } </code></pre> <p>Notice that when you click the button, a postback occurs, and the time is updated. But when you check the check box, the next time you click the button, the button is disabled (as expected), but never does the postback.</p> <p>WHAT THE HECK AM I MISSING HERE???</p> <p>Thanks in advance.</p>
[ { "answer_id": 400633, "author": "Kon", "author_id": 22303, "author_profile": "https://Stackoverflow.com/users/22303", "pm_score": 2, "selected": false, "text": ".hiddenButton\n{\n position: absolute;\n top: -1000px;\n left: -1000px;\n}\n" }, { "answer_id": 400716, "author...
2008/12/30
[ "https://Stackoverflow.com/questions/400616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29043/" ]
400,628
<p>I have a VS 2008 project under TortoiseSVN source control. I am the only person using it at present.</p> <p>I was trying to commit my latest changes when I received the message "File abc is out of date - please update". When I try to update the project, I get a whole set of file conflicts (binary and text). Since I am confident my working copy contains the correct version of the files, I try to resolve the conflicts by selecting "mine" as the correct version. I have also tried just marking each file conflict as resolved. I am then able to commit.</p> <p>However, following this my VS 2008 project refuses to compile, and gives hundreds of errors (so many errors that VS 2008 reports that there are too many errors to show!). Something about TortoiseSVN's conflict resolution completely screws up the project, and it refuses to build. </p> <p><strong>Any way I can force TortoiseSVN to just save my working copy into the repository as the latest revision, without checking for conflicts?</strong></p>
[ { "answer_id": 400679, "author": "Ole", "author_id": 49540, "author_profile": "https://Stackoverflow.com/users/49540", "pm_score": 3, "selected": true, "text": ">>>>>> theirs <<<<<<< mine" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/400628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6939/" ]
400,631
<p>How can I place a banner on webpage with one application to all pages of a website?</p>
[ { "answer_id": 400649, "author": "ConroyP", "author_id": 2287, "author_profile": "https://Stackoverflow.com/users/2287", "pm_score": 2, "selected": false, "text": "banner.inc.php:\n<?php\n // echo out banner here...\n?>\n include(\"banner.inc.php\");\n" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/400631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
400,655
<p>What exactly is a "Format String Vulnerability" in a Windows System, how does it work, and how can I protect against it?</p>
[ { "answer_id": 400722, "author": "some", "author_id": 36866, "author_profile": "https://Stackoverflow.com/users/36866", "pm_score": 2, "selected": false, "text": "string s=getUserInput();\nwrite(s)\n int i=getUnits();\nwrite(\"%02d units\",i);\n write(\"%s\",s);\n output(s);\n" }, { ...
2008/12/30
[ "https://Stackoverflow.com/questions/400655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50216/" ]
400,674
<p>I'm trying to reproduce the functionality of built-in Mail application when a new message arrives while you are listening to iPod music.</p> <p>What happens with the Mail app is:</p> <ol> <li>iPod's volume lowers a bit</li> <li>Mail app plays a short sound and vibration</li> <li>iPod's volume goes back to normal</li> </ol> <p>I know how to play a sound and cause vibration, what I don't know is how to lower iPod's volume and restore it after my sound plays.</p> <p>How can I reproduce this same functionality in my app with SDK 2.2? I know third party apps can't run in the background. My users will play the iPod then have my app in the foreground. </p>
[ { "answer_id": 1003744, "author": "Aleksandar Vacić", "author_id": 108859, "author_profile": "https://Stackoverflow.com/users/108859", "pm_score": 2, "selected": false, "text": "[[MPMusicPlayerController iPodMusicPlayer] setVolume:x.y]\n" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/400674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44091/" ]
400,691
<p>I'm struggling to create an OU for Active Directory using the code below.</p> <pre><code>strPath = "OU=TestOU,DC=Internal,DC=Com" DirectoryEntry objOU; objOU = ADentry.Children.Add(strPath, "OrganizationalUnit"); objOU.CommitChanges(); </code></pre> <p>The problem is strPath contains the full path 'OU=TestOU,DC=Internal,DC=net' so using .Children.Add is making the ldap path 'OU=TestOU,DC=Internal,DC=net,DC=Internal,DC=net' which results in an error as the domain obviously doesn't exist. </p> <p>My question is can I create an OU using <code>strPath</code> without <code>.Children.Add</code>? </p> <p>I'm not familiar with AD and this is something I inherited from the guy before me.</p>
[ { "answer_id": 400787, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": "using System;\nusing System.DirectoryServices;\n\nnamespace ADAM_Examples\n{\n class CreateOU\n {\n /// <summary>...
2008/12/30
[ "https://Stackoverflow.com/questions/400691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
400,706
<p>I'm trying to run down a memory leak in a windows forms application. I'm looking now at a form which contains several embedded forms. What worries me is that the child forms, in their constructor, take a reference to the parent form, and keep it in a private member field. So it seems to me that come garbage-collection time:</p> <p>Parent has a reference to the child form, via the controls collection (child form is embedded there). Child form is not GC'd.</p> <p>Child form has a reference to the parent form, via the private member field. Parent form is not GC'd. </p> <p>Is this an accurate understanding of how the garbage collector will evaluate the situation? Any way to 'prove' it for testing purposes?</p>
[ { "answer_id": 6473482, "author": "user814688", "author_id": 814688, "author_profile": "https://Stackoverflow.com/users/814688", "pm_score": 2, "selected": false, "text": "interface IEventSource\n{\n event EventHandler SomethingHappened;\n}\n class MyClass : IDisposable\n{\n IEvent...
2008/12/30
[ "https://Stackoverflow.com/questions/400706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18071/" ]
400,712
<p>How can I limit a result set to <em>n</em> distinct values of a given column(s), where the actual number of rows may be higher?</p> <p>Input table:</p> <pre><code>client_id, employer_id, other_value 1, 2, abc 1, 3, defg 2, 3, dkfjh 3, 1, ldkfjkj 4, 4, dlkfjk 4, 5, 342 4, 6, dkj 5, 1, dlkfj 6, 1, 34kjf 7, 7, 34kjf 8, 6, lkjkj 8, 7, 23kj </code></pre> <p>desired output, where limit distinct=5 distinct values of client_id:</p> <pre><code>1, 2, abc 1, 3, defg 2, 3, dkfjh 3, 1, ldkfjkj 4, 4, dlkfjk 4, 5, 342 4, 6, dkj 5, 1, dlkfj </code></pre> <p>Platform this is intended for is MySQL.</p>
[ { "answer_id": 400721, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 5, "selected": true, "text": "select * from table where client_id in \n(select distinct client_id from table order by client_id limit 5)\n" }, ...
2008/12/30
[ "https://Stackoverflow.com/questions/400712", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41613/" ]
400,717
<p>What can be done to resolve the exception:</p> <p>CrystalDecisions.CrystalReports.Engine.InternalException: Failed to open a rowset.</p>
[ { "answer_id": 3995720, "author": "fritterfatboy", "author_id": 385382, "author_profile": "https://Stackoverflow.com/users/385382", "pm_score": 0, "selected": false, "text": "Try\n 'your code here\nCatch\n Throw new exception(\"Hey, here's a really friendly but completely useless err...
2008/12/30
[ "https://Stackoverflow.com/questions/400717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19308/" ]
400,728
<p>I'm working with a jQuery dialog that contains a form. In ie6, there are a couple unexplained inches of padding above the form. When I eliminate the form from the markup, the most serious layout problems go away. I've tried it with no theme (default), Flora, and my themeroller theme and they all seem to have the same problem.</p> <p>I've tried making various adjustments to the dialog CSS, but nothing seems to have any effect, and a good amount of inline CSS is written when the dialog is created anyway that prevents any other styles from applying.</p> <p>I've tried setting css properties on the form itself such as floating, eliminating margins and padding, displaying inline, etc but as long as the form's there, there is extra spacing. Has anyone been able to find a workaround for this? I'd rather not hack it and have form controls with no form tag.</p> <p>Thanks.</p>
[ { "answer_id": 402551, "author": "Soviut", "author_id": 46914, "author_profile": "https://Stackoverflow.com/users/46914", "pm_score": 3, "selected": true, "text": "form {\n margin: 0;\n padding: 0;\n overflow: hidden;\n}\n * {\n border: solid 1px #FF0000;\n}\n" }, { "...
2008/12/30
[ "https://Stackoverflow.com/questions/400728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47096/" ]
400,732
<p>How do you determine the length of a string of text in Arial Bold font, and then center it in VB6?</p> <p>We are not using a "label" or "picture box" to print the text to the screen. We are sizing the text on the fly, and allowing the user to scale the size of our application to their liking. We write the text to screen using code.</p>
[ { "answer_id": 400760, "author": "Neil Barnwell", "author_id": 26414, "author_profile": "https://Stackoverflow.com/users/26414", "pm_score": 1, "selected": false, "text": "MeasureString" }, { "answer_id": 400775, "author": "RS Conley", "author_id": 7890, "author_profi...
2008/12/30
[ "https://Stackoverflow.com/questions/400732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40091/" ]
400,733
<p>I want to get the ASCII value of characters in a string in C#.</p> <p>If my string has the value "9quali52ty3", I want an array with the ASCII values of each of the 11 characters.</p> <p>How can I get ASCII values in C#?</p>
[ { "answer_id": 400738, "author": "LeppyR64", "author_id": 16592, "author_profile": "https://Stackoverflow.com/users/16592", "pm_score": 6, "selected": false, "text": "string s = \"9quali52ty3\";\nforeach(char c in s)\n{\n Console.WriteLine((int)c);\n}\n" }, { "answer_id": 400742...
2008/12/30
[ "https://Stackoverflow.com/questions/400733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14299/" ]
400,739
<p>Does * have a special meaning in Python as it does in C? I saw a function like this in the Python Cookbook:</p> <pre><code>def get(self, *a, **kw) </code></pre> <p>Would you please explain it to me or point out where I can find an answer (Google interprets the * as wild card character and thus I cannot find a satisfactory answer).</p>
[ { "answer_id": 400753, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 9, "selected": true, "text": "*identifier **identifier # Excess keyword argument (python 2) example:\ndef foo(a, b, c, **args):\n print \"a = %s\" % (a...
2008/12/30
[ "https://Stackoverflow.com/questions/400739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8203/" ]
400,759
<p>Is there an easy way to do a <code>GROUP BY DATE(timestamp)</code> that includes all days in a period of time, regardless of whether there are any records associated with that date?</p> <p>Basically, I need to generate a report like this:</p> <pre><code>24 Dec - 0 orders 23 Dec - 10 orders 22 Dec - 8 orders 21 Dec - 2 orders 20 Dec - 0 orders </code></pre>
[ { "answer_id": 400779, "author": "ChrisW", "author_id": 49942, "author_profile": "https://Stackoverflow.com/users/49942", "pm_score": 3, "selected": true, "text": "24 Dec\n23 Dec\n22 Dec\n21 Dec\n20 Dec\n" }, { "answer_id": 400789, "author": "Charles Bretana", "author_id"...
2008/12/30
[ "https://Stackoverflow.com/questions/400759", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1902010/" ]
400,772
<p>I want to improve integration tests methods where I work and I would like to know how this process happens in other places.<br> Things like:<br> - When test plans writing begin<br> - Proportion between testers, developers and stuff (entire applications or modifications) to be tested<br> - What kind of methods are used for integration testing.<br> <br></p> <p>Actually, I test webapps and test plans are managed with Test Link. Bugs found are reported on Bugzilla. I am trying to automate tests with Selenium RC, but I takes some time to write the plans and write the code to execute on Selenium. And time is something that I dont have, because I am testing 3 or more aplications.</p> <p>Most of my problems are caused by differences between test environment and production environment. But tests are taking too long to begin. If someone finishes a modification today, it will take about 3 weeks for me to begin tests. And the test process queue keeps growing.</p> <p>It would be really good if anyone suggests something that would improve testing process (like more people testing,etc). But mostly, I would like to hear <b>how testing process works on other places</b>.<br> Thanks.</p>
[ { "answer_id": 400779, "author": "ChrisW", "author_id": 49942, "author_profile": "https://Stackoverflow.com/users/49942", "pm_score": 3, "selected": true, "text": "24 Dec\n23 Dec\n22 Dec\n21 Dec\n20 Dec\n" }, { "answer_id": 400789, "author": "Charles Bretana", "author_id"...
2008/12/30
[ "https://Stackoverflow.com/questions/400772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37650/" ]
400,778
<p>I'm trying to create a UserControl that inherits from a generic class. It does not directly inherit from a generic class, but through an intermediate class that does not use generics. This compiles and works at runtime, but I get an error at design time.</p> <p>Here's my generic parent class:</p> <pre><code>Public Class GenericParent(Of T) Inherits UserControl End Class </code></pre> <p>Here's my non-generic parent class:</p> <pre><code>Public Class NonGenericParent Inherits GenericParent(Of String) End Class </code></pre> <p>Here's my XAML:</p> <pre><code>&lt;local:NonGenericParent x:Class="SilverlightApplication5.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:SilverlightApplication5" Width="400" Height="300"&gt; &lt;StackPanel&gt; &lt;Button Content="Hello"/&gt; &lt;/StackPanel&gt; &lt;/local:NonGenericParent&gt; </code></pre> <p>The IntelliSense parser gives the following errors:</p> <ol> <li>The property 'Width' was not found in type 'NonGenericParent'.</li> <li>The property 'Height' was not found in type 'NonGenericParent'.</li> <li>The type 'NonGenericParent' does not support direct content.</li> </ol> <p>It is as though IntelliSense can't see up the inheritance tree past the GenericParent class. I've tried specifying the ContentPropertyAttribute directly on the SilverlightApplication5.Page class, the NonGenericParent class, and it does not work.</p> <p>I've read that the TypeArguments attribute is not supported in Silverlight 2.0. That is why I've created the intermediate NonGenericParent class.</p> <p>If anybody has any ideas how to silence these errors I'd be eager to hear them.</p> <p><strong>Update:</strong> We've opened a support ticket with MSFT, I'll update this with whatever their solution is.</p>
[ { "answer_id": 400842, "author": "Steven Evers", "author_id": 48553, "author_profile": "https://Stackoverflow.com/users/48553", "pm_score": 1, "selected": false, "text": "\nclass GenericObject[T] : UserControl\n{\n}\n\nclass StaticObject : GenericObject[Int32]\n{\n public Int32 wide {...
2008/12/30
[ "https://Stackoverflow.com/questions/400778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16625/" ]
400,788
<p>I need to resize jpg images with Python without losing the original image's EXIF data (metadata about date taken, camera model etc.). All google searches about python and images point to the PIL library which I'm currently using, but doesn't seem to be able to retain the metadata. The code I have so far (using PIL) is this:</p> <pre><code>img = Image.open('foo.jpg') width,height = 800,600 if img.size[0] &lt; img.size[1]: width,height = height,width resized_img = img.resize((width, height), Image.ANTIALIAS) # best down-sizing filter resized_img.save('foo-resized.jpg') </code></pre> <p>Any ideas? Or other libraries that I could be using?</p>
[ { "answer_id": 400838, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 5, "selected": true, "text": "import jpeg\njpeg.setExif(jpeg.getExif('foo.jpg'), 'foo-resized.jpg') \n" }, { "answer_id": 4270949, "author": "Maksy...
2008/12/30
[ "https://Stackoverflow.com/questions/400788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35716/" ]
400,794
<p>I needed an algorithm to generate all possible partitions of a positive number, and I came up with one (posted as an answer), but it's exponential time.</p> <p>The algorithm should return all the possible ways a number can be expressed as the sum of positive numbers less than or equal to itself. So for example for the number <strong>5</strong>, the result would be:</p> <ul> <li>5</li> <li>4+1</li> <li>3+2</li> <li>3+1+1</li> <li>2+2+1</li> <li>2+1+1+1</li> <li>1+1+1+1+1</li> </ul> <p>So my question is: is there a more efficient algorithm for this?</p> <p><strong>EDIT:</strong> Question was titled <em>"Sum decomposition of a number"</em>, since I didn't really know what this was called. <a href="https://stackoverflow.com/questions/400794/generating-the-partitions-of-a-number#400810">ShreevatsaR pointed out</a> that they were called "partitions," so I edited the question title accordingly.</p>
[ { "answer_id": 400796, "author": "Can Berk Güder", "author_id": 2119, "author_profile": "https://Stackoverflow.com/users/2119", "pm_score": 5, "selected": false, "text": "q = { 1: [[1]] }\n\ndef decompose(n):\n try:\n return q[n]\n except:\n pass\n\n result = [[n]]...
2008/12/30
[ "https://Stackoverflow.com/questions/400794", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2119/" ]
400,798
<p>I have a WCF service that I call from a windows service.</p> <p>The WCF service runs a SSIS package, and that package can take a while to complete and I don't want my windows service to have to wait around for it to finish.</p> <p>How can I make my WCF service call asynchronous? (or is it asynchronous by default?)</p>
[ { "answer_id": 5828828, "author": "Bahamut", "author_id": 730580, "author_profile": "https://Stackoverflow.com/users/730580", "pm_score": 4, "selected": false, "text": "Add Service Reference > click Advanced button > check the Generate Asynchronous Operations" }, { "answer_id": 3...
2008/12/30
[ "https://Stackoverflow.com/questions/400798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
400,799
<p>I'm having a major issue trying to configure a new install of BizTalk Server 2006 (not R2). The server had BizTalk installed on it before, and it was working fine. I've uninstalled BizTalk, removed the databases and jobs from the SQL server, which is a separate machine, and re-installed BizTalk. The install was successful, with no errors during the install, and nothing in the install logs. </p> <p>I'm configuring the BizTalk server to be the SSO master secret server, along with creating a new BizTalk group and registering the BizTalk runtime. The process always errors out on creating the SSO database on the SQL server. In the ConfigLog, there are a couple of warnings that the <code>MSSQLServerOLAPService does not exist</code>, then it shows errors on creating the SSO database. There are 4 in a row. In order, they are:</p> <pre><code>Error ConfigHelper] [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. Error ConfigHelper] SQL error: 08001 Native error code: 17 Error ConfigHelper] c:\depotsetupv2\private\common\configwizard\confighelper\sqlhelper.cpp(1176): FAILED hr = 80004005 Error ConfigHelper] c:\depotsetupv2\private\common\configwizard\confighelper\sqlhelper.cpp(918): FAILED hr = 80004005 </code></pre> <p>It then has similar errors trying to create each of the BizTalk databases.</p> <p>On the SQL server, there are corresponding errors in the SQL Server Logs - 2 for each attempt Login failed for user '[USERNAME]'.[CLIENT: [IP ADDRESS]] Error: 18456, Severity: 14, State: 16</p> <p>The first error from the SQL logs also shows up as a failure audit in the SQL server's application event log.</p> <p>The biggest issue I am having with this is that the user I am logged on to the BizTalk server is a local admin on both the BizTalk server and the SQL server, and is in the SQL sysadmin group. The user that I am configuring the BizTalk services to run under is also a local admin on both servers and in the sysadmin group on the SQL server. I've checked the MSDTC settings on both machines and made sure they are set as the BizTalk documentation recommends. SQL Browser is running on the SQL machine, and I've verified that network access is allowed using the SQL Surface Area Configuration tool.</p> <p>Can anyone help me find something that I might have missed?</p> <p>Re: Igal:</p> <p>Yes, all of the servers and users are on the same domain. I've run across that posting on SQL protocols in researching this, but I tried to select a count from one of the tables in the default database of the logged in user while connected to another database. I had no problems at all running that query.</p> <p>Re: Yossi:</p> <p>I'm installing BizTalk on Windows Server 2003 R2 SP1. Yes, I have removed the SSODB (Wouldn't out it past myself to miss something like that though!). I will make sure I am providing the usernames correctly and check out the sources you linked and get back to you.</p>
[ { "answer_id": 5828828, "author": "Bahamut", "author_id": 730580, "author_profile": "https://Stackoverflow.com/users/730580", "pm_score": 4, "selected": false, "text": "Add Service Reference > click Advanced button > check the Generate Asynchronous Operations" }, { "answer_id": 3...
2008/12/30
[ "https://Stackoverflow.com/questions/400799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16683/" ]
400,802
<p>How to fetch HTML in C or C++? with Sockets. Can you give me a Example code pls?</p> <p>NOTE - I originally closed this, but reopened. To the poster - Please see:</p> <p><a href="https://stackoverflow.com/questions/400688/fetch-web-page-in-c">https://stackoverflow.com/questions/400688/fetch-web-page-in-c</a></p> <p>and</p> <p><a href="https://stackoverflow.com/questions/389069/programmatically-reading-a-web-page#389074">Programmatically reading a web page</a></p>
[ { "answer_id": 400825, "author": "Johann Gerell", "author_id": 6345, "author_profile": "https://Stackoverflow.com/users/6345", "pm_score": 1, "selected": false, "text": "URLDownloadToFile IBindStatusCallback NULL" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/400802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50216/" ]
400,805
<p>I'm looking for the name of the PHP function to build a query string from an array of key value pairs. Please note, I am looking for <em>the built in PHP</em> function to do this, not a homebrew one (that's all a google search seems to return). There is one, I just can't remember its name or find it on php.net. IIRC its name isn't that intuitive.</p>
[ { "answer_id": 400814, "author": "TJ L", "author_id": 12605, "author_profile": "https://Stackoverflow.com/users/12605", "pm_score": 9, "selected": true, "text": "http_build_query()" }, { "answer_id": 5997082, "author": "0x6A75616E", "author_id": 62747, "author_profile...
2008/12/30
[ "https://Stackoverflow.com/questions/400805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1349865/" ]
400,819
<p>I would like to call a sql statement such as:</p> <pre><code>Select * From Table Where Column in ('value1', 'value2', 'value3') </code></pre> <p>Is it as simple as setting a command parameter's value equal to "<code>('value1', 'value2', 'value3')</code>"?</p>
[ { "answer_id": 400831, "author": "JoshBerke", "author_id": 26160, "author_profile": "https://Stackoverflow.com/users/26160", "pm_score": 0, "selected": false, "text": "select * from \ntable inner join\ndbo.fn_stringToTable(@params)\n" }, { "answer_id": 400854, "author": "Char...
2008/12/30
[ "https://Stackoverflow.com/questions/400819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9150/" ]
400,822
<p>I've got some shell stuff set up that dynamically defines aliases depending on what sort of VC repo the CWD contains -- so, for example, 'd' runs 'svn diff' or 'git diff', depending. (Based on <a href="http://muness.blogspot.com/2008/06/stop-presses-bash-said-to-embrace.html" rel="nofollow noreferrer">this blog post</a>, if anybody is interested...)</p> <p>I'd like to define some aliases differently depending on whether I'm in a git repo versus a git-svn repo. Is there an easy way to tell the difference between the two? </p>
[ { "answer_id": 400932, "author": "codelogic", "author_id": 43427, "author_profile": "https://Stackoverflow.com/users/43427", "pm_score": 3, "selected": false, "text": "git config git config --get svn-remote.svn.url\n" }, { "answer_id": 401725, "author": "Pieter", "author_...
2008/12/30
[ "https://Stackoverflow.com/questions/400822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39933/" ]
400,834
<p>I am loading a Microsoft CRM 4.0 window from an Intranet page using window.open(...).</p> <p>When the window closes, I need it to programmatically press a button on the page that opened it. I can do this from my own form by getting the button (whose name is passed in the querystring) and executing its click method in JavaScript.</p> <p>I thought I could try opening my own window with an iframe containing the CRM page as I do with other web-based systems on our Intranet. In the page I can then click the button in the onunload event of the page. However, although this works for most of our systems, with CRM I get two problems.</p> <ol> <li>If I open a window then simply close it I get a CRM error.</li> <li>If I press the Save and Close button from the CRM window it saves but does not close.</li> </ol> <p>Is there a solution for this?</p>
[ { "answer_id": 415473, "author": "brendan", "author_id": 225, "author_profile": "https://Stackoverflow.com/users/225", "pm_score": 2, "selected": true, "text": "if(window.opener.DoSomeFunction != null)\n {\n window.opener.DoSomeFunction;\n }\n" } ]
2008/12/30
[ "https://Stackoverflow.com/questions/400834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44938/" ]
400,843
<p>I have created some rounded navigation tabs using CSS and am having trouble when implementingn <code>hover</code>.</p> <p>Firstly here is a link to the site <a href="http://www.ronnieweb.byethost10.com/test/index.html" rel="nofollow noreferrer">Tabs</a> as it is quite difficult to explain. Please, hover over the left side of the tabs to understand my problem. I have explained below.</p> <p>I have a background image set on <code>#navigation li</code> items this contains the left side corner and I then have a second background image (the right corner) this is set using <code>#navigation a</code>.</p> <p>However when I hover over the left side of the tab, only a small piece of background is shown, I presume this is because only the li area is being hovered over. Obviously I would like the entire tab to highlight as it does when you hover over the rest of it.</p> <p>This was quite hard to explain so if you need to question me further to understand the problem please do.</p>
[ { "answer_id": 400877, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 3, "selected": true, "text": "a a:hover transparent" }, { "answer_id": 400919, "author": "Mg.", "author_id": 314728, "author_profile...
2008/12/30
[ "https://Stackoverflow.com/questions/400843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50057/" ]