qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
340,708
<p>I want to use jQuery with a GridView which contains textboxes, but I'm stuck on how to get event listeners registered for every textbox on the selected row. I was thinking I could do something with a StingBuilder in the Unload event of the GridView but I can't get it working.</p>
[ { "answer_id": 340795, "author": "BigJump", "author_id": 8542, "author_profile": "https://Stackoverflow.com/users/8542", "pm_score": 2, "selected": true, "text": "<p>Why not just add a CSS class to each TextBox and use a jQuery selector to find them?</p>\n\n<pre><code>&lt;asp:GridView ru...
2008/12/04
[ "https://Stackoverflow.com/questions/340708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30512/" ]
I want to use jQuery with a GridView which contains textboxes, but I'm stuck on how to get event listeners registered for every textbox on the selected row. I was thinking I could do something with a StingBuilder in the Unload event of the GridView but I can't get it working.
Why not just add a CSS class to each TextBox and use a jQuery selector to find them? ``` <asp:GridView runat="server"> <Columns> <asp:BoundField ControlStyle-CssClass="someclass" DataField="xxx" /> </Columns> </asp:GridView> ``` Then you should be able to do... ``` $().ready(function() { $(".someclass").f...
340,748
<p>I was writing some code, and I notice a pattern in the exception handling that got me thinking:</p> <pre><code>try{ // do stuff... throws JMS, Create and NamingException } catch (NamingException e) { log1(e); rollback(); doSomething(e) } catch (CreateException e) { log1(e); ...
[ { "answer_id": 340766, "author": "Marko", "author_id": 31141, "author_profile": "https://Stackoverflow.com/users/31141", "pm_score": 0, "selected": false, "text": "<p>I would like if it would be possible to do some pattern matching on exception type as a syntactic addiotion. Something li...
2008/12/04
[ "https://Stackoverflow.com/questions/340748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35323/" ]
I was writing some code, and I notice a pattern in the exception handling that got me thinking: ``` try{ // do stuff... throws JMS, Create and NamingException } catch (NamingException e) { log1(e); rollback(); doSomething(e) } catch (CreateException e) { log1(e); rollback();...
They are considering an extension of this type for Java 7. See: <http://tech.puredanger.com/java7#catch>
340,787
<p>I have a XML with a structure similar to this:</p> <pre><code>&lt;category&gt; &lt;subCategoryList&gt; &lt;category&gt; &lt;/category&gt; &lt;category&gt; &lt;!--and so on --&gt; &lt;/category&gt; &lt;/subCategoryList&gt; &lt;/category&gt; </code></pre> <p>I have a Category ...
[ { "answer_id": 340831, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 2, "selected": false, "text": "<p>I believe the XPath expression for this would be \"<code>//category/subCategoryList/category</code>\". If you just want t...
2008/12/04
[ "https://Stackoverflow.com/questions/340787", "https://Stackoverflow.com", "https://Stackoverflow.com/users/314728/" ]
I have a XML with a structure similar to this: ``` <category> <subCategoryList> <category> </category> <category> <!--and so on --> </category> </subCategoryList> </category> ``` I have a Category class that has a `subcategory` list (`List<Category>`). I'm trying to parse this...
[This link](http://www.roseindia.net/tutorials/xPath/java-xpath.shtml) has everything you need. In shorts: ``` public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException, XPathExpressionException { DocumentBuilderFactory domFactory = DocumentBuilderF...
340,790
<p>I have the following problem: Multithreaded WPF application, Model View Presenter Implementation. Presenters and Views that belong together are created on a separate thread and get a separate Dispatcher. Now someone calls from another thread a method on the Presenter. I am intercepting the call, and now begins the p...
[ { "answer_id": 340968, "author": "jyoung", "author_id": 14841, "author_profile": "https://Stackoverflow.com/users/14841", "pm_score": 2, "selected": false, "text": "<pre><code>if( presenterDispatcherObject.CheckAccess() )\n Doit();\nelse\n presenterDispatcherObject.BeginInvoke( Dispat...
2008/12/04
[ "https://Stackoverflow.com/questions/340790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have the following problem: Multithreaded WPF application, Model View Presenter Implementation. Presenters and Views that belong together are created on a separate thread and get a separate Dispatcher. Now someone calls from another thread a method on the Presenter. I am intercepting the call, and now begins the prob...
``` if( presenterDispatcherObject.CheckAccess() ) Doit(); else presenterDispatcherObject.BeginInvoke( DispatcherPriority.Normal, () => DoIt() ); ```
340,827
<p>I am attempting to mock a call to an indexed property. I.e. I would like to moq the following:</p> <pre><code>object result = myDictionaryCollection["SomeKeyValue"]; </code></pre> <p>and also the setter value</p> <pre><code>myDictionaryCollection["SomeKeyValue"] = myNewValue; </code></pre> <p>I am doing this bec...
[ { "answer_id": 359123, "author": "Mike Scott", "author_id": 43649, "author_profile": "https://Stackoverflow.com/users/43649", "pm_score": 7, "selected": false, "text": "<p>It's not clear what you're trying to do because you don't show the declaration of the mock. Are you trying to mock a...
2008/12/04
[ "https://Stackoverflow.com/questions/340827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31128/" ]
I am attempting to mock a call to an indexed property. I.e. I would like to moq the following: ``` object result = myDictionaryCollection["SomeKeyValue"]; ``` and also the setter value ``` myDictionaryCollection["SomeKeyValue"] = myNewValue; ``` I am doing this because I need to mock the functionality of a class ...
It appears that what I was attempting to do with MOQ is not possible. Essentially I was attempting to MOQ a HTTPSession type object, where the key of the item being set to the index could only be determined at runtime. Access to the indexed property needed to return the value which was previously set. This works for i...
340,842
<p>This works:</p> <pre><code>constructor TMyObj.Create; begin inherited; end; </code></pre> <p>Why this is not working also?</p> <pre><code>function TMyObjEx.Import(CONST FileName: string; CONST x, y, z: Integer): string; begin result:= inherited; // Import(FileName, x, y, z); &lt;--- Compiler says: "incompatibl...
[ { "answer_id": 340893, "author": "Rob Kennedy", "author_id": 33732, "author_profile": "https://Stackoverflow.com/users/33732", "pm_score": 1, "selected": false, "text": "<p>At first I thought you could just use <code>inherited</code> if you were uninterested in the function's result, tha...
2008/12/04
[ "https://Stackoverflow.com/questions/340842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This works: ``` constructor TMyObj.Create; begin inherited; end; ``` Why this is not working also? ``` function TMyObjEx.Import(CONST FileName: string; CONST x, y, z: Integer): string; begin result:= inherited; // Import(FileName, x, y, z); <--- Compiler says: "incompatible types" //do other stuff here end; ``...
The automatic parameters passing just does not work when you need the result of the method. You need to fill in the name of the method and the parameters, sorry.
340,888
<p>I've just done my first little webapp in django and I love it. I'm about to start on converting an old production PHP site into django and as part its template, there is a navigation bar.</p> <p>In PHP, I check each nav option's URL against the current URL, in the template code and apply a CSS class if they line up...
[ { "answer_id": 340994, "author": "Corey", "author_id": 1595, "author_profile": "https://Stackoverflow.com/users/1595", "pm_score": 2, "selected": false, "text": "<p>You could use the <a href=\"http://docs.djangoproject.com/en/dev/topics/http/urls/?from=olddocs#reverse\" rel=\"nofollow no...
2008/12/04
[ "https://Stackoverflow.com/questions/340888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12870/" ]
I've just done my first little webapp in django and I love it. I'm about to start on converting an old production PHP site into django and as part its template, there is a navigation bar. In PHP, I check each nav option's URL against the current URL, in the template code and apply a CSS class if they line up. It's hor...
I use template inheritance to customize navigation. For example: base.html ``` <html> <head>...</head> <body> ... {% block nav %} <ul id="nav"> <li>{% block nav-home %}<a href="{% url 'home' %}">Home</a>{% endblock %}</li> <li>{% block nav-about %}<a href="{% ur...
340,943
<p>How would I go about dynamically allocating a multi-dimensional array?</p>
[ { "answer_id": 340970, "author": "eplawless", "author_id": 1370, "author_profile": "https://Stackoverflow.com/users/1370", "pm_score": 2, "selected": false, "text": "<p>Here's the implementation I've got; I declare a single contiguous block of <code>int</code>s instead of creating new bl...
2008/12/04
[ "https://Stackoverflow.com/questions/340943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1370/" ]
How would I go about dynamically allocating a multi-dimensional array?
If you know the size of nested dimensions already, you can also literally allocate a multi dimensional array using new: ``` typedef int dimensions[3][4]; dimensions * dim = new dimensions[10]; dim[/* from 0 to 9 */][/* from 0 to 2 */][/* from 0 to 3 */] = 42; delete [] dim; ``` instead of `10`, a runtime determined...
340,981
<p>Is it possible to just send a JPanel or any other component to the printer? Or do I have to implement all the drawing to the graphics object by hand?</p> <p>I have tried to use the Print* functions of the JPanel to print to the graphics object but the page that gets printed is blank.</p>
[ { "answer_id": 341070, "author": "Michael Myers", "author_id": 13531, "author_profile": "https://Stackoverflow.com/users/13531", "pm_score": 1, "selected": false, "text": "<p><a href=\"http://java.sun.com/docs/books/tutorial/2d/printing/gui.html\" rel=\"nofollow noreferrer\">This tutoria...
2008/12/04
[ "https://Stackoverflow.com/questions/340981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34145/" ]
Is it possible to just send a JPanel or any other component to the printer? Or do I have to implement all the drawing to the graphics object by hand? I have tried to use the Print\* functions of the JPanel to print to the graphics object but the page that gets printed is blank.
Check out the Java printing API [and tutorial](http://java.sun.com/docs/books/tutorial/2d/printing/gui.html) along with JComponent.print(Graphics). Here is a rudimentary class which will print any component which fits on 1 page (I can't take credit for this, I got the code from [Marty Hall's tutorial](http://courseweb...
340,983
<p>Is there a better, more jQuery-ish way of handling this image substitution?</p> <pre><code>var image = $(obj).children("img"); if ($(image).attr("src") == "Images/TreeCollapse.gif") $(image).attr("src", "Images/TreeExpand.gif"); else $(image).attr("src", "Images/TreeCollapse.gif"); </code></pre>
[ { "answer_id": 341030, "author": "Jeremy B.", "author_id": 28567, "author_profile": "https://Stackoverflow.com/users/28567", "pm_score": 0, "selected": false, "text": "<p>Not really.</p>\n\n<p>I know... extremely helpful answer. What you are doing is pretty succinct and I'm not so sure ...
2008/12/04
[ "https://Stackoverflow.com/questions/340983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/343/" ]
Is there a better, more jQuery-ish way of handling this image substitution? ``` var image = $(obj).children("img"); if ($(image).attr("src") == "Images/TreeCollapse.gif") $(image).attr("src", "Images/TreeExpand.gif"); else $(image).attr("src", "Images/TreeCollapse.gif"); ```
Why set a variable when it isn't needed? ``` $(obj).children("img").toggle( function(){ $(this).attr("src", "Images/TreeExpand.gif"); }, function(){ $(this).attr("src", "Images/TreeCollapse.gif"); } ); ```
340,984
<p>Here is a simple overview of my directory layout for my views:</p> <p>Project</p> <ul> <li>Page 1</li> <li>Page 2</li> <li>RSS</li> </ul> <p>Issues</p> <ul> <li>Page 1</li> <li>Page 2</li> <li>RSS</li> </ul> <p>I am using forms authentication to deny access to all unauthenticated users, that works fine. However...
[ { "answer_id": 341023, "author": "Chris James", "author_id": 3193, "author_profile": "https://Stackoverflow.com/users/3193", "pm_score": 2, "selected": false, "text": "<p>This was actually much simpler than I thought. Seems .net is quite clever, I tried the following:</p>\n\n<pre><code> ...
2008/12/04
[ "https://Stackoverflow.com/questions/340984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3193/" ]
Here is a simple overview of my directory layout for my views: Project * Page 1 * Page 2 * RSS Issues * Page 1 * Page 2 * RSS I am using forms authentication to deny access to all unauthenticated users, that works fine. However, I want to be able to grant access to the RSS views to everyone (so they can subscribe ...
Forget about the <location><allow /><deny /> stuff... sounds like you need to use the [Authorize] attribute on your actions. Check out these pages for more info: <http://www.asp.net/learn/mvc/tutorial-17-cs.aspx> <http://www.pnpguidance.net/post/ASPNETMVCFrameworkPreview4HandleErrorAuthorizeOutputCacheActionFilterAttr...
340,989
<p>I have the following dead simple elisp functions; the first removes the fill breaks from the current paragraph, and the second loops through the current document applying the first to each paragraph in turn, in effect removing all single line-breaks from the document. It runs fast on my low-spec Puppy Linux box usi...
[ { "answer_id": 341002, "author": "Marko", "author_id": 31141, "author_profile": "https://Stackoverflow.com/users/31141", "pm_score": 3, "selected": true, "text": "<p>As the first try, you should download and install Emacs 22.3 for your Windows box and then compare the speed.</p>\n\n<p>Sp...
2008/12/04
[ "https://Stackoverflow.com/questions/340989", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21778/" ]
I have the following dead simple elisp functions; the first removes the fill breaks from the current paragraph, and the second loops through the current document applying the first to each paragraph in turn, in effect removing all single line-breaks from the document. It runs fast on my low-spec Puppy Linux box using e...
As the first try, you should download and install Emacs 22.3 for your Windows box and then compare the speed. Speed difference shouldn't be that big after upgrade.
340,997
<p>I have inherited a Java applet (an actual &lt;APPLET&gt;) which throws an OutOfMemory exception after about 4 days of runtime. The nature of the applet is such that people really will leave it open for long periods of time.</p> <p>After almost two days running, jmap -histo shows the top heap consumers as:</p> <pre...
[ { "answer_id": 341946, "author": "Tom Hawtin - tackline", "author_id": 4725, "author_profile": "https://Stackoverflow.com/users/4725", "pm_score": 2, "selected": false, "text": "<p>Yup, looks like you are leaking class loaders. If you're not actually creating class loaders in you own cod...
2008/12/04
[ "https://Stackoverflow.com/questions/340997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4761/" ]
I have inherited a Java applet (an actual <APPLET>) which throws an OutOfMemory exception after about 4 days of runtime. The nature of the applet is such that people really will leave it open for long periods of time. After almost two days running, jmap -histo shows the top heap consumers as: ``` num #instances...
Yup, looks like you are leaking class loaders. If you're not actually creating class loaders in you own code (typically through URLClassLoader.newInstance or XSLT) then it may be related to reloading the applet (although you would usually get back the same class loader). Possible causes of leaks are ThreadLocal, JDBC d...
340,998
<p>I need to update a group of cells by inserting the same two characters into all of them, but I'm just drawing a blank on how to do this. Could someone point me in the right direction?</p> <p><b>Old Cells</b><br> HI.1 <br> HI.2<br> HII.1</p> <p><b>New Cells</b><br> H08I.1<br> H08I.2<br> H08II.1</p>
[ { "answer_id": 341013, "author": "Tony Andrews", "author_id": 18747, "author_profile": "https://Stackoverflow.com/users/18747", "pm_score": 2, "selected": false, "text": "<p>If all your cells look like that:</p>\n\n<pre><code>update cells\nset cell = Replace(cell,'H','H08');\n</code></pr...
2008/12/04
[ "https://Stackoverflow.com/questions/340998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21717/" ]
I need to update a group of cells by inserting the same two characters into all of them, but I'm just drawing a blank on how to do this. Could someone point me in the right direction? **Old Cells** HI.1 HI.2 HII.1 **New Cells** H08I.1 H08I.2 H08II.1
``` UPDATE Cells SET Cell = LEFT(Cell, 1) + '08' + SUBSTRING(Cell, 1, LEN(Cell)-1) ```
341,005
<p>Suppose you're maintaining an API that was originally released years ago (before java gained <code>enum</code> support) and it defines a class with enumeration values as ints:</p> <pre><code>public class VitaminType { public static final int RETINOL = 0; public static final int THIAMIN = 1; public static final i...
[ { "answer_id": 341064, "author": "Darron", "author_id": 22704, "author_profile": "https://Stackoverflow.com/users/22704", "pm_score": 1, "selected": false, "text": "<p>There is a rumor that the creator of \"make\" realized that the syntax of Makefiles was bad, but felt that he couldn't c...
2008/12/04
[ "https://Stackoverflow.com/questions/341005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24173/" ]
Suppose you're maintaining an API that was originally released years ago (before java gained `enum` support) and it defines a class with enumeration values as ints: ``` public class VitaminType { public static final int RETINOL = 0; public static final int THIAMIN = 1; public static final int RIBOFLAVIN = 2; } ```...
Personal opinion is that it's probably not worth the effort of trying to convert. For one thing, the "public static final int" idiom isn't going away any time soon, given that it's sprinkled liberally all over the JDK. For another, tracking down usages of the original ints is likely to be really unpleasant, given that ...
341,036
<p>My app (winforms .net 2.0 / vs2008) works fine on my dev machine but on one of test machines i'm getting this exception. Has anybody encountered something similar?</p> <pre> ************** Exception Text ************** Microsoft.Reporting.WinForms.LocalProcessingException: An error occurred during local report proc...
[ { "answer_id": 341042, "author": "Brian", "author_id": 19299, "author_profile": "https://Stackoverflow.com/users/19299", "pm_score": 3, "selected": false, "text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/system.uri.fragment.aspx\" rel=\"noreferrer\">http://msdn.microsoft.com...
2008/12/04
[ "https://Stackoverflow.com/questions/341036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39656/" ]
My app (winforms .net 2.0 / vs2008) works fine on my dev machine but on one of test machines i'm getting this exception. Has anybody encountered something similar? ``` ************** Exception Text ************** Microsoft.Reporting.WinForms.LocalProcessingException: An error occurred during local report processing. ...
The value after the hash is not transmitted to the server. There's another SO question about that somewhere, but I'm having trouble finding it. Likewise it's taken me a while to find a decent reference to cite, but [this Wikipedia article](http://en.wikipedia.org/wiki/Fragment_identifier) has some confirmation: > > T...
341,074
<p>Without using plpgsql, I'm trying to urlencode a given text within a pgsql SELECT statement.</p> <p>The problem with this approach:</p> <pre><code>select regexp_replace('héllo there','([^A-Za-z0-9])','%' || encode(E'\\1','hex'),'g') </code></pre> <p>...is that the encode function is not passed the regexp paramete...
[ { "answer_id": 341240, "author": "Kev", "author_id": 16777, "author_profile": "https://Stackoverflow.com/users/16777", "pm_score": 4, "selected": true, "text": "<pre><code>select regexp_replace(encode('héllo there','hex'),'(..)',E'%\\\\1','g');\n</code></pre>\n\n<p>This doesn't leave the...
2008/12/04
[ "https://Stackoverflow.com/questions/341074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16777/" ]
Without using plpgsql, I'm trying to urlencode a given text within a pgsql SELECT statement. The problem with this approach: ``` select regexp_replace('héllo there','([^A-Za-z0-9])','%' || encode(E'\\1','hex'),'g') ``` ...is that the encode function is not passed the regexp parameter, unless there's another way to ...
``` select regexp_replace(encode('héllo there','hex'),'(..)',E'%\\1','g'); ``` This doesn't leave the alphanumeric characters human-readable, though.
341,080
<p>I am attempting to get a DropDownList to AutoPostBack via an UpdatePanel when the selected item is changed. I'm going a little stir-crazy as to why this isn't working.</p> <p>Does anyone have any quick ideas?</p> <p>ASPX page:</p> <pre><code>&lt;asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always"...
[ { "answer_id": 341147, "author": "Programmin Tool", "author_id": 21691, "author_profile": "https://Stackoverflow.com/users/21691", "pm_score": 4, "selected": true, "text": "<p>I was able to get it to work with what you posted. This is the code I used... Basically what you had but I am t...
2008/12/04
[ "https://Stackoverflow.com/questions/341080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38522/" ]
I am attempting to get a DropDownList to AutoPostBack via an UpdatePanel when the selected item is changed. I'm going a little stir-crazy as to why this isn't working. Does anyone have any quick ideas? ASPX page: ``` <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" ChildrenAsTriggers="true" > ...
I was able to get it to work with what you posted. This is the code I used... Basically what you had but I am throwing an exception. ``` <asp:ScriptManager ID="smMain" runat="server" /> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" ChildrenAsTriggers="true" > <ContentTemplat...
341,086
<p>I need advice regarding subselect performance in MySQL. For a reason that I can't change, I am not able to use JOIN to create quesry filter, I can only add another AND clause in WHERE.</p> <p>What is the peformance of:</p> <pre><code>select tasks.* from tasks where some criteria and task.project_id not in (se...
[ { "answer_id": 341124, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 4, "selected": true, "text": "<p>I believe that the second is more efficient as it requires only one select, but to be sure, you should EXPLAIN each q...
2008/12/04
[ "https://Stackoverflow.com/questions/341086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31141/" ]
I need advice regarding subselect performance in MySQL. For a reason that I can't change, I am not able to use JOIN to create quesry filter, I can only add another AND clause in WHERE. What is the peformance of: ``` select tasks.* from tasks where some criteria and task.project_id not in (select id from project ...
I believe that the second is more efficient as it requires only one select, but to be sure, you should EXPLAIN each query and check the results. ``` EXPLAIN select tasks.* from tasks where some criteria and task.project_id not in (select id from project where project.is_template = 1); EXPLAIN select tasks.* from...
341,103
<p>I have this C# extension method that will extend any dictionary where the <em>Value</em> type is an <em>IList</em>. When I write the equivalent code in VB.Net I get the following compile error:</p> <blockquote> <p><em>"Extension method 'Add' has some type constraints that can never be satisfied".</em></p> </bloc...
[ { "answer_id": 341195, "author": "csgero", "author_id": 21764, "author_profile": "https://Stackoverflow.com/users/21764", "pm_score": 0, "selected": false, "text": "<p>I would suspect that the problem is that you used ValueType for as the name for one of the type parameters, which is an ...
2008/12/04
[ "https://Stackoverflow.com/questions/341103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39277/" ]
I have this C# extension method that will extend any dictionary where the *Value* type is an *IList*. When I write the equivalent code in VB.Net I get the following compile error: > > *"Extension method 'Add' has some type constraints that can never be satisfied".* > > > I find this really puzzling as the **same*...
The problem only happens when `<System.Runtime.CompilerServices.Extension()>` is present. The VB compiler imposes a restriction that the constraints must be verifiable with the first argument alone. Since the first argument for the extension method (`Dictionary(Of KeyType, ListType)`) is dependant upon the third argum...
341,112
<p>How to call a javascript file (.js) via Excel VBA?</p> <hr> <p>So as i am opposed to the same kind of problem i'll try to submit you guys my case.</p> <p>I am trying to automate datas extraction from valeo's catalogue using excel vba macro.</p> <p>I have a list of références attached to valeo's automotive produc...
[ { "answer_id": 341160, "author": "Dirk Vollmar", "author_id": 40347, "author_profile": "https://Stackoverflow.com/users/40347", "pm_score": 0, "selected": false, "text": "<p>I don't think that there is a direct way to run JavaScript code in VBA. </p>\n\n<p>What you could try to do is to ...
2008/12/04
[ "https://Stackoverflow.com/questions/341112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How to call a javascript file (.js) via Excel VBA? --- So as i am opposed to the same kind of problem i'll try to submit you guys my case. I am trying to automate datas extraction from valeo's catalogue using excel vba macro. I have a list of références attached to valeo's automotive products (huge list, as more th...
All the previously suggested approaches sound hacky to me. For a more reliable solution, embed the Javascript in a COM component via [Windows Script Components](http://msdn.microsoft.com/en-us/library/07zhfkh8(VS.85).aspx), and call the Javascript-based COM component as you would any other COM component.
341,118
<p>In order to reference a member of a class in XML comments/documentation, you have to use the following tag:</p> <pre><code>&lt;see cref="member"/&gt; </code></pre> <p>It is better explained <a href="http://msdn.microsoft.com/en-us/library/acd0tfbe.aspx" rel="noreferrer">here</a>.</p> <p><strong>How do you referen...
[ { "answer_id": 341149, "author": "leppie", "author_id": 15541, "author_profile": "https://Stackoverflow.com/users/15541", "pm_score": 5, "selected": true, "text": "<pre><code>&lt;see cref=\"P:System.Collections.ArrayList.Item(System.Int32)\" /&gt;\n</code></pre>\n" }, { "answer_i...
2008/12/04
[ "https://Stackoverflow.com/questions/341118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1679/" ]
In order to reference a member of a class in XML comments/documentation, you have to use the following tag: ``` <see cref="member"/> ``` It is better explained [here](http://msdn.microsoft.com/en-us/library/acd0tfbe.aspx). **How do you reference an *indexer*?** I mean, a member like this one: ``` internal object ...
``` <see cref="P:System.Collections.ArrayList.Item(System.Int32)" /> ```
341,143
<p>Say I have a Rails Model called Thing. Thing has a url attribute that can <strong>optionally</strong> be set to a URL somewhere on the Internet. In view code, I need logic that does the following:</p> <pre><code>&lt;% if thing.url.blank? %&gt; &lt;%= link_to('Text', thing_path(thing)) %&gt; &lt;% else %&gt; &lt;%= ...
[ { "answer_id": 341166, "author": "Josh Delsman", "author_id": 40644, "author_profile": "https://Stackoverflow.com/users/40644", "pm_score": 4, "selected": false, "text": "<p>Any logic having to do with what is displayed in the view should be delegated to a helper method, as methods in th...
2008/12/04
[ "https://Stackoverflow.com/questions/341143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32137/" ]
Say I have a Rails Model called Thing. Thing has a url attribute that can **optionally** be set to a URL somewhere on the Internet. In view code, I need logic that does the following: ``` <% if thing.url.blank? %> <%= link_to('Text', thing_path(thing)) %> <% else %> <%= link_to('Text', thing.url) %> <% end %> ``` Th...
In Rails 3 and higher: ``` Rails.application.routes.url_helpers ``` e.g. ``` Rails.application.routes.url_helpers.posts_path Rails.application.routes.url_helpers.posts_url(:host => "example.com") ```
341,156
<p>Is there an EF equivalent to LINQ to SQL's OnCreated partial? </p> <p>Several of my objects have XML fields that I would like to parse whenever the object is loaded from the db - I'd like to put the XML data into more friendly strongly-typed collections. I've already marked the XML field as private and hooked the S...
[ { "answer_id": 341301, "author": "David Schmitt", "author_id": 4918, "author_profile": "https://Stackoverflow.com/users/4918", "pm_score": 3, "selected": true, "text": "<p>There is no <code>OnLoaded</code> event or similar as far as I know. A workaround might be to expose the collections...
2008/12/04
[ "https://Stackoverflow.com/questions/341156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/521/" ]
Is there an EF equivalent to LINQ to SQL's OnCreated partial? Several of my objects have XML fields that I would like to parse whenever the object is loaded from the db - I'd like to put the XML data into more friendly strongly-typed collections. I've already marked the XML field as private and hooked the SavingChang...
There is no `OnLoaded` event or similar as far as I know. A workaround might be to expose the collections as properties and lazily create/parse the values on first access: ``` private List<SomeData> _parsedDataCache; public IList<SomeData> ParsedData { get { if (_parsedDataCache == null) ParseD...
341,168
<p>My installer build "signs" a DLL using a Code Signing certificate during the build process. </p> <p>I've noticed that if I try to build twice in succession, the second build fails because the DLL is already signed so signcode chokes. Obviously I can fix this by signing a copy of the DLL in the build, but the proble...
[ { "answer_id": 482372, "author": "Die in Sente", "author_id": 40756, "author_profile": "https://Stackoverflow.com/users/40756", "pm_score": 3, "selected": false, "text": "<p>Sure it's possible, but not trivial.</p>\n\n<p>Although it would be easier to save a copy of the presigned DLL.</p...
2008/12/04
[ "https://Stackoverflow.com/questions/341168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1737/" ]
My installer build "signs" a DLL using a Code Signing certificate during the build process. I've noticed that if I try to build twice in succession, the second build fails because the DLL is already signed so signcode chokes. Obviously I can fix this by signing a copy of the DLL in the build, but the problem intrigue...
``` signtool remove /s C:\path\to.exe.or.dll ``` [signtool](https://msdn.microsoft.com/en-us/library/windows/desktop/aa387764(v=vs.85).aspx) is available in Windows SDK, and must be at least from Windows 8 SDK kit (version 6.2.9200.20789) to have the `remove` command supported.
341,175
<p>I have a datetime coming back from an XML file in the format:</p> <blockquote> <p>20080916 11:02</p> </blockquote> <p>as in </p> <blockquote> <p>yyyymm hh:ss</p> </blockquote> <p>How can i get the datetime.parse function to pick up on this? Ie parse it without erroring? Cheers</p>
[ { "answer_id": 341200, "author": "Blair Conrad", "author_id": 1199, "author_profile": "https://Stackoverflow.com/users/1199", "pm_score": 9, "selected": true, "text": "<pre><code>DateTime.ParseExact(input,\"yyyyMMdd HH:mm\",null);\n</code></pre>\n\n<p>assuming you meant to say that minut...
2008/12/04
[ "https://Stackoverflow.com/questions/341175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35441/" ]
I have a datetime coming back from an XML file in the format: > > 20080916 11:02 > > > as in > > yyyymm hh:ss > > > How can i get the datetime.parse function to pick up on this? Ie parse it without erroring? Cheers
``` DateTime.ParseExact(input,"yyyyMMdd HH:mm",null); ``` assuming you meant to say that minutes followed the hours, not seconds - your example is a little confusing. The [ParseExact documentation](http://msdn.microsoft.com/en-us/library/system.datetime.parseexact(VS.80).aspx) details other overloads, in case you w...
341,190
<p>I currently have a .net SOAP web service with a timeout on the request that I set using</p> <pre><code>Server.ScriptTimeout = TIME_OUT; </code></pre> <p>I then have java client calling said web service. However when the timeout is reached I get this exception:</p> <pre><code>Exception in thread "Thread-9" com.sun...
[ { "answer_id": 341234, "author": "Sunny Milenov", "author_id": 8220, "author_profile": "https://Stackoverflow.com/users/8220", "pm_score": 0, "selected": false, "text": "<p>You can make your webservice <a href=\"http://msdn.microsoft.com/en-us/library/aa480516.aspx\" rel=\"nofollow noref...
2008/12/04
[ "https://Stackoverflow.com/questions/341190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20774/" ]
I currently have a .net SOAP web service with a timeout on the request that I set using ``` Server.ScriptTimeout = TIME_OUT; ``` I then have java client calling said web service. However when the timeout is reached I get this exception: ``` Exception in thread "Thread-9" com.sun.xml.ws.server.UnsupportedMediaExcept...
This is a [known issue](https://jax-ws.dev.java.net/issues/show_bug.cgi?id=566) with Sun's JAX-WS stack. For reference, the HTTP 500 code actually means that the server had an Internal Server Error. I'm not sure why .NET sends that rather than HTTP 503 Service Unavailable.
341,192
<p>OK - I have an interesting one here. I'm working on a tetris clone (basically to "level-up" my skills). I was trying to refactor my code to get it abstracted the way I wanted it. While it was working just fine before, now I get a segmentation fault before any images can be blitted. I've tried debugging it to no ...
[ { "answer_id": 341302, "author": "UberJumper", "author_id": 34395, "author_profile": "https://Stackoverflow.com/users/34395", "pm_score": 0, "selected": false, "text": "<p>I don't have SDL installed on my machine, but after looking through the code.</p>\n\n<p>I noticed this in the Output...
2008/12/04
[ "https://Stackoverflow.com/questions/341192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3831/" ]
OK - I have an interesting one here. I'm working on a tetris clone (basically to "level-up" my skills). I was trying to refactor my code to get it abstracted the way I wanted it. While it was working just fine before, now I get a segmentation fault before any images can be blitted. I've tried debugging it to no avail. ...
Look at line 15 to 18 of Surface.cpp: ``` surface = SDL_DisplayFormatAlpha( tempSurface ); surface = tempSurface; } SDL_FreeSurface( tempSurface ); ``` I assume it segfaults because when you use this surface later, you are actually operating on tempSurface because of this line: ``` surface = tempSurface; `...
341,208
<p>The catch is this is a .NET 1.0 project and there is no hidden field control...</p> <p>So this is out of the question:</p> <pre> <code> &lt;asp HiddenField Runat="server" ID="hdn" /> </code> </pre> <p>I vaguely remember some type of HtmlHiddenInput class that allowed similar functionality...does anybody know how ...
[ { "answer_id": 341217, "author": "Jas", "author_id": 777, "author_profile": "https://Stackoverflow.com/users/777", "pm_score": 0, "selected": false, "text": "<p>just use an asp textbox and the visible=false property</p>\n" }, { "answer_id": 341222, "author": "Cristian Libardo...
2008/12/04
[ "https://Stackoverflow.com/questions/341208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
The catch is this is a .NET 1.0 project and there is no hidden field control... So this is out of the question: ``` <asp HiddenField Runat="server" ID="hdn" /> ``` I vaguely remember some type of HtmlHiddenInput class that allowed similar functionality...does anybody know how to do this? Thanks.
You can use a regular input or create a custom server control. ``` <input type="hidden" runat="server" /> ```
341,221
<p>Here is some sample VBA code:</p> <pre><code>Sub Macro1() Dim pt As PivotTable Set pt = ActiveSheet.PivotTables("SomePivotTable") 'Set colOfFields = pt.PivotFields End Sub </code></pre> <p>The third line is incomplete/broken. What is the correct way to get access to collection of all the fields in a ...
[ { "answer_id": 341495, "author": "Patrick Cuff", "author_id": 7903, "author_profile": "https://Stackoverflow.com/users/7903", "pm_score": 3, "selected": true, "text": "<p>This works for me (Excel 2003 [11.8146.8202] SP2):</p>\n\n<pre><code>Sub Macro1()\n Dim pt As PivotTable\n Dim ...
2008/12/04
[ "https://Stackoverflow.com/questions/341221", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36590/" ]
Here is some sample VBA code: ``` Sub Macro1() Dim pt As PivotTable Set pt = ActiveSheet.PivotTables("SomePivotTable") 'Set colOfFields = pt.PivotFields End Sub ``` The third line is incomplete/broken. What is the correct way to get access to collection of all the fields in a PivotTable? I need to be a...
This works for me (Excel 2003 [11.8146.8202] SP2): ``` Sub Macro1() Dim pt As PivotTable Dim col As PivotFields Dim c As PivotField ' Name of the pivot table comes from right clicking on the pivot table, ' Table Options..., Name field. Set pt = ActiveSheet.PivotTables("PivotTable1") Set co...
341,232
<p>In postgres you can do a comparison against multiple items like so:</p> <pre><code> SELECT 'test' IN ('not','in','here'); </code></pre> <p>Which is the same as doing:</p> <pre><code> SELECT ('test' = 'not' OR 'test' = 'in' OR 'test' = 'here'); </code></pre> <p>Is there a functional equivalent for SQL Server ?</...
[ { "answer_id": 341278, "author": "Scott Ivey", "author_id": 36297, "author_profile": "https://Stackoverflow.com/users/36297", "pm_score": 0, "selected": false, "text": "<p>this should give similar results in all recent versions of MSSQL. You could also write a scalar function to shorten...
2008/12/04
[ "https://Stackoverflow.com/questions/341232", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43278/" ]
In postgres you can do a comparison against multiple items like so: ``` SELECT 'test' IN ('not','in','here'); ``` Which is the same as doing: ``` SELECT ('test' = 'not' OR 'test' = 'in' OR 'test' = 'here'); ``` Is there a functional equivalent for SQL Server ?
It is supported, but you will need to put the expression somewhere that accepts a boolean expression. For example, in a `case` statement: ``` select case when 'test' in ('not','in','here') then 1 else 0 end ----------- 0 (1 row(s) affected) ``` Or a `where` clause: ``` select * from T where C in (1,3,5,7,9)...
341,239
<p>I'm a newbie in the great world of NHibernate. I'm using version 2.0.1.GA. Here's my question. I have a table <code>Cars</code> with column <code>Manufacturer(nvarchar(50))</code> and a primary key <code>ID(int)</code>. My .NET class is:</p> <pre><code>public class Car { public virtual int ID { get; set; } ...
[ { "answer_id": 341382, "author": "Matt Briggs", "author_id": 10771, "author_profile": "https://Stackoverflow.com/users/10771", "pm_score": 2, "selected": false, "text": "<p>You could probably do this with NHibernate.Linq. It is in a usable form, but still a ways from being complete. Its ...
2008/12/04
[ "https://Stackoverflow.com/questions/341239", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42377/" ]
I'm a newbie in the great world of NHibernate. I'm using version 2.0.1.GA. Here's my question. I have a table `Cars` with column `Manufacturer(nvarchar(50))` and a primary key `ID(int)`. My .NET class is: ``` public class Car { public virtual int ID { get; set; } public virtual string Manufacturer { get; set; ...
Like Google Ninja said, you can do it with NHibernate.Linq. The query would then be: `session.Linq<Car>.Where(c => c.Manufacturer == "Mercedes").ToList()` If someone ends up here and is using NH3.0 the syntax is just a tad different (thanks to Michael Mrozek and Mike for the suggestion): `session.Query<Car>.Where(c ...
341,243
<p>Does anyone know how to get the Video Ram of a PC from a WMI call?</p> <p>I've seen calls to the Win32_VideoController management object's AdapterRAM property, but that only gives the system memory, and is not representative of the video RAM at all.</p>
[ { "answer_id": 341270, "author": "Dan Esparza", "author_id": 19020, "author_profile": "https://Stackoverflow.com/users/19020", "pm_score": 2, "selected": false, "text": "<p>From <a href=\"http://www.microsoft.com/technet/scriptcenter/scripts/\" rel=\"nofollow noreferrer\">The Microsoft T...
2008/12/04
[ "https://Stackoverflow.com/questions/341243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12497/" ]
Does anyone know how to get the Video Ram of a PC from a WMI call? I've seen calls to the Win32\_VideoController management object's AdapterRAM property, but that only gives the system memory, and is not representative of the video RAM at all.
Turns out it was the adapter RAM returned, and through an unfortunate coincidence, the wrong conversion was used and gave the system RAM...on two different systems. Thanks for pushing us to look again. For what it's worth, in a C# WinForms app: ``` int _ram = 0; ManagementObjectSearcher searcher = new ManagementObje...
341,256
<p>I'm having trouble resizing a tableHeaderView. It simple doesn't work.</p> <p>1) Create a UITableView and UIView (100 x 320 px);</p> <p>2) Set the UIView as tableHeaderView of the UITableView;</p> <p>3) Build and Go. Everything is ok.</p> <p>Now, I want to resizing the tableHeaderView, so I add this code in view...
[ { "answer_id": 342605, "author": "codelogic", "author_id": 43427, "author_profile": "https://Stackoverflow.com/users/43427", "pm_score": -1, "selected": false, "text": "<p>Did you try\n<code>[self.tableView reloadData]</code> after changing the height?</p>\n" }, { "answer_id": 41...
2008/12/04
[ "https://Stackoverflow.com/questions/341256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43282/" ]
I'm having trouble resizing a tableHeaderView. It simple doesn't work. 1) Create a UITableView and UIView (100 x 320 px); 2) Set the UIView as tableHeaderView of the UITableView; 3) Build and Go. Everything is ok. Now, I want to resizing the tableHeaderView, so I add this code in viewDidLoad: ``` self.tableView.au...
FYI: I've gotten this to work by modifying the tableHeaderView and re-setting it. In this case, i'm adjusting the size of the tableHeaderView when the UIWebView subview has finished loading. ``` [webView sizeToFit]; CGRect newFrame = headerView.frame; newFrame.size.height = newFrame.size.height + webView.frame.size.he...
341,258
<p>I'm trying to use VBA to write a formula into a cell in Excel. My problem is that when I use a semicolon (<code>;</code>) in my formula, I get an error:</p> <blockquote> <p><strong><code>Run-time error 1004</code></strong></p> </blockquote> <p>My macro is the following : </p> <pre><code>Sub Jours_ouvres() D...
[ { "answer_id": 341276, "author": "e.James", "author_id": 33686, "author_profile": "https://Stackoverflow.com/users/33686", "pm_score": 3, "selected": false, "text": "<p>The correct character to use in this case is a full colon (<code>:</code>), not a semicolon (<code>;</code>).</p>\n" ...
2008/12/04
[ "https://Stackoverflow.com/questions/341258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43277/" ]
I'm trying to use VBA to write a formula into a cell in Excel. My problem is that when I use a semicolon (`;`) in my formula, I get an error: > > **`Run-time error 1004`** > > > My macro is the following : ``` Sub Jours_ouvres() Dim Feuille_Document As String Feuille_Document = "DOCUMENT" Ap...
You can try using FormulaLocal property instead of Formula. Then the semicolon should work.
341,264
<p>What is the best way to get the Max value from a LINQ query that may return no rows? If I just do</p> <pre><code>Dim x = (From y In context.MyTable _ Where y.MyField = value _ Select y.MyCounter).Max </code></pre> <p>I get an error when the query returns no rows. I could do</p> <pre><code>Dim x ...
[ { "answer_id": 341313, "author": "David Schmitt", "author_id": 4918, "author_profile": "https://Stackoverflow.com/users/4918", "pm_score": 5, "selected": false, "text": "<p>You could always add <code>Double.MinValue</code> to the sequence. This would ensure that there is at least one ele...
2008/12/04
[ "https://Stackoverflow.com/questions/341264", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23935/" ]
What is the best way to get the Max value from a LINQ query that may return no rows? If I just do ``` Dim x = (From y In context.MyTable _ Where y.MyField = value _ Select y.MyCounter).Max ``` I get an error when the query returns no rows. I could do ``` Dim x = (From y In context.MyTable _ ...
Since `DefaultIfEmpty` isn't implemented in LINQ to SQL, I did a search on the error it returned and found a [fascinating article](http://www.interact-sw.co.uk/iangblog/2007/09/10/linq-aggregates) that deals with null sets in aggregate functions. To summarize what I found, you can get around this limitation by casting ...
341,282
<p>I'm trying to create a function which takes an array as an argument, adds values to it (increasing its size if necessary) and returns the count of items. So far I have:</p> <pre><code>int main(int argc, char** argv) { int mSize = 10; ent a[mSize]; int n; n = addValues(a,mSize); for(i=0;i&lt;n;i...
[ { "answer_id": 341293, "author": "xahtep", "author_id": 42184, "author_profile": "https://Stackoverflow.com/users/42184", "pm_score": 3, "selected": false, "text": "<p>Try reworking it so a pointer to a pointer to the array is passed in, i.e. <code>ent **a</code>. Then you will be able t...
2008/12/04
[ "https://Stackoverflow.com/questions/341282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23746/" ]
I'm trying to create a function which takes an array as an argument, adds values to it (increasing its size if necessary) and returns the count of items. So far I have: ``` int main(int argc, char** argv) { int mSize = 10; ent a[mSize]; int n; n = addValues(a,mSize); for(i=0;i<n;i++) { //Pr...
The main problem here is that you're trying to use realloc with a stack-allocated array. You have: ``` ent a[mSize]; ``` That's automatic allocation on the stack. If you wanted to use realloc() on this later, you would create the array on the heap using malloc(), like this: ``` ent *a = (ent*)malloc(mSize * sizeof(...
341,303
<p>All this originated from me poking at a compiler warning message (C4267) when attempting the following line:</p> <pre><code>const unsigned int nSize = m_vecSomeVec.size(); </code></pre> <p><code>size()</code> returns a size_t which although typedef'd to unsigned int, is not actually a unsigned int. This I believe ...
[ { "answer_id": 341341, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 2, "selected": false, "text": "<p>If <code>size_t</code> is typedef:ed to <code>unsigned int</code>, then of course it is an <code>unsigned int</code>, on...
2008/12/04
[ "https://Stackoverflow.com/questions/341303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18664/" ]
All this originated from me poking at a compiler warning message (C4267) when attempting the following line: ``` const unsigned int nSize = m_vecSomeVec.size(); ``` `size()` returns a size\_t which although typedef'd to unsigned int, is not actually a unsigned int. This I believe have to do with 64 bit portability i...
It depends on the implementation. `std::size_t` for example has a minimal required size. But there is no upper limit. To avoid these kind of situations, always use the proper typedef: ``` const std::vector<T>::size_type nSize = m_vecSomeVec.size(); ``` You will be always on the safe side then.
341,310
<p>Is it possible to get a list of all files modified/added/deleted by a particular user?</p> <p>The goal is to get an idea of what a user did for the day (or date range).</p>
[ { "answer_id": 341457, "author": "shek", "author_id": 40618, "author_profile": "https://Stackoverflow.com/users/40618", "pm_score": 7, "selected": true, "text": "<p>Here's an example, using the <a href=\"http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.log.html\" rel=\"noreferrer\">svn l...
2008/12/04
[ "https://Stackoverflow.com/questions/341310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
Is it possible to get a list of all files modified/added/deleted by a particular user? The goal is to get an idea of what a user did for the day (or date range).
Here's an example, using the [svn log command](http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.log.html) and [linux sed command](http://www.google.com/search?hl=en&q=linux+sed+command), with your username, 'blankman': ``` svn log | sed -n '/blankman/,/-----$/ p' ``` If you're looking to obtain this information with...
341,315
<p>I tried to make the title as clear as possible... here is my scenario:</p> <p>I have 2 tables (let's call them table A and table B) that have a similar schema. I would like write a stored procedure that would select specific columns of data out of table A, and insert this data as a new record in table B.</p> <p>Ca...
[ { "answer_id": 341323, "author": "John Stauffer", "author_id": 5874, "author_profile": "https://Stackoverflow.com/users/5874", "pm_score": 2, "selected": false, "text": "<p>You can do this as a single query from C# like this:</p>\n\n<pre><code>Insert into tableB (col1, col2, col3) select...
2008/12/04
[ "https://Stackoverflow.com/questions/341315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
I tried to make the title as clear as possible... here is my scenario: I have 2 tables (let's call them table A and table B) that have a similar schema. I would like write a stored procedure that would select specific columns of data out of table A, and insert this data as a new record in table B. Can someone point m...
``` INSERT INTO B (Col1, Col2) SELECT Col1, Col2 FROM A ``` Is this what you mean?
341,338
<p>How do you make a field in a sql select statement all upper or lower case?</p> <p>Example:</p> <p>select firstname from Person</p> <p>How do I make firstname always return upper case and likewise always return lower case?</p>
[ { "answer_id": 341342, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": 4, "selected": false, "text": "<p>LCASE or UCASE respectively.</p>\n\n<p>Example:</p>\n\n<pre><code>SELECT UCASE(MyColumn) AS Upper, LCASE(MyColum...
2008/12/04
[ "https://Stackoverflow.com/questions/341338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6232/" ]
How do you make a field in a sql select statement all upper or lower case? Example: select firstname from Person How do I make firstname always return upper case and likewise always return lower case?
``` SELECT UPPER(firstname) FROM Person SELECT LOWER(firstname) FROM Person ```
341,347
<p>How do I grab the controls inside of a UserControl tag?</p> <p>So if this is on a Page:</p> <pre><code>&lt;ME:NewControl ID="tblCustomList" runat="server"&gt; // ... these controls will be used in my UserControl.aspx &lt;/ME:NewControl&gt; </code></pre> <p>How do I access those controls in my UserControl?</p> <p...
[ { "answer_id": 341395, "author": "David Basarab", "author_id": 2469, "author_profile": "https://Stackoverflow.com/users/2469", "pm_score": 0, "selected": false, "text": "<p>I am not sure if I understand the question 100%.</p>\n\n<p>However if you a custom control called Row you can add a...
2008/12/04
[ "https://Stackoverflow.com/questions/341347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25538/" ]
How do I grab the controls inside of a UserControl tag? So if this is on a Page: ``` <ME:NewControl ID="tblCustomList" runat="server"> // ... these controls will be used in my UserControl.aspx </ME:NewControl> ``` How do I access those controls in my UserControl? For instance, the Table class does this: ``` <asp:...
Turns out I just needed something like this: ``` public TableRow DTHeader { get; set; } protected override void OnInit(EventArgs e) { tblCollection.Rows.Add(DTHeader); base.OnInit(e); } ``` And then use this on my Page: ``` <ME:NewControl ID="tblCustomList" runat="server"> <DTHeader> <asp:Table...
341,348
<p>I have a DSL Tools solution.</p> <p>I need to add a weak-named reference to this project. Because the DSL Tools project DLL is strong-named i cannot used the weak-named DLL.</p> <p>I cannot make the DLL strong-named because i cannot recompile it.</p> <p>I tried to make my DSL Tools project DLL weak-named by going...
[ { "answer_id": 341395, "author": "David Basarab", "author_id": 2469, "author_profile": "https://Stackoverflow.com/users/2469", "pm_score": 0, "selected": false, "text": "<p>I am not sure if I understand the question 100%.</p>\n\n<p>However if you a custom control called Row you can add a...
2008/12/04
[ "https://Stackoverflow.com/questions/341348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20335/" ]
I have a DSL Tools solution. I need to add a weak-named reference to this project. Because the DSL Tools project DLL is strong-named i cannot used the weak-named DLL. I cannot make the DLL strong-named because i cannot recompile it. I tried to make my DSL Tools project DLL weak-named by going to the Dsl and DslPacka...
Turns out I just needed something like this: ``` public TableRow DTHeader { get; set; } protected override void OnInit(EventArgs e) { tblCollection.Rows.Add(DTHeader); base.OnInit(e); } ``` And then use this on my Page: ``` <ME:NewControl ID="tblCustomList" runat="server"> <DTHeader> <asp:Table...
341,370
<p>It seems it is general accepted that exception specifications are not helping as much as one thinks. But I wonder if a specification which only uses std::exception might be a good compromise:</p> <pre><code>void someFunction() throw ( std::exception ); </code></pre> <ul> <li><p>It documents the fact that this ...
[ { "answer_id": 341388, "author": "James Hopkin", "author_id": 11828, "author_profile": "https://Stackoverflow.com/users/11828", "pm_score": 2, "selected": false, "text": "<p>On a conforming compiler, adding a non-empty exception specification generates the equivalent of a try/catch block...
2008/12/04
[ "https://Stackoverflow.com/questions/341370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
It seems it is general accepted that exception specifications are not helping as much as one thinks. But I wonder if a specification which only uses std::exception might be a good compromise: ``` void someFunction() throw ( std::exception ); ``` * It documents the fact that this method/function might throw an ex...
Yes but what do you expect to happen when something that is not derived from std::exception is thrown? Would you like the application to terminate. No stack unwinding not destructors being called to tidy up the code, just the application exiting. The difference between Java and C++ exception specifications is that...
341,373
<p>I need to prompt an alert message when a user selects a particular option in a select menu. Is there a way to do this using jQuery?</p>
[ { "answer_id": 341392, "author": "ayaz", "author_id": 23191, "author_profile": "https://Stackoverflow.com/users/23191", "pm_score": 0, "selected": false, "text": "<p>I recently bumped into the <a href=\"http://nadiana.com/jquery-confirm-plugin\" rel=\"nofollow noreferrer\">jQuery Confirm...
2008/12/04
[ "https://Stackoverflow.com/questions/341373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6050/" ]
I need to prompt an alert message when a user selects a particular option in a select menu. Is there a way to do this using jQuery?
assuming your select has an ID of myselect, and the value you want to check is "myval" ``` $("#myselect").change(function() { if($(this).val() == "myval") { alert('message'); } }); ``` I havent tested this but the concept should be sound
341,377
<p>Did you know that :</p> <pre><code>Map&lt;Object,Object&gt; m1 = new HashMap&lt;Object, Object&gt;(); Map&lt;Object,Object&gt; m2 = new HashMap&lt;Object, Object&gt;(); System.out.println("m1.equals(m2) = "+m1.equals(m2)); System.out.println("m1.keySet().equals(m2.keySet()) = " +m1.keySet().equals(m2.ke...
[ { "answer_id": 341405, "author": "Uri", "author_id": 23072, "author_profile": "https://Stackoverflow.com/users/23072", "pm_score": 0, "selected": false, "text": "<p>I am not sure if thatt's the official reason, but AbstractCollection avoids adding semantic constraints on potential subcla...
2008/12/04
[ "https://Stackoverflow.com/questions/341377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7198/" ]
Did you know that : ``` Map<Object,Object> m1 = new HashMap<Object, Object>(); Map<Object,Object> m2 = new HashMap<Object, Object>(); System.out.println("m1.equals(m2) = "+m1.equals(m2)); System.out.println("m1.keySet().equals(m2.keySet()) = " +m1.keySet().equals(m2.keySet())); System.out.println("m1.entry...
Per the contract of [`Collection#equals()`](http://java.sun.com/javase/6/docs/api/java/util/Collection.html#equals(java.lang.Object)), there is no general-purpose equals() methods for `Collection`s, and thus `AbstractCollection` cannot provide one. Note that `HashMap$Values` is neither a Set nor a List, thus the quand...
341,379
<p>As an example:</p> <pre><code>def get_booking(f=None): print &quot;Calling get_booking Decorator&quot; def wrapper(request, **kwargs): booking = _get_booking_from_session(request) if booking == None: # we don't have a booking in our session. return HttpRedirect('/') ...
[ { "answer_id": 341389, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 6, "selected": true, "text": "<p>I believe python decorators are just syntactic sugar.</p>\n\n<pre><code>@foo\ndef bar ():\n pass\n</code></pre>\n\n<p>is ...
2008/12/04
[ "https://Stackoverflow.com/questions/341379", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22306/" ]
As an example: ``` def get_booking(f=None): print "Calling get_booking Decorator" def wrapper(request, **kwargs): booking = _get_booking_from_session(request) if booking == None: # we don't have a booking in our session. return HttpRedirect('/') else: ...
I believe python decorators are just syntactic sugar. ``` @foo def bar (): pass ``` is the same thing as ``` def bar (): pass bar = foo(bar) ``` As you can see, *foo* is being called even though *bar* has not been called. This is why you see the output from your decorator function. Your output should cont...
341,384
<p>I need to add some intervals and use the result in Excel. </p> <p>Since </p> <pre><code>sum(time.endtime-time.starttime) </code></pre> <p>returns the interval as "1 day 01:30:00" and this format breaks my Excel sheet, I thought it'd be nice to have the output like "25:30:00" but found no way to do it in the Pos...
[ { "answer_id": 341439, "author": "mat", "author_id": 42083, "author_profile": "https://Stackoverflow.com/users/42083", "pm_score": 4, "selected": false, "text": "<p>The only thing I can come with (beside parsing the number of days and adding 24 to the hours every time) is :</p>\n\n<pre><...
2008/12/04
[ "https://Stackoverflow.com/questions/341384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43289/" ]
I need to add some intervals and use the result in Excel. Since ``` sum(time.endtime-time.starttime) ``` returns the interval as "1 day 01:30:00" and this format breaks my Excel sheet, I thought it'd be nice to have the output like "25:30:00" but found no way to do it in the PostgreSQL documentation. Can anyone...
Since there is not an exact solution for the topic: ``` => SELECT date_part('epoch', INTERVAL '1 day 01:30:00') * INTERVAL '1 second' hours; hours ----------- 25:30:00 (1 row) ``` Source: [Documentation](http://www.postgresql.org/docs/9.3/static/functions-datetime.html)
341,387
<p>Hello I would like to ask you, If someone knows how can I add a directory for the header files in the Makefile to avoid the error *.h not found, I have tried this option but does not work:</p> <pre><code>INC_PATH := -I /directory/to/add </code></pre>
[ { "answer_id": 341396, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 5, "selected": false, "text": "<p>At least for GNU make, try the implicit variable <code><a href=\"http://www.gnu.org/software/make/manual/html_node/Impli...
2008/12/04
[ "https://Stackoverflow.com/questions/341387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39160/" ]
Hello I would like to ask you, If someone knows how can I add a directory for the header files in the Makefile to avoid the error \*.h not found, I have tried this option but does not work: ``` INC_PATH := -I /directory/to/add ```
Although the goal is ultimately to affect the value of CFLAGS (as suggested by @unwind), it is often not a good idea to simply set the value of CFLAGS as it is often built out of many pieces. You have to understand the structure of the makefile, and the set of macros used. [*Added*: Eduardo asked: Can you post macros...
341,393
<p>This is an extension of a question I had yesterday.</p> <p>I am trying to make a little php calculator that will show how much people can save on their phone bills if they switch to VoIP, and how much they can save with each service.</p> <p>I have a form that will spit out the right amount for a monthly bill here:...
[ { "answer_id": 341396, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 5, "selected": false, "text": "<p>At least for GNU make, try the implicit variable <code><a href=\"http://www.gnu.org/software/make/manual/html_node/Impli...
2008/12/04
[ "https://Stackoverflow.com/questions/341393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43035/" ]
This is an extension of a question I had yesterday. I am trying to make a little php calculator that will show how much people can save on their phone bills if they switch to VoIP, and how much they can save with each service. I have a form that will spit out the right amount for a monthly bill here: <http://www.nex...
Although the goal is ultimately to affect the value of CFLAGS (as suggested by @unwind), it is often not a good idea to simply set the value of CFLAGS as it is often built out of many pieces. You have to understand the structure of the makefile, and the set of macros used. [*Added*: Eduardo asked: Can you post macros...
341,417
<p>How do you handle the Web User Control event? I notice my custom web user control have a event call OnError but it never fire when i tweak the control to fail. The control is basically a custom gridview control. I search for web user control event handling over the net but i haven't find a article that address what ...
[ { "answer_id": 342921, "author": "BenAlabaster", "author_id": 40650, "author_profile": "https://Stackoverflow.com/users/40650", "pm_score": 1, "selected": false, "text": "<p>You didn't mention what flavour of ASP.NET, so I'll make the assumption of VB - C# is largely the same with the ex...
2008/12/04
[ "https://Stackoverflow.com/questions/341417", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28647/" ]
How do you handle the Web User Control event? I notice my custom web user control have a event call OnError but it never fire when i tweak the control to fail. The control is basically a custom gridview control. I search for web user control event handling over the net but i haven't find a article that address what i l...
You didn't mention what flavour of ASP.NET, so I'll make the assumption of VB - C# is largely the same with the exception of how the event handler is attached. The normal pattern you would expect to see is something along these lines: ***User Control "MyUserControl" CodeBehind*** ``` Public Event MyEvent(ByVal Sende...
341,422
<p>I'm writing a Linux module and getting:</p> <pre><code>Unable to handle kernel NULL pointer dereference </code></pre> <p>What does it mean?</p>
[ { "answer_id": 341432, "author": "Nathan", "author_id": 41158, "author_profile": "https://Stackoverflow.com/users/41158", "pm_score": 4, "selected": true, "text": "<p>Sounds like a pointer which currently has the NULL value (zero) is being dereferenced. Assign an address to the pointer b...
2008/12/04
[ "https://Stackoverflow.com/questions/341422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1100/" ]
I'm writing a Linux module and getting: ``` Unable to handle kernel NULL pointer dereference ``` What does it mean?
Sounds like a pointer which currently has the NULL value (zero) is being dereferenced. Assign an address to the pointer before dereferencing it. e.g. ``` int x = 5; int * x_ptr = NULL; x_ptr = &x; // this line may be missing in your code *x_ptr += 5; //can't dereference x_ptr here if x_ptr is still NULL ```
341,423
<p>The setTimeout function always seems to give me trouble. Right now I have a function that is recursive (calls itself through setTimeout) and changes the elements height.</p> <p>The function is sent two arguments: the element to be altered and that elements maximum height. The purpose of the function is to unfold th...
[ { "answer_id": 341451, "author": "Geoff", "author_id": 1097, "author_profile": "https://Stackoverflow.com/users/1097", "pm_score": 1, "selected": false, "text": "<p>I had a similar experience. When you are passing element the next time through, it is getting converted to a string in the...
2008/12/04
[ "https://Stackoverflow.com/questions/341423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29595/" ]
The setTimeout function always seems to give me trouble. Right now I have a function that is recursive (calls itself through setTimeout) and changes the elements height. The function is sent two arguments: the element to be altered and that elements maximum height. The purpose of the function is to unfold the element,...
When you do this: ``` var func_call = 'slide_down(' + element + ', ' + max_height + ');'; ``` you're converting element to a string, so your timeout will look like ``` slide_down("[Object]", 100); ``` which obviously won't work. What you should be doing is creating a closure - it's a little complicated but basic...
341,429
<p>I am trying to use the SGI STL implementation I have downloaded from their site. I want to use a hashmap, because I have to store around 5.000.000 records, but it should be good: I need to be able to access it very quickly. I've tried <code>stedext::hash_map</code>, but it was very slow because I couldn't set the in...
[ { "answer_id": 341459, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<p>I have used it a number of times without problems, though I used it with gcc (both on windows and linux) and not Visual Stu...
2008/12/04
[ "https://Stackoverflow.com/questions/341429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am trying to use the SGI STL implementation I have downloaded from their site. I want to use a hashmap, because I have to store around 5.000.000 records, but it should be good: I need to be able to access it very quickly. I've tried `stedext::hash_map`, but it was very slow because I couldn't set the initial size. By...
I confess I haven't tried it for myself, but VS2008 is supposed to support TR1 which contains: ``` #include <tr1/unordered_map> ``` it's in a "feature Pack" release. <http://www.microsoft.com/downloads/details.aspx?FamilyId=D466226B-8DAB-445F-A7B4-448B326C48E7&displaylang=en>
341,471
<p>I'm attempting to eliminate leading any leading zeroes in my date when I run the get-date cmdlet by trying: </p> <pre><code>$filedate = get-date -uformat "%m-%d-%Y" $filedate = $filedate.ToString().Replace("0", "") </code></pre> <p>this returns "01-04-2008"</p> <p>I want to the output to be "1-4-2008"</p> <p>an...
[ { "answer_id": 341488, "author": "EBGreen", "author_id": 1358, "author_profile": "https://Stackoverflow.com/users/1358", "pm_score": 2, "selected": false, "text": "<p>$fileDate = $fileDate.ToString(\"M-d-yyyy\")</p>\n" }, { "answer_id": 341524, "author": "Gordon Bell", "a...
2008/12/04
[ "https://Stackoverflow.com/questions/341471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18853/" ]
I'm attempting to eliminate leading any leading zeroes in my date when I run the get-date cmdlet by trying: ``` $filedate = get-date -uformat "%m-%d-%Y" $filedate = $filedate.ToString().Replace("0", "") ``` this returns "01-04-2008" I want to the output to be "1-4-2008" any ideas on another way of doing this? t...
``` $filedate = get-date -format "M-d-yyyy" ```
341,474
<p>Although I know how to build a DOM the long, arduous way using the DOM API, I'd like to do something a bit better than that. Is there a nice, tidy way to build hierarchical documents with, say, an API that works something like Hibernate's Criteria API? So that I can chain calls together like this, for example:</p>...
[ { "answer_id": 341487, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 2, "selected": false, "text": "<p>I highly recommend Elliotte Rusty Harold's <a href=\"http://xom.nu/\" rel=\"nofollow noreferrer\">XOM</a> API.</p>\n\n<p...
2008/12/04
[ "https://Stackoverflow.com/questions/341474", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23309/" ]
Although I know how to build a DOM the long, arduous way using the DOM API, I'd like to do something a bit better than that. Is there a nice, tidy way to build hierarchical documents with, say, an API that works something like Hibernate's Criteria API? So that I can chain calls together like this, for example: ``` Doc...
You definitely want to use `JDom`: <http://www.jdom.org/docs/apidocs/> . It can be used as you described as many methods return a reference to `this`. Here is some code our teacher showed us for this XML document. Haven't tested it, but the teacher is great i believe in him: ``` <adressbuch aktualisiert="1.4.2008"> ...
341,477
<p>I want to create a <strong>List</strong> of <strong>KeyValuePair</strong>s in a managed C++ project. Here is the syntax I'm using</p> <pre><code>List&lt;KeyValuePair&lt;String^, String^&gt;^&gt;^ thing; </code></pre> <p>but I'm getting the following error:</p> <blockquote> <p>error C3225: generic type argument ...
[ { "answer_id": 341679, "author": "Brian", "author_id": 2831, "author_profile": "https://Stackoverflow.com/users/2831", "pm_score": 2, "selected": false, "text": "<p>Figured it out:</p>\n\n<pre><code>List&lt;KeyValuePair&lt;String^, String^&gt;&gt;^ thing;\n</code></pre>\n\n<p>KeyValuePai...
2008/12/04
[ "https://Stackoverflow.com/questions/341477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2831/" ]
I want to create a **List** of **KeyValuePair**s in a managed C++ project. Here is the syntax I'm using ``` List<KeyValuePair<String^, String^>^>^ thing; ``` but I'm getting the following error: > > error C3225: generic type argument for 'T' cannot be 'System::Collections::Generic::KeyValuePair ^', it must be a va...
> > KeyValuePair does not itself need to be a handle. Duh. > > > Because it's a value type, not a reference type (i.e. `struct` instead of `class` in C#).
341,484
<p>in Perl, when I do <code>use &lt;module name&gt; &lt;ver&gt;;</code>, the system finds the <code>.pm</code> file for the library somewhere in the <code>@INC</code> path.</p> <p>Is there a reliable way to which file was actually loaded?</p>
[ { "answer_id": 341529, "author": "John", "author_id": 13895, "author_profile": "https://Stackoverflow.com/users/13895", "pm_score": 2, "selected": false, "text": "<p>From what I found, perl will look in the directories within the path:</p>\n\n<pre><code>perl -le 'print foreach @INC'\n</c...
2008/12/04
[ "https://Stackoverflow.com/questions/341484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23630/" ]
in Perl, when I do `use <module name> <ver>;`, the system finds the `.pm` file for the library somewhere in the `@INC` path. Is there a reliable way to which file was actually loaded?
Yes, [`%INC`](http://perldoc.perl.org/perlvar.html#%25INC) contains the full path a module was loaded from. Example: ``` $ perl -M'Data::Dump qw(pp)' -e 'pp(\%INC)' { "Data/Dump.pm" => "/usr/share/perl5/Data/Dump.pm", "Exporter.pm" => "/usr/share/perl/5.10/Exporter.pm", "List/Util.pm" =...
341,512
<p>I have the following code in WCF service to throw a custom fault based on certain situations. I am getting a "The creator of this fault did not specify a Reason" exception. What am I doing wrong?</p> <pre><code>//source code if(!DidItPass) { InvalidRoutingCodeFault fault = new InvalidRoutingCodeFault("Invalid...
[ { "answer_id": 341580, "author": "Chris Porter", "author_id": 13495, "author_profile": "https://Stackoverflow.com/users/13495", "pm_score": 0, "selected": false, "text": "<p>You might try this in the server config (behaviors -> serviceBehaviors -> behavior):</p>\n\n<pre><code>&lt;service...
2008/12/04
[ "https://Stackoverflow.com/questions/341512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
I have the following code in WCF service to throw a custom fault based on certain situations. I am getting a "The creator of this fault did not specify a Reason" exception. What am I doing wrong? ``` //source code if(!DidItPass) { InvalidRoutingCodeFault fault = new InvalidRoutingCodeFault("Invalid Routing Code - ...
After some addtional research, the following modified code worked: ``` if(!DidItPass) { InvalidRoutingCodeFault fault = new InvalidRoutingCodeFault("Invalid Routing Code - No Approval Started"); throw new FaultException<InvalidRoutingCodeFault>(fault, new FaultReason("Invalid Routing Code - No Approval...
341,516
<p>I've always wondered about when and where is the best time to cache a property value... Some of them seem pretty simple, like the one below...</p> <pre><code>public DateTime FirstRequest { get { if (this.m_FirstRequest == null) { this.m_FirstRequest = DateTime.Now; } return (...
[ { "answer_id": 341640, "author": "Jeff Yates", "author_id": 23234, "author_profile": "https://Stackoverflow.com/users/23234", "pm_score": 1, "selected": false, "text": "<p>I think you need to turn your question the other way around lest you fall into a trap of optimizing too early.</p>\n...
2008/12/04
[ "https://Stackoverflow.com/questions/341516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17091/" ]
I've always wondered about when and where is the best time to cache a property value... Some of them seem pretty simple, like the one below... ``` public DateTime FirstRequest { get { if (this.m_FirstRequest == null) { this.m_FirstRequest = DateTime.Now; } return (DateTime)this....
In general, you should get the code working first and then optimize later and then only do optimizations that profiling say will help you.
341,520
<p>Somebody used libapt or libept to list packages and get informations about package in a debian-like system?</p> <p>Libapt is not well-documented at all, and i've found few examples and tutorials about libept. Can someone explain me best methods to</p> <ol> <li>get a list of every packages in the apt-system</li> <l...
[ { "answer_id": 341588, "author": "joveha", "author_id": 40668, "author_profile": "https://Stackoverflow.com/users/40668", "pm_score": 3, "selected": false, "text": "<p>Take a look at how apt-cache(8) is implemented. Obtaining the source with apt is easy:</p>\n\n<pre><code># apt-get sourc...
2008/12/04
[ "https://Stackoverflow.com/questions/341520", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39796/" ]
Somebody used libapt or libept to list packages and get informations about package in a debian-like system? Libapt is not well-documented at all, and i've found few examples and tutorials about libept. Can someone explain me best methods to 1. get a list of every packages in the apt-system 2. get informations about s...
In debian there is a package called `libapt-pkg-doc` which contains some documentation (like an API reference). Once installed, you can access it at file:///usr/share/doc/libapt-pkg-doc/html/index.xhtml. I only just had a look at libapt and here is what I have learned so far: How to list all packages: ``` #include <...
341,531
<p>I have the following snippet where I would like to extract code between the <code>{foreach}</code> and <code>{/foreach}</code> using a regular expression:</p> <pre><code>{foreach (...)} Some random HTML content &lt;div class=""&gt;aklakdls&lt;/div&gt; and some {$/r/template} markup inside. {/foreach} </code></pre> ...
[ { "answer_id": 341582, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 2, "selected": false, "text": "<p>If your regex flavor did not support non-greedy matching, the following would do it, but since it does I recommend <a h...
2008/12/04
[ "https://Stackoverflow.com/questions/341531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1508/" ]
I have the following snippet where I would like to extract code between the `{foreach}` and `{/foreach}` using a regular expression: ``` {foreach (...)} Some random HTML content <div class="">aklakdls</div> and some {$/r/template} markup inside. {/foreach} ``` I already have: ``` {foreach [^}]*} ``` but I am unab...
I came up with this ``` /(?:{foreach .*?})(.*?)(?:{\/foreach})/gis ``` Tested with [RegExr](http://gskinner.com/RegExr/)
341,571
<p>How can I render after executing an action in a restful controller instead of redirecting.</p> <p>I have a controller with standard actions, and I added a special action that adds data to the resource in question, via a form on the #show page (Think comments on a post). I am validating the input from the form and w...
[ { "answer_id": 341631, "author": "dsimard", "author_id": 42866, "author_profile": "https://Stackoverflow.com/users/42866", "pm_score": 3, "selected": true, "text": "<p>The best way is to re-render the :new</p>\n\n<pre><code>def create\n @obj = TheObject.new(params[:object])\n render :a...
2008/12/04
[ "https://Stackoverflow.com/questions/341571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24559/" ]
How can I render after executing an action in a restful controller instead of redirecting. I have a controller with standard actions, and I added a special action that adds data to the resource in question, via a form on the #show page (Think comments on a post). I am validating the input from the form and want to re-...
The best way is to re-render the :new ``` def create @obj = TheObject.new(params[:object]) render :action => :new unless @obj.save end ``` And in the new.html.erb ``` <% form_for :obj, :url => object_url(@obj), :html => {:method => :post} do |f| %> <%= f.text_field :name %> <% end %> ``` That way, the i...
341,594
<p>I'm trying to get information like OS version, hard disk space, disk space available, and installed RAM on a Linux system in C++. I know I can use <code>system()</code> to run different Linux commands and capture their output (which is what I'm currently doing) but I was wondering if there's a better way? Is there...
[ { "answer_id": 341610, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 3, "selected": false, "text": "<p>There is nothing in the C++ Standard library for these purposes. The library you could use is <code>libh...
2008/12/04
[ "https://Stackoverflow.com/questions/341594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
I'm trying to get information like OS version, hard disk space, disk space available, and installed RAM on a Linux system in C++. I know I can use `system()` to run different Linux commands and capture their output (which is what I'm currently doing) but I was wondering if there's a better way? Is there something in th...
If you are using \*nix commands via system. Then do man scroll to the bottom of the man page and it will usually show you what relevant C system calls are related. ``` Example: man uname: SEE ALSO uname(2), getdomainname(2), gethostname(2) Explanation of numbers: (1): User UNIX Command (2): Unix and C sys...
341,619
<p>I'm using MS Sql 2005.</p> <p>Why does this give me the correct results (returns 169 rows)...</p> <pre><code>select * from [import_Data] where [import_Data].name not in ( select [import_Data].name from [import_Data] inner join [resource] on [import_Data].name = [resource]...
[ { "answer_id": 341659, "author": "xahtep", "author_id": 42184, "author_profile": "https://Stackoverflow.com/users/42184", "pm_score": 2, "selected": false, "text": "<p>You probably have a <code>null</code> in the <code>name</code> column of the <code>[resource]</code> table somewhere. Th...
2008/12/04
[ "https://Stackoverflow.com/questions/341619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24908/" ]
I'm using MS Sql 2005. Why does this give me the correct results (returns 169 rows)... ``` select * from [import_Data] where [import_Data].name not in ( select [import_Data].name from [import_Data] inner join [resource] on [import_Data].name = [resource].name where ...
My guess is that there is a null resource.name in your resource table which is throwing all the comparisons off. Why do nulls cause a problem? Per "Guru's Guid to TSQL" and I'm paraphrasing "ANSI guidelines state that an expression that compares a value for equality to NULL always returns NULL." So any null in the list...
341,622
<p>I am building application that required some data from iPhone's Call log(read only). The call log is a sqlite db located at "<em>/User/Library/CallHistory/call_history.db</em>". I used a jailbroken device to extract the log. However trying to open this location using the <em>sqlite_open3()</em> command I get a <em>S...
[ { "answer_id": 341636, "author": "Vincent", "author_id": 1508, "author_profile": "https://Stackoverflow.com/users/1508", "pm_score": -1, "selected": false, "text": "<p>Honestly, how can you imagine they would let you access the whole Call log? How about you transmit it over the Internet ...
2008/12/04
[ "https://Stackoverflow.com/questions/341622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34046/" ]
I am building application that required some data from iPhone's Call log(read only). The call log is a sqlite db located at "*/User/Library/CallHistory/call\_history.db*". I used a jailbroken device to extract the log. However trying to open this location using the *sqlite\_open3()* command I get a *SQLITE\_ERROR* erro...
There is no access to the call log from Cocoa Touch or other iPhone APIs.
341,624
<p>I have a Spring web application which is configured to use JDK proxying for AOP. The AOP annotations (such as @Transactional) are declared on the interfaces, rather than the implementation classes.</p> <p>The application itself works fine, but when I run the unit tests, it seems to be attempting to use CGLIB for th...
[ { "answer_id": 345138, "author": "digitalsanctum", "author_id": 22436, "author_profile": "https://Stackoverflow.com/users/22436", "pm_score": 3, "selected": false, "text": "<p>Sounds like you're referencing an implementation class instead of an interface. There is an <a href=\"http://boo...
2008/12/04
[ "https://Stackoverflow.com/questions/341624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a Spring web application which is configured to use JDK proxying for AOP. The AOP annotations (such as @Transactional) are declared on the interfaces, rather than the implementation classes. The application itself works fine, but when I run the unit tests, it seems to be attempting to use CGLIB for the AOP func...
Sounds like you're referencing an implementation class instead of an interface. There is an [excerpt here](http://books.google.com/books?id=G4jk-NOpF7gC&pg=PA192&lpg=PA192&dq=spring+cglib+jdk+proxy+interface&source=web&ots=PGqNjejNK9&sig=DhXUwccDLSH6AM4mWWb9mnQlfMs&hl=en&sa=X&oi=book_result&resnum=9&ct=result) with mor...
341,649
<p>is there anyway to have an image act as an ajax actionlink? I can only get it to work using text. Thanks for your help!</p>
[ { "answer_id": 341703, "author": "MrJavaGuy", "author_id": 7138, "author_profile": "https://Stackoverflow.com/users/7138", "pm_score": 3, "selected": false, "text": "<p>The short answer is that is not possible. Your options are to write your own extension method to have an ImageActionLi...
2008/12/04
[ "https://Stackoverflow.com/questions/341649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
is there anyway to have an image act as an ajax actionlink? I can only get it to work using text. Thanks for your help!
From Stephen Walthe, from his [Contact manger project](http://www.asp.net/mvc/tutorials/older-versions/contact-manager/iteration-1-create-the-application-cs) ``` public static class ImageActionLinkHelper { public static string ImageActionLink(this AjaxHelper helper, string imageUrl, string altText, string actio...
341,668
<p>All objects in my program inherit from a Container class. The Container class has a <code>virtual BaseNode* getParent() const;</code> method and a <code>virtual void setParent(BaseNode *p);</code> method. </p> <p>I have a <code>Set</code> class (Set in a tennis match, not a data structure) which has the <code>Match...
[ { "answer_id": 341686, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 3, "selected": true, "text": "<p>The problem is that <code>getParent()</code> returns a <code>BaseNode*</code>, which could be a pointer to any typ...
2008/12/04
[ "https://Stackoverflow.com/questions/341668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16204/" ]
All objects in my program inherit from a Container class. The Container class has a `virtual BaseNode* getParent() const;` method and a `virtual void setParent(BaseNode *p);` method. I have a `Set` class (Set in a tennis match, not a data structure) which has the `Match` class as it's parent (via `setParent()`) but s...
The problem is that `getParent()` returns a `BaseNode*`, which could be a pointer to any type of `BaseNode` - it might point to an unrelated class that also derives from `BaseNode`. If you're 100% sure that the parent must be of type `Match`, you should cast the parent to a `Match*` first, and then you can call `getPla...
341,708
<p>I'm an email n00b but I am working on an application that sends HTML email with Unicode characters (as my friend noted "enjoy encoding hell").</p> <p>The <code>Subject:</code> header comes from user input and therefore may contain Unicode characters. Some mail clients (like GMail and Outlook 2007) are OK with this,...
[ { "answer_id": 341849, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 3, "selected": false, "text": "<p>Your can optionally do the same using Base64 encoding:</p>\n\n<pre><code>require \"base64\"\n\nvalue = Base64.encode64...
2008/12/04
[ "https://Stackoverflow.com/questions/341708", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17965/" ]
I'm an email n00b but I am working on an application that sends HTML email with Unicode characters (as my friend noted "enjoy encoding hell"). The `Subject:` header comes from user input and therefore may contain Unicode characters. Some mail clients (like GMail and Outlook 2007) are OK with this, but from my reading ...
Ahah! `ActionMailer::Quoting` has a `quoted_printable` method. So here's what I did: ``` def my_email(foo) ... @subject = quoted_printable(foo.some_subject_with_accented_chars, 'utf-8') ... end ``` Doing this convinced Mail.app to display the rest of the email using UTF-8. Now to test the rest!
341,723
<p>I'm working with a bit of html and Javascript code that I've taken over from someone else. The page reloads a table of data (via an asynchronous request) every ten seconds, and then re-builds the table using some DOM code. The code in question looks something like this:</p> <pre><code>var blah = xmlres.getElementsB...
[ { "answer_id": 341759, "author": "Peter Bailey", "author_id": 8815, "author_profile": "https://Stackoverflow.com/users/8815", "pm_score": 7, "selected": true, "text": "<p>You do, indeed, need to implement a closure here. This <em>should</em> work (let me know - I didn't test it)</p>\n\n...
2008/12/04
[ "https://Stackoverflow.com/questions/341723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4249/" ]
I'm working with a bit of html and Javascript code that I've taken over from someone else. The page reloads a table of data (via an asynchronous request) every ten seconds, and then re-builds the table using some DOM code. The code in question looks something like this: ``` var blah = xmlres.getElementsByTagName('blah...
You do, indeed, need to implement a closure here. This *should* work (let me know - I didn't test it) ``` var blah = xmlres.getElementsByTagName('blah'); for(var i = 0; i < blah.length; i++) { var td = document.createElement('td'); var select = document.createElement('select'); select.setAttribute("...", "...
341,737
<p>I have the following query which works except that I would like it to behave differently. Now it looks for all the duplicate rows on <code>url</code> and returns it in the order of number of duplicate urls. I use GROUP_ CONCAT to seperate all the different screen_name's. </p> <p>However there can be multiple rows w...
[ { "answer_id": 341750, "author": "AaronS", "author_id": 26932, "author_profile": "https://Stackoverflow.com/users/26932", "pm_score": 0, "selected": false, "text": "<p>Have you tried using the distinct keyword?</p>\n\n<p><a href=\"http://www.tech-recipes.com/rx/1481/ignore-duplicate-entr...
2008/12/04
[ "https://Stackoverflow.com/questions/341737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have the following query which works except that I would like it to behave differently. Now it looks for all the duplicate rows on `url` and returns it in the order of number of duplicate urls. I use GROUP\_ CONCAT to seperate all the different screen\_name's. However there can be multiple rows with the same url an...
It not clear exactly what you want. Given this data: ``` t_uid url title screen_name 1 http://google.com/ Google bob 2 http://google.com/ Google Search bob 3 http://google.com/ Google tom ``` what results are you expecting? If you w...
341,743
<p>I'm used to passing around string like this in my C++ applications:</p> <pre><code>void foo(const std::string&amp; input) { std::cout &lt;&lt; input.size() &lt;&lt; std::endl; } void bar() { foo("stackoverflow"); } </code></pre> <p>Now I have a case where I want the string to be NULL:</p> <pre><code>void baz...
[ { "answer_id": 341751, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 1, "selected": false, "text": "<p>What if you just use:</p>\n\n<pre><code>void foo(const char *xinput)\n{\n if (xinput == NULL) {\n // do some...
2008/12/04
[ "https://Stackoverflow.com/questions/341743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20444/" ]
I'm used to passing around string like this in my C++ applications: ``` void foo(const std::string& input) { std::cout << input.size() << std::endl; } void bar() { foo("stackoverflow"); } ``` Now I have a case where I want the string to be NULL: ``` void baz() { foo("stackoverflow"); foo(NULL); // very bad...
If you want the type to be null, then make it a pointer. Pass string pointers around instead of references, since this is precisely what pointers can do, and references cant. References always point to the same valid object. Pointers can be set to null, or be reseated to point to another object. Thus, if you need the t...
341,782
<p>I'm using Microsoft Visual C++ 2008 Express, and have a pretty annoying problem. It doesn't seem to happen in XP but in Vista I can't find a way around it. Whenever I declare variables non-dynamically, if their combined size exceeds about 30mb, the program will crash immediately at start-up. I know that Vista limits...
[ { "answer_id": 341802, "author": "Tim", "author_id": 10755, "author_profile": "https://Stackoverflow.com/users/10755", "pm_score": 1, "selected": false, "text": "<p>There might be a stack size setting you need to set that is defaulting to something small. It has been a long time since I...
2008/12/04
[ "https://Stackoverflow.com/questions/341782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm using Microsoft Visual C++ 2008 Express, and have a pretty annoying problem. It doesn't seem to happen in XP but in Vista I can't find a way around it. Whenever I declare variables non-dynamically, if their combined size exceeds about 30mb, the program will crash immediately at start-up. I know that Vista limits no...
> > Is static allocation obsolete? > > > You're not doing *static* allocation - you're doing *automatic* allocation and as the others have said, you're running out of stack. There are basically three common ways to reserve space for data in C++: 1. On the stack - these are called 'automatic variables', and they...
341,807
<p>How do I bind a CheckBoxField in my GridView to an underlying db field that is a string. The string is either "1" or "0" but all the same the GridView won't willingly bind to it. What do I do. What is the best way to have a checkbox in the GridView and have it get and set the string in the database (or the underlyin...
[ { "answer_id": 341815, "author": "Andrew Rollings", "author_id": 40410, "author_profile": "https://Stackoverflow.com/users/40410", "pm_score": 1, "selected": false, "text": "<p>The CheckBoxField binds to a boolean.\nYou can either convert the string to a boolean in the binding expression...
2008/12/04
[ "https://Stackoverflow.com/questions/341807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4491/" ]
How do I bind a CheckBoxField in my GridView to an underlying db field that is a string. The string is either "1" or "0" but all the same the GridView won't willingly bind to it. What do I do. What is the best way to have a checkbox in the GridView and have it get and set the string in the database (or the underlying d...
This should work: ``` Checked='<%# DataBinder.Eval(Container.DataItem, "MyStringField") = "1" %>' ``` Normally a checkbox value would be mapped to a bit value in your database so you wouldn't get this issue.
341,810
<p>Suppose you have output like this:</p> <pre><code>Word1 Word2 Word3 Word4 </code></pre> <p>Where the number of spaces between words is arbitrary. I want to break it into an array of words.</p> <p>I used the following code:</p> <pre><code>string[] tokens = new List&lt;String&gt;(input.Sp...
[ { "answer_id": 341825, "author": "EBGreen", "author_id": 1358, "author_profile": "https://Stackoverflow.com/users/1358", "pm_score": 1, "selected": false, "text": "<p>I would use a regex for the split with \"\\w+\" for the pattern.</p>\n" }, { "answer_id": 341828, "author": "...
2008/12/04
[ "https://Stackoverflow.com/questions/341810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
Suppose you have output like this: ``` Word1 Word2 Word3 Word4 ``` Where the number of spaces between words is arbitrary. I want to break it into an array of words. I used the following code: ``` string[] tokens = new List<String>(input.Split(' ')) .FindAll ( ...
He already mentions string.Split(). What he's missing is StringSplitOptions.RemoveEmptyEntries: ``` string[] tokens = input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); ```
341,817
<p>I'm porting a relatively simple console program written for Unix to the Windows platform (<a href="http://en.wikipedia.org/wiki/Visual_C++#32-bit_versions" rel="noreferrer">Visual C++ 8.0</a>). All the source files include "unistd.h", which doesn't exist. Removing it, I get complaints about misssing prototypes for ...
[ { "answer_id": 341941, "author": "e.James", "author_id": 33686, "author_profile": "https://Stackoverflow.com/users/33686", "pm_score": 5, "selected": false, "text": "<p>I would recommend using <a href=\"https://osdn.net/projects/mingw\" rel=\"nofollow noreferrer\">mingw/msys</a> as a dev...
2008/12/04
[ "https://Stackoverflow.com/questions/341817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10396/" ]
I'm porting a relatively simple console program written for Unix to the Windows platform ([Visual C++ 8.0](http://en.wikipedia.org/wiki/Visual_C++#32-bit_versions)). All the source files include "unistd.h", which doesn't exist. Removing it, I get complaints about misssing prototypes for 'srandom', 'random', and 'getopt...
Since we can't find a version on the Internet, let's start one here. Most ports to Windows probably only need a subset of the complete Unix file. Here's a starting point. Please add definitions as needed. ``` #ifndef _UNISTD_H #define _UNISTD_H 1 /* This is intended as a drop-in replacement for unistd.h on W...
341,844
<p>Our company has for many years had multiple domain names to protect our product name. When our webiste was first set up we had all these domain names resolving to on IP address which worked fine until now. We rewrote the site with ASP.NET MVC and now use Recaptcha. The Recaptcha keys are registered to "www.example.c...
[ { "answer_id": 341868, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": -1, "selected": false, "text": "<p>Just off the top of my head, you may want to look into DNS CNAME here. </p>\n\n<p>Another possible solution is...
2008/12/04
[ "https://Stackoverflow.com/questions/341844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36383/" ]
Our company has for many years had multiple domain names to protect our product name. When our webiste was first set up we had all these domain names resolving to on IP address which worked fine until now. We rewrote the site with ASP.NET MVC and now use Recaptcha. The Recaptcha keys are registered to "www.example.com"...
For the CNAME approach you need to pick ONE domain name and make that your primary. So make www.example.com the go-to, and every OTHER domain name redirects to this one. Then you can avoid the infinite loop. There is also a way to setup a configuration on the server so that browsers will allow multiple domains to look...
341,848
<p>Given that Decimal.MaxValue = 79228162514264337593543950335m</p> <p>Why does the next line give me 7922816251426433759354395034M in the Local window instead of 7922816251426433759354395033.5m as expected?</p> <p>Decimal target = Decimal.MaxValue / 10m;</p>
[ { "answer_id": 341865, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": true, "text": "<p>I suspect this is a compiler error, actually.</p>\n\n<p>Here's a short but complete program to show why I think that:<...
2008/12/04
[ "https://Stackoverflow.com/questions/341848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13266/" ]
Given that Decimal.MaxValue = 79228162514264337593543950335m Why does the next line give me 7922816251426433759354395034M in the Local window instead of 7922816251426433759354395033.5m as expected? Decimal target = Decimal.MaxValue / 10m;
I suspect this is a compiler error, actually. Here's a short but complete program to show why I think that: ``` using System; class Test { static void Main() { decimal constant = decimal.MaxValue / 10m; decimal calculated = decimal.MaxValue; calculated /= 10m; Console.WriteLi...
341,852
<p>By default when viewing an account in edit mode you have access to Opportunities, Invoices, and Quotes which contain the products being shopped by the account and/or the sales department.</p> <p>I'm trying to determine where to store, display, and use the products that an account has a subscription too. </p> <p>I ...
[ { "answer_id": 341865, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": true, "text": "<p>I suspect this is a compiler error, actually.</p>\n\n<p>Here's a short but complete program to show why I think that:<...
2008/12/04
[ "https://Stackoverflow.com/questions/341852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
By default when viewing an account in edit mode you have access to Opportunities, Invoices, and Quotes which contain the products being shopped by the account and/or the sales department. I'm trying to determine where to store, display, and use the products that an account has a subscription too. I may not understan...
I suspect this is a compiler error, actually. Here's a short but complete program to show why I think that: ``` using System; class Test { static void Main() { decimal constant = decimal.MaxValue / 10m; decimal calculated = decimal.MaxValue; calculated /= 10m; Console.WriteLi...
341,900
<p>I'm matching ASP.Net generated elements by ID name, but I have some elements which may render as text boxes or labels depending on the page context. I need to figure out whether the match is to a textbox or label in order to know whether to get the contents by val() or by html().</p> <pre><code>$("[id$=" + endOfIdT...
[ { "answer_id": 341919, "author": "CMPalmer", "author_id": 14894, "author_profile": "https://Stackoverflow.com/users/14894", "pm_score": 3, "selected": false, "text": "<p>First time I've answered my own question. After a little more experimentation:</p>\n\n<pre><code>$(\"[id$=\" + endOfId...
2008/12/04
[ "https://Stackoverflow.com/questions/341900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14894/" ]
I'm matching ASP.Net generated elements by ID name, but I have some elements which may render as text boxes or labels depending on the page context. I need to figure out whether the match is to a textbox or label in order to know whether to get the contents by val() or by html(). ``` $("[id$=" + endOfIdToMatch + "]")....
Just one jQuery too much: ``` $("[id$=" + endOfIdToMatch + "]").each(function () { alert(this.tagName); }); ```
341,911
<p>I'm trying to run the Camel Example "camel-example-spring-jms" (also at <a href="http://activemq.apache.org/camel/tutorial-jmsremoting.html" rel="nofollow noreferrer">http://activemq.apache.org/camel/tutorial-jmsremoting.html</a>). However, when I try to start Camel using "org.apache.camel.spring.Main" class, I get ...
[ { "answer_id": 343237, "author": "James Strachan", "author_id": 2068211, "author_profile": "https://Stackoverflow.com/users/2068211", "pm_score": 2, "selected": true, "text": "<p>So it works fine under maven - but not if you run it how? In your IDE or something?</p>\n\n<p>If you are usin...
2008/12/04
[ "https://Stackoverflow.com/questions/341911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/325613/" ]
I'm trying to run the Camel Example "camel-example-spring-jms" (also at <http://activemq.apache.org/camel/tutorial-jmsremoting.html>). However, when I try to start Camel using "org.apache.camel.spring.Main" class, I get the error saying **"Configuration problem: Unable to locate Spring NamespaceHandler for XML schema ...
So it works fine under maven - but not if you run it how? In your IDE or something? If you are using eclipse / intellij you can create an IDE project for the maven project using maven. ``` mvn eclipse:eclipse ``` or ``` mvn idea:idea ``` If you are writing some shell script or running it from the command line t...
341,933
<p>If I am inserting elements into a wrap panel and there is still space in the panel before it overflows on the next line, can I specifically make it wrap over so that the subsequent elements are on the next line?</p> <p>I am looking for something like this:</p> <pre><code>&lt;WrapPanel&gt; &lt;Element/&gt; &lt;...
[ { "answer_id": 341994, "author": "Timothy Khouri", "author_id": 11917, "author_profile": "https://Stackoverflow.com/users/11917", "pm_score": 6, "selected": true, "text": "<p>This works:</p>\n\n<pre><code>&lt;WrapPanel&gt;\n &lt;TextBlock&gt;1&lt;/TextBlock&gt;\n &lt;TextBlock&gt;2...
2008/12/04
[ "https://Stackoverflow.com/questions/341933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24177/" ]
If I am inserting elements into a wrap panel and there is still space in the panel before it overflows on the next line, can I specifically make it wrap over so that the subsequent elements are on the next line? I am looking for something like this: ``` <WrapPanel> <Element/> <Element/> <NewLine???/> <Eleme...
This works: ``` <WrapPanel> <TextBlock>1</TextBlock> <TextBlock>2</TextBlock> <TextBlock>3</TextBlock> <TextBlock>4</TextBlock> <TextBlock Width="10000" Height="0" /> <TextBlock>5</TextBlock> <TextBlock>6</TextBlock> </WrapPanel> ``` I have to add though... this is pretty much a hack. Y...
341,942
<p>This should be easy, but I'm not sure how to best go about it. I have a WinForms app that lets the user type in long descriptions. Occaisionally, they would type in URLs, and the RichTextBox would recognize them and make them clickable when displayed.</p> <p>I'm moving the app to the web, and I'm not sure how to ma...
[ { "answer_id": 341960, "author": "MrKurt", "author_id": 35296, "author_profile": "https://Stackoverflow.com/users/35296", "pm_score": 5, "selected": true, "text": "<p>It's actually a very difficult problem. You can get close, but not perfect, with regular expressions. There's a very ni...
2008/12/04
[ "https://Stackoverflow.com/questions/341942", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23935/" ]
This should be easy, but I'm not sure how to best go about it. I have a WinForms app that lets the user type in long descriptions. Occaisionally, they would type in URLs, and the RichTextBox would recognize them and make them clickable when displayed. I'm moving the app to the web, and I'm not sure how to make those s...
It's actually a very difficult problem. You can get close, but not perfect, with regular expressions. There's a very nice breakdown of potential regex patterns to consider here: <http://www.regexguru.com/2008/11/detecting-urls-in-a-block-of-text/> The last one he lists seems like it's probably good enough for most pur...
341,952
<p>I've got two Django projects on the same server. The first launched several months ago, and has since collected hundreds of user accounts. The second project is launching in a few days, and we'd like the second project to allow users of the first app to authenticate using the same credentials.</p> <p>At first, I ...
[ { "answer_id": 342091, "author": "Myles", "author_id": 43363, "author_profile": "https://Stackoverflow.com/users/43363", "pm_score": 0, "selected": false, "text": "<p>Django currently does not have support for multiple databases (there is a <a href=\"http://code.djangoproject.com/wiki/Mu...
2008/12/04
[ "https://Stackoverflow.com/questions/341952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22468/" ]
I've got two Django projects on the same server. The first launched several months ago, and has since collected hundreds of user accounts. The second project is launching in a few days, and we'd like the second project to allow users of the first app to authenticate using the same credentials. At first, I was going to...
If you wait awhile, eventually Django will get multiple database support. But as of right now, I think the best solution to your problem would be to synchronize the two database's user tables after changes to either are made. You can use the signals support to handle this: ``` from django.db import models def user_p...
341,953
<p>I am a bit rusty on my Haskell and am looking to ramp back up. One thing I enjoy from F# is the F# Interactive shell integrated with Visual Studio: I can evaluate virtually anything (including function and class definitions) and use F# as a shell. Is there an equivalent in Haskell? When I use <code>ghci</code>, I ca...
[ { "answer_id": 342010, "author": "Darius Bacon", "author_id": 27024, "author_profile": "https://Stackoverflow.com/users/27024", "pm_score": 4, "selected": true, "text": "<p>You can define a function using 'let':</p>\n\n<pre><code>$ ghci\nPrelude&gt; let double n = n + n\nPrelude&gt; doub...
2008/12/04
[ "https://Stackoverflow.com/questions/341953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34596/" ]
I am a bit rusty on my Haskell and am looking to ramp back up. One thing I enjoy from F# is the F# Interactive shell integrated with Visual Studio: I can evaluate virtually anything (including function and class definitions) and use F# as a shell. Is there an equivalent in Haskell? When I use `ghci`, I cannot evaluate ...
You can define a function using 'let': ``` $ ghci Prelude> let double n = n + n Prelude> double 42 84 ``` Also, I won't quite recommend this, since (A) I wrote it, and (B) it's terribly undeveloped, but [Halp](http://github.com/darius/halp/) can be handy in Emacs -- it's a little bit like a spreadsheet for Haskell c...
341,957
<p>I have a c# struct where I need to forbid calling the no args constructor on it.</p> <pre><code>MyStruct a; /// init a by members // OK MyStruct b = MyStruct.Fact(args); // OK, inits by memebers MyStruct s = new MyStruct(); // can't have that </code></pre> <p>I'm doing this mostly to force explicet values for a...
[ { "answer_id": 341973, "author": "BenAlabaster", "author_id": 40650, "author_profile": "https://Stackoverflow.com/users/40650", "pm_score": 0, "selected": false, "text": "<p>Put it in its own assembly and have the MyStruct() without the args as a Internal (Friend in VB). Have the Factor...
2008/12/04
[ "https://Stackoverflow.com/questions/341957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343/" ]
I have a c# struct where I need to forbid calling the no args constructor on it. ``` MyStruct a; /// init a by members // OK MyStruct b = MyStruct.Fact(args); // OK, inits by memebers MyStruct s = new MyStruct(); // can't have that ``` I'm doing this mostly to force explicet values for all members as there are no...
You can't. All structs have a public parameterless constructor by definition in C#. (In the CLR almost none of them do, but they can always act as if they have.) See [this question](https://stackoverflow.com/questions/333829) for why you can't define your own parameterless constructors on structs (in C#, anyway). In f...
341,971
<p>What is this "Execute Around" idiom (or similar) I've been hearing about? Why might I use it, and why might I not want to use it?</p>
[ { "answer_id": 342016, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 8, "selected": true, "text": "<p>Basically it's the pattern where you write a method to do things which are always required, e.g. resource allocation a...
2008/12/04
[ "https://Stackoverflow.com/questions/341971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4725/" ]
What is this "Execute Around" idiom (or similar) I've been hearing about? Why might I use it, and why might I not want to use it?
Basically it's the pattern where you write a method to do things which are always required, e.g. resource allocation and clean-up, and make the caller pass in "what we want to do with the resource". For example: ``` public interface InputStreamAction { void useStream(InputStream stream) throws IOException; } // S...
341,978
<p>I'm trying to generate synthetic Javascript events in an Internet Explorer extension, and I'm having trouble getting the fromElement property to stick. Here's an excerpt of my code:</p> <pre><code>MsHtml.IHTMLDocument4 doc4 = ... // the document object Object o = null; MsHtml.IHTMLEventObj2 eObj = (MsHtml.IHT...
[ { "answer_id": 342030, "author": "Jonathan Lonowski", "author_id": 15031, "author_profile": "https://Stackoverflow.com/users/15031", "pm_score": 2, "selected": false, "text": "<p>A lot of this depends on what you want to do with the data. I assume render it.</p>\n\n<p>Flash probably woul...
2008/12/04
[ "https://Stackoverflow.com/questions/341978", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42484/" ]
I'm trying to generate synthetic Javascript events in an Internet Explorer extension, and I'm having trouble getting the fromElement property to stick. Here's an excerpt of my code: ``` MsHtml.IHTMLDocument4 doc4 = ... // the document object Object o = null; MsHtml.IHTMLEventObj2 eObj = (MsHtml.IHTMLEventObj2)doc...
A lot of this depends on what you want to do with the data. I assume render it. Flash probably would be the simplest solution. It's a common enough add-on that just about everyone should have it by now; so you're not running much of a risk for incompatibility. JavaScript just hasn't been considered much of a good pla...
342,031
<p>Does anyone know of a way to monitor table record changes in a SQL Server (2005 or 2008) database from a .Net application? It needs to be able to support multiple clients at a time. Each client will "subscribe" when it starts, and "unsubscribe" when it exits. Multiple users could be accessing the system at once a...
[ { "answer_id": 342085, "author": "Paul Nearney", "author_id": 24071, "author_profile": "https://Stackoverflow.com/users/24071", "pm_score": 0, "selected": false, "text": "<p>I haven't personally used it, but it sounds like Notification Services is worth a look</p>\n\n<p><a href=\"http://...
2008/12/04
[ "https://Stackoverflow.com/questions/342031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34440/" ]
Does anyone know of a way to monitor table record changes in a SQL Server (2005 or 2008) database from a .Net application? It needs to be able to support multiple clients at a time. Each client will "subscribe" when it starts, and "unsubscribe" when it exits. Multiple users could be accessing the system at once and I w...
To monitor for changes to a SQL table or record in SQL 2005+ you can utilize the SqlDependency class. It is targeted for use in ASP.NET or a middle-tier service where a single server is managing active subscriptions against a database - not multiple hundreds of clients managing subscriptions. Depending on the maximum ...
342,032
<p>I was trying to raise a post back event by div tag. I don't know how to do that. AL I could think of is javascript, but that is not what I want. I need to call function of a class inside a event handler. </p>
[ { "answer_id": 342042, "author": "Jack", "author_id": 28647, "author_profile": "https://Stackoverflow.com/users/28647", "pm_score": -1, "selected": false, "text": "<p>If I'm not mistaken, is order to do postback the control need to have \"runat=server\". Try add a id to the div tag and a...
2008/12/04
[ "https://Stackoverflow.com/questions/342032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21918/" ]
I was trying to raise a post back event by div tag. I don't know how to do that. AL I could think of is javascript, but that is not what I want. I need to call function of a class inside a event handler.
You have to use javascript: ``` <div id="foo" onclick="__doPostBack('foo','')"> Clicky! </div> ``` Part of the difficulty is you can't pass the event target easily. There are better ways to do what you want, but you need to elaborate on your need.
342,044
<p>I'm selecting 1 field from 1 table and storing it into a temp table.</p> <p>Sometimes that table ends up with 0 rows.</p> <p>I want to add that field onto another table that has 20+ fields</p> <p>Regular union won't work for me because of the field # mismatch. Outer wont work for me because there is nothing to co...
[ { "answer_id": 342068, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 2, "selected": false, "text": "<p>It sounds like you do want a join, not a union.</p>\n\n<p>You don't need to compare anything to do a join. You end...
2008/12/04
[ "https://Stackoverflow.com/questions/342044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42229/" ]
I'm selecting 1 field from 1 table and storing it into a temp table. Sometimes that table ends up with 0 rows. I want to add that field onto another table that has 20+ fields Regular union won't work for me because of the field # mismatch. Outer wont work for me because there is nothing to compare. NVL doesn't work ...
What field would it match with? BTW, here's how to line them up: ``` SELECT NULL, NULL, NULL, NULL, MySingleField, NULL, NULL, NULL... FROM #temp UNION ALL SELECT Col1, Col2, Col3, Col4, Col5, Col6,... FROM OtherTable ``` UPDATE: OK, after reading your update... I don't think you want a UNION at all, but rather, an...
342,052
<p>I need to increment a String in java from "aaaaaaaa" to "aaaaaab" to "aaaaaac" up through the alphabet, then eventually to "aaaaaaba" to "aaaaaabb" etc. etc.</p> <p>Is there a trick for this?</p>
[ { "answer_id": 342086, "author": "Nicholas Mancuso", "author_id": 8945, "author_profile": "https://Stackoverflow.com/users/8945", "pm_score": 0, "selected": false, "text": "<p>I would create a character array and increment the characters individually. Strings are immutable in Java, so ea...
2008/12/04
[ "https://Stackoverflow.com/questions/342052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13930/" ]
I need to increment a String in java from "aaaaaaaa" to "aaaaaab" to "aaaaaac" up through the alphabet, then eventually to "aaaaaaba" to "aaaaaabb" etc. etc. Is there a trick for this?
It's not much of a "trick", but this works for 4-char strings. Obviously it gets uglier for longer strings, but the idea is the same. ``` char array[] = new char[4]; for (char c0 = 'a'; c0 <= 'z'; c0++) { array[0] = c0; for (char c1 = 'a'; c1 <= 'z'; c1++) { array[1] = c1; for (char c2 = 'a'; c2 <= 'z'; c2...
342,088
<p>I have a web app on our intranet (VS 2005). There are a couple pages that don't require the user to be logged into the app (feedback and the default page). I am trying to get the domain and username to display and/or send with the feedback. Is there a way to do this without requiring the user to log in? I've tri...
[ { "answer_id": 342123, "author": "matt_dev", "author_id": 39086, "author_profile": "https://Stackoverflow.com/users/39086", "pm_score": 2, "selected": false, "text": "<p>Theresa, I think this is what you're looking for...</p>\n\n<pre><code>AppDomain.CurrentDomain.SetPrincipalPolicy(Princ...
2008/12/04
[ "https://Stackoverflow.com/questions/342088", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39355/" ]
I have a web app on our intranet (VS 2005). There are a couple pages that don't require the user to be logged into the app (feedback and the default page). I am trying to get the domain and username to display and/or send with the feedback. Is there a way to do this without requiring the user to log in? I've tried `thi...
Theresa, I think this is what you're looking for... ``` AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal); WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal; WindowsIdentity identity = (WindowsIdentity)principal.Identity; String userName= principal.Identity.Name; ```
342,093
<p>Here's my PS1 variable:</p> <pre><code>PS1='\u:\W$(__git_ps1 "\e[32m\][%s]\e[0m\]")$ ' </code></pre> <p>Works great for picking up my Git branch, but it has the unfortunate side-effect of wrapping the lines when the colours are active, so that they overlap when you use long commands.</p> <p>Can anyone with magic ...
[ { "answer_id": 342135, "author": "Aupajo", "author_id": 10407, "author_profile": "https://Stackoverflow.com/users/10407", "pm_score": 7, "selected": true, "text": "<p>Got it, needed to escape the colours properly.</p>\n\n<p>Fix:</p>\n\n<pre><code>PS1='\\u:\\W$(__git_ps1 \"\\[\\e[32m\\][%...
2008/12/04
[ "https://Stackoverflow.com/questions/342093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10407/" ]
Here's my PS1 variable: ``` PS1='\u:\W$(__git_ps1 "\e[32m\][%s]\e[0m\]")$ ' ``` Works great for picking up my Git branch, but it has the unfortunate side-effect of wrapping the lines when the colours are active, so that they overlap when you use long commands. Can anyone with magic PS1 skills help me out to fix thi...
Got it, needed to escape the colours properly. Fix: ``` PS1='\u:\W$(__git_ps1 "\[\e[32m\][%s]\[\e[0m\]")$ ' ```
342,100
<p>I have a Guid.NewGuid() call that is creating an Empty Guid. </p> <p>What would cause such a problem and how can I fix it?</p> <p><b>Edit:</b> The code:<br /></p> <pre><code>&lt;WebMethod()&gt; _ Public Function CreateRow(rowValue As String) as String Dim rowPointer As Guid = System.Guid.NewGuid() Dim ro...
[ { "answer_id": 342153, "author": "abatishchev", "author_id": 41956, "author_profile": "https://Stackoverflow.com/users/41956", "pm_score": 2, "selected": false, "text": "<p>I had the same thing. Debugging of Guid.NeGuid() was showing that it's empty. Calling .ToString() fixed the situati...
2008/12/04
[ "https://Stackoverflow.com/questions/342100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33226/" ]
I have a Guid.NewGuid() call that is creating an Empty Guid. What would cause such a problem and how can I fix it? **Edit:** The code: ``` <WebMethod()> _ Public Function CreateRow(rowValue As String) as String Dim rowPointer As Guid = System.Guid.NewGuid() Dim rowPointerValue As String = rowPointer.ToStr...
This is an old problem in VB.NET. It is only the debug visualizer that is broken. <http://www.thesoftwaredevotional.com/2008/12/guid-visualizer-broken-in-vbnet.html>
342,101
<p>ok, ive a class and i pass an object as property.</p> <p>the object that i pass is a <code>List&lt;X&gt;</code></p> <p>in my class im trying to access the Object index by reflection BUT I CAN'T!!! </p> <p>Example:</p> <p>this class works i just wrote down the part i want to show you and i need help.</p> <pre><c...
[ { "answer_id": 342114, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "<p>If you are using reflection (and hence lots of <code>object</code>), why not just cast as an <code>IList</code> (no...
2008/12/04
[ "https://Stackoverflow.com/questions/342101", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
ok, ive a class and i pass an object as property. the object that i pass is a `List<X>` in my class im trying to access the Object index by reflection BUT I CAN'T!!! Example: this class works i just wrote down the part i want to show you and i need help. ``` class MyClass { private object _recordSet; publ...
If you are using reflection (and hence lots of `object`), why not just cast as an `IList` (non-generic) instead? i.e. ``` IList list = (IList)actualList; object foo = list[17]; ``` Also - for your original code with `Count`, you don't mean `int.Parse` - you should just cast (since we expect `Count` to be an `int`).
342,103
<p>I have an SSRS report where the date should be grouped by project category the project code in the category is repeating in side the group how do I suppress the value</p> <p>Please help me to get an idea.</p> <p>Thanks,brijit</p>
[ { "answer_id": 4099001, "author": "Keng", "author_id": 730, "author_profile": "https://Stackoverflow.com/users/730", "pm_score": 0, "selected": false, "text": "<p>I think it may be an issue concerning the way you are grouping the dates. Do you have the grouped with time on them as well ...
2008/12/04
[ "https://Stackoverflow.com/questions/342103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have an SSRS report where the date should be grouped by project category the project code in the category is repeating in side the group how do I suppress the value Please help me to get an idea. Thanks,brijit
You can also hide fields by putting an expression in the Hidden property like this: ``` =Fields!ProductCode.Value = Previous(Fields!ProductCode.Value) ``` So if the value in the previous record is the same as this one, it will hide the field. You must sort the dataset correctly for this to work. In your case I think...
342,116
<p>I have a Viewbox with <code>Stretch=Uniform</code> in order to not distort the content. However, when the frame window is wider or taller than the content, the Viewbox content is always centered.</p> <p>I cannot seem to find any content alignment options on the Viewbox. Is there a way to do this?</p>
[ { "answer_id": 342142, "author": "a_hardin", "author_id": 1497, "author_profile": "https://Stackoverflow.com/users/1497", "pm_score": 1, "selected": false, "text": "<p>According to <a href=\"http://msdn.microsoft.com/en-us/library/ms741838.aspx\" rel=\"nofollow noreferrer\">MSDN</a> the ...
2008/12/04
[ "https://Stackoverflow.com/questions/342116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25879/" ]
I have a Viewbox with `Stretch=Uniform` in order to not distort the content. However, when the frame window is wider or taller than the content, the Viewbox content is always centered. I cannot seem to find any content alignment options on the Viewbox. Is there a way to do this?
Try `VerticalAlignment="Top"` and `HorizontalAlignment="Left"` on your viewbox. It will cause it to be anchored to the top and left side. ``` <Grid> <Viewbox VerticalAlignment="Top" HorizontalAlignment="Left"> ... </Viewbox> </Grid> ``` If you want it to completely fill (but keep it uniform) you can use ...
342,119
<p>I'm trying to use a generic list as a property of the users profile. I'll admit this is probably just making my life harder than it needs to be but I don't want to change the programming model just because the data store struggles.</p> <p>I have this in my web.config</p> <p> ...
[ { "answer_id": 342142, "author": "a_hardin", "author_id": 1497, "author_profile": "https://Stackoverflow.com/users/1497", "pm_score": 1, "selected": false, "text": "<p>According to <a href=\"http://msdn.microsoft.com/en-us/library/ms741838.aspx\" rel=\"nofollow noreferrer\">MSDN</a> the ...
2008/12/04
[ "https://Stackoverflow.com/questions/342119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42975/" ]
I'm trying to use a generic list as a property of the users profile. I'll admit this is probably just making my life harder than it needs to be but I don't want to change the programming model just because the data store struggles. I have this in my web.config ``` </providers> <properties> ...
Try `VerticalAlignment="Top"` and `HorizontalAlignment="Left"` on your viewbox. It will cause it to be anchored to the top and left side. ``` <Grid> <Viewbox VerticalAlignment="Top" HorizontalAlignment="Left"> ... </Viewbox> </Grid> ``` If you want it to completely fill (but keep it uniform) you can use ...