qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
206,805
<p>I'm trying to use <code>tasklist</code> to find out which process is consuming more than X percent of my CPU (to later kill it with <code>taskkill</code>.) </p> <p>How do I know what percent a time format represents?</p> <p>The documentations says:</p> <pre><code>TASKLIST options /FI filter </code></pre> <p>And one filter may be:</p> <pre><code>CPUTIME eq, ne, gt, lt, ge, le CPU time in the format: hh:mm:ss. hh - number of hours, mm - minutes, ss - seconds </code></pre> <p>If I try</p> <pre><code>tasklist /FI "CPUTIME gt 00:00:10" </code></pre> <p>it works.</p> <p>But if I </p> <pre><code>tasklist /FI "CPUTIME gt 90" </code></pre> <p>it doesn't.</p> <p>How can I know that time format represent 90%? Or 80%? What's the relationship between CPU usage time and the CPU usage percent?</p>
[ { "answer_id": 206893, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": -1, "selected": true, "text": " (TotalProcessRuntime / CpuTime) / 100\n" }, { "answer_id": 207439, "author": "Jay", "author_id": 20840, ...
2008/10/15
[ "https://Stackoverflow.com/questions/206805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
206,806
<p>In vi[m] there is the <a href="http://www.softpanorama.org/Editors/Vimorama/vim_piping.shtml" rel="noreferrer"><code>!</code> command which lets me pipe text</a> through a shell command -- like sort or indent -- and get the filtered text back into the buffer. Is there an equivalent in emacs?</p>
[ { "answer_id": 206809, "author": "dmckee --- ex-moderator kitten", "author_id": 2509, "author_profile": "https://Stackoverflow.com/users/2509", "pm_score": 3, "selected": false, "text": "M-x shell-command-on-region" }, { "answer_id": 207067, "author": "Greg Mattes", "auth...
2008/10/15
[ "https://Stackoverflow.com/questions/206806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27928/" ]
206,820
<p>I would like to either prevent or handle a <code>StackOverflowException</code> that I am getting from a call to the <code>XslCompiledTransform.Transform</code> method within an <code>Xsl Editor</code> I am writing. The problem seems to be that the user can write an <code>Xsl script</code> that is infinitely recursive, and it just blows up on the call to the <code>Transform</code> method. (That is, the problem is not just the typical programmatic error, which is usually the cause of such an exception.)</p> <p>Is there a way to detect and/or limit how many recursions are allowed? Or any other ideas to keep this code from just blowing up on me?</p>
[ { "answer_id": 206842, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": 7, "selected": true, "text": "// This is just an example, obviously you'll want to pass args to this.\nProcess p1 = new Process();\np1.StartInfo.FileName =...
2008/10/15
[ "https://Stackoverflow.com/questions/206820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27109/" ]
206,853
<p>I'm running a console app (myApp.exe) which outputs a pseudo localized (unicode) string to the standard output. If I run this in a regular command prompt(cmd.exe), the unicode data gets lost. If I run this in a unicode command prompt(cmd.exe /u) or set the properties of the console to "Lucida Console" then the unicode string is maintained.</p> <p>I'd like to run this app in C# and redirect the unicode string into a local variable. I'm using a Process object with RedirectStandardOutput = true, but the unicode string is always lost. </p> <p>How can I specify to persist this unicode info?</p> <pre><code> private static int RunDISM(string Args, out string ConsoleOutput) { Process process = new Process(); process.StartInfo.FileName = "myApp.exe"; process.StartInfo.Arguments = Args; try { process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.WorkingDirectory = Environment.CurrentDirectory; process.Start(); process.WaitForExit(Int32.MaxValue); } catch (Exception e) { WEX.Logging.Interop.Log.Assert("Failure while starting or running process.\nERROR: " + e.Message); ConsoleOutput = null; return EXITCODE_ERROR; } ConsoleOutput = process.StandardOutput.ReadToEnd(); return process.ExitCode; } </code></pre>
[ { "answer_id": 207129, "author": "Charlie", "author_id": 18529, "author_profile": "https://Stackoverflow.com/users/18529", "pm_score": 2, "selected": false, "text": "process.StartInfo.StandardOutputEncoding = Encoding.Unicode;\n" }, { "answer_id": 2067280, "author": "ziya", ...
2008/10/15
[ "https://Stackoverflow.com/questions/206853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/165305/" ]
206,857
<p>I would like to implement a producer/consumer scenario that obeys interfaces that are roughly:</p> <pre><code>class Consumer { private: vector&lt;char&gt; read(size_t n) { // If the internal buffer has `n` elements, then dequeue them // Otherwise wait for more data and try again } public: void run() { read(10); read(4839); // etc } void feed(const vector&lt;char&gt; &amp;more) { // Safely queue the data // Notify `read` that there is now more data } }; </code></pre> <p>In this case, <code>feed</code> and <code>run</code> will run on separate threads and <code>read</code> should be a blocking read (like <code>recv</code> and <code>fread</code>). Obviously, I will need some kind of mutual exclusion on my deque, and I will need some kind of notification system to inform <code>read</code> to try again.</p> <p>I hear <strong>condition variables</strong> are the way to go, but all my multithreading experience lies with Windows and am having a hard time wrapping my head around them. </p> <p>Thanks for any help!</p> <p>(Yes, I know it's inefficient to return vectors. Let's not get into that.)</p>
[ { "answer_id": 206868, "author": "Paul Nathan", "author_id": 26227, "author_profile": "https://Stackoverflow.com/users/26227", "pm_score": 1, "selected": false, "text": "class piper\n{\npthread_mutex queuemutex;\npthread_mutex readymutex;\nbool isReady; //init to false by constructor\n\n...
2008/10/15
[ "https://Stackoverflow.com/questions/206857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/338/" ]
206,867
<p>I've done some research and I can't really find a preferred way to do updating of form controls from a worker thread in C#. I know about the BackgroundWorker component, but what is the best way to do it without using the BackgroundWorker component?</p>
[ { "answer_id": 206884, "author": "AR.", "author_id": 1354, "author_profile": "https://Stackoverflow.com/users/1354", "pm_score": 4, "selected": true, "text": "// Updates the textbox text.\nprivate void UpdateText(string text)\n{\n // Set the textbox text.\n m_TextBox.Text = text;\n}\n\...
2008/10/15
[ "https://Stackoverflow.com/questions/206867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12172/" ]
206,885
<p>Let's say I've got some Perl code that increments a column in a specific row of a database each time it's hit, and I'm expecting it to be hit pretty frequently, so I'd like to optimize it with FCGI. Right now, I basically wrapped most of the code in something like this:</p> <pre><code>while (FCGI::accept() &gt;= 0) { [code which currently creates a db connection and makes calls through it] } </code></pre> <p>I'm wondering if it's better to put the database connection (my $dbh = DBI->connect(etc)) outside of the FCGI loop so that the script keeps the connection alive, or will I still gain the advantages of FCGI in speed &amp; resources by leaving it in the loop?</p>
[ { "answer_id": 207160, "author": "mpeters", "author_id": 12094, "author_profile": "https://Stackoverflow.com/users/12094", "pm_score": 2, "selected": false, "text": "ping()" }, { "answer_id": 214773, "author": "Schwern", "author_id": 14660, "author_profile": "https://...
2008/10/15
[ "https://Stackoverflow.com/questions/206885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
206,899
<p>What is the best way to truncate a URL when displaying it within a web page? I don't mean a link but literally displaying the URL as a value to the user, assuming that the text might be in a container of fixed width and you don't want to wrap or run outside of the container?</p> <p>Is it better to truncate from the end, favouring the early part of the url:</p> <p>eg. http/really.long/urlthaticantf...ere.html</p> <p>Or place the '...' in the middle to favour the start and end of the link as the most value in terms of giving context:</p> <p>eg. http/really.long/ur...aticantfithere.html</p> <p>Also, what is a good rule of thumb when choosing how long to make the truncated URL? Should you be pessimistic and pick a likely wide-character such as capital 'M' and see how many of these fit in the layout? This tends to give really short URLs in general as most characters are much narrower than 'M'.</p> <p>Or should you be optimistic and use a truncation that generally gives a good length but risk overrunning when the URL contains many large characters?</p>
[ { "answer_id": 207708, "author": "PHLAK", "author_id": 27025, "author_profile": "https://Stackoverflow.com/users/27025", "pm_score": 2, "selected": false, "text": "http://www.domainname.com/folder/.../file.php\n" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/206899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5303/" ]
206,916
<p>I'm writing some code in python and I'm having trouble when trying to retrieve content of an Entry widget. The thing is: I want to limit the characters that can be typed, so I'm trying to clear the Entry widget when I reach the specific number of characters (2 in this case), but it looks like I always miss the last typed character. I added the lost character in a print to show.</p> <p>Here's the sample code:</p> <pre><code>from Tkinter import * class sampleFrame: def __init__(self, master): self.__frame = Frame(master) self.__frame.pack() def get_frame(self): return self.__frame class sampleClass: def __init__(self, master): self.__aLabel = Label(master,text="aLabel", width=10) self.__aLabel.pack(side=LEFT) self.__aEntry = Entry (master, width=2) self.__aEntry.bind('&lt;Key&gt;', lambda event: self.callback(event, self.__aEntry)) self.__aEntry.pack(side=LEFT) def callback(self, event, widgetName): self.__value = widgetName.get()+event.char print self.__value if len(self.__value)&gt;2: widgetName.delete(2,4) root = Tk() aSampleFrame = sampleFrame(root) aSampleClass = sampleClass(aSampleFrame.get_frame()) root.mainloop() </code></pre> <p>Any help will be much appreciated!</p> <p>Thanks in advance</p>
[ { "answer_id": 207018, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 3, "selected": true, "text": "if len(self.__value) > 2:\n widgetName.delete(2,4)\n return \"break\" # add this line\n" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/206916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
206,924
<p>I would like to program Java servlets using Eclipse and I plan on deploying them using Tomcat. I think I can build the projects using Ant which is bundled with Eclipse. I have the standard Eclipse IDE. What options do I have for doing Servlet development in Eclipse? What changes do I need to make to Eclipse? Do I need to install a plug-in?</p>
[ { "answer_id": 206940, "author": "William", "author_id": 9193, "author_profile": "https://Stackoverflow.com/users/9193", "pm_score": 7, "selected": false, "text": "doGet()" } ]
2008/10/15
[ "https://Stackoverflow.com/questions/206924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
206,950
<p>I am having trouble in exporting to excel and it crashes out at the .set_Value function.</p> <p>It seems to work if I change object[,] to string[,] but by doing this I lose the formatting.</p> <p>Anyone Help?</p>
[ { "answer_id": 206960, "author": "Mitch Wheat", "author_id": 16076, "author_profile": "https://Stackoverflow.com/users/16076", "pm_score": 1, "selected": false, "text": "null" }, { "answer_id": 210351, "author": "Community", "author_id": -1, "author_profile": "https:/...
2008/10/15
[ "https://Stackoverflow.com/questions/206950", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
206,953
<p>I've got a collection (List&lt;Rectangle&gt;) which I need to sort left-right. That part's easy. Then I want to iterate through the Rectangles in their <em>original</em> order, but easily find their index in the sorted collection. indexOf() won't work, since I may have a number of equal objects. I can't help feeling there should be an easy way to do this.</p>
[ { "answer_id": 207015, "author": "Draemon", "author_id": 26334, "author_profile": "https://Stackoverflow.com/users/26334", "pm_score": 3, "selected": true, "text": "List<Rectangle> originalRects = ...;\n\n/* record index of each rectangle object.\n * Using a hash map makes lookups effici...
2008/10/16
[ "https://Stackoverflow.com/questions/206953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26334/" ]
206,968
<p>Scenario: I have a function that I need to tweak in some way (example; make it work slightly different in different places). For some reason I end up having to add something ugly to the code, either in the function or at existing call sites. Assume that the sum total "ugly" is the same in both cases.</p> <p>The question is which choice should I pick and why? </p> <p>Should I encapsulate it so I don't need to look at it or should I extract it so that it doesn't add semantic trash to the function?</p> <p>What would effect your choice? What about if:</p> <ul> <li>The function will "never" be called except from the current locations.</li> <li>New calls to the function won't need the "ugliness".</li> <li>The function is really clean and generic right now</li> <li>The function is already a hack job.</li> <li>you wrote the function</li> <li>you didn't wright the function</li> <li>etc.</li> </ul>
[ { "answer_id": 207231, "author": "Geoff", "author_id": 10427, "author_profile": "https://Stackoverflow.com/users/10427", "pm_score": 0, "selected": false, "text": "//old call\ncall_some_function_with_ugly(params, case)\n\n// new call\ncall_some_function(params)\n\nvoid call_some_function...
2008/10/16
[ "https://Stackoverflow.com/questions/206968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343/" ]
206,970
<p>I have a web-based application that notifies users of activity on the site via email. Users can choose which kinds of notifcations they want to receive. So far there are about 10 different options (each one is a true/false).</p> <p>I'm currently storing this in one varchar field as a 0 or 1 separated by commas. For example: 1,0,0,0,1,1,1,1,0,0</p> <p>This works but it's difficult to add new notification flags and keep track of which flag belongs to which notification. Is there an accepted standard for doing this? I was thinking of adding another table with a column for each notification type. Then I can add new columns if I need, but I'm not sure how efficient this is.</p> <p>Thanks in advance!</p>
[ { "answer_id": 206990, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 6, "selected": true, "text": "create table notifications (\n user_id int,\n notification_type int\n);\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/206970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18234/" ]
206,983
<p>How do I put a gridview row in edit mode programmatically?</p>
[ { "answer_id": 206999, "author": "azamsharp", "author_id": 3797, "author_profile": "https://Stackoverflow.com/users/3797", "pm_score": 2, "selected": false, "text": "protected void Row_Editing(object sender, GridViewEditArgs e) \n{\n myGridView.EditItemIndex = e.EditItemIndex; \n BindD...
2008/10/16
[ "https://Stackoverflow.com/questions/206983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5232/" ]
206,988
<p>How do I remove the key 'bar' from an array foo so that 'bar' won't show up in</p> <pre><code>for(key in foo){alert(key);} </code></pre>
[ { "answer_id": 206994, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 6, "selected": false, "text": "delete foo[key];\n" }, { "answer_id": 1345122, "author": "going", "author_id": 139196, "author_profile": "...
2008/10/16
[ "https://Stackoverflow.com/questions/206988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10393/" ]
206,997
<p>I have this bit of script to widen a text box on mouseover and shorten it on mouseoff.</p> <p>The problem I am having is that Internet Explorer doesn't seem to extend it's hover over the options of a select box.</p> <p>This means in IE I can click the select, have the options drop down, but if I try to select one, they vanish and the select box re-sizes as soon as I move off the select box itself.</p> <p>Example Code:</p> <pre><code>&lt;script type='text/javascript'&gt; $(function() { $('#TheSelect').hover( function(e){ $('#TheText').val('OVER'); $(this).width( 600 ); }, function(e){ $('#TheText').val('OUT'); $(this).width( 50 ); } ); }); &lt;/script&gt; </code></pre> <p>And:</p> <pre><code>&lt;input type='text' id='TheText' /&gt;&lt;br /&gt;&lt;br /&gt; &lt;select id='TheSelect' style='width:50px;'&gt; &lt;option value='1'&gt;One&lt;/option&gt; &lt;option value='2'&gt;Two&lt;/option&gt; &lt;option value='3'&gt;Three&lt;/option&gt; &lt;option value='42,693,748,756'&gt;Forty-two billion, six-hundred and ninety-three million, seven-hundred-forty-some-odd..... &lt;/option&gt; &lt;option value='5'&gt;Five&lt;/option&gt; &lt;option value='6'&gt;Six&lt;/option&gt; &lt;option value='7'&gt;Seven...&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Are there any workarounds for select boxes in IE? I would even consider a jquery replacement if anyone can recommend one that is really reliable.</p> <p>Thanks!</p>
[ { "answer_id": 207168, "author": "Dan", "author_id": 17121, "author_profile": "https://Stackoverflow.com/users/17121", "pm_score": 4, "selected": true, "text": "$(function() {\n var expand = function(){ $(this).width(600) }\n var contract = function(){ if (!this.noHide) $(this).w...
2008/10/16
[ "https://Stackoverflow.com/questions/206997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27580/" ]
206,998
<p>After some find and replace refactoring I ended up with this gem:</p> <pre><code>const class A { }; </code></pre> <p>What does "const class" mean? It seems to compile ok.</p>
[ { "answer_id": 207003, "author": "Evan Teran", "author_id": 13430, "author_profile": "https://Stackoverflow.com/users/13430", "pm_score": 5, "selected": false, "text": "const class A\n{\n} a;\n" }, { "answer_id": 207007, "author": "Adam Rosenfield", "author_id": 9530, ...
2008/10/16
[ "https://Stackoverflow.com/questions/206998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3146/" ]
207,000
<p>Is there any meaningful distinction between:</p> <pre><code>class A(object): foo = 5 # some default value </code></pre> <p>vs.</p> <pre><code>class B(object): def __init__(self, foo=5): self.foo = foo </code></pre> <p>If you're creating a lot of instances, is there any difference in performance or space requirements for the two styles? When you read the code, do you consider the meaning of the two styles to be significantly different?</p>
[ { "answer_id": 207128, "author": "Alex Coventry", "author_id": 1941213, "author_profile": "https://Stackoverflow.com/users/1941213", "pm_score": 8, "selected": true, "text": ">>> class A: foo = []\n>>> a, b = A(), A()\n>>> a.foo.append(5)\n>>> b.foo\n[5]\n>>> class A:\n... def __init__(...
2008/10/16
[ "https://Stackoverflow.com/questions/207000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22897/" ]
207,002
<p>Is there a way of using an 'OR' operator or equivalent in a PHP switch?</p> <p>For example, something like this:</p> <pre><code>switch ($value) { case 1 || 2: echo 'the value is either 1 or 2'; break; } </code></pre>
[ { "answer_id": 207006, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 9, "selected": false, "text": "switch ($value)\n{\n case 1:\n case 2:\n echo \"the value is either 1 or 2.\";\n break;\n}\n" }, { "an...
2008/10/16
[ "https://Stackoverflow.com/questions/207002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
207,022
<p>My problem is that I can't seem to get the image from my bundle to display properly. This method is in the view controller that controls the tableview. <em>headerView</em> is loaded with the tableview in the .nib file and contains a few UILabels (not shown) that load just fine. Any ideas?</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; [[self view] setTableHeaderView:headerView]; NSBundle *bundle = [NSBundle mainBundle]; NSString *imagePath = [bundle pathForResource:@"awesome_lolcat" ofType:@"jpeg"]; UIImage *image = [UIImage imageWithContentsOfFile:imagePath]; imageView = [[UIImageView alloc] initWithImage:image]; } </code></pre>
[ { "answer_id": 207227, "author": "Ben Gottlieb", "author_id": 6694, "author_profile": "https://Stackoverflow.com/users/6694", "pm_score": 2, "selected": false, "text": "\n //this assumes that headerView is an already created UIView, perhaps an IBOutlet\n\n UIImage *image = [UIIma...
2008/10/16
[ "https://Stackoverflow.com/questions/207022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28422/" ]
207,025
<p>I want to enforce CHECK constraint on a date range such that all dates in column BIRTH_DATE are less than tomorrow and greater than or equal to 100 years ago. I tried this expression in a CHECK constraint:</p> <pre><code>BIRTH_DATE &gt;= (sysdate - numtoyminterval(100, 'YEAR')) AND BIRTH_DATE &lt; sysdate + 1 </code></pre> <p>But I received the error "ORA-02436: date or system variable wrongly specified in CHECK constraint"</p> <p>Is there a way to accomplish this using a CHECK constraint instead of a trigger?</p>
[ { "answer_id": 207087, "author": "Justin Cave", "author_id": 10397, "author_profile": "https://Stackoverflow.com/users/10397", "pm_score": 3, "selected": true, "text": "* Subqueries and scalar subquery expressions\n* Calls to the functions that are not deterministic (CURRENT_DATE,\n" }...
2008/10/16
[ "https://Stackoverflow.com/questions/207025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3401/" ]
207,038
<p>What is the best way to approach removing items from a collection in C#, once the item is known, but not it's index. This is one way to do it, but it seems inelegant at best.</p> <pre><code>//Remove the existing role assignment for the user. int cnt = 0; int assToDelete = 0; foreach (SPRoleAssignment spAssignment in workspace.RoleAssignments) { if (spAssignment.Member.Name == shortName) { assToDelete = cnt; } cnt++; } workspace.RoleAssignments.Remove(assToDelete); </code></pre> <p>What I would really like to do is find the item to remove by property (in this case, name) without looping through the entire collection and using 2 additional variables.</p>
[ { "answer_id": 207048, "author": "Jon B", "author_id": 27414, "author_profile": "https://Stackoverflow.com/users/27414", "pm_score": 6, "selected": true, "text": "Dictionary<T>" }, { "answer_id": 207084, "author": "JaredPar", "author_id": 23283, "author_profile": "htt...
2008/10/16
[ "https://Stackoverflow.com/questions/207038", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18449/" ]
207,045
<p>Can an ArrayList of Node contain a non-Node type? </p> <p>Is there a very dirty method of doing this with type casting?</p>
[ { "answer_id": 207052, "author": "Draemon", "author_id": 26334, "author_profile": "https://Stackoverflow.com/users/26334", "pm_score": 4, "selected": true, "text": "import java.util.*;\nimport java.awt.Rectangle;\n\npublic class test {\n public static void main(String args[]) {\n ...
2008/10/16
[ "https://Stackoverflow.com/questions/207045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27570/" ]
207,069
<p>I have a shared library that I wish to link an executable against using GCC. The shared library has a nonstandard name not of the form libNAME.so, so I can not use the usual -l option. (It happens to also be a Python extension, and so has no 'lib' prefix.)</p> <p>I am able to pass the path to the library file directly to the link command line, but this causes the library path to be hardcoded into the executable.</p> <p>For example:</p> <pre><code>g++ -o build/bin/myapp build/bin/_mylib.so </code></pre> <p>Is there a way to link to this library without causing the path to be hardcoded into the executable?</p>
[ { "answer_id": 207149, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 2, "selected": false, "text": "g++ -o build/bin/myapp _mylib.so other_source_files\n" }, { "answer_id": 207152, "author": "Chris Roland...
2008/10/16
[ "https://Stackoverflow.com/questions/207069", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13402/" ]
207,150
<p>I have a view using a master page that contains some javascript that needs to be executed using the OnLoad of the Body. What is the best way to set the OnLoad on my MasterPage only for certain views?</p> <p>On idea I tried was to pass the name of the javascript function as ViewData. But I dont really want my Controllers to have to know about the javascript on the page. I really don't like this approach...</p> <pre><code>&lt;body onload="&lt;%=ViewData["Body_OnLoad"]%&gt;"&gt; &lt;asp:ContentPlaceHolder ID="MainContent" runat="server" /&gt; </code></pre> <p>Edit - I suppose one idea would be to use jQuery's document ready event instead...</p> <p>Any other ideas?</p>
[ { "answer_id": 238589, "author": "David P", "author_id": 13145, "author_profile": "https://Stackoverflow.com/users/13145", "pm_score": 3, "selected": false, "text": "<script language=\"javascript\" type=\"text/javascript\" src=\"../../Scripts/jquery-1.2.6-intellisense.js\"></script> \n" ...
2008/10/16
[ "https://Stackoverflow.com/questions/207150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10941/" ]
207,157
<p>I have this XML in a column in my table:</p> <pre><code>&lt;keywords&gt; &lt;keyword name="First Name" value="|FIRSTNAME|" display="Jack" /&gt; &lt;keyword name="Last Name" value="|LASTNAME|" display="Jones" /&gt; &lt;keyword name="City" value="|CITY|" display="Anytown" /&gt; &lt;keyword name="State" value="|STATE|" display="MD" /&gt; &lt;/keywords&gt; </code></pre> <p>I'm getting a record out of that table using LINQ to SQL via this:</p> <pre><code>GeneratedArticle ga = db.GeneratedArticles.Single(p =&gt; p.GeneratedArticleId == generatedArticleId); </code></pre> <p>That works, I get my GeneratedArticle object just fine.</p> <p>I'd like to walk through the data in the ArticleKeywords field, which is XML. I started doing this:</p> <pre><code>var keywords = from k in ga.ArticleKeywords.Elements("Keywords") select k; foreach (var keyword in keywords) { //what goes here? } </code></pre> <p>I'm not 100% sure that I'm getting that data correctly. I need help with the proper syntax to get the value and display out of my XML field.</p>
[ { "answer_id": 207196, "author": "ckramer", "author_id": 20504, "author_profile": "https://Stackoverflow.com/users/20504", "pm_score": 0, "selected": false, "text": "var keywordData = from k in ga.ArticleKeywords.Elements(\"Keywords\")\n select new { Value = k.Attributes...
2008/10/16
[ "https://Stackoverflow.com/questions/207157", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1989/" ]
207,190
<p>I want to convert a string like this:</p> <pre><code>'10/15/2008 10:06:32 PM' </code></pre> <p>into the equivalent DATETIME value in Sql Server.</p> <p>In Oracle, I would say this:</p> <pre><code>TO_DATE('10/15/2008 10:06:32 PM','MM/DD/YYYY HH:MI:SS AM') </code></pre> <p><a href="https://stackoverflow.com/questions/202243/custom-datetime-formatting-in-sql-server">This question</a> implies that I must parse the string into one of the <a href="http://www.sql-server-helper.com/tips/date-formats.aspx" rel="noreferrer">standard formats</a>, and then convert using one of those codes. That seems ludicrous for such a mundane operation. Is there an easier way?</p>
[ { "answer_id": 207232, "author": "Taptronic", "author_id": 14728, "author_profile": "https://Stackoverflow.com/users/14728", "pm_score": 6, "selected": false, "text": "Declare @d datetime\nselect @d = getdate()\n\nselect @d as OriginalDate,\nconvert(varchar,@d,100) as ConvertedDate,\n100...
2008/10/16
[ "https://Stackoverflow.com/questions/207190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/672/" ]
207,195
<p>Without using Javascript, is there a way to make a CSS property toggle on and off through nested elements.</p> <p>The problem I'm trying to solve is that I have a number of tags and classes which make some text italic (<code>&lt;em&gt;</code>, <code>&lt;blockquote&gt;</code>, <code>&lt;cite&gt;</code>, <code>&lt;q&gt;</code>, <code>&lt;dfn&gt;</code>, and some other classes), and when one of these is inside another one of these, the italicisation needs to toggle.</p> <pre> &lt;blockquote> And so the man said, &lt;q>That's not from &lt;cite>Catcher In The Rye&lt;/cite>, dear fellow!&lt;/q>, can you believe that?! &lt;/blockquote> </pre> <p>Should render as:</p> <blockquote> <p><em>And so the man said,</em> "That's not from <em>Catcher In The Rye</em>, dear fellow!"<em>, can you believe that?!</em></p> </blockquote> <p>The CSS I've got for this is getting a bit messy:</p> <pre><code>q, em, dfn, cite, blockquote { font-style: italic; } q q, q em, q dfn, q cite, em q, em em, em dfn, em cite, dfn q, dfn em, dfn dfn, dfn cite, cite q, cite em, cite dfn, cite cite, blockquote q, blockquote em, blockquote dfn, blockquote cite { font-style: normal; } </code></pre> <p>...and I'm pretty sure that won't even work past one level of nesting (as in my example).</p> <p>Is there a way I can do this without have to list every permutation of the tags?</p>
[ { "answer_id": 207447, "author": "Eric Wendelin", "author_id": 25066, "author_profile": "https://Stackoverflow.com/users/25066", "pm_score": 3, "selected": true, "text": ":not" }, { "answer_id": 20359229, "author": "Thorsten Kück", "author_id": 2284809, "author_profil...
2008/10/16
[ "https://Stackoverflow.com/questions/207195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
207,212
<p>I'm writing an application in Delphi which uses an SQLite3 database. I'd like to be able to start the application while holding some modifier keys, such as CTRL + SHIFT, to signal reinitialization of the database.</p> <p>How can I capture that the application was started while these keys were held?</p>
[ { "answer_id": 207369, "author": "Tim Knipe", "author_id": 10493, "author_profile": "https://Stackoverflow.com/users/10493", "pm_score": 3, "selected": false, "text": "if (GetKeyState(VK_SHIFT) < 0) and (GetKeyState(VK_CONTROL) < 0) then\n ReinitializeDatabase;\n" }, { "answer_i...
2008/10/16
[ "https://Stackoverflow.com/questions/207212", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10519/" ]
207,223
<p>I've got a script that dynamically calls and displays images from a directory, what would be the best way to paginate this? I'd like to be able to control the number of images that are displayed per page through a variable within the script. I'm thinking of using URL varriables (ie - <a href="http://domain.com/page.php?page=1" rel="noreferrer">http://domain.com/page.php?page=1</a>) but am unsure how to go about this.</p> <p>Thanks for the help.</p>
[ { "answer_id": 207287, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 4, "selected": true, "text": "$itemsPerPage = 5;\n\n$currentPage = isset($_GET['page']) ? $_GET['page'] : 1;\n$totalItems = getTotalItems();\n$totalPages = ce...
2008/10/16
[ "https://Stackoverflow.com/questions/207223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27025/" ]
207,234
<p>How can I get a list of the IP addresses or host names from a local network easily in Python?</p> <p>It would be best if it was multi-platform, but it needs to work on Mac OS X first, then others follow.</p> <p><strong>Edit:</strong> By local I mean all <strong>active</strong> addresses within a local network, such as <code>192.168.xxx.xxx</code>.</p> <p>So, if the IP address of my computer (within the local network) is <code>192.168.1.1</code>, and I have three other connected computers, I would want it to return the IP addresses <code>192.168.1.2</code>, <code>192.168.1.3</code>, <code>192.168.1.4</code>, and possibly their hostnames.</p>
[ { "answer_id": 207775, "author": "Mapad", "author_id": 28165, "author_profile": "https://Stackoverflow.com/users/28165", "pm_score": 4, "selected": false, "text": "import socket\nIP1 = socket.gethostbyname(socket.gethostname()) # local IP adress of your computer\nIP2 = socket.gethostbyna...
2008/10/16
[ "https://Stackoverflow.com/questions/207234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2592/" ]
207,237
<p>What is the best way to allow a team of programmers to use Netbeans, Eclipse and IntelliJ on the same project, thus eliminating the "which IDE is better" question.</p> <p>Which files should or should not be checked into source code control?</p>
[ { "answer_id": 207241, "author": "MetroidFan2002", "author_id": 8026, "author_profile": "https://Stackoverflow.com/users/8026", "pm_score": 3, "selected": false, "text": ".project" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
207,256
<p>I've created the following regex pattern in an attempt to match a string 6 characters in length ending in either "PRI" or "SEC", unless the string = "SIGSEC". For example, I want to match ABCPRI, XYZPRI, ABCSEC and XYZSEC, but not SIGSEC.</p> <pre><code>(\w{3}PRI$|[^SIG].*SEC$) </code></pre> <p>It is very close and sort of works (if I pass in "SINSEC", it returns a partial match on "NSEC"), but I don't have a good feeling about it in its current form. Also, I may have a need to add more exclusions besides "SIG" later and realize that this probably won't scale too well. Any ideas?</p> <p>BTW, I'm using System.Text.RegularExpressions.Regex.Match() in C#</p> <p>Thanks, Rich</p>
[ { "answer_id": 207262, "author": "Dan", "author_id": 17121, "author_profile": "https://Stackoverflow.com/users/17121", "pm_score": 4, "selected": true, "text": "((?!SIGSEC)\\w{3}(?:SEC|PRI))\n" }, { "answer_id": 207266, "author": "warren", "author_id": 4418, "author_p...
2008/10/16
[ "https://Stackoverflow.com/questions/207256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28442/" ]
207,260
<p>i noticed that paypal displays a very different favicon, one that's not just a simple 16x16 icon and is lengthy? anyone can teach me?</p>
[ { "answer_id": 58583952, "author": "Abhinav Pundi", "author_id": 12283143, "author_profile": "https://Stackoverflow.com/users/12283143", "pm_score": 0, "selected": false, "text": "<link rel=\"shortcut icon\" type=\"image/png\" href=\"images/favicon.png\">" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207260", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24744/" ]
207,267
<p>I have recently started working on a very large C++ project that, after completing 90% of the implementation, has determined that they need to demonstrate 100% branch coverage during testing. The project is hosted on an embedded platform (Green Hills Integrity). I'm looking for suggestions and experiences from others on StackOverflow that have used code coverage products in similar environments. I'm interested in both positive and negative comments regarding these types of tools.</p>
[ { "answer_id": 207672, "author": "SmacL", "author_id": 22564, "author_profile": "https://Stackoverflow.com/users/22564", "pm_score": 2, "selected": false, "text": "int div(int a, int b)\n{\nreturn (a/b);\n}\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19853/" ]
207,276
<p>I am just getting started with Silverlight and have recently added a Silverlight project to an established solution. In this particular scenario my solution included an existing ASP.NET web site (not application) which Visual Studio kindly offered to integrated my Silverlight application into, which I accepted.</p> <p>So everything is fine and all, and the Silverlight XAP is being copied to the web site's ClientBin directory. Now I have decided to start a new ASP.NET MVC web application that will eventually replace the older (non-MVC) web site. But I cannot for the life of me figure out what Visual Studio modified to get the XAP to automatically appear in the web site's ClientBin on build, so that I can reproduce that on my MVC site.</p> <p>So my question is essentially, what are the manually steps for getting Visual Studio to autocopy a Silverlight application's XAP to a newly added ASP.NET MVC web application?</p>
[ { "answer_id": 3218716, "author": "Amit", "author_id": 147613, "author_profile": "https://Stackoverflow.com/users/147613", "pm_score": 2, "selected": false, "text": "copy $(TargetDir)*.xap $(SolutionDir)<youar web solution folder name such as app.web>\\ClientBin\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27860/" ]
207,283
<p>OS: Vista enterprise</p> <p>When i switch between my home and office network, i always face issues with getting connected to the network. Almost always I have to use the diagnostic service in 'Network and sharing center' and the problem gets solved when i use the reset network adapter option.</p> <p>This takes a lot of time (3-4 min) and so i was trying to find either a command or a powershell script/cmdlet which i can use directly to reset the network adapter and save myself these 5 mins every time i have to switch between the networks. Any pointers?</p>
[ { "answer_id": 207402, "author": "Mike L", "author_id": 12085, "author_profile": "https://Stackoverflow.com/users/12085", "pm_score": 3, "selected": false, "text": "Restart-NetAdapter -Name \"Your Name Here\"\n" }, { "answer_id": 207418, "author": "JFV", "author_id": 13...
2008/10/16
[ "https://Stackoverflow.com/questions/207283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26090/" ]
207,290
<p>I've been wondering about how hard it would be to write some Python code to search a string for the index of a substring of the form <code>${</code><em>expr</em><code>}</code>, for example, where <em>expr</em> is meant to be a Python expression or something resembling one. Given such a thing, one could easily imagine going on to check the expression's syntax with <code>compile()</code>, evaluate it against a particular scope with <code>eval()</code>, and perhaps even substitute the result into the original string. People must do very similar things all the time.</p> <p>I could imagine solving such a problem using a third-party parser generator [oof], or by hand-coding some sort of state machine [eek], or perhaps by convincing Python's own parser to do the heavy lifting somehow [hmm]. Maybe there's a third-party templating library somewhere that can be made to do exactly this. Maybe restricting the syntax of <em>expr</em> is likely to be a worthwhile compromise in terms of simplicity or execution time or cutting down on external dependencies -- for example, maybe all I really need is something that matches any <em>expr</em> that has balanced curly braces.</p> <p>What's your sense?</p> <h2>Update:</h2> <p>Thanks very much for your responses so far! Looking back at what I wrote yesterday, I'm not sure I was sufficiently clear about what I'm asking. Template substitution is indeed an interesting problem, and probably much more useful to many more people than the expression extraction subproblem I'm wondering about, but I brought it up only as a simple example of how the answer to my question might be useful in real life. Some other potential applications might include passing the extracted expressions to a syntax highlighter; passing the result to a real Python parser and looking at or monkeying with the parse tree; or using the sequence of extracted expressions to build up a larger Python program, perhaps in conjunction with some information taken from the surrounding text.</p> <p>The <code>${</code><em>expr</em><code>}</code> syntax I mentioned is also intended as an example, and in fact I wonder if I shouldn't have used <code>$(</code><em>expr</em><code>)</code> as my example instead, because it makes the potential drawbacks of the obvious approach, along the lines of <code>re.finditer(r'$\{([^}]+)\}', s)</code>, a bit easier to see. Python expressions can (and often do) contain the <code>)</code> (or <code>}</code>) character. It seems possible that handling any of those cases might be much more trouble than it's worth, but I'm not convinced of that yet. Please feel free to try to make this case!</p> <p>Prior to posting this question, I spent quite a bit of time looking at Python template engines hoping that one might expose the sort of low-level functionality I'm asking about -- namely, something that can find expressions in a variety of contexts and tell me where they are rather than being limited to finding expressions embedded using a single hard-coded syntax, always evaluating them, and always substituting the results back into the original string. I haven't figured out how to use any of them to solve my problem yet, but I do very much appreciate the suggestions regarding more to look at (can't believe I missed that wonderful list on the wiki!). The API documentation for these things tends to be pretty high-level, and I'm not too familiar with the internals of any of them, so I'm sure I could use help looking at those and figuring out how to get them to do this sort of thing.</p> <p>Thanks for your patience!</p>
[ { "answer_id": 207502, "author": "Jay", "author_id": 20840, "author_profile": "https://Stackoverflow.com/users/20840", "pm_score": 2, "selected": false, "text": "#!/usr/bin/env python\n\nimport sys\nimport re\n\nFILE = sys.argv[1]\n\nhandle = open(FILE)\nfcontent = handle.read()\nhandle....
2008/10/16
[ "https://Stackoverflow.com/questions/207290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13871/" ]
207,306
<p>I'm using the MonthCalendar control and want to programmatically select a date range. When I do so the control doesn't paint properly if <code>Application.EnableVisualStyles()</code> has been called. This is a known issue according to MSDN. </p> <blockquote> <p>Using the MonthCalendar with visual styles enabled will cause a selection range for the MonthCalendar control to not paint correctly (from: <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.monthcalendar.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.windows.forms.monthcalendar.aspx</a>)</p> </blockquote> <p>Is there really no fix for this other than not calling <code>EnableVisualStyles</code>? This seems to make that particular control entirely useless for a range of applications and a rather glaring oversight from my perspective.</p>
[ { "answer_id": 1410399, "author": "Treb", "author_id": 22114, "author_profile": "https://Stackoverflow.com/users/22114", "pm_score": 2, "selected": false, "text": "public class MonthCalendarEx : System.Windows.Forms.MonthCalendar\n{\n private int _offsetX;\n private int _offsetY;\n...
2008/10/16
[ "https://Stackoverflow.com/questions/207306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6255/" ]
207,309
<p>I have db table with parent child relationship as:</p> <pre><code>NodeId NodeName ParentId ------------------------------ 1 Node1 0 2 Node2 0 3 Node3 1 4 Node4 1 5 Node5 3 6 Node6 5 7 Node7 2 </code></pre> <p>Here parentId = 0 means that it is a root level node. Now I want to write an SQL Query which will return child at all level of a parent category.</p> <p>e.g. for nodeId = 1, it should return 3, 4, 5, 6.</p> <p>I am using MS SQL Server 2005 </p>
[ { "answer_id": 207324, "author": "yfeldblum", "author_id": 12349, "author_profile": "https://Stackoverflow.com/users/12349", "pm_score": 4, "selected": true, "text": "with [CTE] as (\n select * from [TheTable] c where c.[ParentId] = 1\n union all\n select * from [CTE] p, [TheTab...
2008/10/16
[ "https://Stackoverflow.com/questions/207309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28243/" ]
207,337
<p>The Oracle view V$OSSTAT holds a few operating statistics, including:</p> <ul> <li>IDLE_TICKS Number of hundredths of a second that a processor has been idle, totalled over all processors</li> <li>BUSY_TICKS Number of hundredths of a second that a processor has been busy executing user or kernel code, totalled over all processors</li> </ul> <p>The documentation I've read has not been clear as to whether these are ever reset. Does anyone know?</p> <p>Another question I have is that I'd like to work out the average CPU load the system is experiencing. To do so I expect I have to go:</p> <pre><code>busy_ticks / (idle_ticks + busy_ticks) </code></pre> <p>Is this correct?</p> <p><strong>Update Nov 08</strong></p> <p>Oracle 10g r2 includes a stat called LOAD in this table. It provides the current load of the machine as at the time the value is read. This is much better than using the other information as the *_ticks data is "since instance start" not as of the current point in time.</p>
[ { "answer_id": 208455, "author": "Leigh Riffel", "author_id": 27010, "author_profile": "https://Stackoverflow.com/users/27010", "pm_score": 3, "selected": true, "text": "SELECT (select value from v$osstat where stat_name = 'BUSY_TICKS') /\n(\n NVL((select value from v$osstat where stat...
2008/10/16
[ "https://Stackoverflow.com/questions/207337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27308/" ]
207,343
<p>I'm writing a data structure in C# (a priority queue using a <a href="http://en.wikipedia.org/wiki/Fibonacci_heap" rel="nofollow noreferrer">fibonacci heap</a>) and I'm trying to use it as a learning experience for TDD which I'm quite new to. </p> <p>I understand that each test should only test one piece of the class so that a failure in one unit doesn't confuse me with multiple test failures, but I'm not sure how to do this when the state of the data structure is important for a test. </p> <p>For example, </p> <pre><code>private PriorityQueue&lt;int&gt; queue; [SetUp] public void Initialize() { this.queue = new PriorityQueue&lt;int&gt;(); } [Test] public void PeekShouldReturnMinimumItem() { this.queue.Enqueue(2); this.queue.Enqueue(1); Assert.That(this.queue.Peek(), Is.EqualTo(1)); } </code></pre> <p>This test would break if either <code>Enqueue</code> or <code>Peek</code> broke. </p> <p>I was thinking that I could somehow have the test manually set up the underlying data structure's heap, but I'm not sure how to do that without exposing the implementation to the world.</p> <p>Is there a better way to do this? Is relying on other parts ok? </p> <p>I have a <code>SetUp</code> in place, just left it out for simplicity.</p>
[ { "answer_id": 207350, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 4, "selected": true, "text": "SetUp" }, { "answer_id": 207366, "author": "Jason Kealey", "author_id": 20893, "author_profile": "ht...
2008/10/16
[ "https://Stackoverflow.com/questions/207343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9617/" ]
207,404
<p>In Groovy, how do I grab a web page and remove HTML tags, etc., leaving only the document's text? I'd like the results dumped into a collection so I can build a word frequency counter.</p> <p>Finally, let me mention again that I'd like to do this in Groovy.</p>
[ { "answer_id": 209245, "author": "mbrevoort", "author_id": 18228, "author_profile": "https://Stackoverflow.com/users/18228", "pm_score": 1, "selected": false, "text": "def records = new XmlSlurper().parseText(YOURHTMLSTRING)\ndef allNodes = records.depthFirst().collect{ it }\ndef list = ...
2008/10/16
[ "https://Stackoverflow.com/questions/207404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
207,454
<p>I've been trying to programatically feed the paper on a pos printer (Epson TM-U220D). The problem I have is that the last line of the document don't get printed, instead, it is printed as the first line of the next document printed. I tried POS for .NET sending the "ESC|flF" command, also tried to send the raw esc/pos command using the serial port, but it doesn't work. Any ideas?</p>
[ { "answer_id": 207527, "author": "bugmagnet", "author_id": 426, "author_profile": "https://Stackoverflow.com/users/426", "pm_score": 0, "selected": false, "text": "\"ECHO \" & Chr(12) & \">LPT1\"\n" }, { "answer_id": 207586, "author": "alexandrul", "author_id": 19756, ...
2008/10/16
[ "https://Stackoverflow.com/questions/207454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26727/" ]
207,464
<p>I'm refactoring a number of classes in an application to use interfaces instead of base classes. Here's the interfaces I created so far:</p> <ul> <li>ICarryable implemented by all Item objects </li> <li>IActable implemented by all Actor objects</li> <li>IUseable implemented by some Item sub-classes</li> <li>IWieldable implemented by some Item sub-classes</li> </ul> <p>You can see the major base-classes are still Item and Actor. These have a common interface in that they both are located on a Map, so they have a Location property. The Map shouldn't care whether the object is an Actor or an Item, so I want to create an interface for it. Here's what the interface would look like</p> <pre><code>public interface IUnnameable { event EventHandler&lt;LocationChangedEventArgs&gt; LocationChanged; Location Location { get; set; } } </code></pre> <p>That's no problem, but I can't think of what to call this interface. IMappable comes to mind by seems a bit lame. Any ideas?</p>
[ { "answer_id": 207489, "author": "Matt Cruikshank", "author_id": 8643, "author_profile": "https://Stackoverflow.com/users/8643", "pm_score": 1, "selected": false, "text": "ICanHasLocation" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1103052/" ]
207,477
<p>I'm looking for a reasonable way to represent searches as a RESTful URLs.</p> <p>The setup: I have two models, Cars and Garages, where Cars can be in Garages. So my urls look like:</p> <pre><code>/car/xxxx xxx == car id returns car with given id /garage/yyy yyy = garage id returns garage with given id </code></pre> <p>A Car can exist on its own (hence the /car), or it can exist in a garage. What's the right way to represent, say, all the cars in a given garage? Something like:</p> <pre><code>/garage/yyy/cars ? </code></pre> <p>How about the union of cars in garage yyy and zzz?</p> <p>What's the right way to represent a search for cars with certain attributes? Say: show me all blue sedans with 4 doors :</p> <pre><code>/car/search?color=blue&amp;type=sedan&amp;doors=4 </code></pre> <p>or should it be /cars instead?</p> <p>The use of "search" seems inappropriate there - what's a better way / term? Should it just be:</p> <pre><code>/cars/?color=blue&amp;type=sedan&amp;doors=4 </code></pre> <p>Should the search parameters be part of the PATHINFO or QUERYSTRING?</p> <p>In short, I'm looking for guidance for cross-model REST url design, and for search.</p> <p>[Update] I like Justin's answer, but he doesn't cover the multi-field search case:</p> <pre><code>/cars/color:blue/type:sedan/doors:4 </code></pre> <p>or something like that. How do we go from</p> <pre><code>/cars/color/blue </code></pre> <p>to the multiple field case?</p>
[ { "answer_id": 207493, "author": "Justin Bozonier", "author_id": 9401, "author_profile": "https://Stackoverflow.com/users/9401", "pm_score": -1, "selected": false, "text": "/garages\n Returns list of garages (think JSON array here)\n/garages/yyy\n Returns specific garage\n/garage/yyy/c...
2008/10/16
[ "https://Stackoverflow.com/questions/207477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13055/" ]
207,485
<p>When you plot things in Matlab, the most recently plotted data series is placed on top of whatever's already there. For example:</p> <pre><code>figure; hold on plot(sin(linspace(0,pi)),'linewidth',4,'color',[0 0 1]) plot(cos(linspace(0,pi)),'linewidth',4,'color',[1 0 0]) </code></pre> <p>Here, the red line is shown on top of the blue line (where they intersect). Is there any way to set "how deep" a line is drawn, so that you can plot things <em>beneath</em> what's already there?</p>
[ { "answer_id": 207603, "author": "b3.", "author_id": 14946, "author_profile": "https://Stackoverflow.com/users/14946", "pm_score": 5, "selected": true, "text": "h1 = plot(1:10, 'b');\nhold on;\nh2 = plot(1:10, 'r');\n" }, { "answer_id": 207828, "author": "b3.", "author_id...
2008/10/16
[ "https://Stackoverflow.com/questions/207485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4161/" ]
207,490
<p>I am working on a new version of a firefox extension, but after releasing it, and incrementing the em:version in install.rdf and update.rdf, when I click "Find updates" Firefox reports that "No updates were found." When I run it with debugging on, the output in the console is actually identical to what I see when I don't put the update live. </p> <p>It starts with RDFItemUpdater:checkForUpdates with all of the parameters, and returns with Addon Update Ended and status: 8.</p> <p>I verified with McCoy tool that the extension is signed, and has the same Id as the old one, etc. I'm not sure what else to try. Any advice would be appreciated. This is with Firefox 3 (and the extension is marked as compatible with it... that didn't change).</p>
[ { "answer_id": 2410957, "author": "Jason", "author_id": 7745, "author_profile": "https://Stackoverflow.com/users/7745", "pm_score": 0, "selected": false, "text": "minVersion=\"3.0.*\"" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26624/" ]
207,494
<p>Its a little tricky to search for 'var:*' because most search engines wont find it.</p> <p>I'm not clear exactly what var:* means, compared to say var:Object</p> <p>I thought it would let me set arbitrary properties on an object like :</p> <pre><code>var x:* = myObject; x.nonExistantProperty = "123"; </code></pre> <p>but this gives me an error :</p> <pre><code>Property nonExistantProperty not found on x </code></pre> <p>What does * mean exactly?</p> <p><strong>Edit:</strong> I fixed the original var:* to the correct var x:*. Lost my internet connection</p>
[ { "answer_id": 207505, "author": "Gerald", "author_id": 19404, "author_profile": "https://Stackoverflow.com/users/19404", "pm_score": 1, "selected": false, "text": "var x = myObject;\n" }, { "answer_id": 207508, "author": "AdamC", "author_id": 16476, "author_profile":...
2008/10/16
[ "https://Stackoverflow.com/questions/207494", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24727/" ]
207,496
<p>So my code is below. I'm not getting any errors and it places everything in the node just fine. But based on my debug statements Everytime anything is inserted it's finding the root. I'm not sure if that is right. But according to output file for the assignment, my answers are different when it comes to the height of the tree, the traversals, and I just flat am still having troubles with my leaf count function. Another story though.</p> <p>Based on the debug statements it looks like everything is going right where they should. But I figure I might need fresh eyes. I don't see how my traversals could change at all since it is really only a matter of where I'm proccessing the node that should effect the Inorder, preorder, and postorder. </p> <pre><code>template &lt;class T&gt; void BT&lt;T&gt;::insert(const T&amp; item) { Node&lt;T&gt;* newNode; newNode = new Node&lt;T&gt;(item); insert(root, newNode); } template &lt;class T&gt; void BT&lt;T&gt;::insert(struct Node&lt;T&gt; *&amp;root, struct Node&lt;T&gt; *newNode) { if (root == NULL) { cout &lt;&lt; "Root Found" &lt;&lt; newNode-&gt;data &lt;&lt; endl; root = newNode; } else { if (newNode-&gt;data &lt; root-&gt;data) { insert(root-&gt;left, newNode); cout &lt;&lt; "Inserting Left" &lt;&lt; newNode-&gt; data &lt;&lt; endl; } else { insert(root-&gt;right, newNode); cout &lt;&lt; "Inserting Right" &lt;&lt; newNode-&gt;data &lt;&lt; endl; } } } </code></pre> <p>My height function is as follows just in case my insert is actually fine.</p> <pre><code>template &lt;class T&gt; int BT&lt;T&gt;::height() const { return height(root); } template &lt;class T&gt; int BT&lt;T&gt;::height(Node&lt;T&gt;* root) const { if (root == NULL) return 0; else { if (height(root-&gt;right) &gt; height(root-&gt;left)) return 1 + height(root-&gt; right); return 1 + height(root-&gt;left); } } </code></pre>
[ { "answer_id": 207503, "author": "Martin York", "author_id": 14065, "author_profile": "https://Stackoverflow.com/users/14065", "pm_score": 4, "selected": true, "text": " cout << \"Leaf Node Found\" << newNode->data << endl;\n" }, { "answer_id": 207580, "author": "Paul Nathan"...
2008/10/16
[ "https://Stackoverflow.com/questions/207496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28392/" ]
207,497
<p>I am looking to set full trust for a single web part, is this possible? manifest.xml maybe?</p>
[ { "answer_id": 207515, "author": "Ed Altorfer", "author_id": 26552, "author_profile": "https://Stackoverflow.com/users/26552", "pm_score": 2, "selected": true, "text": "gacutil.exe \\i C:\\Path\\To\\Dll.dll\n" }, { "answer_id": 207641, "author": "Ryan", "author_id": 20198...
2008/10/16
[ "https://Stackoverflow.com/questions/207497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14777/" ]
207,498
<p>I am running both maven inside the m2eclipse plugin, windows command line and my cygwin command line.</p> <p>cygwin's bash shell dumps artifacts into the cygwin /home/me/.m2 directory</p> <p>but m2eclipse &amp; windows shell (on vista) uses /Users/me/Documents/.m2</p> <p>Is it possible to tell the mvn command to use one central .m2 directory ?</p> <p>Thanks</p>
[ { "answer_id": 207559, "author": "Alex Miller", "author_id": 7671, "author_profile": "https://Stackoverflow.com/users/7671", "pm_score": 4, "selected": false, "text": "<settings xmlns=\"http://maven.apache.org/POM/4.0.0\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n xsi:...
2008/10/16
[ "https://Stackoverflow.com/questions/207498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24457/" ]
207,504
<p>I have a UserControl with some predefined controls (groupbox,button,datagridview) on it, these controls are marked as protected and the components variable is also marked as protected.</p> <p>I then want to inherit from this base UserControl to another UserControl, however the DataGridView is always locked in the designer.</p> <p>I suspect it may have something to do with the DataGridView implementing ISupportInitilize.</p> <pre><code>public class BaseGridDetail : UserControl </code></pre> <p>Has a DataGridView control (et al) defined.</p> <p><br></p> <pre><code>public class InheritedDetail : BaseGridDetail </code></pre> <p>The DataGridView control is locked</p> <p><br>Does anyone have any ideas how to make this control available in the designer after inheritenace?</p>
[ { "answer_id": 207511, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 1, "selected": false, "text": "// in base UserControl\npublic BaseGridDetail()\n{\n InitializeComponent();\n\n InitGridColumns(dataGridView1.Colu...
2008/10/16
[ "https://Stackoverflow.com/questions/207504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4490/" ]
207,510
<p>If I click on File -> Close, it closes the buffer like I want, but doesn't list a key mapping. What is the key mapping?</p>
[ { "answer_id": 207610, "author": "Miserable Variable", "author_id": 18573, "author_profile": "https://Stackoverflow.com/users/18573", "pm_score": 5, "selected": false, "text": "C-h b" }, { "answer_id": 12098186, "author": "Anish", "author_id": 1389198, "author_profile...
2008/10/16
[ "https://Stackoverflow.com/questions/207510", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4960/" ]
207,513
<p>Is there any tool that enables you to "hot swap" JavaScript contents while executing a webpage? </p> <p>I am looking for something similar to what HotSpot does for Java, a way to "hot deploy" new JS code without having to reload the whole page.</p> <p>Is there anything like that out there?</p> <p><strong>Clarifying in case people don't understand "hot swap", as indicated by <em>lock</em>:</strong></p> <p>By "hot swap" I mean allowing me to change parts of the code contained on the page itself and its .js files. </p> <p>Then this framework would detect the change - either automagically or by some indication from my end - and reload the code dynamically, avoiding the new server-side post (reload). </p> <p>That kind of approach would simplify debugging and error fixing, since you don't need to reload the page and start the interaction all over again, from scratch.</p>
[ { "answer_id": 207769, "author": "Erlend Halvorsen", "author_id": 1920, "author_profile": "https://Stackoverflow.com/users/1920", "pm_score": 3, "selected": true, "text": "function reload(){var scripts=document.getElementsByTagName(\"script\");var head=document.getElementsByTagName(\"hea...
2008/10/16
[ "https://Stackoverflow.com/questions/207513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14540/" ]
207,542
<p>I would like to programatically shutdown a Windows Mobile device using Compact framework 2.0, Windows mobile 5.0 SDK.</p> <p>Regards,</p>
[ { "answer_id": 208331, "author": "ctacke", "author_id": 13154, "author_profile": "https://Stackoverflow.com/users/13154", "pm_score": 3, "selected": true, "text": "[Flags]\npublic enum ExitFlags\n{\n Reboot = 0x02,\n PowerOff = 0x08\n}\n\n[DllImport(\"coredll\")]\npublic static extern ...
2008/10/16
[ "https://Stackoverflow.com/questions/207542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/254/" ]
207,554
<p>I'm working on an intranet with several subdomains. I have control over each subdomain, so security of cross-site requests is not a concern. I have PHP scripts with JSON responses I'd like to call from multiple subdomains without duplication. For GET requests, I can do this with AJAX and JSONP, but that doesn't work with POST requests. Some alternatives I see, none of which seem very good:</p> <ul> <li>POST to a copy on local subdomain with minimal response, then GET full response from central location with JSONP</li> <li>Both POST and GET to a copy on local subdomain with JSON</li> <li>Use mod_rewrite to use local URLs with a central script on back end with JSON</li> <li>Use symlinks to use local URLs with a central script on back end with JSON</li> </ul> <p>Am I missing something simpler? What would you do here?</p>
[ { "answer_id": 207668, "author": "Rik Heywood", "author_id": 4012, "author_profile": "https://Stackoverflow.com/users/4012", "pm_score": 2, "selected": false, "text": "<?php\n// Set header so our output looks like a PNG\nheader(\"Content-Type: image/png\");\n\n// Reflect the image from g...
2008/10/16
[ "https://Stackoverflow.com/questions/207554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10837/" ]
207,592
<p>I have a class, and I want to inspect its fields and report eventually how many bytes each field takes. I assume all fields are of type Int32, byte, etc.</p> <p>How can I find out easily how many bytes does the field take?</p> <p>I need something like:</p> <pre><code>Int32 a; // int a_size = a.GetSizeInBytes; // a_size should be 4 </code></pre>
[ { "answer_id": 207601, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 4, "selected": false, "text": "using System;\nusing System.Runtime.InteropServices;\n\npublic class MyClass\n{\n public static void Main()\n {...
2008/10/16
[ "https://Stackoverflow.com/questions/207592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
207,599
<p>I just wrote a new web part and now I am getting this error when I try to deploy them on my non-dev servers:</p> <blockquote> <p>the default namespace '<a href="http://schemas.microsoft.com/WebPart/v2" rel="nofollow noreferrer">http://schemas.microsoft.com/WebPart/v2</a>' is a reserved namespace for base Web Part propertiees. Custom Web Part properties require a unique namespace (specified through an XmlElementAttribute on the property , or an XmlRootAttribute on the class).</p> </blockquote> <p>I am writing the web parts into CAB files and deploying them with this:</p> <pre><code>stsadm -o addwppack -filename web_part_name.CAB -url http://your_url_here -globalinstall -force </code></pre> <p>Everything works fine until I try to add the web part, then I get this error in a popup. It works just fine on my dev VM...?</p> <p>Any ideas would be appreciate, thank you.</p>
[ { "answer_id": 207686, "author": "Ryan", "author_id": 20198, "author_profile": "https://Stackoverflow.com/users/20198", "pm_score": 0, "selected": false, "text": "[XmlRoot(Namespace = \"Your.Namespace\")]\npublic class YourWebPart: WebPart\n{\n...\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14777/" ]
207,608
<p>There is this style of exception system where a component throws component-specific exception. For example, all data access classes throw <code>DataAccessException</code>.</p> <p>In this style, I often find myself having to catch and rethrow the component specific exception, because called methods are delcared as <code>throws Exception</code>:</p> <pre><code>try { int foo = foo(); if (foo != expectedValue) { throw new ComponentException("bad result from foo(): " + foo); } bar(); } catch (ComponentException e) { throw e; } catch (Exception e) { throw new ComponentException(e); } </code></pre> <p>Do you find yourself doing the same? Do you find it ugly?</p> <p>This question is not about validity of this style, but something within the constraints of this style.</p>
[ { "answer_id": 207634, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 2, "selected": false, "text": "try {\n componentCall();\n} catch (ComponentException e) {\n Throwable t = e.getCause();\n //Handle each possible...
2008/10/16
[ "https://Stackoverflow.com/questions/207608", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18573/" ]
207,613
<p>Please one library per answer so that people can vote for the individually.</p>
[ { "answer_id": 207808, "author": "aemkei", "author_id": 28150, "author_profile": "https://Stackoverflow.com/users/28150", "pm_score": 2, "selected": false, "text": "var cal = new scal('samplecal', updateelement, {\n oncalchange: function(d) {\n alert('Calendar Change: ' + d.format('y...
2008/10/16
[ "https://Stackoverflow.com/questions/207613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3547/" ]
207,631
<p>Does some article or proof exist that .NET applications are immune to low level errors? </p> <p>I'm talking about the classic pointer errors we can see in a C++ application, memory overflow, problems from the Intel <a href="http://en.wikipedia.org/wiki/NX_bit" rel="nofollow noreferrer">DEP</a> and so on.</p> <p>I'm talking about .NET applications that do not use "unsafe" code, from what is my experience in this case only problems can be that of a memory leak or classic coding errors (like stack overflows) but I've never seen low level errors.</p> <p>Could someone comment on this?</p>
[ { "answer_id": 18925326, "author": "supercat", "author_id": 363751, "author_profile": "https://Stackoverflow.com/users/363751", "pm_score": 0, "selected": false, "text": "new" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11673/" ]
207,633
<p>Can we somehow extend the RuleSetDialog class and host in our windows application?</p>
[ { "answer_id": 682151, "author": "Mel", "author_id": 1763, "author_profile": "https://Stackoverflow.com/users/1763", "pm_score": 0, "selected": false, "text": "var dialog = new RuleSetDialog(activityType, null, ruleset);\ndialog.Controls[\"headerTextLabel\"].Visible = false;\ndialog.Cont...
2008/10/16
[ "https://Stackoverflow.com/questions/207633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11039/" ]
207,636
<p>I have a Java method which starts up a Process with ProcessBuilder, and pipes its output into a byte array, and then returns its byte array when the process is finished.</p> <p>Pseudo-code:</p> <pre><code>ProcessBuilder b = new ProcessBuilder("my.exe") Process p = b.start(); ... // get output from process, close process </code></pre> <p>What would be the best way to go about unit testing this method? I haven't found a way to mock ProcessBuilder (it's final), even with the incredibly awesome <a href="http://jmockit.org" rel="noreferrer">JMockit</a>, it gives me a NoClassDefFoundError:</p> <pre><code>java.lang.NoClassDefFoundError: test/MockProcessBuilder at java.lang.ProcessBuilder.&lt;init&gt;(ProcessBuilder.java) at mypackage.MyProcess.start(ReportReaderWrapperImpl.java:97) at test.MyProcessTest.testStart(ReportReaderWrapperImplTest.java:28) </code></pre> <p>Any thoughts?</p> <hr> <p><strong>Answer</strong> - As Olaf recommended, I ended up refactoring those lines to an interface</p> <pre><code>Process start(String param) throws IOException; </code></pre> <p>I now pass an instance of this interface into the class I wanted to test (in its constructor), normally using a default implementation with the original lines. When I want to test I simply use a mock implementation of the interface. Works like a charm, though I do wonder if I'm over-interfacing here...</p>
[ { "answer_id": 1024931, "author": "Rogério", "author_id": 2326914, "author_profile": "https://Stackoverflow.com/users/2326914", "pm_score": 2, "selected": false, "text": "public class MyProcessTest\n{\n public static class MyProcess {\n public byte[] run() throws IOException, I...
2008/10/16
[ "https://Stackoverflow.com/questions/207636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6583/" ]
207,642
<p>There are so many options when it comes to PHP development environments and you have to piece it all together yourself.</p> <p>I'm wondering if someone has come up with what they think is the ideal setup that gets out of your way and lets you develop.</p> <p>Right now I use vim and svn from the command-line. I write scripts to manage builds but I'm thinking about looking into Phing.</p> <p>I love vim but I'm seriously thinking of trying Eclipse with the PHP plugin because I imagine it makes common SVN options a bit easier (moving files around in a project).</p> <p>Something to support continuous integration on the database would be a major plus!</p> <p>UPDATE: Just wanted to stress that previous line up there. I realize some frameworks will help with this, but I don't use a framework. Is there some simple module out there (included in the IDE or not) that will let me easily tie my database schemas/data to a subversion revision, letting me rollback and forward, tag, branch, etc?</p> <p>Any comments on things beyond the editor? For example: Builds, managing staging/production/development environments, automated testing and building upon SVN commit, etc. Ideally we can make this post a "Go to Whoah" for setting up a professional PHP team development environment.</p>
[ { "answer_id": 207685, "author": "Richard Turner", "author_id": 12559, "author_profile": "https://Stackoverflow.com/users/12559", "pm_score": 1, "selected": false, "text": "var_dump();exit;" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
207,646
<p>I am having an VB Script. I need to log the error information in a file. I need to log every information like error number error description and in which sub routine does the error occured.</p> <p>Please provide some code</p>
[ { "answer_id": 207697, "author": "TcKs", "author_id": 20382, "author_profile": "https://Stackoverflow.com/users/20382", "pm_score": -1, "selected": true, "text": "On Error Resume Next '' ignore errors\nSomeIgnorableFunction()\n\nOn Error GoTo 0 '' removes error ignoring\nSomeImportantFun...
2008/10/16
[ "https://Stackoverflow.com/questions/207646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22162/" ]
207,662
<p>I'm trying to write a wstring to file with ofstream in binary mode, but I think I'm doing something wrong. This is what I've tried:</p> <pre><code>ofstream outFile("test.txt", std::ios::out | std::ios::binary); wstring hello = L"hello"; outFile.write((char *) hello.c_str(), hello.length() * sizeof(wchar_t)); outFile.close(); </code></pre> <p>Opening test.txt in for example Firefox with encoding set to UTF16 it will show as:</p> <p>h�e�l�l�o�</p> <p>Could anyone tell me why this happens? </p> <p><strong>EDIT:</strong></p> <p>Opening the file in a hex editor I get:</p> <pre><code>FF FE 68 00 00 00 65 00 00 00 6C 00 00 00 6C 00 00 00 6F 00 00 00 </code></pre> <p>Looks like I get two extra bytes in between every character for some reason?</p>
[ { "answer_id": 208431, "author": "Martin York", "author_id": 14065, "author_profile": "https://Stackoverflow.com/users/14065", "pm_score": 4, "selected": false, "text": "#include <locale>\n#include <fstream>\n#include <iostream>\n// See Below for the facet\n#include \"UTF16Facet.h\"\n\ni...
2008/10/16
[ "https://Stackoverflow.com/questions/207662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22283/" ]
207,693
<p>The following code returns data from a spreadsheet into a grid perfectly</p> <pre><code>[ string excelConnectString = "Provider = Microsoft.Jet.OLEDB.4.0;" + "Data Source = " + excelFileName + ";" + "Extended Properties = Excel 8.0;"; OleDbConnection objConn = new OleDbConnection(excelConnectString); OleDbCommand objCmd = new OleDbCommand("Select * From [Accounts$]", objConn); OleDbDataAdapter objDatAdap = new OleDbDataAdapter(); objDatAdap.SelectCommand = objCmd; DataSet ds = new DataSet(); objDatAdap.Fill(ds); fpDataSet_Sheet1.DataSource = ds;//fill a grid with data ] </code></pre> <p>The spreadsheet I'm using has columns named from A and so on( just standard column names ) and the sheet name is Accounts.</p> <p>I have a problem with the query ...</p> <pre><code> [OleDbCommand objCmd = new OleDbCommand("Select * From [Accounts$]", objConn);] </code></pre> <p>How can I make the query string like this...</p> <pre><code>"Select &lt;columnA&gt;,&lt;columnB&gt;,SUM&lt;columnG&gt; from [Accounts$] group by &lt;columnA&gt;,&lt;columnB&gt;" </code></pre> <p>..so that it returns the results of this query</p> <p>Note : columnA is A on Sheet , columnB is B on Sheet and columnG is G on Sheet</p> <p>Other possible Alternatives:</p> <ol> <li>I have the data of that excel spread into a DataTable object, how can I query the DataTAble object</li> <li>I read about a DataView object that it can take a table and return the table manipulated according to (<code>&lt;dataviewObject&gt;.RowFilter = "where..."</code>) , but I don't know how to use the query I want.</li> </ol>
[ { "answer_id": 281829, "author": "Jason Anderson", "author_id": 1530166, "author_profile": "https://Stackoverflow.com/users/1530166", "pm_score": 0, "selected": false, "text": "SUM" }, { "answer_id": 421145, "author": "Binoj Antony", "author_id": 33015, "author_profil...
2008/10/16
[ "https://Stackoverflow.com/questions/207693", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
207,703
<p>I have a touch screen kiosk that displays a webpage and a pdf document. Can I remove the menu bar? Users must not have "save", "print" and other such features.</p> <p>Update</p> <p><a href="http://flickr.com/photos/23021917@N05/2209106577/" rel="nofollow noreferrer">random screenshot on flickr</a> - I am refering to the print, back/forward, zoom bar that controls the PDF -- not the browser menu. Sorry for not beeing specific.</p>
[ { "answer_id": 208160, "author": "charlesbridge", "author_id": 22738, "author_profile": "https://Stackoverflow.com/users/22738", "pm_score": 2, "selected": false, "text": "File->Export as PDF->User Interface" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3718/" ]
207,720
<p>One of the most difficult problems in my javascript experience has been the correct (that is "cross-browser") computing of a <strong>iframe height</strong>. In my applications I have a lot of dynamically generated iframe and I want them all do a sort of autoresize at the end of the load event to adjust their height and width.</p> <p>In the case of <strong>height</strong> computing my best solution is the following (with the help of jQuery):</p> <pre><code>function getDocumentHeight(doc) { var mdoc = doc || document; if (mdoc.compatMode=='CSS1Compat') { return mdoc.body.offsetHeight; } else { if ($.browser.msie) return mdoc.body.scrollHeight; else return Math.max($(mdoc).height(), $(mdoc.body).height()); } } </code></pre> <p>I searched the internet without success. I also tested Yahoo library that has some methods for document and viewport dimensions, but it's not satisfactory. My solution works decently, but sometimes it calculates a taller height. I've studied and tested tons of properties regarding document height in Firefox/IE/Safari: <code>documentElement.clientHeight, documentElement.offsetHeight, documentElement.scrollHeight, body.offsetHeight, body.scrollHeight, ...</code> Also jQuery doesn't have a coherent behavior in various browser with the calls <code>$(document.body).height(), $('html', doc).height(), $(window).height()</code></p> <p>I call the above function not only at the end of load event, but also in the case of dynamically inserted DOM elements or elements hidden or shown. This is a case that sometimes breaks the code that works only in the load event.</p> <p>Does someone have a real cross-browser (at least Firefox/IE/Safari) solution? Some tips or hints?</p>
[ { "answer_id": 749417, "author": "Brian Grinstead", "author_id": 76137, "author_profile": "https://Stackoverflow.com/users/76137", "pm_score": 0, "selected": false, "text": "function getDocumentHeight(doc) {\n var mdoc = doc || document; \n var docHeight = mdoc.body.scrollHeight;\n\n ...
2008/10/16
[ "https://Stackoverflow.com/questions/207720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27789/" ]
207,721
<p>As I mention in an earlier question, I'm refactoring a project I'm working on. Right now, everything depends on everything else. Everything is separated into namespaces I created early on, but I don't think my method of separtion was very good. I'm trying to eliminate cases where an object depends on another object in a different namespace that depends on the other object.</p> <p>The way I'm doing this, is by partitioning my project (a game) into a few assemblies:</p> <pre><code>GameName.Engine GameName.Rules GameName.Content GameName.Gui </code></pre> <p>The <code>GameName.Engine</code> assembly contains a bunch of interfaces, so other parts of the program don't need to depend on any particular implementation. For instance, I have a <code>GameName.Engine.ICarryable</code> interface that is primarily implemented by <code>GameName.Content.Item</code> class (and its sub-classes). I also have an object to allow an <code>Actor</code> to pick up an <code>ICarryable</code>: <code>PickupAction</code>. <code>Previously</code>, it required an Item, but this exposes unneccessary methods and properties, where it really only needed the methods required to pick it up and carry it. That's why I've created the <code>ICarryable</code> interface.</p> <p>Now that's all good, so to my question. <code>GameName.Gui</code> should only depend on <code>GameName.Engine</code>, not any implementation. Inside <code>GameName.Gui</code> I have a <code>MapView</code> object that displays a <code>Map</code> and any <code>IRenderable</code> objects on it.</p> <p><code>IRenderable</code> is basically just an interface that exposes an image and some strings describing the object. But, the MapView also needs the object to implement <code>ILocateable</code>, so it can see its location and know when it's changed via an event, <code>LocationChanged</code>, inside <code>ILocateable</code>.</p> <p>These two interfaces are implemented by both <code>Item</code> and <code>Actor</code> objects. Which, again are defined in <code>GameName.Content</code>. Since it needs both interfaces, I have two choices:</p> <ol> <li><p>Make <code>GameName.Gui</code> depend on <code>GameName.Content</code> and require an <code>Entity</code> (base-class of <code>Item</code> and <code>Actor</code>).</p></li> <li><p>Make an interface inside <code>GameName.Engine</code> that looks like this:</p> <pre><code>interface ILocateableRenderable : ILocateable, IRenderable { } </code></pre> <p>And then make my <code>Actor</code> and <code>Item</code> objects implement that interface instead of the two individually.</p></li> </ol> <p>Anyone have any suggestions on which method is the best? Is it appropriate to create an interface with no methods or properties, that only enforces implementing two other interfaces?</p> <p><em>Clarification: <code>MapView</code> works on a <code>Map</code>, which is composed of <code>Entity</code> objects. I don't want to expose the <code>Entity</code> objects to the <code>MapView</code>, it only needs to know their location (<code>ILocateable</code>) and how to render them (<code>IRenderable</code>).</em></p>
[ { "answer_id": 207753, "author": "Sklivvz", "author_id": 7028, "author_profile": "https://Stackoverflow.com/users/7028", "pm_score": 3, "selected": true, "text": "public void Whatever(IRenderable renderable)\n{\n if (renderable is ILocateable)\n {\n ((ILocateable) renderable).Lo...
2008/10/16
[ "https://Stackoverflow.com/questions/207721", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1103052/" ]
207,730
<p>I'm trying to create a C++ class, with a templated superclass. The idea being, I can easily create lots of similar subclasses from a number of superclasses which have similar characteristics.</p> <p>I have distilled the problematic code as follows:</p> <p><code>template_test.h</code>:</p> <pre><code>template&lt;class BaseClass&gt; class Templated : public BaseClass { public: Templated(int a); virtual int Foo(); }; class Base { protected: Base(int a); public: virtual int Foo() = 0; protected: int b; }; </code></pre> <p><code>template_test.cpp</code>:</p> <pre><code>#include "template_test.h" Base::Base(int a) : b(a+1) { } template&lt;class BaseClass&gt; Templated&lt;BaseClass&gt;::Templated(int a) : BaseClass(a) { } template&lt;class BaseClass&gt; int Templated&lt;BaseClass&gt;::Foo() { return this-&gt;b; } </code></pre> <p><code>main.cpp</code>:</p> <pre><code>#include "template_test.h" int main() { Templated&lt;Base&gt; test(1); return test.Foo(); } </code></pre> <p>When I build the code, I get linker errors, saying that the symbols <code>Templated&lt;Base&gt;::Templated(int)</code> and <code>Templated&lt;Base&gt;::Foo()</code> cannot be found.</p> <p>A quick Google suggests that adding the following to <code>main.cpp</code> will solve the problem:</p> <pre><code>template&lt;&gt; Templated&lt;Base&gt;::Templated(int a); template&lt;&gt; int Templated&lt;Base&gt;::Foo(); </code></pre> <p>But this does not solve the problem. Adding the lines to <code>main.cpp</code> does not work either. (Though, interestingly, adding them to both gives 'multiply defined symbol' errors from the linker, so they must be doing something...)</p> <p><em>However</em>, putting all the code in one source file does solve the problem. While this would be ok for the noddy example above, the real application I'm looking at would become unmanageable very fast if I was forced to put the whole lot in one cpp file.</p> <p>Does anyone know if what I'm doing is even possible? (How) can I solve my linker errors?</p> <p>I would assume that I could make all the methods in <code>class Templated</code> inline and this would work, but this doesn't seem ideal either.</p>
[ { "answer_id": 207743, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 3, "selected": true, "text": ".inl" }, { "answer_id": 207782, "author": "Andrew Stapleton", "author_id": 28506, "author_profile": "http...
2008/10/16
[ "https://Stackoverflow.com/questions/207730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17938/" ]
207,734
<p>we can use <code>time</code> in a unix environment to see how long something took...</p> <pre><code>shell&gt; time some_random_command real 0m0.709s user 0m0.008s sys 0m0.012s </code></pre> <p>is there an equivalent for recording memory usage of the process(es)?</p> <p>in particular i'm interested in peak allocation.</p>
[ { "answer_id": 208346, "author": "Andy Whitfield", "author_id": 4805, "author_profile": "https://Stackoverflow.com/users/4805", "pm_score": 0, "selected": false, "text": "ps v <pid>" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26094/" ]
207,744
<p>I'm looking for a good algorithm that can give me the unique edges from a set of polygon data. In this case, the polygons are defined by two arrays. One array is the number of points per polygon, and the other array is a list of vertex indices.</p> <p>I have a version that is working, but performance gets slow when reaching over 500,000 polys. My version walks over each face and adds each edge's sorted vertices to an stl::set. My data set will be primarily triangle and quad polys, and most edges will be shared.</p> <p>Is there a smarter algorithm for this?</p>
[ { "answer_id": 207757, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 3, "selected": false, "text": "A +-----+ B\n \\ |\\\n \\ 1 | \\\n \\ | \\\n \\ | 2 \\\n \\| \\\n C +-----+ D\n" }...
2008/10/16
[ "https://Stackoverflow.com/questions/207744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17209/" ]
207,763
<p>I recently saw an announcement and <a href="http://www.linux.com/feature/150399" rel="nofollow noreferrer">article</a> outlining the release of the first <a href="http://www.python.org/download/releases/3.0/" rel="nofollow noreferrer">Python 3.0</a> release candidate. I was wondering whether there were any commercial, free, open source etc. IDE's that support its syntax.</p>
[ { "answer_id": 209303, "author": "Dan Lenski", "author_id": 20789, "author_profile": "https://Stackoverflow.com/users/20789", "pm_score": 4, "selected": true, "text": "print" }, { "answer_id": 800310, "author": "Zxaos", "author_id": 4924, "author_profile": "https://St...
2008/10/16
[ "https://Stackoverflow.com/questions/207763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/416/" ]
207,768
<p>I know how to fill an std::vector with non-trivial initial values, e.g. sequence numbers:</p> <pre><code>void IndexArray( unsigned int length, std::vector&lt;unsigned int&gt;&amp; v ) { v.resize(length); for ( unsigned int i = 0; i &lt; length; ++i ) { v[i] = i; } } </code></pre> <p>But this is a for-loop. Is there an elegant way to do this with less lines of code using stl functionality (and <strong>not</strong> using Boost)?</p>
[ { "answer_id": 207777, "author": "moogs", "author_id": 26374, "author_profile": "https://Stackoverflow.com/users/26374", "pm_score": 5, "selected": true, "text": "#include <iostream>\n#include <algorithm>\n#include <vector>\n\nstruct c_unique {\n int current;\n c_unique() {current=0;...
2008/10/16
[ "https://Stackoverflow.com/questions/207768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19863/" ]
207,786
<p>I develop using MAMP pro on my Mac. When I start MAMP it prompts me for a password if I use port 80. If I use a higher port it doesn't prompt me, but I have to append the port number in the URL ( eg dev.local:8888 ). Does anyone know how to make it not prompt for password when using standard ports? Thank you.</p>
[ { "answer_id": 15050843, "author": "Anonymous", "author_id": 945722, "author_profile": "https://Stackoverflow.com/users/945722", "pm_score": 2, "selected": false, "text": "YOURPASSWORD" }, { "answer_id": 17238053, "author": "bw_qa", "author_id": 1881324, "author_profi...
2008/10/16
[ "https://Stackoverflow.com/questions/207786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26107/" ]
207,789
<p>I am using sql express 2008 and vs2008, writing in c#.</p> <p>I have a db table with a Geography column in it, into which I need to put gps data I collected. When I tried creating an Entity-Framework mapping for this table, it just ignored the column with some warning about not being able to map such column types. I then looked at nHibernate.Spatial project, but it seems like it only translates the Geometry types, not the Geography. No luck there. I've been told I can use a view with casting the Geography to VarBinary, and then in the created entity class add another Property that deserializes the binary back into Geography. I guess that will work for reading the data from the db, but I also need to insert those rows into my db, and I can't add rows to the view. Is there some other trick I can use in order to easily read and write Geography data from my db, in my c# code?</p>
[ { "answer_id": 214159, "author": "kͩeͣmͮpͥ ͩ", "author_id": 26479, "author_profile": "https://Stackoverflow.com/users/26479", "pm_score": 2, "selected": true, "text": "IUserType" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207789", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28505/" ]
207,791
<p>It doesn't look like basic javascript but nor can I use JQuery commands like <code>$('myId')</code>. Is this or similar functions documented anywhere?</p> <p>For reason I don't want to go into, I am not able to use 3rd party libraries like JQuery but if some powerful javascript extensions come with asp then I would like to know about them. </p>
[ { "answer_id": 207846, "author": "Filini", "author_id": 21162, "author_profile": "https://Stackoverflow.com/users/21162", "pm_score": 1, "selected": false, "text": "\nfunction $()\n{\n alert('foo');\n} \n\n$();\n" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207791", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18107/" ]
207,793
<p>Is it possible to pass a path such as subject/name to a template then to use that path which is passed in the template as a path and not as a textual string. I am finding that the path is treated as text rather than a path.</p>
[ { "answer_id": 208838, "author": "ChuckB", "author_id": 28605, "author_profile": "https://Stackoverflow.com/users/28605", "pm_score": 1, "selected": false, "text": "dyn:evaluate()" }, { "answer_id": 217438, "author": "Richard A", "author_id": 24355, "author_profile": ...
2008/10/16
[ "https://Stackoverflow.com/questions/207793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
207,800
<p>I am new to C and i have this question. why does the following code crash:</p> <pre><code>int *a = 10; *a = 100; </code></pre>
[ { "answer_id": 207807, "author": "gimel", "author_id": 6491, "author_profile": "https://Stackoverflow.com/users/6491", "pm_score": 4, "selected": false, "text": "int cell = 10;\nint *a = &cell; // a points to address of cell\n*a = 100; // content of cell changed\n" }, { "an...
2008/10/16
[ "https://Stackoverflow.com/questions/207800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
207,824
<p><a href="http://wiki.eclipse.org/index.php/ATF/JSDT" rel="nofollow noreferrer">Javascript Developer Tools</a> (JSDT) for Eclipse provides a nice outline view of Javascript classes, with a little symbol next to them to indicate visibility. </p> <p>Looking at <em>Preferences->Javascript->Appearance->Members Sort Order</em>, it seems able to indicate whether a method is public, private or protected, but all of my use the "default" marker, a blue triangle.</p> <p>Does anyone know how it determines which symbol to use? I've tried using Javadoc and JSDoc formatted comments. My private methods start with a leading underscore, and that doesn't give it a hint either.</p> <p>Not a big deal, just would be nice to know...</p>
[ { "answer_id": 609438, "author": "levik", "author_id": 4465, "author_profile": "https://Stackoverflow.com/users/4465", "pm_score": 0, "selected": false, "text": "@private" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6521/" ]
207,829
<p>I have a List object being accessed by multiple threads. There is mostly one thread, and in some conditions two threads, that updates the list. There are one to five threads that can read from this list, depending on the number of user requests being processed. The list is not a queue of tasks to perform, it is a list of domain objects that are being retrieved and updated concurrently.</p> <p>Now there are several ways to make the access to this list thread-safe:<br> -use synchronized block<br> -use normal <em>Lock</em> (i.e. read and write ops share same lock)<br> -use <em>ReadWriteLock</em><br> -use one of the new <em>ConcurrentBLABLBA</em> collection classes </p> <p><strong>My question:</strong><br> What is the optimal approach to use, given that the cricital sections typically do not contain a lot of operations (mostly just adding/removing/inserting or getting elements from the list)?<br> Can you recommend another approach, not listed above?</p> <p><strong>Some constrains</strong><br> -optimal performance is critical, memory usage not so much<br> -it must be an ordered list (currently synchronizing on an <em>ArrayList</em>), although not a sorted list (i.e. not sorted using Comparable or Comparator, but according to insertion order)<br> -the list will is big, containing up to 100000 domain objects, thus using something like CopyOnWriteArrayList not feasible<br> -the write/update ciritical sections are typically very quick, doing simple add/remove/insert or replace (set)<br> -the read operations will do primarily a elementAt(index) call most of the time, although some read operations might do a binary search, or indexOf(element)<br> -no direct iteration over the list is done, though operation like indexOf(..) will traverse list </p>
[ { "answer_id": 207937, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 3, "selected": true, "text": "ConcurrentHashMap" }, { "answer_id": 208953, "author": "Marcus Downing", "author_id": 1000, "author_profi...
2008/10/16
[ "https://Stackoverflow.com/questions/207829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27602/" ]
207,837
<p>In a <a href="https://stackoverflow.com/questions/190524/mapping-computed-properties-in-linq-to-sql-to-actuall-sql-statements">previous question</a> I asked how to make "Computed properties" in a linq to sql object. The answer supplied there was sufficient for that specific case but now I've hit a similar snag in another case.</p> <p>I have a database with <strong>Items</strong> that have to pass through a number of <strong>Steps</strong>. I want to have a function in my database that retrieves the Current step of the item that I can then build on. For example:</p> <pre><code>var x = db.Items.Where(item =&gt; item.Steps.CurrentStep().Completed == null); </code></pre> <p>The code to get the current step is:</p> <pre><code>Steps.OrderByDescending(step =&gt; step.Created).First(); </code></pre> <p>So I tried to add an extension method to the <strong>EntitySet&lt;Step&gt;</strong> that returned a single <strong>Step</strong> like so:</p> <pre><code>public static OrderFlowItemStep CurrentStep(this EntitySet&lt;OrderFlowItemStep&gt; steps) { return steps.OrderByDescending(o =&gt; o.Created).First(); } </code></pre> <p>But when I try to execute the query at the top I get an error saying that the <em>CurrentStep()</em> function has no translation to SQL. Is there a way to add this functionality to Linq-to-SQL in any way or do I have to manually write the query every time? I tried to write the entire query out first but it's very long and if I ever change the way to get the active step of an item I have to go over all the code again.</p> <p>I'm guessing that the CurrentStep() method has to return a Linq expression of some kind but I'm stuck as to how to implement it.</p>
[ { "answer_id": 216733, "author": "MichaelGG", "author_id": 27012, "author_profile": "https://Stackoverflow.com/users/27012", "pm_score": 2, "selected": true, "text": "using System;\nusing System.Linq;\nusing System.Linq.Expressions;\n\nclass Program {\n static void Main(string[] args)...
2008/10/16
[ "https://Stackoverflow.com/questions/207837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26746/" ]
207,838
<p>There has been a lot of press about IPv6 and the impending switch over to IPv6 from IPv4. I have some understanding of IPv6, but I've often wondered how much impact IPv6 has on application development &amp; design (specifically)?</p> <p>Are there some tangible/well known benefits IPv6 provides which we don't already have today?</p> <p>I know Windows Vista and Server 2008 support IPv6 out-of-the-box, is anyone using (or designing with IPv6 in mind) today, and if so, what are the benefits? Should we be considering IPv6 in current and future projects?</p> <p>Are there any <em>good</em> examples of IPv6-aware applications? </p>
[ { "answer_id": 378212, "author": "Alnitak", "author_id": 6782, "author_profile": "https://Stackoverflow.com/users/6782", "pm_score": 3, "selected": false, "text": "AF_INET" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18471/" ]
207,843
<p>I am using Eclipse 3.3 ("Europa"). Periodically, Eclipse takes an inordinately long time (perhaps forever) to start up. The only thing I can see in the Eclipse log is:</p> <pre> !ENTRY org.eclipse.core.resources 2 10035 2008-10-16 09:47:34.801 !MESSAGE The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes. </pre> <p>Googling reveals <a href="http://dev.zhourenjian.com/blog/2007/11/07/eclipse-freezing-on-start.html" rel="noreferrer">someone's suggestion</a> that I remove the folder:</p> <pre><code>workspace\.metadata\.plugins\org.eclipse.core.resources\.root\.indexes </code></pre> <p>This does not appear to have helped.</p> <p>Short of starting with a new workspace (something which I am not keen to do, as it takes me hours to set up all my projects again properly), is there a way to make Eclipse start up properly?</p>
[ { "answer_id": 208148, "author": "Ruben", "author_id": 26919, "author_profile": "https://Stackoverflow.com/users/26919", "pm_score": 5, "selected": false, "text": "Eclipse" }, { "answer_id": 209834, "author": "matt b", "author_id": 4249, "author_profile": "https://Sta...
2008/10/16
[ "https://Stackoverflow.com/questions/207843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4728/" ]
207,848
<p>How do I get the full width result for the *nix command "<strong>ps</strong>"?<br /> I know we can specify something like <code>--cols 1000</code> but is there anyway I can the columns and just print out everything?</p>
[ { "answer_id": 207864, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 4, "selected": true, "text": "ps -w -w aux" }, { "answer_id": 207893, "author": "C. K. Young", "author_id": 13, "author_profile": "htt...
2008/10/16
[ "https://Stackoverflow.com/questions/207848", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4037/" ]
207,851
<p>I want to create a Silverlight 2 control that has two content areas. A Title and a MainContent. So the control would be:</p> <pre><code>&lt;StackPanel&gt; &lt;TextBlock Text=" CONTENT1 "/&gt; &lt;Content with CONTENT2 "/&gt; &lt;/StackPanel&gt; </code></pre> <p>When I use the control I should just be able to use:</p> <pre><code>&lt;MyControl Text="somecontent"&gt;main content &lt;/MyControl&gt; </code></pre> <p>How can I create such a control?</p>
[ { "answer_id": 207897, "author": "Mark Ingram", "author_id": 986, "author_profile": "https://Stackoverflow.com/users/986", "pm_score": 4, "selected": true, "text": "[ContentProperty(\"Child\")]\npublic partial class MyControl: UserControl\n{\n public static readonly DependencyProperty...
2008/10/16
[ "https://Stackoverflow.com/questions/207851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5189/" ]
207,867
<p>Is it less efficient to use TEXT than varchar in an SQL database?</p> <p>If so why?</p> <p>If not why would you not just always use TEXT?</p> <p>I'm not targetting a specific database here but oracle is probably the most relevant, although I'm testing on MySQL for the time being as part of a proof of concept.</p>
[ { "answer_id": 207874, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 3, "selected": true, "text": "varchar(max)" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20400/" ]
207,871
<p>I need to use utf-8 characters in my perl-documentation. If I use:</p> <pre><code>perldoc MyMod.pm </code></pre> <p>I see strange characters. If I use:</p> <pre><code>pod2text MyMod.pm </code></pre> <p>everything is fine.</p> <p>I use Ubuntu/Debian.</p> <pre><code>$ locale LANG=de_DE.UTF-8 LC_CTYPE="de_DE.UTF-8" LC_NUMERIC="de_DE.UTF-8" LC_TIME="de_DE.UTF-8" LC_COLLATE="de_DE.UTF-8" LC_MONETARY="de_DE.UTF-8" LC_MESSAGES="de_DE.UTF-8" LC_PAPER="de_DE.UTF-8" LC_NAME="de_DE.UTF-8" LC_ADDRESS="de_DE.UTF-8" LC_TELEPHONE="de_DE.UTF-8" LC_MEASUREMENT="de_DE.UTF-8" LC_IDENTIFICATION="de_DE.UTF-8" LC_ALL=de_DE.UTF-8 </code></pre> <p>Is there a HowTo about using special characters in Pod?</p> <p>Here is a small example using german umlauts "Just a Test: äöüßÄÖ":</p> <pre><code>$ perldoc perl/MyMod.pm &lt;standard input&gt;:72: warning: can't find character with input code 159 &lt;standard input&gt;:72: warning: can't find character with input code 150 MyMod(3) User Contributed Perl Documentation MyMod(3) NAME MyMod.pm - Just a Test: äöüÃÃà perl v5.10.0 2008-10-16 MyMod(3) </code></pre>
[ { "answer_id": 208699, "author": "moritz", "author_id": 14132, "author_profile": "https://Stackoverflow.com/users/14132", "pm_score": 5, "selected": true, "text": "=encoding utf-8" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27239/" ]
207,878
<p>I have the following code that sets a cookie:</p> <pre><code> string locale = ((DropDownList)this.LoginUser.FindControl("locale")).SelectedValue; HttpCookie cookie = new HttpCookie("localization",locale); cookie.Expires= DateTime.Now.AddYears(1); Response.Cookies.Set(cookie); </code></pre> <p>However, when I try to read the cookie, the Value is Null. The cookie exists. I never get past the following if check:</p> <pre><code> if (Request.Cookies["localization"] != null &amp;&amp; !string.IsNullOrEmpty(Request.Cookies["localization"].Value)) </code></pre> <p>Help?</p>
[ { "answer_id": 208159, "author": "aunlead", "author_id": 28321, "author_profile": "https://Stackoverflow.com/users/28321", "pm_score": 0, "selected": false, "text": "string locale = ((DropDownList)this.LoginUser.FindControl(\"locale\"))\n ...
2008/10/16
[ "https://Stackoverflow.com/questions/207878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1090/" ]
207,881
<p>I've a dialog which contains a Qt TabWidget with a number of tabs added. </p> <p>I'd like to hide one of the tabs. </p> <pre><code>_mytab-&gt;hide() </code></pre> <p>doesn't work. I don't want to just delete the tab and all its widgets from the .ui file because other code relies on the widgets within the tab. However, it would be fine to generate the tab code but somehow not ::insertTab in the generated uic_mydialog.cpp. Setting the hidden property in the ui file does not work either.</p> <p>I'm using Qt 3.3</p>
[ { "answer_id": 208425, "author": "Jérôme", "author_id": 2796, "author_profile": "https://Stackoverflow.com/users/2796", "pm_score": 4, "selected": true, "text": "_myTabDlg->removePage(_mytab);\n" }, { "answer_id": 208441, "author": "AMM", "author_id": 11212, "author_p...
2008/10/16
[ "https://Stackoverflow.com/questions/207881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23434/" ]
207,889
<p>I want this method to work for any given number of arguments, i can do that with code generation(with a lot of ugly code), can it be done with recursion? if so how? I understand recursion, but i dont know how to write this.</p> <pre><code>private static void allCombinations(List&lt;String&gt;... lists) { if (lists.length == 3) { for (String s3 : lists[0]) { for (String s1 : lists[1]) { for (String s2 : lists[2]) { System.out.println(s1 + "-" + s2 + "-" + s3); } } } } if (lists.length == 2) { for (String s3 : lists[0]) { for (String s1 : lists[1]) { System.out.println(s1 + "-" + s3); } } } } </code></pre>
[ { "answer_id": 207912, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 1, "selected": false, "text": "public static void allCombinations(List<String>... lists) {\n int[] indexes = new int[lists.length];\n\n while (in...
2008/10/16
[ "https://Stackoverflow.com/questions/207889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
207,896
<p>I have a C#/.NET program that can run both as a console application and as a service. Currently I give it a command-line option to start as a console application, but I would like to avoid that.</p> <p>Is it possible to programmatically detect whether my program is being started as a service? </p> <p>If it was pure Win32, I could try starting as a service with StartServiceCtrlDispatcher and fall back to console if it returned ERROR_FAILED_SERVICE_CONTROLLER_CONNECT, but System.ServiceProcess.ServiceBase.Run() pops up an errordialog if it fails and then just returns without signaling an error to the program.</p> <p>Any ideas?</p>
[ { "answer_id": 6202990, "author": "Chin Siang", "author_id": 779622, "author_profile": "https://Stackoverflow.com/users/779622", "pm_score": 2, "selected": false, "text": "[DllImport(\"kernel32.dll\", SetLastError = true)]\nstatic extern IntPtr GetStdHandle(int nStdHandle);\nconst int ST...
2008/10/16
[ "https://Stackoverflow.com/questions/207896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5542/" ]
207,899
<p>I have a database that contains a table that looks a bit like this:</p> <p>PropertyId, EntityId, Value</p> <p>PropertyId and EntityId are a combined primary key. Every Entity is spread over a couple of rows where every row contains a single property of the entity. I have no control over this database so I'll have to work with it.</p> <p>Is it possible to use NHibernate to map entities from this table to single objects? I only have to read from this table, this might make things a bit easier. Or would I be better off just using DataReaders and do the mapping myself?</p>
[ { "answer_id": 212838, "author": "kͩeͣmͮpͥ ͩ", "author_id": 26479, "author_profile": "https://Stackoverflow.com/users/26479", "pm_score": 1, "selected": false, "text": "map" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3320/" ]
207,901
<p>I have a databound <code>DataGridView</code>. When a new row is added and the user presses <kbd>Esc</kbd> I want to delete the entire row. How can I do this?</p>
[ { "answer_id": 207970, "author": "balexandre", "author_id": 28004, "author_profile": "https://Stackoverflow.com/users/28004", "pm_score": 3, "selected": false, "text": "private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e)\n{\n if (e.KeyChar == (char)27)\n {\n ...
2008/10/16
[ "https://Stackoverflow.com/questions/207901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
207,938
<p>I'm not sure what the best api for simple 2d graphics with Java is. I know <code>java.awt.Graphics2D</code> was the standard but has it been replaced? Swing is the new API for Java GUI apps but it seems a bit heavy for what I want. What I really want is something like the C <a href="http://libsdl.org/" rel="noreferrer">SDL library</a>.</p>
[ { "answer_id": 207982, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 5, "selected": true, "text": "Graphics2D" } ]
2008/10/16
[ "https://Stackoverflow.com/questions/207938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3165/" ]
207,939
<p>I was wondering if anybody could point me towards a free ftps module for python.</p> <p>I am a complete newbie to python, but this is something I need for a work project. I need an ftps client to connect to a 3rd party ftps server.</p> <p>thanks,</p> <p>David.</p>
[ { "answer_id": 208256, "author": "Glyph", "author_id": 13564, "author_profile": "https://Stackoverflow.com/users/13564", "pm_score": 3, "selected": false, "text": "FTPClient.connectFactory" }, { "answer_id": 215529, "author": "Tony Meyer", "author_id": 4966, "author_p...
2008/10/16
[ "https://Stackoverflow.com/questions/207939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10171/" ]
207,947
<p>How do I get a platform-dependent newline in Java? I can’t use <code>"\n"</code> everywhere.</p>
[ { "answer_id": 207950, "author": "abahgat", "author_id": 27565, "author_profile": "https://Stackoverflow.com/users/27565", "pm_score": 9, "selected": false, "text": "System.getProperty(\"line.separator\");\n" }, { "answer_id": 209771, "author": "Alex B", "author_id": 6180...
2008/10/16
[ "https://Stackoverflow.com/questions/207947", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3713/" ]