qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
368,006 | <p>I want my background worker to add items to a list box, it appears to do so when debugging but the listbox doesn't show the values. I suspect this is something to do with adding items whilst inside the background worker thread, do I need to add these to an array and then populate the list box from the array during <code>backgroundWorker1_RunWorkerCompleted</code>?</p>
<p>Thanks for the help.</p>
| [
{
"answer_id": 368009,
"author": "Quibblesome",
"author_id": 1143,
"author_profile": "https://Stackoverflow.com/users/1143",
"pm_score": 1,
"selected": false,
"text": "Form.Invoke\n"
},
{
"answer_id": 368017,
"author": "Oliver Friedrich",
"author_id": 44532,
"author_p... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
368,014 | <p>Is there any way to detect if the iPhone wakes up from sleep while you're app is running? Eg: your app is running, the user locks the screen (or the screen auto locks) and some time later the user unlocks the screen and up pops your app. Is there some way to get an event at that point or detect it somehow? </p>
<p>I've tried searching the Google and this forum, but I can't seem to find anything about it.</p>
| [
{
"answer_id": 368066,
"author": "Lily Ballard",
"author_id": 582,
"author_profile": "https://Stackoverflow.com/users/582",
"pm_score": 4,
"selected": true,
"text": "applicationDidBecomeActive:"
},
{
"answer_id": 1490753,
"author": "noodl_es",
"author_id": 170237,
"au... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6044/"
] |
368,018 | <p>I'm trying to replace every multiline import inside a Python source file.. So, the source goes like</p>
<pre><code>from XXX import (
AAA,
BBB,
)
from YYY import (
CCC,
DDD,
EEE,
...
)
...other instructions...
</code></pre>
<p>and I'd like to get something like</p>
<pre><code>from XXX import AAA, BBB
from YYY import CCC, DDD, EEE, ...
...other instructions...
</code></pre>
<p>I tried to use sed but it looks like it doesn't support non-greedy matching of the closing parenthesis, so it "eats" the second import.. :(<br>
Any hint? Is this impossible with sed? Should I try with another tool?</p>
| [
{
"answer_id": 368037,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 2,
"selected": true,
"text": "lineIter= iter(aFile)\nfor aLine in lineIter:\n if aLine.startswith(\"import\"):\n if aLine.endswith(\"(\"):\n ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3497/"
] |
368,021 | <p>When my app is run in the iPhone simulator, the delegate method</p>
<pre><code>- (void)applicationWillTerminate:(UIApplication *)application
</code></pre>
<p>is only called the first time I hit the iPhone simulator's home button.</p>
<p>After the home button is pressed and the app is launched again, hitting the home button does not call the delegate method.</p>
<p>What is going on here? Am I misunderstanding something fundamental?</p>
| [
{
"answer_id": 368064,
"author": "Lily Ballard",
"author_id": 582,
"author_profile": "https://Stackoverflow.com/users/582",
"pm_score": 6,
"selected": true,
"text": "NSLog"
},
{
"answer_id": 4372705,
"author": "Linuxmint",
"author_id": 524358,
"author_profile": "https... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26088/"
] |
368,039 | <p>I seem to have an app on my Dev server that has lots of open connections (they should be there, but some bad data layer was used to open them, that forgot to close them). I just want them closed so I can keep other apps running on the server. How can I force all the connections to close?</p>
| [
{
"answer_id": 368052,
"author": "gbn",
"author_id": 27535,
"author_profile": "https://Stackoverflow.com/users/27535",
"pm_score": 2,
"selected": false,
"text": "DECLARE @kill_id smallint \nDECLARE spid_cursor CURSOR FOR\nselect spid from sysprocesses \nwhere dbid = > 4 and last_batch < ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5055/"
] |
368,041 | <p>I would like to show the user with a spinner, that something is done in background but do not know how this works in a batchfile.</p>
<p>Does anyone have a clue?</p>
| [
{
"answer_id": 368793,
"author": "Patrick Cuff",
"author_id": 7903,
"author_profile": "https://Stackoverflow.com/users/7903",
"pm_score": 1,
"selected": false,
"text": "WScript.StdOut.Write(chr(8) & WScript.Arguments(0))\n"
},
{
"answer_id": 368865,
"author": "chakrit",
"... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44532/"
] |
368,049 | <p>I'd like to insert a new field with a Default value using Visual C++ Code.
I have wrote this:</p>
<pre><code>CADODatabase pDB;
String strConnessione = _T("Provider=Microsoft.Jet.OLEDB.4.0;""Data Source=");
strConnessione = strConnessione + "MioDatabase.mdb";
pDB.SetConnectionString(strConnessione);
pDB.Open();
query.Format("ALTER TABLE TBProva ADD Fattore Double Default 0;");
pDB.Execute(query);
</code></pre>
<p>but it isn't correct. How can I do for doing it?
Someone of you Can write me the just code? </p>
| [
{
"answer_id": 368572,
"author": "Philippe Grondier",
"author_id": 11436,
"author_profile": "https://Stackoverflow.com/users/11436",
"pm_score": 2,
"selected": false,
"text": "strSql = \"ALTER TABLE MyTable ADD COLUMN MyField DECIMAL (28,3);\"\nstrSql = \"ALTER TABLE MyTable ADD COLUMN M... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
368,057 | <p>Say I have a package "mylibrary".</p>
<p>I want to make "mylibrary.config" available for import, either as a dynamically created module, or a module imported from an entirely different place that would then basically be "mounted" inside the "mylibrary" namespace.</p>
<p>I.e., I do:</p>
<pre><code>import sys, types
sys.modules['mylibrary.config'] = types.ModuleType('config')
</code></pre>
<p>Given that setup:</p>
<pre><code>>>> import mylibrary.config # -> works
>>> from mylibrary import config
<type 'exceptions.ImportError'>: cannot import name config
</code></pre>
<p>Even stranger:</p>
<pre><code>>>> import mylibrary.config as X
<type 'exceptions.ImportError'>: cannot import name config
</code></pre>
<p>So it seems that using the direct import works, the other forms do not. Is it possible to make those work as well?</p>
| [
{
"answer_id": 368178,
"author": "Martin v. Löwis",
"author_id": 33006,
"author_profile": "https://Stackoverflow.com/users/33006",
"pm_score": 5,
"selected": true,
"text": ">>> import sys,types,xml\n>>> xml.config = sys.modules['xml.config'] = types.ModuleType('xml.config')\n>>> import x... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15677/"
] |
368,074 | <p>I have a problem in integrating PHP and JQuery:</p>
<p>My main file is <code>MyFile.html</code> and the AJAX call file is <code>ajax.php</code>.</p>
<p>The <code>ajax.php</code> function returns links to <code>myFile.html</code> as </p>
<p><code><a href Link.php?action=Function ></a></code> (i.e <code>echo " <a href Link.php?action=Delete";</code>)</p>
<p>When I click the returned link from <code>MyFile.html</code> it's performing as expected. I need how to modify the equivalent code to work correctly in <code>Myfile.Html</code>.</p>
<p>My motivation is that the <code>ajax.php</code> return link should work in HTML.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 368113,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 2,
"selected": false,
"text": "="
},
{
"answer_id": 368175,
"author": "William Brendel",
"author_id": 2405,
"author_profile": "https://S... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44984/"
] |
368,094 | <p>In Java, what are the performance and resource implications of using</p>
<pre><code>System.currentTimeMillis()
</code></pre>
<p>vs. </p>
<pre><code>new Date()
</code></pre>
<p>vs. </p>
<pre><code>Calendar.getInstance().getTime()
</code></pre>
<p>As I understand it, <code>System.currentTimeMillis()</code> is the most efficient. However, in most applications, that long value would need to be converted to a Date or some similar object to do anything meaningful to humans.</p>
| [
{
"answer_id": 368100,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": 4,
"selected": false,
"text": "System.currentTimeMillis()"
},
{
"answer_id": 368103,
"author": "krosenvold",
"author_id": 23691,
"autho... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15452/"
] |
368,114 | <p>I have an HTML form with two buttons as follows:</p>
<pre><code><input type="submit" name="confirm" value="Yes, Delete" />
<button name="confirm" type="button" onclick="history.back()" value="No, Go Back">No, Go Back</button>
</code></pre>
<p>Now, when I click on either in Firefox, the behavior is as expected. If I click the submit button, then "Yes, Delete" gets posted and if I click "No, Go Back" it's as if I hit the back button on the browser. However, in Internet Explorer (6 or 8), if I click on "Yes, Delete" then "No, Go Back" gets posted. Why is that?</p>
| [
{
"answer_id": 368151,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<button>"
}
] | 2008/12/15 | [
"https://Stackoverflow.com/questions/368114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3831/"
] |
368,139 | <p>I was given a task of write the coding guidelines for my team, and it was going great until my manager asked me to write an explanation of <strong>Why Error Handling is Important</strong>.</p>
<p>I know it instinctively, but how do I express this in words?</p>
<p>I tried to google it first but came up empty, so I now ask my fellow coding wizards.</p>
| [
{
"answer_id": 368165,
"author": "Christian Payne",
"author_id": 5188,
"author_profile": "https://Stackoverflow.com/users/5188",
"pm_score": 1,
"selected": false,
"text": "System.IO.FileNotFoundException"
}
] | 2008/12/15 | [
"https://Stackoverflow.com/questions/368139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44375/"
] |
368,143 | <p>I'm new to ASP.NET MVC and all tutorials, samples, and the like I seem to find are very basic.</p>
<p>Is it possible (and if yes, a good design) to have routes like so:
.../Organization/10/User/5/Edit
.../Organization/10/User/List</p>
<p>In other words; can the urls mirror your domain model?</p>
| [
{
"answer_id": 368243,
"author": "Garry Shutler",
"author_id": 6369,
"author_profile": "https://Stackoverflow.com/users/6369",
"pm_score": 1,
"selected": false,
"text": "\"~/Organization/{orgId}/{Controller}/{id}/{action}\"\n"
}
] | 2008/12/15 | [
"https://Stackoverflow.com/questions/368143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46343/"
] |
368,154 | <p>I'm creating a installer for a c# windows project using VS 2008. I'm trying to write a custom action that copies a settings file from the source directory of the MSI file stored on a file server (e.g. \server\fileshare\myappinstaller\mysetting.xml) to the target directory on the computer on which my application is been installed (e.g. C:\Program Files\My App). </p>
<p>The settings file can't be added in to the installer as it will contain settings with will be unique to the customer installing the app. </p>
<p>Does anyone have code (preferably C# or VB.NET) for such a custom action? Alternately does anyone know how to get the MSI source location (e.g. \server\fileshare\myappinstaller) within a custom action.</p>
<p>Many thanks</p>
| [
{
"answer_id": 2094661,
"author": "habakuk",
"author_id": 254041,
"author_profile": "https://Stackoverflow.com/users/254041",
"pm_score": 3,
"selected": false,
"text": " Public Overrides Sub Commit(ByVal savedState As System.Collections.IDictionary)\n MyBase.Commit(savedState)\... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/254/"
] |
368,160 | <p>I have a dataset in a worksheet that can be different every time. I am creating a pivottable from that data, but it is possible that one of the PivotItems is not there. For example:</p>
<pre><code>.PivotItems("Administratie").Visible = False
</code></pre>
<p>If that specific value is not in my dataset, the VBA script fails, saying that it can't define the item in the specified Field. (error 1004)</p>
<p>So I thought a loop might work.
I have the following: </p>
<pre><code>Dim pvtField As PivotField
Dim pvtItem As PivotItem
Dim pvtItems As PivotItems
For Each pvtItem In pvtField.pvtItems
pvtItem.Visible = False
Next
</code></pre>
<p>But that gives me an 91 error at the For Each pvtItem line:</p>
<pre><code>Object variable or With block variable not set
</code></pre>
<p>I thought I declared the variables well enough, but I am most likely missing something obvious... </p>
| [
{
"answer_id": 368211,
"author": "Patrick Cuff",
"author_id": 7903,
"author_profile": "https://Stackoverflow.com/users/7903",
"pm_score": 0,
"selected": false,
"text": "Public Function Test()\n On Error GoTo Test_EH\n\n Dim pvtField As PivotField\n Dim pvtItem As PivotItem\n ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42389/"
] |
368,169 | <p>I have some code that prints out databse values into a repeater control on an asp.net page. However, some of the values returned are null/blank - and this makes the result look ugly when there are blank spaces. </p>
<p>How do you do conditional logic in asp.net controls i.e. print out a value if one exists, else just go to next value.</p>
<p>I should also add - that I want the markup to be conditional also, as if there is no value I dont want a <br> tag either.</p>
<p>Here is a snippet of code below just to show the type of values I am getting back from my database. (It is common for <strong>Address 2</strong> not to have a value at all).</p>
<pre><code><div id="results">
<asp:Repeater ID="repeaterResults" runat="server">
<ItemTemplate>
Company: <strong><%#Eval("CompanyName") %></strong><br />
Contact Name: <strong><%#Eval("ContactName") %></strong><br />
Address: <strong><%#Eval("Address1")%></strong><br />
<strong><%#Eval("Address2")%></strong><br />..................
</code></pre>
<p>Many thanks</p>
| [
{
"answer_id": 368225,
"author": "Matt Woodward",
"author_id": 40593,
"author_profile": "https://Stackoverflow.com/users/40593",
"pm_score": 4,
"selected": true,
"text": "<strong><% If (Eval(\"Address2\").Length > 0) Then %><%#Eval(\"Address2\")%><% Else %>No data available for Address 2... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5175/"
] |
368,170 | <p>I'm trying to write some code to find a specific XmlNode object based on the URL in the XML sitemap but can't get it to find anything.</p>
<p>The sitemap is the standard ASP.net sitemap and contains:</p>
<pre><code><siteMapNode url="~/lev/index.aspx" title="Live-Eye-Views">
--- Child Items ---
</siteMapNode>
</code></pre>
<p>The code I'm using to search for the element is:</p>
<pre><code>XmlDocument siteMapXml = new XmlDocument();
siteMapXml.Load(AppDomain.CurrentDomain.BaseDirectory + _siteMapFileName)
XmlNode levRoot = siteMapXml.SelectSingleNode("siteMapNode[@url=\"~/lev/index.aspx\"]");
</code></pre>
<p>The levRoot object is always null. When I break after the Load method, I can see all the elements in the XML file so it's loading as expected.</p>
<p>I've tried using single quotes in the XPath query but that didn't make any difference.</p>
<p>_siteMapFileName is set in the Initialize method and is pointing at the correct file. </p>
<p>Does anyone have any ideas what could be up with this or suggest another way to find a specific element by attribute?</p>
| [
{
"answer_id": 368239,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 3,
"selected": true,
"text": "<siteMap xmlns=\"http://schemas.microsoft.com/AspNet/SiteMap-File-1.0\" >\n <siteMapNode url=\"~/lev/index.aspx\" title=\"... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33721/"
] |
368,176 | <p>I need to find 2 elements in an unsorted array such that the difference between them is less than or equal to (Maximum - Minimum)/(number of elements in the array).</p>
<p>In O(n).</p>
<p>I know the max and min values.</p>
<p>Can anyone think of something?</p>
<p>Thank you!</p>
| [
{
"answer_id": 369817,
"author": "Sid Datta",
"author_id": 18390,
"author_profile": "https://Stackoverflow.com/users/18390",
"pm_score": 1,
"selected": false,
"text": "2n"
},
{
"answer_id": 53613333,
"author": "Jonathan Weiss",
"author_id": 6706019,
"author_profile": ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
368,184 | <p>I found some code in a project which looks like that : </p>
<pre><code>int main(int argc, char *argv[])
{
// some stuff
try {
theApp.Run();
} catch (std::exception& exc) {
cerr << exc.what() << std::endl;
exit(EXIT_FAILURE);
}
return (EXIT_SUCCESS);
}
</code></pre>
<p>I don't understand why the exceptions are being catched. If they weren't, the application would simply exit and the exception would be printed. </p>
<p>Do you see any good reason to catch exceptions here ? </p>
<hr>
<p>EDIT : I agree that it is good to print the exception error. However, wouldn't it be better to rethrow the exception ? I have the feeling that we are swallowing it here...</p>
| [
{
"answer_id": 368217,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "int main(void)\n{\n try\n {\n // your code \n }\n catch ( /* YourPossibleExceptions i.e. barfs you ex... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20986/"
] |
368,192 | <p>I have this little function</p>
<pre><code>function makewindows(){
child1 = window.open ("about:blank");
child1.document.write("<?php echo htmlspecialchars(json_encode($row2['ARTICLE_DESC']), ENT_QUOTES); ?>");
child1.document.close();
}
</code></pre>
<p>Which whatever I try, simply outputs the php code as the html source, and not the result of the php code. This was previously working fine, and I am not sure what I have changed to result in this behavior.</p>
<p>I have pasted all the code now. An error is generated by a link that calls updateByQuery, preventing makewindows from being parsed correctly..I think. I am not sure what is wrong with updateByQuery however:</p>
<pre><code>function updateByQuery(layer, query) {
url = "get_records.php?cmd=GetRecordSet&query="+query+"&sid="+Math.random();
update(layer, url);
}
</code></pre>
| [
{
"answer_id": 368216,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 0,
"selected": false,
"text": "http://localhost/yourpage.php"
},
{
"answer_id": 368231,
"author": "some",
"author_id": 36866,
"... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] |
368,194 | <p>I'm using <a href="https://tablelayout.dev.java.net/" rel="nofollow noreferrer">TableLayout</a> for my swing GUI. Initially only some basic labels, buttons and text fields where required which I could later on access by:</p>
<pre><code>public Component getComponent(String componentName) {
return getComponent(componentName, this.frame.getContentPane());
}
private Component getComponent(String componentName, Component component) {
Component found = null;
if (component.getName() != null && component.getName().equals(componentName)) {
found = component;
} else {
for (Component child : ((Container) component).getComponents()) {
found = getComponent(componentName, child);
if (found != null)
break;
}
}
return found;
}
</code></pre>
<p>Unfortunately I ran into issues after using using <code>JScrollPane</code> to support scrolling in <code>JTextArea</code> and JTable's, which I did with:</p>
<pre><code>JTextArea ta = new JTextArea();
ta.setName("fooburg");
JScrollPane scr = new JScrollPane(ta);
frame.getContentPane().add(scr, "1, 1"); // EDIT: changed, tkx bruno
</code></pre>
<p>After suggestions, I've been able to access through <code>getComponent("fooburg")</code> the desired component (the version above is the final one). Many thanks to Dan and Bruno!</p>
| [
{
"answer_id": 368216,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 0,
"selected": false,
"text": "http://localhost/yourpage.php"
},
{
"answer_id": 368231,
"author": "some",
"author_id": 36866,
"... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33429/"
] |
368,200 | <p>Simple question. How do you disable the text selection of DocumentViewer in WPF? This is the feature where an XPS document is displayed by the viewer and then text can be highlighted via mouse. The highlighted text can also be copied but I have already disabled this. I just don't know how to disable the highlighting.</p>
<p>Thanks!</p>
| [
{
"answer_id": 415155,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": "<Style TargetType=\"{x:Type ScrollViewer}\" x:Key=\"CustomScrollPresenter\">\n <Setter Property=\"Template\">\n <Set... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
368,215 | <p>Considering the following table</p>
<p>I have a large table from which I can query to get the following table</p>
<pre><code>type no of times type occurs
101 450
102 562
103 245
111 25
112 28
113 21
</code></pre>
<p>Now suppose I wanted to get a table which shows me the sum of no of times type occurs
for type starting with 1 then starting with 10,11,12,13.......19 then starting with 2, 20,21, 22, 23...29 and so on.</p>
<p>Something like this </p>
<pre><code>1 1331 10 1257
11 74
12 ..
13 ..
.. ..
2 ... 20 ..
21 ..
</code></pre>
<p>Hope I am clear
Thanks </p>
| [
{
"answer_id": 415155,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": "<Style TargetType=\"{x:Type ScrollViewer}\" x:Key=\"CustomScrollPresenter\">\n <Setter Property=\"Template\">\n <Set... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31132/"
] |
368,219 | <p>I have a relatively simple form which asks a variety of questions. One of those questions is answered via a Select Box. What I would like to do is if the person selects a particular option, they are prompted for more information.</p>
<p>With the help of a few online tutorials, I've managed to get the Javascript to display a hidden div just fine. My problem is I can't seem to localise the event to the Option tag, only the Select tag which is no use really.</p>
<p>At the moment the code looks like (code simplified to aid clarity!): </p>
<pre><code><select id="transfer_reason" name="transfer_reason onChange="javascript:showDiv('otherdetail');">
<option value="x">Reason 1</option>
<option value="y">Reason 2</option>
<option value="other">Other Reason</option>
</select>
<div id="otherdetail" style="display: none;">More Detail Here Please</div>
</code></pre>
<p>What I would like is if they choose "Other Reason" it then displays the div. Not sure how I achieve this if onChange can't be used with the Option tag!</p>
<p>Any assistance much appreciated :)</p>
<p>Note: Complete beginner when it comes to Javascript, I apologise if this is stupidly simple to achieve!</p>
| [
{
"answer_id": 368232,
"author": "Tom",
"author_id": 20,
"author_profile": "https://Stackoverflow.com/users/20",
"pm_score": 5,
"selected": true,
"text": "onchange"
},
{
"answer_id": 368292,
"author": "suitedupgeek",
"author_id": 42428,
"author_profile": "https://Stac... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42428/"
] |
368,253 | <p>I have a <code>NSTimer</code> object that I need to invalidate if a user taps on a button or if they exit a view.</p>
<p>So I have:</p>
<pre><code>[myNSTimer invalidate];
</code></pre>
<p>inside my button handler and inside <code>viewWillDisappear</code>. If user taps on a button and then exists a view the app throws an exception because <code>myNSTimer</code> has already been invalidated.
What I need to do in the <code>viewWillDisappear</code> method is check if the <code>myNSTimer</code> has been invalidated or not. How do I do that?</p>
<p>I've tried:</p>
<pre><code>if(myNSTimer != nil)
[myNSTimer invalidate];
</code></pre>
<p>but that didn't work.</p>
| [
{
"answer_id": 368263,
"author": "Lily Ballard",
"author_id": 582,
"author_profile": "https://Stackoverflow.com/users/582",
"pm_score": 6,
"selected": true,
"text": "release"
},
{
"answer_id": 368379,
"author": "Ben Gottlieb",
"author_id": 6694,
"author_profile": "htt... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44091/"
] |
368,260 | <p>Sometimes Eclipse comes up saying "hey you should debug this line!!!" but doesn't actually close the program. I can then continue to play big two, and even go through the same events that caused the error the first time and get another error box to pop up!</p>
<p>The bug is simple, I'll fix it, I just want to know why some bugs are terminal and some are not? What's the difference?</p>
| [
{
"answer_id": 368297,
"author": "Bent André Solheim",
"author_id": 44380,
"author_profile": "https://Stackoverflow.com/users/44380",
"pm_score": 2,
"selected": false,
"text": "public class ThreadTest {\n\n public static void main(String[] args) {\n\n Runnable test = new Runnab... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29182/"
] |
368,262 | <p>I am compiling a c++ static library in vs2008, and in the solution i also have a startup project that uses the lib, and that works fine. </p>
<p>But when using the lib in another solution i get an run-time check failure.
"The value of ESP was not properly saved across a functioncall"
Stepping through the code i noticed a function foo() jumping to bar() instead right before the crash. The functions in question are just regular functions and no function pointers.</p>
<p>Anyone has any clue what might be going on, and why it works when using the lib's from the same solution?</p>
<p>edit: the functions (methods) are part of a class, if that helps.</p>
| [
{
"answer_id": 370228,
"author": "Mr.Ree",
"author_id": 37946,
"author_profile": "https://Stackoverflow.com/users/37946",
"pm_score": 5,
"selected": true,
"text": "class Foo { virtual void f(); };\n"
}
] | 2008/12/15 | [
"https://Stackoverflow.com/questions/368262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46357/"
] |
368,265 | <p>I want to make a very simple event bus which will allow any client to subscribe to a particular type of event and when any publisher pushes an event on the bus using <code>EventBus.PushEvent()</code> method only the clients that subscribed to that particular event type will get the event.</p>
<p>I am using C# and .NET 2.0.</p>
| [
{
"answer_id": 1681066,
"author": "Volker von Einem",
"author_id": 104631,
"author_profile": "https://Stackoverflow.com/users/104631",
"pm_score": 2,
"selected": false,
"text": "[Publishes(\"TimerTick\")]\npublic event EventHandler Expired;\nprivate void OnTick(Object sender, EventArgs e... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46358/"
] |
368,271 | <p>I would like to know how to modify the below code to strip <code>=20</code> characters at the end of many lines, and mainly to sort the messages chronologically from first received or sent to last. I am not sure if this would be an internal Perl routine or not. </p>
<pre><code>#!/usr/bin/perl
use warnings;
use strict;
use Mail::Box::Manager;
my $file = shift || $ENV{MAIL};
my $mgr = Mail::Box::Manager->new(
access => 'r',
);
my $folder = $mgr->open( folder => $file )
or die "$file: Unable to open: $!\n";
for my $msg ($folder->messages)
{
my $to = join( ', ', map { $_->format } $msg->to );
my $from = join( ', ', map { $_->format } $msg->from );
my $date = localtime( $msg->timestamp );
my $subject = $msg->subject;
my $body = $msg->body;
# Strip all quoted text
$body =~ s/^>.*$//msg;
print <<"";
From: $from
To: $to
Date: $date
$body
}
</code></pre>
<p>When trying to run this I get the following errors:</p>
<p>"my" variable $msg masks earlier declaration in same scope at x.pl line 16.
syntax error at x.pl line 15, near ") ) "
syntax error at x.pl line 31, near "}"
(Might be a runaway multi-line << string starting on line 25)
Execution of x.pl aborted due to compilation errors.</p>
<p>I am not sure as to why, as the syntax seems fine.</p>
| [
{
"answer_id": 368309,
"author": "innaM",
"author_id": 7498,
"author_profile": "https://Stackoverflow.com/users/7498",
"pm_score": 3,
"selected": true,
"text": "=20"
}
] | 2008/12/15 | [
"https://Stackoverflow.com/questions/368271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] |
368,280 | <p>As made clear in update 3 on <a href="https://stackoverflow.com/questions/367440/javascript-associative-array-without-tostring-etc#367454">this answer</a>, this notation:</p>
<pre><code>var hash = {};
hash[X]
</code></pre>
<p>does not actually hash the object <code>X</code>; it actually just converts <code>X</code> to a string (via <code>.toString()</code> if it's an object, or some other built-in conversions for various primitive types) and then looks that string up, without hashing it, in "<code>hash</code>". Object equality is also not checked - if two different objects have the same string conversion, they will just overwrite each other.</p>
<p>Given this - are there any efficient implementations of hashmaps in JavaScript?</p>
<p>(For example, the second Google result of <a href="http://www.google.com/search?rlz=1C1GGLS_en-USUS299US303&sourceid=chrome&ie=UTF-8&q=javascript%20hashmap" rel="noreferrer"><code>javascript hashmap</code></a> yields an implementation which is O(n) for any operation. Various other results ignore the fact that different objects with equivalent string representations overwrite each other.</p>
| [
{
"answer_id": 368504,
"author": "Eugene Lazutkin",
"author_id": 26394,
"author_profile": "https://Stackoverflow.com/users/26394",
"pm_score": 10,
"selected": true,
"text": "var key = function(obj){\n // Some unique object-dependent key\n return obj.totallyUniqueEmployeeIdKey; // Just ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] |
368,281 | <p>I'm pulling my hair out on this one.</p>
<p>I have a site which is version controlled using Subversion. I use aptana (eclipse, subclipse) to do the svn. I have been checking in and out files, updating etc and everything is fine. However the system we have been building has been adding its own files and folders.</p>
<p>When I try to commit these, it tells me <code><path></code> is not a working copy. If I try to do a cleanup then it gives the same error. I found I can manually add each file to version control but this throws the same error. Doing an update doesn't help, refreshing the workspace does not do anything either. Cleanup seems to die after the error and then the directory is locked.</p>
<p>I know you're supposed to add files using SVN, but how on earth do you work with generated files? How do I get around this "<code><folder></code> is not a working copy directory" error? How do I get Subversion to just look at the files and add them to its repository?</p>
| [
{
"answer_id": 368293,
"author": "Keltia",
"author_id": 16143,
"author_profile": "https://Stackoverflow.com/users/16143",
"pm_score": 0,
"selected": false,
"text": "svn"
},
{
"answer_id": 368307,
"author": "Avi",
"author_id": 1605,
"author_profile": "https://Stackover... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368281",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28241/"
] |
368,288 | <p>I'm having trouble with the following two items:</p>
<ul>
<li>How to retrieve all of the subkey values in ClassesRoot\Typelib, and;</li>
<li>How to find a match for a known value (path/dll name) in the array of subkey values.</li>
</ul>
<p>As background info, I'm trying to find a way to check if a DLL has been registered. Someone mentioned that checking ClassesRoot\Typelib for the DLL was one way of doing it, since I know the directory location and name of the DLL, but nothing else.</p>
<p>Does anyone have any tips? Cheers.</p>
| [
{
"answer_id": 368397,
"author": "WOPR",
"author_id": 46255,
"author_profile": "https://Stackoverflow.com/users/46255",
"pm_score": 1,
"selected": false,
"text": "public void Foo()\n{\n foreach (string s in Microsoft.Win32.Registry.CurrentUser.GetSubKeyNames())\n {\n Microsoft.W... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2493/"
] |
368,295 | <p>I'm using <code>FontMetrics.getHeight()</code> to get the height of the string, but it gives me a wrong value, cutting off the descenders of string characters. Is there a better function I can use?</p>
| [
{
"answer_id": 368308,
"author": "Joachim Sauer",
"author_id": 40342,
"author_profile": "https://Stackoverflow.com/users/40342",
"pm_score": 4,
"selected": false,
"text": "getMaxDescent()"
},
{
"answer_id": 368448,
"author": "Ned Batchelder",
"author_id": 14343,
"auth... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9476/"
] |
368,323 | <p>i've got the following linq2sql query, and i'm setting the result to a POCO. One of my POCO properties is an enumeration.</p>
<pre><code>public IQueryable<Models.Achievement> GetAchievements()
{
return from a in _sqlDatabase.Achievements
select new Models.Achievement
{
// Note: ToEnum is an extension method that converts an int -> the enum.
AchievementType = a.AchievementTypeId.ToEnum<Models.AchievementType>(),
DateTimeCreated = a.DateTimeCreated,
UserId = a.UserId
};
}
</code></pre>
<p>When i run the query, i get the following error.</p>
<pre><code>System.NotSupportedException: Method 'Models.AchievementType
ToEnum[AchievementType](int)' has no supported translation to SQL.
</code></pre>
<p>hmm. is there a way i can be tricky enough to make the result int get converted to my custom enum?</p>
| [
{
"answer_id": 368335,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": true,
"text": "select new {..., AchievementType = (AchievementType) foo.Bar, ...}\n"
},
{
"answer_id": 368342,
"author": ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30674/"
] |
368,329 | <p>Besides the fact that <code>$_REQUEST</code> reads from cookies, are there any reasons why I should use <code>$_GET</code> and <code>$_POST</code> instead of <code>$_REQUEST</code>? What are theoretical and practical reasons for doing so?</p>
| [
{
"answer_id": 368337,
"author": "Karsten",
"author_id": 28144,
"author_profile": "https://Stackoverflow.com/users/28144",
"pm_score": 2,
"selected": false,
"text": "$_GET['foo'] = 'bar'\n$_POST['foo'] = 'baz'\n"
},
{
"answer_id": 368339,
"author": "Powerlord",
"author_id... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26155/"
] |
368,338 | <p>can I pass a cursor in a procedure?</p>
<pre><code>CURSOR BLT_CURSOR IS
SELECT BLT.sol_id,
BLT.bill_id,
BLT.bank_id
FROM BLT;
</code></pre>
<p>Is my cursor.</p>
<pre><code>Procedure abc(i want to pass the cursor here)
</code></pre>
<p>How do I do it.</p>
| [
{
"answer_id": 368533,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 4,
"selected": false,
"text": "PROCEDURE abc( p_cursor IN SYS_REFCURSOR) IS\n v_sol_id blt.sol_id%TYPE;\n v_bill_id blt.bill_id%TYPE;\n v_bank... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
368,351 | <p>Given the following table in SQL Server 2005:</p>
<pre><code>ID Col1 Col2 Col3
-- ---- ---- ----
1 3 34 76
2 32 976 24
3 7 235 3
4 245 1 792
</code></pre>
<p>What is the best way to write the query that yields the following result (i.e. one that yields the final column - a column containing the minium values out of Col1, Col2, and Col 3 <strong>for each row</strong>)?</p>
<pre><code>ID Col1 Col2 Col3 TheMin
-- ---- ---- ---- ------
1 3 34 76 3
2 32 976 24 24
3 7 235 3 3
4 245 1 792 1
</code></pre>
<p><strong><em>UPDATE:</em></strong></p>
<p>For clarification (as I have said in the coments) in the real scenario the database is <strong>properly normalized</strong>. These "array" columns are not in an actual table but are in a result set that is required in a report. And the new requirement is that the report also needs this MinValue column. I can't change the underlying result set and therefore I was looking to T-SQL for a handy "get out of jail card".</p>
<p>I tried the CASE approach mentioned below and it works, although it is a bit cumbersome. It is also more complicated than stated in the answers because you need to cater for the fact that there are two min values in the same row.</p>
<p>Anyway, I thought I'd post my current solution which, given my constraints, works pretty well. It uses the UNPIVOT operator:</p>
<pre><code>with cte (ID, Col1, Col2, Col3)
as
(
select ID, Col1, Col2, Col3
from TestTable
)
select cte.ID, Col1, Col2, Col3, TheMin from cte
join
(
select
ID, min(Amount) as TheMin
from
cte
UNPIVOT (Amount for AmountCol in (Col1, Col2, Col3)) as unpvt
group by ID
) as minValues
on cte.ID = minValues.ID
</code></pre>
<p>I'll say upfront that I don't expect this to offer the best performance, but given the circumstances (I can't redesign all the queries just for the new MinValue column requirement), it is a pretty elegant "get out of jail card".</p>
| [
{
"answer_id": 368381,
"author": "George Mastros",
"author_id": 1408129,
"author_profile": "https://Stackoverflow.com/users/1408129",
"pm_score": 7,
"selected": true,
"text": "Select Id,\n Case When Col1 < Col2 And Col1 < Col3 Then Col1\n When Col2 < Col1 And Col2 < Col3... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21379/"
] |
368,359 | <p>I have a long running function in MATLAB that I tried to speed up by adding caching and wound up slowing down my performance significantly. My code is basically searching for continuous "horizontal" lines in an edge detected image and the original code looks something like this:</p>
<pre><code>function lineLength = getLineLength(img, startRow, startCol)
[nRows, nCols] = size(img);
lineLength = 0;
if startRow < 1 || startRow > nRows
return;
end
for curCol = startCol:nCols
if img(curCol)
lineLength = lineLength + 1;
continue;
elseif lineLength > 0
lengths = zeros(2,1);
lengths(1) = getLineLength(img, startRow - 1, curCol);
lengths(2) = getLineLength(img, startRow + 1, curCol);
increment = max(lengths);
lineLength = lineLength + increment;
end
break; %// At this point the end of the current line has been reached
end
end function
</code></pre>
<p>Since performance in this function is not what I would like, I thought I would add caching of the length from any point something like the following:</p>
<pre><code>function lineLength = getLineLength(img, startRow, startCol)
persistent pointCache;
if startRow == 0 && startCol == 0
pointCache = zeros(size(img, 1), size(img, 2), 2);
end
[nRows, nCols] = size(img);
lineLength = 0;
if startRow < 1 || startRow > nRows
return;
end
for curCol = startCol:nCols
if pointCache(startRow, curCol, 2)
lineLength = lineLength + pointCache(startRow, curCol, 1);
break;
end
if img(curCol)
lineLength = lineLength + 1;
continue;
elseif lineLength > 0
lengths = zeros(2,1);
lengths(1) = getLineLength(img, startRow - 1, curCol);
lengths(2) = getLineLength(img, startRow + 1, curCol);
increment = max(lengths);
lineLength = lineLength + increment;
end
break; %// At this point the end of the current line has been reached
end
pointCache(startRow, startCol, 1) = lineLength;
pointCache(startRow, startCol, 2) = 1;
end function
</code></pre>
<p>What surprised me is that implementing this caching actually made my performance worse, rather than better. My best guesses are that either the <code>global</code> variable is getting me in trouble, or its the extra memory use, but I don't have enough MATLAB experience to know.</p>
<p><strong>Edited...</strong></p>
<p>As Gautam correctly pointed out that there was a bug in the original code that was ignoring the results of the recursion. This is what the actual code does. I'm sure it's obvious, but MATLAB is not my native language so if there's a more MATLABy way to do this, I'd love the suggestions.</p>
| [
{
"answer_id": 368391,
"author": "schnaader",
"author_id": 34065,
"author_profile": "https://Stackoverflow.com/users/34065",
"pm_score": 0,
"selected": false,
"text": "for every pixel p in img\n if (pixel p set)\n linelength = 1\n p2 = p\n while (pixel p2 set) and (p2 in same c... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4797/"
] |
368,362 | <p>Sample data:
!!Part|123456,ABCDEF,ABC132!!</p>
<p>The comma delimited list can be any number of any combination of alphas and numbers </p>
<p>I want a regex to match the entries in the comma separated list:</p>
<p>What I have is:
!!PART\|(\w+)(?:,{1}(\w+))*!!</p>
<p>Which seems to do the job, the thing is I want to retrieve them in order into an ArrayList or similar so in the sample data I would want:</p>
<ul>
<li>1 - 132456</li>
<li>2 - ABCDEF</li>
<li>3 - ABC123</li>
</ul>
<p>The code I have is:</p>
<pre><code>string partRegularExpression = @"!!PART\|(\w+)(?:,{1}(\w+))*!!"
Match match = Regex.Match(tag, partRegularExpression);
ArrayList results = new ArrayList();
foreach (Group group in match.Groups)
{
results.Add(group.Value);
}
</code></pre>
<p>But that's giving me unexpected results. What am I missing?</p>
<p>Thanks</p>
<p><strong>Edit:</strong>
A solution would be to use a regex like !!PART\|(\w+(?:,??\w+)*)!! to capture the comma separated list and then split that as suggested by Marc Gravell</p>
<p>I am still curious for a working regex for this however :o)</p>
| [
{
"answer_id": 368389,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 1,
"selected": false,
"text": " if (tag.StartsWith(\"!!Part|\") && tag.EndsWith(\"!!\"))\n {\n tag = tag.Substring(7, tag.L... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39643/"
] |
368,369 | <p>I'm working on a site similar to digg in the respect that users can submit "stories". </p>
<p>I keep track of how many "votes" and "similar adds" each item got. Similar adds are defined as two users adding the same "link". </p>
<p>Here is <em>part</em> of the algorithm (essentially the most important):</p>
<pre><code>y = day number
sy = number of adds on day y
∑ y[1:10] sy / y
</code></pre>
<p>So basically calculate the number of "similar adds" on a specified day and divide by the number of seconds since the content was posted. Do this for the past 10 days (as an example). </p>
<p>However, I'm not sure how to implement this so that it performs well. Every method I can think of will be really slow. </p>
<p>The only way I can think of implementing this is by calculating the number of adds for the past 10 days for each item submitted will take forever. (so a sql command with a group by date executed 10 times for the past 10 days - obviously this method sucks).</p>
<p>Even if I keep a table that I update once a day (and run the above sql in the background), that will still be ridiculously slow once the database gets large. Plus the rating will be "outdated" since it's not live (e.g. breaking news "items" will never reach the top). </p>
<p>Does anyone have any experience of how to go about doing this?</p>
| [
{
"answer_id": 368509,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 0,
"selected": false,
"text": "select sum(dayval)\nfrom\n( select count(*) / (current_date-day+1) dayval\n from votes\n where story_id = 123\n an... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23695/"
] |
368,384 | <p>After deploying our huge distributed system to one of our clients we experience an unexpected error. During the investigation we replace the assembly causing the error with one where we have added some diagnostic code. The dll we use is built in debug mode. And suddenly it all works!</p>
<p>Replacing the debug dll with the release version (with the diagnostic code) makes it crash again. </p>
<p>There are no precompiler directives, conditional debug attributes etc. in our code. The problem has been found in two different installation sites, while it works fine in several more.</p>
<p>(The project has a mix of C# and VB.NET, the troublesom assembly is VB.NET.., if that makes any difference)</p>
<p>So the question is: <strong><em>What do you do in situations like this? And what can be the cause - in general?</em></strong> Any advice on debugging this issue is welcome.</p>
| [
{
"answer_id": 368408,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": false,
"text": "Debug.WriteLine"
},
{
"answer_id": 368429,
"author": "Ed Guiness",
"author_id": 4200,
"author_pro... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22621/"
] |
368,385 | <p>Is it possible to implement <a href="http://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization" rel="noreferrer">RAII</a> in pure C? </p>
<p>I assume it isn't possible in any sane way, but perhaps is it possible using some kind of dirty trick. Overloading the standard <code>free</code> function comes to mind or perhaps overwriting the return address on the stack so that when the function returns, it calls some other function that somehow releases resources? Or maybe with some setjmp/longjmp trick?</p>
<p>This is of a purely academic interest and I have no intention of actually writing such unportable and crazy code but I'm wondering if that is at all possible.</p>
| [
{
"answer_id": 368444,
"author": "Roger Lipscombe",
"author_id": 8446,
"author_profile": "https://Stackoverflow.com/users/8446",
"pm_score": 1,
"selected": false,
"text": "free"
},
{
"answer_id": 368731,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15109/"
] |
368,414 | <p>I have a view which is selecting rows from a table in a different database. I'd like to grant select access to the view, but not direct access to the base table. The view has a where clause restricting the number of rows.</p>
<p>Can I grant select to the view and not the base table, or do I need to switch to a stored procedure? I would rather not do it the latter way.</p>
| [
{
"answer_id": 368428,
"author": "James Orr",
"author_id": 41457,
"author_profile": "https://Stackoverflow.com/users/41457",
"pm_score": 4,
"selected": false,
"text": "GRANT SELECT ON [viewname] TO [user]\n"
},
{
"answer_id": 6383578,
"author": "Kosmo",
"author_id": 80293... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37591/"
] |
368,430 | <p>I am working on creating a .asmx webservice to meet the specific needs of an integration environment and for the life of me I cannot figure out how to get one section of it to work. The key is that the request WSDL needs to be something like the following. (Note I removed the soap envelope and namespace information)</p>
<pre><code><methodOne>
<myValue>string</myValue>
<myDemoGroup>
<myDemoGroupItem>string</myDemoGroupItem>
<myDemoGroupItem2>string</myDemoGroupItem2>
</myDemoGroup>
<myComplexGroup>
<mySubStructure>
<subItem1>string</subItem1>
<subItem2>string</subItem2>
</mySubStructure>
</myComplexGroup
</methodOne>
</code></pre>
<p>Now, I know how to take care of most of this, the method one tag is handled by the name of my parameter, and then the items inside are simply elements in the class. SO something like this gets everything except for "MyComplexGroup"</p>
<pre><code>[Web Method]
public void MyWebMethod(MyWebMethodRequest methodOne)
{
//Do my stuff
}
public class MyWebMethodRequest
{
public string myValue {get; set;}
public MyDemoGroupInfo myDemoGroup {get; set;}
}
public class MyDemoGroupInfo
{
public string myDemoGroupItem {get; set;}
public string myDemoGroupItem2 {get; set;}
}
</code></pre>
<p>The question is how to I define the "myComplexGroup" to allow the creation of multiple mySubStructure elements, while still outputting all items to the WSDL.</p>
<p>If I continue on and do something like this</p>
<pre><code>public class MyComplexGroupInfo
{
public List<MySubStructureInfo> mySubStructure {get; set;}
}
public class MySubStructureInfo
{
public string subItem1 {get; set;}
public string subItem2 {get; set;}
}
</code></pre>
<p>I can then add <code>public MyComplexGroupInfo myComplexGroup {get; set;}</code> to the object and I will get part of it, but instead of listing subItem1 and subItem2 it simply says MySubStructureInfo with nil set to one.</p>
<p>How can I get around this?</p>
| [
{
"answer_id": 368479,
"author": "Ihar Voitka",
"author_id": 46313,
"author_profile": "https://Stackoverflow.com/users/46313",
"pm_score": 3,
"selected": true,
"text": "wsdl.exe /serverInterface"
}
] | 2008/12/15 | [
"https://Stackoverflow.com/questions/368430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13279/"
] |
368,432 | <p>Is there any way to set the style for the lineends for the TCanvas.LineTo method? It seems to default to rounded ends, which looks very bad for several lines in a row of different colours when Pen.Width is set to a large value (e.g. 9).</p>
<p>It looks like this (rounded ends):</p>
<pre><code> ********........******
**********........******
**********........******
********........******
</code></pre>
<p>(where * is e.g. blue and . is yellow)</p>
<p>It is even worse if the two outer lines are drawn after the middle line:</p>
<pre><code> ********........******
**********......********
**********......********
********........******
</code></pre>
<p>I'd like it to look like this (streight ends):</p>
<pre><code> ********........******
********........******
********........******
********........******
</code></pre>
<p>Pen does not seem to offer any setting for this and neither does the LineTo method. Is there maybe a windows API function I could call?</p>
| [
{
"answer_id": 368606,
"author": "Uli Gerhardt",
"author_id": 1431618,
"author_profile": "https://Stackoverflow.com/users/1431618",
"pm_score": 3,
"selected": true,
"text": "PS_ENDCAP_*"
},
{
"answer_id": 59089189,
"author": "NineBerry",
"author_id": 101087,
"author_p... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21506/"
] |
368,438 | <p>I have to work on some code that's using generic lists to store a collection of custom objects.</p>
<p>Then it does something like the following to check if a given object's in the collection and do something if so:</p>
<pre><code>List<CustomObject> customObjects;
//fill up the list
List<CustomObject> anotherListofCustomObjects;
//fill it up
//...
foreach (CustomObject myCustomObject in customObjects)
{
if (anotherListofCustomObjects.Contains(myCustomObject))
{
//do stuff
}
}
</code></pre>
<p>Problem is is taking forever to process 7000 objects like that.</p>
<p>This is not my code - I am just trying to come up options to improve it - Looks to me it would be much faster to use a dictionary to get the stuff by key instead of looping through the whole collection like the above.</p>
<p>Suggestions?</p>
| [
{
"answer_id": 368457,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": true,
"text": "Dictionary<CustomObject,CustomObject> ...\n"
},
{
"answer_id": 368465,
"author": "Frans Bouma",
"autho... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311500/"
] |
368,450 | <p>Is there a tool that will show me what applications are writing to the hard drive in real time? I'm thinking something like Task Manager but for I/O. I've got a number of background processes running, and can never tell when Visual Studio is holding everything up, or some other process is hogging the disk (especially when the processor is running at less than 20%).</p>
| [
{
"answer_id": 30905723,
"author": "duhaime",
"author_id": 1727392,
"author_profile": "https://Stackoverflow.com/users/1727392",
"pm_score": 2,
"selected": false,
"text": "Task Manager"
}
] | 2008/12/15 | [
"https://Stackoverflow.com/questions/368450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23935/"
] |
368,459 | <p>For example I have two tables. The first table is student while the second table are the courses that the a student is taking. How can I use a select statement so that I can see two columns student and courses so that the courses are separated by commas.</p>
<p>Thanks.</p>
| [
{
"answer_id": 368489,
"author": "Ian Varley",
"author_id": 37539,
"author_profile": "https://Stackoverflow.com/users/37539",
"pm_score": 0,
"selected": false,
"text": "SELECT \n S.*,\n SC.*\n FROM\n Students S\n INNER JOIN Student_Courses SC\n ON S.student_id = SC.stud... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
368,463 | <p>We are in the process of designing a simple service-oriented architecture using WCF as the implementation framework. There are a handful of services that a few applications use. These services are mostly used internally, so a basic authentication and authorization scheme (such as Windows-based) is enough.</p>
<p>We want, however, expose some of the services to some business partners. The set of services they have access to depend on the contract. Kind of a standard architecture.</p>
<p>I think we can implement a <em>service gateway</em> which authenticates the requests and relays them to the correct internal service endpoint (this resembles simple ESB), so we can centralize the authentication/authorization code and expose one single endpoint to the world. I looked at some available ESB toolkits, but they seem way too complex for this purpose. We do not need to integrate a lot of different services, but just to expose some of them to the Internet.</p>
<p>How can I design and implement such a relay/router in WCF, keeping it very simple? I have read <a href="http://www.microsoft.com/mspress/books/9610.aspx" rel="nofollow noreferrer">Inside Windows Communication Foundation</a>, which is a good book, but I'm still not confident enough on how to begin.</p>
| [
{
"answer_id": 368536,
"author": "Joseph DeCarlo",
"author_id": 46362,
"author_profile": "https://Stackoverflow.com/users/46362",
"pm_score": 3,
"selected": true,
"text": "[OperationContract(Namespace=\"www.fu.com\", Action=\"*\")]\nvoid CallThis(Message msg);\n"
},
{
"answer_id"... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16026/"
] |
368,468 | <p>i wonder if there is a simple way to remove already registered types from a unity container or at least replace existing Interface/Type mappings with another one.
is it enough to just map another class type to an interface and the old one is overwritten?</p>
<hr>
<p>this should not happen very often. actually hardly any time, but there are situations were i want to replace a service implemeting some interface with another without having the other parts disturbed.</p>
| [
{
"answer_id": 5437437,
"author": "Eric Bock",
"author_id": 70863,
"author_profile": "https://Stackoverflow.com/users/70863",
"pm_score": 4,
"selected": false,
"text": "\npublic interface IService\n{\n void DoSomething();\n}\n\npublic class SomeService : IService\n{\n public void D... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20227/"
] |
368,480 | <p>I am trying to display an HTML page inside another SharePoint webpart page.</p>
<p>I used the Out-of-the-box page viewer webpart, but the page viewer webpart displays a disabled scrollbar inside it.</p>
<p>I also tried using a content editor webpart with an IFRAME tag in it, but still it didnt't work.</p>
<p>This is the code i used in the content editor webpart. </p>
<pre><code><iframe name="Iframe" src="URL1" scrolling="no"
FRAMEBORDER="0" style="width:100%; border:0; height:100%; overflow:hidden;">
</iframe>
</code></pre>
| [
{
"answer_id": 9439688,
"author": "Karlo",
"author_id": 1231877,
"author_profile": "https://Stackoverflow.com/users/1231877",
"pm_score": 2,
"selected": false,
"text": "#s4-workspace {\n\n overflow-y: hidden !important;\n\n overflow-x: hidden !important;\n\n}\n"
}
] | 2008/12/15 | [
"https://Stackoverflow.com/questions/368480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1909/"
] |
368,490 | <p>I am looking to determine from a large code base, what files are actually being used over a period of time. I need to know about CFM pages and CFCs as well as any included CFM files etc. </p>
<p>I know I can get <em>some</em> of this info using logging in application.cfm, or by using IIS, but I will still be missing any include files and any CFCs used. </p>
<p>Is there any way to get CF to log every file it executes? Ideally I would like to keep any new coding to a minimum or just in one place. </p>
<p>Thanks,
Ciarán </p>
| [
{
"answer_id": 371405,
"author": "Peter Boughton",
"author_id": 9360,
"author_profile": "https://Stackoverflow.com/users/9360",
"pm_score": 3,
"selected": true,
"text": "classic.cfm"
},
{
"answer_id": 383266,
"author": "Stewart Robinson",
"author_id": 47424,
"author_p... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446733/"
] |
368,494 | <p>I have a WCF service that has been hosted on a Windows Service and uses the BasicHttp endpoint to serve Windows Mobile devices that has been connected to it.</p>
<p>The problem is that with the Device Emulator. I can connect to the service and using it without any problems, but with an actual device. I receive the error:</p>
<blockquote>
<p>WCF The request failed with HTTP status 405: Method Not Allowed.</p>
</blockquote>
<p>I have used following code to implement the service.</p>
<pre><code>BasicHttpBinding basicHttpBinding = new BasicHttpBinding();
basicHttpBinding.UseDefaultWebProxy = false;
m_ServiceHost.AddServiceEndpoint(typeof(IKooft), basicHttpBinding, "KooftService");
m_ServiceHost.Open();
</code></pre>
<p>How can I solve this problem?</p>
| [
{
"answer_id": 29384299,
"author": "Oğuzhan Soykan",
"author_id": 3514288,
"author_profile": "https://Stackoverflow.com/users/3514288",
"pm_score": 1,
"selected": false,
"text": "[OperationContract]\n[WebInvoke(Method = \"POST\", ResponseFormat = WebMessageFormat.Json)]\nstring CheckServ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34623/"
] |
368,505 | <p>Is it possible to select column data using the ordinal_position for a table column? I know using ordinal positions is a bad practice but for a one-off data import process I need to be able to use the ordinal position to get the column data.</p>
<p>So for example </p>
<pre><code>create table Test(
Col1 int,
Col2 nvarchar(10)
)
</code></pre>
<p>instead of using</p>
<pre><code>select Col2 from Test
</code></pre>
<p>can I write</p>
<pre><code>select "2" from Test -- for illustration purposes only
</code></pre>
| [
{
"answer_id": 368525,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 2,
"selected": false,
"text": "select table_name, column_name, ordinal_position, data_type\nfrom information_schema.columns\norder by 1,3\n"
},
{
... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3635/"
] |
368,542 | <p>I was thinking of implementing shortcut keys in a pet web application, I am developing for me. I am using c# and asp.net. </p>
<p>I have seen very few web-sites( frankly I remember only g-mail), which have shortcut keys. </p>
<p>Has anyone ever implemented shortcut keys for a web application, if yes how to go about it?</p>
<p>Thanks. </p>
| [
{
"answer_id": 20795304,
"author": "pratik patel",
"author_id": 3106345,
"author_profile": "https://Stackoverflow.com/users/3106345",
"pm_score": -1,
"selected": false,
"text": "use this javascript on your master page this work using keycode.........\n\n\n--------------------------------... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41968/"
] |
368,545 | <p>I wrote a <code>while loop</code> in a function, but don't know how to stop it. When it doesn't meet its final condition, the loop just go for ever. How can I stop it?</p>
<pre><code>def determine_period(universe_array):
period=0
tmp=universe_array
while True:
tmp=apply_rules(tmp)#aplly_rules is a another function
period+=1
if numpy.array_equal(tmp,universe_array) is True:
break #i want the loop to stop and return 0 if the
#period is bigger than 12
if period>12: #i wrote this line to stop it..but seems it
#doesnt work....help..
return 0
else:
return period
</code></pre>
| [
{
"answer_id": 368550,
"author": "Mapad",
"author_id": 28165,
"author_profile": "https://Stackoverflow.com/users/28165",
"pm_score": 6,
"selected": true,
"text": "def determine_period(universe_array):\n period=0\n tmp=universe_array\n while True:\n tmp=apply_rules(tmp)#ap... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44354/"
] |
368,551 | <p>Given a list of strings, what is the best method for concatenating these strings into a comma separated list with no comma at the end. (VB.NET or C#) (Using either StringBuilder or String Concat.)</p>
<pre><code>Dim strResult As String = ""
Dim lstItems As New List(Of String)
lstItems.Add("Hello")
lstItems.Add("World")
For Each strItem As String In lstItems
If strResult.Length > 0 Then
strResult = strResult & ", "
End If
strResult = strResult & strItem
Next
MessageBox.Show(strResult)
</code></pre>
| [
{
"answer_id": 368564,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 5,
"selected": false,
"text": "Dim Result As String\nDim Items As New List(Of String)\nItems.Add(\"Hello\")\nItems.Add(\"World\")\n\nResult = String.... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21826/"
] |
368,557 | <p>I have a small program to order and sort email messages, outputting to a textfile using <code>$msg->decoded->string</code>. The perl program outputs to <code>stdout</code>, and I redirect it to a txt file. However, gedit is unable to open this text file because of a character set problem, and I would like to know how to restore or set a character set with perl.</p>
<p>The program is now thus:</p>
<pre><code>#!/usr/bin/perl
use warnings;
use strict;
use Mail::Box::Manager;
open (MYFILE, '>>data.txt');
my $file = shift || $ENV{MAIL};
my $mgr = Mail::Box::Manager->new(
access => 'r',
);
my $folder = $mgr->open( folder => $file )
or die "$file: Unable to open: $!\n";
for my $msg ( sort { $a->timestamp <=> $b->timestamp } $folder->messages)
{
my $to = join( ', ', map { $_->format } $msg->to );
my $from = join( ', ', map { $_->format } $msg->from );
my $date = localtime( $msg->timestamp );
my $subject = $msg->subject;
my $body = $msg->decoded->string;
# Strip all quoted text
$body =~ s/^>.*$//msg;
print MYFILE <<"";
From: $from
To: $to
Date: $date
$body
}
</code></pre>
<p>However I get the same problem that I am unable to open the file with gedit, even though it works with vi or such. If there are non unicode characters in the file, would this break it?</p>
| [
{
"answer_id": 368696,
"author": "Dave Vogt",
"author_id": 35189,
"author_profile": "https://Stackoverflow.com/users/35189",
"pm_score": 1,
"selected": false,
"text": "open my $fh, '>:encoding(UTF-8)', $file;\n"
},
{
"answer_id": 368748,
"author": "Leon Timmermans",
"auth... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368557",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] |
368,603 | <p>I need to write a 'simple' util to convert from ASCII to EBCDIC? </p>
<p>The Ascii is coming from Java, Web and going to an AS400. I've had a google around, can't seem to find a easy solution (maybe coz there isn't one :( ). I was hoping for an opensource util or paid for util that has already been written. </p>
<p>Like this maybe? </p>
<pre><code>Converter.convertToAscii(String textFromAS400)
Converter.convertToEBCDIC(String textFromJava)
</code></pre>
<p>Thanks, </p>
<p>Scott</p>
| [
{
"answer_id": 368632,
"author": "JeeBee",
"author_id": 17832,
"author_profile": "https://Stackoverflow.com/users/17832",
"pm_score": 2,
"selected": false,
"text": "String(byte[] bytes, [int offset, int length,] String enc)"
},
{
"answer_id": 27737881,
"author": "dmolony",
... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31751/"
] |
368,612 | <p>I have an .Net Froms application that displays web pages through a WebBrowser control.</p>
<p>Is there anyway that I can detect if the control shows a '<em>Page not found</em>' or '<em>Cannot display webpage</em>' error?
There doesn't seem to be any error event handlers.</p>
| [
{
"answer_id": 368734,
"author": "Darin Dimitrov",
"author_id": 29407,
"author_profile": "https://Stackoverflow.com/users/29407",
"pm_score": 5,
"selected": true,
"text": "private void button1_Click(object sender, EventArgs e)\n{\n SHDocVw.WebBrowser instance = (SHDocVw.WebBrowser)web... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18107/"
] |
368,613 | <p>I've got a collection of records to process, and the processing can be parallelized, so I've created an <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ExecutorService.html" rel="nofollow noreferrer">ExecutorService</a> (via <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Executors.html#newCachedThreadPool()" rel="nofollow noreferrer">Executors#newCachedThreadPool()</a>). The processing of an individual record is, itself, composed of parallelizable steps, so I'd like to use another <code>ExecutorService</code>. Is there an easy way to make this new one use the same underlying thread pool? Is it even desirable? Thanks.</p>
| [
{
"answer_id": 368671,
"author": "Tim Frey",
"author_id": 1471,
"author_profile": "https://Stackoverflow.com/users/1471",
"pm_score": 2,
"selected": false,
"text": "public class Task implements Runnable {\n private final ExecutorService threadPool;\n private final SubTask[] subtask... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4203/"
] |
368,636 | <p>I've seen a good bit of setuptools bashing on the internets lately. Most recently, I read James Bennett's <a href="http://www.b-list.org/weblog/2008/dec/14/packaging/" rel="noreferrer">On packaging</a> post on why no one should be using setuptools. From my time in #python on Freenode, I know that there are a few souls there who absolutely detest it. I would count myself among them, but I do actually use it.</p>
<p>I've used setuptools for enough projects to be aware of its deficiencies, and I would prefer something better. I don't particularly like the egg format and how it's deployed. With all of setuptools' problems, I haven't found a better alternative.</p>
<p>My understanding of tools like <a href="http://pip.openplans.org/" rel="noreferrer">pip</a> is that it's meant to be an easy_install replacement (not setuptools). In fact, pip uses some setuptools components, right?</p>
<p>Most of my packages make use of a setuptools-aware setup.py, which declares all of the dependencies. When they're ready, I'll build an sdist, bdist, and bdist_egg, and upload them to pypi.</p>
<p>If I wanted to switch to using pip, what kind of changes would I need to make to rid myself of easy_install dependencies? Where are the dependencies declared? I'm guessing that I would need to get away from using the egg format, and provide just source distributions. If so, how do i generate the egg-info directories? or do I even need to?</p>
<p>How would this change my usage of virtualenv? Doesn't virtualenv use easy_install to manage the environments?</p>
<p>How would this change my usage of the setuptools provided "develop" command? Should I not use that? What's the alternative?</p>
<p>I'm basically trying to get a picture of what my development workflow will look like.</p>
<p>Before anyone suggests it, I'm not looking for an OS-dependent solution. I'm mainly concerned with debian linux, but deb packages are not an option, for the reasons Ian Bicking outlines <a href="http://blog.ianbicking.org/2008/12/14/a-few-corrections-to-on-packaging/" rel="noreferrer">here</a>.</p>
| [
{
"answer_id": 370062,
"author": "ianb",
"author_id": 20218,
"author_profile": "https://Stackoverflow.com/users/20218",
"pm_score": 6,
"selected": true,
"text": "python -c 'import setuptools; __file__=\"setup.py\"; execfile(__file__)' \\\n install \\\n --single-version-externally-m... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18866/"
] |
368,642 | <p>I'm getting the error when accessing a Stored Procedure in SQL Server</p>
<pre><code>Server Error in '/' Application.
Procedure or function 'ColumnSeek' expects parameter '@template', which was not supplied.
</code></pre>
<p>This is happening when I call a Stored Procedure with a parameter through .net's data connection to sql <code>(System.data.SqlClient)</code>, even though I am supplying the parameter. Here is my code.</p>
<pre><code>SqlConnection sqlConn = new SqlConnection(connPath);
sqlConn.Open();
//METADATA RETRIEVAL
string sqlCommString = "QCApp.dbo.ColumnSeek";
SqlCommand metaDataComm = new SqlCommand(sqlCommString, sqlConn);
metaDataComm.CommandType = CommandType.StoredProcedure;
SqlParameter sp = metaDataComm.Parameters.Add("@template",SqlDbType.VarChar,50);
sp.Value = Template;
SqlDataReader metadr = metaDataComm.ExecuteReader();
</code></pre>
<p>And my Stored Procedure is:</p>
<pre><code> USE [QCApp]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[ColumnSeek]
@template varchar(50)
AS
EXEC('SELECT Column_Name, Data_Type
FROM [QCApp].[INFORMATION_SCHEMA].[COLUMNS]
WHERE TABLE_NAME = ' + @template);
</code></pre>
<p>I'm trying to figure out what I'm doing wrong here.</p>
<p><strong>Edit:</strong> As it turns out, Template was null because I was getting its value from a parameter passed through the URL and I screwed up the url param passing (I was using <code>@</code> for and instead of <code>&</code>)</p>
| [
{
"answer_id": 368659,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 0,
"selected": false,
"text": "AS\nSELECT Column_Name, ...\nFROM ...\nWHERE TABLE_NAME = @template\n"
},
{
"answer_id": 2766541,
"author... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26140/"
] |
368,651 | <p>Using the standard win32 api, what's the best way to detect more than one user is logged on? I have an upgrade to our software product that can't be run when more than one user is logged in. (I know this is something to be avoided because of its annoyance factor, but the product is very complicated. You'll have to trust me when I say there really is no other solution.) Thanks.</p>
| [
{
"answer_id": 368937,
"author": "Mick",
"author_id": 12458,
"author_profile": "https://Stackoverflow.com/users/12458",
"pm_score": 2,
"selected": false,
"text": "unit main;\n\ninterface\n\nuses\n Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,\n Dialogs, Std... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24898/"
] |
368,653 | <p>In a web-application implemented in java using JSP and Servlets; if I store information in the user session, this information is shared from all the tabs from the same browser. How to differ sessions in the browser-tabs?
In this example: </p>
<pre><code><%@page language="java"%>
<%
String user = request.getParameter("user");
user = (user == null ? (String)session.getAttribute("SESSIONS_USER") : user);
session.setAttribute("SESSIONS_USER",user);
%>
<html><head></head><body>
<%=user %>
<form method="post">
User:<input name="user" value="">
<input type="submit" value="send">
</form>
</body></html>
</code></pre>
<p>Copy this code in a jsp page (<code>testpage.jsp</code>), deploy this file in an existing context of a web application on the server (I use Apache Tomcat), then open a browser (FF, IE7 or Opera) using the correct URL (<code>localhost/context1/testpage.jsp</code>), type your name in the input and submit the form. Then open a new tab in the same browser, and then you can see your name (get from the session) on the new tab. Be careful with the browser-cache, sometimes seems that it doesn't happen, but it's in the cache, refresh the second tab.</p>
<p>Thanks.</p>
| [
{
"answer_id": 19384101,
"author": "Mike A.",
"author_id": 782695,
"author_profile": "https://Stackoverflow.com/users/782695",
"pm_score": 3,
"selected": false,
"text": "//Events \n$(window).ready(function() {generateWindowID()});\n$(window).focus(function() {setAppId()});\n$(window).mou... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46388/"
] |
368,668 | <p>I'm interested in assigning the tag name of the root element in an xml document to an xslt variable. For instance, if the document looked like (minus the DTD):</p>
<pre><code><foo xmlns="http://.....">
<bar>1</bar>
</foo>
</code></pre>
<p>and I wanted to assign the string 'foo' to an xslt variable. Is there a way to reference that?</p>
<p>Thanks, Matt</p>
| [
{
"answer_id": 368727,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 6,
"selected": true,
"text": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Tr... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26241/"
] |
368,669 | <p>We have many projects that use a common base of shared components (dlls).
Currently the development build for each project links against dlls built from the trunk of the components. (ie trunk builds use the dlls from other trunk builds)</p>
<p>When we do a release build, we have a script that goes through the project files and replaces the trunk references to specific numbered versions of the components (that are built from a tagged branch) </p>
<p>I think this weakens the testing that we do during development because the project that I am actually working on is using diferent dlls to what the release build will be using. I would like to always develop against the numbered versions of the components and only ever update them when there is a specific need.</p>
<p>However others in the team argue that unless we develop against trunk (and update to the newer versions of the components with each release) we will have the problem that (a) our products will hardly ever update to the newer version of the components then (b) when we do need to update it will be a huge task because the component source/interfaces will have changed so much.</p>
<p>What practices do you follow, and why?</p>
<p>Edit: Sorry all, I have just realised I have confused things by mentioning that there are several main products sharing components - although they share the components they don't run on the same PCs. My concern relates to the fact the because the components are likely to change with each release of a product (even though there was no specific requirement to update the component) that testing would miss some subtle change that was done in a component and not related to the specific work being done on the product. </p>
| [
{
"answer_id": 368753,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https://Stackoverflow.com/users/8709",
"pm_score": 4,
"selected": true,
"text": "trunk"
}
] | 2008/12/15 | [
"https://Stackoverflow.com/questions/368669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3590/"
] |
368,725 | <p>Given the schema</p>
<pre>
PERSON { name, spouse }
</pre>
<p>where PERSON.spouse is a foreign key to PERSON.name, NULLs will be necessary when a person is unmarried or we don't have any info.</p>
<p>Going with the argument against nulls, how do you avoid them in this case?</p>
<p>I have an alternate schema</p>
<pre>
PERSON { name }
SPOUSE { name1, name2 }
</pre>
<p>where SPOUSE.name* are FKs to PERSON. The problem I see here is that there is no way to ensure someone has only one spouse (even with all possible UNIQUE constraints, it would be possible to have two spouses).</p>
<p>What's the best way to factor out nulls in bill-of-materials style relations?</p>
| [
{
"answer_id": 368795,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 2,
"selected": false,
"text": "PERSON { A, B }\nPERSON { B, C }\nPERSON { C, NULL }\n"
},
{
"answer_id": 369057,
"author": "Tom H",
... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21294/"
] |
368,742 | <p>Suppose I have a method that takes an object of some kind as an argument. Now say that if this method is passed a null argument, it's a fatal error and an exception should be thrown. Is it worth it for me to code something like this (keeping in mind this is a trivial example):</p>
<pre><code>void someMethod(SomeClass x)
{
if (x == null){
throw new ArgumentNullException("someMethod received a null argument!");
}
x.doSomething();
}
</code></pre>
<p>Or is it safe for me to just rely on it throwing NullException when it calls x.doSomething()?</p>
<p>Secondly, suppose that someMethod is a constructor and x won't be used until another method is called. Should I throw the exception immediately or wait until x is needed and throw the exception then?</p>
| [
{
"answer_id": 368759,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 7,
"selected": true,
"text": "ArgumentNullException"
},
{
"answer_id": 368760,
"author": "Chris Marisic",
"author_id": 37055,
"aut... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] |
368,744 | <p>Suppose a shell script (/bin/sh or /bin/bash) contained several commands. How can I cleanly make the script terminate if any of the commands has a failing exit status? Obviously, one can use if blocks and/or callbacks, but is there a cleaner, more concise way? Using && is not really an option either, because the commands can be long, or the script could have non-trivial things like loops and conditionals.</p>
| [
{
"answer_id": 368754,
"author": "mat",
"author_id": 42083,
"author_profile": "https://Stackoverflow.com/users/42083",
"pm_score": 7,
"selected": true,
"text": "sh"
},
{
"answer_id": 1222559,
"author": "Barun",
"author_id": 147021,
"author_profile": "https://Stackover... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28558/"
] |
368,750 | <p>Finally, I have a question to ask on Stack Overflow! :-)</p>
<p>The main target is for Java but I believe it is mostly language agnostic: if you don't have native assert, you can always simulate it.</p>
<p>I work for a company selling a suite of softwares written in Java. The code is old, dating back to Java 1.3 at least, and at some places, it shows... That's a large code base, some 2 millions of lines, so we can't refactor it all at once.<br>
Recently, we switched the latest versions from Java 1.4 syntax and JVM to Java 1.6, making conservative use of some new features like <code>assert</code> (we used to use a DEBUG.ASSERT macro -- I know <code>assert</code> has been introduced in 1.4 but we didn't used it before), generics (only typed collections), foreach loop, enums, etc.</p>
<p>I am still a bit green about the use of assert, although I have read a couple of articles on the topic. Yet, some usages I see leave me perplex, hurting my common sense... ^_^ So I thought I should ask some questions, to see if I am right to want to correct stuff, or if it goes against common practices. I am wordy, so I <strong>bolded</strong> the questions, for those liking to skim stuff.</p>
<p>For reference, I have searched <em>assert java</em> in SO and found some interesting threads, but apparently no exact duplicate.</p>
<ul>
<li><a href="https://stackoverflow.com/questions/271526/how-to-avoid-null-statements-in-java" title=" How to avoid “!= null” statements in java? "> How to avoid “!= null” statements in java? </a> and <a href="https://stackoverflow.com/questions/302736/how-much-null-checking-is-enough" title="How much null checking is enough?">How much null checking is enough?</a> are quite relevant, because lot of asserts we have just check if variable is null. At some places in our code, there are usages of the null object (eg. returning <code>new String[0]</code>) but not always. We have to live with that, at least for maintenance of legacy code.</li>
<li>Some good answers also in <a href="https://stackoverflow.com/questions/298909/java-assertions-underused" title="Java assertions underused">Java assertions underused</a>.</li>
<li>Oh, and SO indicates with reason that <a href="https://stackoverflow.com/questions/129120/when-should-i-use-debugassert" title="When should I use Debug.Assert()?">When should I use Debug.Assert()?</a> question is related too (nice feature to reduce duplicates!).</li>
</ul>
<p>First, main issue, which triggered my question today:</p>
<pre><code>SubDocument aSubDoc = documents.GetAt( i );
assert( aSubDoc != null );
if ( aSubDoc.GetType() == GIS_DOC )
{
continue;
}
assert( aSubDoc.GetDoc() != null );
ContentsInfo ci = (ContentsInfo) aSubDoc.GetDoc();
</code></pre>
<p>(<em>Yes, we use MS' C/C++ style/code conventions. And I even like it (coming from same background)! So sue us.</em>)<br>
First, the <code>assert()</code> form comes from conversion of <code>DEBUG.ASSERT()</code> calls. I dislike the extra parentheses, since assert is a language construct, not (no longer, here) a function call. I dislike also <code>return (foo);</code> :-)<br>
Next, the asserts don't test here for invariants, they are rather used as guards against bad values. But as I understand it, they are useless here: the assert will throw an exception, not even documented with a companion string, and only if assertions are enabled. So if we have <code>-ea</code> option, we just have an assertion thrown instead of the regular NullPointerException one. That doesn't look like a paramount advantage, since we catch unchecked exceptions at highest level anyway.<br>
<strong>Am I right supposing we can get rid of them and live with that (ie. let Java raise such unckecked exception)?</strong> (or, of course, test against null value if likely, which is done in other places).</p>
<p>Side note: should I have to assert in the above snippet, I would do that against ci value, not against the getter: even if most getters are optimized/inlined, we cannot be sure, so we should avoid calling it twice.</p>
<p>Somebody told, in the last referenced thread, that public methods should use tests against values of parameters (usage of the public API) and private methods should rely on asserts instead. Good advice.<br>
Now, both kinds of methods must check another source of data: external input. Ie. data coming from user, from a database, from some file or from the network, for example.<br>
In our code, I see asserts against these values. I always change these to real test, so they act even with assertions disabled: these are not invariants and must be properly handled.<br>
I see only one possible exception, where input is supposed constant, for example a database table filled with constants used in relations: program would break if this table is changed but corresponding code wasn't updated.<br>
<strong>Do you see other exceptions?</strong></p>
<p>Another relatively frequent use I see, which seems OK: in the default of a switch, or at the end of a series of <code>else if</code> testing all possible values (these cases date back before our use of enums!), there is often an <code>assert false : "Unexpected value for stuff: " + stuff;</code><br>
<strong>Looks legitimate for me (these cases shouldn't happen in production), what do you think?</strong> (beyond the "no switch, use OO" advices which are irrelevant here).</p>
<p>And finally, <strong>are there any other useful use cases or annoying gotchas</strong> I missed here? (probably!)</p>
| [
{
"answer_id": 368811,
"author": "Stefan Teitge",
"author_id": 12463,
"author_profile": "https://Stackoverflow.com/users/12463",
"pm_score": 2,
"selected": false,
"text": "List returnListOfSize(int size) {\n // complex list creation\n assert list.size == size;\n}\n"
},
{
"a... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15459/"
] |
368,761 | <p>I need to start and stop SQL Server from the command line. I am willing to write a small C# program if necessary, but I suspect that there's something (PowerShell, maybe?) that currently exists that does this gracefully.</p>
<p>Thank you.</p>
| [
{
"answer_id": 368772,
"author": "P Daddy",
"author_id": 36388,
"author_profile": "https://Stackoverflow.com/users/36388",
"pm_score": 5,
"selected": true,
"text": "net {start|stop} mssqlserver"
},
{
"answer_id": 73737652,
"author": "Kai - Kazuya Ito",
"author_id": 817243... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2536/"
] |
368,762 | <p>So What I'm essentially trying to do is have something happen 70% of the time, another few things happen 10% of the time each if that makes sense but my app doesn't seem to do any of the actions I'm guessing I'm misunderstanding the loop syntax or something, anyway if anyone could take a look and maybe give me some advice</p>
<pre><code>per1 := 70;
per2 := 77;
per3 := 84;
per4 := 91;
per5 := 100;
per6 := Random(2) + 1;
randomize;
RandPer:= Random(100);
randomize;
RandPer2 := Random(100);
if RandPer2 <= 70 then begin
If RandPer <= per1 then begin
Functiontest(1);
end Else If RandPer <= per2 then begin
Functiontest(3);
end Else begin If RandPer <= per3 then begin
Functiontest(5);
end Else begin If RandPer <= per4 then begin
Functiontest(6);
end Else begin If RandPer <= per5 then begin
Functiontest(9);
end;
end;
end;
end;
</code></pre>
| [
{
"answer_id": 368772,
"author": "P Daddy",
"author_id": 36388,
"author_profile": "https://Stackoverflow.com/users/36388",
"pm_score": 5,
"selected": true,
"text": "net {start|stop} mssqlserver"
},
{
"answer_id": 73737652,
"author": "Kai - Kazuya Ito",
"author_id": 817243... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
368,766 | <p>I'm looking for a little help on programmatically passing parameters to a SSRS report via VB.NET and ASP.NET. This seems like it should be a relatively simple thing to do, but I haven't had much luck finding help on this.</p>
<p>Does anyone have any suggestions on where to go to get help with this, or perhaps even some sample code?</p>
<p>Thanks.</p>
| [
{
"answer_id": 368851,
"author": "Abram Simon",
"author_id": 46204,
"author_profile": "https://Stackoverflow.com/users/46204",
"pm_score": 5,
"selected": true,
"text": "LocalReport myReport = new LocalReport();\nmyReport.ReportPath = Server.MapPath(\"~/Path/To/Report.rdlc\");\n\nReportPa... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6602/"
] |
368,771 | <p>How do I post a form to an external site using an ASP.NET MVC controller?</p>
<p><strong>EDIT:</strong> Ok... I have a view with some data on it. After the user completes the form I need to do a postback with a specified form format to an external site (like for paypal). After I posted the constructed form I need to redirect the action to a new view</p>
| [
{
"answer_id": 368785,
"author": "Ian P",
"author_id": 10853,
"author_profile": "https://Stackoverflow.com/users/10853",
"pm_score": 0,
"selected": false,
"text": "<% using (Html.Form<Controller>(\"Action\", c => c.Method())) { %>\n"
},
{
"answer_id": 369050,
"author": "chakr... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
368,786 | <p>Here's an interesting question. I have a system that attempts to run some initialization code. If it fails, we call the deinitializer to clean everything up.</p>
<p>Because we call the deinitializer in exception handling, we run the risk that both initialize and deinitialize will fail, and hypothetically, it now seems that we have to throw <strong>two</strong> exceptions.</p>
<p>It seems pretty unlikely that we will, though. So what happens and what should the code do here?</p>
<pre><code> try { /* init code here */ }
catch (Exception ex)
{
try
{
_DeinitializeEngine();
}
catch (Exception ex2)
{
throw new OCRException("Engine failed to initialize; ALSO failed to deinitialize engine!", ex2);
}
finally
{
throw new OCRException("Engine failed to initialize; failed to initialize license!", ex);
}
}
</code></pre>
| [
{
"answer_id": 368796,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 3,
"selected": false,
"text": " static void Main(string[] args)\n {\n try\n {\n principalMethod();\n }\n... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40352/"
] |
368,802 | <p>I have a really simple Java class that effectively decorates a Map with input validation, with the obvious void set() and String get() methods.</p>
<p>I'd like to be able to effectively call those methods and handle return values and exceptions from outside the JVM, but still on the same machine <strong>Update: the caller I have in mind is not another JVM; thanks @Dave Ray</strong></p>
<p>My implementation considerations are typical </p>
<ul>
<li>performance</li>
<li>ease of implementation and maintenance (simplicity?)</li>
<li>reliability</li>
<li>flexibility (i.e. can I call from a remote machine, etc.)</li>
</ul>
<p>Is there a 'right way?' If not, what are my options, and what are the pro/cons for each?</p>
<p>(Stuff people have actually done and can provide real-life feedback on would be great!)</p>
| [
{
"answer_id": 1540974,
"author": "Travis Wilson",
"author_id": 8735,
"author_profile": "https://Stackoverflow.com/users/8735",
"pm_score": 1,
"selected": false,
"text": "i = new bsh.Interpreter();\ni.set( \"myapp\", this ); // Provide a reference to your app\ni.eval(\"server(7000)\");\... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2362/"
] |
368,805 | <p>Any thoughts on why this isn't working? I really thought 'ignore' would do the right thing.</p>
<pre><code>>>> 'add \x93Monitoring\x93 to list '.encode('latin-1','ignore')
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
UnicodeDecodeError: 'ascii' codec can't decode byte 0x93 in position 4: ordinal not in range(128)
</code></pre>
| [
{
"answer_id": 368828,
"author": "rob",
"author_id": 43927,
"author_profile": "https://Stackoverflow.com/users/43927",
"pm_score": 2,
"selected": false,
"text": ">>> u'add \\x93Monitoring\\x93 to list '.encode('latin-1','ignore')\n'add \\x93Monitoring\\x93 to list '\n"
},
{
"answ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13009/"
] |
368,807 | <p>The following html code works in Firefox, but for some reason fails in IE (Label2 is not shown). Is that a bug or I miss something?</p>
<p>Any help would be appreciated.</p>
<pre><code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js" type="text/javascript">
</script>
<script>
jQuery(document).ready(function(){
function setVis(){
var val = $("#check").is(":checked");
if (val)
$("#g_1").show();
else
$("#g_1").hide();
}
setVis();
$("#check").change(setVis);
});
</script>
</head>
<body>
<span>
<input type="checkbox" id="check" />
<label>Label1</label>
</span>
<span id="g_1">
<label>Label2</label>
</span>
</body>
</html>
</code></pre>
| [
{
"answer_id": 368857,
"author": "cLFlaVA",
"author_id": 45109,
"author_profile": "https://Stackoverflow.com/users/45109",
"pm_score": 3,
"selected": false,
"text": "<sidequestion>"
},
{
"answer_id": 368893,
"author": "Shog9",
"author_id": 811,
"author_profile": "http... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42512/"
] |
368,813 | <p>According to HTML specs, the <code>select</code> tag in HTML doesn't have a <code>readonly</code> attribute, only a <code>disabled</code> attribute. So if you want to keep the user from changing the dropdown, you have to use <code>disabled</code>.</p>
<p>The only problem is that disabled HTML form inputs don't get included in the POST / GET data.</p>
<p>What's the best way to emulate the <code>readonly</code> attribute for a <code>select</code> tag, and still get the POST data?</p>
| [
{
"answer_id": 368822,
"author": "kemiller2002",
"author_id": 1942,
"author_profile": "https://Stackoverflow.com/users/1942",
"pm_score": 7,
"selected": false,
"text": "$('#yourSelect').prop('disabled', true);\n"
},
{
"answer_id": 368834,
"author": "bezmax",
"author_id": ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6681/"
] |
368,830 | <p>I currently have some code that pulls down a list of users in a group and then iterates through that group to determine if a given account exists, but it seems like there ought to be a more concise (and perhaps faster) way to accomplish this.</p>
<p>This code (VB.NET) attempts to use the member property of the group object, but it is returning false even when the user is a member of that group. Can anyone see what I am doing wrong here?</p>
<pre><code>Dim group As DirectoryEntry = GetNetworkObject(GroupDomanName, NetworkObjectType.NetworkGroup, GroupName)
Dim user As DirectoryEntry =GetNetworkObject(UserDomainName, NetworkObjectType.NetworkUser, Login)
Return group.Properties("member").Contains(user.Path)
</code></pre>
<p>FYI: The GetNetworkObject calls just return a directoryEntry object, I have confirmed that the correct object is being returned for both the group and user object.</p>
| [
{
"answer_id": 368890,
"author": "huseyint",
"author_id": 39,
"author_profile": "https://Stackoverflow.com/users/39",
"pm_score": 5,
"selected": true,
"text": "static bool IsUserMemberOf(string userName, string groupName)\n{\n using (var ctx = new PrincipalContext(ContextType.Domain))... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30018/"
] |
368,831 | <p>i would to know how to write a profiler? What books and / or articles recommended? Can anyone help me please?</p>
<p>Someone has already done something like this?</p>
| [
{
"answer_id": 738647,
"author": "Mike Dunlavey",
"author_id": 23771,
"author_profile": "https://Stackoverflow.com/users/23771",
"pm_score": 3,
"selected": false,
"text": "I"
},
{
"answer_id": 874632,
"author": "Mike Dunlavey",
"author_id": 23771,
"author_profile": "h... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24639/"
] |
368,832 | <p>I have a PHP script (running on a Linux server) that ouputs the names of some files on the server. It outputs these file names in a simple text-only format.</p>
<p>This output is read from a VB.NET program by using HttpWebRequest, HttpWebResponse, and a StreamReader.</p>
<p>The problem is that some of the file names being output contain... unusual characters. Specifically, the "section" symbol (§). </p>
<p>If I view the output of the PHP script in a web browser, the symbol appears fine.</p>
<p>But when I read the output of the PHP script into my .NET program, the symbol doesn't appear correctly (it appears as a generic "block" symbol). </p>
<p>I've tried all the different character encoding options that you can use when reading the response stream (from the HttpWebResponse). I've tried outputting the stream directly to a text file (no good), displaying it in a TextBox (no good), and even when viewing the results directly in the Visual Studio debugger, the character appears as a block instead of as the "section" symbol. </p>
<p>I've examined the output in a hex editor (as suggested by a related question, "<a href="https://stackoverflow.com/questions/29499/how-do-you-troubleshoot-character-encoding-problems">how do you troubleshoot character encoding problems</a>." </p>
<p>When I write out the section symbol (§) from .NET itself, the hex bytes I see representing it are "c2 a7" (makes sense if it's unicode, right? requires two bytes?). When I write out the output from the PHP script directly to a file and examine that with a hex editor, the symbol shows up as "ef bf bd" - three bytes instead of two?</p>
<p>I'm at a loss as to what to do - if I need to specify some other character encoding, or if I'm missing something obvious about this. </p>
<p>Here's the code that's used to get the output of the PHP script (VB-style comments modified so they appear correctly on this site):</p>
<pre><code>
Dim myRequest As HttpWebRequest = WebRequest.Create("http://www.example.com/sample.php")
Dim myResponse As HttpWebResponse = myRequest.GetResponse()
// read the response stream
Dim myReader As New StreamReader(myResponse.GetResponseStream())
// read the entire output in one block (just as an example)
Dim theOutput as String = myReader.ReadToEnd()
</code></pre>
<p>Any ideas? </p>
<ul>
<li>Am I using the wrong kind of StreamReader? (I've tried passing the character encoding in the call to create the new StreamReader - I've tried all the ones that are in System.Text.Encoding - UTF-8, UTF-7, ASCII, UTF-32, Unicode, etc.)</li>
<li>Should I be using a different method for reading the output of the PHP script? </li>
<li>Is there something I should be doing different on the PHP-side when outputting the text?</li>
</ul>
<p><strong>UPDATED INFO:</strong></p>
<ul>
<li>The output from PHP is specifically encoded UTF-8 by calling: <code>utf8_encode($file);</code></li>
<li>When I wrote out the symbol from .NET, I copied and pasted the symbol from the Character Map app in Windows. I also copied & pasted it directly from the file's name (in Windows) and from this web page itself - all gave the same hex value when written out (c2 a7).</li>
<li>Yes, the "section symbol" I'm talking about is U+00A7 (ALT+0167 on Windows, according to Character Map).</li>
<li>The content-type is set explicitly via <code>header('Content-Type: text/html; charset=utf-8');</code> right at the beginning of the PHP script.</li>
</ul>
<p><strong>UPDATE:</strong></p>
<p>Figured it out myself, but I couldn't have done it without the help from the people who answered. Thank you!</p>
| [
{
"answer_id": 368848,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 1,
"selected": false,
"text": "utf8_encode($file)"
},
{
"answer_id": 368939,
"author": "Ates Goral",
"author_id": 23501,
"author_pr... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5956/"
] |
368,858 | <p>I've been working with <a href="http://www.microsoft.com/Sqlserver/" rel="nofollow noreferrer">Microsoft SQL Server</a> with many years now but have only just recently started to use <a href="http://www.mysql.com/" rel="nofollow noreferrer">MySQL</a> with my web applications, and I'm hungry for knowledge.</p>
<p>To continue with the long line of <a href="https://stackoverflow.com/questions/tagged/hidden-features">"hidden feature" questions</a>, I would like to know any hidden or handy features of MySQL which will hopefully improve my knowledge of this open source database.</p>
| [
{
"answer_id": 368894,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 4,
"selected": false,
"text": "mysql> show processlist;\nshow processlist;\n+----+-------------+-----------------+------+---------+------+----... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/383/"
] |
368,879 | <p>I have an application which tries to load some expected registry settings within its constructor.</p>
<p>What is the most appropriate .NET Exception from the BCL to throw if these (essential, non-defaultable) registry settings cannot be loaded?</p>
<p>For example:</p>
<pre><code> RegistryKey registryKey = Registry.LocalMachine.OpenSubkey("HKLM\Foo\Bar\Baz");
// registryKey might be null!
if (registryKey == null)
{
// What exception to throw?
throw new ???Exception("Could not load settings from HKLM\foo\bar\baz.");
}
</code></pre>
| [
{
"answer_id": 368891,
"author": "chakrit",
"author_id": 3055,
"author_profile": "https://Stackoverflow.com/users/3055",
"pm_score": 4,
"selected": true,
"text": "throw new ArgumentException(\"Could not find registry key: \" + theKey);\n"
},
{
"answer_id": 368898,
"author": "... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5975/"
] |
368,904 | <p>I have a classic 3-tier ASP.Net 3.5 web application with forms that display business objects and allow them to be edited. Controls on the form correspond to a property of the underlying business object. The user will have read/write, readonly, or no access to the various controls depending on his/her role. Very conventional stuff.</p>
<p>My question is: what is the object-oriented best practice for coding this? Is there anything more elegant than wrapping each control in a test for the user's role and setting its Visible and Enabled properties?</p>
<p>Thanks</p>
| [
{
"answer_id": 1743719,
"author": "Julian Bromwich",
"author_id": 212262,
"author_profile": "https://Stackoverflow.com/users/212262",
"pm_score": 3,
"selected": true,
"text": "/** NO permissions.\n * Presentation: \"hidden\"\n * Database: \"no access\"\n */\nNONE(0),\n\n/** VIEW ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44394/"
] |
368,913 | <p>What's a good way to serialize a Delphi object tree to XML--using RTTI and not custom code?</p>
<p>I would have loved to find that this feature is already built into Delphi, but it doesn't seem to be.</p>
<p>I've found a few components (posted, below) that seem like they might perform this function. Have you used any of them or some other offering? Have you built your own? Am I missing something obvious, in Delphi?</p>
| [
{
"answer_id": 368972,
"author": "Andreas Hausladen",
"author_id": 44005,
"author_profile": "https://Stackoverflow.com/users/44005",
"pm_score": 5,
"selected": true,
"text": "uses\n JvAppXMLStorage;\n\nvar\n Storage: TJvAppXMLFileStorage;\nbegin\n Storage := TJvAppXMLFileStorage.Creat... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32841/"
] |
368,924 | <p>Is there any simple way to access the <code>DataContext</code> in a linq2sql entity class.</p>
<p>I'm trying to create something like <code>EntitySet</code> but I cannot figure out how the <code>EntitySet</code> has access to the context that created the entity object in the first place.</p>
<p>I want to have a regular linq2sql entity class with a way for the class to access the <code>DataContext</code> that created it. I know it's possible because when you have an entity class with a primary key linq2sql gives you the option to load all children without creating a new <code>DataContext</code>.</p>
| [
{
"answer_id": 369618,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "EntitySet<T>"
},
{
"answer_id": 818987,
"author": "Monty",
"author_id": 83791,
"author_profile": ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35371/"
] |
368,926 | <p>What's the easiest way to figure out if a window is opened modally or not?</p>
<p><strong>CLARIFICATION:</strong></p>
<p>I open a window calling </p>
<pre><code>myWindow.ShowDialog();
</code></pre>
<p>I have a footer with an "OK" & "Cancel" button that I only want to show if the window is opened modally. Now I realize I can set a property by doing this:</p>
<pre><code>myWindow.IsModal = true;
myWindow.ShowDialog();
</code></pre>
<p>But I want the window itself to make that determination. I want to check in the <code>Loaded</code> event of the window whether or not it is modal.</p>
<p><strong>UPDATE</strong></p>
<p>The <code>IsModal</code> property doesn't <em>actually</em> exist in a WPF window. It's a property that I have created. <code>ShowDialog()</code> blocks the current thread. </p>
<p>I'm guessing I can determine if the Window is opened via <code>ShowDialog()</code> by checking if the current thread is blocked. How would I go about doing that?</p>
| [
{
"answer_id": 368969,
"author": "Stephen Wrighton",
"author_id": 7516,
"author_profile": "https://Stackoverflow.com/users/7516",
"pm_score": 0,
"selected": false,
"text": "dim f as myWindow\nf.show\nsomeOtherMethod()\n"
},
{
"answer_id": 369021,
"author": "BenAlabaster",
... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17744/"
] |
368,927 | <p>I am working in the Linux environment, and I have a C++ program, what I want is when I cancel the program with ctrl+c I would like that the program executes a function, to close some files and print some sutff, is there any way to do this?. Thank you. </p>
| [
{
"answer_id": 368949,
"author": "Colin Pickard",
"author_id": 12744,
"author_profile": "https://Stackoverflow.com/users/12744",
"pm_score": 2,
"selected": false,
"text": "void sigint_handler(int sig)\n{\n [do some cleanup]\n signal(SIGINT, SIG_DFL);\n kill(getpid(), SIGINT);\n}... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39160/"
] |
368,929 | <p>Say I want to design a database for a community site with blogs, photos, forums etc., one way to do this is to single out the concept of a "post", as a blog entry, a blog comment, a photo, a photo comment, a forum post all can be thought as a post. So, I could potentially have one table named Post [PostID, PostType, Title, Body .... ], the PostType will tell what type of post it is.</p>
<p>Or I could design this whole thing with more tables, BlogPost, PhotoPost, ForumPost, and I'll leave Comment just it's own table with a CommentType column.</p>
<p>Or have a Post table for all types of post, but have a separate Comment table.</p>
<p>To be complete I'm using ADO.NET Entity Framework to implement my DAL. </p>
<p>Now the question what are some of the implications if I go with any route described above that will influence on my DB performance and manageability, middle tier design and code cleaness, EF performance etc.?</p>
<p>Thank you very much!</p>
<p>Ray.</p>
| [
{
"answer_id": 369019,
"author": "Joachim Sauer",
"author_id": 40342,
"author_profile": "https://Stackoverflow.com/users/40342",
"pm_score": 2,
"selected": false,
"text": "Post"
},
{
"answer_id": 369223,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32240/"
] |
368,943 | <p>How do I get the div from within this (the last) list item?</p>
<p>Currently I have this, which is just plain ugly...any suggestions on a cleaner selector/ solution?</p>
<pre><code>var div = ul.append("<li><div></div></li>").contents("li:last-child")[0].children[0];
</code></pre>
<p>Thanks!</p>
| [
{
"answer_id": 368955,
"author": "doekman",
"author_id": 56,
"author_profile": "https://Stackoverflow.com/users/56",
"pm_score": 0,
"selected": false,
"text": "var div = ul.append(\"<li><div></div></li>\").contents(\"li:last-child > div\")[0];\n"
},
{
"answer_id": 368960,
"au... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5791/"
] |
368,954 | <p>Probably not much more to elaborate on here - I'm using a NumericStepper control and I want the user to use the buttons only to change the value in the NS, not by typing into the control - I couldn't find a property to disable the text - does it exist? </p>
<p>If it doesn't, how would I subclass this thing to disable the text?</p>
| [
{
"answer_id": 369039,
"author": "Paul Mignard",
"author_id": 3435,
"author_profile": "https://Stackoverflow.com/users/3435",
"pm_score": 1,
"selected": false,
"text": "mx_internal::inputField.enabled = false;\n"
}
] | 2008/12/15 | [
"https://Stackoverflow.com/questions/368954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3435/"
] |
368,956 | <p>I have forms in my page a get and a post and i want add pager on my get form .. so i cant page through the results.. </p>
<p>The problem that i am having is when i move to the second page it does not display anything..</p>
<p>I am using this library for paging ..
<a href="http://stephenwalther.com/Blog/archive/2008/09/18/asp-net-mvc-tip-44-create-a-pager-html-helper.aspx" rel="nofollow noreferrer">http://stephenwalther.com/Blog/archive/2008/09/18/asp-net-mvc-tip-44-create-a-pager-html-helper.aspx</a></p>
<p>this my actions code.</p>
<pre><code> [AcceptVerbs("GET")]
public ActionResult SearchByAttraction()
{
return View();
}
[AcceptVerbs("POST")]
public ActionResult SearchByAttraction(int? id, FormCollection form)
{....
}
</code></pre>
<p>and this is what i am using on my get form to page through</p>
<p><%= Html.Pager(ViewData.Model)%> //but when i do this it goes to
this method
[AcceptVerbs("GET")]
public ActionResult SearchByAttraction()</p>
<p>instead of going to this this</p>
<p>[AcceptVerbs("POST")] public ActionResult SearchByAttraction(int? id, FormCollection form)</p>
<p>which sort of makes sence .. but i cant really think of any other way of doing this</p>
<p>Any help would be very appreciated.. </p>
<p>Thanx</p>
| [
{
"answer_id": 369049,
"author": "maxnk",
"author_id": 45862,
"author_profile": "https://Stackoverflow.com/users/45862",
"pm_score": 1,
"selected": false,
"text": "1. make form on the page:\n <form id=\"myForm\" action=\"your/url\" method=\"post\">\n <input type=\"hidden\" name... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43838/"
] |
368,963 | <p>I wish to store a single variable in my application that will be saved between runs. This will be a version number that will be used to trigger an update option and so will change only rarely.</p>
<p>Does anyone have suggestions on the best way of implementing this? Considering it's such a simple requirement I am interested in the simplest solution.</p>
<p>Thanks!</p>
| [
{
"answer_id": 377065,
"author": "ayaz",
"author_id": 23191,
"author_profile": "https://Stackoverflow.com/users/23191",
"pm_score": 0,
"selected": false,
"text": "c:\\System\\Apps\\${AppName}\\${filename}"
}
] | 2008/12/15 | [
"https://Stackoverflow.com/questions/368963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33604/"
] |
368,966 | <p>I'm trying to do query result pagination with hibernate and displaytag, and Hibernate <code>DetachedCriteria</code> objects are doing their best to stand in the way. Let me explain...</p>
<p>The easiest way to do pagination with displaytag seems to be implementing the <code>PaginatedList</code> interface that has, among others, the following methods:</p>
<pre><code>/* Gets the total number of results. */
int getFullListSize();
/* Gets the current page of results. */
List getList();
/* Gets the page size. */
int getObjectsPerPage();
/* Gets the current page number. */
int getPageNumber();
/* Get the sorting column and direction */
String getSortCriterion();
SortOrderEnum getSortDirection();
</code></pre>
<p>I'm thinking of throwing my PaginatedList implementation a Criteria object and let it work along theese lines...</p>
<pre><code>getFullListSize() {
criteria.setProjection(Projections.rowCount());
return ((Long) criteria.uniqueResult()).intValue();
}
getList() {
if (getSortDirection() == SortOrderEnum.ASCENDING) {
criteria.addOrder(Order.asc(getSortCriterion());
} else if (getSortDirection() == SortOrderEnum.DECENDING) {
criteria.addOrder(Order.desc(getSortCriterion());
}
return criteria.list((getPageNumber() - 1) * getObjectsPerPage(),
getObjectsPerPage());
}
</code></pre>
<p>But this doesn't work, because the <code>addOrder()</code> or the <code>setProjection()</code> calls modify the criteria object rendering it in-usable for the successive calls. I'm not entirely sure of the order of the calls, but the db throws an error on <code>getFullListSize()</code> trying to do a "<code>select count(*) ... order by ...</code>" which is obviously wrong.</p>
<p>I think I could fix this by creating an object of my own to keep track of query conditions and rebuilding the Criteria object for each call, but that feels like reinventing yet another wheel. Is there a smarter way, possibly copying the Criteria initially passed in and working on that copy?</p>
<p><strong><em>Update</em></strong>:
It looks like <code>getList</code> is called first, and <code>getFullListSize</code> is called multiple times after, so, as soon as there's an ordering passed in, <code>getFullListSize</code> will fail. It would make sense to hit the db only once (in <code>getList</code> I'd say) and cache the results, with no need to copy/reset the <code>Criteria</code> object, but still...</p>
<p><strong><em>Update (again)</em></strong>:
Forget about that, once I've done the <code>count</code> I can't do the <code>select</code>, and vice versa. I really need two distinct <code>Criteria</code> objects.</p>
| [
{
"answer_id": 374333,
"author": "agnul",
"author_id": 6069,
"author_profile": "https://Stackoverflow.com/users/6069",
"pm_score": 1,
"selected": false,
"text": "DetachedCriteria"
},
{
"answer_id": 805842,
"author": "agnul",
"author_id": 6069,
"author_profile": "https... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6069/"
] |
368,967 | <p>There example on the net and code given in Learn OpenCv,Orielly.</p>
<p>After many attempts the out.avi file is written with 0 bytes.
I wonder where i went wrong.</p>
<p>The following are the code i used...</p>
<pre><code>int main(int argc, char* argv[]) {
CvCapture* input = cvCaptureFromFile(argv[1]);
IplImage* image = cvRetrieveFrame(input);
if (!image) {
printf("Unable to read input");
return 0;
}
CvSize imgSize;
imgSize.width = image->width;
imgSize.height = image->height;
double fps = cvGetCaptureProperty(
input,
CV_CAP_PROP_FPS
);
CvVideoWriter *writer = cvCreateVideoWriter(
"out.avi",
CV_FOURCC('M', 'J', 'P', 'G'),
fps,
imgSize
);
IplImage* colourImage;
//Keep processing frames...
for (;;) {
//Get a frame from the input video.
colourImage = cvQueryFrame(input);
cvWriteFrame(writer, colourImage);
}
cvReleaseVideoWriter(&writer);
cvReleaseCapture(&input);
}
</code></pre>
| [
{
"answer_id": 397703,
"author": "sgielen",
"author_id": 13104,
"author_profile": "https://Stackoverflow.com/users/13104",
"pm_score": 0,
"selected": false,
"text": "if(colourImage == NULL) {\n printf(\"Warning - got NULL colourImage\\n\");\n continue;\n}\ncvNamedWindow( \"test\", ... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43076/"
] |
368,976 | <p>I have an abstract class defining a pure virtual method in c++:</p>
<pre><code>class Base
{
Base();
~Base();
virtual bool Test() = 0;
};
</code></pre>
<p>I have subclassed this with a number of other classes (which provide an implementation for Test()), which I'll refer to as A, B, C, etc. I now want to create an array of any of these types using this base class:</p>
<pre><code>int main(int argc, char* argv[])
{
int size = 0;
Base* bases = new Base[10];
bases[size++] = new A();
bases[size++] = new B();
for (int i = 0; i < size; i++)
{
Base* base = bases[i];
base->Test();
}
}
</code></pre>
<p>(Excuse any errors I might have made, I'm writing this on the fly to provide a simple example).</p>
<p>The problem is I can't instantiate the array as it would require creating an instance of the Base class (which it can't do as it's abstract). However, without doing this, it hasn't allocated the memory needed to assign to the indices of the array, and thus provides a segmentation fault when trying to access that memory. I am under the impression that it's not good practice to mix new and delete with malloc and free.</p>
<p>It may be that I have confused the way this should be used and I should be attempting to use templates or some other mechanism to do this, but hopefully I've provided enough information to illustrate what I'm attempting to do.</p>
<p>So what is the best way of doing this and how would I get around this problem of allocating memory to an abstract class?</p>
<p>Thanks,
Dan</p>
| [
{
"answer_id": 368984,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 5,
"selected": true,
"text": "int main(int argc, char* argv[])\n{\n int size = 0;\n Base** bases = new Base*[10];\n\n bases[size+... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18909/"
] |
368,981 | <p>I have a full path which I would like to remove certain levels of it. So for instance,</p>
<pre><code>/home/john/smith/web/test/testing/nothing/
</code></pre>
<p>I would like to get rid of 4 levels, so I get</p>
<pre><code>/test/testing/nothing/
</code></pre>
<p>What would be a good of doing this?</p>
<p>Thanks</p>
| [
{
"answer_id": 368989,
"author": "troelskn",
"author_id": 18180,
"author_profile": "https://Stackoverflow.com/users/18180",
"pm_score": 4,
"selected": true,
"text": "join(\"/\", array_slice(explode(\"/\", $path), 5));\n"
},
{
"answer_id": 371208,
"author": "Jay",
"author_... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
368,997 | <p>I have a column that contains dates, when I click the column header the column is sorted numerically and not by date. How would I sort this by date? The date is in the format dd/mm/yy.</p>
<p>Example (sorted oldest first):</p>
<p>10/12/08 <--December
10/09/08 <--September
12/12/08 <--December</p>
<p>Many thanks</p>
| [
{
"answer_id": 369014,
"author": "Gunny",
"author_id": 12830,
"author_profile": "https://Stackoverflow.com/users/12830",
"pm_score": 3,
"selected": false,
"text": "myDataTable.Columns[\"ColumnName\"].DataType = System.Type.GetType(\"System.Date\");\n"
},
{
"answer_id": 3324967,
... | 2008/12/15 | [
"https://Stackoverflow.com/questions/368997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.