qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
209,086
<p>I've got a C++ Win32 application that has a number of threads that might be busy doing IO (HTTP calls, etc) when the user wants to shutdown the application. Currently, I play nicely and wait for all the threads to end before returning from <code>main</code>. Sometimes, this takes longer than I would like and indeed, it seems kind of pointless to make the user wait when I could just exit. However, if I just go ahead and return from <code>main</code>, I'm likely to get crashes as destructors start getting called while there are still threads using the objects.</p> <p>So, recognizing that in an ideal, platonic world of virtue, the best thing to do would be to wait for all the threads to exit and then shutdown cleanly, what is the next best real world solution? Simply making the threads exit faster may not be an option. The goal is to get the process dead as quickly as possible so that, for example, a new version can be installed over it. The only disk IO I'm doing is in a transactional db, so I'm not terribly concerned about pulling the plug on that.</p>
[ { "answer_id": 210385, "author": "Roddy", "author_id": 1737, "author_profile": "https://Stackoverflow.com/users/1737", "pm_score": 3, "selected": false, "text": "QueueUserAPC()" }, { "answer_id": 8440351, "author": "Daniel", "author_id": 362589, "author_profile": "htt...
2008/10/16
[ "https://Stackoverflow.com/questions/209086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23524/" ]
209,095
<p>Requirement is to pass module name and function name from the command-line argument. I need to get the command-line argument in the program and I need to call that function from that module</p> <p>For example, calling a try.pl program with 2 arguments: MODULE1(Module name) Display(Function name)</p> <pre><code> perl try.pl MODULE1 Display </code></pre> <p>I want to some thing like this, but its not working, please guide me: </p> <pre><code>use $ARGV[0]; &amp; $ARGV[0]::$ARGV[1](); </code></pre>
[ { "answer_id": 209284, "author": "Yanick", "author_id": 10356, "author_profile": "https://Stackoverflow.com/users/10356", "pm_score": 3, "selected": false, "text": "#!/usr/bin/perl\nuse strict;\nuse warnings;\n\nmy ( $package, $function ) = @ARGV;\n\neval \"use $package; 1\" or die $@;\n...
2008/10/16
[ "https://Stackoverflow.com/questions/209095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28622/" ]
209,110
<p>In my application I have a number of panes from m_wndspliter classes. What I want to do is at run time show and hide one of these panes. Whilst with the following code I can show and hide the view associated with the pane, I can't temporarily remove the pane itself. </p> <pre><code>CWnd * pCurView = m_wndSplitter2.GetPane(2, 0); if( !pCurView == NULL ) { if( fShow ) { pCurView-&gt;ShowWindow(SW_SHOW); RecalcLayout(); } else { pCurView-&gt;ShowWindow(SW_HIDE); RecalcLayout(); } } </code></pre> <p>Any examples / ideas ?</p>
[ { "answer_id": 66088935, "author": "thomiel", "author_id": 1284927, "author_profile": "https://Stackoverflow.com/users/1284927", "pm_score": 0, "selected": false, "text": "CExtSplitter" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18664/" ]
209,127
<p>I'm looking for a plugin for jQuery that can validate as a key is pressed and after it loses focus (text boxes). </p> <p>I'm currently using <a href="http://www.overset.com/2008/07/31/jval-jquery-form-field-validation-plugin/" rel="nofollow noreferrer">jVal - jQuery Form Field Validation Plugin</a>. It works pretty good. The only issue I have is that I can only use a generic error message.</p> <p>For example: I need a string to between 2 and 5 characters. If its too short I would like to display an error message that indicates it to short, equally if its too long. I know I could display an error message that requires the string to between 2 and 5 characters. <strong>The validation that is being done is more complicated.</strong> </p> <p>Any ideas of other validators or how I could use this plug-in to display unique error messages.</p> <hr> <p>Edit:</p> <p>The validation tool needs to prevent particular letters or numbers and not require a form. </p> <p>Thanks</p>
[ { "answer_id": 209168, "author": "hasseg", "author_id": 4111, "author_profile": "https://Stackoverflow.com/users/4111", "pm_score": 5, "selected": true, "text": "// validate signup form on keyup and submit\n$(\"#signupForm\").validate({\n rules: {\n firstname: \"required\",\n ...
2008/10/16
[ "https://Stackoverflow.com/questions/209127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7617/" ]
209,132
<p>How would I assign a variable within scriplet code in JSP &lt;%> and then use struts logic tags to do stuff based on the value of the variable assigned in the scriplet code block?</p> <p>I have tried using struts:logic equal and greaterthan to no avail....</p> <p>Many Thanks,</p>
[ { "answer_id": 209882, "author": "myplacedk", "author_id": 28683, "author_profile": "https://Stackoverflow.com/users/28683", "pm_score": 1, "selected": false, "text": "<% String foo = \"Test\"; %>\n<bean:write name=\"foo\" />\n" }, { "answer_id": 18515083, "author": "rohan", ...
2008/10/16
[ "https://Stackoverflow.com/questions/209132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21004/" ]
209,133
<p>We are logging any exceptions that happen in our system by writing the Exception.Message to a file. However, they are written in the culture of the client. And Turkish errors don't mean a lot to me.</p> <p>So how can we log any error messages in English without changing the users culture?</p>
[ { "answer_id": 209222, "author": "morechilli", "author_id": 5427, "author_profile": "https://Stackoverflow.com/users/5427", "pm_score": 1, "selected": false, "text": "0x00000001" }, { "answer_id": 209259, "author": "mdb", "author_id": 8562, "author_profile": "https://...
2008/10/16
[ "https://Stackoverflow.com/questions/209133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21679/" ]
209,135
<p>When working on some code, I add extra debug logging of some kind to make it easier for me to trace the state and values that I care about for this particular fix.</p> <p>But if I would check this in into the source code repository, my colleagues would get angry on me for polluting the Log output and polluting the code.</p> <p>So how do I locally keep these lines of code that are important to me, without checking them in?</p> <p><strong>Clarification:</strong> Many answers related to the log output, and that you with log levels can filter that out. And I agree with that.</p> <p>But. I also mentioned the problem of polluting the actual code. If someone puts a log statement between every other line of code, to print the value of all variables all the time. It really makes the code hard to read. So I would really like to avoid that as well. Basically by not checking in the logging code at all. So the question is: how to keep your own special purpose log lines. So you can use them for your debug builds, without cluttering up the checked in code.</p>
[ { "answer_id": 209179, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 2, "selected": false, "text": "#if DEBUG\n logger.debug(\"stuff I care about\");\n#endif\n" }, { "answer_id": 209324, "author": "use...
2008/10/16
[ "https://Stackoverflow.com/questions/209135", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28625/" ]
209,138
<p>I need to make a mouseover menu that opens diagonally (from top-left to bottom-right). </p>
[ { "answer_id": 212069, "author": "Pier Luigi", "author_id": 27789, "author_profile": "https://Stackoverflow.com/users/27789", "pm_score": 1, "selected": false, "text": "$('#mymenu').animate({width: '80px', height: '200px'})\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
209,145
<p>When setting the export path in Unix, example:</p> <pre><code>export PATH=$PATH: $EC2_HOME/bin </code></pre> <p>If I quit terminal and open it back up to continue working, I have to go through all the steps again, setting up the paths each time. I'm wondering how I can set the path and have it "stick" so my system knows where to find everything the next time I open terminal without having to do it all over again. Thanks!</p>
[ { "answer_id": 209165, "author": "Mo.", "author_id": 1870, "author_profile": "https://Stackoverflow.com/users/1870", "pm_score": 1, "selected": false, "text": ".bashrc" }, { "answer_id": 209166, "author": "JSBձոգչ", "author_id": 8078, "author_profile": "https://Stacko...
2008/10/16
[ "https://Stackoverflow.com/questions/209145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2293/" ]
209,148
<p>What on earth is a caret in the context of a CSplitterWnd class? I can't find any documentation relating explicitly to CSplitterWnds...</p> <p>EDIT: Specifically, what do these functions <em>actually</em> do:</p> <pre><code>CWnd * pCurView = m_wndSplitter2.GetPane(2, 0); pCurView-&gt;ShowCaret() pCurView-&gt;HideCaret() </code></pre> <p>EDIT2: Please note, I know what a caret is, I am specifically asking about the functions within the context of the CSlitterWnd Class. I have seen the MSDN documentation and it offers no real explaination.</p>
[ { "answer_id": 209321, "author": "SmacL", "author_id": 22564, "author_profile": "https://Stackoverflow.com/users/22564", "pm_score": 1, "selected": false, "text": "CWnd * pCurView = m_wndSplitter2.GetPane(2, 0);\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18664/" ]
209,160
<p>I want to do something like this :</p> <pre><code>myYear = record.GetValueOrNull&lt;int?&gt;("myYear"), </code></pre> <p>Notice the nullable type as the generic parameter. </p> <p>Since the <code>GetValueOrNull</code> function could return null my first attempt was this: </p> <pre><code>public static T GetValueOrNull&lt;T&gt;(this DbDataRecord reader, string columnName) where T : class { object columnValue = reader[columnName]; if (!(columnValue is DBNull)) { return (T)columnValue; } return null; } </code></pre> <p>But the error I'm getting now is:</p> <blockquote> <p>The type 'int?' must be a reference type in order to use it as parameter 'T' in the generic type or method</p> </blockquote> <p>Right! <code>Nullable&lt;int&gt;</code> is a <code>struct</code>! So I tried changing the class constraint to a <code>struct</code> constraint (and as a side effect can't return <code>null</code> any more):</p> <pre><code>public static T GetValueOrNull&lt;T&gt;(this DbDataRecord reader, string columnName) where T : struct </code></pre> <p>Now the assignment:</p> <pre><code>myYear = record.GetValueOrNull&lt;int?&gt;("myYear"); </code></pre> <p>Gives the following error:</p> <blockquote> <p>The type 'int?' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method</p> </blockquote> <p>Is specifying a nullable type as a generic parameter at all possible?</p>
[ { "answer_id": 209219, "author": "Greg Dean", "author_id": 1200558, "author_profile": "https://Stackoverflow.com/users/1200558", "pm_score": 9, "selected": true, "text": "Nullable<T>" }, { "answer_id": 210681, "author": "Robert C. Barth", "author_id": 9209, "author_pr...
2008/10/16
[ "https://Stackoverflow.com/questions/209160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25145/" ]
209,192
<p>I would like to match the time (10.00) from a string with the date and time ("21.01.08 10.00"). I'm using the following regular expression:</p> <pre><code>new RegExp("\\b[0-9]{1,2}\\.[0-9]{1,2}\\b" "g"); </code></pre> <p>But this matches 21.01 from 21.01.08 and 10.00.</p> <p>I'm using PCRE as my regualar expression engine. </p> <p>Update:</p> <p>I'm sorry, i should have more been more clear. The data and time are part of a larger string. I want to extract the time from that string.</p> <p>For example:</p> <p>"On 21.01.08 from 10.00 a party will take place in the library" "21.08.08 - At 10:00 there will be a party" "On 21.08.08 you are scheduled for a ... . The ... will begin at 10.00"</p> <p>Is this possible?</p>
[ { "answer_id": 209231, "author": "Pat", "author_id": 238, "author_profile": "https://Stackoverflow.com/users/238", "pm_score": 0, "selected": false, "text": "new RegExp(\"\\\\b[0-9]{1,2}\\\\.[0-9]{1,2}$\" \"g\");\n" }, { "answer_id": 209243, "author": "theraccoonbear", "a...
2008/10/16
[ "https://Stackoverflow.com/questions/209192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/948/" ]
209,193
<p>I am creating a left navigation system utilizing xml and xsl. Everything was been going great until I tried to use a special character in my xml document. I am using <code>&amp;raquo;</code> and I get th error.</p> <blockquote> <p>reason: Reference to undefined entity 'raquo'.<br> error code: -1072898046</p> </blockquote> <p>How do I make this work?</p>
[ { "answer_id": 209272, "author": "Pat", "author_id": 238, "author_profile": "https://Stackoverflow.com/users/238", "pm_score": 3, "selected": false, "text": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n" }, { ...
2008/10/16
[ "https://Stackoverflow.com/questions/209193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27516/" ]
209,198
<p>I am using Borland Turbo C++ with some inlined assembler code, so presumably Turbo Assembler (TASM) style assembly code. I wish to do the following:</p> <pre><code>void foo::bar( void ) { __asm { mov eax, SomeLabel // ... } // ... SomeLabel: // ... } </code></pre> <p>So the address of SomeLabel is placed into EAX. This doesn't work and the compiler complains of: Undefined symbol 'SomeLabel'.</p> <p>In Microsoft Assembler (MASM) the dollar symbol ($) serves as the current location counter, which would be useful for my purpose. But again this does not seem to work in Borlands Assember (expression syntax error).</p> <p>Update: To be a little more specific, I need the compiler to generate the address it moves into eax as a constant during compilation/linking and not at run time, so it will compile like "mov eax, 0x00401234".</p> <p>Can anybody suggest how to get this working?</p> <p>UPDATE: To respond to Pax's question (see comment), If the base address is changed at run time by the Windows loader the DLL/EXE PE image will still be relocated by the Windows loader and the labels address will be patched at run time by the loader to use the re-based address so using a compile/link time value for the label address is not an issue.</p> <p>Many thanks in advance.</p>
[ { "answer_id": 209359, "author": "Sean", "author_id": 4919, "author_profile": "https://Stackoverflow.com/users/4919", "pm_score": 0, "selected": false, "text": "int result=0;\n\n__asm__ {\n mov result, 1\n}\n\nswitch (result){\n case 1: printf(\"You wanted case 1 to happen in your...
2008/10/16
[ "https://Stackoverflow.com/questions/209198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14260/" ]
209,199
<p>The <a href="http://msdn.microsoft.com/en-us/library/bb384061.aspx" rel="noreferrer">var</a> keyword does away with the need for an explicit type declaration and I have read with interest the <a href="https://stackoverflow.com/questions/41479/use-of-var-keyword-in-c">SO discussion</a> of when it might be appropriate.</p> <p>I have also read about (but not used) <a href="https://github.com/boo-lang/boo" rel="noreferrer">Boo</a> which seems to take things a step further by making it <a href="https://github.com/boo-lang/boo/wiki/Type-Inference" rel="noreferrer">optional to declare a local variable</a>. With Boo, both the type and the declaration can be implied.</p> <p>Which leads me to wonder, why did the C# language designers bother to include a var keyword at all? </p> <p><strong>Update</strong>: Yes, var supports Anonymous types, but anonymous types by themselves do not necessitate the var keyword...</p> <pre><code>var anon = new { Name = "Terry", Age = 34 }; </code></pre> <p>versus</p> <pre><code>anon = new { Name = "Terry", Age = 34 }; </code></pre>
[ { "answer_id": 209225, "author": "Ferruccio", "author_id": 4086, "author_profile": "https://Stackoverflow.com/users/4086", "pm_score": 6, "selected": false, "text": "name = \"fred\";\n ...\nName = \"barney\"; // whoops! we meant to reuse name\n" }, { "answer_id": 209239, "a...
2008/10/16
[ "https://Stackoverflow.com/questions/209199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4200/" ]
209,224
<p>I have to consume 2 different web services. Both contain a definition for a 'user' object. </p> <p>When I reference the services using "Add service reference" I give each service a unique namespace:</p> <pre><code>com.xyz.appname.ui.usbo.UserManagement com.xyz.appname.ui.usbo.AgencyManagement </code></pre> <p>The problem I have is that each one of the proxies that are generated contain a new user class. One is located at com.xyz.appname.ui.usbo.UserManagement.user and the other at com.xyz.appname.ui.usbo.AgencyManagement.user. However, the user objects are identical and I would like to treat them as such.</p> <p>Is there a way that I can somehow reference the user object as one object instead of treating them as two different?</p> <p>I am using .Net 3.5 to consume the service. The service being consumed is written in Java.</p> <p>Thanks!!</p> <p>Edit:</p> <p><a href="http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/8c55f517-72c0-4add-8f9d-264acd334e83/" rel="noreferrer" title="This forum thread">This forum thread</a> got very close to an answer, but the accepted answer ended up being to share types from client and server - which I cannot do because we're crossing platforms (Java to .Net). The real question is, is there a /sharetypes type of parameter for svcutil in WCF?</p>
[ { "answer_id": 209277, "author": "leppie", "author_id": 15541, "author_profile": "https://Stackoverflow.com/users/15541", "pm_score": 2, "selected": false, "text": "/sharetypes\n Turns on type sharing feature. This feature creates one code file with\n a single type definition for i...
2008/10/16
[ "https://Stackoverflow.com/questions/209224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10589/" ]
209,237
<p>I know I should be using htmlentities for all my form text input fields but this doesn't work:</p> <pre><code>&lt;?php echo "&lt;tr&gt; &lt;td align=\"right\"&gt;".Telephone." :&lt;/td&gt; &lt;td&gt;&lt;input type=\"text\" name=\"telephone\" size=\"27\" value=\"htmlentities($row[telephone])\"&gt; Inc. dialing codes &lt;/td&gt; &lt;/tr&gt;"; ?&gt; </code></pre> <p>It simply shows the input value as "htmlentities(0123456789)" in the form? What have I done wrong please?</p>
[ { "answer_id": 209246, "author": "workmad3", "author_id": 16035, "author_profile": "https://Stackoverflow.com/users/16035", "pm_score": 3, "selected": false, "text": "value=\\\"\" . htmlentities($row[telephone]) . \"\\\"\n" }, { "answer_id": 209248, "author": "Quentin", "...
2008/10/16
[ "https://Stackoverflow.com/questions/209237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
209,254
<p>I'm writing a web application that decodes Morse Code that is tapped in using mouse button.</p> <p>I originally did a proof of concept using conventional JavaScript, but now I'm redoing it using jQuery.</p> <p>Is there a clever way with jQuery to tell if a button has been pressed again within so many milliseconds, or not - and run some jQuery code if the button was NOT pressed again.</p> <p>I've been going over the jQuery API and I'm not seeing a clever way of doing this....</p> <p>Any ideas...</p> <p>Derek</p>
[ { "answer_id": 209358, "author": "Pseudo Masochist", "author_id": 8529, "author_profile": "https://Stackoverflow.com/users/8529", "pm_score": 1, "selected": false, "text": "setTimeout()" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5440/" ]
209,255
<p>I've got a unidirectional tree of objects, in which each objects points to its parent. Given an object, I need to obtain its entire subtree of descendants, as a collection of objects. The objects are not actually in any data structure, but I can easily get a collection of all the objects.</p> <p>The naive approach is to examine each object in the batch, see if the given object is an ancestor, and keep it aside. This would not be too efficient... It carries an overhead of O(N*N), where N is the number of objects.</p> <p>Another approach is the recursive one, meaning search for the object's direct children and repeat the process for the next level. Unfortunately the tree is unidirectional... there's no direct approach to the children, and this would be only slightly less costly than the previous approach.</p> <p>My question: Is there an efficient algorithm I'm overlooking here?</p> <p>Thanks,</p> <p>Yuval =8-)</p>
[ { "answer_id": 209450, "author": "matt b", "author_id": 4249, "author_profile": "https://Stackoverflow.com/users/4249", "pm_score": 3, "selected": true, "text": "public static Set<Node> findDescendants(List<Node> allNodes, Node thisNode) {\n\n // keep a map of Nodes to a List of that ...
2008/10/16
[ "https://Stackoverflow.com/questions/209255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2819/" ]
209,257
<p>I getting the following error when I try to connect to my server app using remoting:</p> <blockquote> <p><em>A problem seems to have occured whilst connecting to the remote server:<br> Server encountered an internal error. For more information, turn off customErrors in the server's .config file.</em></p> </blockquote> <p>This is the code on my server app:</p> <pre><code>TcpChannel tcpChannel = new TcpChannel(999); MyRemoteObject remObj = new MyRemoteObject (this); RemotingServices.Marshal(remObj, "MyUri"); ChannelServices.RegisterChannel(tcpChannel); </code></pre> <p>It seems to work the first time, but unless the server app is restarted the error occurs.</p> <p>I would guess something isn't being cleaned up properly but I'm not sure what as the customError is still on.</p> <p>Any ideas where I start. Thanks.</p> <p>[EDIT] - Thanks to Gulzar, I modified my code above to the following and now the errors are shown:</p> <pre><code>RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.Off; TcpChannel tcpChannel = new TcpChannel(999); MyRemoteObject remObj = new MyRemoteObject (this); RemotingServices.Marshal(remObj, "MyUri"); ChannelServices.RegisterChannel(tcpChannel); </code></pre>
[ { "answer_id": 209278, "author": "Gulzar Nazim", "author_id": 4337, "author_profile": "https://Stackoverflow.com/users/4337", "pm_score": 6, "selected": true, "text": "<ServerEXE>.config" }, { "answer_id": 209293, "author": "DOK", "author_id": 27637, "author_profile":...
2008/10/16
[ "https://Stackoverflow.com/questions/209257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11989/" ]
209,258
<p>I am trying to use a third party DLL that wants an int** as one of the parameters to the method. It describes the parameter as the address of the pointer that will point to the memory allocation.</p> <p>Sorry for any confusion. The parameter is two-way I think. The DLL is for talking to an FPGA board and the method is setting up DMA transfer between the host PC and the PCI board.</p>
[ { "answer_id": 209267, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 4, "selected": true, "text": "System.IntPtr" }, { "answer_id": 209270, "author": "leppie", "author_id": 15541, "author_profile": "h...
2008/10/16
[ "https://Stackoverflow.com/questions/209258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1629/" ]
209,281
<p>I am aware that you can lock an object in c# using lock but can you give up the lock and wait for something else to notify you that it's changed like you can in java with wait and notify?</p> <p>It seems to me that synchronised and lock in java and c# respectively are synonomous.</p>
[ { "answer_id": 209319, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 8, "selected": true, "text": "foo.notify() => Monitor.Pulse(foo)\nfoo.notifyAll() => Monitor.PulseAll(foo)\nfoo.wait() => Monitor.Wait(foo)\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20400/" ]
209,301
<p>How do I post a form from an HTML page to and ASPX page (2.0) and be able to read the values?</p> <p>I currently have an ASP.NET site using the Membership provider and everything is working fine. Users can log in from the Login.aspx page.</p> <p>We now want to be able to have users log in directly from another web site--which is basically a static HTML page. The users need to be able to enter their name and password on this HTML page and have it POST to my Login.aspx page (where I can then log them in manually).</p> <p>Is it possible to pass form values from HTML to ASPX? I have tried everything and the Request.Form.Keys collection is always empty. I can't use a HTTP GET as these are credentials and can't be passed on a query string.</p> <p>The only way I know of is an iframe.</p>
[ { "answer_id": 209455, "author": "Pseudo Masochist", "author_id": 8529, "author_profile": "https://Stackoverflow.com/users/8529", "pm_score": 5, "selected": false, "text": "<form id=\"form1\" runat=\"server\">\n <div>\n <asp:TextBox ID=\"TextBox1\" runat=\"server\"></asp:TextBo...
2008/10/16
[ "https://Stackoverflow.com/questions/209301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
209,305
<p>I'm writing a C/C++ application under Linux that reads data from a raw socket (for ICMP packets). Question: is there a way to discard all data that is still queued on the socket?</p> <p>The problem is that after sleeping for a while, there is data queued up on the socket which I'm not interested in; so it would be best to just tell the socket "forget all data you have buffered right now", so that if I go into a select()/recvfrom() loop then, I only get data that was received recently.</p> <p>Is there a better way than going into a separate poll()/recvfrom() loop first? Some socket API call maybe? Portable, even? :-)</p>
[ { "answer_id": 219923, "author": "Tim Howland", "author_id": 4276, "author_profile": "https://Stackoverflow.com/users/4276", "pm_score": 0, "selected": false, "text": "for(n=0;n<=MAX_BUFFER_SIZE;n++)\n{\nrecv_buffer[n] = 0;\n}\n" }, { "answer_id": 219946, "author": "Adam Rose...
2008/10/16
[ "https://Stackoverflow.com/questions/209305", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2148773/" ]
209,320
<p>I have an activex object I loaded into an html page. I then use that activex object to create another object, but I need to register an event with the new object created. The object is expecting an event listener of a certain type.</p> <p>I can load this same dll in c# and it will work fine. Code looks like this for c#.</p> <pre><code>upload = obj.constructUploadObj(uploadConfig); upload.stateChanged += new UploadActionEvents_stateChangedEventHandler(upload_stateChanged); </code></pre> <p>In javascript I have similar code however I cannot get the event registered with the object.</p> <pre><code>uploadAction = obj.constructUploadObj(uploadConfig); uploadAction.stateChanged = upload_stateChanged; function upload_stateChanged(sender){ writeLine("uploadState changed " + sender.getState()); } </code></pre> <p>I have enumerated some of the properties of the uploadAction object in javascript to ensure that it is actually created. When I try and register the event with uploadAction it throws an error saying "Object doesn't support this property or method."</p> <p>To me it seems like its expecting a strongly typed event. Is there anyway to register the event similar to that of C# in javascript?</p> <p>Thanks In Advance.</p>
[ { "answer_id": 219923, "author": "Tim Howland", "author_id": 4276, "author_profile": "https://Stackoverflow.com/users/4276", "pm_score": 0, "selected": false, "text": "for(n=0;n<=MAX_BUFFER_SIZE;n++)\n{\nrecv_buffer[n] = 0;\n}\n" }, { "answer_id": 219946, "author": "Adam Rose...
2008/10/16
[ "https://Stackoverflow.com/questions/209320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21664/" ]
209,327
<p>How should I format URLs with special/international characters?</p> <p>Currently I try to make URLs "look good", so that: </p> <pre><code>www.myhost.com/this is a test, do you know how? </code></pre> <p>is converted to: </p> <pre><code>www.myhost.com/this_is_a_test_do_you_know_how </code></pre> <p>I know some international letters could be converted (ü = ue, æ = ae, å = aa), some characters could be removed. I general I try to make the URL look "good", but is that stupid? </p> <p>But what do I do with chinese, japanese, arabian letters that has nothing to do with our western ASCII format? </p> <p>I really don't like the idea of rewriting the URL with hex codes, so right now I just use my internal unique ID if the url contains too many "non convertable" characters.</p>
[ { "answer_id": 209776, "author": "balexandre", "author_id": 28004, "author_profile": "https://Stackoverflow.com/users/28004", "pm_score": 0, "selected": false, "text": "Server.URLEncode( myURL );\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
209,335
<p>I have a chart in a Worksheet in Excel and I have a macro set up so that when I change the value in a certain cell the range of data in the chart is set to <code>A2</code> down as far as the row number corresponding in this certain cell.</p> <p>What I can't seem to be able to do is to modify the axis as the specified axis no longer covers the range of the graph i.e. the current X axis is set to:</p> <pre><code>=Sheet1!$C$2:$C$600 </code></pre> <p>I can't figure out how I can update this in a macro. Any help would be much appreciated.</p>
[ { "answer_id": 209486, "author": "Dave DuPlantis", "author_id": 8174, "author_profile": "https://Stackoverflow.com/users/8174", "pm_score": 4, "selected": true, "text": "Charts(\"chartname\").SeriesCollection(1).XValues = \"=MYXAXIS\"\n" }, { "answer_id": 260933, "author": "C...
2008/10/16
[ "https://Stackoverflow.com/questions/209335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4014/" ]
209,354
<p>I am currently developing an approval routing WCF service that will allow an user to create "rules" which determine how an request is routed. The route is determined by comparing the "ObjectToEvaluate" property of the Request class against the "ObjectToEvaluate" property of the "Rule" class. The "UnitOfMeasurement" enum determines how to cast the "ObjectToEvaluate" property for each class. </p> <pre><code>public enum UnitOfMeasurement { Currency = 1, Numeric = 2, Special = 3, Text = 4, } public class Request { public object ObjectToEvaluate { get; set; } } public class Rule { public object ObjectToEvaluate { get; set; } public virtual void ExecuteRule() { //logic to see if it passes the rule condition } } </code></pre> <p>What would be the best way to implement the method to cast the "ObjectToEvaluate" property using the "UnitOfMeasurement" enum?</p>
[ { "answer_id": 209442, "author": "JSBձոգչ", "author_id": 8078, "author_profile": "https://Stackoverflow.com/users/8078", "pm_score": 4, "selected": true, "text": "public class CastableObject {\n\n private UnitOfMeasurement eUnit; // Assign this somehow\n\n public static implicit op...
2008/10/16
[ "https://Stackoverflow.com/questions/209354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
209,366
<p>Is there any way to take a Class and determine if it represents a primitive type (is there a solution that doesn't require specifically enumerating all the primitive types)?</p> <p>NOTE: I've seen <a href="https://stackoverflow.com/questions/180097/dynamically-find-the-class-that-represents-a-primitive-java-type">this question</a>. I'm asking basically the opposite. I have the Class, I want to know if it's a primitive.</p>
[ { "answer_id": 10195276, "author": "kentcdodds", "author_id": 971592, "author_profile": "https://Stackoverflow.com/users/971592", "pm_score": 2, "selected": false, "text": "/**\n* Checks first whether it is primitive and then whether it's wrapper is a primitive wrapper. Returns true\n* i...
2008/10/16
[ "https://Stackoverflow.com/questions/209366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16430/" ]
209,376
<p>Is it possible to use SQL Server 2008 CROSS APPLY with LINQ-2-SQL? </p> <p>Example SQL:</p> <pre><code>select d.dateCol, tvf.descr, tvf.value from dateTable d cross apply tvFunction(d.dt, 'anotherParam') tvf where d.category='someCat' </code></pre> <p>CROSS APPLY enables using values from a table (dateTable in the example) as parameters to a tablevalue function. This is very usefull if you need do do a complex calculation (encapsulated in a table value function) for a range of inputs.</p>
[ { "answer_id": 5579182, "author": "Djordje", "author_id": 1272040, "author_profile": "https://Stackoverflow.com/users/1272040", "pm_score": 2, "selected": false, "text": "from d in dateTable\nfrom tvf in tvFunction(d.dt, 'anotherProgram')\nwhere d.category = 'someCat'\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/224/" ]
209,383
<p>I have a stored procedure that returns 80 columns, and 300 rows. I want to write a select that gets 2 of those columns. Something like </p> <pre><code>SELECT col1, col2 FROM EXEC MyStoredProc 'param1', 'param2' </code></pre> <p>When I used the above syntax I get the error: </p> <blockquote> <p>"Invalid Column Name".</p> </blockquote> <p>I know the easiest solution would be to change the stored procedure, but I didn't write it, and I can't change it. </p> <p>Is there any way to do what I want?</p> <ul> <li><p>I could make a temp table to put the results in, but because there are 80 columns so I would need to make an 80 column temp table just to get 2 columns. I wanted to avoid tracking down all the columns that are returned.</p></li> <li><p>I tried using <code>WITH SprocResults AS ....</code> as suggested by Mark, but I got 2 errors <BR></p> <blockquote> <p>Incorrect syntax near the keyword 'EXEC'.<BR>Incorrect syntax near ')'.</p> </blockquote></li> <li><p>I tried declaring a table variable and I got the following error <br></p> <blockquote> <p>Insert Error: Column name or number of supplied values does not match table definition</p> </blockquote></li> <li><p>If I try <BR> <code>SELECT * FROM EXEC MyStoredProc 'param1', 'param2'</code><br> I get the error :<br></p> <blockquote> <p>Incorrect syntax near the keyword 'exec'.</p> </blockquote></li> </ul>
[ { "answer_id": 209390, "author": "Gulzar Nazim", "author_id": 4337, "author_profile": "https://Stackoverflow.com/users/4337", "pm_score": 8, "selected": false, "text": "Declare @tablevar table(col1 col1Type,..\ninsert into @tablevar(col1,..) exec MyStoredProc 'param1', 'param2'\n\nSELECT...
2008/10/16
[ "https://Stackoverflow.com/questions/209383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28281/" ]
209,389
<p>If I have a string (010) and i want to add 1 to it (011) what value type should i use to convert this string into a number for adding and at the same time preserve the whole number and not 10 + 1 = 11. </p>
[ { "answer_id": 209392, "author": "Omer van Kloeten", "author_id": 4979, "author_profile": "https://Stackoverflow.com/users/4979", "pm_score": 3, "selected": false, "text": "if (int.TryParse(str, out i))\n str = (i + 1).ToString(\"000\");\n" }, { "answer_id": 209395, "autho...
2008/10/16
[ "https://Stackoverflow.com/questions/209389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28647/" ]
209,403
<p>i know this doesnt work but i dont know why, also how can i make it work?</p> <pre><code> &lt;% int result = referer.indexOf("smlMoverDetail.do"); %&gt; &lt;% if (result == -1){%&gt; &lt;%out.print("checking");%&gt; &lt;bean:define id="JOININGDATE" name="smlMoverDetailForm" property="empFDJoiningDate" type="java.lang.String" toScope="session"/&gt; &lt;%}%&gt; </code></pre> <p>Please please help i dont understand</p> <p>i have tried this</p> <pre><code>&lt;logic:Equal name="result" value = "-1"&gt; &lt;bean:define id="JOININGDATE" name="smlMoverDetailForm" property="empFDJoiningDate" type="java.lang.String" toScope="session"/&gt; &lt;/logic:Equal&gt; </code></pre> <p>but that doenst work either it doesnt exicute the bean:define part</p> <p>help thansk</p>
[ { "answer_id": 212272, "author": "Shivasubramanian A", "author_id": 9195, "author_profile": "https://Stackoverflow.com/users/9195", "pm_score": 1, "selected": false, "text": "<logic:Equal name=\"result\" value = \"-1\">\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
209,407
<p>I am developing a specialty application where the end-user needs to operate multiple controls simultaneously. The application is used to "tune" the control parameters of an electronic device to calibrate the unit to its best performance.</p> <p>Currently, there is a UI with multiple graphical sliders which the operator click-drags one slider at a time. He can also click on a slider, and use the mouse-scroll wheel, which is a little easier to use.</p> <p>This works, sort of, but is somewhat cumbersome. The various parameters (5 in this particular case) are sufficiently independent of each other so that I can't just refactor the parameters into a single adjustment. And, if the operator can keep his eye on the device being adjusted, rather than the UI of the control application, it would speed up and simplify his work.</p> <p>One idea that I had was that I might buy a whole bunch of the USB jog-dial products, and bind each dial to a specific control. This way, the operator can quickly adjust any parameter, or even two parameters simultaneously. (BTW, Griffin PowerMate comes to immediate mind, but I know there are a few other jog dials out there.)</p> <p>Do you have any suggestions?</p> <p>ADDED:</p> <p>Keep in mind that in some cases, the parameters are adjusted in different directions, and may be significantly different in the adjustment steps. It's not a simple "track two channels together, and then fine tune the last bit of difference".</p>
[ { "answer_id": 209424, "author": "theraccoonbear", "author_id": 7210, "author_profile": "https://Stackoverflow.com/users/7210", "pm_score": 3, "selected": true, "text": "A/Z are the up/down keys for slider 1\nS/X are the up/down keys for slider 2\nD/C are the up/down keys for slider 3\nF...
2008/10/16
[ "https://Stackoverflow.com/questions/209407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22329/" ]
209,415
<p>Some text before the code so that the question summary isn't mangled.</p> <pre><code>class Tree { public event EventHandler MadeSound; public void Fall() { MadeSound(this, new EventArgs()); } static void Main(string[] args) { Tree oaky = new Tree(); oaky.Fall(); } } </code></pre> <p>I haven't used events much in C#, but the fact that this would cause a NullRefEx seems weird. The EventHandler reference is considered null because it currently has no subsribers - but that doesn't mean that the event hasn't occurred, does it?</p> <p>EventHandlers are differentiated from standard delegates by the <strong>event</strong> keyword. Why didn't the language designers set them up to fire silently in to the void when they have no subscribers? (I gather you can do this manually by explicitly adding an empty delegate).</p>
[ { "answer_id": 209437, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 3, "selected": false, "text": "void OnMadeSound()\n{\n if (MadeSound != null)\n {\n MadeSound(this, new EventArgs());\n }\n}\n\npubl...
2008/10/16
[ "https://Stackoverflow.com/questions/209415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82/" ]
209,416
<p>I have a WPF ListView which currently scrolls everytime I click on an item which is only partially visible. How can I keep the control from scrolling that item into view (instead simply selecting the partially visible one)? This behavior is very annoying when doing a drag from this control. </p> <p>Thanks.</p> <p>Added: I am looking for a solution to keep the control itself from scrolling when contents are clicked that the control believes are not fully visible. Often this is by a few pixels and the scroll is not necessary.</p>
[ { "answer_id": 218476, "author": "David Schmitt", "author_id": 4918, "author_profile": "https://Stackoverflow.com/users/4918", "pm_score": 1, "selected": false, "text": "ListView" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26152/" ]
209,418
<p>My main JavaScript framework is <a href="http://jquery.com/" rel="nofollow noreferrer">jQuery</a>, so I would like my unit test and mocking frameworks to be compatible with that. I'd rather not have to introduce another JavaScript framework.</p> <p>I am currently using <a href="http://docs.jquery.com/QUnit" rel="nofollow noreferrer">QUnit</a> for unit testing and <a href="https://github.com/keronsen/jack" rel="nofollow noreferrer">Jack</a> for mocking, but I am pretty new to the whole unit testing of JavaScript.</p> <p>Is there a better tool to suggest? What has worked for you?</p>
[ { "answer_id": 209673, "author": "Chris MacDonald", "author_id": 18146, "author_profile": "https://Stackoverflow.com/users/18146", "pm_score": 0, "selected": false, "text": "setup()" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4481/" ]
209,428
<p>HTML (or maybe just XHTML?) is relatively strict when it comes to non-standard attributes on tags. If they aren't part of the spec, then your code is considered non-compliant.</p> <p>Non-standard attributes can be fairly useful for passing along meta-data to Javascript however. For instance, if a link is suppose to show a popup, you can set the name of the popup in an attribute:</p> <pre><code>&lt;a href="#null" class="popup" title="See the Popup!" popup_title="Title for My Popup"&gt;click me&lt;/a&gt; </code></pre> <p>Alternatively, you can store the title for the popup in a hidden element, like a span:</p> <pre><code>&lt;style&gt; .popup .title { display: none; } &lt;/style&gt; &lt;a href="#null" title="See the Popup!" class="popup"&gt; click me &lt;span class="title"&gt;Title for My Popup&lt;/span&gt; &lt;/a&gt; </code></pre> <p>I am torn however as to which should be a preferred method. The first method is more concise and, I'm guessing, doesn't screw with search engines and screen readers as much. Conversely, the second option makes storing large amounts of data easier and is thus, more versatile. It is also standards compliant.</p> <p>I am curious what this communities thoughts are. How do you handle a situation like this? Does the simplicity of the first method outweigh the potential downsides (if there are any)?</p>
[ { "answer_id": 209432, "author": "eyelidlessness", "author_id": 17964, "author_profile": "https://Stackoverflow.com/users/17964", "pm_score": 7, "selected": true, "text": "data-" }, { "answer_id": 881334, "author": "ibz", "author_id": 5475, "author_profile": "https://...
2008/10/16
[ "https://Stackoverflow.com/questions/209428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10093/" ]
209,429
<p>I have installed CherryPy 3.1.0,. Here is what happens when I try to run tutorial 9:</p> <pre><code>$ cd /Library/Python/2.5/site-packages/cherrypy/tutorial/ $ python tut09_files.py Traceback (most recent call last): File "tut09_files.py", line 48, in &lt;module&gt; from cherrypy.lib import static ImportError: cannot import name static </code></pre> <p>The previous line in the file:</p> <pre><code>import cherrypy </code></pre> <p>passes without error, so it appears that it can find cherrypy on the path. What am I missing?</p>
[ { "answer_id": 209432, "author": "eyelidlessness", "author_id": 17964, "author_profile": "https://Stackoverflow.com/users/17964", "pm_score": 7, "selected": true, "text": "data-" }, { "answer_id": 881334, "author": "ibz", "author_id": 5475, "author_profile": "https://...
2008/10/16
[ "https://Stackoverflow.com/questions/209429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/173/" ]
209,458
<p>How do you concatenate bits in VHDL? I'm trying to use the following code:</p> <p>Case b0 &amp; b1 &amp; b2 &amp; b3 is ...</p> <p>and it throws an error</p> <p>Thanks</p>
[ { "answer_id": 209504, "author": "user21246", "author_id": 21246, "author_profile": "https://Stackoverflow.com/users/21246", "pm_score": 4, "selected": false, "text": "architecture EXAMPLE of CONCATENATION is\n signal Z_BUS : bit_vector (3 downto 0);\n signal A_BIT, B_BIT, C_BIT, D_B...
2008/10/16
[ "https://Stackoverflow.com/questions/209458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21539/" ]
209,465
<p>I could use some help trying to track down an intermittent error that I've been having with our ASP.Net project for quite some time.</p> <p>Intermittently when building the solution, the build will fail with the error "/: Build (web): Object reference not set to an instance of an object." The error has no associated file, line, column or project information. The weird thing about the error is that it will go away on successive rebuilds and doesn't seem to result in any run-time errors that we've come across once the build is successful. Sometimes the error will pop only once, sometimes 3-4 times, but eventually the build will finish successfully and then seems to build just fine each time after. I haven't been able to nail down a pattern as to why and when the error will happen, and since it always eventually builds it hasn't been a critical problem for us. Just an annoyance. But one that I want gone for obvious reasons.</p> <p>I guess I should add that this is an application that was originally developed in ASP.net 1.1 and converted to 2.0 and I inherited it somewhere down the line after that, so I don't know when the problem originally surfaced. As far as everyone here is concerned, it's always been there.</p> <p>Obviously I'm not expecting someone to pick out the cause of my problem as that would require them to look at our entire solution to pick out potential problems. Just hoping someone can give me a couple fresh ideas as to how to go about tracking down the actual source of the error in code. It has to be coming from somewhere, right? How would you go about finding out where?</p>
[ { "answer_id": 4896338, "author": "bcolin", "author_id": 587536, "author_profile": "https://Stackoverflow.com/users/587536", "pm_score": 2, "selected": false, "text": "<buildProviders>\n <add extension=\".rdlc\" type=\"Microsoft.Reporting.RdlBuildProvider, Microsoft.ReportViewer.Commo...
2008/10/16
[ "https://Stackoverflow.com/questions/209465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
209,470
<p>I currently do my textfile manipulation through a bunch of badly remembered AWK, sed, Bash and a tiny bit of Perl.</p> <p>I've seen mentioned a few places that python is good for this kind of thing. How can I use Python to replace shell scripting, AWK, sed and friends?</p>
[ { "answer_id": 209562, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 8, "selected": true, "text": "shutil" }, { "answer_id": 209565, "author": "Davide", "author_id": 25891, "author_profile": "https://Sta...
2008/10/16
[ "https://Stackoverflow.com/questions/209470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27074/" ]
209,478
<p>Hopefully I haven't misunderstood the meaning of "duck typing", but from what I've read, it means that I should write code based on how an object responds to methods rather than what type/class it is.</p> <p>Here's the code:</p> <pre><code>def convert_hash(hash) if hash.keys.all? { |k| k.is_a?(Integer) } return hash elsif hash.keys.all? { |k| k.is_a?(Property) } new_hash = {} hash.each_pair {|k,v| new_hash[k.id] = v} return new_hash else raise "Custom attribute keys should be ID's or Property objects" end end </code></pre> <p>What I want is to make sure that I end up with a hash where the keys are an integer representing the ID of an ActiveRecord object. I don't particularly enjoy having to iterate through the hash keys twice with <code>all?</code> to determine if I need to grab the ID's out.</p> <p>Of course, I'll accept any other suggestions to improve this code as well :)</p>
[ { "answer_id": 209532, "author": "Eli Courtwright", "author_id": 1694, "author_profile": "https://Stackoverflow.com/users/1694", "pm_score": 5, "selected": true, "text": "def convert(hash)\n new_hash = {}\n hash.each_pair { |k,v| new_hash[ k.is_a?(Integer) ? k : k.id ] = v }\n r...
2008/10/16
[ "https://Stackoverflow.com/questions/209478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24848/" ]
209,491
<p>I have a form using multiple <code>&lt;cfinput type="datefield" ...&gt;</code>. They are positioned in such a way that the pop-up CSS calendar should appear over the field for others. However, the text fields for the other dates end up in front of the calendar.</p> <p>This is only an IE issue as Firefox and Safari work just fine.</p> <p>Is there a simple CSS hack or some other simple thing I can do to get the calendar to act as it should? Re-arranging the form is not very helpful.</p>
[ { "answer_id": 209696, "author": "Ben Doom", "author_id": 12267, "author_profile": "https://Stackoverflow.com/users/12267", "pm_score": 0, "selected": false, "text": "<cfinput type=\"datefiled\" name=\"bob\" value=\"\" style=\"z-index: -1;\">\n" }, { "answer_id": 556879, "aut...
2008/10/16
[ "https://Stackoverflow.com/questions/209491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21960/" ]
209,495
<p>I am looking for a concise way to check a value to see if it is nil or zero. Currently I am doing something like:</p> <pre><code>if (!val || val == 0) # Is nil or zero end </code></pre> <p>But this seems very clumsy.</p>
[ { "answer_id": 209522, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 2, "selected": false, "text": "nil" }, { "answer_id": 209575, "author": "Adrian Dunston", "author_id": 8344, "author_profile": "https:...
2008/10/16
[ "https://Stackoverflow.com/questions/209495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19839/" ]
209,509
<p>Instead of using the <code>&lt;input type="file"&gt;</code> tag I'd like to have a button that launches a file browser dialog.</p> <p>My first thought was to have a hidden file input tag and a button. I'd use the button click on the button to fire the onclick of the hidden file input, but I haven't been able to get this working properly.</p> <p>So the question is, is this even possible? And second is there a nicer way to do this and still be able to send the information back in a form?</p> <p>This will be the bottom layer of degrading functionality (from Flash to JavaScript (our site doesn't work without JS)) so it has to work with just basic JS and HTML.</p>
[ { "answer_id": 21069776, "author": "Rolf", "author_id": 370786, "author_profile": "https://Stackoverflow.com/users/370786", "pm_score": 1, "selected": false, "text": "$(\"#upload-box\").change(function(){\n $(\"#upload-click-handler\").val($(this).val());\n});\n$(\"#upload-click-handl...
2008/10/16
[ "https://Stackoverflow.com/questions/209509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28655/" ]
209,513
<p>How do I convert a hex string to an integer?</p> <pre><code>&quot;0xffff&quot; ⟶ 65535 &quot;ffff&quot; ⟶ 65535 </code></pre>
[ { "answer_id": 209529, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 8, "selected": false, "text": "int(hexstring, 16)" }, { "answer_id": 209530, "author": "Jorge Ferreira", "author_id": 6508, "author_pr...
2008/10/16
[ "https://Stackoverflow.com/questions/209513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17693/" ]
209,516
<p>I inherited this gigantic legacy Java web app using Struts 1.2.4. I have a specific question regarding Actions. Most of the pages have exactly one Action, and the processExecute() methods are hideous monsters (very long and tons of nested if statements based on request parameters).</p> <p>Given that Actions are an implementation of the command pattern, I'm thinking to split these Actions into one Action per user gesture. This will be a large refactoring though, and I'm wondering:</p> <ol> <li>Is this the right direction?</li> <li>Is there an intermediate step I could take, a pattern that deals with the mess inside the monolithic actions? Maybe another command pattern inside the Action?</li> </ol>
[ { "answer_id": 209730, "author": "extraneon", "author_id": 24582, "author_profile": "https://Stackoverflow.com/users/24582", "pm_score": 1, "selected": false, "text": "enum Operation {\n ADD, DELETE;\n}\n\n...\n\nOperation operation = determineOperation(form);\nif (operation == Operatio...
2008/10/16
[ "https://Stackoverflow.com/questions/209516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13041/" ]
209,528
<p>How would I drag and drop something into a static control? It looks like I need to create a sub class of COleDropTarget and include that as a member variable in a custom CStatic. That doesn't appear to be working though. When I try and drag something onto the Static control I get the drop denied cursor.</p>
[ { "answer_id": 209870, "author": "ChrisN", "author_id": 3853, "author_profile": "https://Stackoverflow.com/users/3853", "pm_score": 3, "selected": true, "text": "m_hWnd" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6701/" ]
209,534
<p>Please don't reply I should use ddd, nemiver, emacs, vim, or any other front-end, I just prefer gdb as it is, but would like to see its output with some terminal colors.</p>
[ { "answer_id": 249750, "author": "John Carter", "author_id": 8331, "author_profile": "https://Stackoverflow.com/users/8331", "pm_score": 7, "selected": false, "text": "gdb -tui executable.out\n" }, { "answer_id": 1123400, "author": "RandomNickName42", "author_id": 67819, ...
2008/10/16
[ "https://Stackoverflow.com/questions/209534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1277510/" ]
209,554
<p>I'm seeing this exception message coming from XslCompiledTransform.Transform(), but after handling the exception the XSL transform still appears to have been successful. The full exception message is:</p> <blockquote> <p>Token Text in state EndRootElement would result in an invalid XML document. Make sure that the ConformanceLevel setting is set to ConformanceLevel.Fragment or ConformanceLevel.Auto if you want to write an XML fragment.</p> </blockquote> <p>The stylesheet looks like this:</p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:ext="ext:extensions" xmlns:f="http://schemas.foo.com/FOAMSchema"&gt; &lt;xsl:template match="/Root/Documents/PO/DROPSHIP"&gt; &lt;Transactions&gt; &lt;Transaction&gt; &lt;f:partnerTransmission&gt; &lt;transmission_id&gt; &lt;xsl:value-of select="ext:NewGUID()"/&gt; &lt;/transmission_id&gt; &lt;partner_code&gt; &lt;xsl:value-of select="/Root/@PartnerCode"/&gt; &lt;/partner_code&gt; &lt;control_nbr&gt; &lt;xsl:value-of select="@GS_CNTRL_NUM"/&gt; &lt;/control_nbr&gt; &lt;creationTime&gt; &lt;xsl:value-of select="ext:ConvertToStandardDateTime(@DATE,@TIME,'ISO8601Basic')"/&gt; &lt;/creationTime&gt; &lt;direction&gt;I&lt;/direction&gt; &lt;messageCount&gt; &lt;xsl:value-of select="count(ORDERS/ORDER)"/&gt; &lt;/messageCount&gt; &lt;syntax&gt;XML&lt;/syntax&gt; &lt;format&gt;BARBAZ&lt;/format&gt; &lt;deliveryMethod&gt;FTP&lt;/deliveryMethod&gt; &lt;/f:partnerTransmission&gt; &lt;/Transaction&gt; &lt;/Transactions&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <p>The generated XML looks like this:</p> <pre><code>&lt;Transactions xmlns="http://schemas.foo.com/IntegrationProfile" xmlns:ext="ext:extensions"&gt; &lt;Transaction&gt; &lt;f:partnerTransmission xmlns:f="http://schemas.foo.com/FOAMSchema"&gt; &lt;transmission_id&gt;a5e0ec76-6c24-426b-9eb5-aef9c45d913f&lt;/transmission_id&gt; &lt;partner_code&gt;VN000033&lt;/partner_code&gt; &lt;control_nbr&gt;650&lt;/control_nbr&gt; &lt;creationTime&gt;9/27/2008 12:51:00 AM&lt;/creationTime&gt; &lt;direction&gt;I&lt;/direction&gt; &lt;messageCount&gt;2&lt;/messageCount&gt; &lt;syntax&gt;XML&lt;/syntax&gt; &lt;format&gt;BARBAZ&lt;/format&gt; &lt;deliveryMethod&gt;FTP&lt;/deliveryMethod&gt; &lt;/f:partnerTransmission&gt; &lt;/Transaction&gt; &lt;/Transactions&gt; </code></pre> <p>The above is what I get when I catch and ignore the exception.</p> <p>I haven't been able to find a way to set the ConformanceLevel (the property is read-only), but at the same time I also don't think there should be a problem here anyway.</p> <p>Does my output constitute an XML fragment? Am I missing something in the stylesheet?</p>
[ { "answer_id": 209697, "author": "ddaa", "author_id": 11549, "author_profile": "https://Stackoverflow.com/users/11549", "pm_score": 0, "selected": false, "text": "conformanceLevel" }, { "answer_id": 2451956, "author": "John Saunders", "author_id": 76337, "author_profi...
2008/10/16
[ "https://Stackoverflow.com/questions/209554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5548/" ]
209,558
<p>I'm attempting to put together some basic report screens. I've got some fairly complicated SQL queries that I'm feeding into ActiveRecord's find_by_sql method. The problem I am having here is that I am losing the order of the columns as given in the original query. I'm assuming that this is because the Hash class does not preserve entry order of its keys. </p> <p>Is there a way around this problem? Should I be using a different method then find_by_sql for my queries?</p>
[ { "answer_id": 209894, "author": "Mike Woodhouse", "author_id": 1060, "author_profile": "https://Stackoverflow.com/users/1060", "pm_score": 3, "selected": true, "text": "<% for row in @report.rows %>\n <tr>\n <% for col in [:a, :b, :c] %>\n <td><%= row[col] %></td>\n <% e...
2008/10/16
[ "https://Stackoverflow.com/questions/209558", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23513/" ]
209,595
<p>I want to make a deep copy of a LINQ to XML XElement. The reason I want to do this is there are some nodes in the document that I want to create modified copies of (in the same document). I don't see a method to do this.</p> <p>I could convert the element to an XML string and then reparse it, but I'm wondering if there's a better way.</p>
[ { "answer_id": 209674, "author": "Daniel Plaisted", "author_id": 1509, "author_profile": "https://Stackoverflow.com/users/1509", "pm_score": 3, "selected": false, "text": "XElement copy = XElement.Parse(original.ToString());\n" }, { "answer_id": 212259, "author": "Wonko", ...
2008/10/16
[ "https://Stackoverflow.com/questions/209595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1509/" ]
209,603
<p>What are the easiest steps to make a small circuit with an LED flash from a C/C++ program?</p> <p>I would prefer the least number of dependencies and packages needed. </p> <ul> <li>What port would I connect something into?</li> <li>Which compiler would I use?</li> <li>How do I send data to that port?</li> <li>Do I need to have a micro-processor? If not I don't want to use one for this simple project.</li> </ul> <p>EDIT: Interested in any OS specific solutions.</p>
[ { "answer_id": 209658, "author": "mwilliams", "author_id": 23909, "author_profile": "https://Stackoverflow.com/users/23909", "pm_score": 5, "selected": true, "text": "/* Blinking LED\n * ------------\n *\n * turns on and off a light emitting diode(LED) connected to a digital \n * pin, i...
2008/10/16
[ "https://Stackoverflow.com/questions/209603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
209,615
<p>Using the following query:</p> <pre><code> SELECT pe.prodtree_element_name_l, MAX(rs.resource_value) AS resource_value FROM prodtree_element pe LEFT JOIN resource_shortstrings rs ON pe.prodtree_element_name_l_rk = rs.resource_key WHERE rs.language_id = '5' AND pe.prodtree_element_name_l &lt;&gt; '' GROUP BY prodtree_element_name_l </code></pre> <p>I'm trying to figure out how to grab ANY of the "resource_value". The problem being that while this works for a number of other queries, I have one particular table that uses ntext datatypes instead of varchars (which can't utilize the MAX function). So basically, MAX doesn't work here. Is there a substitute I can use on MS SQL Server 2005?</p> <p>I need the prodtree_element_name_l column grouped, but I only need one value from the resource_value column, and I don't care what it is as most of them are identical regardless (although some are not, hence I can't group that one as well).</p> <p>UPDATE:</p> <p>Whoops, I was wrong, prodtree_element_name_l is ALSO an NTEXT. That might help a little :p</p>
[ { "answer_id": 209623, "author": "Dave Markle", "author_id": 24995, "author_profile": "https://Stackoverflow.com/users/24995", "pm_score": 0, "selected": false, "text": " SELECT pe.prodtree_element_name_l, MAX(CAST(rs.resource_value AS NVARCHAR(MAX))) AS resource_value\n FROM prodtre...
2008/10/16
[ "https://Stackoverflow.com/questions/209615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16631/" ]
209,657
<p>I have a footer that is a 1 x 70px, which is set as the background and tiles horizonally.</p> <p>In cases when the web page does not contain a lot of content on it, it will display the footer above where the footer should be. I want it to fill in with a solid color, so if they scroll down, it won't show the footer, then the white under the footer.</p> <p>Here is the style I have for the footer.</p> <pre><code>.footer{ background:#055830 url('/images/footer_tile.gif') repeat-x top left; color:#fff; font-size:12px; height: 70px; margin-top: 10px; font-family: Arial, Verdana, sans-serif; width:100%; } </code></pre> <p><img src="https://i.stack.imgur.com/pUzIQ.jpg" alt="alt text"></p> <p>I want the footer to look like this: <img src="https://i.stack.imgur.com/s96Ft.jpg" alt="alt text"></p>
[ { "answer_id": 209664, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 0, "selected": false, "text": "position:absolute;\nbottom: 0;\n" }, { "answer_id": 209668, "author": "JSBձոգչ", "author_id": 8078...
2008/10/16
[ "https://Stackoverflow.com/questions/209657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26130/" ]
209,686
<p>I've often had to load multiple items to a particular record in the database. For example: a web page displays items to include for a single report, all of which are records in the database (Report is a record in the Report table, Items are records in Item table). A user is selecting items to include in a single report via a web app, and let's say they select 3 items and submit. The process will add these 3 items to this report by adding records to a table called ReportItems (ReportId,ItemId).</p> <p>Currently, I would do something like this in in the code:</p> <pre><code>public void AddItemsToReport(string connStr, int Id, List&lt;int&gt; itemList) { Database db = DatabaseFactory.CreateDatabase(connStr); string sqlCommand = "AddItemsToReport" DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); string items = ""; foreach (int i in itemList) items += string.Format("{0}~", i); if (items.Length &gt; 0) items = items.Substring(0, items.Length - 1); // Add parameters db.AddInParameter(dbCommand, "ReportId", DbType.Int32, Id); db.AddInParameter(dbCommand, "Items", DbType.String, perms); db.ExecuteNonQuery(dbCommand); } </code></pre> <p>and this in the Stored procedure:</p> <pre><code>INSERT INTO ReportItem (ReportId,ItemId) SELECT @ReportId, Id FROM fn_GetIntTableFromList(@Items,'~') </code></pre> <p>Where the function returns a one column table of integers.</p> <p>My question is this: is there a better way to handle something like this? Note, I'm not asking about database normalizing or anything like that, my question relates specifically with the code.</p>
[ { "answer_id": 209711, "author": "Jason Jackson", "author_id": 13103, "author_profile": "https://Stackoverflow.com/users/13103", "pm_score": 4, "selected": false, "text": "string items = \n string.Join(\"~\", itemList.Select(item=>item.ToString()).ToArray());\n" }, { "answer_i...
2008/10/16
[ "https://Stackoverflow.com/questions/209686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27908/" ]
209,687
<p>I'm trying to order items based on an attribute value:</p> <pre><code>&lt;xsl:apply-templates select="Question"&gt; &lt;xsl:sort order="ascending" select="@Value"&gt;&lt;/xsl:sort&gt; &lt;/xsl:apply-templates&gt; </code></pre> <p>This does order them, but I could have values like 1,2,3, ... 10, 11, ... 20 and it will order them 1,10,11, ... 2,20... 3. etc.<br> I could also have values like 1.A, 1.B, 2.A, 2.B etc.</p> <p>How can I order these values to take into account the numeric content and the alphabetic, in that priority?</p>
[ { "answer_id": 209700, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 2, "selected": false, "text": "data-type" }, { "answer_id": 209746, "author": "rasx", "author_id": 22944, "author_profile": "https:/...
2008/10/16
[ "https://Stackoverflow.com/questions/209687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9266/" ]
209,706
<p>I'm asking in generalities - why would any server not set and return headers and/or status codes? I can't think of a good reason for this. Perhaps I'm overlooking something.</p>
[ { "answer_id": 210183, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 2, "selected": false, "text": "GET /\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
209,717
<p>I'm using a column of checkboxes in a YUI DataTable, I works fine. But I haven't found a way to put a name and value attribute so I can use when the form is submitted.</p> <p>Thanks in advance.</p>
[ { "answer_id": 342945, "author": "Ryan Doherty", "author_id": 956, "author_profile": "https://Stackoverflow.com/users/956", "pm_score": 0, "selected": false, "text": "<input type=\"checkbox\" name=\"the_name\" value=\"the_value\" />\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24927/" ]
209,721
<p>I'm doing a personal organizer for learning purposes, and i've never worked with XML so i'm not sure if my solution is the best. Here's the basic structure for the XML file i came with:</p> <pre><code>&lt;calendar&gt; &lt;year value="2008"&gt; &lt;month value="october"&gt; &lt;day value="16"&gt; &lt;activity name="mike's birthday" time="21:00" address="mike's apartment" urgency="10"&gt; activity description. &lt;/activity&gt; &lt;/day&gt; &lt;/month&gt; &lt;/year&gt; &lt;/calendar&gt; </code></pre> <p>The urgency attribute should be on a scale of 1 to 10. <br/> I did a quick search on google and couldn't find a good example. Maybe that's not the best solution, and i'd like to know if its adequate. I'm doing the application in PHP if that has any relevance.</p>
[ { "answer_id": 209733, "author": "Adam V", "author_id": 517, "author_profile": "https://Stackoverflow.com/users/517", "pm_score": 3, "selected": true, "text": "<activity>\n <name>Mike's Birthday</name>\n <time>2100</time>\n <address>Mike's Place</address>\n <urgency>10</urgency>\n <...
2008/10/16
[ "https://Stackoverflow.com/questions/209721", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27090/" ]
209,725
<p>We have an auto-complete list that's populated when an you send an email to someone, which is all well and good until the list gets really big you need to type more and more of an address to get to the one you want, which goes against the purpose of auto-complete</p> <p>I was thinking that some logic should be added so that the auto-complete results should be sorted by some function of most recently contacted or most often contacted rather than just alphabetical order.</p> <p>What I want to know is if there's any known good algorithms for this kind of search, or if anyone has any suggestions. </p> <p>I was thinking just a point system thing, with something like same day is 5 points, last three days is 4 points, last week is 3 points, last month is 2 points and last 6 months is 1 point. Then for most often, 25+ is 5 points, 15+ is 4, 10+ is 3, 5+ is 2, 2+ is 1. No real logic other than those numbers "feel" about right.</p> <p>Other than just arbitrarily picked numbers does anyone have any input? Other numbers also welcome if you can give a reason why you think they're better than mine</p> <p>Edit: This would be primarily in a business environment where recentness (yay for making up words) is often just as important as frequency. Also, past a certain point there really isn't much difference between say someone you talked to 80 times vs say 30 times.</p>
[ { "answer_id": 9336825, "author": "Umbrella", "author_id": 1125513, "author_profile": "https://Stackoverflow.com/users/1125513", "pm_score": 0, "selected": false, "text": "UPDATE `addresslist` SET `favor` = `favor` + 10 WHERE `address` = 'foo@bar.com'\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23822/" ]
209,731
<p>First of all, using gnome is not an option (but it is possible to install its libraries).</p> <p>I need to know what is necessary to display a Java Swing desktop application using the current installed KDE look and feel of KDE. Ideally, the solution should allow me to apply a look and feel that looks like the underlying windowing system (ie: Windows LNF for Windows, GTK LNF for Gnome(GTK), QT LNF for KDE (QT), the default one for other platforms).</p> <p>Under KDE, you can configure it to use the current KDE theme for GTK applications, too. So, if the solution works with GTK it is fine.</p> <p>When I run the following piece of code under Gnome (Ubuntu 8.04), the Java application looks beautiful. It integrates very well with the rest of applications:</p> <pre><code>try { // Set System L&amp;F UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { //Handle it } </code></pre> <p>However, if I run the same thing under Debian (Lenny) with KDE, the UIManager.getSystemLookAndFeelClassName() call returns the Java default one. If I go ahead and force it to use the GTK LNF, the application doesn't work. Some fields are invisible, others become out of place, everything is unusable:</p> <pre><code>try { //Force the GTK LNF on top of KDE, but **it doesn't work** UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); } catch (Exception e) { /*Handle it*/ } </code></pre> <p>I've also tried to put the following code. It let's the user chose any one of the available LNF and then tries to set it. Metal and Motif work fine. GTK doesn't. The slider is really messed up. The list box looks ugly and disappears, but seems to work. Buttons and menu seem ok. The relevant code is shown here:</p> <pre><code>(...) /** Creates new form SwingFrame */ public SwingFrame() { initComponents(); //Save all available lafs in a combobox cbLafs.removeAllItems(); UIManager.LookAndFeelInfo[] lafs=UIManager.getInstalledLookAndFeels(); for (int i=0,t=lafs.length;i&lt;t;i++) { cbLafs.addItem(lafs[i]); System.out.println(lafs[i].getName()); } } public void changeLookAndFeel(String laf) { //If not specified, get the default one if (laf==null) { laf=UIManager.getSystemLookAndFeelClassName(); } try { // Set System L&amp;F UIManager.setLookAndFeel(laf); } catch (Exception e) { // handle exception e.printStackTrace(); } SwingUtilities.updateComponentTreeUI(this); } private void cbLafsActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: UIManager.LookAndFeelInfo laf=(UIManager.LookAndFeelInfo)cbLafs.getSelectedItem(); if (laf==null) changeLookAndFeel(null); else changeLookAndFeel(laf.getClassName()); } </code></pre> <p>This same system has all GTK applications working (for example: Firefox) as expected. So:</p> <p>1) What is missing from the environment to have a Java GTK LNF application working under KDE?</p> <p>2) What does the JVM checks for to return GTK as the default system theme?</p> <p>Thanks for you help Luis Fernando</p> <p>PS->I've tried other solutions,too, such as JGoodies, plain AWT and SWT. However, Swing with GTK LNF would be the best solution to avoid the hassle of SWT native libraries and JGoodies extra jars (also, JGoodies LNF doesn't look as integrated as Swing GTK under Gnome). AWT looks hideous (motif-like) and misses lots of features.</p>
[ { "answer_id": 211004, "author": "Marcus Tik", "author_id": 23450, "author_profile": "https://Stackoverflow.com/users/23450", "pm_score": 0, "selected": false, "text": "try {\n// sure look and feel\nUIManager.setLookAndFeel(\"com.sun.java.swing.plaf.gtk.GTKLookAndFeel\");\n// not-so-sure...
2008/10/16
[ "https://Stackoverflow.com/questions/209731", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24165/" ]
209,732
<p>I have code similar to this filtering entries in an Array of Objects:</p> <pre><code>var filterRegex = new RegExp(".*blah.*","ig"); if (filterRegex.test(events[i].thing) &amp;&amp; events[i].show) { console.log("SUCCESS: filtering thing " + i + " " + events[i].thing); events[i].show = false; numevents--; } </code></pre> <p>I get inconsistent results with this if condition (checking with Firebug, both conditions are true individually, but <em>sometimes</em> the whole expression evaluates to false). HOWEVER, if I actually put an <code>alert()</code> called inside this if statement (like line 4), it becomes consistent and I get the result I want.</p> <p>Can you see anything wrong with this logic and tell me why it's not always producing what is expected?</p>
[ { "answer_id": 209817, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 0, "selected": false, "text": "regex.test()" }, { "answer_id": 210077, "author": "Shog9", "author_id": 811, "author_profile": "https:...
2008/10/16
[ "https://Stackoverflow.com/questions/209732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25066/" ]
209,738
<p>I need that my Apache require authentication only to external access but free in my local network. I have mod_user in my Apache.</p>
[ { "answer_id": 209821, "author": "James Schek", "author_id": 17871, "author_profile": "https://Stackoverflow.com/users/17871", "pm_score": 2, "selected": false, "text": "Require valid-user\nAllow from 192.168.1\nSatisfy Any \n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
209,753
<p>I have an error handling method in my ApplicationController:</p> <pre><code>rescue_from ActiveRecord::RecordNotFound, :with =&gt; :not_found def not_found(exception) @exception = exception render :template =&gt; '/errors/not_found', :status =&gt; 404 end </code></pre> <p>In <code>RAILS_ROOT/app/views/errors/not_found.html.erb</code>, I have this:</p> <pre><code>&lt;h1&gt;Error 404: Not Found&lt;/h1&gt; &lt;%= debug @exception %&gt; </code></pre> <p>But <code>@exception</code> is always <code>nil</code> there. I've tried <code>debug assigns</code>, but that's always <code>{}</code>. Do assigns not get copied when calling <code>render :template</code>? If so, how can I get them?</p> <p>I'm on edge Rails.</p>
[ { "answer_id": 209792, "author": "Avdi", "author_id": 20487, "author_profile": "https://Stackoverflow.com/users/20487", "pm_score": 4, "selected": true, "text": "def not_found(exception)\n render :template => '/errors/not_found', \n :status => 404, \n :locals => {:ex...
2008/10/16
[ "https://Stackoverflow.com/questions/209753", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1190/" ]
209,754
<p>We have a sitemap for our site <a href="http://www.appsamuck.com/" rel="nofollow noreferrer">http://www.appsamuck.com/</a></p> <p>The sitemap is here <a href="http://www.appsamuck.com/sitemap.xml" rel="nofollow noreferrer">http://www.appsamuck.com/sitemap.xml</a></p> <p>But Google seems to hate it. My question is why? I'm just staring at it now saying to myself it looks right. Am I missing something?</p> <p>3 Paths don't match We've detected that you submitted your Sitemap using a URL path that doesn't include the www prefix (for instance, <a href="http://example.com/sitemap.xml" rel="nofollow noreferrer">http://example.com/sitemap.xml</a>). However, the URLs listed inside your Sitemap do use the www prefix (for instance, <a href="http://www.example.com/myfile.htm" rel="nofollow noreferrer">http://www.example.com/myfile.htm</a>). Help Help URL: Problem detected on: <a href="http://www.appsamuck.com/" rel="nofollow noreferrer">http://www.appsamuck.com/</a> Oct 15, 2008</p>
[ { "answer_id": 209767, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": -1, "selected": false, "text": "<lastmod></lastmod>, <changefreq></changefreq>, <priority></priority>" }, { "answer_id": 21153...
2008/10/16
[ "https://Stackoverflow.com/questions/209754", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23294/" ]
209,774
<p>I found this <a href="http://pecl.php.net/package/threads" rel="noreferrer">PECL package called threads</a>, but there is not a release yet. And nothing is coming up on the PHP website.</p>
[ { "answer_id": 210919, "author": "Darryl Hein", "author_id": 5441, "author_profile": "https://Stackoverflow.com/users/5441", "pm_score": 6, "selected": false, "text": "$cmd = 'nohup nice -n 10 /usr/bin/php -c /path/to/php.ini -f /path/to/php/file.php action=generate var1_id=23 var2_id=35...
2008/10/16
[ "https://Stackoverflow.com/questions/209774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
209,779
<p>I am developing a wizard for a machine that is to be used as a backup of other machines. When it replaces an existing machine, it needs to set its IP address, DNS, WINS, and host name to match the machine being replaced.</p> <p>Is there a library in .net (C#) which allows me to do this programatically?</p> <p>There are multiple NICs, each which need to be set individually.</p> <p><strong>EDIT</strong></p> <p>Thank you <a href="https://stackoverflow.com/questions/209779/how-can-you-change-network-settings-ip-address-dns-wins-host-name-with-code-in-c#209822">TimothyP</a> for your example. It got me moving on the right track and the quick reply was awesome.</p> <p>Thanks <a href="https://stackoverflow.com/questions/209779/how-can-you-change-network-settings-ip-address-dns-wins-host-name-with-code-in-c#209983">balexandre</a>. Your code is perfect. I was in a rush and had already adapted the example TimothyP linked to, but I would have loved to have had your code sooner.</p> <p>I've also developed a routine using similar techniques for changing the computer name. I'll post it in the future so subscribe to this questions <a href="https://stackoverflow.com/feeds/question/209779" title="RSS Feed">RSS feed</a> if you want to be informed of the update. I may get it up later today or on Monday after a bit of cleanup.</p>
[ { "answer_id": 209983, "author": "balexandre", "author_id": 28004, "author_profile": "https://Stackoverflow.com/users/28004", "pm_score": 7, "selected": true, "text": "using System;\nusing System.Management;\n\nnamespace WindowsFormsApplication_CS\n{\n class NetworkManagement\n {\n ...
2008/10/16
[ "https://Stackoverflow.com/questions/209779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10119/" ]
209,787
<p>In the following one to many</p> <pre><code>CREATE TABLE source(id int, name varchar(10), PRIMARY KEY(id)); CREATE TABLE params(id int, source int, value int); </code></pre> <p>where params.source is a foreign key to source.id</p> <pre><code>INSERT INTO source values(1, 'yes'); INSERT INTO source values(2, 'no'); INSERT INTO params VALUES(1,1,1); INSERT INTO params VALUES(2,1,2); INSERT INTO params VALUES(3,1,3); INSERT INTO params VALUES(4,2,1); INSERT INTO params VALUES(5,2,3); INSERT INTO params VALUES(6,2,4); </code></pre> <p>If i have a list of param values (say [1,2,3]), how do I find all the sources that have ALL of the values in the list (source 1, "yes") in SQL?</p> <p>Thanks</p>
[ { "answer_id": 209819, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 4, "selected": true, "text": "SELECT\n *\nFROM\n source\nWHERE\n (\n SELECT COUNT(DISTINCT value)\n FROM params\n WHER...
2008/10/16
[ "https://Stackoverflow.com/questions/209787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
209,789
<p>Is there a way to start an instance of eclipse, passing it some sort of parameter telling it to use a specific workspace?</p> <p>The problem I'm trying to solve is that I have a workspace for work projects and one for personal projects. I'd like to be able to tie these to workspaces to separate shortcuts that I could launch independently.</p>
[ { "answer_id": 209794, "author": "Matt H", "author_id": 18049, "author_profile": "https://Stackoverflow.com/users/18049", "pm_score": 9, "selected": true, "text": "-data your_workspace_location\n" }, { "answer_id": 10507415, "author": "santaranger", "author_id": 1383222, ...
2008/10/16
[ "https://Stackoverflow.com/questions/209789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5291/" ]
209,790
<p>I would like to have the same editor available on all of the platforms I frequent.</p> <p>Emacs and Vi are not desired solutions.</p>
[ { "answer_id": 209794, "author": "Matt H", "author_id": 18049, "author_profile": "https://Stackoverflow.com/users/18049", "pm_score": 9, "selected": true, "text": "-data your_workspace_location\n" }, { "answer_id": 10507415, "author": "santaranger", "author_id": 1383222, ...
2008/10/16
[ "https://Stackoverflow.com/questions/209790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7734/" ]
209,793
<p>Kind of a random question...</p> <p>What I'm looking for is a way to express a cast operation which uses a defined operator of the class instance I'm casting from, and generates a compile-time error if there is not a defined cast operator for the type. So, for example, what I'm looking for is something like:</p> <pre><code>template&lt; typename RESULT_TYPE, typename INPUT_TYPE &gt; RESULT_TYPE operator_cast( const INPUT_TYPE&amp; tValue ) { return tValue.operator RESULT_TYPE(); } // Should work... CString sString; LPCTSTR pcszString = operator_cast&lt; LPCTSTR &gt;( sString ); // Should fail... int iValue = 42; DWORD dwValue = operator_cast&lt; DWORD &gt;( iValue ); </code></pre> <p>Interesting side-note: The above code crashes the VS2005 C++ compiler, and doesn't compile correctly in the VS2008 C++ compiler due to what I'm guessing is a compiler bug, but hopefully demonstrates the idea.</p> <p>Anybody know of any way to achieve this effect?</p> <p>Edit: More rationale, to explain why you might use this. Say you have a wrapper class which is supposed to encapsulate or abstract a type, and you're casting it to the encapsulated type. You could use static_cast&lt;>, but that might work when you wanted it to fail (ie: the compiler chooses an operator which is allowed to convert to the type you asked for, when you wanted a failure because that operator is not present).</p> <p>Admittedly it's an uncommon case, but it's annoying that I can't express exactly what I want the compiler to do in an encapsulated function... hence the question here.</p>
[ { "answer_id": 210254, "author": "Evan Teran", "author_id": 13430, "author_profile": "https://Stackoverflow.com/users/13430", "pm_score": 0, "selected": false, "text": "/* general template */\ntemplate<typename T1, typename T2> T1 operator_cast(const T2 &x);\n\n/* do this for each valid ...
2008/10/16
[ "https://Stackoverflow.com/questions/209793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26240/" ]
209,795
<p>All of this is pertaining to WebHttp binding, hosted in a custom Service Host (IIS is not an option at this time).</p> <p>I've implemented a custom UserNamePasswordValidator, and a custom IAuthorizationPolicy. When I configure the endpoint's binding to use Basic authentication, everything works just as I'd like (custom principal, custom roles, etc..). </p> <p>I'd like to add the ability for anonymous HTTP access as well, and have my custom implementations put the Anonymous user in some default roles, etc.. (if no Authenticate header is sent).</p> <p>What happens now is that anonymous users are given a 401 before any of my custom code is hit. If I turn off the HTTP Basic authentication requirement, then the Authenticate header is ignored altogether.</p> <p>How do I configure, <strong>or inject an Authenticate header</strong>, to do this both ways (without creating 2 separate endpoints)?</p>
[ { "answer_id": 234376, "author": "Ronald Wildenberg", "author_id": 23562, "author_profile": "https://Stackoverflow.com/users/23562", "pm_score": 2, "selected": true, "text": "System.Net.HttpListener" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/209795", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18941/" ]
209,804
<p>What reason is there for C# or java having lambdas? Neither language is based around them, it appears to be another coding method to do the same thing that C# already did.<br> I'm not being confrontational, if there is a reason I would like to know the reason why. For the purpose of full disclosure I am a Java programmer with a C++ background with no lisp experience, I may just be missing the point. </p>
[ { "answer_id": 209829, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 6, "selected": true, "text": "JButton button = new JButton(\"Push me!\");\nbutton.addActionListener(new ActionListener() {\n public void actionPe...
2008/10/16
[ "https://Stackoverflow.com/questions/209804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13491/" ]
209,806
<p>I have an instance of a general purpose class that will be executed both under ASP.NET and a stand alone program. This code is sensative to the process where it is being run - that is, there are certin methods that should not called if running under ASP.NET. How do you determine if the code is executing in an ASP.NET process?</p> <p>The solution I am currently using is answered below.</p> <hr> <p>I wish someone would add a comment as to why this question has gotten downvoted and/or propose a better way to ask it! I can only assume at least some folks have looked at the question and said "what an idiot, ASP.NET code is .NET code".</p>
[ { "answer_id": 209807, "author": "jr.", "author_id": 2415, "author_profile": "https://Stackoverflow.com/users/2415", "pm_score": -1, "selected": false, "text": "public class SomeClass {\n\n public bool RunningUnderAspNet { get; private set; }\n\n\n public SomeClass()\n //\n /...
2008/10/16
[ "https://Stackoverflow.com/questions/209806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2415/" ]
209,812
<p>I'm using NetBeans, trying to change the familiar Java coffee cup icon to a png file that I have saved in a resources directory in the jar file. I've found many different web pages that claim they have a solution, but so far none of them work.</p> <p>Here's what I have at the moment (leaving out the try-catch block):</p> <pre><code>URL url = new URL("com/xyz/resources/camera.png"); Toolkit kit = Toolkit.getDefaultToolkit(); Image img = kit.createImage(url); getFrame().setIconImage(img); </code></pre> <p>The class that contains this code is in the <strong>com.xyz</strong> package, if that makes any difference. That class also extends JFrame. This code is throwing a MalformedUrlException on the first line.</p> <p>Anyone have a solution that works?</p>
[ { "answer_id": 209824, "author": "JeeBee", "author_id": 17832, "author_profile": "https://Stackoverflow.com/users/17832", "pm_score": 7, "selected": true, "text": "java.net.URL url = ClassLoader.getSystemResource(\"com/xyz/resources/camera.png\");\n" }, { "answer_id": 210197, ...
2008/10/16
[ "https://Stackoverflow.com/questions/209812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
209,820
<p>I want to be able to introduce new 'tag lines' into a database that are shown 'randomly' to users. (These tag lines are shown as an introduction as animated text.)</p> <p>Based upon the number of sales that result from those taglines I'd like the good ones to trickle to the top, but still show the others less frequently.</p> <p>I could come up with a basic algorithm quite easily but I want something thats a little more 'statistically accurate'.</p> <p>I dont really know where to start. Its been a while since I've done anything more than basic statistics. My model would need to be sensitive to tolerances, but obviously it doesnt need to be worthy of a PHD.</p> <p><strong>Edit:</strong> I am currently tracking a 'conversion rate' - i.e. hits per order. This value would probably be best calculated as a cumulative 'all time' convertsion rate to be fed into the algorithm.</p>
[ { "answer_id": 212573, "author": "Tnilsson", "author_id": 4165, "author_profile": "https://Stackoverflow.com/users/4165", "pm_score": 1, "selected": false, "text": "START:\nx = random(1, 3); \nif x = 3 goto NEW else goto NORMAL\n\nNEW:\nTagVec = Taglines.filterYounger(5 days); // I'm tak...
2008/10/16
[ "https://Stackoverflow.com/questions/209820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24727/" ]
209,840
<p>I want to combine these:</p> <pre class="lang-py prettyprint-override"><code>keys = ['name', 'age', 'food'] values = ['Monty', 42, 'spam'] </code></pre> <p>Into a single dictionary:</p> <pre class="lang-py prettyprint-override"><code>{'name': 'Monty', 'age': 42, 'food': 'spam'} </code></pre>
[ { "answer_id": 209854, "author": "Dan Lenski", "author_id": 20789, "author_profile": "https://Stackoverflow.com/users/20789", "pm_score": 12, "selected": true, "text": "keys = ['a', 'b', 'c']\nvalues = [1, 2, 3]\ndictionary = dict(zip(keys, values))\nprint(dictionary) # {'a': 1, 'b': 2, ...
2008/10/16
[ "https://Stackoverflow.com/questions/209840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12388/" ]
209,861
<p>I have a HTML page that scrolls up and down (not a lot, but it does scroll). How can I set the scroll position in the page after executing some JavaScript?</p> <p>I'm using jQuery to inject some additional HTML at the bottom of the page and I'd like to programmatically scroll to the position of that new content after it's added.</p>
[ { "answer_id": 209881, "author": "KernelM", "author_id": 22328, "author_profile": "https://Stackoverflow.com/users/22328", "pm_score": 3, "selected": false, "text": "window.scroll" }, { "answer_id": 210028, "author": "Jason Bunting", "author_id": 1790, "author_profile...
2008/10/16
[ "https://Stackoverflow.com/questions/209861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2536/" ]
209,862
<p>This page displays beautifully in firefox but i get all kinds of problems when testing the site in opera or internet explorer, mostly with the menu. I would like to know what techniques have caused this and how to avoid them. </p> <p><a href="http://www.jkhbdesign.se/" rel="nofollow noreferrer">http://www.jkhbdesign.se/</a></p> <p>Edit 2: Here are some screenshots of some specific problems</p> <p>The dropdown as it should look:</p> <p><a href="http://nibbo.se/slask/correct.png" rel="nofollow noreferrer">alt text http://nibbo.se/slask/correct.png</a></p> <p>The way it looks in IE 7:</p> <p><a href="http://nibbo.se/slask/dropdownie.png" rel="nofollow noreferrer">alt text http://nibbo.se/slask/dropdownie.png</a></p> <p>The way it looks in Opera:</p> <p><a href="http://nibbo.se/slask/dropdownopera.png" rel="nofollow noreferrer">alt text http://nibbo.se/slask/dropdownopera.png</a></p>
[ { "answer_id": 209934, "author": "Geoff", "author_id": 1097, "author_profile": "https://Stackoverflow.com/users/1097", "pm_score": 3, "selected": true, "text": "ul.menu li:hover ul.submenu {\nbackground:white none repeat scroll 0 0;\nborder:1px solid #A6A6A6;\ndisplay:block;\nmargin-left...
2008/10/16
[ "https://Stackoverflow.com/questions/209862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28668/" ]
209,869
<p>Some of my data are 64-bit integers. I would like to send these to a JavaScript program running on a page.</p> <p>However, as far as I can tell, integers in most JavaScript implementations are 32-bit signed quantities.</p> <p>My two options seem to be:</p> <ol> <li>Send the values as strings</li> <li>Send the values as 64-bit floating point numbers</li> </ol> <p>Option (1) isn't perfect, but option (2) seems far less perfect (loss of data).</p> <p>How have you handled this situation?</p>
[ { "answer_id": 209892, "author": "Simon Howard", "author_id": 24806, "author_profile": "https://Stackoverflow.com/users/24806", "pm_score": 6, "selected": true, "text": " [ 12345678, 12345678 ]\n" }, { "answer_id": 858857, "author": "David Leonard", "author_id": 19502, ...
2008/10/16
[ "https://Stackoverflow.com/questions/209869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/338/" ]
209,874
<p>New to javascript/jquery and having a hard time with using <code>this</code> or <code>$(this)</code> to get the current object.</p> <p>I have a table with a set of <code>radio buttons</code> on each row, each named <code>s_&lt;rowindex&gt;</code>. None of the radio buttons are checked by default:</p> <pre><code>&lt;tr&gt; &lt;td align="left" style="width: 300px"&gt; &lt;div id="div_s_0"&gt; &lt;input type="radio" name="s_0" value="1" /&gt;Public &lt;input type="radio" name="s_0" value="2" /&gt;Not Public &lt;input type="radio" name="s_0" value="3" /&gt;Confidential &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="left" style="width: 300px"&gt; &lt;div id="div_s_1"&gt; &lt;input type="radio" name="s_1" value="1" /&gt;Public &lt;input type="radio" name="s_1" value="2" /&gt;Not Public &lt;input type="radio" name="s_1" value="3" /&gt;Confidential &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>I'm trying to write a jQuery function to add a new row to the table whenever the user selects a radio button, but only if they are currently on the last row of the table. What I'd like to do is get the name attribute of the clicked radio button, parse it to get the row index (i.e. the part after the '_') and compare it to the number of rows in the table. If they are equal, add a new row, otherwise, do nothing.</p> <p>My question is twofold, depending on how I should attack this:</p> <p>1) How do I return the name attribute of a radio button, OR 2) How do I return the row index of the row I am currently in?</p>
[ { "answer_id": 209926, "author": "MDCore", "author_id": 1896, "author_profile": "https://Stackoverflow.com/users/1896", "pm_score": 0, "selected": false, "text": "$(\"#div_s_0 input[type='radio']\").onclick = function() {\n if ($(\"#div_s_0 input[type='radio']:last\").attr('checked') ...
2008/10/16
[ "https://Stackoverflow.com/questions/209874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23585/" ]
209,888
<p>Python 3.0 is in beta with a final release coming shortly. Obviously it will take some significant time for general adoption and for it to eventually replace 2.x.</p> <p>I am writing a tutorial about certain aspects of programming Python. I'm wondering if I should do it in Python 2.x or 3.0? (not that the difference is huge)</p> <p>a 2.x tutorial is probably more useful now, but it would be nice to start producing 3.0 tutorials.</p> <p>anyone have thoughts?</p> <p>(of course I could do both, but I would prefer to do one or the other)</p>
[ { "answer_id": 209911, "author": "Dan Lenski", "author_id": 20789, "author_profile": "https://Stackoverflow.com/users/20789", "pm_score": 2, "selected": false, "text": "print" }, { "answer_id": 214510, "author": "Glyph", "author_id": 13564, "author_profile": "https://...
2008/10/16
[ "https://Stackoverflow.com/questions/209888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16148/" ]
209,890
<p>I'm looking for a regex that can pull out quoted sections in a string, both single and double quotes.</p> <p>IE:</p> <pre><code>"This is 'an example', \"of an input string\"" </code></pre> <p>Matches:</p> <ul> <li>an example</li> <li>of an input string</li> </ul> <p>I wrote up this:</p> <pre><code> [\"|'][A-Za-z0-9\\W]+[\"|'] </code></pre> <p>It works but does anyone see any flaws with it?</p> <p>EDIT: The main issue I see is that it can't handle nested quotes.</p>
[ { "answer_id": 209898, "author": "Chris Bunch", "author_id": 422, "author_profile": "https://Stackoverflow.com/users/422", "pm_score": 0, "selected": false, "text": "[\\\"']([^\\\"']*)[\\\"']\n" }, { "answer_id": 209899, "author": "Tomalak", "author_id": 18771, "autho...
2008/10/16
[ "https://Stackoverflow.com/questions/209890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
209,905
<p>Can somebody explain what is <a href="https://stackoverflow.com/tags/rest/info">REST</a> and what is <a href="https://stackoverflow.com/tags/soap/info">SOAP</a> in plain english? And how Web Services work? </p>
[ { "answer_id": 22415123, "author": "cmd", "author_id": 2616755, "author_profile": "https://Stackoverflow.com/users/2616755", "pm_score": 5, "selected": false, "text": "SOAP" }, { "answer_id": 25706876, "author": "inf3rno", "author_id": 607033, "author_profile": "https...
2008/10/16
[ "https://Stackoverflow.com/questions/209905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26927/" ]
209,906
<p>Is there a way in PHP to compile a regular expression, so that it can then be compared to multiple strings without repeating the compilation process? Other major languages can do this -- Java, C#, Python, Javascript, etc.</p>
[ { "answer_id": 7119245, "author": "Mike", "author_id": 902114, "author_profile": "https://Stackoverflow.com/users/902114", "pm_score": 4, "selected": false, "text": "<?php\n\nfunction microtime_float() {\n list($usec, $sec) = explode(\" \", microtime());\n return ((float)$usec + (f...
2008/10/16
[ "https://Stackoverflow.com/questions/209906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25213/" ]
209,924
<p>My code for sql connection using linq is:</p> <pre><code>var query1 = from u in dc.Usage_Computers where u.DomainUser == s3 select u; // selects all feilds from table GridView1.DataSource = query1; GridView1.DataBind(); </code></pre> <p>I have a field called "Operation" in the table "Domainuser" which has values like "1, 2, 3". When I populate these values to data grid I wanted to convert them to meaningful values like if the value of Operation is 1 then display in datagrid as "logon", if 2 then "logoff" etc...</p> <p>How do i assign values for them after retrieving from database?</p>
[ { "answer_id": 209944, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 0, "selected": false, "text": "protected void label_OnPreRender( object sender, EventArgs e )\n{\n Label l = (Label)sender;\n switch (l.Text) {\n ...
2008/10/16
[ "https://Stackoverflow.com/questions/209924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
209,935
<p>I'm trying to set up a virtual host on a new VPS using apache 2.x on a Ubuntu server.</p> <p>When starting apache I get the error " xxx.241.214.xxx:80 has no VirtualHosts", and the url for the site still points to the default location which means my virtual host file isn't taking effect:</p> <pre><code>&lt;VirtualHost xxx.241.214.xxx:80&gt; ServerName xxx.co.uk ServerAlias www.xxx.co.uk DocumentRoot /var/www/vhosts/xxx.co.uk/httpdocs/xxx.co.uk &lt;/VirtualHost&gt; </code></pre> <p>Please help, I'm no good at all this server config stuff.</p>
[ { "answer_id": 209954, "author": "Richard Harrison", "author_id": 19624, "author_profile": "https://Stackoverflow.com/users/19624", "pm_score": 0, "selected": false, "text": "<VirtualHost *>\n" }, { "answer_id": 212176, "author": "Rodent43", "author_id": 28869, "autho...
2008/10/16
[ "https://Stackoverflow.com/questions/209935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
209,963
<p>I've got a table of hardware and a table of incidents. Each hardware has a unique tag, and the incidents are tied to the tag.</p> <p>How can I select all the hardware which has at least one incident listed as unresolved?</p> <p>I can't just do a join, because then if one piece of hardware had multiple unresolved issues, it would show up multiple times.</p>
[ { "answer_id": 209967, "author": "Richard Harrison", "author_id": 19624, "author_profile": "https://Stackoverflow.com/users/19624", "pm_score": 4, "selected": true, "text": "select distinct(hardware_name) \nfrom hardware,incidents \nwhere hardware.id = incidents.hardware_id and incidents...
2008/10/16
[ "https://Stackoverflow.com/questions/209963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18210/" ]
209,972
<p>How to Programmatically Inject JavaScript in PDF files?</p> <p>Can it be done without Adobe Professional?</p> <hr> <p>My goal is: I want to show up the print dialog immediately when I open the PDF. </p> <p>I know that this can be done with JavaScript code embedded in the document.</p>
[ { "answer_id": 3963918, "author": "Mark Storer", "author_id": 477771, "author_profile": "https://Stackoverflow.com/users/477771", "pm_score": 2, "selected": false, "text": "PdfReader myReader = new PdfReader( myFilePath ); // throws IOException\nPdfStamper myStamper = new PdfStamper( myR...
2008/10/16
[ "https://Stackoverflow.com/questions/209972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1100/" ]
209,980
<p>I have tried</p> <pre><code>&lt;ul id="contact_list"&gt; &lt;li id="phone"&gt;Local 604-555-5555&lt;/li&gt; &lt;li id="i18l_phone"&gt;Toll-Free 1-800-555-5555&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>with</p> <pre><code>#contact_list { list-style: disc none inside; } #contact_list #phone { list-style-image: url(images/small_wood_phone.png); } #contact_list #i18l_phone { list-style-image: url(images/i18l_wood_phone.png); } </code></pre> <p>to no avail. Only a disc appears. If I want each individual list item to have it's own bullet, how can I accomplish this with css, <strong><em>without using background images</em></strong>.</p> <p>Edit : I have discovered that, despite what firebug tells me, the list-style-image rule is being overridden somehow. If I inline the rule, like so:</p> <pre><code> &lt;li id="phone" style="list-style-image: url(images/small_wood_phone.png);"&gt;Local 604-555-5555&lt;/li&gt; </code></pre> <p>then all is well. Since I have no other rules in the test case I'm running that contains ul or li in the selector, I'm not sure why inlining gives a different result.</p>
[ { "answer_id": 209997, "author": "Remy Sharp", "author_id": 22617, "author_profile": "https://Stackoverflow.com/users/22617", "pm_score": 2, "selected": false, "text": "#contact_list\n{\n list-style: none;\n}\n\n#contact_list li {\n padding-left: 20px; /* assumes the icons are 16px */\...
2008/10/16
[ "https://Stackoverflow.com/questions/209980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16398/" ]
210,022
<p>I have a requirement on my current project (a Flex app which will be run in Flash player) to display an arbitrary subset of the components on a form while hiding all the other components based on certain aspects of the application state. There are about a dozen different text boxes and drop downs, but some become irrelevant based on previously entered user data and we don't want to display those when we get to this particular form. Every time this form is displayed I could need to show any one of the many permutations of these components.</p> <p>I'm trying to decide what the best way to approach this problem is. Should I create a Canvas (or other container) with all of the needed controls on it and then just set visible = false on the ones I don't need? The problem then becomes making sure the layout looks decent. I don't want there to be gaps where the hidden controls would have been.</p> <p>The other option I've thought about is just having a mechanism that could dynamically instantiate the TextInput or CheckBox etc. component and then call container.addChild(control) in order to build up the components and not have to worry about the gap issue.</p> <p>This seems like a problem that has an idiomatic solution in flex, but I don't know what it is. Neither of these ideas seem great so I'm wondering if anyone else has a better idea.</p>
[ { "answer_id": 210090, "author": "rmeador", "author_id": 10861, "author_profile": "https://Stackoverflow.com/users/10861", "pm_score": 3, "selected": true, "text": "visible = false" }, { "answer_id": 210105, "author": "David Arno", "author_id": 7122, "author_profile":...
2008/10/16
[ "https://Stackoverflow.com/questions/210022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1247/" ]
210,026
<p>I have some C++ source code with templates maybe like this - doxygen runs without errors but none of the documentation is added to the output, what is going on?</p> <pre><code>/// /// A class /// class A { /// /// A typedef /// typedef B&lt;C&lt;D&gt;&gt; SomeTypedefOfTemplates; }; </code></pre>
[ { "answer_id": 210043, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": 3, "selected": true, "text": "///\n/// A class\n///\nclass A\n{\n ///\n /// A typedef\n ///\n typedef B<C<D> > SomeTypedefOfTemplates;\n};\n" ...
2008/10/16
[ "https://Stackoverflow.com/questions/210026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3146/" ]
210,068
<p>What's the shortest Perl one-liner that print out the first 9 powers of a hard-coded 2 digit decimal (say, for example, .37), each on its own line? </p> <p>The output would look something like:</p> <pre><code>1 0.37 0.1369 [etc.] </code></pre> <p>Official Perl golf rules:</p> <ol> <li>Smallest number of (key)strokes wins</li> <li>Your stroke count includes the command line</li> </ol>
[ { "answer_id": 210107, "author": "willasaywhat", "author_id": 12234, "author_profile": "https://Stackoverflow.com/users/12234", "pm_score": 0, "selected": false, "text": "perl -e \"for(my $i = 1; $i < 10; $i++){ print((.37**$i). \\\"\\n\\\"); }\"\n" }, { "answer_id": 210132, ...
2008/10/16
[ "https://Stackoverflow.com/questions/210068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2683/" ]
210,069
<p>In ASP.NET what's the best way to do the following:</p> <ol> <li>Show certain controls based on your rights?</li> <li>For a gridview control, how do you show certain columns based on your role?</li> </ol> <p>I'm thinking for number 2, have the data come from a role specific view on the database.</p>
[ { "answer_id": 210117, "author": "Elijah Manor", "author_id": 4481, "author_profile": "https://Stackoverflow.com/users/4481", "pm_score": 4, "selected": true, "text": "//Delete Icon Column\ngridViewContacts.Columns[0].Visible = user.IsInRole(\"DeleteAnyContact\"); \n" }, { "answe...
2008/10/16
[ "https://Stackoverflow.com/questions/210069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/781/" ]
210,079
<p>I have a 10 second sound effect wave file. What I would like to do is take that file and repeat it n number of times and then save the longer WAV file to disk. This way I can create a much longer background effect rather than auto-repeat on the media player which is a bit stuttered between repeats. I am trying to do this in C#.</p>
[ { "answer_id": 216932, "author": "Mark Heath", "author_id": 7532, "author_profile": "https://Stackoverflow.com/users/7532", "pm_score": 0, "selected": false, "text": "WaveFileReader" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/210079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27294/" ]
210,080
<p>I'm sure this one is easy but I've tried a ton of variations and still cant match what I need. The thing is being too greedy and I cant get it to stop being greedy.</p> <p>Given the text:</p> <pre><code>test=this=that=more text follows </code></pre> <p>I want to just select:</p> <pre><code>test= </code></pre> <p>I've tried the following regex</p> <pre><code>(\S+)=(\S.*) (\S+)?= [^=]{1} ... </code></pre> <p>Thanks all.</p>
[ { "answer_id": 210102, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 5, "selected": true, "text": "// matches \"test=, test\"\n(\\S+?)=\n\nor\n\n// matches \"test=, test\" too\n(\\S[^=]+)=\n" }, { "answer_id": 210108, ...
2008/10/16
[ "https://Stackoverflow.com/questions/210080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14230/" ]
210,088
<p>I have a website that is deployed between 3 different environments - Dev, Stage, and Prod. For Stage and Prod, the site can resolve local paths to images with just the base url to the file, such as /SiteImages/banner.png. However, on the Dev server I have to hard code the full URL of the image path for the image to be resolved, such as <a href="http://server/folder/SiteImages/banner.png" rel="nofollow noreferrer">http://server/folder/SiteImages/banner.png</a>. Is there a setting I can flip to make the Dev server behave in the same manner as the other 2? I am using IIS 6.0 on a Win 2003 server. </p>
[ { "answer_id": 210102, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 5, "selected": true, "text": "// matches \"test=, test\"\n(\\S+?)=\n\nor\n\n// matches \"test=, test\" too\n(\\S[^=]+)=\n" }, { "answer_id": 210108, ...
2008/10/16
[ "https://Stackoverflow.com/questions/210088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1284/" ]
210,094
<p>There is a store procedure that uses FREETEXTTABLE twice on two tables and then merges the results and returns the top 50. </p> <p>The problem is if I do a search on "Women of Brewster", the results returns "Confession of an ex doofus motha" with a rank of 143 from table A and second "Women of Brewster Place" with a rank of 102 from table B.</p> <p>Is this because of the count? (Table A return results total is 2399. Table B return results total is 3445.)</p>
[ { "answer_id": 67916046, "author": "pj2494", "author_id": 5018023, "author_profile": "https://Stackoverflow.com/users/5018023", "pm_score": 0, "selected": false, "text": "USE AdventureWorks2012; \nGO \n \nSELECT FT_TBL.Description \n ,KEY_TBL.RANK \nFROM Production.ProductDescrip...
2008/10/16
[ "https://Stackoverflow.com/questions/210094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8737/" ]