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
381,055
<p>I'm trying to save the contents of a particular registry key to a file using the RegSaveKey() API:</p> <pre><code>HKEY key; LRESULT result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\MyProduct", 0, KEY_ACCESS_ALL, &amp;key); result = RegSaveKey(key, L"c:\\temp\\saved.reg", NULL); </code></pre> <p>However, RegSa...
[ { "answer_id": 382039, "author": "reuben", "author_id": 41646, "author_profile": "https://Stackoverflow.com/users/41646", "pm_score": 3, "selected": false, "text": "<p>Despite running as a local administrator or as a service, you probably don't have the \"Backup\" privilege enabled by de...
2008/12/19
[ "https://Stackoverflow.com/questions/381055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2459/" ]
I'm trying to save the contents of a particular registry key to a file using the RegSaveKey() API: ``` HKEY key; LRESULT result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\MyProduct", 0, KEY_ACCESS_ALL, &key); result = RegSaveKey(key, L"c:\\temp\\saved.reg", NULL); ``` However, RegSaveKey() is returning `ERROR_PR...
Despite running as a local administrator or as a service, you probably don't have the "Backup" privilege enabled by default. You'll need to enable this privilege before you try to save the registry key. MSDN has a good example on how to enable a security privilege in C/C++: <http://msdn.microsoft.com/en-us/library/aa4...
381,063
<p>I need fire a filter method with all string in GET or POST value from http request before it was bind into controller action</p> <p>Can i do it in Global.asax.cs? and if yes, can u give me more details or example (great) about this?</p>
[ { "answer_id": 381108, "author": "Kieron", "author_id": 5791, "author_profile": "https://Stackoverflow.com/users/5791", "pm_score": 1, "selected": false, "text": "<p>I believe you can with an action filter.</p>\n\n<p>Try this <a href=\"http://www.singingeels.com/Articles/Logging_with_ASP...
2008/12/19
[ "https://Stackoverflow.com/questions/381063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44533/" ]
I need fire a filter method with all string in GET or POST value from http request before it was bind into controller action Can i do it in Global.asax.cs? and if yes, can u give me more details or example (great) about this?
You can do it in Global.asax.cs for *all* requests by ``` protected void Application_BeginRequest(object sender, EventArgs e) { //Look at HttpContext.Current.Request to grab request values } ``` Model binding occurs before action filters run. If you want to write a filter that runs before model binding, you cou...
381,066
<p>In a project we have text files looking like this:</p> <pre><code>mv A, R3 mv R2, B mv R1, R3 mv B, R4 add A, R1 add B, R1 add R1, R2 add R3, R3 add R21, X add R12, Y mv X, R2 </code></pre> <p>I need to replace the strings according to the following, but I am looking for a more general solution.</p> <pre><code>R1...
[ { "answer_id": 381080, "author": "kgiannakakis", "author_id": 24054, "author_profile": "https://Stackoverflow.com/users/24054", "pm_score": -1, "selected": false, "text": "<p>You can use a HashMap:</p>\n\n<pre><code>Map&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();\nma...
2008/12/19
[ "https://Stackoverflow.com/questions/381066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11827/" ]
In a project we have text files looking like this: ``` mv A, R3 mv R2, B mv R1, R3 mv B, R4 add A, R1 add B, R1 add R1, R2 add R3, R3 add R21, X add R12, Y mv X, R2 ``` I need to replace the strings according to the following, but I am looking for a more general solution. ``` R1 => R2 R2 => R3 R3 => R1 R12 => R2...
I've actually had to use this sort of algorithm several times in the past two weeks. So here it is the world's second-most verbose language... ``` import java.util.HashMap; import java.util.regex.Pattern; import java.util.regex.Matcher; /* R1 => R2 R2 => R3 R3 => R1 R12 => R21 R21 => R12 */ String inputString ...
381,072
<p>DataGridView.CellContentClick is not firing if I mouse click a DataGridViewCheckBoxCell very fast. How can I solve this? I need to know when CheckBox's check state changes</p>
[ { "answer_id": 381130, "author": "BFree", "author_id": 15861, "author_profile": "https://Stackoverflow.com/users/15861", "pm_score": 3, "selected": false, "text": "<p>Regardless of how fast the user clicks in the checkbox cell, the value won't change from true to false or vise versa unti...
2008/12/19
[ "https://Stackoverflow.com/questions/381072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45624/" ]
DataGridView.CellContentClick is not firing if I mouse click a DataGridViewCheckBoxCell very fast. How can I solve this? I need to know when CheckBox's check state changes
Try handling the `CellMouseUp` event. You can check which colum the `MouseUp` event occurred in to see if it is your checkbox column. You can also find out if it is in edit mode and end the edit mode programmatically, which in turn will fire the `CellValueChanged` event. In the example below, I have a DataGridV...
381,100
<p>I'm using a bookmarklet that inserts a script tag into the current web page.</p> <p>This script has some UI and an "<code>input type=submit....</code>" tag in it.</p> <p>Web page A has chosen not to style "<code>input type=submit..</code>" tags whereas web page B has styled them.</p> <p>This results in the bookma...
[ { "answer_id": 381135, "author": "Martijn Laarman", "author_id": 47020, "author_profile": "https://Stackoverflow.com/users/47020", "pm_score": 3, "selected": false, "text": "<p>Taken from <a href=\"https://developer.mozilla.org/en/Common_CSS_Questions\" rel=\"noreferrer\">Mozilla Develop...
2008/12/19
[ "https://Stackoverflow.com/questions/381100", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm using a bookmarklet that inserts a script tag into the current web page. This script has some UI and an "`input type=submit....`" tag in it. Web page A has chosen not to style "`input type=submit..`" tags whereas web page B has styled them. This results in the bookmarklet displaying differently styled submit but...
Taken from [Mozilla Developer Center](https://developer.mozilla.org/en/Common_CSS_Questions) > > **Restoring the default property value** > Because CSS does not provide a "default" keyword, the only way to restore the default value of a property is to explicitly re-declare that property. > Thus, particular care sho...
381,131
<p>I have these two lines of code. </p> <pre><code>CString strHost = AfxGetApp()-&gt;GetProfileString(_T("WebServices"), _T("Server")); AfxMessageBox(strHost); </code></pre> <p>Nowhere in the app do I set the value. (the installer does that). So the strHost, should be the same no matter where or when this line is run...
[ { "answer_id": 381165, "author": "Roel", "author_id": 11449, "author_profile": "https://Stackoverflow.com/users/11449", "pm_score": 1, "selected": false, "text": "<p>GetProfileString() can also read from a .ini file, besides the registry. If the call to GetProfileString() is done on a di...
2008/12/19
[ "https://Stackoverflow.com/questions/381131", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31325/" ]
I have these two lines of code. ``` CString strHost = AfxGetApp()->GetProfileString(_T("WebServices"), _T("Server")); AfxMessageBox(strHost); ``` Nowhere in the app do I set the value. (the installer does that). So the strHost, should be the same no matter where or when this line is run. Here's what I've got. Pr...
GetProfileString() can also read from a .ini file, besides the registry. If the call to GetProfileString() is done on a different CWinApp-derived object than the one in the main application (in a dll for example), it might try to read from the application's .ini file. Try stepping into GetProfileString() to find out wh...
381,145
<p>I'm trying to select more than 80,000 record in SQL Server in a table that has millions of records. The issue is that I've the correct Index, but it takes more than 15 minutes to return the recordset.</p> <p>I'm using MS SQL Server 2000, I found a pagination method using stored procedures but it uses a temporal tab...
[ { "answer_id": 381160, "author": "Jim Blizard", "author_id": 36924, "author_profile": "https://Stackoverflow.com/users/36924", "pm_score": 0, "selected": false, "text": "<p>There are a few of options. The usual DB tuning tricks (on which I'm not an expert). Is it possible to extract the ...
2008/12/19
[ "https://Stackoverflow.com/questions/381145", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to select more than 80,000 record in SQL Server in a table that has millions of records. The issue is that I've the correct Index, but it takes more than 15 minutes to return the recordset. I'm using MS SQL Server 2000, I found a pagination method using stored procedures but it uses a temporal table that I ...
You'll have to edit this to implement your input parameters for user's filtering and sort options, but the general principle will apply.. I used this technique with SQL 2000 in 2000/2001 timeframe with 90M record table to deliver fast paging for 150-200k row resultsets. Since only the key is in the temp table, it is a ...
381,153
<p>I have a table that represents a series of matches between ids from another table as follows:</p> <pre><code>CREATE TABLE #matches ( asid1 int, asid2 int ) insert into #matches values (1,2) insert into #matches values (1,3) insert into #matches values (3,1) insert into #matches values (3,4) insert into #matche...
[ { "answer_id": 381248, "author": "EndangeredMassa", "author_id": 106, "author_profile": "https://Stackoverflow.com/users/106", "pm_score": 2, "selected": true, "text": "<p>It appears that a <a href=\"http://en.wikipedia.org/wiki/Disjoint-set_data_structure\" rel=\"nofollow noreferrer\">D...
2008/12/19
[ "https://Stackoverflow.com/questions/381153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14357/" ]
I have a table that represents a series of matches between ids from another table as follows: ``` CREATE TABLE #matches ( asid1 int, asid2 int ) insert into #matches values (1,2) insert into #matches values (1,3) insert into #matches values (3,1) insert into #matches values (3,4) insert into #matches values (7,6)...
It appears that a [Disjoint-set](http://en.wikipedia.org/wiki/Disjoint-set_data_structure) is what you need to solve this. Here is a [listing](http://www.emilstefanov.net/Programming/DisjointSets.aspx) of a C# and C++ implementation.
381,157
<pre><code> $rowfetch =~ s/['-]//g; #All chars inside the [ ] will be filtered out. $rowfetch =~ m/(\w+), ?(.)/; printf $fh lc($2.$1); </code></pre> <p>I got help building this regular expression yesterday, but I don't fully understand it.<br><br>It takes a name like Parisi, Kenneth and prints out kparisi<B...
[ { "answer_id": 381175, "author": "Ed Guiness", "author_id": 4200, "author_profile": "https://Stackoverflow.com/users/4200", "pm_score": 5, "selected": false, "text": "<p>I find the <code>YAPE::Regex::Explain</code> module very helpful -</p>\n\n<pre><code>C:\\&gt;perl -e \"use YAPE::Regex...
2008/12/19
[ "https://Stackoverflow.com/questions/381157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42229/" ]
``` $rowfetch =~ s/['-]//g; #All chars inside the [ ] will be filtered out. $rowfetch =~ m/(\w+), ?(.)/; printf $fh lc($2.$1); ``` I got help building this regular expression yesterday, but I don't fully understand it. It takes a name like Parisi, Kenneth and prints out kparisi Knowns: s/ = substi...
I keep one of these [cheat sheets](http://www.addedbytes.com/cheat-sheets/regular-expressions-cheat-sheet/) pinned on my cube wall for just such occasions. Google for `regular expression cheat sheet` to find others. To add to what you already know: ``` g -- search globally throughout the string + -- match at leas...
381,161
<p>I have just installed boost for the first time on my Intel Mac, and it works fine in general, as long as I use only boost's header files.</p> <p>But when I try to use a lib, in my case the regex lib, my app links and launches fine, but then it soon crashes in a regex related destructor.</p> <p>This even happens wi...
[ { "answer_id": 381175, "author": "Ed Guiness", "author_id": 4200, "author_profile": "https://Stackoverflow.com/users/4200", "pm_score": 5, "selected": false, "text": "<p>I find the <code>YAPE::Regex::Explain</code> module very helpful -</p>\n\n<pre><code>C:\\&gt;perl -e \"use YAPE::Regex...
2008/12/19
[ "https://Stackoverflow.com/questions/381161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43615/" ]
I have just installed boost for the first time on my Intel Mac, and it works fine in general, as long as I use only boost's header files. But when I try to use a lib, in my case the regex lib, my app links and launches fine, but then it soon crashes in a regex related destructor. This even happens with the simple tes...
I keep one of these [cheat sheets](http://www.addedbytes.com/cheat-sheets/regular-expressions-cheat-sheet/) pinned on my cube wall for just such occasions. Google for `regular expression cheat sheet` to find others. To add to what you already know: ``` g -- search globally throughout the string + -- match at leas...
381,164
<p>I see in a header that I didn't write myself the following: </p> <pre><code>class MonitorObjectString: public MonitorObject { // some other declarations friend inline bool operator==(MonitorObjectString&amp; lhs, MonitorObjectString&amp; rhs) { return(lhs.fVal==rhs.fVal); } </code></pre> <p>I can't understan...
[ { "answer_id": 381183, "author": "pyon", "author_id": 46571, "author_profile": "https://Stackoverflow.com/users/46571", "pm_score": 3, "selected": false, "text": "<p>Grammatically speaking...</p>\n\n<p>The <code>friend</code> keyword is still needed to tell the compiler that this functio...
2008/12/19
[ "https://Stackoverflow.com/questions/381164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20986/" ]
I see in a header that I didn't write myself the following: ``` class MonitorObjectString: public MonitorObject { // some other declarations friend inline bool operator==(MonitorObjectString& lhs, MonitorObjectString& rhs) { return(lhs.fVal==rhs.fVal); } ``` I can't understand why this method is declared as f...
``` friend inline bool operator==(MonitorObjectString& lhs, MonitorObjectString& rhs) { return(lhs.fVal==rhs.fVal); } ``` is sometimes called `friend definition`, because it is a friend declaration that also defines the function. It will define the function as a non-member function of the namespace surrounding ...
381,169
<h1>Problem</h1> <p>At work we have a department wiki (running <a href="http://www.mediawiki.org/" rel="noreferrer">Mediawiki</a>). Unfortunately several persons edit without logging in, and that makes it very difficult to track down editors to ask questions about the content.</p> <p>There are two strategies to impro...
[ { "answer_id": 381194, "author": "George Stocker", "author_id": 16587, "author_profile": "https://Stackoverflow.com/users/16587", "pm_score": 4, "selected": false, "text": "<p>You can <a href=\"http://www.thejackol.com/2007/02/16/disable-anonymous-editing-in-mediawiki/\" rel=\"noreferrer...
2008/12/19
[ "https://Stackoverflow.com/questions/381169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23118/" ]
Problem ======= At work we have a department wiki (running [Mediawiki](http://www.mediawiki.org/)). Unfortunately several persons edit without logging in, and that makes it very difficult to track down editors to ask questions about the content. There are two strategies to improve this * encourage logged in editing ...
You can [Turn off Anonymous Editing](http://www.thejackol.com/2007/02/16/disable-anonymous-editing-in-mediawiki/) in Mediawiki like so: * Edit LocalSettings.php and add the following setting: ``` $wgDisableAnonEdit = true; ``` * Edit includes/SkinTemplate.php, find `$fname-edit` and change the code to look like this...
381,171
<p>I usually do not have difficulty to read JavaScript code but for this one I can’t figure out the logic. The code is from an exploit that has been published 4 days ago. You can find it at <a href="https://web.archive.org/web/20100412164007/http://www.milw0rm.com/exploits/7477" rel="nofollow noreferrer">milw0rm</a>.</...
[ { "answer_id": 381184, "author": "Brian", "author_id": 18192, "author_profile": "https://Stackoverflow.com/users/18192", "pm_score": 2, "selected": false, "text": "<p>Any time I see memory that doesn't get addressed in an exploit discussion, my first thought is that the exploit is some s...
2008/12/19
[ "https://Stackoverflow.com/questions/381171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
I usually do not have difficulty to read JavaScript code but for this one I can’t figure out the logic. The code is from an exploit that has been published 4 days ago. You can find it at [milw0rm](https://web.archive.org/web/20100412164007/http://www.milw0rm.com/exploits/7477). Here is the code: ``` <html> <div i...
The shellcode contains some x86 assembly instructions that will do the actual exploit. `spray` creates a long sequence of instructions that will be put in `memory`. Since we can't usually find out the exact location of our shellcode in memory, we put a lot of `nop` instructions before it and jump to somewhere there. Th...
381,214
<h2>Some Context</h2> <p>From <a href="http://books.google.com/books?id=VOS6IlCsuU4C" rel="nofollow noreferrer">Javascript: The Definitive Guide</a>:</p> <blockquote> <p>When <code>regexp</code> is a global regular expression, however, <code>exec()</code> behaves in a slightly more complex way. It begins searching...
[ { "answer_id": 381236, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 4, "selected": true, "text": "<p>The problem is that the dot in</p>\n\n<pre><code>^(.*)$\n</code></pre>\n\n<p>does not match new line characters, but wit...
2008/12/19
[ "https://Stackoverflow.com/questions/381214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/208/" ]
Some Context ------------ From [Javascript: The Definitive Guide](http://books.google.com/books?id=VOS6IlCsuU4C): > > When `regexp` is a global regular expression, however, `exec()` behaves in a slightly more complex way. It begins searching `string` at the character position specified by the `lastIndex` preperty of...
The problem is that the dot in ``` ^(.*)$ ``` does not match new line characters, but with your `"m"` switch you make `"^"` and `"$"` anchor to new line characters. That means the "nothing" between `"\n"` and `"\n"` can be matched successfully with `"(.*)"`. Since this match is of zero width, the `lastIndex` prope...
381,226
<p>I don't want to discuss the merits of this approach, just if it is possible. I believe the answer to be "no". But maybe someone will surprise me!</p> <p>Imagine you have a core widget class. It has a method <code>calculateHeight()</code>, that returns a height. The height is too big - this result in buttons (say) t...
[ { "answer_id": 381240, "author": "Joachim Sauer", "author_id": 40342, "author_profile": "https://Stackoverflow.com/users/40342", "pm_score": 3, "selected": false, "text": "<p>One ugly solution would be to put your own implementation of DefaultWidget (with same FQCN) earlier on the Classp...
2008/12/19
[ "https://Stackoverflow.com/questions/381226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4596/" ]
I don't want to discuss the merits of this approach, just if it is possible. I believe the answer to be "no". But maybe someone will surprise me! Imagine you have a core widget class. It has a method `calculateHeight()`, that returns a height. The height is too big - this result in buttons (say) that are too big. You ...
Perhaps you could use Aspect Oriented Programming to trap calls to that function and return your own version instead? Spring offers some AOP functionality but there are other libraries that do it as well.
381,231
<p>I enjoyed the answers and questions about <a href="https://stackoverflow.com/questions/121243/hidden-features-of-sql-server">hidden features in sql server</a> </p> <p>What can you tell us about Oracle?<br> Hidden tables, inner workings of ..., secret stored procs, package that has good utils...</p>
[ { "answer_id": 381268, "author": "Peter Gfader", "author_id": 35693, "author_profile": "https://Stackoverflow.com/users/35693", "pm_score": 1, "selected": false, "text": "<p>Q: How to call a stored with a cursor from TOAD? </p>\n\n<p>A: Example, change to your cursor, packagename and st...
2008/12/19
[ "https://Stackoverflow.com/questions/381231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35693/" ]
I enjoyed the answers and questions about [hidden features in sql server](https://stackoverflow.com/questions/121243/hidden-features-of-sql-server) What can you tell us about Oracle? Hidden tables, inner workings of ..., secret stored procs, package that has good utils...
Since Apex is now part of every Oracle database, these Apex utility functions are useful even if you aren't using Apex: ``` SQL> declare 2 v_array apex_application_global.vc_arr2; 3 v_string varchar2(2000); 4 begin 5 6 -- Convert delimited string to array 7 v_array := apex_util.string_to_tab...
381,243
<p>Following Alan Green's "<a href="http://www.bright-green.com/blog/2003_02_25/naming_java_classes_without_a.html" rel="nofollow noreferrer">Naming Java classes without Manager</a>" I've started hunting *Manager classes in my own code.</p> <p>How would you rename the following class? ServiceLoader, maybe? but it does...
[ { "answer_id": 381246, "author": "Mark Carpenter", "author_id": 47645, "author_profile": "https://Stackoverflow.com/users/47645", "pm_score": 2, "selected": true, "text": "<p>Maybe ServiceController? ServiceWrapper?</p>\n" }, { "answer_id": 381247, "author": "Kon", "autho...
2008/12/19
[ "https://Stackoverflow.com/questions/381243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2148/" ]
Following Alan Green's "[Naming Java classes without Manager](http://www.bright-green.com/blog/2003_02_25/naming_java_classes_without_a.html)" I've started hunting \*Manager classes in my own code. How would you rename the following class? ServiceLoader, maybe? but it doesn't "load" anything from anywhere. ``` class ...
Maybe ServiceController? ServiceWrapper?
381,253
<p>So, I want to use jquery to set the text of a button, depending on the value of a property in the current row of a repeater.</p> <p>I need to call a function in the code-behind to map the value to the text the button should have. So, I need to pass to my foo function, the string value of the UserStatus property for...
[ { "answer_id": 381303, "author": "Tom Jelen", "author_id": 28399, "author_profile": "https://Stackoverflow.com/users/28399", "pm_score": 3, "selected": true, "text": "<p>Switch the &lt;%= with &lt;%# and it looks like you should be good to go.</p>\n" }, { "answer_id": 381312, ...
2008/12/19
[ "https://Stackoverflow.com/questions/381253", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35086/" ]
So, I want to use jquery to set the text of a button, depending on the value of a property in the current row of a repeater. I need to call a function in the code-behind to map the value to the text the button should have. So, I need to pass to my foo function, the string value of the UserStatus property for the curre...
Switch the <%= with <%# and it looks like you should be good to go.
381,259
<p>I was just browsing a forum and someone asked about a PHP file they had found on the web. It has several spots like this in the code:</p> <p><code>if ($REMOTE_ADDR == "") $ip = "no ip"; else $ip = getHostByAddr($REMOTE_ADDR);</code></p> <p>I have always thought brackets are needed to enclose what you want to do i...
[ { "answer_id": 381274, "author": "Jacco", "author_id": 22674, "author_profile": "https://Stackoverflow.com/users/22674", "pm_score": 7, "selected": true, "text": "<p>you can do if else statements like this:</p>\n\n<pre><code>&lt;?php\nif ($something) {\n echo 'one conditional line of c...
2008/12/19
[ "https://Stackoverflow.com/questions/381259", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27620/" ]
I was just browsing a forum and someone asked about a PHP file they had found on the web. It has several spots like this in the code: `if ($REMOTE_ADDR == "") $ip = "no ip"; else $ip = getHostByAddr($REMOTE_ADDR);` I have always thought brackets are needed to enclose what you want to do if the condition is true. Is t...
you can do if else statements like this: ``` <?php if ($something) { echo 'one conditional line of code'; echo 'another conditional line of code'; } if ($something) echo 'one conditional line of code'; if ($something) echo 'one conditional line of code'; echo 'a NON-conditional line of code'; // this line gets...
381,265
<p>Since PHP is a dynamic language what's the best way of checking to see if a provided field is empty? </p> <p>I want to ensure that:</p> <ol> <li>null is considered an empty string</li> <li>a white space only string is considered empty</li> <li>that "0" is not considered empty</li> </ol> <p>This is what I've got ...
[ { "answer_id": 381275, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 9, "selected": true, "text": "<pre><code>// Function for basic field validation (present and neither empty nor only white space\nfunction IsNullOrEmptySt...
2008/12/19
[ "https://Stackoverflow.com/questions/381265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2443/" ]
Since PHP is a dynamic language what's the best way of checking to see if a provided field is empty? I want to ensure that: 1. null is considered an empty string 2. a white space only string is considered empty 3. that "0" is not considered empty This is what I've got so far: ``` $question = trim($_POST['question'...
``` // Function for basic field validation (present and neither empty nor only white space function IsNullOrEmptyString($str){ return ($str === null || trim($str) === ''); } ```
381,267
<p>Simple question; what's better and why?</p> <pre><code> out.resize( in.size() ); T1::iterator outit = out.begin(); for( inIt = in.begin() to end, ++inIt, ++outIt ) *outit = *inIt OR out.erase(); for( inIt = in.begin() to end, ++inIt ) out.push_back( inIt ); </code></pre> <p>I...
[ { "answer_id": 381304, "author": "Greg Rogers", "author_id": 5963, "author_profile": "https://Stackoverflow.com/users/5963", "pm_score": 2, "selected": false, "text": "<p>The second one, as long as you reserve the right capacity first.</p>\n\n<p>One problem I see (apart from style) is th...
2008/12/19
[ "https://Stackoverflow.com/questions/381267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38892/" ]
Simple question; what's better and why? ``` out.resize( in.size() ); T1::iterator outit = out.begin(); for( inIt = in.begin() to end, ++inIt, ++outIt ) *outit = *inIt OR out.erase(); for( inIt = in.begin() to end, ++inIt ) out.push_back( inIt ); ``` I'm assuming the memory assign...
The second, and if you're concerned about multiple extensions use out.reserve(). The right answer to adding to a vector is almost always push\_back or back\_inserter, which avoid some possible problems (exception guarantees, constructors, writing past the end, for example) that you'd have to pay attention to with other...
381,273
<p>Periodically (during autosave) and at close i get:</p> <p><strong>Problems saving workspace</strong></p> <pre><code>(X) Problems occurred while trying to save the state of the workbench. Details &gt;&gt; Could not write metadata for '/projectname'. encoded string too long: 123456 bytes </code></pre> <p>Can'...
[ { "answer_id": 382983, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": -1, "selected": false, "text": "<p>It's not a write permissions or disk-space issue. I'm getting the same problem on Eclipse 3.5 M4. No troubles w...
2008/12/19
[ "https://Stackoverflow.com/questions/381273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11397/" ]
Periodically (during autosave) and at close i get: **Problems saving workspace** ``` (X) Problems occurred while trying to save the state of the workbench. Details >> Could not write metadata for '/projectname'. encoded string too long: 123456 bytes ``` Can't find a reason or solution for this using the usual...
It should relate to a bug in [DataOuputStream](http://www.docjar.com/html/api/java/io/DataOutputStream.java.html) that it cannot writeUTF with longer then 65535 utflen. If I were you, I will try to find a way to reduce the data size, and I will submit bug report to Eclipse and JRE.
381,300
<p>I want to read an XML file into a <code>char *buffer</code> using C.</p> <p>What is the best way to do this?</p> <p>How should I get started?</p>
[ { "answer_id": 381329, "author": "Baget", "author_id": 34369, "author_profile": "https://Stackoverflow.com/users/34369", "pm_score": 2, "selected": false, "text": "<p>You can use the stat() function to get the file size. then allocate a buffer using malloc after it reading the file using...
2008/12/19
[ "https://Stackoverflow.com/questions/381300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41795/" ]
I want to read an XML file into a `char *buffer` using C. What is the best way to do this? How should I get started?
And if you want to *parse* XML, not just reading it into a buffer (something which would not be XML-specific, see Christoph's and Baget's answers), you can use for instance [libxml2](http://xmlsoft.org/): ``` #include <stdio.h> #include <string.h> #include <libxml/parser.h> int main(int argc, char **argv) { xmlDoc...
381,323
<p>I have a column that has fields such as C5, C6, C3, CC, CA, CD, etc. </p> <p>I want to be able to find all the columns that have a letter and then a number such as C5 and C6.</p> <p>I know if I do:</p> <pre><code>SELECT * FROM TABLE WHERE FIELD LIKE 'C%' </code></pre> <p>It will return CC,CA,CD as well, but I d...
[ { "answer_id": 381336, "author": "Mark Carpenter", "author_id": 47645, "author_profile": "https://Stackoverflow.com/users/47645", "pm_score": 1, "selected": false, "text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/aa933232(SQL.80).aspx\" rel=\"nofollow noreferrer\">Try starti...
2008/12/19
[ "https://Stackoverflow.com/questions/381323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
I have a column that has fields such as C5, C6, C3, CC, CA, CD, etc. I want to be able to find all the columns that have a letter and then a number such as C5 and C6. I know if I do: ``` SELECT * FROM TABLE WHERE FIELD LIKE 'C%' ``` It will return CC,CA,CD as well, but I don't want that, I want to just return the...
The query would be `SELECT * FROM TABLE WHERE FIELD LIKE 'C[0-9]%'`
381,324
<p>I <a href="https://stackoverflow.com/questions/381164">this post</a>, I've seen this:</p> <pre><code>class MonitorObjectString: public MonitorObject { // some other declarations friend inline bool operator==(/*const*/ MonitorObjectString&amp; lhs, /*const*/ MonitorObjectStr...
[ { "answer_id": 381344, "author": "Andrew Rollings", "author_id": 40410, "author_profile": "https://Stackoverflow.com/users/40410", "pm_score": 3, "selected": false, "text": "<p>Most likely they forgot the <code>const</code>. \nOperator overloads <em>should</em> behave consistently and no...
2008/12/19
[ "https://Stackoverflow.com/questions/381324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46571/" ]
I [this post](https://stackoverflow.com/questions/381164), I've seen this: ``` class MonitorObjectString: public MonitorObject { // some other declarations friend inline bool operator==(/*const*/ MonitorObjectString& lhs, /*const*/ MonitorObjectString& rhs) { return lhs.fV...
Perhaps the classes use a form of lazy initialization. When the data is accessed, proper initialization must occur, and the data must be fetched. This may change class members. However, lazy initialization can be formed so that modification to the class isn't necessary. This can be accomplished by using the [Pimpl idi...
381,363
<p>I'm so sick of the pass-callback-data-as-void*-struct anti-pattern. Boost bind solves it nicely, but is an unacceptable dependency. What's a lightweight alternative? How would I write it myself as simply as possible?</p>
[ { "answer_id": 381412, "author": "eduffy", "author_id": 7536, "author_profile": "https://Stackoverflow.com/users/7536", "pm_score": 3, "selected": true, "text": "<p>I'm not familiar with boost:bind, but is it something like this?</p>\n\n<pre><code>#include &lt;iostream&gt;\n\nvoid foo (i...
2008/12/19
[ "https://Stackoverflow.com/questions/381363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20003/" ]
I'm so sick of the pass-callback-data-as-void\*-struct anti-pattern. Boost bind solves it nicely, but is an unacceptable dependency. What's a lightweight alternative? How would I write it myself as simply as possible?
I'm not familiar with boost:bind, but is it something like this? ``` #include <iostream> void foo (int const& x) { std::cout << "x = " << x << std::endl; } void bar (std::string const& s) { std::cout << "s = " << s << std::endl; } template<class T> void relay (void (*f)(T const&), T const& a) { f(a); } ...
381,366
<p>I've used the <a href="http://msdn.microsoft.com/en-us/library/8bch7bkk.aspx" rel="nofollow noreferrer"><code>setargv.obj</code> linking for Expanding Wildcard Arguments</a> in the past for a number of C and C++ apps, but I can't find any similar mention for .net applications.</p> <p><strong>Is there a standard way ...
[ { "answer_id": 381471, "author": "BenAlabaster", "author_id": 40650, "author_profile": "https://Stackoverflow.com/users/40650", "pm_score": 2, "selected": false, "text": "<p>I'm not sure exactly what you're after... but if I get where you're going with the Directory.GetFiles() \"hack\" y...
2008/12/19
[ "https://Stackoverflow.com/questions/381366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1441/" ]
I've used the [`setargv.obj` linking for Expanding Wildcard Arguments](http://msdn.microsoft.com/en-us/library/8bch7bkk.aspx) in the past for a number of C and C++ apps, but I can't find any similar mention for .net applications. **Is there a standard way to have your app's command line parameters automatically wildca...
Your code looks like exactly how you're supposed to do it.
381,371
<p>I have a sqlite (v3) table with this column definition:</p> <pre><code>"timestamp" DATETIME DEFAULT CURRENT_TIMESTAMP </code></pre> <p>The server that this database lives on is in the CST time zone. When I insert into my table without including the timestamp column, sqlite automatically populates that field with ...
[ { "answer_id": 381394, "author": "BrianH", "author_id": 40619, "author_profile": "https://Stackoverflow.com/users/40619", "pm_score": 8, "selected": true, "text": "<p>I found on the sqlite documentation (<a href=\"https://www.sqlite.org/lang_datefunc.html\" rel=\"noreferrer\">https://www...
2008/12/19
[ "https://Stackoverflow.com/questions/381371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40619/" ]
I have a sqlite (v3) table with this column definition: ``` "timestamp" DATETIME DEFAULT CURRENT_TIMESTAMP ``` The server that this database lives on is in the CST time zone. When I insert into my table without including the timestamp column, sqlite automatically populates that field with the current timestamp in GM...
I found on the sqlite documentation (<https://www.sqlite.org/lang_datefunc.html>) this text: > > Compute the date and time given a unix > timestamp 1092941466, and compensate > for your local timezone. > > > ``` SELECT datetime(1092941466, 'unixepoch', 'localtime'); ``` That didn't look like it fit my needs, ...
381,395
<p>I'm using the <code>File::Find</code> module to traverse a directory tree. Once I find a specific file, I want to stop searching. How can I do that?</p> <pre><code> find (\$processFile, $mydir); sub processFile() { if ($_ =~ /target/) { # How can I return from find here? } } </code><...
[ { "answer_id": 381425, "author": "eduffy", "author_id": 7536, "author_profile": "https://Stackoverflow.com/users/7536", "pm_score": 1, "selected": false, "text": "<p>Can you throw custom exceptions in Perl?</p>\n" }, { "answer_id": 381454, "author": "innaM", "author_id": ...
2008/12/19
[ "https://Stackoverflow.com/questions/381395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1094969/" ]
I'm using the `File::Find` module to traverse a directory tree. Once I find a specific file, I want to stop searching. How can I do that? ``` find (\$processFile, $mydir); sub processFile() { if ($_ =~ /target/) { # How can I return from find here? } } ```
Seems like you will have to die: ``` eval { find (\$processFile, $mydir); }; if ( $@ ) { if ( $@ =~ m/^found it/ ) { # be happy } else ( $@ ) { die $@; } } else { # be sad } sub processFile() { if ($_ =~ /target/) { die 'found it'; } } ```
381,396
<p>I have several listboxes that get each of their data from a separate stored procedure. </p> <p>If the user selects an option in 1 listbox, it should filter the other listboxes. </p> <p>I have done this before by adding logic to the stored procedure, but sometimes it seems to get very long. </p> <p>Does anyone ...
[ { "answer_id": 381411, "author": "Charles Bretana", "author_id": 32632, "author_profile": "https://Stackoverflow.com/users/32632", "pm_score": 3, "selected": true, "text": "<p>You can try changing the code so that instead of having the Listbox bind directly to an ADO.Net datatable, it bi...
2008/12/19
[ "https://Stackoverflow.com/questions/381396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33690/" ]
I have several listboxes that get each of their data from a separate stored procedure. If the user selects an option in 1 listbox, it should filter the other listboxes. I have done this before by adding logic to the stored procedure, but sometimes it seems to get very long. Does anyone know of a better way to app...
You can try changing the code so that instead of having the Listbox bind directly to an ADO.Net datatable, it binds to a DataView. DataViews can be sorted and filtered independently from the underlying DataTable they are based on... Assume LBStates is state ListBox, and lbCities is City ListBox, and dtCities is form ...
381,401
<p>By default C# compares DateTime objects to the 100ns tick. However, my database returns DateTime values to the nearest millisecond. What's the best way to compare two DateTime objects in C# using a specified tolerance?</p> <p>Edit: I'm dealing with a truncation issue, not a rounding issue. As Joe points out below, ...
[ { "answer_id": 381420, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": 6, "selected": true, "text": "<p>I usally use the TimeSpan.FromXXX methods to do something like this:</p>\n\n<pre><code>if((myDate - myOtherDate) &gt; Time...
2008/12/19
[ "https://Stackoverflow.com/questions/381401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19112/" ]
By default C# compares DateTime objects to the 100ns tick. However, my database returns DateTime values to the nearest millisecond. What's the best way to compare two DateTime objects in C# using a specified tolerance? Edit: I'm dealing with a truncation issue, not a rounding issue. As Joe points out below, a rounding...
I usally use the TimeSpan.FromXXX methods to do something like this: ``` if((myDate - myOtherDate) > TimeSpan.FromSeconds(10)) { //Do something here } ```
381,403
<p>I am using C# .Net 2.0 to write a webservices client. The server's soap implementation is tested and is pretty solid. gSoap/C++ applications had no problem reading the responses. However the .Net implementation complains "There is an error in XML document" while calling one of the methods. Similar responses recieved...
[ { "answer_id": 381476, "author": "Kev", "author_id": 419, "author_profile": "https://Stackoverflow.com/users/419", "pm_score": 3, "selected": true, "text": "<p>First of all I'd grab a snapshot of the failing XML in the Deserialise stage to try and diagnose the problem.</p>\n\n<p>You can ...
2008/12/19
[ "https://Stackoverflow.com/questions/381403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1781/" ]
I am using C# .Net 2.0 to write a webservices client. The server's soap implementation is tested and is pretty solid. gSoap/C++ applications had no problem reading the responses. However the .Net implementation complains "There is an error in XML document" while calling one of the methods. Similar responses recieved fr...
First of all I'd grab a snapshot of the failing XML in the Deserialise stage to try and diagnose the problem. You can hook your soap extension into your client app without recompiling. Just add: ``` <webServices> <soapExtensionTypes> <add type="DebugTools.SOAP.SOAPTrace.SoapTraceExtension, DebugTools.SOAP...
381,405
<p>I have a Div with five float divs inside:</p> <pre><code>var div=document.createElement("div"); div.className="cssDivNino"; var divFolio=document.createElement("div"); divFolio.className="cssFolio"; div.appendChild(divFolio); var divCurp=document.createElement("div"); divCurp.className="cssCurp"; div.appendChild(...
[ { "answer_id": 381421, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 3, "selected": true, "text": "<p>A few notes:</p>\n\n<ol>\n<li><p>You will save yourself a lot of trouble by just using a <code>&lt;table&gt;</code> ...
2008/12/19
[ "https://Stackoverflow.com/questions/381405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15039/" ]
I have a Div with five float divs inside: ``` var div=document.createElement("div"); div.className="cssDivNino"; var divFolio=document.createElement("div"); divFolio.className="cssFolio"; div.appendChild(divFolio); var divCurp=document.createElement("div"); divCurp.className="cssCurp"; div.appendChild(divCurp); var...
A few notes: 1. You will save yourself a lot of trouble by just using a `<table>` for this data, which is tabular. 2. Building this stuff via the DOM is insanely slow compared to letting the browser just render raw HTML. Just something to be aware of. Anyway, I'd immediately try floating the container div `.cssDivNin...
381,434
<p>I`m developing an application using Spring WebFlow 2, Facelets and JSF. One of my flows does have a page that must trigger a form submit at certain events. For each different action, a different view must be presented. So, I'm trying to activate the following javascript code to perform the submission:</p> <pre><cod...
[ { "answer_id": 381439, "author": "scunliffe", "author_id": 6144, "author_profile": "https://Stackoverflow.com/users/6144", "pm_score": 0, "selected": false, "text": "<p>Are you looking for this parameter in your GET params or your POST params? <strong><em>It won't appear in the POST.</em...
2008/12/19
[ "https://Stackoverflow.com/questions/381434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9025/" ]
I`m developing an application using Spring WebFlow 2, Facelets and JSF. One of my flows does have a page that must trigger a form submit at certain events. For each different action, a different view must be presented. So, I'm trying to activate the following javascript code to perform the submission: ``` function myF...
I've got the solution in the Spring WebFlow forum. According to Jeremy Grelle, the submission of "\_eventId" parameter does not trigger transitions when integrating Spring WebFlow to JSF. The solution he gave was to create a JSF PhaseListener that creates a JSF action when an "\_eventId" parameter is sent. The phaseLi...
381,445
<p>I have a client of my web based application who heavily uses the data from our system for powerpoint presentations.</p> <p>We currently allow data to export in more traditional file types...PDF, CSV, HTML, and a few others. Powerpoint doesn't seem to be really automated.</p> <p>Is there a way, on the ASP.NET serv...
[ { "answer_id": 381457, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 3, "selected": true, "text": "<p>In <a href=\"http://steveorr.net/reviews/AsposePowerPoint.aspx\" rel=\"nofollow noreferrer\">this article</a>, Ste...
2008/12/19
[ "https://Stackoverflow.com/questions/381445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24126/" ]
I have a client of my web based application who heavily uses the data from our system for powerpoint presentations. We currently allow data to export in more traditional file types...PDF, CSV, HTML, and a few others. Powerpoint doesn't seem to be really automated. Is there a way, on the ASP.NET server side, to automa...
In [this article](http://steveorr.net/reviews/AsposePowerPoint.aspx), Steve suggests using Aspose's Slide application. He also explains step by step on how to generate the PowerPoint file. Here are some code excerpts (in VB): *Opening an existing PowerPoint file:* ``` Dim fs As System.IO.FileStream = _ New S...
381,451
<p>I'm creating a WPF app and have a system tray icon with a context menu. For the menu items I want to use WPF commands but when I assign them they are always greyed out even though the (same) commands are enabled in other places.</p> <pre><code>MenuItem menuItem = new MenuItem(); menuItem.Header = "Exit"; menuItem.C...
[ { "answer_id": 381603, "author": "Bryan Anderson", "author_id": 21186, "author_profile": "https://Stackoverflow.com/users/21186", "pm_score": 3, "selected": true, "text": "<p>Of the top of my head I'd guess you have to add a CommandBinding to the Menu or systray so that your command gets...
2008/12/19
[ "https://Stackoverflow.com/questions/381451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4055/" ]
I'm creating a WPF app and have a system tray icon with a context menu. For the menu items I want to use WPF commands but when I assign them they are always greyed out even though the (same) commands are enabled in other places. ``` MenuItem menuItem = new MenuItem(); menuItem.Header = "Exit"; menuItem.Command = Custo...
Of the top of my head I'd guess you have to add a CommandBinding to the Menu or systray so that your command gets handled. Although I think if that were the case it would be enabled by default.
381,452
<p>I have a simple NAnt build file, which attempts to perform an update from subversion on the specified directory. An example of the test build file content is:</p> <pre><code>&lt;?xml version="1.0" ?&gt; &lt;project name="Project_name" default="update"&gt; &lt;property name="root" value="C:\Subversion\UpdateDir" ove...
[ { "answer_id": 388489, "author": "James Gregory", "author_id": 27206, "author_profile": "https://Stackoverflow.com/users/27206", "pm_score": 3, "selected": true, "text": "<p>TeamCity has it's own checkout location in the agent that's running the build. The error message points to that wo...
2008/12/19
[ "https://Stackoverflow.com/questions/381452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15669/" ]
I have a simple NAnt build file, which attempts to perform an update from subversion on the specified directory. An example of the test build file content is: ``` <?xml version="1.0" ?> <project name="Project_name" default="update"> <property name="root" value="C:\Subversion\UpdateDir" overwrite="false"/> <property na...
TeamCity has it's own checkout location in the agent that's running the build. The error message points to that working copy having gotten muddled somehow; this can sometimes happen if a build fails and it was in the middle of an update. I'd suggest trying to do a `svn cleanup` in the specific agent's working copy.
381,455
<p>I love to Extend my Assert.AreEqual to many different classes, the known one is the CollectionAssert of course, but I can think of some more such as: <a href="http://www.human-debugger.net/blog/2008/12/21/TddExtendingAssertToSupportImages.aspx" rel="noreferrer">ImageAssert</a>, XmlAssert etc..</p> <p>Did you Create...
[ { "answer_id": 381491, "author": "RS Conley", "author_id": 7890, "author_profile": "https://Stackoverflow.com/users/7890", "pm_score": 0, "selected": false, "text": "<p>A lot of my tests revolve around loading a object that (like a CuttingPath) with a known good state.. Performing the te...
2008/12/19
[ "https://Stackoverflow.com/questions/381455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47817/" ]
I love to Extend my Assert.AreEqual to many different classes, the known one is the CollectionAssert of course, but I can think of some more such as: [ImageAssert](http://www.human-debugger.net/blog/2008/12/21/TddExtendingAssertToSupportImages.aspx), XmlAssert etc.. Did you Create your own Assert classes? and what kin...
I've just added an implementation to [ImageAssert](https://web.archive.org/web/20131031051646/http://human-debugger.net/wp-blog/2008/12/21/tdd-extending-assert-to-support-images/) as I wrote above (in my question) I would be glad to hear more of that kind of samples ``` [TestMethod] public void CompareImagesSize() { ...
381,478
<p>I have a multi-project solution. I believe it is best practice to put all <strong>externally</strong> referenced assemblies (e.g. OSS stuff) in a folder that is on the relative path of the solution and it's component projects.</p> <p>I'd like to create a real folder called <strong>Libs</strong> within the same Win...
[ { "answer_id": 381482, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": 2, "selected": false, "text": "<p>Here's my structure in TFS</p>\n\n<pre><code>Development/\n Trunk/\n Binaries/ -- Shared libraries\n Source/...
2008/12/19
[ "https://Stackoverflow.com/questions/381478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7961/" ]
I have a multi-project solution. I believe it is best practice to put all **externally** referenced assemblies (e.g. OSS stuff) in a folder that is on the relative path of the solution and it's component projects. I'd like to create a real folder called **Libs** within the same Windows folder that contains my .sln fil...
Here's my structure in TFS ``` Development/ Trunk/ Binaries/ -- Shared libraries Source/ Test/ Docs/ -- Documentation TeamBuildTypes/ -- Build definitions ``` You cannot do what you want directly in visual studio with the projects. The best thing you can do is create an ...
381,485
<p>Having fallen behind in the world of ORM and modern data access, I'm looking to move away from DataSets (<em>shudder</em>) and into a proper mapping framework.</p> <p>I've just about got my head around Linq to SQL, an I'm now looking into NHibernate with the view to using it in our next project.</p> <p>With old sc...
[ { "answer_id": 381500, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 4, "selected": true, "text": "<p>A quick answer is that the ORM will check the property name and will transform it to a SQL query that will do...
2008/12/19
[ "https://Stackoverflow.com/questions/381485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28543/" ]
Having fallen behind in the world of ORM and modern data access, I'm looking to move away from DataSets (*shudder*) and into a proper mapping framework. I've just about got my head around Linq to SQL, an I'm now looking into NHibernate with the view to using it in our next project. With old school sql and data sets, ...
A quick answer is that the ORM will check the property name and will transform it to a SQL query that will do you name = .... So it won't load all the customers into the memory to search for the name.
381,492
<p>I'm using a WPF WebBrowser control to preview HTML typed by the user.</p> <p>example...</p> <p><a href="http://img411.imageshack.us/img411/2296/appbz9.jpg" rel="nofollow noreferrer">WPF TextBox and WebBrowser controls http://img411.imageshack.us/img411/2296/appbz9.jpg</a></p> <p>But, how do I made the WebBrowser ...
[ { "answer_id": 381503, "author": "EndangeredMassa", "author_id": 106, "author_profile": "https://Stackoverflow.com/users/106", "pm_score": 1, "selected": false, "text": "<p>You will have to sanitize the input.</p>\n\n<p>Do not allow anchor or script tags or on attributes. (I don't know i...
2008/12/19
[ "https://Stackoverflow.com/questions/381492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/83/" ]
I'm using a WPF WebBrowser control to preview HTML typed by the user. example... [WPF TextBox and WebBrowser controls http://img411.imageshack.us/img411/2296/appbz9.jpg](http://img411.imageshack.us/img411/2296/appbz9.jpg) But, how do I made the WebBrowser control read-only? I don't want the user to be clicking links...
Capture the Navigating event of the WebBrowser control and set the Cancel property of its NavigatingCancelEventArgs to True. Visual Basic code... ``` Private Sub WebBrowser1_Navigating(...) Handles WebBrowser1.Navigating If WebBrowser1Locked Then e.Cancel = True End If End Sub ``` This requires a g...
381,496
<p>I have two tables in a MySQL database</p> <p>urltracker with columns id and urlclicked and urlreferrer with columns id, url_id and urlreferrer</p> <p>the urltracker is really just a lookup table with the url_id column in the urlreferrer table being the link between the tables.</p> <p><strong>Example DDL:</strong>...
[ { "answer_id": 381503, "author": "EndangeredMassa", "author_id": 106, "author_profile": "https://Stackoverflow.com/users/106", "pm_score": 1, "selected": false, "text": "<p>You will have to sanitize the input.</p>\n\n<p>Do not allow anchor or script tags or on attributes. (I don't know i...
2008/12/19
[ "https://Stackoverflow.com/questions/381496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47373/" ]
I have two tables in a MySQL database urltracker with columns id and urlclicked and urlreferrer with columns id, url\_id and urlreferrer the urltracker is really just a lookup table with the url\_id column in the urlreferrer table being the link between the tables. **Example DDL:** ``` CREATE TABLE urltracker ( i...
Capture the Navigating event of the WebBrowser control and set the Cancel property of its NavigatingCancelEventArgs to True. Visual Basic code... ``` Private Sub WebBrowser1_Navigating(...) Handles WebBrowser1.Navigating If WebBrowser1Locked Then e.Cancel = True End If End Sub ``` This requires a g...
381,501
<p>I discovered to have some problem to fully understand callbacks scoping when trying to learn Jquery. I would add that i have little experience with the Javascript language The code:</p> <pre><code>var globDom; // placeholder for DOM fragment // Getting xml file; jquery parses the file and give me back a DOM fr...
[ { "answer_id": 381550, "author": "Herms", "author_id": 1409, "author_profile": "https://Stackoverflow.com/users/1409", "pm_score": 3, "selected": false, "text": "<p>I haven't used jquery myself, but my understanding is that a lot of the stuff it does is asynchronous. That get method pro...
2008/12/19
[ "https://Stackoverflow.com/questions/381501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47506/" ]
I discovered to have some problem to fully understand callbacks scoping when trying to learn Jquery. I would add that i have little experience with the Javascript language The code: ``` var globDom; // placeholder for DOM fragment // Getting xml file; jquery parses the file and give me back a DOM fragment // saveX...
What Herms said. your (simplified) timeline looks like ``` 0.001 globdom = undefined; 0.002 $.get(somerequest, callback) 0.003 alert(globdom) .. 50 milliseconds later .. 0.053 saveXml(xmlDom) ```
381,502
<p>I'm writing small and very <a href="http://en.wikipedia.org/wiki/DRY" rel="noreferrer">DRY</a> framework, which heavily relies on metadata. I'd like to know if there is a way to obtain method parameter names, i.e. given some method</p> <pre><code>public void a(int myIntParam, String theString) { ... } </code></pre>...
[ { "answer_id": 381519, "author": "bobwienholt", "author_id": 24257, "author_profile": "https://Stackoverflow.com/users/24257", "pm_score": 3, "selected": false, "text": "<p>I could be wrong about this... but I don't think parameter names appear in a class file so I would guess that there...
2008/12/19
[ "https://Stackoverflow.com/questions/381502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1764/" ]
I'm writing small and very [DRY](http://en.wikipedia.org/wiki/DRY) framework, which heavily relies on metadata. I'd like to know if there is a way to obtain method parameter names, i.e. given some method ``` public void a(int myIntParam, String theString) { ... } ``` get the strings `"myIntParam"` and `"theString"`....
We created a custom annotation for the method that holds a String[] of parameter names. This approach felt a little easier to manage than having to annotate each individual parameter. We plan to add build-time checking that the number of annotated parameter names matches the number of arguments, since that it what we r...
381,508
<p>I'm trying to write out a <code>Byte[]</code> array representing a complete file to a file.</p> <p>The original file from the client is sent via TCP and then received by a server. The received stream is read to a byte array and then sent to be processed by this class. </p> <p>This is mainly to ensure that the rec...
[ { "answer_id": 381528, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 3, "selected": false, "text": "<p>Yep, why not?</p>\n\n<pre><code>fs.Write(myByteArray, 0, myByteArray.Length);\n</code></pre>\n" }, { "answer_id": 3...
2008/12/19
[ "https://Stackoverflow.com/questions/381508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5648/" ]
I'm trying to write out a `Byte[]` array representing a complete file to a file. The original file from the client is sent via TCP and then received by a server. The received stream is read to a byte array and then sent to be processed by this class. This is mainly to ensure that the receiving `TCPClient` is ready f...
Based on the first sentence of the question: *"I'm trying to write out a Byte[] array **representing a complete file** to a file."* The path of least resistance would be: ``` File.WriteAllBytes(string path, byte[] bytes) ``` Documented here: > > [`System.IO.File.WriteAllBytes` - MSDN](http://msdn.microsoft.com/en...
381,517
<p>Is there a way to set the prefix on the Signature of a Signed XML Document (SignedXml class in .Net)?</p> <p>So instead of:</p> <pre><code>&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#&gt; ... &lt;/Signature&gt; </code></pre> <p>I could have the following:</p> <pre><code>&lt;ds:Signature xmlns:ds="http...
[ { "answer_id": 382161, "author": "Eric Rosenberger", "author_id": 41624, "author_profile": "https://Stackoverflow.com/users/41624", "pm_score": 4, "selected": true, "text": "<p>First of all, there really isn't any good reason to do this. The two forms are functionally equivalent. Any wel...
2008/12/19
[ "https://Stackoverflow.com/questions/381517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28660/" ]
Is there a way to set the prefix on the Signature of a Signed XML Document (SignedXml class in .Net)? So instead of: ``` <Signature xmlns="http://www.w3.org/2000/09/xmldsig#> ... </Signature> ``` I could have the following: ``` <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#> ... </ds:Signature> ```
First of all, there really isn't any good reason to do this. The two forms are functionally equivalent. Any well-behaved XML processor will handle them absolutely identically. So unless you are trying to talk to an application that doesn't properly implement XML namespaces, it's better (IMO) just to leave the default f...
381,542
<p>As Joel points out in <a href="https://stackoverflow.blog/2008/12/18/podcast-34/">Stack Overflow podcast #34</a>, in <a href="https://rads.stackoverflow.com/amzn/click/com/0131103628" rel="noreferrer" rel="nofollow noreferrer">C Programming Language</a> (aka: K &amp; R), there is mention of this property of arrays i...
[ { "answer_id": 381549, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 12, "selected": true, "text": "<p>The C standard defines the <code>[]</code> operator as follows:</p>\n\n<p><code>a[b] == *(a + b)</code></p>\n\n<p>Therefore...
2008/12/19
[ "https://Stackoverflow.com/questions/381542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/356/" ]
As Joel points out in [Stack Overflow podcast #34](https://stackoverflow.blog/2008/12/18/podcast-34/), in [C Programming Language](https://rads.stackoverflow.com/amzn/click/com/0131103628) (aka: K & R), there is mention of this property of arrays in C: `a[5] == 5[a]` Joel says that it's because of pointer arithmetic b...
The C standard defines the `[]` operator as follows: `a[b] == *(a + b)` Therefore `a[5]` will evaluate to: ``` *(a + 5) ``` and `5[a]` will evaluate to: ``` *(5 + a) ``` `a` is a pointer to the first element of the array. `a[5]` is the value that's 5 **elements** further from `a`, which is the same as `*(a + 5)...
381,545
<p>I have a SSRS report and using PL/SQL for the dataset creation. My report needs two tables 1 one gives detailed view.(dataset 1) 2 one below that gives a summary table (data should come from the calculations based on the data in 1 table) </p> <p>I am using a temporary table for the dataset one. </p> <p>What are ...
[ { "answer_id": 381549, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 12, "selected": true, "text": "<p>The C standard defines the <code>[]</code> operator as follows:</p>\n\n<p><code>a[b] == *(a + b)</code></p>\n\n<p>Therefore...
2008/12/19
[ "https://Stackoverflow.com/questions/381545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a SSRS report and using PL/SQL for the dataset creation. My report needs two tables 1 one gives detailed view.(dataset 1) 2 one below that gives a summary table (data should come from the calculations based on the data in 1 table) I am using a temporary table for the dataset one. What are the methods to get...
The C standard defines the `[]` operator as follows: `a[b] == *(a + b)` Therefore `a[5]` will evaluate to: ``` *(a + 5) ``` and `5[a]` will evaluate to: ``` *(5 + a) ``` `a` is a pointer to the first element of the array. `a[5]` is the value that's 5 **elements** further from `a`, which is the same as `*(a + 5)...
381,563
<p>I am using <strong>InstallShield 2009</strong> to generate an <strong>MSI</strong> for a codebase I have inherited. The code is comprised of <strong>VB6</strong>, and <strong>.NET 2.0</strong> code (C# and C++). I'm developing and installing on <strong>Windows XP SP2</strong>.</p> <p>I created the <em>InstallShield...
[ { "answer_id": 381574, "author": "David Heggie", "author_id": 4309, "author_profile": "https://Stackoverflow.com/users/4309", "pm_score": 2, "selected": false, "text": "<p>TBH, I'd be surprised if IE6 actually used CSS internally for laying out the majority of HTML elements, so what you'...
2008/12/19
[ "https://Stackoverflow.com/questions/381563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2455/" ]
I am using **InstallShield 2009** to generate an **MSI** for a codebase I have inherited. The code is comprised of **VB6**, and **.NET 2.0** code (C# and C++). I'm developing and installing on **Windows XP SP2**. I created the *InstallShield* project (call it `"MyClient.ISM"`) by reverse engineering it from the *MSI* ...
Here is a [CSS comparison chart](http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(CSS)). IE actually stores the CSS settings in the ever-so-dumb-place, *the Registry*. Another issue is whether the doctype of your application is using standards mode or quirks mode. If it's using [quirks mode](http://en.wikipe...
381,573
<p>I started dabbling in groovy yesterday. There's an example on the groovy website that I understand but I would like to know more about why it works the way it does. What's confusing me is <code>who[1..-1]</code>. Is this like saying <code>who[1..who.length()-1]</code>? I can't find any documentation on this synt...
[ { "answer_id": 381598, "author": "mipadi", "author_id": 28804, "author_profile": "https://Stackoverflow.com/users/28804", "pm_score": 4, "selected": true, "text": "<p>You're right -- a negative number in a range basically refers to the <em>end</em> of the list, rather than the beginning....
2008/12/19
[ "https://Stackoverflow.com/questions/381573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33178/" ]
I started dabbling in groovy yesterday. There's an example on the groovy website that I understand but I would like to know more about why it works the way it does. What's confusing me is `who[1..-1]`. Is this like saying `who[1..who.length()-1]`? I can't find any documentation on this syntax. Are there any good groovy...
You're right -- a negative number in a range basically refers to the *end* of the list, rather than the beginning. `-x` is equivalent to `who.length()-x`. What you're dealing with is known as *slices* in Python. (I mention the terminology because searching for something like "groovy slices" may help you find more info...
381,580
<p>In my javascript I have this</p> <pre><code> loopDeLoop: while (foo !== bar) { switch (fubar) { case reallyFubar: if (anotherFoo == anotherBar) { break loopDeLoop; } break; defa...
[ { "answer_id": 381651, "author": "EndangeredMassa", "author_id": 106, "author_profile": "https://Stackoverflow.com/users/106", "pm_score": 0, "selected": false, "text": "<p>You could set a flag that determines whether or not you are done working in the loop. </p>\n\n<pre><code...
2008/12/19
[ "https://Stackoverflow.com/questions/381580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4232/" ]
In my javascript I have this ``` loopDeLoop: while (foo !== bar) { switch (fubar) { case reallyFubar: if (anotherFoo == anotherBar) { break loopDeLoop; } break; default: ...
You are using the label correctly. JSLint is throwing a warning because labels in Javascript are horribly bad style, and JSLint wants you to know that. To reiterate, if you use labels at all, even correctly, JSLint will give that warning. Edit: Looks like you might be able to disable the label warning with a `-use_...
381,582
<p>Is there a way to link to another View that displays search results without having to use a querystring? For example, I know that I can do the following:</p> <pre><code>[AcceptVerbs(HttpVerbs.Post)] public ActionResult Index(string txtOrderNumber) { return RedirectToAction("OrderLookup", new { controller = "Re...
[ { "answer_id": 386371, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 3, "selected": true, "text": "<p>Rename the txtOrderNumber argument to id. Then it will get picked up by the default route. Alternately, introduce a n...
2008/12/19
[ "https://Stackoverflow.com/questions/381582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47576/" ]
Is there a way to link to another View that displays search results without having to use a querystring? For example, I know that I can do the following: ``` [AcceptVerbs(HttpVerbs.Post)] public ActionResult Index(string txtOrderNumber) { return RedirectToAction("OrderLookup", new { controller = "Report", id = txt...
Rename the txtOrderNumber argument to id. Then it will get picked up by the default route. Alternately, introduce a new route with a value called txtOrderNumber in the same place as the id value in the default route, and constrain it to respond to only this controller.
381,592
<p>I'm want to parse a custom string format that is persisting an object graphs state. This is ASP.NET scenario and I wanted something easy to use on the client (JavaScript) and server (C#).</p> <p>I have a format something like </p> <pre><code>{Name1|Value1|Value2|...|ValueN}{Name2|Value1|...}{...}{NameN|...} </cod...
[ { "answer_id": 381676, "author": "Markus Jarderot", "author_id": 22364, "author_profile": "https://Stackoverflow.com/users/22364", "pm_score": 4, "selected": true, "text": "<pre><code>(?&lt;!\\\\)(?:\\\\\\\\)*\\{(.*?(?&lt;!\\\\)(?:\\\\\\\\)*)\\}\n</code></pre>\n\n<p><code>(?&lt;!\\\\)</c...
2008/12/19
[ "https://Stackoverflow.com/questions/381592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44656/" ]
I'm want to parse a custom string format that is persisting an object graphs state. This is ASP.NET scenario and I wanted something easy to use on the client (JavaScript) and server (C#). I have a format something like ``` {Name1|Value1|Value2|...|ValueN}{Name2|Value1|...}{...}{NameN|...} ``` In this format I have...
``` (?<!\\)(?:\\\\)*\{(.*?(?<!\\)(?:\\\\)*)\} ``` `(?<!\\)` will prevent any `\` before this point. `(?:\\\\)*` will allow any number of escaped `\`. `\{` matches an opening brace. `(` begins a capture group. `.*?` matches the content, including any `|`. `(?<!\\)` will prevent any `\` before this point. `(?:\\\...
381,596
<p>I need to <code>POST</code> data to a url in the middle of a script.</p> <ol> <li>User fills out form:</li> <li>Form submits to <code>process.asp</code>: I need to <code>POST</code> data to a 3rd Party integration at this point.</li> <li><code>process.asp</code> finishes and directs user to thank you page.</li> </o...
[ { "answer_id": 381613, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 2, "selected": false, "text": "<p>In .Net it's System.Net.WebClient or System.Net.HttpWebRequest.</p>\n\n<p>Classic ASP has a completely different ap...
2008/12/19
[ "https://Stackoverflow.com/questions/381596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47838/" ]
I need to `POST` data to a url in the middle of a script. 1. User fills out form: 2. Form submits to `process.asp`: I need to `POST` data to a 3rd Party integration at this point. 3. `process.asp` finishes and directs user to thank you page.
I'm not sure why everybody else is posting ASP.Net solutions when you specifically said you're using ASP "classic." Something like this should work. I didn't write the code; I found it elsewhere. But the MSXML2.ServerXMLHTTP object is what you want to use if you don't want to purchase something commercial. ``` functi...
381,621
<p>In our C++ course they suggest not to use C++ arrays on new projects anymore. As far as I know Stroustroup himself suggests not to use arrays. But are there significant performance differences?</p>
[ { "answer_id": 381646, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 3, "selected": false, "text": "<p>STL is a heavily optimized library. In fact, it's even suggested to use STL in games where high performance might be needed...
2008/12/19
[ "https://Stackoverflow.com/questions/381621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25418/" ]
In our C++ course they suggest not to use C++ arrays on new projects anymore. As far as I know Stroustroup himself suggests not to use arrays. But are there significant performance differences?
Using C++ arrays with `new` (that is, using dynamic arrays) should be avoided. There is the problem that you have to keep track of the size, and you need to delete them manually and do all sorts of housekeeping. Using arrays on the stack is also discouraged because you don't have range checking, and passing the array ...
381,668
<p>I'm trying to create a color-picker which must dynamically generate its images and figured it would be a whole lot easier to generate SVG than a raster image. Unfortunately, I can't figure out how to represent the big, two-dimensional gradient which will form the centerpiece of the picker.</p> <p>For example, if t...
[ { "answer_id": 59079752, "author": "Paul Wheeler", "author_id": 229247, "author_profile": "https://Stackoverflow.com/users/229247", "pm_score": 4, "selected": true, "text": "<p>This is possible using the <code>mix-blend-mode</code> style attribute:</p>\n<p><div class=\"snippet\" data-lan...
2008/12/19
[ "https://Stackoverflow.com/questions/381668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46387/" ]
I'm trying to create a color-picker which must dynamically generate its images and figured it would be a whole lot easier to generate SVG than a raster image. Unfortunately, I can't figure out how to represent the big, two-dimensional gradient which will form the centerpiece of the picker. For example, if the currentl...
This is possible using the `mix-blend-mode` style attribute: ```html <svg xmlns="http://www.w3.org/2000/svg" width="256" height="256"> <defs> <linearGradient id="black-to-green" gradientTransform="rotate(0)"> <stop offset="0" stop-color="#000000" /> <stop offset="100%" stop-color="#00ff00" /> </...
381,685
<p>I just finished reading a book on scala. What strikes me is that every single example in the whole book was numerical in some form or another.</p> <p>Like a lot of programmers, the only math I use is from discrete and combinatorial mathematics, and usually that's not math I program in an explicit way. I'm really mi...
[ { "answer_id": 381687, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 1, "selected": false, "text": "<p>Pattern matching is also a place where functional programming shines, making it really useful in areas such as Bioinformati...
2008/12/19
[ "https://Stackoverflow.com/questions/381685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23691/" ]
I just finished reading a book on scala. What strikes me is that every single example in the whole book was numerical in some form or another. Like a lot of programmers, the only math I use is from discrete and combinatorial mathematics, and usually that's not math I program in an explicit way. I'm really missing some...
My company asked me to write a custom application that allowed users to perform ad hoc queries against a flat-file database. The users of this app were your typical Joe Businessman types. They are not programmers, and its unlikely they have ever seen an SQL statement in their lives. As a result, I was tasked to develo...
381,691
<p>Well i need to make it so any user can have a foo.com/username in my site where i user a Zend framework. </p> <p>The thing is that i want foo.com/login and other controllers to keep working as they do, so i already validate that no user can be named as one of the controllers im going to use. The htaccess cant be c...
[ { "answer_id": 381687, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 1, "selected": false, "text": "<p>Pattern matching is also a place where functional programming shines, making it really useful in areas such as Bioinformati...
2008/12/19
[ "https://Stackoverflow.com/questions/381691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47846/" ]
Well i need to make it so any user can have a foo.com/username in my site where i user a Zend framework. The thing is that i want foo.com/login and other controllers to keep working as they do, so i already validate that no user can be named as one of the controllers im going to use. The htaccess cant be changed or t...
My company asked me to write a custom application that allowed users to perform ad hoc queries against a flat-file database. The users of this app were your typical Joe Businessman types. They are not programmers, and its unlikely they have ever seen an SQL statement in their lives. As a result, I was tasked to develo...
381,718
<p>How do I check if a variable, specifically a pointer, is defined in C++? Suppose I have a class:</p> <pre><code>class MyClass { public: MyClass(); ~MyClass() { delete pointer; // if defined! } initializePointer() { pointer = new OtherClass(); } private: OtherClass* poi...
[ { "answer_id": 381726, "author": "Gabriel Isenberg", "author_id": 1473493, "author_profile": "https://Stackoverflow.com/users/1473493", "pm_score": 3, "selected": false, "text": "<p>I tend to initialize my pointer values to NULL on object construction. This allows a check against NULL to...
2008/12/19
[ "https://Stackoverflow.com/questions/381718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25418/" ]
How do I check if a variable, specifically a pointer, is defined in C++? Suppose I have a class: ``` class MyClass { public: MyClass(); ~MyClass() { delete pointer; // if defined! } initializePointer() { pointer = new OtherClass(); } private: OtherClass* pointer; }; ```
Why worry about checking for the pointers value? Just initialize it to a null pointer value and then just call delete on it. delete on a null pointer does nothing (the standard guarantees it). ``` class MyClass { public: MyClass():pointer(0) { } ~MyClass() { delete pointer; pointer = 0; ...
381,733
<p>Syntactic sugar for properties for example in C#:</p> <pre><code>private int x; public int X{ get { return x; } set { x = value; } } </code></pre> <p>or simply</p> <pre><code> public int X{ get; set; } </code></pre> <p>I am missing verbatim strings in java... @"C:\My Documents\" instead of "C:\\My Docum...
[ { "answer_id": 381740, "author": "Matt Briggs", "author_id": 10771, "author_profile": "https://Stackoverflow.com/users/10771", "pm_score": 2, "selected": false, "text": "<p>That is oldschool C#. Nowadays it is </p>\n\n<pre><code>public int X { get; set; }\n</code></pre>\n" }, { "...
2008/12/19
[ "https://Stackoverflow.com/questions/381733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35323/" ]
Syntactic sugar for properties for example in C#: ``` private int x; public int X{ get { return x; } set { x = value; } } ``` or simply ``` public int X{ get; set; } ``` I am missing verbatim strings in java... @"C:\My Documents\" instead of "C:\\My Documents\\" Do you agree Java needs more "sugar"? An...
While I don't necessarily agree with Java's philosophy, I think that adding lots of **syntactic sugar** to Java would go against its philosophy. Java is supposed to be a very simple, easy to reason about language with few constructs, kind of a lowest common denominator *lingua franca* in the programming community. It w...
381,734
<p>I want to perform this <em>CODE</em> equivlant in the castle xml config file.</p> <p>// Foo(string name)</p> <p>IFoo f = new Foo(StaticBarClass.Name);</p> <p><br> <br><br> <em>XML</em></p> <p>Now for the XML, I know everything (e.g. the blah) except for the stuff inside the parameter part.</p> <p>What would the...
[ { "answer_id": 381740, "author": "Matt Briggs", "author_id": 10771, "author_profile": "https://Stackoverflow.com/users/10771", "pm_score": 2, "selected": false, "text": "<p>That is oldschool C#. Nowadays it is </p>\n\n<pre><code>public int X { get; set; }\n</code></pre>\n" }, { "...
2008/12/19
[ "https://Stackoverflow.com/questions/381734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to perform this *CODE* equivlant in the castle xml config file. // Foo(string name) IFoo f = new Foo(StaticBarClass.Name); *XML* Now for the XML, I know everything (e.g. the blah) except for the stuff inside the parameter part. What would the parameter part look like? ``` <component id="blah" se...
While I don't necessarily agree with Java's philosophy, I think that adding lots of **syntactic sugar** to Java would go against its philosophy. Java is supposed to be a very simple, easy to reason about language with few constructs, kind of a lowest common denominator *lingua franca* in the programming community. It w...
381,760
<p>My app sends lots and lots of data to SAP. To di this, it builds up an SAP table object and sends it over. I get this error somewhat regularly, but not reliably:</p> <pre><code>System exception thrown while marshaling .NET type 20081219 to RFCTYPE_BCD at SAP.Connector.Rfc.RfcMarshal.NetFieldToRfcField(Object src,...
[ { "answer_id": 382242, "author": "Igal Serban", "author_id": 25737, "author_profile": "https://Stackoverflow.com/users/25737", "pm_score": 2, "selected": true, "text": "<p><strong>Update 4:</strong> In second thought, I don't think that the librfc version is important. The exception seem...
2008/12/19
[ "https://Stackoverflow.com/questions/381760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29/" ]
My app sends lots and lots of data to SAP. To di this, it builds up an SAP table object and sends it over. I get this error somewhat regularly, but not reliably: ``` System exception thrown while marshaling .NET type 20081219 to RFCTYPE_BCD at SAP.Connector.Rfc.RfcMarshal.NetFieldToRfcField(Object src, RFCTYPE type...
**Update 4:** In second thought, I don't think that the librfc version is important. The exception seems to come from the managed code. The options that I can think of are: * Try to use debugger on the single threaded version. * The magical way. Even without finding the bug ( That is on sap or your code). Just changin...
381,772
<p>I want to submit the values of a flex form to a ColdFusion cfc.</p> <p>If I have a flex form (see below) is the data in the form an object? Or do I have to create an object based on the id's in the form and then pass that new object to the coldfusion component? </p> <pre><code>&lt;mx:Form x="10" y="10" width="790"...
[ { "answer_id": 381773, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 4, "selected": true, "text": "<p>What people think of right now as cloud computing, especially the Amazon/Google/Microsoft offerings, are really just...
2008/12/19
[ "https://Stackoverflow.com/questions/381772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24563/" ]
I want to submit the values of a flex form to a ColdFusion cfc. If I have a flex form (see below) is the data in the form an object? Or do I have to create an object based on the id's in the form and then pass that new object to the coldfusion component? ``` <mx:Form x="10" y="10" width="790" id="myFrom" defaultButt...
What people think of right now as cloud computing, especially the Amazon/Google/Microsoft offerings, are really just glitzy ways of abstracting traditional hosting. It's just that somehow when you say "cloud" people think it's okay to put data online that would normally have been kept in-house. Real cloud computing wo...
381,782
<p>How would I define an element that can either contain plain text or contain elements? Say I wanted to somehow allow for both of these cases:</p> <pre><code>&lt;xs:element name="field"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element ref="subfield" minOccurs="0" maxOccurs="unboun...
[ { "answer_id": 381839, "author": "David Norman", "author_id": 34502, "author_profile": "https://Stackoverflow.com/users/34502", "pm_score": 6, "selected": true, "text": "<p>I did some research on this a while ago and the only solution I found was to used the mixed attribute:</p>\n\n<pre>...
2008/12/19
[ "https://Stackoverflow.com/questions/381782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5291/" ]
How would I define an element that can either contain plain text or contain elements? Say I wanted to somehow allow for both of these cases: ``` <xs:element name="field"> <xs:complexType> <xs:sequence> <xs:element ref="subfield" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> ...
I did some research on this a while ago and the only solution I found was to used the mixed attribute: ``` <xs:element name="field"> <xs:complexType mixed="true"> <xs:sequence> <xs:element ref="subfield" minOccurs="0" maxOccurs="unbounded" /> </xs:sequence> <xs:attribute nam...
381,793
<p>My problem is the following. I have a method which simply takes an XML excerpt and an XPath. It then should create me an array of objects for that XML excerpt. Meaning if I get passed the following XML:</p> <pre><code>&lt;user&gt; &lt;name&gt;Bob&lt;/name&gt; &lt;age&gt;50&lt;/age&gt; &lt;/user&gt; </code></pre...
[ { "answer_id": 381862, "author": "codelogic", "author_id": 43427, "author_profile": "https://Stackoverflow.com/users/43427", "pm_score": 7, "selected": true, "text": "<p>For instantiating a class using its name, you can use <a href=\"https://developer.apple.com/documentation/foundation/1...
2008/12/19
[ "https://Stackoverflow.com/questions/381793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40882/" ]
My problem is the following. I have a method which simply takes an XML excerpt and an XPath. It then should create me an array of objects for that XML excerpt. Meaning if I get passed the following XML: ``` <user> <name>Bob</name> <age>50</age> </user> ``` My method will instantiate an instance of the class User...
For instantiating a class using its name, you can use [NSClassFromString](https://developer.apple.com/documentation/foundation/1395135-nsclassfromstring?language=objc): ``` id obj = [[NSClassFromString(@"MySpecialClass") alloc] init]; ```
381,795
<p>Not that I'm trying to prevent 'View Source' or anything silly like that, but I'm making some custom context menus for certain elements.</p> <p>EDIT: response to answers: I've tried this:</p> <pre><code>&lt;a id="moo" href=''&gt; &lt;/a&gt; &lt;script type="text/javascript"&gt; var moo = document.getElementBy...
[ { "answer_id": 381848, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 8, "selected": true, "text": "<p>Capture the <code>onContextMenu</code> event, and return false in the event handler.</p>\n\n<p>You can also capture ...
2008/12/19
[ "https://Stackoverflow.com/questions/381795", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4435/" ]
Not that I'm trying to prevent 'View Source' or anything silly like that, but I'm making some custom context menus for certain elements. EDIT: response to answers: I've tried this: ``` <a id="moo" href=''> </a> <script type="text/javascript"> var moo = document.getElementById('moo'); function handler(event)...
Capture the `onContextMenu` event, and return false in the event handler. You can also capture the click event and check which mouse button fired the event with `event.button`, in some browsers anyway.
381,831
<p>When I new a WCF service in my solution, can I do the following, have a constructor with parameter to pass in? If yes, how, when and where does the runtime fill in my required IBusinessLogic object?</p> <pre><code>[ServiceContract] public interface IServiceContract { [OperationContract] ... } public class...
[ { "answer_id": 381842, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 3, "selected": false, "text": "<p>Look at <a href=\"http://msdn.microsoft.com/en-us/library/aa702697.aspx\" rel=\"noreferrer\">ServiceHostFactory</a>.<...
2008/12/19
[ "https://Stackoverflow.com/questions/381831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32240/" ]
When I new a WCF service in my solution, can I do the following, have a constructor with parameter to pass in? If yes, how, when and where does the runtime fill in my required IBusinessLogic object? ``` [ServiceContract] public interface IServiceContract { [OperationContract] ... } public class MyService : IS...
Out of the box WCF will only use the default constructor, you can't use parameterised constructors. You have to do a bit of extra work to make WCF call parameterised constructors. You could try this: > > [How do I pass values to the constructor on my wcf service?](https://stackoverflow.com/questions/2454850/how-do-i...
381,859
<p>I have an <code>ItemsControl</code> that is data bound to a list of <code>decimal</code>s. I need to add one extra control to the <code>ItemsControl</code> (an option to specify the number manually). Is there a way to do this in XAML? I know I can manually add the item in the code behind, but I'm trying to unders...
[ { "answer_id": 382093, "author": "Robert Macnee", "author_id": 19273, "author_profile": "https://Stackoverflow.com/users/19273", "pm_score": 6, "selected": true, "text": "<p>You can use the <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.data.compositecollection.aspx\" r...
2008/12/19
[ "https://Stackoverflow.com/questions/381859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9323/" ]
I have an `ItemsControl` that is data bound to a list of `decimal`s. I need to add one extra control to the `ItemsControl` (an option to specify the number manually). Is there a way to do this in XAML? I know I can manually add the item in the code behind, but I'm trying to understand WPF a little better and want to se...
You can use the [CompositeCollection](http://msdn.microsoft.com/en-us/library/system.windows.data.compositecollection.aspx) class for this purpose, it combines multiple collections or individual items as the ItemsSource for an ItemsControl. There's a good example in the MSDN article, or here's another one: ``` <Grid ...
381,885
<p>I'm running on a shared *NIX server (run by Site5). I have a php script that runs in the background occasionally doing some offline calculations. It uses around 100% CPU while it runs. I've tried nice-ing it, like this:</p> <pre><code>nice -n 19 php script.php </code></pre> <p>but that doesn't seem to make any dif...
[ { "answer_id": 381893, "author": "Brian Knoblauch", "author_id": 15689, "author_profile": "https://Stackoverflow.com/users/15689", "pm_score": 3, "selected": false, "text": "<p>Even niced, it'll use 100% CPU if available. However, the kernel will give priority to any other (non-niced) p...
2008/12/19
[ "https://Stackoverflow.com/questions/381885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
I'm running on a shared \*NIX server (run by Site5). I have a php script that runs in the background occasionally doing some offline calculations. It uses around 100% CPU while it runs. I've tried nice-ing it, like this: ``` nice -n 19 php script.php ``` but that doesn't seem to make any difference.
You could scatter usleep ( int $micro\_seconds ) through your code. This will force your script to stop for tiny amounts of time leaving the CPU free for other things. Will that be necessary though? If you script has a low priority, does it matter that it's using 100% of the CPU... If other processes with a higher pri...
381,889
<p>Here is my SQLCommand object:</p> <pre><code>oCommand.CommandText = "INSERT INTO hits (id,client_id,client_ip,page,vars) VALUES _ (@@IDENTITY,@client_id,@ip,@page,@vars)" oCommand.Parameters.Count = 4 &gt;&gt; oCommand.Parameters.Item(0).ParameterName = "@client_id" &gt;&gt; oCommand.Par...
[ { "answer_id": 381910, "author": "Nathan Koop", "author_id": 18821, "author_profile": "https://Stackoverflow.com/users/18821", "pm_score": 2, "selected": true, "text": "<p>In the CV function are you checking to see if the value is null? One of the <a href=\"http://www.sitepoint.com/forum...
2008/12/19
[ "https://Stackoverflow.com/questions/381889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25515/" ]
Here is my SQLCommand object: ``` oCommand.CommandText = "INSERT INTO hits (id,client_id,client_ip,page,vars) VALUES _ (@@IDENTITY,@client_id,@ip,@page,@vars)" oCommand.Parameters.Count = 4 >> oCommand.Parameters.Item(0).ParameterName = "@client_id" >> oCommand.Parameters.Item(0).Value = "1...
In the CV function are you checking to see if the value is null? One of the [sites](http://www.sitepoint.com/forums/showthread.php?t=487633) I see documents that you need to pass a value of DBNull.value instead of null.
381,890
<p>I am doing some work on a web site that has a secure area which is available to users only after they have logged in. In this area there is a page with links to pdf documents which can be downloaded. The physical documents are outside of the web site's root directory. The links to the pdf documents look something li...
[ { "answer_id": 381939, "author": "Samuel", "author_id": 32465, "author_profile": "https://Stackoverflow.com/users/32465", "pm_score": 1, "selected": false, "text": "<p>Try using </p>\n\n<pre><code>Content-Disposition: inline;\n</code></pre>\n" }, { "answer_id": 381943, "autho...
2008/12/19
[ "https://Stackoverflow.com/questions/381890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1142/" ]
I am doing some work on a web site that has a secure area which is available to users only after they have logged in. In this area there is a page with links to pdf documents which can be downloaded. The physical documents are outside of the web site's root directory. The links to the pdf documents look something like ...
I've finally come up with a work around for this problem. Although the RFC 2183 shows that a filename parameter can be used for both attachment and inline for the Content-Disposition header field, it seems that browsers ignore the filename parameter when inline is used but rather try to work out what the filename shou...
381,918
<p>After two years of C#, my VB.NET is a bit rusty. I have two Lists. Let's call them originalList and targetList. Here is my C# code:</p> <pre><code>for(int i = 0; i&lt;originalList.Count; i++) { bool isMatch = false; foreach (string t in targetList) { if(String.Compare(originalList[i], t, true) =...
[ { "answer_id": 381940, "author": "skb", "author_id": 14101, "author_profile": "https://Stackoverflow.com/users/14101", "pm_score": -1, "selected": false, "text": "<p>It looks to me like it is a problem with how you are indexing into your strings, not with your for loops. Use a debugger ...
2008/12/19
[ "https://Stackoverflow.com/questions/381918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28647/" ]
After two years of C#, my VB.NET is a bit rusty. I have two Lists. Let's call them originalList and targetList. Here is my C# code: ``` for(int i = 0; i<originalList.Count; i++) { bool isMatch = false; foreach (string t in targetList) { if(String.Compare(originalList[i], t, true) == 0) { ...
Consider this - it's a far more elegant way of achieving what you're trying to do - and that is removing items from your original list that appear in your target list. Consider the following lists: ``` Dim OriginalList As New List(Of String)(New String() {"a", "b", "c", "d"}) Dim TargetList As New List(Of String)(New ...
381,920
<p>I'm looking for a way to redirect output in a groovy script to stderr:</p> <pre><code>catch(Exception e) { println "Want this to go to stderr" } </code></pre>
[ { "answer_id": 381941, "author": "Dan Vinton", "author_id": 21849, "author_profile": "https://Stackoverflow.com/users/21849", "pm_score": 4, "selected": false, "text": "<p>Groovy has access to the JRE:</p>\n\n<pre><code>System.err.println \"goes to stderr\"\n</code></pre>\n\n<p>Although ...
2008/12/19
[ "https://Stackoverflow.com/questions/381920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14481/" ]
I'm looking for a way to redirect output in a groovy script to stderr: ``` catch(Exception e) { println "Want this to go to stderr" } ```
Just off the top of my head couldn't you do a bit of self-wiring: ``` def printErr = System.err.&println printErr("AHHH") ``` but that is a bit manual
381,954
<p>We've recently implemented Amazon S3 in our site which led us to change the way we handled images. We used to call a controller /fotos.php that would read the file from disk, record some statistics, set headers and return the contents of the file as image/jpeg.</p> <p>All went OK until S3. Fotos.php now does a 302 ...
[ { "answer_id": 381971, "author": "EndangeredMassa", "author_id": 106, "author_profile": "https://Stackoverflow.com/users/106", "pm_score": 0, "selected": false, "text": "<p>I ran into this issue myself once. I think that the only real workaround for it (at the time) was to append somethi...
2008/12/19
[ "https://Stackoverflow.com/questions/381954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26481/" ]
We've recently implemented Amazon S3 in our site which led us to change the way we handled images. We used to call a controller /fotos.php that would read the file from disk, record some statistics, set headers and return the contents of the file as image/jpeg. All went OK until S3. Fotos.php now does a 302 redirect t...
try to specify the content type of the image with `header('Content-Type: image/jpeg');` or `header('Content-Type: image/png');` maybe you'll have to use content disposition attachment to let PHP specify the content-type (location leave the task to the web server) ``` $archivo = $fotos->ObtenerPathFotoAmazon( $url, ...
381,976
<p>I have the following sub:</p> <pre><code> Private Sub Watcher_Changed(ByVal sender As System.Object, ByVal e As FileSystemEventArgs) If Path.GetExtension(e.Name) = ".p2p" Then Exit Sub Else Try ' multiple change events can be thrown. Check that file hasn't al...
[ { "answer_id": 382194, "author": "Victor", "author_id": 42518, "author_profile": "https://Stackoverflow.com/users/42518", "pm_score": 2, "selected": false, "text": "<p>we had a similar situation; however the system that wrote the file in batches used a temp name, and changed it to the \"...
2008/12/19
[ "https://Stackoverflow.com/questions/381976", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have the following sub: ``` Private Sub Watcher_Changed(ByVal sender As System.Object, ByVal e As FileSystemEventArgs) If Path.GetExtension(e.Name) = ".p2p" Then Exit Sub Else Try ' multiple change events can be thrown. Check that file hasn't already been mov...
I created a service to upload files dumped to an FTP folder a couple years ago and here's some things I did that should help you get over your problem: 1. I tested all the NotifyFilters and chose the one that cut out duplicate notifications (using *only* NotifyFilters.Size gave me reliable notifications for every file...
381,980
<p>I am writing a web app using Castle ActiveRecord, and I keep getting this exception whenever I try to access a lazy loaded list of related objects. Here is my code:</p> <pre><code> using(new SessionScope()) { foreach (var field in eventObj.RegistrationFields) { ...
[ { "answer_id": 382092, "author": "user47393", "author_id": 47393, "author_profile": "https://Stackoverflow.com/users/47393", "pm_score": 1, "selected": false, "text": "<p>When was eventObj loaded? That needs to be in the session too. Also, check out the <a href=\"http://www.castleproje...
2008/12/19
[ "https://Stackoverflow.com/questions/381980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14101/" ]
I am writing a web app using Castle ActiveRecord, and I keep getting this exception whenever I try to access a lazy loaded list of related objects. Here is my code: ``` using(new SessionScope()) { foreach (var field in eventObj.RegistrationFields) { //Do somethin...
I think you're getting confused about sessions. `RegistrationFields` is a lazy property of `eventObj`. It is the session that loaded `eventObj` that would be responsible for loading `RegistrationFields`. You're explicitly opening a new session by using `new SessionScope()`, which creates a new session to which `eventOb...
381,983
<p>What's the best way retrieve complex queries from a REST service?</p> <p>Suppose I want to get X collections, apply filters and equations to each one, combine the collections using some other operation and return one result, everything in one request.</p> <p>It is just too complex (and big) to put everything in th...
[ { "answer_id": 381990, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 2, "selected": false, "text": "<p>This is the standard RESTful approach. <code>POST</code> to the resource and expect a <code>201 Created</code> (no en...
2008/12/19
[ "https://Stackoverflow.com/questions/381983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22693/" ]
What's the best way retrieve complex queries from a REST service? Suppose I want to get X collections, apply filters and equations to each one, combine the collections using some other operation and return one result, everything in one request. It is just too complex (and big) to put everything in the querystring sin...
Sounds RESTful to me if you're using a unique ID. If the query result set is large you might want to include a way of asking for result set rows M - N where M,N are parameters. I guess an advantage of your unique ID approach (w/ query definition state stored on the server) is you could use the result of the query as a...
382,006
<p>I'm creating a WPF application where several ListView selections are made in a row (similar to the iTunes browser). The problem is that the default inactive selection color is too light. (see below) <img src="https://i.stack.imgur.com/hwctc.jpg" alt="Default inactive selection color (too light)"></p> <p>How can I c...
[ { "answer_id": 382162, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 7, "selected": true, "text": "<p>The <code>ListBox</code> template uses a system color called <code>ControlBrush</code> to set the inactive highlight...
2008/12/19
[ "https://Stackoverflow.com/questions/382006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/317/" ]
I'm creating a WPF application where several ListView selections are made in a row (similar to the iTunes browser). The problem is that the default inactive selection color is too light. (see below) ![Default inactive selection color (too light)](https://i.stack.imgur.com/hwctc.jpg) How can I change this color so my i...
The `ListBox` template uses a system color called `ControlBrush` to set the inactive highlight color. Therefore, you can just override that color: ``` <ListBox> <ListBox.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}">Red</SolidColorBrush> </ListBox.Resources> </ListBox> ``...
382,009
<p>In my .net windows service, when my timer elapses and my main method is called, is it best practice to put the timer in sleep mode?</p> <p>This is in case my main method runs for too long, and the timer elapses before the previous calls main method finishes its execution.</p>
[ { "answer_id": 382162, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 7, "selected": true, "text": "<p>The <code>ListBox</code> template uses a system color called <code>ControlBrush</code> to set the inactive highlight...
2008/12/19
[ "https://Stackoverflow.com/questions/382009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
In my .net windows service, when my timer elapses and my main method is called, is it best practice to put the timer in sleep mode? This is in case my main method runs for too long, and the timer elapses before the previous calls main method finishes its execution.
The `ListBox` template uses a system color called `ControlBrush` to set the inactive highlight color. Therefore, you can just override that color: ``` <ListBox> <ListBox.Resources> <SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}">Red</SolidColorBrush> </ListBox.Resources> </ListBox> ``...
382,051
<p>I'm trying to find documentation on how I can override a property name in Objective-C with @synthesize. If I have an instance variable name of 'foo', I want to write it's accessor as 'bar'. </p> <p>Doing something such as</p> <pre><code>@synthesize foo = bar; </code></pre> <p>gives a compile-time error.</p>
[ { "answer_id": 382082, "author": "JamesSugrue", "author_id": 1075, "author_profile": "https://Stackoverflow.com/users/1075", "pm_score": 3, "selected": true, "text": "<p>You can but \"bar\" has to exist first (be a declared variable). From the <a href=\"http://developer.apple.com/documen...
2008/12/19
[ "https://Stackoverflow.com/questions/382051", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40882/" ]
I'm trying to find documentation on how I can override a property name in Objective-C with @synthesize. If I have an instance variable name of 'foo', I want to write it's accessor as 'bar'. Doing something such as ``` @synthesize foo = bar; ``` gives a compile-time error.
You can but "bar" has to exist first (be a declared variable). From the [documentation](http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_3.html) > > You can use the form property=ivar to indicate that a particular instance variable should be used for the property, for ex...
382,108
<p>How to script a constraint on a field in a table, for an acceptable range of values is between 0 and 100?</p>
[ { "answer_id": 382116, "author": "Mark Brackett", "author_id": 2199, "author_profile": "https://Stackoverflow.com/users/2199", "pm_score": 6, "selected": true, "text": "<pre><code>ALTER TABLE Table\nADD CONSTRAINT CK_Table_Column_Range CHECK (\n Column &gt;= 0 AND Column &lt;= 100 --In...
2008/12/19
[ "https://Stackoverflow.com/questions/382108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1446/" ]
How to script a constraint on a field in a table, for an acceptable range of values is between 0 and 100?
``` ALTER TABLE Table ADD CONSTRAINT CK_Table_Column_Range CHECK ( Column >= 0 AND Column <= 100 --Inclusive ) ```
382,110
<p>Can someone point me to an article (or discuss here) that explains how an add-on/extension can read what a user has completed in a form in a browser so you can present data to them based on the search parameters?</p> <p>An example would be the Sidestep extension that opens a sidebar when a user searches on an airli...
[ { "answer_id": 382116, "author": "Mark Brackett", "author_id": 2199, "author_profile": "https://Stackoverflow.com/users/2199", "pm_score": 6, "selected": true, "text": "<pre><code>ALTER TABLE Table\nADD CONSTRAINT CK_Table_Column_Range CHECK (\n Column &gt;= 0 AND Column &lt;= 100 --In...
2008/12/19
[ "https://Stackoverflow.com/questions/382110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47880/" ]
Can someone point me to an article (or discuss here) that explains how an add-on/extension can read what a user has completed in a form in a browser so you can present data to them based on the search parameters? An example would be the Sidestep extension that opens a sidebar when a user searches on an airline/travel ...
``` ALTER TABLE Table ADD CONSTRAINT CK_Table_Column_Range CHECK ( Column >= 0 AND Column <= 100 --Inclusive ) ```
382,150
<p>I want to pass some parameters to my MVC UserControl like ShowTitle(bool) and the ViewData.Model.Row . How I define my usercontrol and pass them to it? Tanx</p>
[ { "answer_id": 382205, "author": "liggett78", "author_id": 19762, "author_profile": "https://Stackoverflow.com/users/19762", "pm_score": 1, "selected": false, "text": "<p>You can define your control as</p>\n\n<pre><code>public partial class MyUserControl : System.Web.Mvc.ViewUserControl&...
2008/12/19
[ "https://Stackoverflow.com/questions/382150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46110/" ]
I want to pass some parameters to my MVC UserControl like ShowTitle(bool) and the ViewData.Model.Row . How I define my usercontrol and pass them to it? Tanx
You can use the RenderAction HtmlHelper, found in the MVC futures dll available at [codeplex](http://www.codeplex.com/aspnet). In your main page ... You need an action method on the controller with the parameters. The action then creates a ViewData for the usercontrol. The usercontrol is returned as a view with ``` ...
382,152
<p>I'm trying to control the coordinates of where my program opens a new window because currently they're opening ontop of each other. Does anyone have a working example of how to do this?</p>
[ { "answer_id": 382168, "author": "JosephStyons", "author_id": 672, "author_profile": "https://Stackoverflow.com/users/672", "pm_score": 3, "selected": false, "text": "<p>You can always set the .Top and .Left properties manually, like this:</p>\n\n<pre><code>procedure TForm1.Button1Click(...
2008/12/19
[ "https://Stackoverflow.com/questions/382152", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to control the coordinates of where my program opens a new window because currently they're opening ontop of each other. Does anyone have a working example of how to do this?
You can always set the .Top and .Left properties manually, like this: ``` procedure TForm1.Button1Click(Sender: TObject); var frm : TForm; begin frm := TForm.Create(Self); frm.Left := 100; //replace with some integer variable frm.Top := 100; //replace with some integer variable frm.Show; end; ``` However...
382,155
<p>In Unix the <code>^</code> allows you to repeat a command with some text substituted for new text. For example:</p> <pre><code>csh% grep "stuff" file1 &gt;&gt; Results grep "stuff" file1 csh% ^file1^file2^ grep "stuff" file2 csh% </code></pre> <p>Is there a Vim equivalent? There are a lot of times I find myself ed...
[ { "answer_id": 382195, "author": "palehorse", "author_id": 312, "author_profile": "https://Stackoverflow.com/users/312", "pm_score": 3, "selected": false, "text": "<p>There are 2 ways.</p>\n\n<ol>\n<li>You simply hit the <kbd>.</kbd> key to perform an exact replay of the very last comman...
2008/12/19
[ "https://Stackoverflow.com/questions/382155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23829/" ]
In Unix the `^` allows you to repeat a command with some text substituted for new text. For example: ``` csh% grep "stuff" file1 >> Results grep "stuff" file1 csh% ^file1^file2^ grep "stuff" file2 csh% ``` Is there a Vim equivalent? There are a lot of times I find myself editing minor things on the command line over...
Specifically for subsitutions: **use `&` to repeat your last substitution** on the current line from normal mode. To repeat for all lines, type `:%&`
382,171
<p>I have a form on an HTML page with multiple submit buttons that perform different actions. However, when the user is typing a value into a text input and hit enters, the browsers generally act as though the next submit button sequentially was activated. I want a particular action to occur, so one solution I found wa...
[ { "answer_id": 382179, "author": "cLFlaVA", "author_id": 45109, "author_profile": "https://Stackoverflow.com/users/45109", "pm_score": 4, "selected": true, "text": "<p>One way would be to remove all of the submit buttons and use input buttons to submit the form programatically. This wou...
2008/12/19
[ "https://Stackoverflow.com/questions/382171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1892/" ]
I have a form on an HTML page with multiple submit buttons that perform different actions. However, when the user is typing a value into a text input and hit enters, the browsers generally act as though the next submit button sequentially was activated. I want a particular action to occur, so one solution I found was t...
One way would be to remove all of the submit buttons and use input buttons to submit the form programatically. This would remove the ability to submit the form by hitting the enter key in a textbox. You could also leave one submit button as the default submit functionality, and use regular button inputs for the others ...
382,173
<p>The two methods <code>Thread.Suspend()</code> and <code>Thread.Resume()</code> are obsolete since .NET 2.0. Why? What are other alternatives and any examples?</p>
[ { "answer_id": 382180, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 3, "selected": false, "text": "<p>This is the best tutorial ever for Thread (for C#): <a href=\"http://www.albahari.com/threading/\" rel=\"nor...
2008/12/19
[ "https://Stackoverflow.com/questions/382173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/62776/" ]
The two methods `Thread.Suspend()` and `Thread.Resume()` are obsolete since .NET 2.0. Why? What are other alternatives and any examples?
You'll want to use an AutoResetEvent EventWaitHandle. Say you want to do something like this (**NOTE**: don't do this!): ``` private Thread myThread; private void WorkerThread() { myThread = Thread.CurrentThread; while (true) { myThread.Suspend(); //Do work. } } public void StartWo...
382,174
<p>Within the Netbeans 6.5's Tools -> Options -> Fonts &amp; Colors -> Syntax dialog, you have the ability to change the look and feel of the Netbeans text editor. When you select a language, you are presented with a preview of your font/color scheme. However, when I preview Java, there are far more options for syntax ...
[ { "answer_id": 382232, "author": "lbrandao", "author_id": 47883, "author_profile": "https://Stackoverflow.com/users/47883", "pm_score": 0, "selected": false, "text": "<p>I think you can only accomplish that with a new plugin, since you need somekind of parsing to define what is what. </p...
2008/12/19
[ "https://Stackoverflow.com/questions/382174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34235/" ]
Within the Netbeans 6.5's Tools -> Options -> Fonts & Colors -> Syntax dialog, you have the ability to change the look and feel of the Netbeans text editor. When you select a language, you are presented with a preview of your font/color scheme. However, when I preview Java, there are far more options for syntax changes...
The document which is displayed (for each mime type) is specified in a particular folder in the "system file system" (which is a NetBeans concept which is a virtual file system composed from contributions from individual modules; this is how functionality is dynamically registered in NetBeans). Modules typically speci...
382,176
<p>I am working on a project that needs to use a database driven MVC scheme where the route to the controllers and views are controlled through a single database table. However, I haven't been able to find any tutorials that demonstrate this with a current version of the framework (they all appear to have been written ...
[ { "answer_id": 382298, "author": "lbrandao", "author_id": 47883, "author_profile": "https://Stackoverflow.com/users/47883", "pm_score": 2, "selected": false, "text": "<p>Maybe the best aproach is not by using routers but by using plugins or a common controller. Without a deeper analysis ...
2008/12/19
[ "https://Stackoverflow.com/questions/382176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20178/" ]
I am working on a project that needs to use a database driven MVC scheme where the route to the controllers and views are controlled through a single database table. However, I haven't been able to find any tutorials that demonstrate this with a current version of the framework (they all appear to have been written sev...
I realized that a more elegant approach is indeed to use a router, but for that you would need to create a custom one by extending the Zend\_Controller\_Router\_Abstract class and implementing the "route" method. You get a Zend\_Controller\_Request\_Abstract object as the parameter of the "route" method. There you can...
382,186
<p>Is there a way, given a set of values <code>(x,f(x))</code>, to find the polynomial of a given degree that best fits the data? </p> <p>I know <a href="http://en.wikipedia.org/wiki/Polynomial_interpolation" rel="noreferrer">polynomial interpolation</a>, which is for finding a polynomial of degree <code>n</code> give...
[ { "answer_id": 382201, "author": "John D. Cook", "author_id": 25188, "author_profile": "https://Stackoverflow.com/users/25188", "pm_score": 3, "selected": false, "text": "<p>Yes, the way this is typically done is by using least squares. There are other ways of specifying how well a polyn...
2008/12/19
[ "https://Stackoverflow.com/questions/382186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4958/" ]
Is there a way, given a set of values `(x,f(x))`, to find the polynomial of a given degree that best fits the data? I know [polynomial interpolation](http://en.wikipedia.org/wiki/Polynomial_interpolation), which is for finding a polynomial of degree `n` given `n+1` data points, but here there are a large number of va...
Thanks for everyone's replies. Here is another attempt at summarizing them. Pardon if I say too many "obvious" things: I knew nothing about least squares before, so everything was new to me. NOT polynomial interpolation ---------------------------- [Polynomial interpolation](http://en.wikipedia.org/wiki/Polynomial_in...
382,197
<p>I am getting this error on a remote server, but the same code executes fine locally. Please refrain from saying it sucks, or giving me your rant on dynamic sql, I didn't write it, just trying to figure out why it's throwing an exception. The highlighted error is line 56.</p> <pre><code>Protected Sub drpDateRange_Se...
[ { "answer_id": 382209, "author": "StingyJack", "author_id": 16391, "author_profile": "https://Stackoverflow.com/users/16391", "pm_score": 0, "selected": false, "text": "<p>Whats with the #'s surrounding the date? </p>\n\n<p>SQL understands quoted dates when using text represented dates, ...
2008/12/19
[ "https://Stackoverflow.com/questions/382197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26/" ]
I am getting this error on a remote server, but the same code executes fine locally. Please refrain from saying it sucks, or giving me your rant on dynamic sql, I didn't write it, just trying to figure out why it's throwing an exception. The highlighted error is line 56. ``` Protected Sub drpDateRange_SelectedIndexCha...
This might be due to a regional datetime settings difference between the server and your dev PC. There is an implicit conversion between datetime and string in the code (remember it is inline sql (Edit: RowFilter syntax), you're not setting a parameter). Try formatting the string ``` dv.RowFilter = "inspectionType='B...
382,207
<p>I have tables A and B. Items of table B might exist also in table A, and I want to delete those items. What would the SQL statements to do this look like?</p>
[ { "answer_id": 382216, "author": "HLGEM", "author_id": 9034, "author_profile": "https://Stackoverflow.com/users/9034", "pm_score": 0, "selected": false, "text": "<pre><code>delete a\n--select a.*\nfrom tablea a\njoin tableb b on a.someid = b.someid\n</code></pre>\n\n<p>Make sure that you...
2008/12/19
[ "https://Stackoverflow.com/questions/382207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have tables A and B. Items of table B might exist also in table A, and I want to delete those items. What would the SQL statements to do this look like?
this is an option ``` delete from a where a.key in (select key from b) ```
382,234
<p>I have an integer field in a ClientDataSet and I need to compare to some values, something like this:</p> <p>I can use const</p> <pre><code>const mvValue1 = 1; mvValue2 = 2; if ClientDataSet_Field.AsInteger = mvValue1 then </code></pre> <p>or enums</p> <pre><code>TMyValues = (mvValue1 = 1, mvValue2 = 2); i...
[ { "answer_id": 382277, "author": "X-Ray", "author_id": 14031, "author_profile": "https://Stackoverflow.com/users/14031", "pm_score": 1, "selected": false, "text": "<p>so many options! :-) i prefer enums and routinely use them as you describe. one of the parts i like is that i can use ...
2008/12/19
[ "https://Stackoverflow.com/questions/382234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24293/" ]
I have an integer field in a ClientDataSet and I need to compare to some values, something like this: I can use const ``` const mvValue1 = 1; mvValue2 = 2; if ClientDataSet_Field.AsInteger = mvValue1 then ``` or enums ``` TMyValues = (mvValue1 = 1, mvValue2 = 2); if ClientDataSet_Field.AsInteger = Integer(mv...
I wouldn't say that class consts are not the Delphi way. It's just they have been introduced to Delphi quite recently, and a lot of books and articles you'll find on the internet were written before their introduction, and thus you won't see them widely used. Many Delphi developers (I'd say the majority) will have star...
382,256
<p>In Crystal reports, you can define default values for the report parameters.</p> <p>For example, I might have a date range and set a default start of 12/01/2008 and a default end of 12/31/2008.</p> <p>Is it possible to modify these defaults at runtime? For example:</p> <p>1 - Default to the first and last days o...
[ { "answer_id": 382492, "author": "Philippe Grondier", "author_id": 11436, "author_profile": "https://Stackoverflow.com/users/11436", "pm_score": 3, "selected": true, "text": "<p>Are you planning to run your crystal report from the crystal reports interface or as an add-in embedded in ano...
2008/12/19
[ "https://Stackoverflow.com/questions/382256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/672/" ]
In Crystal reports, you can define default values for the report parameters. For example, I might have a date range and set a default start of 12/01/2008 and a default end of 12/31/2008. Is it possible to modify these defaults at runtime? For example: 1 - Default to the first and last days of the current month? 2 -...
Are you planning to run your crystal report from the crystal reports interface or as an add-in embedded in another program (you can for example use the Crystal Reports ActiveX Designer Runtime Support - craxdrt.dll - in VB code) ? In this last case, it is possible to manipulate every object of the report before launchi...
382,272
<p>I'm using the CPoint class from MFC. There is no explicitly defined assignment operator or copy constructor (AFAIK). Yet, this works:<br></p> <pre> CPoint p1(1, 2), p2; p2 = p1; // p2 now is equal to p1 </pre> <p>I'm assuming this is working automagically because of a compiler generated assignment operator. Correc...
[ { "answer_id": 382284, "author": "Yuliy", "author_id": 47527, "author_profile": "https://Stackoverflow.com/users/47527", "pm_score": 1, "selected": false, "text": "<p>If a class is \"simple\", then the compiler-generated assignment operator will work (memberwise copy). If there are some ...
2008/12/19
[ "https://Stackoverflow.com/questions/382272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47154/" ]
I'm using the CPoint class from MFC. There is no explicitly defined assignment operator or copy constructor (AFAIK). Yet, this works: ``` CPoint p1(1, 2), p2; p2 = p1; // p2 now is equal to p1 ``` I'm assuming this is working automagically because of a compiler generated assignment operator. Correct? If so, can ...
This is safe - if an assignment operator wasn't meant to be supplied then the MFC designers could have made sure it wasn't available (by making it private for example). IIRC the compiler will perform a member-by-member copy, so for a class containing POD like this, you won't have a problem. It can get messy if you hav...
382,301
<p>I've set up a number of accordions on a page using the jquery accordion plugin so I can implement expand all and collapse all functionality.</p> <p>Each ID element is it's own accordion and the code below works to close them all no matter which ones are already open:</p> <pre><code>$("#contact, #address, #email, #...
[ { "answer_id": 382828, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 6, "selected": true, "text": "<p>I'm not exactly sure what you're after, but this is my best guess. Out of all your accordions, you want the \"open all\" but...
2008/12/19
[ "https://Stackoverflow.com/questions/382301", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47895/" ]
I've set up a number of accordions on a page using the jquery accordion plugin so I can implement expand all and collapse all functionality. Each ID element is it's own accordion and the code below works to close them all no matter which ones are already open: ``` $("#contact, #address, #email, #sales, #equipment, #n...
I'm not exactly sure what you're after, but this is my best guess. Out of all your accordions, you want the "open all" button to open all the accordions which are closed (that is, no section is showing). I'd do that by using `filter()` ``` $("#contact, #address, #email, #sales, #equipment, #notes, #marketingdata") ...
382,307
<p>What is it about this source code that causes it to actually generate a table in IE instead of just doing nothing.</p> <pre><code> function generateATable() { tableContainer = document.getElementById("tableDiv"); var tableElement = document.createElement("table"); ...
[ { "answer_id": 382313, "author": "Yuliy", "author_id": 47527, "author_profile": "https://Stackoverflow.com/users/47527", "pm_score": 3, "selected": false, "text": "<pre><code> tableContainer = document.getElementById(\"tableDiv\");\n var tableElement...
2008/12/19
[ "https://Stackoverflow.com/questions/382307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18149/" ]
What is it about this source code that causes it to actually generate a table in IE instead of just doing nothing. ``` function generateATable() { tableContainer = document.getElementById("tableDiv"); var tableElement = document.createElement("table"); // Append the...
``` tableContainer = document.getElementById("tableDiv"); var tableElement = document.createElement("table"); // Append the Table Element to the table // container. tableContainer.appendChild(tableElement); ``` That'...
382,317
<p>I have an application that starts a Swing gui using java web start. The user has 4 versions of java 1.6 installed (1.6.0.3, 1.6.0.5, 1.6.0.7. 1.6.0.11) </p> <p>Webstart is selecting java version 1.6.0.11 but JAVA_HOME is set to java version 1.6.0.3. Could this cause any potential problems for webstart? </p> <ul>...
[ { "answer_id": 382331, "author": "Geo", "author_id": 47222, "author_profile": "https://Stackoverflow.com/users/47222", "pm_score": 0, "selected": false, "text": "<p>Take a look inside the jave web start script. They might have their own JRE or JDK path inside it. The user might be even...
2008/12/19
[ "https://Stackoverflow.com/questions/382317", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47508/" ]
I have an application that starts a Swing gui using java web start. The user has 4 versions of java 1.6 installed (1.6.0.3, 1.6.0.5, 1.6.0.7. 1.6.0.11) Webstart is selecting java version 1.6.0.11 but JAVA\_HOME is set to java version 1.6.0.3. Could this cause any potential problems for webstart? * rich
In [this thread](http://forums.sun.com/thread.jspa?threadID=5282583), it is mentioned a Java Web Start application check the version of an available JRE in this path: ``` C:\Documents and Settings\[User]\Application Data\Sun\Java\Deployment\deployment.properties (for Windows XP) C:\Users\[User]\AppData\LocalLow\Sun\J...
382,336
<p>Does anyone know of a good example on how to set up log4net to use the system.data.sqlite provider? </p> <p>I've been playing around with it lately and I thought I had it all working. It makes a successful connection to the database and "writes" it out. However, when I look at the table data, it never actually c...
[ { "answer_id": 757566, "author": "enriquein", "author_id": 88868, "author_profile": "https://Stackoverflow.com/users/88868", "pm_score": 0, "selected": false, "text": "<p>I was searching that same thing today and found <a href=\"http://sqlite.phxsoftware.com/forums/t/1667.aspx\" rel=\"no...
2008/12/19
[ "https://Stackoverflow.com/questions/382336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Does anyone know of a good example on how to set up log4net to use the system.data.sqlite provider? I've been playing around with it lately and I thought I had it all working. It makes a successful connection to the database and "writes" it out. However, when I look at the table data, it never actually commits the lo...
Make sure you have the following references set: * log4net (obviously) * System.Data.SQLite (you might forget about this one) Close the project in Visual Studio and reopen the .csproject (or equivalent for VB) in a text editor, and look for the references section. Mine looks like this: ``` <Reference Include="log4n...
382,344
<p>I have a service that I am rewriting to use threading. I understand that state from one thread should not be accessed by another, but I'm a little confused by what constitutes 'state'. Does that mean <em>any</em> field/property/method outside of the method scope?</p> <p>Specifically, my service looks something lik...
[ { "answer_id": 382354, "author": "Charlie Martin", "author_id": 35092, "author_profile": "https://Stackoverflow.com/users/35092", "pm_score": 2, "selected": false, "text": "<p>\"State\" is all the data contained in the class, and the real issue as far as concurrency goes is write access...
2008/12/19
[ "https://Stackoverflow.com/questions/382344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47225/" ]
I have a service that I am rewriting to use threading. I understand that state from one thread should not be accessed by another, but I'm a little confused by what constitutes 'state'. Does that mean *any* field/property/method outside of the method scope? Specifically, my service looks something like this: ``` publi...
Er...nope, you don't need to lock resources that are read-only. The purpose of locking them is so that if you need to check the value of a resource before writing it then another resource can't change the value between your read and your write. i.e.: ``` SyncLock MyQueue If MyQueue.Length = 0 Then PauseFlag.Rese...