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
368,219
<p>I have a relatively simple form which asks a variety of questions. One of those questions is answered via a Select Box. What I would like to do is if the person selects a particular option, they are prompted for more information.</p> <p>With the help of a few online tutorials, I've managed to get the Javascript to ...
[ { "answer_id": 368232, "author": "Tom", "author_id": 20, "author_profile": "https://Stackoverflow.com/users/20", "pm_score": 5, "selected": true, "text": "<p>Setup the <code>onchange</code> event handler for the select box to look at the currently selected index. If the selected index is...
2008/12/15
[ "https://Stackoverflow.com/questions/368219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42428/" ]
I have a relatively simple form which asks a variety of questions. One of those questions is answered via a Select Box. What I would like to do is if the person selects a particular option, they are prompted for more information. With the help of a few online tutorials, I've managed to get the Javascript to display a ...
Setup the `onchange` event handler for the select box to look at the currently selected index. If the selected index is that of the 'Other Reason' option, then display the message; otherwise, hide the division. ``` <html> <head> <script type="text/javascript"> window.onload = function() { var eSelect =...
368,253
<p>I have a <code>NSTimer</code> object that I need to invalidate if a user taps on a button or if they exit a view.</p> <p>So I have:</p> <pre><code>[myNSTimer invalidate]; </code></pre> <p>inside my button handler and inside <code>viewWillDisappear</code>. If user taps on a button and then exists a view the app th...
[ { "answer_id": 368263, "author": "Lily Ballard", "author_id": 582, "author_profile": "https://Stackoverflow.com/users/582", "pm_score": 6, "selected": true, "text": "<p>Once you invalidate the timer, simply call <code>release</code> on it (assuming you've retained the reference you're ho...
2008/12/15
[ "https://Stackoverflow.com/questions/368253", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44091/" ]
I have a `NSTimer` object that I need to invalidate if a user taps on a button or if they exit a view. So I have: ``` [myNSTimer invalidate]; ``` inside my button handler and inside `viewWillDisappear`. If user taps on a button and then exists a view the app throws an exception because `myNSTimer` has already been ...
Once you invalidate the timer, simply call `release` on it (assuming you've retained the reference you're holding on to) and then nil out your reference. That way when you exit the view, trying to invalidate the timer a second time will just call that method on nil instead, which does nothing. Alternatively, you can u...
368,262
<p>I am compiling a c++ static library in vs2008, and in the solution i also have a startup project that uses the lib, and that works fine. </p> <p>But when using the lib in another solution i get an run-time check failure. "The value of ESP was not properly saved across a functioncall" Stepping through the code i not...
[ { "answer_id": 368264, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 2, "selected": false, "text": "<p>Make sure you're compiling in Debug mode and not Release mode. If you attempt to debug a program in Release mode...
2008/12/15
[ "https://Stackoverflow.com/questions/368262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46357/" ]
I am compiling a c++ static library in vs2008, and in the solution i also have a startup project that uses the lib, and that works fine. But when using the lib in another solution i get an run-time check failure. "The value of ESP was not properly saved across a functioncall" Stepping through the code i noticed a fun...
Forgive me for stating the bleeding obvious here, but... I've seen this sort of thing happen many times before when object (.o) and header (.h) files get out of sync. Especially with respect to virtual methods. Consider: The object file is compiled with header: ``` class Foo { virtual void f(); }; ``` But then the ...
368,271
<p>I would like to know how to modify the below code to strip <code>=20</code> characters at the end of many lines, and mainly to sort the messages chronologically from first received or sent to last. I am not sure if this would be an internal Perl routine or not. </p> <pre><code>#!/usr/bin/perl use warnings; use stri...
[ { "answer_id": 368302, "author": "Keltia", "author_id": 16143, "author_profile": "https://Stackoverflow.com/users/16143", "pm_score": 0, "selected": false, "text": "<p>I'd suggest to look at the <a href=\"http://search.cpan.org/~gaas/MIME-Base64-Perl-1.00/\" rel=\"nofollow noreferrer\">M...
2008/12/15
[ "https://Stackoverflow.com/questions/368271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
I would like to know how to modify the below code to strip `=20` characters at the end of many lines, and mainly to sort the messages chronologically from first received or sent to last. I am not sure if this would be an internal Perl routine or not. ``` #!/usr/bin/perl use warnings; use strict; use Mail::Box::Manage...
I guess that those instances of `=20` are in the body of the message. Reading just a bit of the [documentation for Mail::Message](http://search.cpan.org/~markov/Mail-Box/lib/Mail/Message.pod) will reveal this helpful note: > > BE WARNED that this returns you an object which may be encoded: use decoded() to get a bod...
368,280
<p>As made clear in update 3 on <a href="https://stackoverflow.com/questions/367440/javascript-associative-array-without-tostring-etc#367454">this answer</a>, this notation:</p> <pre><code>var hash = {}; hash[X] </code></pre> <p>does not actually hash the object <code>X</code>; it actually just converts <code>X</code> ...
[ { "answer_id": 368504, "author": "Eugene Lazutkin", "author_id": 26394, "author_profile": "https://Stackoverflow.com/users/26394", "pm_score": 10, "selected": true, "text": "<p>Hash your objects yourself manually, and use the resulting strings as keys for a regular JavaScript dictionary....
2008/12/15
[ "https://Stackoverflow.com/questions/368280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15055/" ]
As made clear in update 3 on [this answer](https://stackoverflow.com/questions/367440/javascript-associative-array-without-tostring-etc#367454), this notation: ``` var hash = {}; hash[X] ``` does not actually hash the object `X`; it actually just converts `X` to a string (via `.toString()` if it's an object, or some...
Hash your objects yourself manually, and use the resulting strings as keys for a regular JavaScript dictionary. After all, you are in the best position to know what makes your objects unique. That's what I do. Example: ``` var key = function(obj){ // Some unique object-dependent key return obj.totallyUniqueEmploy...
368,288
<p>I'm having trouble with the following two items:</p> <ul> <li>How to retrieve all of the subkey values in ClassesRoot\Typelib, and;</li> <li>How to find a match for a known value (path/dll name) in the array of subkey values.</li> </ul> <p>As background info, I'm trying to find a way to check if a DLL has been reg...
[ { "answer_id": 368397, "author": "WOPR", "author_id": 46255, "author_profile": "https://Stackoverflow.com/users/46255", "pm_score": 1, "selected": false, "text": "<p>Have a look at Microsoft.Win32.Registry and Microsoft.Win32.RegistryKey.</p>\n\n<pre><code>public void Foo()\n{\n foreac...
2008/12/15
[ "https://Stackoverflow.com/questions/368288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2493/" ]
I'm having trouble with the following two items: * How to retrieve all of the subkey values in ClassesRoot\Typelib, and; * How to find a match for a known value (path/dll name) in the array of subkey values. As background info, I'm trying to find a way to check if a DLL has been registered. Someone mentioned that che...
I've not tested it extensively and it has very little error handling code, but this should help you start. ``` public static bool IsRegistered(string name, string dllPath) { RegistryKey typeLibKey = Registry.ClassesRoot.OpenSubKey("TypeLib"); foreach (string libIdKeyName in typeLibKey.GetSubKeyNames()) { ...
368,295
<p>I'm using <code>FontMetrics.getHeight()</code> to get the height of the string, but it gives me a wrong value, cutting off the descenders of string characters. Is there a better function I can use?</p>
[ { "answer_id": 368301, "author": "Bombe", "author_id": 43582, "author_profile": "https://Stackoverflow.com/users/43582", "pm_score": 3, "selected": false, "text": "<p><a href=\"http://java.sun.com/javase/6/docs/api/java/awt/FontMetrics.html#getAscent()\" rel=\"noreferrer\">FontMetrics.ge...
2008/12/15
[ "https://Stackoverflow.com/questions/368295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9476/" ]
I'm using `FontMetrics.getHeight()` to get the height of the string, but it gives me a wrong value, cutting off the descenders of string characters. Is there a better function I can use?
The `getStringBounds()` method below is based on the `GlyphVector` for the current `Graphics2D` font, which works very well for one line string of text: ``` public class StringBoundsPanel extends JPanel { public StringBoundsPanel() { setBackground(Color.white); setPreferredSize(new Dimension(40...
368,323
<p>i've got the following linq2sql query, and i'm setting the result to a POCO. One of my POCO properties is an enumeration.</p> <pre><code>public IQueryable&lt;Models.Achievement&gt; GetAchievements() { return from a in _sqlDatabase.Achievements select new Models.Achievement { ...
[ { "answer_id": 368335, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 3, "selected": true, "text": "<p>You can actually use enums directly in LINQ-to-SQL (but not Entity Framework); just change the type of the property...
2008/12/15
[ "https://Stackoverflow.com/questions/368323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30674/" ]
i've got the following linq2sql query, and i'm setting the result to a POCO. One of my POCO properties is an enumeration. ``` public IQueryable<Models.Achievement> GetAchievements() { return from a in _sqlDatabase.Achievements select new Models.Achievement { // Note: ToEnum is a...
You can actually use enums directly in LINQ-to-SQL (but not Entity Framework); just change the type of the property (in the dbml/designer) to the fully qualified enum type, and it will do the cast for you. You might want to call it AchievementType, of course - and this assumes a straight (cast) translation. If this do...
368,338
<p>can I pass a cursor in a procedure?</p> <pre><code>CURSOR BLT_CURSOR IS SELECT BLT.sol_id, BLT.bill_id, BLT.bank_id FROM BLT; </code></pre> <p>Is my cursor.</p> <pre><code>Procedure abc(i want to pass the cursor here) </code></pre> <p>How do I do it.</p>
[ { "answer_id": 368368, "author": "Bob Probst", "author_id": 12424, "author_profile": "https://Stackoverflow.com/users/12424", "pm_score": 0, "selected": false, "text": "<p>It's not possible in MSSQL2005. I don't know about 2008 or other platforms. </p>\n\n<p>There's been several times ...
2008/12/15
[ "https://Stackoverflow.com/questions/368338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
can I pass a cursor in a procedure? ``` CURSOR BLT_CURSOR IS SELECT BLT.sol_id, BLT.bill_id, BLT.bank_id FROM BLT; ``` Is my cursor. ``` Procedure abc(i want to pass the cursor here) ``` How do I do it.
I am assuming you are using Oracle (it would appear so). You can do this: ``` PROCEDURE abc( p_cursor IN SYS_REFCURSOR) IS v_sol_id blt.sol_id%TYPE; v_bill_id blt.bill_id%TYPE; v_bank_id blt.bank_id%TYPE; BEGIN LOOP FETCH p_cursor INTO v_sol_id, v_bill_id, v_bank_id; EXIT WHEN p_cursor%NOTFOUN...
368,351
<p>Given the following table in SQL Server 2005:</p> <pre><code>ID Col1 Col2 Col3 -- ---- ---- ---- 1 3 34 76 2 32 976 24 3 7 235 3 4 245 1 792 </code></pre> <p>What is the best way to write the query that yields the following result (i.e. one that yie...
[ { "answer_id": 368381, "author": "George Mastros", "author_id": 1408129, "author_profile": "https://Stackoverflow.com/users/1408129", "pm_score": 7, "selected": true, "text": "<p>There are likely to be many ways to accomplish this. My suggestion is to use Case/When to do it. With 3 col...
2008/12/15
[ "https://Stackoverflow.com/questions/368351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21379/" ]
Given the following table in SQL Server 2005: ``` ID Col1 Col2 Col3 -- ---- ---- ---- 1 3 34 76 2 32 976 24 3 7 235 3 4 245 1 792 ``` What is the best way to write the query that yields the following result (i.e. one that yields the final column - a c...
There are likely to be many ways to accomplish this. My suggestion is to use Case/When to do it. With 3 columns, it's not too bad. ``` Select Id, Case When Col1 < Col2 And Col1 < Col3 Then Col1 When Col2 < Col1 And Col2 < Col3 Then Col2 Else Col3 End As TheMin From YourTa...
368,359
<p>I have a long running function in MATLAB that I tried to speed up by adding caching and wound up slowing down my performance significantly. My code is basically searching for continuous "horizontal" lines in an edge detected image and the original code looks something like this:</p> <pre><code>function lineLength ...
[ { "answer_id": 368391, "author": "schnaader", "author_id": 34065, "author_profile": "https://Stackoverflow.com/users/34065", "pm_score": 0, "selected": false, "text": "<p>My guess is that you're caching the wrong part of your code. The recursion in the elseif part seems to be the real bo...
2008/12/15
[ "https://Stackoverflow.com/questions/368359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4797/" ]
I have a long running function in MATLAB that I tried to speed up by adding caching and wound up slowing down my performance significantly. My code is basically searching for continuous "horizontal" lines in an edge detected image and the original code looks something like this: ``` function lineLength = getLineLength...
I'm pretty sure the global is not the problem, but as a matter of style, you should use a `persistent`, which maintains it's value from call to call, but is local to the function. Anytime you have performance problems, profile. Call `profile on`, then your function, then `profile report`. It will point out your real ...
368,362
<p>Sample data: !!Part|123456,ABCDEF,ABC132!!</p> <p>The comma delimited list can be any number of any combination of alphas and numbers </p> <p>I want a regex to match the entries in the comma separated list:</p> <p>What I have is: !!PART\|(\w+)(?:,{1}(\w+))*!!</p> <p>Which seems to do the job, the thing is I want...
[ { "answer_id": 368389, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 1, "selected": false, "text": "<p>Unless I'm mistaken, that still only counts as one group. I'm guessing you'll need to do a string.Split(',') to do...
2008/12/15
[ "https://Stackoverflow.com/questions/368362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39643/" ]
Sample data: !!Part|123456,ABCDEF,ABC132!! The comma delimited list can be any number of any combination of alphas and numbers I want a regex to match the entries in the comma separated list: What I have is: !!PART\|(\w+)(?:,{1}(\w+))\*!! Which seems to do the job, the thing is I want to retrieve them in order int...
You can either use split: ``` string csv = tag.Substring(7, tag.Length - 9); string[] values = csv.Split(new char[] { ',' }); ``` Or a regex: ``` Regex csvRegex = new Regex(@"!!Part\|(?:(?<value>\w+),?)+!!"); List<string> valuesRegex = new List<string>(); foreach (Capture capture in csvRegex.Match(tag).Groups["valu...
368,369
<p>I'm working on a site similar to digg in the respect that users can submit "stories". </p> <p>I keep track of how many "votes" and "similar adds" each item got. Similar adds are defined as two users adding the same "link". </p> <p>Here is <em>part</em> of the algorithm (essentially the most important):</p> <pre><...
[ { "answer_id": 368509, "author": "Tony Andrews", "author_id": 18747, "author_profile": "https://Stackoverflow.com/users/18747", "pm_score": 0, "selected": false, "text": "<p>There wouldn't be a need to execute SQL 10 times to get the result, you could get it in one execution something li...
2008/12/15
[ "https://Stackoverflow.com/questions/368369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23695/" ]
I'm working on a site similar to digg in the respect that users can submit "stories". I keep track of how many "votes" and "similar adds" each item got. Similar adds are defined as two users adding the same "link". Here is *part* of the algorithm (essentially the most important): ``` y = day number sy = number of...
Try this one: everyone has one vote. Your vote sticks to the last thing you voted for. The time thing would come from user behaviour.
368,371
<p>Since XAML gets compiled, there should be no difference in execution of code like this.<br> Winforms (code like):</p> <pre><code>Form formPeter = new Form(); Textbox textbox = new Textbox(); Label l1 = new Label1(); </code></pre> <p>Xaml does not get parsed at runtime, as I thought... :-) </p> <p>But what about r...
[ { "answer_id": 368415, "author": "amazedsaint", "author_id": 45956, "author_profile": "https://Stackoverflow.com/users/45956", "pm_score": 3, "selected": false, "text": "<p>WPF uses DirectX for rendering (which is much faster) instead of the native Windows GDI. </p>\n\n<p>As you might al...
2008/12/15
[ "https://Stackoverflow.com/questions/368371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35693/" ]
Since XAML gets compiled, there should be no difference in execution of code like this. Winforms (code like): ``` Form formPeter = new Form(); Textbox textbox = new Textbox(); Label l1 = new Label1(); ``` Xaml does not get parsed at runtime, as I thought... :-) But what about rendering/execution of big forms wi...
Which Technology is faster? I'm afraid your question doesn't really have a simple answer. Your comment about XAML not being parsed at runtime is both true and false. While the XAML is not parsed a normalized binary version of it (embedded as a resource in your application) called BAML **is** parsed at runtime. To say ...
368,384
<p>After deploying our huge distributed system to one of our clients we experience an unexpected error. During the investigation we replace the assembly causing the error with one where we have added some diagnostic code. The dll we use is built in debug mode. And suddenly it all works!</p> <p>Replacing the debug dll ...
[ { "answer_id": 368408, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": false, "text": "<p>For causes... well, some hint of the symptom would help. One possibility is that you have code to a method like <c...
2008/12/15
[ "https://Stackoverflow.com/questions/368384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22621/" ]
After deploying our huge distributed system to one of our clients we experience an unexpected error. During the investigation we replace the assembly causing the error with one where we have added some diagnostic code. The dll we use is built in debug mode. And suddenly it all works! Replacing the debug dll with the r...
For causes... well, some hint of the symptom would help. One possibility is that you have code to a method like `Debug.WriteLine` that has side effects (i.e. makes it work). Calls to methods marked with `[Conditional(...)]` are not compiled unless you have the right symbols defined - so anything marked `[Conditional("D...
368,385
<p>Is it possible to implement <a href="http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization" rel="noreferrer">RAII</a> in pure C? </p> <p>I assume it isn't possible in any sane way, but perhaps is it possible using some kind of dirty trick. Overloading the standard <code>free</code> function comes to m...
[ { "answer_id": 368444, "author": "Roger Lipscombe", "author_id": 8446, "author_profile": "https://Stackoverflow.com/users/8446", "pm_score": 1, "selected": false, "text": "<p>I'd opt for overwriting the return address on the stack. It'd work out as the most transparent. Replacing <code>f...
2008/12/15
[ "https://Stackoverflow.com/questions/368385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15109/" ]
Is it possible to implement [RAII](http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization) in pure C? I assume it isn't possible in any sane way, but perhaps is it possible using some kind of dirty trick. Overloading the standard `free` function comes to mind or perhaps overwriting the return address on ...
This is inherent implementation dependent, since the Standard doesn't include such a possibility. For GCC, the `cleanup` attribute runs a function when a variable goes out of scope: ``` #include <stdio.h> void scoped(int * pvariable) { printf("variable (%d) goes out of scope\n", *pvariable); } int main(void) { ...
368,430
<p>I am working on creating a .asmx webservice to meet the specific needs of an integration environment and for the life of me I cannot figure out how to get one section of it to work. The key is that the request WSDL needs to be something like the following. (Note I removed the soap envelope and namespace informatio...
[ { "answer_id": 368441, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 1, "selected": false, "text": "<p>Maybe an obvious question, but did you try using wsdl.exe to see what it spits out? You can always just use this f...
2008/12/15
[ "https://Stackoverflow.com/questions/368430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13279/" ]
I am working on creating a .asmx webservice to meet the specific needs of an integration environment and for the life of me I cannot figure out how to get one section of it to work. The key is that the request WSDL needs to be something like the following. (Note I removed the soap envelope and namespace information) `...
If you have WSDL contract that needs to be implemented, you may try `wsdl.exe /serverInterface` to get service stub generated.
368,432
<p>Is there any way to set the style for the lineends for the TCanvas.LineTo method? It seems to default to rounded ends, which looks very bad for several lines in a row of different colours when Pen.Width is set to a large value (e.g. 9).</p> <p>It looks like this (rounded ends):</p> <pre><code> ********........****...
[ { "answer_id": 368606, "author": "Uli Gerhardt", "author_id": 1431618, "author_profile": "https://Stackoverflow.com/users/1431618", "pm_score": 3, "selected": true, "text": "<p>Maybe <a href=\"https://msdn.microsoft.com/en-us/library/dd162705(v=vs.85).aspx\" rel=\"nofollow noreferrer\">E...
2008/12/15
[ "https://Stackoverflow.com/questions/368432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21506/" ]
Is there any way to set the style for the lineends for the TCanvas.LineTo method? It seems to default to rounded ends, which looks very bad for several lines in a row of different colours when Pen.Width is set to a large value (e.g. 9). It looks like this (rounded ends): ``` ********........****** **********...........
Maybe [ExtCreatePen](https://msdn.microsoft.com/en-us/library/dd162705(v=vs.85).aspx) helps. Check the `PS_ENDCAP_*` and `PS_JOIN_*` flags.
368,438
<p>I have to work on some code that's using generic lists to store a collection of custom objects.</p> <p>Then it does something like the following to check if a given object's in the collection and do something if so:</p> <pre><code>List&lt;CustomObject&gt; customObjects; //fill up the list List&lt;CustomObject&gt; ...
[ { "answer_id": 368457, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 3, "selected": true, "text": "<p>Well, you seem to have answered it yourself? If you need fast query against a set of data, then a dictionary may be...
2008/12/15
[ "https://Stackoverflow.com/questions/368438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1311500/" ]
I have to work on some code that's using generic lists to store a collection of custom objects. Then it does something like the following to check if a given object's in the collection and do something if so: ``` List<CustomObject> customObjects; //fill up the list List<CustomObject> anotherListofCustomObjects; //fil...
Well, you seem to have answered it yourself? If you need fast query against a set of data, then a dictionary may be better than a flat list (for largish data sizes, which yours is). You could, for example, use the object as its own key - ``` Dictionary<CustomObject,CustomObject> ... ``` Note that the meaning of eq...
368,456
<p>I have code that sends HTML emails to users. To accommodate users who dont have/ want HTML email, the email contains 2 alternate views, View(0) is HTML, View(1) is Plain text. </p> <p>The HTML view has a header and footer graphics, but the style is done inline and not via css file. The text view is only the text; n...
[ { "answer_id": 368535, "author": "adam", "author_id": 33604, "author_profile": "https://Stackoverflow.com/users/33604", "pm_score": 2, "selected": true, "text": "<p>Ideally, as recommended by W3C, you should be encoding using UTF8.</p>\n\n<p>This may do the trick.</p>\n" }, { "an...
2008/12/15
[ "https://Stackoverflow.com/questions/368456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16391/" ]
I have code that sends HTML emails to users. To accommodate users who dont have/ want HTML email, the email contains 2 alternate views, View(0) is HTML, View(1) is Plain text. The HTML view has a header and footer graphics, but the style is done inline and not via css file. The text view is only the text; no tags, im...
Ideally, as recommended by W3C, you should be encoding using UTF8. This may do the trick.
368,459
<p>For example I have two tables. The first table is student while the second table are the courses that the a student is taking. How can I use a select statement so that I can see two columns student and courses so that the courses are separated by commas.</p> <p>Thanks.</p>
[ { "answer_id": 368476, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 0, "selected": false, "text": "<p>It depends on which server you're using. SQL Server? MySQL? Other?</p>\n" }, { "answer_id": 368489, ...
2008/12/15
[ "https://Stackoverflow.com/questions/368459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
For example I have two tables. The first table is student while the second table are the courses that the a student is taking. How can I use a select statement so that I can see two columns student and courses so that the courses are separated by commas. Thanks.
Assuming you're using SQL Server 2005: This should do what you're after - obviously replace fields as you need: For demo purposes, consider the following two table structures: ``` Students( STU_PKEY Int Identity(1,1) Constraint PK_Students_StuPKey Primary Key, STU_NAME nvarchar(64) ) Courses( CRS_PKEY Int Ide...
368,463
<p>We are in the process of designing a simple service-oriented architecture using WCF as the implementation framework. There are a handful of services that a few applications use. These services are mostly used internally, so a basic authentication and authorization scheme (such as Windows-based) is enough.</p> <p>We...
[ { "answer_id": 368536, "author": "Joseph DeCarlo", "author_id": 46362, "author_profile": "https://Stackoverflow.com/users/46362", "pm_score": 3, "selected": true, "text": "<p>I have done something very similar to this. What you can do is expose an endpoint with a single operation.</p>\n...
2008/12/15
[ "https://Stackoverflow.com/questions/368463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16026/" ]
We are in the process of designing a simple service-oriented architecture using WCF as the implementation framework. There are a handful of services that a few applications use. These services are mostly used internally, so a basic authentication and authorization scheme (such as Windows-based) is enough. We want, how...
I have done something very similar to this. What you can do is expose an endpoint with a single operation. That operation would look something like ``` [OperationContract(Namespace="www.fu.com", Action="*")] void CallThis(Message msg); ``` Have your clients use a proxy that is intended for the service they intended...
368,480
<p>I am trying to display an HTML page inside another SharePoint webpart page.</p> <p>I used the Out-of-the-box page viewer webpart, but the page viewer webpart displays a disabled scrollbar inside it.</p> <p>I also tried using a content editor webpart with an IFRAME tag in it, but still it didnt't work.</p> <p>This...
[ { "answer_id": 401121, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": true, "text": "<p>\"width:100%;height:100%\" may be the culprit. make size of the iframe larger than the frame window. Also try using scrollin...
2008/12/15
[ "https://Stackoverflow.com/questions/368480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1909/" ]
I am trying to display an HTML page inside another SharePoint webpart page. I used the Out-of-the-box page viewer webpart, but the page viewer webpart displays a disabled scrollbar inside it. I also tried using a content editor webpart with an IFRAME tag in it, but still it didnt't work. This is the code i used in t...
"width:100%;height:100%" may be the culprit. make size of the iframe larger than the frame window. Also try using scrolling="no"
368,494
<p>I have a WCF service that has been hosted on a Windows Service and uses the BasicHttp endpoint to serve Windows Mobile devices that has been connected to it.</p> <p>The problem is that with the Device Emulator. I can connect to the service and using it without any problems, but with an actual device. I receive the ...
[ { "answer_id": 458255, "author": "WillH", "author_id": 30132, "author_profile": "https://Stackoverflow.com/users/30132", "pm_score": 2, "selected": false, "text": "<p>Check your IIS extensions, particularly those for .wsdl are valid:</p>\n\n<p>In IIS:</p>\n\n<ul>\n<li>Look at the propert...
2008/12/15
[ "https://Stackoverflow.com/questions/368494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34623/" ]
I have a WCF service that has been hosted on a Windows Service and uses the BasicHttp endpoint to serve Windows Mobile devices that has been connected to it. The problem is that with the Device Emulator. I can connect to the service and using it without any problems, but with an actual device. I receive the error: > ...
Check your IIS extensions, particularly those for .wsdl are valid: In IIS: * Look at the properties for your site. * In the Home Directory tab, click configuration. * Click add (my path is "C:\Program Files (x86)\Common Files\MSSOAP\BINARIES\SOAPIS30.DLL" ) * Set the extension to .WSDL and allow "Get" and "Post" * Se...
368,505
<p>Is it possible to select column data using the ordinal_position for a table column? I know using ordinal positions is a bad practice but for a one-off data import process I need to be able to use the ordinal position to get the column data.</p> <p>So for example </p> <pre><code>create table Test( Col1 int, ...
[ { "answer_id": 368525, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 2, "selected": false, "text": "<p>Yes, you could do this with some really ugly hits into the system tables. You'd probably need to fall into the world of...
2008/12/15
[ "https://Stackoverflow.com/questions/368505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3635/" ]
Is it possible to select column data using the ordinal\_position for a table column? I know using ordinal positions is a bad practice but for a one-off data import process I need to be able to use the ordinal position to get the column data. So for example ``` create table Test( Col1 int, Col2 nvarchar(10) ...
You'd have to do something like ``` declare @col1 as varchar(128) declare @col2 as varchar(128) declare @sq1 as varchar(8000) select @col1 = column_name from information_schema.columns where table_name = 'tablename' and ordinal_position = @position select @col2 = column_name from information_schema.columns where t...
368,521
<p>We're embarking on a new middle tier service that will allow internal client systems to create and update and query records in some underlying data stores. The service will aggregate as many as 3 seperate underlying datastores. For the purposes of this question assume:</p> <p>Data store #1: Proprietary XML Datab...
[ { "answer_id": 368531, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": 1, "selected": false, "text": "<p>Certainly the stongly typed approach will be easiest from an end-user-developer perspective which is what I would prefer....
2008/12/15
[ "https://Stackoverflow.com/questions/368521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36860/" ]
We're embarking on a new middle tier service that will allow internal client systems to create and update and query records in some underlying data stores. The service will aggregate as many as 3 seperate underlying datastores. For the purposes of this question assume: Data store #1: Proprietary XML Database. Data ...
I'd say expose an object API. Although not for the reasons mentioned in another post above - that of exposing XML resulting in a fixed format that is more difficult to change. Arguably, an API of strongly-typed business objects is as difficult to change as XML - both will require re-compilation and re-building. So tha...
368,545
<p>I wrote a <code>while loop</code> in a function, but don't know how to stop it. When it doesn't meet its final condition, the loop just go for ever. How can I stop it?</p> <pre><code>def determine_period(universe_array): period=0 tmp=universe_array while True: tmp=apply_rules(tmp)#aplly_rules is...
[ { "answer_id": 368550, "author": "Mapad", "author_id": 28165, "author_profile": "https://Stackoverflow.com/users/28165", "pm_score": 6, "selected": true, "text": "<p>just indent your code correctly:</p>\n\n<pre><code>def determine_period(universe_array):\n period=0\n tmp=universe_a...
2008/12/15
[ "https://Stackoverflow.com/questions/368545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44354/" ]
I wrote a `while loop` in a function, but don't know how to stop it. When it doesn't meet its final condition, the loop just go for ever. How can I stop it? ``` def determine_period(universe_array): period=0 tmp=universe_array while True: tmp=apply_rules(tmp)#aplly_rules is a another function ...
just indent your code correctly: ``` def determine_period(universe_array): period=0 tmp=universe_array while True: tmp=apply_rules(tmp)#aplly_rules is a another function period+=1 if numpy.array_equal(tmp,universe_array) is True: return period if period>12: #i w...
368,551
<p>Given a list of strings, what is the best method for concatenating these strings into a comma separated list with no comma at the end. (VB.NET or C#) (Using either StringBuilder or String Concat.)</p> <pre><code>Dim strResult As String = "" Dim lstItems As New List(Of String) lstItems.Add("Hello") lstItems.Add("Wor...
[ { "answer_id": 368564, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 5, "selected": false, "text": "<pre><code>Dim Result As String\nDim Items As New List(Of String)\nItems.Add(&quot;Hello&quot;)\nItems.Add(&quot;World...
2008/12/15
[ "https://Stackoverflow.com/questions/368551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21826/" ]
Given a list of strings, what is the best method for concatenating these strings into a comma separated list with no comma at the end. (VB.NET or C#) (Using either StringBuilder or String Concat.) ``` Dim strResult As String = "" Dim lstItems As New List(Of String) lstItems.Add("Hello") lstItems.Add("World") For Each ...
``` Dim Result As String Dim Items As New List(Of String) Items.Add("Hello") Items.Add("World") Result = String.Join(",", Items) MessageBox.Show(Result) ``` If you're really concerned about empty strings, use this join function: ``` Function Join(ByVal delimiter As String, ByVal items As IEnumerable(Of String), Opt...
368,557
<p>I have a small program to order and sort email messages, outputting to a textfile using <code>$msg-&gt;decoded-&gt;string</code>. The perl program outputs to <code>stdout</code>, and I redirect it to a txt file. However, gedit is unable to open this text file because of a character set problem, and I would like to k...
[ { "answer_id": 368591, "author": "innaM", "author_id": 7498, "author_profile": "https://Stackoverflow.com/users/7498", "pm_score": 1, "selected": false, "text": "<p>If you are simply redirecting Perl's output, then Perl will have a difficult time producing a decent file.</p>\n\n<p>You sh...
2008/12/15
[ "https://Stackoverflow.com/questions/368557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
I have a small program to order and sort email messages, outputting to a textfile using `$msg->decoded->string`. The perl program outputs to `stdout`, and I redirect it to a txt file. However, gedit is unable to open this text file because of a character set problem, and I would like to know how to restore or set a cha...
Different messages probably are in different encodings. Probably gedit detects it as UTF-8, but later finds out that parts of the file aren't UTF-8. Mixed files like this are major PITA. The best (perhaps only) solution is to check for the content type (`$message->contentType`) and convert everything to UTF-8.
368,603
<p>I need to write a 'simple' util to convert from ASCII to EBCDIC? </p> <p>The Ascii is coming from Java, Web and going to an AS400. I've had a google around, can't seem to find a easy solution (maybe coz there isn't one :( ). I was hoping for an opensource util or paid for util that has already been written. </p>...
[ { "answer_id": 368621, "author": "Elie", "author_id": 23249, "author_profile": "https://Stackoverflow.com/users/23249", "pm_score": 0, "selected": false, "text": "<p>It should be fairly simple to write a map for the EBCDIC character set, and one for the ASCII character set, and in each r...
2008/12/15
[ "https://Stackoverflow.com/questions/368603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31751/" ]
I need to write a 'simple' util to convert from ASCII to EBCDIC? The Ascii is coming from Java, Web and going to an AS400. I've had a google around, can't seem to find a easy solution (maybe coz there isn't one :( ). I was hoping for an opensource util or paid for util that has already been written. Like this maybe...
[JTOpen](http://jt400.sourceforge.net/), IBM's open source version of their Java toolbox has a collection of classes to access AS/400 objects, including a FileReader and FileWriter to access native AS400 text files. That may be easier to use then writing your own conversion classes. From the JTOpen homepage: > > Her...
368,612
<p>I have an .Net Froms application that displays web pages through a WebBrowser control.</p> <p>Is there anyway that I can detect if the control shows a '<em>Page not found</em>' or '<em>Cannot display webpage</em>' error? There doesn't seem to be any error event handlers.</p>
[ { "answer_id": 368734, "author": "Darin Dimitrov", "author_id": 29407, "author_profile": "https://Stackoverflow.com/users/29407", "pm_score": 5, "selected": true, "text": "<p>The WebBrowser windows forms control is wrapper around Internet Explorer and it doesn't expose all the functional...
2008/12/15
[ "https://Stackoverflow.com/questions/368612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18107/" ]
I have an .Net Froms application that displays web pages through a WebBrowser control. Is there anyway that I can detect if the control shows a '*Page not found*' or '*Cannot display webpage*' error? There doesn't seem to be any error event handlers.
The WebBrowser windows forms control is wrapper around Internet Explorer and it doesn't expose all the functionality of the underlying ActiveX control and particularly the NavigateError event. Here's a workaround: First add reference to SHDocVw.dll to your project (COM tab of Add Reference window). Then you can do the...
368,618
<p>I can not distinguish the difference between aggregating and holding. What does it mean in terms of, let`s say, C++?<br> I suppose when the object of class A holds (or instantiates) objects of class B, it uses it to perform some functions by itself.<br> For example:</p> <pre><code>class A { int state; public: ...
[ { "answer_id": 368660, "author": "David M. Karr", "author_id": 10508, "author_profile": "https://Stackoverflow.com/users/10508", "pm_score": 0, "selected": false, "text": "<p>It's very much about ownership and visibility. There are different names for these relationships, but you should...
2008/12/15
[ "https://Stackoverflow.com/questions/368618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28298/" ]
I can not distinguish the difference between aggregating and holding. What does it mean in terms of, let`s say, C++? I suppose when the object of class A holds (or instantiates) objects of class B, it uses it to perform some functions by itself. For example: ``` class A { int state; public: A(int s): state(...
Holding another class means that a class is associated with another class through a parent child relationship. For example a Path has a list of points. The Path is the parent of the List of Points which is the parent of the individual points. Aggregating means taking different classes and putting them behind a interfa...
368,636
<p>I've seen a good bit of setuptools bashing on the internets lately. Most recently, I read James Bennett's <a href="http://www.b-list.org/weblog/2008/dec/14/packaging/" rel="noreferrer">On packaging</a> post on why no one should be using setuptools. From my time in #python on Freenode, I know that there are a few sou...
[ { "answer_id": 369264, "author": "Salim Fadhley", "author_id": 46411, "author_profile": "https://Stackoverflow.com/users/46411", "pm_score": 2, "selected": false, "text": "<p>For starters, pip is really new. New, incomplete and largely un-tested in the real world. </p>\n\n<p>It shows gre...
2008/12/15
[ "https://Stackoverflow.com/questions/368636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18866/" ]
I've seen a good bit of setuptools bashing on the internets lately. Most recently, I read James Bennett's [On packaging](http://www.b-list.org/weblog/2008/dec/14/packaging/) post on why no one should be using setuptools. From my time in #python on Freenode, I know that there are a few souls there who absolutely detest ...
pip uses Setuptools, and doesn't require any changes to packages. It actually installs packages with Setuptools, using: ``` python -c 'import setuptools; __file__="setup.py"; execfile(__file__)' \ install \ --single-version-externally-managed ``` Because it uses that option (`--single-version-externally-mana...
368,642
<p>I'm getting the error when accessing a Stored Procedure in SQL Server</p> <pre><code>Server Error in '/' Application. Procedure or function 'ColumnSeek' expects parameter '@template', which was not supplied. </code></pre> <p>This is happening when I call a Stored Procedure with a parameter through .net's data con...
[ { "answer_id": 368659, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 0, "selected": false, "text": "<p>First - why is that an EXEC? Shouldn't that just be</p>\n\n<pre><code>AS\nSELECT Column_Name, ...\nFROM ...\nWHERE...
2008/12/15
[ "https://Stackoverflow.com/questions/368642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26140/" ]
I'm getting the error when accessing a Stored Procedure in SQL Server ``` Server Error in '/' Application. Procedure or function 'ColumnSeek' expects parameter '@template', which was not supplied. ``` This is happening when I call a Stored Procedure with a parameter through .net's data connection to sql `(System.da...
I would check my application code and see what value you are setting @template to. I suspect it is null and therein lies the problem.
368,653
<p>In a web-application implemented in java using JSP and Servlets; if I store information in the user session, this information is shared from all the tabs from the same browser. How to differ sessions in the browser-tabs? In this example: </p> <pre><code>&lt;%@page language="java"%&gt; &lt;% String user = request.g...
[ { "answer_id": 368667, "author": "Bombe", "author_id": 43582, "author_profile": "https://Stackoverflow.com/users/43582", "pm_score": 2, "selected": false, "text": "<p>You can use link-rewriting to append a unique identifier to all your URLs when starting at a single page (e.g. index.html...
2008/12/15
[ "https://Stackoverflow.com/questions/368653", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46388/" ]
In a web-application implemented in java using JSP and Servlets; if I store information in the user session, this information is shared from all the tabs from the same browser. How to differ sessions in the browser-tabs? In this example: ``` <%@page language="java"%> <% String user = request.getParameter("user"); us...
You can use HTML5 SessionStorage (window.sessionStorage). You will generate a random id and save in session Storage per Browser Tab. Then each browser tab has his own Id. > > Data stored using sessionStorage do not persist across browser tabs, > even if two tabs both contain webpages from the same domain origin. In...
368,668
<p>I'm interested in assigning the tag name of the root element in an xml document to an xslt variable. For instance, if the document looked like (minus the DTD):</p> <pre><code>&lt;foo xmlns="http://....."&gt; &lt;bar&gt;1&lt;/bar&gt; &lt;/foo&gt; </code></pre> <p>and I wanted to assign the string 'foo' to an x...
[ { "answer_id": 368724, "author": "Matty", "author_id": 26241, "author_profile": "https://Stackoverflow.com/users/26241", "pm_score": 2, "selected": false, "text": "<p>Figured it out. The function name() given the parameter * will return foo.</p>\n" }, { "answer_id": 368727, ...
2008/12/15
[ "https://Stackoverflow.com/questions/368668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26241/" ]
I'm interested in assigning the tag name of the root element in an xml document to an xslt variable. For instance, if the document looked like (minus the DTD): ``` <foo xmlns="http://....."> <bar>1</bar> </foo> ``` and I wanted to assign the string 'foo' to an xslt variable. Is there a way to reference that? Th...
I think you want to retrieve the name of the outermost XML element. This can be done like in the following XSL sample: ``` <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:variable name="outermostElementName" select="name(/*)" /> <xsl:te...
368,687
<p>We have an issue on our page whereby the first time a button posts back (we have ASP.NET ajax to enable partial updates) nothing happens, then on every subsequent click, the information is updated as if the previous event fired.</p> <p>Here's the code for the page. The events are button clicks fired from within the...
[ { "answer_id": 368704, "author": "devio", "author_id": 21336, "author_profile": "https://Stackoverflow.com/users/21336", "pm_score": 0, "selected": false, "text": "<p>Did you try an HTML table, with or without runat=\"server\" ?</p>\n\n<p>Do you add or remove controls inside the table in...
2008/12/15
[ "https://Stackoverflow.com/questions/368687", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4950/" ]
We have an issue on our page whereby the first time a button posts back (we have ASP.NET ajax to enable partial updates) nothing happens, then on every subsequent click, the information is updated as if the previous event fired. Here's the code for the page. The events are button clicks fired from within the table. Wh...
Your table is probably being populated too late in the page lifecycle. Try creating the table in PreInit.
368,725
<p>Given the schema</p> <pre> PERSON { name, spouse } </pre> <p>where PERSON.spouse is a foreign key to PERSON.name, NULLs will be necessary when a person is unmarried or we don't have any info.</p> <p>Going with the argument against nulls, how do you avoid them in this case?</p> <p>I have an alternate schema</p> ...
[ { "answer_id": 368745, "author": "BobbyShaftoe", "author_id": 38426, "author_profile": "https://Stackoverflow.com/users/38426", "pm_score": 1, "selected": false, "text": "<p>Well, first I would use auto-incrementing IDs as, of course, someone could have the same name. But, I assume you i...
2008/12/15
[ "https://Stackoverflow.com/questions/368725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21294/" ]
Given the schema ``` PERSON { name, spouse } ``` where PERSON.spouse is a foreign key to PERSON.name, NULLs will be necessary when a person is unmarried or we don't have any info. Going with the argument against nulls, how do you avoid them in this case? I have an alternate schema ``` PERSON { name } SPOUSE { n...
All right, use Auto-IDs and then use a Check Constraint. The "Name1" column (which would only be an int ID) will be force to only have ODD numbered IDs and Name2 will only have EVEN. Then create a Unique Constraint for Column1 and Column2.
368,742
<p>Suppose I have a method that takes an object of some kind as an argument. Now say that if this method is passed a null argument, it's a fatal error and an exception should be thrown. Is it worth it for me to code something like this (keeping in mind this is a trivial example):</p> <pre><code>void someMethod(Some...
[ { "answer_id": 368759, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 7, "selected": true, "text": "<p>I prefer the <code>ArgumentNullException</code> over the <code>NullReferenceException</code> that not checking the ar...
2008/12/15
[ "https://Stackoverflow.com/questions/368742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2147/" ]
Suppose I have a method that takes an object of some kind as an argument. Now say that if this method is passed a null argument, it's a fatal error and an exception should be thrown. Is it worth it for me to code something like this (keeping in mind this is a trivial example): ``` void someMethod(SomeClass x) { if...
I prefer the `ArgumentNullException` over the `NullReferenceException` that not checking the argument would provide. In general, my preference is to always check for nullity before trying to invoke a method on a potentially null object. If the method is a constructor, then it would depend on a couple of different fact...
368,744
<p>Suppose a shell script (/bin/sh or /bin/bash) contained several commands. How can I cleanly make the script terminate if any of the commands has a failing exit status? Obviously, one can use if blocks and/or callbacks, but is there a cleaner, more concise way? Using &amp;&amp; is not really an option either, beca...
[ { "answer_id": 368754, "author": "mat", "author_id": 42083, "author_profile": "https://Stackoverflow.com/users/42083", "pm_score": 7, "selected": true, "text": "<p>With standard <code>sh</code> and <code>bash</code>, you can</p>\n\n<pre><code>set -e\n</code></pre>\n\n<p>It will </p>\n\n<...
2008/12/15
[ "https://Stackoverflow.com/questions/368744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28558/" ]
Suppose a shell script (/bin/sh or /bin/bash) contained several commands. How can I cleanly make the script terminate if any of the commands has a failing exit status? Obviously, one can use if blocks and/or callbacks, but is there a cleaner, more concise way? Using && is not really an option either, because the comman...
With standard `sh` and `bash`, you can ``` set -e ``` It will ``` $ help set ... -e Exit immediately if a command exits with a non-zero status. ``` It also works (from what I could gather) with `zsh`. It also should work for any Bourne shell descendant. With `csh`/`tcsh`, you have to launch your script...
368,750
<p>Finally, I have a question to ask on Stack Overflow! :-)</p> <p>The main target is for Java but I believe it is mostly language agnostic: if you don't have native assert, you can always simulate it.</p> <p>I work for a company selling a suite of softwares written in Java. The code is old, dating back to Java 1.3 a...
[ { "answer_id": 368809, "author": "james", "author_id": 32155, "author_profile": "https://Stackoverflow.com/users/32155", "pm_score": 2, "selected": false, "text": "<p>you have touched on many of the reasons why i think asserts should be avoided in general. unless you are working with a ...
2008/12/15
[ "https://Stackoverflow.com/questions/368750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15459/" ]
Finally, I have a question to ask on Stack Overflow! :-) The main target is for Java but I believe it is mostly language agnostic: if you don't have native assert, you can always simulate it. I work for a company selling a suite of softwares written in Java. The code is old, dating back to Java 1.3 at least, and at s...
The number one rule is to avoid side-effects in assertions. In other words, the code should behave identically with assertions turned off as it does when assertions are turned on and not failing (obviously assertions that fail are going to alter the behaviour because they will raise an error). The number two rule is n...
368,762
<p>So What I'm essentially trying to do is have something happen 70% of the time, another few things happen 10% of the time each if that makes sense but my app doesn't seem to do any of the actions I'm guessing I'm misunderstanding the loop syntax or something, anyway if anyone could take a look and maybe give me some ...
[ { "answer_id": 368772, "author": "P Daddy", "author_id": 36388, "author_profile": "https://Stackoverflow.com/users/36388", "pm_score": 5, "selected": true, "text": "<p><code>net {start|stop} mssqlserver</code></p>\n" }, { "answer_id": 368773, "author": "Brian Rudolph", "a...
2008/12/15
[ "https://Stackoverflow.com/questions/368762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
So What I'm essentially trying to do is have something happen 70% of the time, another few things happen 10% of the time each if that makes sense but my app doesn't seem to do any of the actions I'm guessing I'm misunderstanding the loop syntax or something, anyway if anyone could take a look and maybe give me some adv...
`net {start|stop} mssqlserver`
368,766
<p>I'm looking for a little help on programmatically passing parameters to a SSRS report via VB.NET and ASP.NET. This seems like it should be a relatively simple thing to do, but I haven't had much luck finding help on this.</p> <p>Does anyone have any suggestions on where to go to get help with this, or perhaps even...
[ { "answer_id": 368835, "author": "HectorMac", "author_id": 1400, "author_profile": "https://Stackoverflow.com/users/1400", "pm_score": 4, "selected": false, "text": "<p>If the Report server is directly accessible, you can pass parameters in the Querystring if you are accessing the repoor...
2008/12/15
[ "https://Stackoverflow.com/questions/368766", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6602/" ]
I'm looking for a little help on programmatically passing parameters to a SSRS report via VB.NET and ASP.NET. This seems like it should be a relatively simple thing to do, but I haven't had much luck finding help on this. Does anyone have any suggestions on where to go to get help with this, or perhaps even some sampl...
You can do the following,: (it works both on local reports as in Full Blown SSRS reports. but in full mode, use the appropriate class, the parameter part remains the same) ``` LocalReport myReport = new LocalReport(); myReport.ReportPath = Server.MapPath("~/Path/To/Report.rdlc"); ReportParameter myParam = new ReportP...
368,786
<p>Here's an interesting question. I have a system that attempts to run some initialization code. If it fails, we call the deinitializer to clean everything up.</p> <p>Because we call the deinitializer in exception handling, we run the risk that both initialize and deinitialize will fail, and hypothetically, it now se...
[ { "answer_id": 368796, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 3, "selected": false, "text": "<p>You shouldn't throw in the Finally block. Instead, use the InnerException to add information in the throw.</...
2008/12/15
[ "https://Stackoverflow.com/questions/368786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40352/" ]
Here's an interesting question. I have a system that attempts to run some initialization code. If it fails, we call the deinitializer to clean everything up. Because we call the deinitializer in exception handling, we run the risk that both initialize and deinitialize will fail, and hypothetically, it now seems that w...
If your clean up code is failing and you cannot leave the application in a clean and known state I would let the exception go unhandled (or catch it with the UnhandledException event to log it) then close the application. Because if you can't handle the first exception, what point is there in catching the second excep...
368,805
<p>Any thoughts on why this isn't working? I really thought 'ignore' would do the right thing.</p> <pre><code>&gt;&gt;&gt; 'add \x93Monitoring\x93 to list '.encode('latin-1','ignore') Traceback (most recent call last): File "&lt;interactive input&gt;", line 1, in ? UnicodeDecodeError: 'ascii' codec can't decode byt...
[ { "answer_id": 368828, "author": "rob", "author_id": 43927, "author_profile": "https://Stackoverflow.com/users/43927", "pm_score": 2, "selected": false, "text": "<p>encode is available to unicode strings, but the string you have there does not seems unicode (try with u'add \\x93Monitorin...
2008/12/15
[ "https://Stackoverflow.com/questions/368805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13009/" ]
Any thoughts on why this isn't working? I really thought 'ignore' would do the right thing. ``` >>> 'add \x93Monitoring\x93 to list '.encode('latin-1','ignore') Traceback (most recent call last): File "<interactive input>", line 1, in ? UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position 4: ordinal ...
…there's a reason they're called "encodings"… A little preamble: think of unicode as the norm, or the ideal state. Unicode is just a table of characters. №65 is latin capital A. №937 is greek capital omega. Just that. In order for a computer to store and-or manipulate Unicode, it has to *encode* it into bytes. The mo...
368,807
<p>The following html code works in Firefox, but for some reason fails in IE (Label2 is not shown). Is that a bug or I miss something?</p> <p>Any help would be appreciated.</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; &lt;html&gt; &lt;head&gt; ...
[ { "answer_id": 368857, "author": "cLFlaVA", "author_id": 45109, "author_profile": "https://Stackoverflow.com/users/45109", "pm_score": 3, "selected": false, "text": "<p>Remember that the onchange event is triggered <strong>after you check the checkbox and then leave the checkbox</strong>...
2008/12/15
[ "https://Stackoverflow.com/questions/368807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42512/" ]
The following html code works in Firefox, but for some reason fails in IE (Label2 is not shown). Is that a bug or I miss something? Any help would be appreciated. ``` <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" co...
### Cause: Per MSDN, the [change event](http://msdn.microsoft.com/en-us/library/ms536912(VS.85).aspx) is > > ...fired when the contents are committed > and not while the value is changing. > For example, on a text box, this event > is not fired while the user is typing, > but rather when the user commits the > chang...
368,813
<p>According to HTML specs, the <code>select</code> tag in HTML doesn't have a <code>readonly</code> attribute, only a <code>disabled</code> attribute. So if you want to keep the user from changing the dropdown, you have to use <code>disabled</code>.</p> <p>The only problem is that disabled HTML form inputs don't get ...
[ { "answer_id": 368822, "author": "kemiller2002", "author_id": 1942, "author_profile": "https://Stackoverflow.com/users/1942", "pm_score": 7, "selected": false, "text": "<p>You can re-enable the select object on submit.</p>\n\n<p><strong>EDIT</strong>: i.e., normally disabling the select ...
2008/12/15
[ "https://Stackoverflow.com/questions/368813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6681/" ]
According to HTML specs, the `select` tag in HTML doesn't have a `readonly` attribute, only a `disabled` attribute. So if you want to keep the user from changing the dropdown, you have to use `disabled`. The only problem is that disabled HTML form inputs don't get included in the POST / GET data. What's the best way ...
You should keep the `select` element `disabled` but also add another hidden `input` with the same name and value. If you reenable your SELECT, you should copy its value to the hidden input in an onchange event and disable (or remove) the hidden input. Here is a demo: ```js $('#mainform').submit(function() { $('...
368,830
<p>I currently have some code that pulls down a list of users in a group and then iterates through that group to determine if a given account exists, but it seems like there ought to be a more concise (and perhaps faster) way to accomplish this.</p> <p>This code (VB.NET) attempts to use the member property of the grou...
[ { "answer_id": 368890, "author": "huseyint", "author_id": 39, "author_profile": "https://Stackoverflow.com/users/39", "pm_score": 5, "selected": true, "text": "<p>If you are on .NET 3.5 stack, <a href=\"http://msdn.microsoft.com/en-us/library/system.directoryservices.accountmanagement.as...
2008/12/15
[ "https://Stackoverflow.com/questions/368830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30018/" ]
I currently have some code that pulls down a list of users in a group and then iterates through that group to determine if a given account exists, but it seems like there ought to be a more concise (and perhaps faster) way to accomplish this. This code (VB.NET) attempts to use the member property of the group object, ...
If you are on .NET 3.5 stack, [System.DirectoryServices.AccountManagement.dll assembly](http://msdn.microsoft.com/en-us/library/system.directoryservices.accountmanagement.aspx) has a nice API on top of AD. The following method can be implemented to solve your issue: ``` static bool IsUserMemberOf(string userName, stri...
368,832
<p>I have a PHP script (running on a Linux server) that ouputs the names of some files on the server. It outputs these file names in a simple text-only format.</p> <p>This output is read from a VB.NET program by using HttpWebRequest, HttpWebResponse, and a StreamReader.</p> <p>The problem is that some of the file nam...
[ { "answer_id": 368848, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 1, "selected": false, "text": "<p>Does PHP give you control over the encoding at all? It's generally not a good idea to just guess at it.</p>\n\n<p>Whe...
2008/12/15
[ "https://Stackoverflow.com/questions/368832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5956/" ]
I have a PHP script (running on a Linux server) that ouputs the names of some files on the server. It outputs these file names in a simple text-only format. This output is read from a VB.NET program by using HttpWebRequest, HttpWebResponse, and a StreamReader. The problem is that some of the file names being output c...
**Figured it out!!** Like so many things, it's simple in retrospect! Jon Skeet was correct - it was *meant* to be UTF-8, but definitely wasn't. Turns out, in the original script I was using (before I stripped it down to make it simpler to debug), there was some additional text output by the script which was not wrap...
368,844
<p>Using ext/ldap I'm trying to add entries to an Active Directory. As long as I only use one single structural objectClass everything works as expected, but as soon as I try to add an entry with a second auxiliary objectClass, the server reports an error:</p> <blockquote> <p>Server is unwilling to perform; 00002040...
[ { "answer_id": 369167, "author": "Martin v. Löwis", "author_id": 33006, "author_profile": "https://Stackoverflow.com/users/33006", "pm_score": 0, "selected": false, "text": "<p>You may not have permission to set the objectClass attribute. See whether you can attach the auxiliary class af...
2008/12/15
[ "https://Stackoverflow.com/questions/368844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11354/" ]
Using ext/ldap I'm trying to add entries to an Active Directory. As long as I only use one single structural objectClass everything works as expected, but as soon as I try to add an entry with a second auxiliary objectClass, the server reports an error: > > Server is unwilling to perform; 00002040: SvcErr: DSID-030F0...
I just found that, in order to add dynamic (per-instance) aux classes, the [forest functional level of the domain must be 2003](http://msdn.microsoft.com/en-us/library/ms676290.aspx).
368,858
<p>I've been working with <a href="http://www.microsoft.com/Sqlserver/" rel="nofollow noreferrer">Microsoft SQL Server</a> with many years now but have only just recently started to use <a href="http://www.mysql.com/" rel="nofollow noreferrer">MySQL</a> with my web applications, and I'm hungry for knowledge.</p> <p>To...
[ { "answer_id": 368886, "author": "mat", "author_id": 42083, "author_profile": "https://Stackoverflow.com/users/42083", "pm_score": 5, "selected": false, "text": "<p>One of the not so hidden feature of MySQL is that it's not really good at being SQL compliant, well, not bugs really, but, ...
2008/12/15
[ "https://Stackoverflow.com/questions/368858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
I've been working with [Microsoft SQL Server](http://www.microsoft.com/Sqlserver/) with many years now but have only just recently started to use [MySQL](http://www.mysql.com/) with my web applications, and I'm hungry for knowledge. To continue with the long line of ["hidden feature" questions](https://stackoverflow.c...
Since you put up a bounty, I'll share my hard won secrets... In general, all the SQLs I tuned today required using sub-queries. Having come from Oracle database world, things I took for granted weren’t working the same with MySQL. And my reading on MySQL tuning makes me conclude that MySQL is behind Oracle in terms of...
368,879
<p>I have an application which tries to load some expected registry settings within its constructor.</p> <p>What is the most appropriate .NET Exception from the BCL to throw if these (essential, non-defaultable) registry settings cannot be loaded?</p> <p>For example:</p> <pre><code> RegistryKey registryKey = Registr...
[ { "answer_id": 368888, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 0, "selected": false, "text": "<p>I would probably throw an ApplicationException since this is specifically related to your application. Alternativel...
2008/12/15
[ "https://Stackoverflow.com/questions/368879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5975/" ]
I have an application which tries to load some expected registry settings within its constructor. What is the most appropriate .NET Exception from the BCL to throw if these (essential, non-defaultable) registry settings cannot be loaded? For example: ``` RegistryKey registryKey = Registry.LocalMachine.OpenSubkey("H...
I'd go with [ArgumentException](http://msdn.microsoft.com/en-us/library/system.argumentexception.aspx) or [ArgumentOutOfRangeException](http://msdn.microsoft.com/en-us/library/system.argumentoutofrangeexception.aspx).. ``` throw new ArgumentException("Could not find registry key: " + theKey); ``` Quoting MSDN: > >...
368,904
<p>I have a classic 3-tier ASP.Net 3.5 web application with forms that display business objects and allow them to be edited. Controls on the form correspond to a property of the underlying business object. The user will have read/write, readonly, or no access to the various controls depending on his/her role. Very conv...
[ { "answer_id": 369008, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 0, "selected": false, "text": "<p>I have often found that this is really the only real easy and understandable way to do it, as your interface ne...
2008/12/15
[ "https://Stackoverflow.com/questions/368904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44394/" ]
I have a classic 3-tier ASP.Net 3.5 web application with forms that display business objects and allow them to be edited. Controls on the form correspond to a property of the underlying business object. The user will have read/write, readonly, or no access to the various controls depending on his/her role. Very convent...
To work properly, I have found that access levels should be in this increasing order: NONE, VIEW, REQUIRED, EDIT. Note that REQUIRED is NOT the top level as you may think it would be since EDIT (both populate & de-populate permission) is a greater privilege than REQUIRED (populate-only permission). The enum would loo...
368,913
<p>What's a good way to serialize a Delphi object tree to XML--using RTTI and not custom code?</p> <p>I would have loved to find that this feature is already built into Delphi, but it doesn't seem to be.</p> <p>I've found a few components (posted, below) that seem like they might perform this function. Have you used...
[ { "answer_id": 368923, "author": "Mattias Andersson", "author_id": 32841, "author_profile": "https://Stackoverflow.com/users/32841", "pm_score": 2, "selected": false, "text": "<p><strong>JVCL's TJvTranslator.ComponentToXML</strong></p>\n\n<p><em>Link:</em> <a href=\"http://sourceforge.ne...
2008/12/15
[ "https://Stackoverflow.com/questions/368913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32841/" ]
What's a good way to serialize a Delphi object tree to XML--using RTTI and not custom code? I would have loved to find that this feature is already built into Delphi, but it doesn't seem to be. I've found a few components (posted, below) that seem like they might perform this function. Have you used any of them or so...
You can use the JVCL TJvAppXMLFileStorage component to serialize TPersistent derived classes. ``` uses JvAppXMLStorage; var Storage: TJvAppXMLFileStorage; begin Storage := TJvAppXMLFileStorage.Create(nil); try Storage.WritePersistent('', MyObject); Storage.Xml.SaveToFile('S:\TestFiles\Test.xml'); ...
368,924
<p>Is there any simple way to access the <code>DataContext</code> in a linq2sql entity class.</p> <p>I'm trying to create something like <code>EntitySet</code> but I cannot figure out how the <code>EntitySet</code> has access to the context that created the entity object in the first place.</p> <p>I want to have a re...
[ { "answer_id": 369618, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "<p>Basically, no.</p>\n\n<p>The <code>EntitySet&lt;T&gt;</code> class has an internal <code>Source</code> property th...
2008/12/15
[ "https://Stackoverflow.com/questions/368924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35371/" ]
Is there any simple way to access the `DataContext` in a linq2sql entity class. I'm trying to create something like `EntitySet` but I cannot figure out how the `EntitySet` has access to the context that created the entity object in the first place. I want to have a regular linq2sql entity class with a way for the cla...
I've just had to do exactly the same thing. Here's my solution (albeit probably not the best approach, but is at least quite elegant): Firstly, Create an interface for all your entities to implement that inherits from INotifyPropertyChanging. This is used to hook up some extension methods and keep our implementation n...
368,926
<p>What's the easiest way to figure out if a window is opened modally or not?</p> <p><strong>CLARIFICATION:</strong></p> <p>I open a window calling </p> <pre><code>myWindow.ShowDialog(); </code></pre> <p>I have a footer with an "OK" &amp; "Cancel" button that I only want to show if the window is opened modally. Now...
[ { "answer_id": 368969, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": 0, "selected": false, "text": "<p>a modal window will stop processing until it is closed.</p>\n\n<p>This example shows displaying a non-modal wind...
2008/12/15
[ "https://Stackoverflow.com/questions/368926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17744/" ]
What's the easiest way to figure out if a window is opened modally or not? **CLARIFICATION:** I open a window calling ``` myWindow.ShowDialog(); ``` I have a footer with an "OK" & "Cancel" button that I only want to show if the window is opened modally. Now I realize I can set a property by doing this: ``` myWin...
From <http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/c95f1acb-5dee-4670-b779-b07b06afafff/> *"System.Windows.Interop.ComponentDispatcher.IsThreadModal can tell you if the calling thread is currently running a modal hwnd."*
368,927
<p>I am working in the Linux environment, and I have a C++ program, what I want is when I cancel the program with ctrl+c I would like that the program executes a function, to close some files and print some sutff, is there any way to do this?. Thank you. </p>
[ { "answer_id": 368944, "author": "Graeme Perrow", "author_id": 1821, "author_profile": "https://Stackoverflow.com/users/1821", "pm_score": 0, "selected": false, "text": "<p>Short answer: look into the signal function, specifically catching SIGINT. You write a callback function and pass i...
2008/12/15
[ "https://Stackoverflow.com/questions/368927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39160/" ]
I am working in the Linux environment, and I have a C++ program, what I want is when I cancel the program with ctrl+c I would like that the program executes a function, to close some files and print some sutff, is there any way to do this?. Thank you.
`signal()` can be dangerous on some OSes and is deprecated on Linux in favor of `sigaction()`. ["signal versus sigaction"](https://www.petesh.com/archives/2008/11/signal_versus_sigaction/) Here's an example that I ran across recently (["Tap the interrupt signal"](http://cc.byexamples.com/20070520/tap-the-interrupt-sig...
368,943
<p>How do I get the div from within this (the last) list item?</p> <p>Currently I have this, which is just plain ugly...any suggestions on a cleaner selector/ solution?</p> <pre><code>var div = ul.append("&lt;li&gt;&lt;div&gt;&lt;/div&gt;&lt;/li&gt;").contents("li:last-child")[0].children[0]; </code></pre> <p>Thanks...
[ { "answer_id": 368955, "author": "doekman", "author_id": 56, "author_profile": "https://Stackoverflow.com/users/56", "pm_score": 0, "selected": false, "text": "<p>Like this?</p>\n\n<pre><code>var div = ul.append(\"&lt;li&gt;&lt;div&gt;&lt;/div&gt;&lt;/li&gt;\").contents(\"li:last-child &...
2008/12/15
[ "https://Stackoverflow.com/questions/368943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5791/" ]
How do I get the div from within this (the last) list item? Currently I have this, which is just plain ugly...any suggestions on a cleaner selector/ solution? ``` var div = ul.append("<li><div></div></li>").contents("li:last-child")[0].children[0]; ``` Thanks!
Using an array-index returns just the HTMLElement object and so removes a lot of jQuery's useful functionality, so be careful with that. I would tend to approach it this way: ``` var div = $("<div/>").appendTo($("<li/>").appendTo(ul)); ``` From innermost to outermost, this creates a list item, appends it to your lis...
368,945
<p>Having some SSIS permissions issue.</p> <p>I am calling the SSIS package in my .net console application with:</p> <pre><code>Package pkg = app.LoadFromSqlServer(packagePath, serverName, serverUsername, serverPassword, dtsEvents); </code></pre> <p>It is working when manually running it using the windows accout, bu...
[ { "answer_id": 372358, "author": "Michael Entin", "author_id": 19880, "author_profile": "https://Stackoverflow.com/users/19880", "pm_score": 1, "selected": false, "text": "<p>There are plenty of reasons for it to fail when run under different account, to avoid trying to fix it blindly, y...
2008/12/15
[ "https://Stackoverflow.com/questions/368945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
Having some SSIS permissions issue. I am calling the SSIS package in my .net console application with: ``` Package pkg = app.LoadFromSqlServer(packagePath, serverName, serverUsername, serverPassword, dtsEvents); ``` It is working when manually running it using the windows accout, but fails with the above call in my...
There are plenty of reasons for it to fail when run under different account, to avoid trying to fix it blindly, you should get the error information. It looks like you are supplying dtsEvent parameter - so your app should get the error message. Another way to get it to examine package.Error collection after execution, ...
368,947
<p>We have a button that saves asynchronously using AjaxToolKit/C#/.NET. I'm getting this in my Error Console:</p> <pre><code>Error: [Exception... "'Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the s...
[ { "answer_id": 369013, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 3, "selected": true, "text": "<p>Things to check:</p>\n\n<ol>\n<li>Reboot (oldie but goodie, and doesn't always go without saying)</li>\n<li>OS version (...
2008/12/15
[ "https://Stackoverflow.com/questions/368947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25538/" ]
We have a button that saves asynchronously using AjaxToolKit/C#/.NET. I'm getting this in my Error Console: ``` Error: [Exception... "'Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The stat...
Things to check: 1. Reboot (oldie but goodie, and doesn't always go without saying) 2. OS version (you did this) 3. Web browser (you did this) 4. Web browser settings (you covered this by trying multiple browsers) 5. Network connectivity and [Hosts file](http://en.wikipedia.org/wiki/Hosts_file) rules 6. User permissio...
368,956
<p>I have forms in my page a get and a post and i want add pager on my get form .. so i cant page through the results.. </p> <p>The problem that i am having is when i move to the second page it does not display anything..</p> <p>I am using this library for paging .. <a href="http://stephenwalther.com/Blog/archive/200...
[ { "answer_id": 369049, "author": "maxnk", "author_id": 45862, "author_profile": "https://Stackoverflow.com/users/45862", "pm_score": 1, "selected": false, "text": "<p>Of course it will hit the GET version of SearchByAttraction because using this control you have a links as output.</p>\n\...
2008/12/15
[ "https://Stackoverflow.com/questions/368956", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43838/" ]
I have forms in my page a get and a post and i want add pager on my get form .. so i cant page through the results.. The problem that i am having is when i move to the second page it does not display anything.. I am using this library for paging .. <http://stephenwalther.com/Blog/archive/2008/09/18/asp-net-mvc-tip-4...
I'd recommend against doing paging via HTTP POST. Page and search criteria are 2 perfect examples of what querystrings are meant for. Put those values in the query string & have that load up your action args. Think about this. You can search google for "pies", navigate to page 14, copy the link and send it to your gra...
368,966
<p>I'm trying to do query result pagination with hibernate and displaytag, and Hibernate <code>DetachedCriteria</code> objects are doing their best to stand in the way. Let me explain...</p> <p>The easiest way to do pagination with displaytag seems to be implementing the <code>PaginatedList</code> interface that has, ...
[ { "answer_id": 369197, "author": "james", "author_id": 46430, "author_profile": "https://Stackoverflow.com/users/46430", "pm_score": 3, "selected": true, "text": "<p>well, DetachedCriteria are Serializable, so you have built-in (if inelegant) deep clone support. You could serialize the ...
2008/12/15
[ "https://Stackoverflow.com/questions/368966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6069/" ]
I'm trying to do query result pagination with hibernate and displaytag, and Hibernate `DetachedCriteria` objects are doing their best to stand in the way. Let me explain... The easiest way to do pagination with displaytag seems to be implementing the `PaginatedList` interface that has, among others, the following meth...
well, DetachedCriteria are Serializable, so you have built-in (if inelegant) deep clone support. You could serialize the initial criteria to a byte[] once on construction, then deserialize it each time you want to use it.
368,967
<p>There example on the net and code given in Learn OpenCv,Orielly.</p> <p>After many attempts the out.avi file is written with 0 bytes. I wonder where i went wrong.</p> <p>The following are the code i used...</p> <pre><code>int main(int argc, char* argv[]) { CvCapture* input = cvCaptureFromFile(argv[1]); Ip...
[ { "answer_id": 397703, "author": "sgielen", "author_id": 13104, "author_profile": "https://Stackoverflow.com/users/13104", "pm_score": 0, "selected": false, "text": "<p>Maybe you could try inserting a printf(\"Frame found\\n\") inside the for(;;) to see if it is actually capturing frames...
2008/12/15
[ "https://Stackoverflow.com/questions/368967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43076/" ]
There example on the net and code given in Learn OpenCv,Orielly. After many attempts the out.avi file is written with 0 bytes. I wonder where i went wrong. The following are the code i used... ``` int main(int argc, char* argv[]) { CvCapture* input = cvCaptureFromFile(argv[1]); IplImage* image = cvRetrieveFr...
My bet is that cvCreateVideoWriter returns NULL. Just step through it to see if it's true. In that case, the problem is probably with CV\_FOURCC(..) which doesnt find the codec and force a return 0; you can try using -1 instead of CV\_FOURCC. There is gonna be a prompt during runtime for you to chose the appropriate c...
368,976
<p>I have an abstract class defining a pure virtual method in c++:</p> <pre><code>class Base { Base(); ~Base(); virtual bool Test() = 0; }; </code></pre> <p>I have subclassed this with a number of other classes (which provide an implementation for Test()), which I'll refer to as A, B, C, etc. I now want to create an...
[ { "answer_id": 368984, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 5, "selected": true, "text": "<p>There is only a slight misunderstanding in that code. Instead of allocating Base objects, you have to all...
2008/12/15
[ "https://Stackoverflow.com/questions/368976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18909/" ]
I have an abstract class defining a pure virtual method in c++: ``` class Base { Base(); ~Base(); virtual bool Test() = 0; }; ``` I have subclassed this with a number of other classes (which provide an implementation for Test()), which I'll refer to as A, B, C, etc. I now want to create an array of any of these typ...
There is only a slight misunderstanding in that code. Instead of allocating Base objects, you have to allocate pointers. A pointer can exist at any time. A pointer to a abstract class, to an incomplete type, and even to void is valid: ``` int main(int argc, char* argv[]) { int size = 0; Base** bases = new Base...
368,981
<p>I have a full path which I would like to remove certain levels of it. So for instance,</p> <pre><code>/home/john/smith/web/test/testing/nothing/ </code></pre> <p>I would like to get rid of 4 levels, so I get</p> <pre><code>/test/testing/nothing/ </code></pre> <p>What would be a good of doing this?</p> <p>Thanks...
[ { "answer_id": 368989, "author": "troelskn", "author_id": 18180, "author_profile": "https://Stackoverflow.com/users/18180", "pm_score": 4, "selected": true, "text": "<p>A simple solution is to slice the path up into parts, and then manipulate the array before sticking it back together ag...
2008/12/15
[ "https://Stackoverflow.com/questions/368981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a full path which I would like to remove certain levels of it. So for instance, ``` /home/john/smith/web/test/testing/nothing/ ``` I would like to get rid of 4 levels, so I get ``` /test/testing/nothing/ ``` What would be a good of doing this? Thanks
A simple solution is to slice the path up into parts, and then manipulate the array before sticking it back together again: ``` join("/", array_slice(explode("/", $path), 5)); ``` Of course, if you wanted to remove that specific path, you could also use a regular expression: ``` preg_replace('~^/home/john/smith/web...
368,997
<p>I have a column that contains dates, when I click the column header the column is sorted numerically and not by date. How would I sort this by date? The date is in the format dd/mm/yy.</p> <p>Example (sorted oldest first):</p> <p>10/12/08 &lt;--December 10/09/08 &lt;--September 12/12/08 &lt;--December</p> <p>Many...
[ { "answer_id": 369014, "author": "Gunny", "author_id": 12830, "author_profile": "https://Stackoverflow.com/users/12830", "pm_score": 3, "selected": false, "text": "<p>Is the source a datatable? If so, you'll probably need to specify that the column in question is of type DateTime:</p>\n\...
2008/12/15
[ "https://Stackoverflow.com/questions/368997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a column that contains dates, when I click the column header the column is sorted numerically and not by date. How would I sort this by date? The date is in the format dd/mm/yy. Example (sorted oldest first): 10/12/08 <--December 10/09/08 <--September 12/12/08 <--December Many thanks
Is the source a datatable? If so, you'll probably need to specify that the column in question is of type DateTime: ``` myDataTable.Columns["ColumnName"].DataType = System.Type.GetType("System.Date"); ``` Hope that helps!
369,007
<p>I've been using NetBeans as the XDebug interactive debugging client. But seems like it only supports attaching debuggers to scripts that are invoked via Firefox. I want to step through the request parse script when it's invoked via cURL.</p>
[ { "answer_id": 369185, "author": "lewen7er9", "author_id": 46413, "author_profile": "https://Stackoverflow.com/users/46413", "pm_score": 2, "selected": false, "text": "<p>I figured out the answer. First I attached a debugger by right-clicking on the wordpress project in netbeans and choo...
2008/12/15
[ "https://Stackoverflow.com/questions/369007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46413/" ]
I've been using NetBeans as the XDebug interactive debugging client. But seems like it only supports attaching debuggers to scripts that are invoked via Firefox. I want to step through the request parse script when it's invoked via cURL.
I figured out the answer. First I attached a debugger by right-clicking on the wordpress project in netbeans and choosing "debug". This will open the blog in firefox with the "XDEBUG\_SESSION\_START=netbeans-xdebug" param included in the url (e.g. "<http://localhost/wordpress/?XDEBUG_SESSION_START=netbeans-xdebug>"). ...
369,011
<p>Is it possible to avoid the automatic collapse of a Silverlight ComboBox after LostFocus?</p>
[ { "answer_id": 371033, "author": "Sorskoot", "author_id": 31722, "author_profile": "https://Stackoverflow.com/users/31722", "pm_score": 2, "selected": true, "text": "<p>I don't think there is an easy way around this. The code below is copied from the disassembled code from the ComboBox C...
2008/12/15
[ "https://Stackoverflow.com/questions/369011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3714/" ]
Is it possible to avoid the automatic collapse of a Silverlight ComboBox after LostFocus?
I don't think there is an easy way around this. The code below is copied from the disassembled code from the ComboBox Class. As you can see it closes always when hasFocus is false. I don't think there is any way around this. Writing your own ComboBox is a solution. ``` private void FocusChanged(bool hasFocus) { th...
369,024
<p>How do I achieve the equivalent of the LVIS_CUT style for a listview item? It looks like it's not exposed by the framework? Should I P/Invoke?</p> <p>Edit: LVIS_CUT is a Win32 style that affects the look of the item: It grays the item image. You can see it in action in Windows Explorer: Select a file and type Ctrl+...
[ { "answer_id": 369048, "author": "BFree", "author_id": 15861, "author_profile": "https://Stackoverflow.com/users/15861", "pm_score": 0, "selected": false, "text": "<p>Are you referring to when it's grayed out? Like when you do a \"cut\" on it? If so, I would just set the forecolor to Ina...
2008/12/15
[ "https://Stackoverflow.com/questions/369024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12379/" ]
How do I achieve the equivalent of the LVIS\_CUT style for a listview item? It looks like it's not exposed by the framework? Should I P/Invoke? Edit: LVIS\_CUT is a Win32 style that affects the look of the item: It grays the item image. You can see it in action in Windows Explorer: Select a file and type Ctrl+X. TIA.
Well, one way to "achieve the equivalent of the LVIS\_CUT style" would be the following: Use a function along the lines of ``` private void MakeCutList(ImageList sourceList, Color background) { Brush overlay = new SolidBrush(Color.FromArgb(128, BackColor)); Rectangle rect = new Rectangle(new Point(0, 0), source...
369,026
<p>I have a page with a <code>document.onkeydown</code> event handler, and I'm loading it inside an iframe in another page. I have to click inside the iframe to get the content page to start "listening". </p> <p>Is there some way I can use JavaScript in the outer page to set the focus to the inner page so I don't have...
[ { "answer_id": 369034, "author": "Jaime Febres", "author_id": 33205, "author_profile": "https://Stackoverflow.com/users/33205", "pm_score": 4, "selected": false, "text": "<pre><code>document.getElementsByName(\"iframe_name\")[0].contentWindow.document.body.focus();\n</code></pre>\n" },...
2008/12/15
[ "https://Stackoverflow.com/questions/369026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4435/" ]
I have a page with a `document.onkeydown` event handler, and I'm loading it inside an iframe in another page. I have to click inside the iframe to get the content page to start "listening". Is there some way I can use JavaScript in the outer page to set the focus to the inner page so I don't have to click inside the ...
I had a similar problem with the jQuery Thickbox (a lightbox-style dialog widget). The way I fixed my problem is as follows: ``` function setFocusThickboxIframe() { var iframe = $("#TB_iframeContent")[0]; iframe.contentWindow.focus(); } $(document).ready(function(){ $("#id_cmd_open").click(function(){ ...
369,042
<p>I have a table with doctor offices and doctors in those offices that I'm populating to a repeater control. The data coming back is not aggregated. So, if there are 2 doctors in 1 office, there are 2 rows, same office, different doctor. </p> <p>Is there a way to aggregate the data so the repeater shows 1 office with...
[ { "answer_id": 369052, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 0, "selected": false, "text": "<p>I think you'd be best doing the aggregation in the database.</p>\n" }, { "answer_id": 369081, "author": "Bi...
2008/12/15
[ "https://Stackoverflow.com/questions/369042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45043/" ]
I have a table with doctor offices and doctors in those offices that I'm populating to a repeater control. The data coming back is not aggregated. So, if there are 2 doctors in 1 office, there are 2 rows, same office, different doctor. Is there a way to aggregate the data so the repeater shows 1 office with all of th...
In your aspx markup: ``` <table><tr><th>Office</th><th>Doctors</th></tr> <asp:repeater id="Repeater" runat="server" OnItemDataBound="NextItem" ... > <ItemTemplate><asp:Literal id="RepeaterRow" runat="server" /> </ItemTemplate> </asp:repeater> <asp:Literal id="LastRow" runat="server" /> </table> ``` In your c...
369,046
<p>I want to debug my project in Zend Framework in Eclipse. Zend Debugger is already running bud now I have problem with Debug tool in Eclipse. It give an extra GET parametrs and the project in Zend don't like it.</p> <p>I tried to google it and found <a href="http://framework.zend.com/wiki/display/ZFDEV/Configuring+Y...
[ { "answer_id": 371713, "author": "Akeem", "author_id": 35505, "author_profile": "https://Stackoverflow.com/users/35505", "pm_score": 1, "selected": false, "text": "<p>I successfully use the debugger and my htaccess looks like this </p>\n\n<pre><code>&lt;IfModule mod_rewrite.c&gt;\nRewrit...
2008/12/15
[ "https://Stackoverflow.com/questions/369046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45846/" ]
I want to debug my project in Zend Framework in Eclipse. Zend Debugger is already running bud now I have problem with Debug tool in Eclipse. It give an extra GET parametrs and the project in Zend don't like it. I tried to google it and found [this](http://framework.zend.com/wiki/display/ZFDEV/Configuring+Your+URL+Rewr...
with actual Zend Framework 1.9.6 and Zend Debugger it works without any special changes
369,090
<p>When I drag a link that is inside a draggable div over an iframe in IE7, I get very strange results. Try the code below and let me know if you have any suggestions about how to fix this.</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transit...
[ { "answer_id": 369205, "author": "scunliffe", "author_id": 6144, "author_profile": "https://Stackoverflow.com/users/6144", "pm_score": 3, "selected": true, "text": "<p>I found the only way to handle this gracefully was to place a full size div, with transparency = 1% over the iframe, the...
2008/12/15
[ "https://Stackoverflow.com/questions/369090", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45849/" ]
When I drag a link that is inside a draggable div over an iframe in IE7, I get very strange results. Try the code below and let me know if you have any suggestions about how to fix this. ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html>...
I found the only way to handle this gracefully was to place a full size div, with transparency = 1% over the iframe, then drag my content over top of it. PS the dragging issue is in IE6 and IE8 too.
369,102
<p>Does anyone know how I could go about doing something like :</p> <p>Html.ActionLink(c => c.SomeAction(new MessageObject { Id = 1 } ))</p> <p>This should output a link with the url of "/Controller/SomeAction/1", pointing at an ActionMethod along the lines of:</p> <pre><code>public Controller : Controller { publi...
[ { "answer_id": 370375, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 0, "selected": false, "text": "<p>I'm not sure exactly what you are trying to do since your example URL doesn't match that required for the signature ...
2008/12/15
[ "https://Stackoverflow.com/questions/369102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12459/" ]
Does anyone know how I could go about doing something like : Html.ActionLink(c => c.SomeAction(new MessageObject { Id = 1 } )) This should output a link with the url of "/Controller/SomeAction/1", pointing at an ActionMethod along the lines of: ``` public Controller : Controller { public ActionResult SomeMethod(Me...
In the end I ended up wrapping the following code in an HtmlHelper extension method. This would allow me to use something like Html.ActionLink(c => c.SomeAction(new MessageObject { Id = 1 } )) and have all the properties of the MessageObject created as RouteValues. ``` public static RouteValueDictionary GetRouteVal...
369,116
<p>When I hit /// in Visual Studio, is it possible to change the resulting snippet from this:</p> <pre><code>/// &lt;summary&gt; /// /// &lt;/summary&gt; </code></pre> <p>to this?:</p> <pre><code>/// &lt;summary&gt;&lt;/summary&gt; </code></pre>
[ { "answer_id": 369125, "author": "Joseph Ferris", "author_id": 15906, "author_profile": "https://Stackoverflow.com/users/15906", "pm_score": 2, "selected": false, "text": "<p>I know that it was possible for VB in VS 2005 and VS 2008. Last I had checked, though, there was not a way to do...
2008/12/15
[ "https://Stackoverflow.com/questions/369116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2596/" ]
When I hit /// in Visual Studio, is it possible to change the resulting snippet from this: ``` /// <summary> /// /// </summary> ``` to this?: ``` /// <summary></summary> ```
Here is the solution working in at least VS2010. Save the bottom code as a file summ.snippet. Visual Studio 2010 / Tools / Code Snippet Manager Click import, browse to file. Save with default options. Now goto your code window and type summ + tab + tab Result ``` /// <summary> </summary> ``` with the curso...
369,119
<p>I need to have a routine/function/stored proc/whatever to archive particular accounts from our 'active' table, to an inactive table.</p> <p>I can write this out as a group of queries, all executed in order by PHP one at a time, but I'm looking to offload most of the work to mysql because it's not necessary for PHP ...
[ { "answer_id": 369133, "author": "TravisO", "author_id": 35116, "author_profile": "https://Stackoverflow.com/users/35116", "pm_score": 1, "selected": true, "text": "<p>You might want to use scheduled tasks aka events if you want this to be run daily, automatically. You can read about th...
2008/12/15
[ "https://Stackoverflow.com/questions/369119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13704/" ]
I need to have a routine/function/stored proc/whatever to archive particular accounts from our 'active' table, to an inactive table. I can write this out as a group of queries, all executed in order by PHP one at a time, but I'm looking to offload most of the work to mysql because it's not necessary for PHP to be invo...
You might want to use scheduled tasks aka events if you want this to be run daily, automatically. You can read about them in the MySQL documentation [here](http://dev.mysql.com/tech-resources/articles/event-feature.html). Keep in mind you need to use MySQL 5.1.6 or newer to do this, if not, time to upgrade (there's be...
369,120
<p>Every now and then I get an error when I set up states in an MXML file. The error I get says that mx:states could not be resolved to a component implementation.</p> <p>I read, at the following url, that this issue is caused by extending components - that somehow throws off the compiler's ability to resolve mx:stat...
[ { "answer_id": 369605, "author": "Josh Tynjala", "author_id": 10768, "author_profile": "https://Stackoverflow.com/users/10768", "pm_score": 5, "selected": true, "text": "<p>If you have a custom component, you'll probably have it in a namespace other than <em>mx</em>. You're on the right ...
2008/12/15
[ "https://Stackoverflow.com/questions/369120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37446/" ]
Every now and then I get an error when I set up states in an MXML file. The error I get says that mx:states could not be resolved to a component implementation. I read, at the following url, that this issue is caused by extending components - that somehow throws off the compiler's ability to resolve mx:states. I don't...
If you have a custom component, you'll probably have it in a namespace other than *mx*. You're on the right track by removing the namespace, but you don't have to do that. Consider the following example ``` <example:MyComponent xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:example="com.example.*"> </example:MyCo...
369,122
<p>I have the following Clojure code and I'm not sure why it's not working:</p> <pre><code>(defn match (x y &amp;optional binds) (cond ((eql x y) (values binds t)) ((assoc x binds) (match (binding x binds) y binds)) ((assoc y binds) (match x (binding y binds) binds)) ((var? x) (values (cons (cons x y) bi...
[ { "answer_id": 369332, "author": "Paul Reiners", "author_id": 7648, "author_profile": "https://Stackoverflow.com/users/7648", "pm_score": 6, "selected": true, "text": "<p>The problem is that I'm using parentheses ('(' and ')'), rather than square brackets ('[' and ']'), for the arguments...
2008/12/15
[ "https://Stackoverflow.com/questions/369122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7648/" ]
I have the following Clojure code and I'm not sure why it's not working: ``` (defn match (x y &optional binds) (cond ((eql x y) (values binds t)) ((assoc x binds) (match (binding x binds) y binds)) ((assoc y binds) (match x (binding y binds) binds)) ((var? x) (values (cons (cons x y) binds) t)) ((var?...
The problem is that I'm using parentheses ('(' and ')'), rather than square brackets ('[' and ']'), for the arguments list. It should start out like this: ``` (defn match [x y &optional binds] ``` (I found the answer in *Programming Clojure* by Stuart Halloway.)
369,132
<p>I have two services and am sending pretty chunky messages between them (~100kb). Though the previously mentioned value is typical of the size of the message, it is possible for it to fluctuate greatly (in both positive and negative directions).</p> <p>Thus, to deal with such situations where i have to transport a sw...
[ { "answer_id": 371202, "author": "tomasr", "author_id": 10292, "author_profile": "https://Stackoverflow.com/users/10292", "pm_score": 0, "selected": false, "text": "<p>There are ocassional problems with WCF that will cause it to fail \"silently\" (i.e. no exception) which can be hard to ...
2008/12/15
[ "https://Stackoverflow.com/questions/369132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have two services and am sending pretty chunky messages between them (~100kb). Though the previously mentioned value is typical of the size of the message, it is possible for it to fluctuate greatly (in both positive and negative directions). Thus, to deal with such situations where i have to transport a swollen mes...
well this problem seems to have resolved itself (suddenly after never complaining before, WCF started getting upset about a certain value in the app.config, changed that and it seemed to work then!) however now i have an equally strange problem! for somre reason it refuses to accept that i have configured metadata to ...
369,145
<p>When the following two lines of code are executed in a bash script, "ls" complains that the files don't exist:</p> <pre><code>dirs=/content/{dev01,dev02} ls -l $dirs </code></pre> <p>When I run the script with the -x option, it appears to be passing the variable within single quotes (which would prevent globbing):...
[ { "answer_id": 369165, "author": "Zsolt Botykai", "author_id": 11621, "author_profile": "https://Stackoverflow.com/users/11621", "pm_score": -1, "selected": false, "text": "<pre><code>ls `echo $dirs` \n</code></pre>\n\n<p>works under cygwin. </p>\n" }, { "answer_id": 369181, ...
2008/12/15
[ "https://Stackoverflow.com/questions/369145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42126/" ]
When the following two lines of code are executed in a bash script, "ls" complains that the files don't exist: ``` dirs=/content/{dev01,dev02} ls -l $dirs ``` When I run the script with the -x option, it appears to be passing the variable within single quotes (which would prevent globbing): ``` + dirs=/content/{dev...
I think it is the order of expansions: > > The order of expansions is: `brace > expansion`, tilde expansion, parameter, > `variable` and arithmetic expansion and > command substitution (done in a > left-to-right fashion), word > splitting, and `pathname expansion`. > > > So if your variable is substituted, b...
369,147
<p>I have a paragraph of text in a javascript variable called 'input_content' and that text contains multiple anchor tags/links. I would like to match all of the anchor tags and extract anchor text and URL, and put it into an array like (or similar to) this:</p> <pre>Array ( [0] => Array ( [0] ...
[ { "answer_id": 369174, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 7, "selected": true, "text": "<pre><code>var matches = [];\n\ninput_content.replace(/[^&lt;]*(&lt;a href=\"([^\"]+)\"&gt;([^&lt;]+)&lt;\\/a&gt;)/g, fu...
2008/12/15
[ "https://Stackoverflow.com/questions/369147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/74552/" ]
I have a paragraph of text in a javascript variable called 'input\_content' and that text contains multiple anchor tags/links. I would like to match all of the anchor tags and extract anchor text and URL, and put it into an array like (or similar to) this: ``` Array ( [0] => Array ( [0] => <a h...
``` var matches = []; input_content.replace(/[^<]*(<a href="([^"]+)">([^<]+)<\/a>)/g, function () { matches.push(Array.prototype.slice.call(arguments, 1, 4)) }); ``` This assumes that your anchors will always be in the form `<a href="...">...</a>` i.e. it won't work if there are any other attributes (for example...
369,151
<p>Everytime i retrieve data from a mysql stored procedure with a concat function an error will occur after binding the datagridview to the datatable that holds the returned rows.</p>
[ { "answer_id": 369239, "author": "maxnk", "author_id": 45862, "author_profile": "https://Stackoverflow.com/users/45862", "pm_score": 1, "selected": true, "text": "<p>I suppose you should make an alias for selected value:</p>\n\n<pre><code>select concat(column1, column2) as concatenated f...
2008/12/15
[ "https://Stackoverflow.com/questions/369151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26087/" ]
Everytime i retrieve data from a mysql stored procedure with a concat function an error will occur after binding the datagridview to the datatable that holds the returned rows.
I suppose you should make an alias for selected value: ``` select concat(column1, column2) as concatenated from table1 ```
369,177
<p>When I try to connect to WMI from Powershell, ConfigMgr, or WMI explorer, I can talk to the majority of my computers, but some (maybe 30%?) return an 0x800706ba (RPC server is unavailable).</p> <p>If I turn the firewall off on the remote machine, the queries start working. I have tried a bunch of different configu...
[ { "answer_id": 369239, "author": "maxnk", "author_id": 45862, "author_profile": "https://Stackoverflow.com/users/45862", "pm_score": 1, "selected": true, "text": "<p>I suppose you should make an alias for selected value:</p>\n\n<pre><code>select concat(column1, column2) as concatenated f...
2008/12/15
[ "https://Stackoverflow.com/questions/369177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44831/" ]
When I try to connect to WMI from Powershell, ConfigMgr, or WMI explorer, I can talk to the majority of my computers, but some (maybe 30%?) return an 0x800706ba (RPC server is unavailable). If I turn the firewall off on the remote machine, the queries start working. I have tried a bunch of different configurations of ...
I suppose you should make an alias for selected value: ``` select concat(column1, column2) as concatenated from table1 ```
369,187
<p><strong>Please note the Edit below for a lot more information, and a possible solution</strong></p> <p>We recently modified a large Delphi application to use ADO connections and queries instead of BDE connections and queries. Since that change, performance has become terrible.</p> <p>I've profiled the application...
[ { "answer_id": 369260, "author": "zendar", "author_id": 25732, "author_profile": "https://Stackoverflow.com/users/25732", "pm_score": 5, "selected": true, "text": "<p>I don't know about Delphi 2007, but I did same thing with Delphi 7 and Oracle 8.</p>\n\n<p>Here are things I did:</p>\n\n...
2008/12/15
[ "https://Stackoverflow.com/questions/369187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/672/" ]
**Please note the Edit below for a lot more information, and a possible solution** We recently modified a large Delphi application to use ADO connections and queries instead of BDE connections and queries. Since that change, performance has become terrible. I've profiled the application and the bottleneck seems to be...
I don't know about Delphi 2007, but I did same thing with Delphi 7 and Oracle 8. Here are things I did: * Set **TAdoDataSet.CursorLocation** according to query: + ***clUseClient*** if query fetches records for GUI and query is relatively "simple" - no grouping or sum + ***clUseServer*** if query have some sort of a...
369,198
<p>I have the following problem. If I query values with a keyfigure which is a function I can't specify multiple values of the same dimension restriction, but if it is not a function it works.</p> <p>So this works:</p> <pre><code>SELECT {[Measures].[Netto]} on columns FROM TDC where ({NonEmpty([Time].[Month].[Month]....
[ { "answer_id": 371866, "author": "Anders Rune Jensen", "author_id": 13995, "author_profile": "https://Stackoverflow.com/users/13995", "pm_score": 2, "selected": true, "text": "<p>Ok, this works:</p>\n\n<pre><code>WITH MEMBER [Time].[Month].a AGGREGATE \n({[Time].[Month].[Month].&amp;[200...
2008/12/15
[ "https://Stackoverflow.com/questions/369198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13995/" ]
I have the following problem. If I query values with a keyfigure which is a function I can't specify multiple values of the same dimension restriction, but if it is not a function it works. So this works: ``` SELECT {[Measures].[Netto]} on columns FROM TDC where ({NonEmpty([Time].[Month].[Month].&[2008-03-01T00:00:00...
Ok, this works: ``` WITH MEMBER [Time].[Month].a AGGREGATE ({[Time].[Month].[Month].&[2008-03-01T00:00:00], [Time].[Month].[Month].&[2008-04-01T00:00:00]}) SELECT {[Measures].[CalculatedFunction]} on columns FROM TDC where a ```
369,211
<p>I've got a node struct</p> <pre><code>struct Node{CString text, int id;}; </code></pre> <p>in a sorted vector. </p> <p>I'm wondering if there's a function in algorithm that will do a binary search of the vector and find an element. </p>
[ { "answer_id": 369243, "author": "Binary Worrier", "author_id": 18797, "author_profile": "https://Stackoverflow.com/users/18797", "pm_score": 3, "selected": false, "text": "<p>Yes, there's a function called \"binary_search\" std::binary_search </p>\n\n<p>You give it first, last and a val...
2008/12/15
[ "https://Stackoverflow.com/questions/369211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31325/" ]
I've got a node struct ``` struct Node{CString text, int id;}; ``` in a sorted vector. I'm wondering if there's a function in algorithm that will do a binary search of the vector and find an element.
`std::binary_search()` will tell you if a value exists in the container. `std::lower_bound()/std::upper_bound()` will return an iterator to the first/last occurrence of a value. Your objects need to implement `operator<` for these algorithms to work.
369,213
<p>I am writing a addressbook module for my software right now. I have the database set up so far that it supports a very flexible address-book configuration.</p> <p>I can create n-entries for every type I want. Type means here data like 'email', 'address', 'telephone' etc.</p> <p>I have a table named 'contact_profil...
[ { "answer_id": 369253, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 1, "selected": false, "text": "<p>If you are limiting yourself to displaying a single email, name, website, etc. for each person in this query, I'd use s...
2008/12/15
[ "https://Stackoverflow.com/questions/369213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9535/" ]
I am writing a addressbook module for my software right now. I have the database set up so far that it supports a very flexible address-book configuration. I can create n-entries for every type I want. Type means here data like 'email', 'address', 'telephone' etc. I have a table named 'contact\_profiles'. This only ...
You have reinvented a database design called [Entity-Attribute-Value](http://en.wikipedia.org/wiki/Entity-attribute-value_model). This design has a lot of weaknesses, including the weakness you've discovered: it's very hard to reproduce a query result in a conventional format, with one column per attribute. Here's an...
369,220
<p>I entered this statement in JSLint:</p> <pre><code>var number = new Number(3); </code></pre> <p>And received the following message:</p> <blockquote> <p>Do not use Number as a constructor.</p> </blockquote> <p>Why is that? The statement is creating a number object, not a primitive value, so I don't see why usin...
[ { "answer_id": 369257, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 4, "selected": false, "text": "<pre><code>var number = new Number(3);\nalert(typeof number); // gives \"object\"\n</code></pre>\n\n<p>Making the varia...
2008/12/15
[ "https://Stackoverflow.com/questions/369220", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I entered this statement in JSLint: ``` var number = new Number(3); ``` And received the following message: > > Do not use Number as a constructor. > > > Why is that? The statement is creating a number object, not a primitive value, so I don't see why using `new` is a problem. **EDIT:** Thanks for all the res...
In addition to breaking === and typeof returning "object", using the Number constructor also changes the way the value is used in boolean contexts. Since "new Number(0)" is an object, not a literal value, it evaluates as "true" because it is not null. So for example: ``` var n1 = 0; var n2 = new Number(0); n1 == n2 ...
369,230
<p>I am using Django and the Google Web Toolkit (GWT) for my current project. I would like to pass a ModelForm instance to GWT via an Http response so that I can "chop" it up and render it as I please. My goal is to keep the form in sync with changes to my models.py file, yet increase control I have over the look of th...
[ { "answer_id": 372371, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>If your problem is just to serialze a ModelForm to json, just write your own simplejson serializer subclass.</p>\n" }, ...
2008/12/15
[ "https://Stackoverflow.com/questions/369230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44440/" ]
I am using Django and the Google Web Toolkit (GWT) for my current project. I would like to pass a ModelForm instance to GWT via an Http response so that I can "chop" it up and render it as I please. My goal is to keep the form in sync with changes to my models.py file, yet increase control I have over the look of the f...
If you were using pure Django, you'd pass the form to your template, and could then call individual fields on the form for more precise rendering, rather than using ModelForm.to\_table. You can use the following to iterate over each field and render it exactly how you want: ``` {% for field in form.fields %} <div ...
369,242
<p>In my code segment, when I script the file name, it gives me a permission denied on the following line: </p> <pre><code>Set objTextFile = objFSO.OpenTextFile(strDirectory &amp; strFile, ForAppending, True) </code></pre> <p>Here is the script </p> <pre><code>'output log info Function OutputToLog (strToAdd) ...
[ { "answer_id": 369287, "author": "BenAlabaster", "author_id": 40650, "author_profile": "https://Stackoverflow.com/users/40650", "pm_score": 5, "selected": true, "text": "<p>I don't think this has to do with File Permissions per se. It has to do with the fact that you've created the file...
2008/12/15
[ "https://Stackoverflow.com/questions/369242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18853/" ]
In my code segment, when I script the file name, it gives me a permission denied on the following line: ``` Set objTextFile = objFSO.OpenTextFile(strDirectory & strFile, ForAppending, True) ``` Here is the script ``` 'output log info Function OutputToLog (strToAdd) Dim strDirectory,strFile,strText, objFile...
I don't think this has to do with File Permissions per se. It has to do with the fact that you've created the file using: ``` Set objFile = objFSO.CreateTextFile(strDirectory & strFile) ``` That creates the file...and carries a reference to that file (objFile) Then you don't close the file before you destroy the re...
369,246
<p><strong>Background</strong></p> <p>I have made a Web Service in Visual Studio, and I'm trying to consume it using the automatically generated proxy class. The Web Service returns a class that I have implemented, containing a List.</p> <p><strong>Question</strong></p> <p>The proxy class has automatically generated...
[ { "answer_id": 369308, "author": "Andrew Hare", "author_id": 34211, "author_profile": "https://Stackoverflow.com/users/34211", "pm_score": 0, "selected": false, "text": "<p>Unless your client code knows about your custom class (e.g. has a reference to the assembly) you will not be able t...
2008/12/15
[ "https://Stackoverflow.com/questions/369246", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37481/" ]
**Background** I have made a Web Service in Visual Studio, and I'm trying to consume it using the automatically generated proxy class. The Web Service returns a class that I have implemented, containing a List. **Question** The proxy class has automatically generated methods to send the SOAP to the web service. It u...
Since Web References generate partial classes, you should be able to add to your project a partial class extension to the proxy class that reimplements just the method in question (just copy and paste it) but changes the return type (and the name, of course). If the method signature changes, you'll have to update your ...
369,248
<p>I have been reading the proper article in MSDN, <em><a href="http://msdn.microsoft.com/en-us/library/wd40t7ad.aspx" rel="noreferrer">Strong-Named Assemblies</a></em> and a related Stack&nbsp;Overflow question, <em><a href="https://stackoverflow.com/questions/308756">Checking an assembly for a strong name</a></em>.</...
[ { "answer_id": 369268, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 4, "selected": false, "text": "<p>Authenticode relies on a third party certificate authority for certificate validation. Strong naming works like a self-sign...
2008/12/15
[ "https://Stackoverflow.com/questions/369248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18552/" ]
I have been reading the proper article in MSDN, *[Strong-Named Assemblies](http://msdn.microsoft.com/en-us/library/wd40t7ad.aspx)* and a related Stack Overflow question, *[Checking an assembly for a strong name](https://stackoverflow.com/questions/308756)*. 1. To which extent can a strong-named assembly be verified to...
When you sign an assembly with a strong name based on a private key that you create, this has the following benefits: * A strong name guarantees the uniqueness of an assembly's identity by adding a public key token and a digital signature to the assembly. * A strong name can be matched to a public key to prove that th...
369,277
<p>We've got a page in our asp.net web system that uses response.redirect to redirect the user directly to an excel file so it will download "automatically" without the user having to to a right click / save as.</p> <p>This works great - except for files over about 100k in IE7. Other browsers just download the large ...
[ { "answer_id": 369324, "author": "EndangeredMassa", "author_id": 106, "author_profile": "https://Stackoverflow.com/users/106", "pm_score": 2, "selected": true, "text": "<p>I prefer a different method for sending files. It works for me with all kinds of different types and sizes of files....
2008/12/15
[ "https://Stackoverflow.com/questions/369277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19074/" ]
We've got a page in our asp.net web system that uses response.redirect to redirect the user directly to an excel file so it will download "automatically" without the user having to to a right click / save as. This works great - except for files over about 100k in IE7. Other browsers just download the large file fine, ...
I prefer a different method for sending files. It works for me with all kinds of different types and sizes of files. Instead of using Response.Redirect, allow the link to the file to do a postback where you modify the response, like so: ``` Public Shared Sub SendFileToBrowser(ByRef response As HttpResponse, ByVal fi...
369,288
<p>I'm using interface builder's tag feature to access some UILabels I'm instantiating in a xib file. Since this a UITextViewCell I want to avoid superfluous method calls, but I want to do it right too. Thus when I do:</p> <pre><code>UILabel *label = (UILabel *)[cell viewWithTag:1]; </code></pre> <p>I'm wondering if ...
[ { "answer_id": 369326, "author": "August", "author_id": 30966, "author_profile": "https://Stackoverflow.com/users/30966", "pm_score": 3, "selected": true, "text": "<p>Unless you have a lot of different objects of different classes that have subviews tagged '1' then this isn't necessary.<...
2008/12/15
[ "https://Stackoverflow.com/questions/369288", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46436/" ]
I'm using interface builder's tag feature to access some UILabels I'm instantiating in a xib file. Since this a UITextViewCell I want to avoid superfluous method calls, but I want to do it right too. Thus when I do: ``` UILabel *label = (UILabel *)[cell viewWithTag:1]; ``` I'm wondering if I should wrap it up like s...
Unless you have a lot of different objects of different classes that have subviews tagged '1' then this isn't necessary. If you DO have a bunch of different objects (cells, say) that have different classes but all have subviews with a 1 tag, I'd reconsider your tagging scheme. Perhaps 101, 201, & 301, etc.
369,291
<p>In a multi-server environment, users will be able to use a page to put, update or delete files on the servers. I was considering using a webservice (on each server) called by the IIS thread to do that work (with an aspx management page).</p> <p>However, for obvious reasons, I don't really want anyone to be able to ...
[ { "answer_id": 369474, "author": "fasih.rana", "author_id": 46024, "author_profile": "https://Stackoverflow.com/users/46024", "pm_score": 1, "selected": false, "text": "<p>You can associate a SHA1 hash with the IP address for each incoming request generated by the combination of the brow...
2008/12/15
[ "https://Stackoverflow.com/questions/369291", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5789/" ]
In a multi-server environment, users will be able to use a page to put, update or delete files on the servers. I was considering using a webservice (on each server) called by the IIS thread to do that work (with an aspx management page). However, for obvious reasons, I don't really want anyone to be able to call that ...
You should be able to get the user that's calling the web service by getting the IPrinciple object stored at: ``` IPrinciple _currentUser = HttpContext.Current.User; ``` Once you get the current user, you should be able to do your validation on whether or not that user has the permissions to do whatever action they'...
369,334
<p>Is is possible to have a local variable in an anonymous c# methods, i.e. in the following code I would like to perform the count only once.</p> <pre><code>IQueryable&lt;Enquiry&gt; linq = db.Enquiries; if(...) linq = linq.Where(...); if(...) linq = linq.Where(e =&gt; (x &lt;= (from p in db.Orders where p.Enq...
[ { "answer_id": 369341, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 5, "selected": false, "text": "<p>Yes, why not?! After all it's a function, just anonymous!</p>\n\n<p>Example:</p>\n\n<pre><code> x =&gt; { int y = x + 1; re...
2008/12/15
[ "https://Stackoverflow.com/questions/369334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40939/" ]
Is is possible to have a local variable in an anonymous c# methods, i.e. in the following code I would like to perform the count only once. ``` IQueryable<Enquiry> linq = db.Enquiries; if(...) linq = linq.Where(...); if(...) linq = linq.Where(e => (x <= (from p in db.Orders where p.EnquiryId == e.Id select p).C...
I've run into a similar problem. The solution is to create a custom expression tree generating method. I asked my question on MSDN-forums. Please see the question and answer here: [Reusing Where expressions](http://social.msdn.microsoft.com/forums/en-US/linqtosql/thread/7256f2a6-71e2-40f5-9235-1bf71032f8b6/ "Reusing ...
369,348
<p>I have a number of icons used throughout an application - let's take ok/cancel icons as an example. At the moment they might be a tick and a cross (tick.png, cross.png) but I may want to replace them in future. Also, I would like to keep the resource path in one place.</p> <p>Is this ok:</p> <pre><code>public clas...
[ { "answer_id": 369351, "author": "Markus", "author_id": 45064, "author_profile": "https://Stackoverflow.com/users/45064", "pm_score": 2, "selected": false, "text": "<p>You may want to mark the constants as final.</p>\n" }, { "answer_id": 369353, "author": "Elie", "author_...
2008/12/15
[ "https://Stackoverflow.com/questions/369348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26334/" ]
I have a number of icons used throughout an application - let's take ok/cancel icons as an example. At the moment they might be a tick and a cross (tick.png, cross.png) but I may want to replace them in future. Also, I would like to keep the resource path in one place. Is this ok: ``` public class Icons { public ...
If you want to keep you icons as static constants, I would extract the instantiation of the ImageIcon objects into a static method; ``` public static final Icon ok = icon("ok.png"); private static Icon icon(String path) { URL resource = Icons.class.getResource("/icons/" + path); if (resource == null) { ...
369,356
<p>WinXP Pro Oracle 10g Instant Client 10.2.0.1 MS Access 2003</p> <p>When I link a table in MS Access, the pick list that appears shows me every table and view in the system I have access to. This list is quite large. Normally, I really only want to look at the tables that I own. Is there a way to filter the items di...
[ { "answer_id": 369351, "author": "Markus", "author_id": 45064, "author_profile": "https://Stackoverflow.com/users/45064", "pm_score": 2, "selected": false, "text": "<p>You may want to mark the constants as final.</p>\n" }, { "answer_id": 369353, "author": "Elie", "author_...
2008/12/15
[ "https://Stackoverflow.com/questions/369356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8670/" ]
WinXP Pro Oracle 10g Instant Client 10.2.0.1 MS Access 2003 When I link a table in MS Access, the pick list that appears shows me every table and view in the system I have access to. This list is quite large. Normally, I really only want to look at the tables that I own. Is there a way to filter the items displayed ba...
If you want to keep you icons as static constants, I would extract the instantiation of the ImageIcon objects into a static method; ``` public static final Icon ok = icon("ok.png"); private static Icon icon(String path) { URL resource = Icons.class.getResource("/icons/" + path); if (resource == null) { ...
369,367
<p>I thought this was pretty straight forward but I don't get the same results as the tutorials I read. I have a button on an html page that calls a function in script tags. I also have a reference to the prototype.js file which I haven't even begun to implement yet. If I leave that reference in the page, my function c...
[ { "answer_id": 369401, "author": "Ben Scheirman", "author_id": 3381, "author_profile": "https://Stackoverflow.com/users/3381", "pm_score": 3, "selected": true, "text": "<p>A couple of things: first, make sure your HTML is valid. Run it through the validator at <a href=\"http://validato...
2008/12/15
[ "https://Stackoverflow.com/questions/369367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2636656/" ]
I thought this was pretty straight forward but I don't get the same results as the tutorials I read. I have a button on an html page that calls a function in script tags. I also have a reference to the prototype.js file which I haven't even begun to implement yet. If I leave that reference in the page, my function call...
A couple of things: first, make sure your HTML is valid. Run it through the validator at <http://validator.wc.org>. Next, once you're sure that your page is valid, add the prototype.js library as the first script reference on the page: ``` <script type="text/javascript" src="prototype.js"></script> ``` Notice that ...
369,383
<p>I am thinking about something like this:</p> <pre><code>public static &lt;T extends Comparable&lt;T&gt;&gt; T minOf(T...ts){ SortedSet&lt;T&gt; set = new TreeSet&lt;T&gt;(Arrays.asList(ts)); return set.first(); } public static &lt;T extends Comparable&lt;T&gt;&gt; T maxOf(T...ts){ SortedSet&lt;...
[ { "answer_id": 369395, "author": "Pyrolistical", "author_id": 21838, "author_profile": "https://Stackoverflow.com/users/21838", "pm_score": 6, "selected": true, "text": "<p>What's wrong with <a href=\"http://java.sun.com/javase/6/docs/api/java/util/Collections.html#max(java.util.Collecti...
2008/12/15
[ "https://Stackoverflow.com/questions/369383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356709/" ]
I am thinking about something like this: ``` public static <T extends Comparable<T>> T minOf(T...ts){ SortedSet<T> set = new TreeSet<T>(Arrays.asList(ts)); return set.first(); } public static <T extends Comparable<T>> T maxOf(T...ts){ SortedSet<T> set = new TreeSet<T>(Arrays.asList(ts)); retur...
What's wrong with [Collections.max](http://java.sun.com/javase/6/docs/api/java/util/Collections.html#max(java.util.Collection))? And why do you care about null safety? Are you sure you want to allow nulls to be in your Collection?