qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
171,400
<p>I'd like to know if anyone has any first-hand experience with this dichotomy. A few blogs say the mysql extension is faster than mysqli. Is this true?</p> <p>And I'm only asking about speed. I know mysqli has features that are not present in the older extension.</p>
[ { "answer_id": 17254568, "author": "Donovanr", "author_id": 2047064, "author_profile": "https://Stackoverflow.com/users/2047064", "pm_score": -1, "selected": false, "text": "SELECT * FROM users WHERE ID=$user_id" }, { "answer_id": 20766308, "author": "Josh", "author_id": ...
2008/10/05
[ "https://Stackoverflow.com/questions/171400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3351/" ]
171,407
<p>Has anyone implemented Mozilla's Object.toSource() method for Internet Explorer and other non-Gecko browsers? I'm looking for a lightweight way to serialize simple objects into strings.</p>
[ { "answer_id": 171421, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 2, "selected": false, "text": "Object.prototype.getSource = function() {\n var output = [], temp;\n for (var i in this) {\n if (this.hasOwnPrope...
2008/10/05
[ "https://Stackoverflow.com/questions/171407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4541/" ]
171,412
<p>I basically have an xml column, and I need to find and replace one tag value in each record.</p>
[ { "answer_id": 171429, "author": "Michael Petrotta", "author_id": 23897, "author_profile": "https://Stackoverflow.com/users/23897", "pm_score": 4, "selected": false, "text": "SELECT * FROM Table\nWHERE XMLColumn.exist('/Root/MyElement') = 1\n" }, { "answer_id": 171430, "autho...
2008/10/05
[ "https://Stackoverflow.com/questions/171412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5416/" ]
171,435
<p>I know that the #warning directive is not standard <strong>C</strong>/C++, but several compilers support it, including gcc/g++. But for those that don't support it, will they silently ignore it or will it result in a compile failure? In other words, can I safely use it in my project without breaking the build for compilers that don't support it?</p>
[ { "answer_id": 40147989, "author": "Fantastory", "author_id": 621706, "author_profile": "https://Stackoverflow.com/users/621706", "pm_score": 2, "selected": false, "text": "#ifdef __GNUC__\n//from https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html\n//Instead of put such pragma in...
2008/10/05
[ "https://Stackoverflow.com/questions/171435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78437/" ]
171,452
<p>I've got an app that my client wants to open a kiosk window to ie on startup that goes to their corporate internet. Vb isn't my thing but they wanted it integrated into their current program and I figured it would be easy so I've got</p> <pre><code>Shell ("explorer.exe http://www.corporateintranet.com") </code></pre> <p>and command line thing that needs to be passed is -k</p> <p>Can't figure out where in the hell to drop this to make it work. Thanks in advance! :)</p>
[ { "answer_id": 171459, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 2, "selected": false, "text": "iexplore.exe" }, { "answer_id": 171465, "author": "Community", "author_id": -1, "author_profile": "ht...
2008/10/05
[ "https://Stackoverflow.com/questions/171452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
171,474
<p>I'm curious what tools people have found useful for building flowcharts. Obviously MS Visio and OmniGraffle come to mind but they both feel so bloated and also tend to emphasize the document formatting/printing side and less on helping to organize the actual logic. Is there anything else out there that fellow developers would recommend?</p> <p>I'm hoping to find something fairly simple that would let me throw together flowcharts on the fly when I'm working through complex logic. I don't care about formatting or fonts or the like, just something that would help me keep my logic organized as I work through it. Even something that would arrange the chart itself and simply allow me to specify where to branch and what to check, etc.</p> <p>Any OS would be fine, though I personally lean towards OS X apps as this has recently been my primary work environment.</p>
[ { "answer_id": 173034, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "digraph finite_state_machine {\n rankdir=LR;\n size=\"8,5\"\n node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8;\n ...
2008/10/05
[ "https://Stackoverflow.com/questions/171474", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5291/" ]
171,480
<p>I have a value like this:</p> <pre class="lang-none prettyprint-override"><code>"Foo Bar" "Another Value" something else </code></pre> <p>What regex will return the values enclosed in the quotation marks (e.g. <code>Foo Bar</code> and <code>Another Value</code>)?</p>
[ { "answer_id": 171483, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 9, "selected": false, "text": "\"(.*?)\"\n" }, { "answer_id": 171492, "author": "Martin York", "author_id": 14065, "author_profile":...
2008/10/05
[ "https://Stackoverflow.com/questions/171480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4646/" ]
171,506
<p>I've been unsuccessfully searching for a way to install <code>make</code> utility on my CentOS 5.2. I've looked through some RPM repositories and online, with no avail. Installing <code>gcc</code>, <code>gcc-c++</code> didn't help! Package <code>build-essential</code> is not made for CentOS/RHEL. I have RPMFORGE repo enabled in YUM.</p>
[ { "answer_id": 1539224, "author": "Daniel Von Fange", "author_id": 62621, "author_profile": "https://Stackoverflow.com/users/62621", "pm_score": 5, "selected": false, "text": "yum install make\n" }, { "answer_id": 3523405, "author": "CagedMantis", "author_id": 71002, ...
2008/10/05
[ "https://Stackoverflow.com/questions/171506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18406/" ]
171,512
<p>I wish to implement a 2d bit map class in Python. The class would have the following requirements:</p> <ol> <li><p>Allow the creating of arbitrarily sized 2d bitmaps. i.e. to create an 8 x 8 bitmap (8 bytes), something like:</p> <pre><code>bitmap = Bitmap(8,8) </code></pre></li> <li><p>provide an API to access the bits in this 2d map as boolean or even integer values, i.e.:</p> <pre><code>if bitmap[1, 2] or bitmap.get(0, 1) </code></pre></li> <li><p>Able to retrieve the data as packed Binary data. Essentially it would be each row of the bit map concatenated and returned as Binary data. It may be padded to the nearest byte or something similar.</p> <pre><code>bitmap.data() </code></pre></li> <li><p>Be able to create new maps from the binary data retrieved:</p> <pre><code>new_bitmap = Bitmap(8, 8, bitmap.data()) </code></pre></li> </ol> <p>I know Python is able to perform binary operations, but I'd like some suggestions as how best to use them to implement this class.</p>
[ { "answer_id": 171672, "author": "gimel", "author_id": 6491, "author_profile": "https://Stackoverflow.com/users/6491", "pm_score": 4, "selected": true, "text": ">>> a = np.array([[[1,0,1],\n... [0,1,0]],\n... [[1,1,0],\n... [0,0,1]]])\n>>> b = ...
2008/10/05
[ "https://Stackoverflow.com/questions/171512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10942/" ]
171,516
<p>In my ASP.NET application using InProc sessions, Session_End calls a static method in another object to do session-specific clean up. This clean up uses a shared database connection that I am storing in application state.</p> <p>The problem is that I cannot see how to access the application state without passing it (or rather the database connection) as a parameter to the clean up method. Since I am not in a request I have no current HttpContext, and I cannot find any other static method to access the state.</p> <p>Am I missing something?</p> <p><strong>UPDATE</strong>: It appears that my question needs further clarification, so let me try the following code sample. What I want to be able to do is:</p> <pre><code>// in Global.asax void Session_End(object sender, EventArgs e) { NeedsCleanup nc = Session["NeedsCleanup"] as NeedsCleanup; nc.CleanUp(); } </code></pre> <p>But the problem is that the <code>CleanUp</code> method in turn needs information that is stored in application state. I am already doing the following, but it is exactly what I was hoping to avoid; this is what I meant by "...without passing it... as a parameter to the clean up method" above.</p> <pre><code>// in Global.asax void Session_End(object sender, EventArgs e) { NeedsCleanup nc = Session["NeedsCleanup"] as NeedsCleanup; nc.CleanUp(this.Application); } </code></pre> <p>I just do not like the idea that <code>Global.asax</code> <em>has</em> to know where the <code>NeedsCleanup</code> object gets its information. That sort of thing that makes more sense as self-contained within the class.</p>
[ { "answer_id": 171538, "author": "Greg Dean", "author_id": 1200558, "author_profile": "https://Stackoverflow.com/users/1200558", "pm_score": 1, "selected": false, "text": "void Session_End(object sender, EventArgs e) \n{\n HttpSessionState session = this.Session;\n}\n" }, { "a...
2008/10/05
[ "https://Stackoverflow.com/questions/171516", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6234/" ]
171,519
<p>I'm looking for a way to authenticate users through LDAP with PHP (with Active Directory being the provider). Ideally, it should be able to run on IIS 7 (<a href="http://adldap.sourceforge.net/" rel="noreferrer">adLDAP</a> does it on Apache). Anyone had done anything similar, with success?</p> <ul> <li>Edit: I'd prefer a library/class with code that's ready to go... It'd be silly to invent the wheel when someone has already done so.</li> </ul>
[ { "answer_id": 172042, "author": "ceejayoz", "author_id": 1902010, "author_profile": "https://Stackoverflow.com/users/1902010", "pm_score": 8, "selected": true, "text": "$ldap = ldap_connect(\"ldap.example.com\");\nif ($bind = ldap_bind($ldap, $_POST['username'], $_POST['password'])) {\n...
2008/10/05
[ "https://Stackoverflow.com/questions/171519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18406/" ]
171,529
<p>I have this Task model:</p> <pre><code>class Task &lt; ActiveRecord::Base acts_as_tree :order =&gt; 'sort_order' end </code></pre> <p>And I have this test</p> <pre><code>class TaskTest &lt; Test::Unit::TestCase def setup @root = create_root end def test_destroying_a_task_should_destroy_all_of_its_descendants d1 = create_task(:parent_id =&gt; @root.id, :sort_order =&gt; 2) d2 = create_task(:parent_id =&gt; d1.id, :sort_order =&gt; 3) d3 = create_task(:parent_id =&gt; d2.id, :sort_order =&gt; 4) d4 = create_task(:parent_id =&gt; d1.id, :sort_order =&gt; 5) assert_equal 5, Task.count d1.destroy assert_equal @root, Task.find(:first) assert_equal 1, Task.count end end </code></pre> <p>The test is successful: when I destroy d1, it destroys all the descendants of d1. Thus, after the destroy only the root is left.</p> <p>However, this test is now failing after I have added a before_save callback to the Task. This is the code I added to Task:</p> <pre><code>before_save :update_descendants_if_necessary def update_descendants_if_necessary handle_parent_id_change if self.parent_id_changed? return true end def handle_parent_id_change self.children.each do |sub_task| #the code within the loop is deliberately commented out end end </code></pre> <p>When I added this code, <code>assert_equal 1, Task.count</code> fails, with <code>Task.count == 4</code>. I think <code>self.children</code> under <code>handled_parent_id_change</code> is the culprit, because when I comment out the <code>self.children.each do |sub_task|</code> block, the test passes again.</p> <p>Any ideas?</p>
[ { "answer_id": 172553, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 1, "selected": false, "text": "children" }, { "answer_id": 173169, "author": "gsmendoza", "author_id": 11082, "author_profile": "ht...
2008/10/05
[ "https://Stackoverflow.com/questions/171529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11082/" ]
171,541
<p>I have a service app that creates AppDomain's during the course of its use for long running tasks. I've been tracking these by storing them in a Hashtable with a unique ID.</p> <p>After a task is completed the service app then unloads the AppDomain allocated to that task and then it's removed it from the appdomain Hashtable.</p> <p>Purely from a sanity checking point of view, is there a way I can query the CLR to see what app domains are still loaded by the creating app domain (i.e. so I can compare the tracking Hashtable against what the CLR actually sees)?</p>
[ { "answer_id": 172553, "author": "Orion Edwards", "author_id": 234, "author_profile": "https://Stackoverflow.com/users/234", "pm_score": 1, "selected": false, "text": "children" }, { "answer_id": 173169, "author": "gsmendoza", "author_id": 11082, "author_profile": "ht...
2008/10/05
[ "https://Stackoverflow.com/questions/171541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/419/" ]
171,542
<p>I'm trying to set the width and height of an element with javascript to cover the entire browser viewport, and I'm successful using <pre>document.body.clientHeight</pre> but in IE6 it seems that I always get horizontal and vertical scrollbars because the element must be slightly too big. </p> <p>Now, I really don't want to use browser specific logic and substract a pixel or 2 from each dimension just for IE6. Also, I am not using CSS (width: 100% etc.) for this because I need the pixel amounts.</p> <p>Does anyone know a better way to fill the viewport with an element in IE6+ (obviously all good browsers, too)?</p> <p>Edit: Thanks Owen for the suggestion, I'm sure jQuery will work. I should have specified that I need a toolkit-agnostic solution. </p>
[ { "answer_id": 171544, "author": "micahwittman", "author_id": 11181, "author_profile": "https://Stackoverflow.com/users/11181", "pm_score": 2, "selected": false, "text": "<script type=\"text/javascript\">\n<!--\n\n var viewportwidth;\n var viewportheight;\n\n // the more standards compli...
2008/10/05
[ "https://Stackoverflow.com/questions/171542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25066/" ]
171,548
<p>I have always been for documenting code, but when it comes to AJAX + PHP, it's not always easy: the code is really spread out! Logic, data, presentation - you name it - are split and mixed between server-side and client-side code. Sometimes there's also database-side code (stored procedures, views, etc) doing part of the work.</p> <p>This challenges me to come up with an efficient way to document such code. I usually provide a list of .js files inside .php file as well as list of .php files inside .js file. I also do in-line comments and function descriptions, where I list what function is used by what file and what output is expected. I do similar tasks for database procedures. Maybe there's a better method?</p> <p>Any ideas or experiences?</p> <p>Note: This question applies to any client+server-side applications, not just Javascript+PHP.</p>
[ { "answer_id": 191907, "author": "Ken", "author_id": 20074, "author_profile": "https://Stackoverflow.com/users/20074", "pm_score": 1, "selected": false, "text": "function OutputJs($Content) {\n ob_start();\n echo $Content;\n $expires = DAY_IN_S;\n header(\"Content-type: x-jav...
2008/10/05
[ "https://Stackoverflow.com/questions/171548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18406/" ]
171,550
<blockquote> <p><strong>See also:</strong> <br/> <em><a href="https://stackoverflow.com/questions/4950725">How can I see which Git branches are tracking which remote / upstream branch?</a></em></p> </blockquote> <p>How can I find out which remote branch a local branch is tracking?</p> <p>Do I need to parse <code>git config</code> output, or is there a command that would do this for me?</p>
[ { "answer_id": 7251377, "author": "Aaron Wells", "author_id": 468642, "author_profile": "https://Stackoverflow.com/users/468642", "pm_score": 7, "selected": false, "text": "@{u}" }, { "answer_id": 7733266, "author": "Ajit George", "author_id": 36661, "author_profile":...
2008/10/05
[ "https://Stackoverflow.com/questions/171550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
171,565
<p>Is there a tool/plugin/function for Firefox that'll dump out a memory usage of Javascript objects that you create in a page/script? I know about Firebug's profiler but I'd like something more than just times. Something akin to what Yourkit has for Java profiling of memory usage.</p> <p>Reason is that a co-worker is using id's for "keys" in an array and is creating 1000's of empty slots when he does this. He's of the opinion that this is harmless whereas my opinion differs. I'd like to offer some proof to prove whether I'm right or not.</p>
[ { "answer_id": 172105, "author": "Nickolay", "author_id": 1026, "author_profile": "https://Stackoverflow.com/users/1026", "pm_score": 3, "selected": false, "text": "Array" }, { "answer_id": 22458462, "author": "Jan Wrobel", "author_id": 1031601, "author_profile": "htt...
2008/10/05
[ "https://Stackoverflow.com/questions/171565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8590/" ]
171,566
<p>Im using delphi's ttreeview as an 'options' menu. how would i go upon selecting the next node at runtime like a previous and next button? i tried the getprev and getnext methods but no luck.</p>
[ { "answer_id": 171722, "author": "John Thomas", "author_id": 22599, "author_profile": "https://Stackoverflow.com/users/22599", "pm_score": 3, "selected": false, "text": "procedure TForm8.btn1Click(Sender: TObject); \nvar \n crt: TTreeNode;\n\nbegin\n with tv1 do //this is our tree\n ...
2008/10/05
[ "https://Stackoverflow.com/questions/171566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
171,569
<p>Actually I will want to use that JeOS for our webserver. Is it a good choice?</p>
[ { "answer_id": 171722, "author": "John Thomas", "author_id": 22599, "author_profile": "https://Stackoverflow.com/users/22599", "pm_score": 3, "selected": false, "text": "procedure TForm8.btn1Click(Sender: TObject); \nvar \n crt: TTreeNode;\n\nbegin\n with tv1 do //this is our tree\n ...
2008/10/05
[ "https://Stackoverflow.com/questions/171569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
171,588
<p>If I modify or add an environment variable I have to restart the command prompt. Is there a command I could execute that would do this without restarting CMD?</p>
[ { "answer_id": 171737, "author": "itsadok", "author_id": 7581, "author_profile": "https://Stackoverflow.com/users/7581", "pm_score": 8, "selected": true, "text": "resetvars.vbs" }, { "answer_id": 2479615, "author": "Brian Weed", "author_id": 297617, "author_profile": ...
2008/10/05
[ "https://Stackoverflow.com/questions/171588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3957/" ]
171,596
<p>After having implemented the strategy pattern, I wanted to make an array of the interface-type, to which I can then add any concrete type. </p> <p>For those who don't know the strategy pattern: <a href="http://en.wikipedia.org/wiki/Strategy_pattern" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Strategy_pattern</a> In this particular example I would want to make a StrategyInterface array, which I can then fill with concrete type's A, B and C. However, because this is an abstract class, I can't get it done. Is there a way to do this, or is it completely impossible, without removing the abstract method?</p>
[ { "answer_id": 171605, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": 3, "selected": false, "text": "typedef std::vector<Interface *> Array;\nArray myArray;\nmyArray.push_back(new A());\n" }, { "answer_id": 1...
2008/10/05
[ "https://Stackoverflow.com/questions/171596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23163/" ]
171,601
<p>WPF WebBrowser control looks great but knowledge accumlated over time about WinForms WebBrowser is substantial and it's hard to ignore work like csExWB. It would be nice to know what functional shortcomings or advantages exists in .NET 3.5's WPF WebBrowser control over WinForms WebBrowser control. In particular, is it possible to build csExWB-like functionality on top of WPF WebBrowser?</p>
[ { "answer_id": 1152092, "author": "Marco Luglio", "author_id": 14263, "author_profile": "https://Stackoverflow.com/users/14263", "pm_score": 3, "selected": false, "text": "IsWebBrowserContextMenuEnabled" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/171601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/406313/" ]
171,633
<p>When using one's own iPhone for development it's easy enough to access any crash logs via XCode->Organizer->Crash Logs.</p> <p>How does one access crash logs on another person's phone if they don't have it set up for development in XCode, as would likely be the case if you were distributing your app to them via ad hoc distribution for beta testing?</p>
[ { "answer_id": 4504889, "author": "Simon Whitaker", "author_id": 263871, "author_profile": "https://Stackoverflow.com/users/263871", "pm_score": 4, "selected": false, "text": "~/Library/Logs/CrashReporter/MobileDevice/<DEVICE_NAME>" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/171633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1512/" ]
171,640
<p>In multi-threaded code, when an instance may be read or written by multiple threads, they need to be locked on to perform these operations safely.</p> <p>To avoid the repetition of creating an object to lock on and writing a bunch of lock statements through code, I've created a generic class to handle the locking. </p> <p>Am I missing anything, conceptually? This should work, right?</p> <pre><code>public class Locked&lt;T&gt; where T : new() { private readonly object locker = new object(); private T value; public Locked() : this(default(T)) { } public Locked(T value) { this.value = value; } public T Get() { lock (this.locker) { return this.value; } } public void Set(T value) { lock (this.locker) { this.value = value; } } } </code></pre> <p>And an example of it being used in a class:</p> <pre><code>private Locked&lt;bool&gt; stopWorkerThread = new Locked&lt;bool&gt;(); public void WorkerThreadEntryPoint() { while (true) { if (this.stopWorkerThread.Get()) { break; } </code></pre> <p>Also, how would I test something like this, in an automated way (e.g. create a unit test)?</p> <p>Lastly, what can I do to implement a ++ and -- operator, to avoid this:</p> <pre><code> this.runningThreads.Set(this.runningThreads.Get() + 1); </code></pre>
[ { "answer_id": 171665, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": 1, "selected": false, "text": "this.runningThreads.Set(this.runningThreads.Get() + 1);\n" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/171640", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11574/" ]
171,641
<p>When maintaining a <code>COM</code> interface should an empty <code>BSTR</code> be treated the same way as <code>NULL</code>? In other words should these two function calls produce the same result?</p> <pre><code> // Empty BSTR CComBSTR empty(L""); // Or SysAllocString(L"") someObj-&gt;Foo(empty); // NULL BSTR someObj-&gt;Foo(NULL); </code></pre>
[ { "answer_id": 171644, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": 5, "selected": true, "text": "strlen" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/171641", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
171,662
<p>I'm trying to output a list of string values into a 2 column format. The standard way of making a list of strings into "normal text" is by using the <strong>string.join</strong> method. However, it only takes 2 arguments so I can only make a single column using "\n". I thought trying to make a loop that would simply add a tab between columns would do it but the logic didn't work correctly.</p> <p>I found an <a href="http://code.activestate.com/recipes/302380/" rel="noreferrer">ActiveState page</a> that has a fairly complicated way of doing it but it's from 4 years ago. Is there an easy way to do it nowadays?</p> <hr> <p><strong>Edit</strong> Here is the list that I want to use.</p> <pre><code>skills_defs = ["ACM:Aircraft Mechanic", "BC:Body Combat", "BIO:Biology", "CBE:Combat Engineer", "CHM:Chemistry", "CMP:Computers", "CRM:Combat Rifeman", "CVE:Civil Engineer", "DIS:Disguise", "ELC:Electronics","EQ:Equestrian", "FO:Forward Observer", "FOR:Forage", "FRG:Forgery", "FRM:Farming", "FSH:Fishing", "GEO:Geology", "GS:Gunsmith", "HW:Heavy Weapons", "IF:Indirect Fire", "INS:Instruction", "INT:Interrogation", "JP:Jet Pilot", "LB:Longbow", "LAP:Light Aircraft Pilot", "LCG:Large Caliber Gun", "LNG:Language", "LP:Lockpick", "MC:Melee Combat", "MCY:Motorcycle", "MEC:Mechanic", "MED:Medical", "MET:Meterology", "MNE:Mining Engineer", "MTL:Metallurgy", "MTN:Mountaineering", "NWH:Nuclear Warhead", "PAR:Parachute", "PST:Pistol", "RCN:Recon", "RWP:Rotary Wing Pilot", "SBH:Small Boat Handling","SCD:Scuba Diving", "SCR:Scrounging", "SWM:Swimming", "TW:Thrown Weapon", "TVD:Tracked Vehicle Driver", "WVD:Wheeled Vehicle Driver"] </code></pre> <p>I just want to output this list into a simple, 2 column format to reduce space. Ideally there should be a standard amount of space between the columns but I can work with it.</p> <pre><code>ACM:Aircraft Mechanic BC:Body Combat BIO:Biology CBE:Combat Engineer CHM:Chemistry CMP:Computers CRM:Combat Rifeman CVE:Civil Engineer DIS:Disguise ELC:Electronics EQ:Equestrian FO:Forward Observer FOR:Forage FRG:Forgery FRM:Farming FSH:Fishing GEO:Geology GS:Gunsmith HW:Heavy Weapons IF:Indirect Fire INS:Instruction INT:Interrogation JP:Jet Pilot LB:Longbow LAP:Light Aircraft Pilot LCG:Large Caliber Gun LNG:Language LP:Lockpick MC:Melee Combat MCY:Motorcycle MEC:Mechanic MED:Medical MET:Meterology MNE:Mining Engineer MTL:Metallurgy MTN:Mountaineering NWH:Nuclear Warhead PAR:Parachute PST:Pistol RCN:Recon RWP:Rotary Wing Pilot SBH:Small Boat Handling SCD:Scuba Diving SCR:Scrounging SWM:Swimming TW:Thrown Weapon TVD:Tracked Vehicle Driver WVD:Wheeled Vehicle Driver </code></pre>
[ { "answer_id": 171686, "author": "Douglas Leeder", "author_id": 3978, "author_profile": "https://Stackoverflow.com/users/3978", "pm_score": 0, "selected": false, "text": "data = [ (\"1\",\"2\"),(\"3\",\"4\") ]\nprint \"\\n\".join(map(\"\\t\".join,data))\n" }, { "answer_id": 17170...
2008/10/05
[ "https://Stackoverflow.com/questions/171662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18676/" ]
171,664
<p>I have not used generics much and so cannot figure out if it is possible to turn the following three methods into one using generics to reduce duplication. Actually my code currently has six methods but if you can solve it for the three then the rest should just work anyway with the same solution.</p> <pre><code> private object EvaluateUInt64(UInt64 x, UInt64 y) { switch (Operation) { case BinaryOp.Add: return x + y; case BinaryOp.Subtract: return x - y; case BinaryOp.Multiply: return x * y; case BinaryOp.Divide: return x / y; case BinaryOp.Remainder: return x % y; default: throw new ApplicationException("error"); } } private object EvaluateFloat(float x, float y) { switch(Operation) { case BinaryOp.Add: return x + y; case BinaryOp.Subtract: return x - y; case BinaryOp.Multiply: return x * y; case BinaryOp.Divide: return x / y; case BinaryOp.Remainder: return x % y; default: throw new ApplicationException("error"); } } private object EvaluateDouble(double x, double y) { switch (Operation) { case BinaryOp.Add: return x + y; case BinaryOp.Subtract: return x - y; case BinaryOp.Multiply: return x * y; case BinaryOp.Divide: return x / y; case BinaryOp.Remainder: return x % y; default: throw new ApplicationException("error"); } } </code></pre> <p>I am building a simple expression parser that then needs to evaluate the simple binary operations such as addition/subtraction etc. I use the above methods to get the actual maths performed using the relevant types. But there has got to be a better answer!</p>
[ { "answer_id": 171668, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": " public T Evaluate<T>(T x, T y) {\n switch (Operation)\n {\n case BinaryOp.Add:\n return...
2008/10/05
[ "https://Stackoverflow.com/questions/171664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6276/" ]
171,673
<p>I've been trying to create a Windows Media Player plugin in Visual Studio 2008, and am having great difficulty finding the correct template. MSDN provides advice <a href="http://msdn.microsoft.com/en-us/library/bb262076(VS.85).aspx" rel="nofollow noreferrer">here</a>, but it does not appear to be relevant to VS2008.</p> <p>Can anyone suggest how to start a WMP plugin in Visual Studio?</p> <p>EDIT: Ive accepted this answer because it worked for me, but I'm afraid it isn't the most elegant of solutions. If anyone has a better idea, please add it!</p>
[ { "answer_id": 171668, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": " public T Evaluate<T>(T x, T y) {\n switch (Operation)\n {\n case BinaryOp.Add:\n return...
2008/10/05
[ "https://Stackoverflow.com/questions/171673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11484/" ]
171,694
<p>Many times I will use the same font scheme for static text in a wxPython application. Currently I am making a <code>SetFont()</code> call for each static text object but that seems like a lot of unnecessary work. However, the wxPython demo and wxPython In Action book don't discuss this.</p> <p>Is there a way to easily apply the same <code>SetFont()</code> method to all these text objects without making separate calls each time?</p>
[ { "answer_id": 171702, "author": "kender", "author_id": 4172, "author_profile": "https://Stackoverflow.com/users/4172", "pm_score": 1, "selected": false, "text": "__init__" }, { "answer_id": 182923, "author": "DzinX", "author_id": 18745, "author_profile": "https://Sta...
2008/10/05
[ "https://Stackoverflow.com/questions/171694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18676/" ]
171,699
<p>I'm developing and application that runs as a Windows service. There are other components which include a few WCF services, a client GUI and so on - but it is the Windows service that access the database.</p> <p>So, the application is a long-running server, and I'd like to improve its performance and scalability, I was looking to improve data access among other things. I posted in another thread about second-level caching.</p> <p>This post is about session management for the long-running thread that accesses the database. Should I be using a thread-static context? If so, is there any example of how that would be implemented. </p> <p>Every one around the net who is using NHibernate seem to be heavily focussed on web-application style architectures. There seems to be a great lack of documentation / discussion for non-web app designs.</p> <p>At the moment, my long running thread does this:</p> <ol> <li>Call 3 or 4 DAO methods</li> <li>Verify the state of the detached objects returned.</li> <li>Update the state if needed.</li> <li>Call a couple of DAO methods to persist the updated instances. (pass in the id of the object and the instance itself - the DAO will retrieve the object from the DB again, and set the updated values and session.SaveOrUpdate() before committing the transaction.</li> <li>Sleep for 'n' seconds</li> <li>Repeat all over again!</li> </ol> <p>So, the following is a common pattern we use for each of the DAO methods:</p> <ul> <li>Open session using sessionFactory.OpenSession()</li> <li>Begin transaction</li> <li>Do db work. retrieve / update etc</li> <li>Commit trans</li> <li>(Rollback in case of exceptions)</li> <li>Finally always dispose transaction and session.Close()</li> </ul> <p>This happens for <em>every</em> method call to a DAO class. I suspect this is some sort of an anti-pattern the way we are doing it.</p> <p>However, I'm not able to find enough direction anywhere as to how we could improve it.</p> <p>Pls note, while this thread is running in the background, doing its stuff, there are requests coming in from the WCF clients each of which could make 2-3 DAO calls themselves - sometimes querying/updating the same objects the long running thread deals with.</p> <p>Any ideas / suggestions / pointers to improve our design will be greatly appreciated. If we can get some good discussion going, we could make this a community wiki, and possbily link to here from <a href="http://nhibernate.info" rel="nofollow noreferrer">http://nhibernate.info</a></p> <p>Krishna</p>
[ { "answer_id": 324185, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "private void BeginTransaction(object sender, EventArgs e) {\n NHibernateSessionManager.Instance.BeginTransaction();\n}\npri...
2008/10/05
[ "https://Stackoverflow.com/questions/171699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6995/" ]
171,727
<p>How do i delete all the tables in the schema on Apache Derby DB using JDBC?</p>
[ { "answer_id": 171773, "author": "Telcontar", "author_id": 518, "author_profile": "https://Stackoverflow.com/users/518", "pm_score": 2, "selected": false, "text": "DROP TABLE [tablename]\n" }, { "answer_id": 13928594, "author": "gregn", "author_id": 266387, "author_pr...
2008/10/05
[ "https://Stackoverflow.com/questions/171727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15100/" ]
171,730
<p>I have a small problem with interfaces. Here it is in Pseudo code :</p> <pre><code>type Interface1 = interface end; Interface2 = interface end; TParentClass = class(TInterfacedObject, Interface1) private fChild : Interface2; public procedure AddChild(aChild : Interface2); end; TChildClass = class(TInterfacedObject, Interface2) private fParent : Interface2; public constructor Create(aPArent : Interface1); end; </code></pre> <p>Can anyone see the flaw? I need the child to have a reference to it's parent, but the reference counting doesn't work in this situation. If I create a ParentClass instance, and add a child, then the parent class is never released. I can see why. How do I get round it?</p>
[ { "answer_id": 171795, "author": "Barry Kelly", "author_id": 3712, "author_profile": "https://Stackoverflow.com/users/3712", "pm_score": 4, "selected": true, "text": "TChildClass = class(TInterfacedObject, Interface2)\nprivate\n fParent : Pointer;\n function GetParent: Interface1;\npub...
2008/10/05
[ "https://Stackoverflow.com/questions/171730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22712/" ]
171,765
<p>Here's the very dumb way:</p> <pre><code>def divisorGenerator(n): for i in xrange(1,n/2+1): if n%i == 0: yield i yield n </code></pre> <p>The result I'd like to get is similar to this one, but I'd like a smarter algorithm (this one it's too much slow and dumb :-)</p> <p>I can find prime factors and their multiplicity fast enough. I've an generator that generates factor in this way:</p> <p>(factor1, multiplicity1)<br> (factor2, multiplicity2)<br> (factor3, multiplicity3)<br> and so on...</p> <p>i.e. the output of </p> <pre><code>for i in factorGenerator(100): print i </code></pre> <p>is:</p> <pre><code>(2, 2) (5, 2) </code></pre> <p>I don't know how much is this useful for what I want to do (I coded it for other problems), anyway I'd like a smarter way to make</p> <pre><code>for i in divisorGen(100): print i </code></pre> <p>output this:</p> <pre><code>1 2 4 5 10 20 25 50 100 </code></pre> <hr> <p><strong>UPDATE:</strong> Many thanks to Greg Hewgill and his "smart way" :) Calculating all divisors of 100000000 took 0.01s with his way against the 39s that the dumb way took on my machine, very cool :D</p> <p><strong>UPDATE 2:</strong> Stop saying this is a duplicate of <a href="https://stackoverflow.com/questions/110344/algorithm-to-calculate-the-number-of-divisors-of-a-given-number">this</a> post. Calculating the number of divisor of a given number doesn't need to calculate all the divisors. It's a different problem, if you think it's not then look for "Divisor function" on wikipedia. Read the questions and the answer before posting, if you do not understand what is the topic just don't add not useful and already given answers.</p>
[ { "answer_id": 171779, "author": "Matthew Scharley", "author_id": 15537, "author_profile": "https://Stackoverflow.com/users/15537", "pm_score": 5, "selected": false, "text": "n / i" }, { "answer_id": 171784, "author": "Greg Hewgill", "author_id": 893, "author_profile"...
2008/10/05
[ "https://Stackoverflow.com/questions/171765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21384/" ]
171,771
<p>Okay, so I'm doing my first foray into using the ADO.NET Entity Framework. </p> <p>My test case right now includes a SQL Server 2008 database with 2 tables, Member and Profile, with a 1:1 relationship.</p> <p>I then used the Entity Data Model wizard to auto-generate the EDM from the database. It generated a model with the correct association. Now I want to do this:</p> <pre><code>ObjectQuery&lt;Member&gt; members = entities.Member; IQueryable&lt;Member&gt; membersQuery = from m in members select m; foreach (Member m in membersQuery) { Profile p = m.Profile; ... } </code></pre> <p>Which halfway works. I am able to iterate through all of the Members. But the problem I'm having is that m.Profile is always null. The examples for LINQ to Entities on the MSDN library seem to suggest that I will be able to seamlessly follow the navigation relationships like that, but it doesn't seem to work that way. I found that if I first load the profiles in a separate call somehow, such as using entities.Profile.ToList, then m.Profile will point to a valid Profile.</p> <p>So my question is, is there an elegant way to force the framework to automatically load the data along the navigation relationships, or do I need to do that explicitly with a join or something else?</p> <p>Thanks</p>
[ { "answer_id": 173273, "author": "Gerald", "author_id": 19404, "author_profile": "https://Stackoverflow.com/users/19404", "pm_score": 4, "selected": true, "text": "IQueryable<Member> membersQuery = from m in members.Include(\"Profile\") select m;\n" }, { "answer_id": 329342, ...
2008/10/05
[ "https://Stackoverflow.com/questions/171771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19404/" ]
171,776
<p>I've looked at <a href="http://en.wikipedia.org/wiki/Strategy_pattern" rel="noreferrer">this explanation on Wikipedia</a>, specifically the C++ sample, and fail to recognize the difference between just defining 3 classes, creating instances and calling them, and that example. What I saw was just placing two other classes into the process and cannot see where there would be a benefit. Now I'm sure I'm missing something obvious (wood for the trees) - could someone please explain it using a definitive real-world example?</p> <hr> <p>What I can make from the answers so far, it seems to me to be just a more complex way of doing this:</p> <pre><code>have an abstract class: MoveAlong with a virtual method: DoIt() have class Car inherit from MoveAlong, implementing DoIt() { ..start-car-and-drive..} have class HorseCart inherit from MoveAlong, implementing DoIt() { ..hit-horse..} have class Bicycle inherit from MoveAlong, implementing DoIt() { ..pedal..} now I can call any function taking MoveAlong as parm passing any of the three classes and call DoIt Isn't this what Strategy intents? (just simpler?) </code></pre> <p>[Edit-update] The function I refer to above is replaced with another class in which MoveAlong would be attribute which is set according to need based on the algorithm implemented in this new class. (Similar to what is demonstrated in the accepted answer.)</p> <hr> <p>[Edit-update] <strong>Conclusion</strong></p> <p>The Strategy Pattern has it's uses, but I am a strong believer in KISS, and would tend to more straightforward and less obfuscatory techniques. Mostly since I want to pass on easily maintainable code (and 'cos I'll most likely be the one who have to make the changes!).</p>
[ { "answer_id": 171781, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 1, "selected": false, "text": "execute" }, { "answer_id": 171782, "author": "Garth Gilmour", "author_id": 2635682, "author_profile": "h...
2008/10/05
[ "https://Stackoverflow.com/questions/171776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15161/" ]
171,778
<p>Using NHibernate from C# and only HQL (not SQL) in a way that is compatible with MS SQL Server 2005/2008 (and preferably Oracle).</p> <p>Is there a way to write the order by clause so that nulls will sort at the end of the query results while the non-null results will be sorted in ascending order?</p> <p>Based on the answer to the question referenced by nickf the answer is:</p> <pre><code>select x from MyClass x order by case when x.MyProperty is null then 1 else 0 end, x.MyProperty </code></pre>
[ { "answer_id": 171781, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 1, "selected": false, "text": "execute" }, { "answer_id": 171782, "author": "Garth Gilmour", "author_id": 2635682, "author_profile": "h...
2008/10/05
[ "https://Stackoverflow.com/questions/171778", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3509/" ]
171,785
<p>When it comes to organizing python modules, my Mac OS X system is a mess. I've packages lying around everywhere on my hdd and no particular system to organize them.</p> <p>How do you keep everything manageable?</p>
[ { "answer_id": 172538, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 3, "selected": false, "text": "Components" }, { "answer_id": 173715, "author": "codeape", "author_id": 3571, "author_profile": "https:...
2008/10/05
[ "https://Stackoverflow.com/questions/171785", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20672/" ]
171,809
<p>Are there LaTeX packages for (more or less) easily drawing Gantt diagrams?</p> <p>Thanks.</p>
[ { "answer_id": 2772068, "author": "ablaeul", "author_id": 331618, "author_profile": "https://Stackoverflow.com/users/331618", "pm_score": 2, "selected": false, "text": "\\psline" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/171809", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11384/" ]
171,816
<p>(The original question was asked there : <a href="http://www.ogre3d.org/phpBB2/viewtopic.php?t=44832" rel="nofollow noreferrer">http://www.ogre3d.org/phpBB2/viewtopic.php?t=44832</a> )</p> <p>Someone asked : "While I would like to build everything in vs2008 (VC9), the PhysX SDK is built with vs2005 (VC8). Would this cause any problems, using all vc9 compiled libs and used in combination with this vc8 lib?"</p> <p>I answered that the day before i tried to use a .lib file (and a .dll) generated with VC8 and include it in a vc9 compiled exe, the compiler couldn't open the .lib file.</p> <p>Now, other answered they did this with no problems....</p> <p>I can't find the information about lib compatibility between vc9 and vc8. </p> <p>so... Help?</p>
[ { "answer_id": 2772068, "author": "ablaeul", "author_id": 331618, "author_profile": "https://Stackoverflow.com/users/331618", "pm_score": 2, "selected": false, "text": "\\psline" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/171816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2368/" ]
171,824
<p>I have a plug-in to an Eclipse RCP application that has a view. After an event occurs in the RCP application, the plug-in is instantiated, its methods are called to populate the plug-in's model, but I cannot find how to make the view appear without going to the "Show View..." menu.</p> <p>I would think that there would be something in the workbench singleton that could handle this, but I have not found out how anywhere.</p>
[ { "answer_id": 172082, "author": "ILikeCoffee", "author_id": 25270, "author_profile": "https://Stackoverflow.com/users/25270", "pm_score": 7, "selected": true, "text": "PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(\"viewId\");\n" }, { "answer_id":...
2008/10/05
[ "https://Stackoverflow.com/questions/171824", "https://Stackoverflow.com", "https://Stackoverflow.com/users/725/" ]
171,828
<p>When receiving a bug report or an it-doesnt-work message one of my initials questions is always what version? With a different builds being at many stages of testing, planning and deploying this is often a non-trivial question.</p> <p>I the case of releasing Java JAR (ear, jar, rar, war) files I would like to be able to look in/at the JAR and switch to the same branch, version or tag that was the source of the released JAR.</p> <p>How can I best adjust the ant build process so that the version information in the svn checkout remains in the created build?</p> <p>I was thinking along the lines of:</p> <ul> <li>adding a VERSION file, but with what content?</li> <li>storing information in the META-INF file, but under what property with which content?</li> <li>copying sources into the result archive</li> <li>added svn:properties to all sources with keywords in places the compiler leaves them be</li> </ul> <hr> <p>I ended up using the svnversion approach (the accepted anwser), because it scans the entire subtree as opposed to svn info which just looks at the current file / directory. For this I defined the SVN task in the ant file to make it more portable. </p> <pre><code>&lt;taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask"&gt; &lt;classpath&gt; &lt;pathelement location="${dir.lib}/ant/svnant.jar"/&gt; &lt;pathelement location="${dir.lib}/ant/svnClientAdapter.jar"/&gt; &lt;pathelement location="${dir.lib}/ant/svnkit.jar"/&gt; &lt;pathelement location="${dir.lib}/ant/svnjavahl.jar"/&gt; &lt;/classpath&gt; &lt;/taskdef&gt; </code></pre> <p>Not all builds result in webservices. The ear file before deployment must remain the same name because of updating in the application server. Making the file executable is still an option, but until then I just include a version information file.</p> <pre><code>&lt;target name="version"&gt; &lt;svn&gt;&lt;wcVersion path="${dir.source}"/&gt;&lt;/svn&gt; &lt;echo file="${dir.build}/VERSION"&gt;${revision.range}&lt;/echo&gt; &lt;/target&gt; </code></pre> <p>Refs:<br> svnrevision: <a href="http://svnbook.red-bean.com/en/1.1/re57.html" rel="noreferrer">http://svnbook.red-bean.com/en/1.1/re57.html</a><br> svn info <a href="http://svnbook.red-bean.com/en/1.1/re13.html" rel="noreferrer">http://svnbook.red-bean.com/en/1.1/re13.html</a><br> subclipse svn task: <a href="http://subclipse.tigris.org/svnant/svn.html" rel="noreferrer">http://subclipse.tigris.org/svnant/svn.html</a><br> svn client: <a href="http://svnkit.com/" rel="noreferrer">http://svnkit.com/</a></p>
[ { "answer_id": 171859, "author": "Blair Conrad", "author_id": 1199, "author_profile": "https://Stackoverflow.com/users/1199", "pm_score": 2, "selected": false, "text": "svn info" }, { "answer_id": 171927, "author": "Peter Hilton", "author_id": 2670, "author_profile": ...
2008/10/05
[ "https://Stackoverflow.com/questions/171828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16352/" ]
171,835
<p><a href="http://oreilly.com/catalog/9780596515829/" rel="nofollow noreferrer">Python for Unix and Linux System Administration</a> is aimed at sysadmins. Any other favorites besides this.</p>
[ { "answer_id": 1149731, "author": "ghostdog74", "author_id": 131527, "author_profile": "https://Stackoverflow.com/users/131527", "pm_score": 3, "selected": false, "text": " for line in open(\"file\"):\n print line\n" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/171835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11065/" ]
171,849
<p>I have a program that spits out an Excel workbook in Excel 2003 XML format. It works fine with one problem, I cannot get the column widths to set automatically.</p> <p>A snippet of what I produce:</p> <pre><code> &lt;Table &gt; &lt;Column ss:AutoFitWidth="1" ss:Width="2"/&gt; &lt;Row ss:AutoFitHeight="0" ss:Height="14.55"&gt; &lt;Cell ss:StyleID="s62"&gt;&lt;Data ss:Type="String"&gt;Database&lt;/Data&gt;&lt;/Cell&gt; </code></pre> <p>This does not set the column to autofit. I have tried not setting width, I have tried many things and I am stuck.</p> <p>Thanks.</p>
[ { "answer_id": 26046306, "author": "Mathijs Beentjes", "author_id": 4080802, "author_profile": "https://Stackoverflow.com/users/4080802", "pm_score": 0, "selected": false, "text": " <xsl:for-each select=\"/*/*[1]/*\">\n <Column>\n <xsl:variable name=\"columnNum\" select=\"...
2008/10/05
[ "https://Stackoverflow.com/questions/171849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5189/" ]
171,855
<p>I want to update a list of storage devices as the user inserts USB keys, adds external disks and mounts disk images. IOKit's IOServiceAddInterestNotification looks like the way to go, but the obvious use of registering general interest in kIOMediaClass only gives you notifications for unmounting of volumes and then only sometimes.</p> <p>What's the right way to do this?</p>
[ { "answer_id": 171973, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "/Volumes" }, { "answer_id": 194691, "author": "Rhythmic Fistman", "author_id": 22147, "author_profile": "h...
2008/10/05
[ "https://Stackoverflow.com/questions/171855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22147/" ]
171,862
<p>When authoring a library in a particular namespace, it's often convenient to provide overloaded operators for the classes in that namespace. It seems (at least with g++) that the overloaded operators can be implemented either in the library's namespace:</p> <pre><code>namespace Lib { class A { }; A operator+(const A&amp;, const A&amp;); } // namespace Lib </code></pre> <p>or the global namespace</p> <pre><code>namespace Lib { class A { }; } // namespace Lib Lib::A operator+(const Lib::A&amp;, const Lib::A&amp;); </code></pre> <p>From my testing, they both seem to work fine. Is there any practical difference between these two options? Is either approach better?</p>
[ { "answer_id": 171881, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 2, "selected": false, "text": "namespace Lib {\n\nclass A {\npublic:\n A operator+(const A&);\n};\n\n} // namespace Lib\n" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/171862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/78437/" ]
171,868
<p>When you take your first look at an Oracle database, one of the first questions is often "where's the alert log?". Grid Control can tell you, but its often not available in the environment.</p> <p>I posted some bash and Perl scripts to find and tail the alert log <a href="http://tardate.blogspot.com/2007/04/find-and-tail-oracle-alert-log.html" rel="nofollow noreferrer">on my blog</a> some time back, and I'm surprised to see that post still getting lots of hits.</p> <p>The technique used is to lookup background_dump_dest from v$parameter. But I only tested this on Oracle Database 10g.</p> <p>Is there a better approach than this? And does anyone know if this still works in 11g?</p>
[ { "answer_id": 172936, "author": "pjf", "author_id": 19422, "author_profile": "https://Stackoverflow.com/users/19422", "pm_score": 2, "selected": false, "text": "File::Tail::App" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/171868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6329/" ]
171,873
<p>I try to write KSH script for processing a file consisting of name-value pairs, several of them on each line.</p> <p>Format is:</p> <pre><code>NAME1 VALUE1,NAME2 VALUE2,NAME3 VALUE3, etc </code></pre> <p>Suppose I write:</p> <pre><code>read l IFS="," set -A nvls $l echo "$nvls[2]" </code></pre> <p>This will give me second name-value pair, nice and easy. Now, suppose that the task is extended so that values could include commas. They should be escaped, like this:</p> <pre><code>NAME1 VALUE1,NAME2 VALUE2_1\,VALUE2_2,NAME3 VALUE3, etc </code></pre> <p>Obviously, my code no longer works, since "read" strips all quoting and second element of array will be just "NAME2 VALUE2_1". </p> <p>I'm stuck with older ksh that does not have "read -A array". I tried various tricks with "read -r" and "eval set -A ....", to no avail. I can't use "read nvl1 nvl2 nvl3" to do unescaping and splitting inside read, since I dont know beforehand how many name-value pairs are in each line.</p> <p>Does anyone have a useful trick up their sleeve for me?</p> <p>PS I know that I have do this in a nick of time in Perl, Python, even in awk. However, I have to do it in ksh (... or die trying ;)</p>
[ { "answer_id": 171945, "author": "ADEpt", "author_id": 10105, "author_profile": "https://Stackoverflow.com/users/10105", "pm_score": 1, "selected": false, "text": "sed -e 's/\\([^\\]\\),/\\1\\\n/g;s/$/\\\n/\n" }, { "answer_id": 249153, "author": "Bill Karwin", "author_id"...
2008/10/05
[ "https://Stackoverflow.com/questions/171873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10105/" ]
171,917
<h2>Context:</h2> <p>A while ago, I stumbled upon this 2001 DDJ article by Alexandrescu: <a href="http://www.ddj.com/cpp/184403799" rel="noreferrer">http://www.ddj.com/cpp/184403799</a></p> <p>It's about comparing various ways to initialized a buffer to some value. Like what "memset" does for single-byte values. He compared various implementations (memcpy, explicit "for" loop, duff's device) and did not really find the best candidate across all dataset sizes and all compilers.</p> <p>Quote:</p> <blockquote> <p>There is a very deep, and sad, realization underlying all this. We are in 2001, the year of the Spatial Odyssey. (...) Just step out of the box and look at us — after 50 years, we're still not terribly good at filling and copying memory.</p> </blockquote> <h2>Question:</h2> <ol> <li>does anyone have more recent information about this problem ? Do recent GCC and Visual C++ implementations perform significantly better than 7 years ago ? <li>I'm writing code that has a lifetime of 5+ (probably 10+) years and that will process arrays' sizes from a few bytes to hundred of megabytes. I can't assume that my choices now will still be optimal in 5 years. What should I do: <ul> <li>a) use the system's memset (or equivalent) and forget about optimal performance or assume the runtime and compiler will handle this for me. <li>b) benchmark once and for all on various array sizes and compilers and switch at runtime between several routines. <li>c) run the benchmark at program initialization and switch at runtime based on accurate (?) data. </ul> </ol> <p>Edit: I'm working on image processing software. My array items are PODs and every millisecond counts !</p> <p>Edit 2: Thanks for the first answers, here are some additional informations:<ul><li>Buffer initialization may represent 20%-40% of total runtime of some algorithms. <li>The platform may vary in the next 5+ years, although it will stay in the "fastest CPU money can buy from DELL" category. Compilers will be some form of GCC and Visual C++. No embedded stuff or exotic architectures on the radar<li>I'd like to hear from people who had to update their software when MMX and SSE appeared, since I'll have to do the same when "SSE2015" becomes available... :) </ul></p>
[ { "answer_id": 172489, "author": "Zooba", "author_id": 891, "author_profile": "https://Stackoverflow.com/users/891", "pm_score": 3, "selected": false, "text": "for" }, { "answer_id": 173572, "author": "Skizz", "author_id": 1898, "author_profile": "https://Stackoverflo...
2008/10/05
[ "https://Stackoverflow.com/questions/171917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20055/" ]
171,924
<p>Is it possible to check a bash script syntax without executing it?</p> <p>Using Perl, I can run <code>perl -c 'script name'</code>. Is there any equivalent command for bash scripts?</p>
[ { "answer_id": 171932, "author": "andy", "author_id": 6152, "author_profile": "https://Stackoverflow.com/users/6152", "pm_score": 10, "selected": true, "text": "bash -n scriptname\n" }, { "answer_id": 4874883, "author": "Jeevan", "author_id": 600032, "author_profile":...
2008/10/05
[ "https://Stackoverflow.com/questions/171924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13523/" ]
171,928
<p>I am using the <a href="https://jqueryui.com/dialog/" rel="noreferrer"><code>jquery-ui-dialog</code></a> plugin</p> <p>I am looking for way to refresh the page when in some circumstances when the dialog is closed.</p> <p>Is there a way to capture a close event from the dialog?</p> <p>I know I can run code when the close button is clicked but that doesn't cover the user closing with escape or the x in the top right corner.</p>
[ { "answer_id": 172000, "author": "Brownie", "author_id": 6600, "author_profile": "https://Stackoverflow.com/users/6600", "pm_score": 9, "selected": true, "text": " $('div#popup_content').on('dialogclose', function(event) {\n alert('closed');\n });\n" }, { "answer_id": 172506,...
2008/10/05
[ "https://Stackoverflow.com/questions/171928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6600/" ]
171,948
<p>I've been hearing a lot about about how the new version of VMWare Fusion can run virtual operating systems in "headless mode". </p> <p>A Google search makes it clear that other virtualisation products also have similar features, however, I have not been able to find a good description of what this actually means? What is happening when you do this?</p>
[ { "answer_id": 171951, "author": "Binarytales", "author_id": 319, "author_profile": "https://Stackoverflow.com/users/319", "pm_score": 2, "selected": false, "text": "defaults write com.vmware.fusion fluxCapacitor -bool YES\n" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/171948", "https://Stackoverflow.com", "https://Stackoverflow.com/users/319/" ]
171,952
<p>Is there a destructor for Java? I don't seem to be able to find any documentation on this. If there isn't, how can I achieve the same effect?</p> <p>To make my question more specific, I am writing an application that deals with data and the specification say that there should be a 'reset' button that brings the application back to its original just launched state. However, all data have to be 'live' unless the application is closed or reset button is pressed.</p> <p>Being usually a C/C++ programmer, I thought this would be trivial to implement. (And hence I planned to implement it last.) I structured my program such that all the 'reset-able' objects would be in the same class so that I can just destroy all 'live' objects when a reset button is pressed.</p> <p>I was thinking if all I did was just to dereference the data and wait for the garbage collector to collect them, wouldn't there be a memory leak if my user repeatedly entered data and pressed the reset button? I was also thinking since Java is quite mature as a language, there should be a way to prevent this from happening or gracefully tackle this.</p>
[ { "answer_id": 171955, "author": "flicken", "author_id": 12880, "author_profile": "https://Stackoverflow.com/users/12880", "pm_score": 4, "selected": false, "text": "java.lang.Object#finalize" }, { "answer_id": 171956, "author": "Shimi Bandiel", "author_id": 15100, "a...
2008/10/05
[ "https://Stackoverflow.com/questions/171952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18500/" ]
171,962
<p>I'm storing all localizable strings in a <code>ResourceDictionary</code> (in <code>App.xaml</code>) and assign those via the <code>StaticResource</code> markup extension to <code>TextBlock.Text</code>, <code>Button.Content</code> etc.</p> <p>In Beta 2 and RC0, <em>sometimes</em> parsing the XAML in <code>InitializeComponent()</code> will fail with an <code>AG_E_PARSER_BAD_PROPERTY_VALUE</code> on the line and position where I set the attribute value to the <code>StaticResource</code>.</p> <p>It only happens sometimes: When restarting the app, it parses and displays without any problems. The same interface code works for days or weeks, then it happens again.</p> <p>Any ideas?</p>
[ { "answer_id": 179607, "author": "Brian Leahy", "author_id": 580, "author_profile": "https://Stackoverflow.com/users/580", "pm_score": 2, "selected": false, "text": "Text=\"{StaticResource bleh}\" \n" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/171962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23222/" ]
171,970
<p>When logging in C#, how can I learn the name of the method that called the current method? I know all about <code>System.Reflection.MethodBase.GetCurrentMethod()</code>, but I want to go one step beneath this in the stack trace. I've considered parsing the stack trace, but I am hoping to find a cleaner more explicit way, something like <code>Assembly.GetCallingAssembly()</code> but for methods.</p>
[ { "answer_id": 171974, "author": "Firas Assaad", "author_id": 23153, "author_profile": "https://Stackoverflow.com/users/23153", "pm_score": 10, "selected": true, "text": "using System.Diagnostics;\n// Get call stack\nStackTrace stackTrace = new StackTrace(); \n// Get calling method name\...
2008/10/05
[ "https://Stackoverflow.com/questions/171970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/470/" ]
171,999
<p>How can I extract the whole line in a row, for example, row 3. These data are saved in my text editor in linux. Here's my data:</p> <pre><code>1,julz,kath,shiela,angel 2,may,ann,janice,aika 3,christal,justine,kim 4,kris,allan,jc,mine </code></pre> <p>I want output like:</p> <pre><code>3,christal,justine,kim </code></pre>
[ { "answer_id": 172005, "author": "Adam Bellaire", "author_id": 21632, "author_profile": "https://Stackoverflow.com/users/21632", "pm_score": 2, "selected": false, "text": "open $fh, \"myfile.txt\";\nmy @lines = <$fh>;\n" }, { "answer_id": 172017, "author": "jfs", "author_...
2008/10/05
[ "https://Stackoverflow.com/questions/171999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
172,018
<p>Is there a way to exclude all svn externals when doing a recursive update?</p> <p>Is there a way to exclude only 1 of all of the svn externals when doing a recursive update?</p> <p>Basically I'd like to cut down the svn update time, and a couple of the SVN externals that I have will just about never get updated.</p>
[ { "answer_id": 172043, "author": "Adam Bellaire", "author_id": 21632, "author_profile": "https://Stackoverflow.com/users/21632", "pm_score": 6, "selected": true, "text": "> svn update --ignore-externals\n" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/172018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
172,066
<p>I'd like to create a subset of Users that don't have a login... basically as a way to add a photographer field to photos without having a full blown account associated with that person (since in many cases, they'll never actually log in to the site). A caveat is that I'd also like to be able to enable an account for them later.</p> <p>So, I think the question becomes what's the best way to set up a "People" table that ties to the User table without actually extending the User table with UserProfile.</p>
[ { "answer_id": 172097, "author": "Jonny Buchanan", "author_id": 6760, "author_profile": "https://Stackoverflow.com/users/6760", "pm_score": 4, "selected": true, "text": "django.contrib.auth.models.User.get_profile" }, { "answer_id": 172464, "author": "S.Lott", "author_id"...
2008/10/05
[ "https://Stackoverflow.com/questions/172066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25274/" ]
172,095
<p>I'm doing some experiments with Microsoft Dynamics CRM. You interact with it through web services and I have added a Web Reference to my project. The web service interface is very rich, and the generated "Reference.cs" is some 90k loc. </p> <p>I'm using the web reference in a console application. I often change something, recompile and run. Compilation is fast, but newing up the web service reference is very slow, taking some 15-20 seconds: <code> CrmService service = new CrmService(); </code> Profiling reveals that all time is spent in the SoapHttpClientProtocol constructor.</p> <p>The culprit is apparently the fact that the XML serialization code (not included in the 90k loc mentioned above) is generated at run time, before being JIT'ed. This happens during the constructor call. The wait is rather frustrating when playing around and trying things out.</p> <p>I've tried various combinations of sgen.exe, ngen and XGenPlus (which takes several hours and generates 500MB of additional code) but to no avail. I've considered implementing a Windows service that have few CrmService instances ready to dish out when needed but that seems excessive.</p> <p>Any ideas?</p>
[ { "answer_id": 172106, "author": "Alex Lyman", "author_id": 5897, "author_profile": "https://Stackoverflow.com/users/5897", "pm_score": 1, "selected": false, "text": "Sgen.exe" }, { "answer_id": 965857, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile...
2008/10/05
[ "https://Stackoverflow.com/questions/172095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2942/" ]
172,110
<p>How can I elegantly print the date in RFC822 format in Perl?</p>
[ { "answer_id": 172119, "author": "njsf", "author_id": 4995, "author_profile": "https://Stackoverflow.com/users/4995", "pm_score": 6, "selected": true, "text": "use POSIX qw(strftime);\nprint strftime(\"%a, %d %b %Y %H:%M:%S %z\", localtime(time())) . \"\\n\";\n" }, { "answer_id":...
2008/10/05
[ "https://Stackoverflow.com/questions/172110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13523/" ]
172,111
<p>Is it possible to get notified (without polling, but via an event) when a drive letter becomes accessible. For example if you have an external hard drive that always appears as drive F - is it possible to have an event raised when that is connected and F becomes accessible?</p>
[ { "answer_id": 172119, "author": "njsf", "author_id": 4995, "author_profile": "https://Stackoverflow.com/users/4995", "pm_score": 6, "selected": true, "text": "use POSIX qw(strftime);\nprint strftime(\"%a, %d %b %Y %H:%M:%S %z\", localtime(time())) . \"\\n\";\n" }, { "answer_id":...
2008/10/05
[ "https://Stackoverflow.com/questions/172111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1912/" ]
172,125
<p>Memory (and resource) leaks happen. How do you make sure they don't?</p> <p>What tips &amp; techniques would you suggest to help avoid creating memory leaks in first place?</p> <p>Once you have an application that is leaking how do you track down the source of leaks?</p> <p>(Oh and please avoid the "just use GC" answer. Until the iPhone supports GC this isn't a valid answer, and even then - it is possible to leak resources and memory on GC)</p>
[ { "answer_id": 172243, "author": "mmalc", "author_id": 23233, "author_profile": "https://Stackoverflow.com/users/23233", "pm_score": 4, "selected": false, "text": "cd" }, { "answer_id": 172270, "author": "mmalc", "author_id": 23233, "author_profile": "https://Stackove...
2008/10/05
[ "https://Stackoverflow.com/questions/172125", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23113/" ]
172,130
<p>Is there a way to stop the path showing in a source code tab in Visual Studio 2008?</p> <p>Currently when developing an ASP.NET site, I get the path from the root plus the filename - truncated when it gets too long. So something like:</p> <blockquote> <p>MyDir/MyPage.aspx</p> </blockquote> <p>for a short path and filename, or:</p> <blockquote> <p>MyDir/MyLong...yPage.aspx</p> </blockquote> <p>for a longer path and filename.</p> <p>I'd prefer to see just the filename (ie just MyPage.aspx), allowing more tabs to show at once and making it easier to see which files I have open without using the drop-down list or Crtl-Tab to show the full set.</p> <p>In VS2005, I just get the filename - no path however long it is. Oddly in VS2003 I get the path and filename. I've scoured the options and I can't find a setting that lets me change what appears in the tabs. Searching suggests that other people have similar issues (although which version it occurs in appears to differ) but no-one could identify an option to change what appears.</p> <p>Can anyone point me in the right direction to get rid of the paths in the tabs (or confirm that it can't be changed to save me wasting more time searching)?</p>
[ { "answer_id": 172243, "author": "mmalc", "author_id": 23233, "author_profile": "https://Stackoverflow.com/users/23233", "pm_score": 4, "selected": false, "text": "cd" }, { "answer_id": 172270, "author": "mmalc", "author_id": 23233, "author_profile": "https://Stackove...
2008/10/05
[ "https://Stackoverflow.com/questions/172130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4733/" ]
172,151
<p>I want to write a program in which plays an audio file that reads a text. I want to highlite the current syllable that the audiofile plays in green and the rest of the current word in red. What kind of datastructure should I use to store the audio file and the information that tells the program when to switch to the next word/syllable?</p>
[ { "answer_id": 221712, "author": "Marcus Downing", "author_id": 1000, "author_profile": "https://Stackoverflow.com/users/1000", "pm_score": 3, "selected": true, "text": "{\\K132}Unmei {\\K34}no {\\K54}tobira\n{\\K60}{\\K132}yukkuri {\\K36}to {\\K142}hirakareta\n" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/172151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25282/" ]
172,175
<p>Here's my code in a gridview that is bound at runtime:</p> <pre><code>... &lt;asp:templatefield&gt; &lt;edititemtemplate&gt; &lt;asp:dropdownlist runat="server" id="ddgvOpp" /&gt; &lt;/edititemtemplate&gt; &lt;itemtemplate&gt; &lt;%# Eval("opponent.name") %&gt; &lt;/itemtemplate&gt; &lt;/asp:templatefield&gt; ... </code></pre> <p>I want to bind the dropdownlist "ddgvOpp" but i don't know how. I should, but I don't. Here's what I have, but I keep getting an "Object reference" error, which makes sense:</p> <pre><code>protected void gvResults_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) //skip header row { DropDownList ddOpp = (DropDownList)e.Row.Cells[5].FindControl("ddgvOpp"); BindOpponentDD(ddOpp); } } </code></pre> <p>Where <code>BindOpponentDD()</code> is just where the DropDownList gets populated. Am I not doing this in the right event? If not, which do I need to put it in?</p> <p>Thanks so much in advance...</p>
[ { "answer_id": 172220, "author": "Jason", "author_id": 7173, "author_profile": "https://Stackoverflow.com/users/7173", "pm_score": 4, "selected": true, "text": "if (myGridView.EditIndex == e.Row.RowIndex)\n{\n //do work\n}\n" }, { "answer_id": 1198319, "author": "Communit...
2008/10/05
[ "https://Stackoverflow.com/questions/172175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7173/" ]
172,176
<p>What is the best way to deal with storing and indexing URL's in SQL Server 2005? </p> <p>I have a WebPage table that stores metadata and content about Web Pages. I also have many other tables related to the WebPage table. They all use URL as a key. </p> <p>The problem is URL's can be very large, and using them as a key makes the indexes larger and slower. How much I don't know, but I have read many times using large fields for indexing is to be avoided. Assuming a URL is nvarchar(400), they are enormous fields to use as a primary key.</p> <p>What are the alternatives? </p> <p>How much pain would there likely to be with using URL as a key instead of a smaller field.</p> <p>I have looked into the WebPage table having a identity column, and then using this as the primary key for a WebPage. This keeps all the associated indexes smaller and more efficient but it makes importing data a bit of a pain. Each import for the associated tables has to first lookup what the id of a url is before inserting data in the tables.</p> <p>I have also played around with using a hash on the URL, to create a smaller index, but am still not sure if it is the best way of doing things. It wouldn't be a unique index, and would be subject to a small number of collisions. So I am unsure what foreign key would be used in this case...</p> <p>There will be millions of records about webpages stored in the database, and there will be a lot of batch updating. Also there will be a quite a lot of activity reading and aggregating the data.</p> <p>Any thoughts?</p>
[ { "answer_id": 172205, "author": "Dylan Beattie", "author_id": 5017, "author_profile": "https://Stackoverflow.com/users/5017", "pm_score": 3, "selected": true, "text": "CREATE FUNCTION GetUrlId (@Url nvarchar(400)) \nRETURNS int\nAS BEGIN\n DECLARE @UrlId int\n SELECT @UrlId = Id FROM ...
2008/10/05
[ "https://Stackoverflow.com/questions/172176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1982/" ]
172,192
<p>I am working on a web-application in which dynamically-created images are used to display information. This data is currently sent to the images using a GET query-string but with more complex images and data I am worried about running into problems with the url character limit.</p> <p>I could simply pass the record ID to the image and have this query the database but this would obviously increase demand on the server. Is there some way I could add an image retrieved using POST into a HTML document?</p>
[ { "answer_id": 172292, "author": "Jacob", "author_id": 8119, "author_profile": "https://Stackoverflow.com/users/8119", "pm_score": 0, "selected": false, "text": "<? //index.php\n $_SESSION['imagedata']['header'] = array('name'=>'Simon','backgroundcolor'=>'red');\n echo '<img src=\"...
2008/10/05
[ "https://Stackoverflow.com/questions/172192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16822/" ]
172,199
<p>Where can I find a list of all types of bsd style socket errors?</p>
[ { "answer_id": 172273, "author": "bortzmeyer", "author_id": 15625, "author_profile": "https://Stackoverflow.com/users/15625", "pm_score": 4, "selected": true, "text": "% man connect\n...\n ECONNREFUSED\n No-one listening on the remote address.\n EISCONN\n The socket i...
2008/10/05
[ "https://Stackoverflow.com/questions/172199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4946/" ]
172,208
<p>We're starting a large web project, mostly green field. I like the Tapestry framework for java/web solutions. I have concerns about starting a Tapestry 5 project since T5 is still in beta. However, if I understand the documentation correctly, T4 development will not be supported by T5 and up. My question: Should I begin a large project for a large company with T5? If not, with the imminent release of T5, should I ignore T4 altogether?</p>
[ { "answer_id": 371982, "author": "Chochos", "author_id": 10165, "author_profile": "https://Stackoverflow.com/users/10165", "pm_score": 3, "selected": false, "text": "@Property" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/172208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
172,209
<p>Can perforce be adjusted so I don't need to "open files for edit"? Someone told me that this was a "feature", and that s/he guessed it could be turned off.</p>
[ { "answer_id": 172765, "author": "PhiLho", "author_id": 15459, "author_profile": "https://Stackoverflow.com/users/15459", "pm_score": 1, "selected": false, "text": "command.name.0.*=P4 edit\ncommand.0.*=p4 edit -c default $(FileNameExt)\ncommand.save.before.0.*=2\n" }, { "answer_...
2008/10/05
[ "https://Stackoverflow.com/questions/172209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9987/" ]
172,223
<p>From the Apple <a href="http://developer.apple.com/internet/safari/faq.html" rel="noreferrer">developer faq</a></p> <blockquote> <p>Safari ships with a conservative cookie policy which limits cookie writes to only the pages chosen ("navigated to") by the user.</p> </blockquote> <p>By default Safari only allows cookies from sites you navigate to directly. (i.e. if you click on links with the url of that domainname).</p> <p>This means that if you load a page from your own site with an iFrame with a page from another site, that the other site is not able to set cookies. (for instance, a ticketshop). As soon as you have visited the other domain directly, the other site is able to access and change its own cookies. </p> <p>Without having access to code on the other site, how can i make the user-experience as inobtrusive as possible?</p> <p>Is there a (javascript?) way to check if the other site's cookies are already set, and accordingly, show a direct link to the other site first, if needed?</p> <p>Update:</p> <p>The HTML5 feature 'window.postmessage' seems to be a nice solution.<br> There are some jQuery libraries that might help, and compatible with most recent browsers.<br> In essence, the iFrame document sends messages, with Json, thru the window element.</p> <p>The very nice <a href="http://postmessage.freebaseapps.com" rel="noreferrer">Postmessage-plugin</a>, by daepark, which i got working.<br> and another <a href="http://benalman.com/projects/jquery-postmessage-plugin/" rel="noreferrer">jQuery postMessage</a>, by Ben Alman i found, but haven't tested.</p>
[ { "answer_id": 1032746, "author": "M.W. Felker", "author_id": 127012, "author_profile": "https://Stackoverflow.com/users/127012", "pm_score": 3, "selected": false, "text": " (parent doc) (iframe doc)\n HTML --> IFRAME <-- HTML \n ^--------|---------^\n" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/172223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25286/" ]
172,255
<p>I'd like to zoom and unzoom in ways the base class doesn't support.</p> <p>For instance, upon receiving a double tap.</p>
[ { "answer_id": 668166, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "- (void) touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {\n UIScrollView *scrollView = (UIScrollView*)[self superview...
2008/10/05
[ "https://Stackoverflow.com/questions/172255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22704/" ]
172,258
<p>I've written up a weekly-review GTD checklist for myself in TiddlyWiki, using <a href="http://www.tiddlytools.com/#CheckboxPlugin" rel="nofollow noreferrer">CheckboxPlugin</a>. After I'm finished with it each week, I'd like to click one link to uncheck (reset) all of the items on it, so it's ready for the next use.</p> <p>I'm storing the check information as tags on a separate tiddler page. I should be able to just erase all the tags on that page and refresh the checklist page, but I haven't been able to work out how to do that yet.</p> <p>I generally work in C, C++, and Lisp, I'm just learning about Javascript. Can anyone offer some useful pointers?</p> <p>(And before anyone suggests it, I've looked at the ChecklistScript on the same site. It doesn't use the CheckboxPlugin stuff, and isn't compatible with it.)</p>
[ { "answer_id": 178066, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<html><form style=\"display:inline\">\n <input type=\"button\" value=\"clear all\" onclick=\"\n var tid='SomeTiddler...
2008/10/05
[ "https://Stackoverflow.com/questions/172258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12193/" ]
172,262
<p>What is the difference between <code>#include</code> and <code>#import</code> in C++?</p>
[ { "answer_id": 172264, "author": "Brian R. Bondy", "author_id": 3153, "author_profile": "https://Stackoverflow.com/users/3153", "pm_score": 7, "selected": false, "text": "#import" }, { "answer_id": 172274, "author": "Head Geek", "author_id": 12193, "author_profile": "...
2008/10/05
[ "https://Stackoverflow.com/questions/172262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1585/" ]
172,265
<p>I've got a WCF Web Service method whose prototype is:</p> <pre><code>[OperationContract] Response&lt;List&lt;Customer&gt;&gt; GetCustomers(); </code></pre> <p>When I add the service reference to a client, Visual Studio (2005) creates a type called "ResponseOfArrayOfCustomerrleXg3IC" that is a wrapper for "Response&lt;List&lt;Customer>>". Is there any way I can control the wrapper name? ResponseOfArrayOfCustomerrleXg3IC doesn't sound very appealing...</p>
[ { "answer_id": 172349, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": -1, "selected": false, "text": "[OperationContract(Name = \"NameGoesHere\")]\nResponse<List<Customer>> GetCustomers();\n" }, { "answer_id": 172370,...
2008/10/05
[ "https://Stackoverflow.com/questions/172265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9825/" ]
172,278
<p>I have a stored procedure with the following header:</p> <pre><code>FUNCTION SaveShipment (p_user_id IN INTEGER, p_transaction_id IN INTEGER, p_vehicle_code IN VARCHAR2 DEFAULT NULL, p_seals IN VARCHAR2 DEFAULT NULL) RETURN INTEGER; </code></pre> <p>And I am having trouble running it from TOAD's Editor. I cannot run it as part of a select from dual statement because it preforms DML, but if I try the following syntax which I saw recommended on some forum:</p> <pre><code>var c integer; exec :c := orm_helper.orm_helper.SAVESHIPMENT (9999, 31896, NULL, ''); print c; </code></pre> <p>I get:</p> <pre><code>ORA-01008: not all variables bound Details: BEGIN :c := orm_helper.orm_helper.saveshipment (9999, 31896, null, ''); END; Error at line 2 ORA-01008: not all variables bound </code></pre> <p>What's the proper syntax to run this sp manually?</p>
[ { "answer_id": 172309, "author": "friol", "author_id": 23034, "author_profile": "https://Stackoverflow.com/users/23034", "pm_score": 3, "selected": true, "text": "declare\n c integer;\nbegin\n\nc:=storedProc(...parameters...);\n" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/172278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
172,300
<p>When using Mercurial I sometimes find that it is hard to understand the relationship between changesets when there are thousands of changesets, and sometimes ten or more active branches at any one time. Currently, I use <a href="http://www.logilab.org/project/hgview/screenshots?selected=4873" rel="noreferrer">hgview</a> which is okay, and while it makes a reasonable attempt to represent the parent relationships it is still basically one dimensional. I imagine something making use of graph visualisation programs such as <a href="http://www.graphviz.org/" rel="noreferrer">GraphViz</a> might work nicely, or perhaps something more wacky.</p> <p>Currently I'm working on projects with around 30,000 revisions, and I expect that number to grow significantly; if 100 full time developers really grok distributed version control and start committing regularly and sharing their full development history then we could end up dealing with millions of revisions. A browser which doesn't have to load the entire history in to RAM every time you want to look at it therefore becomes necessary</p> <p>I'm interested in good history browsers for any version control systems as well, especially if there is a chance I can port them to Mercurial.</p>
[ { "answer_id": 172358, "author": "I GIVE CRAP ANSWERS", "author_id": 25083, "author_profile": "https://Stackoverflow.com/users/25083", "pm_score": 4, "selected": true, "text": "gitk(1)" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/172300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22668/" ]
172,302
<p>This is for a small scheduling app. I need an algorithm to efficiently compare two "schedules", find differences, and update only the data rows which have been changed, as well as entries in another table having this table as a foreign key. This is a big question, so I'll say right away I'm looking for either <strong>general advice</strong> or <strong>specific solutions</strong>.</p> <p><strong>EDIT:</strong> As suggested, I have significantly shortened the question.</p> <p>In one table, I associate resources with a span of time when they are used. </p> <p>I also have a second table (Table B) which uses the ID from Table A as a foreign key.</p> <p>The entry from Table A corresponding to Table B will have a span of time which <strong>subsumes</strong> the span of time from Table B. Not all entries in Table A will have an entry in Table B.</p> <p>I'm providing an interface for users to edit the resource schedule in Table A. They basically provide a new set of data for Table A that I need to treat as a <em>diff</em> from the version in the DB.</p> <p>If they completely remove an object from Table A that is pointed to by Table B, I want to remove the entry from Table B as well.</p> <p>So, given the following 3 sets:</p> <ul> <li>The original objects from Table A (from the DB)</li> <li>The original objects from Table B (from the DB)</li> <li>The edited set of objects from Table A (from the user, so no unique IDs)</li> </ul> <p>I need an algorithm that will:</p> <ul> <li>Leave rows in Table A and Table B untouched if no changes are needed for those objects.</li> <li>Add rows to Table A as needed.</li> <li>Remove rows from Table A and Table B as needed.</li> <li>Modify rows in Table A and Table B as needed.</li> </ul> <p>Just sorting the objects into an arrangement where I can apply the appropriate database operations is more than adequate for a solution.</p> <p>Again, please answer as <strong>specifically</strong> or <strong>generally</strong> as you like, I'm looking for advice but if someone has a complete algorithm that would just make my day. :)</p> <p><strong>EDIT:</strong> In response to lassvek, I am providing some additional detail:</p> <p>Table B's items are always contained entirely within Table A items, not merely overlapping.</p> <p><em>Importantly,</em> Table B's items are quantized so they should fall either entirely within or entirely outside. If this doesn't happen, then I have a data integrity error that I'll have to handle separately.</p> <p>For example (to use a shorthand):</p> <pre> Table A ID Resource Start End 01 Resource A 10/6 7:00AM 10/6 11:00AM 02 Resource A 10/6 1:00PM 10/6 3:00PM Table B ID Table_A_ID Start End 01 02 10/6 1:00PM 10/6 2:00PM </pre> <p>So I want the following behaviours:</p> <ul> <li>If I remove ID 02 from table A, or shorten it to 2:00PM - 3:00PM, I should remove ID 01 from Table B.</li> <li>If I extend Table A ID 01 to where it ends at 1:00PM, <strong>these two entries should be merged together into one row</strong>, and Table B ID 01 should now point to table A ID 01.</li> <li>If I remove 8:00AM-10:00AM from Table A ID 01, that entry should be split into two entries: One for 7:00AM-8:00AM, and a new entry (ID 03) for 10:00AM-11:00AM.</li> </ul>
[ { "answer_id": 174037, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 4, "selected": true, "text": "|---------------- A -------------------|\n |--- B ----| |--- B ---|\n" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/172302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21632/" ]
172,303
<p>Is it possible to detect a valid regular expression with another regular expression? If so please give example code below.</p>
[ { "answer_id": 172312, "author": "Dan", "author_id": 17121, "author_profile": "https://Stackoverflow.com/users/17121", "pm_score": 8, "selected": false, "text": "try..catch" }, { "answer_id": 172316, "author": "Markus Jarderot", "author_id": 22364, "author_profile": "...
2008/10/05
[ "https://Stackoverflow.com/questions/172303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10950/" ]
172,306
<p>I'm sure this is a subject that's on most python developers' minds considering that Python 3 is coming out soon. Some questions to get us going in the right direction:</p> <ol> <li><p>Will you have a python 2 and python 3 version to be maintained concurrently or will you simply have a python 3 version once it's finished?</p> <ul> <li>Have you already started or plan on starting soon? Or do you plan on waiting until the final version comes out to get into full swing?</li> </ul></li> </ol>
[ { "answer_id": 172350, "author": "I GIVE CRAP ANSWERS", "author_id": 25083, "author_profile": "https://Stackoverflow.com/users/25083", "pm_score": 3, "selected": false, "text": "from __future__ import X" }, { "answer_id": 214601, "author": "Glyph", "author_id": 13564, ...
2008/10/05
[ "https://Stackoverflow.com/questions/172306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2147/" ]
172,320
<p>I'm working with a webservice that offers almost duplicated code across two namesspaces. Lets say for example PigFeet and HorseFeet, both namespaces contain a Feet class and other code that works with the Feet class requires it to be part of that same namespace.</p> <p>Right now In my code I'm forced to do something like this:</p> <pre><code>if( _animalType == AnimalType.Pig ) { //namespace is pigfeet PigFeet.Feet feet = new Feet(); feet.WashFeet(); } if( _animalType == AnimalType.Horse ) { //namespace is horsefeet HorseFeet.Feet feet = new Feet(); feet.WashFeet(); } </code></pre> <p>This is leaving me with lots of duplicated code. Is there a way to choose a namespace more dynamically?</p>
[ { "answer_id": 172324, "author": "Eric Schoonover", "author_id": 3957, "author_profile": "https://Stackoverflow.com/users/3957", "pm_score": 2, "selected": false, "text": "using PigFeet = PigFeet.Feet;\nusing HorseFeet = HorseFeet.Feet;\n\n//now your sample code should look something lik...
2008/10/05
[ "https://Stackoverflow.com/questions/172320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25300/" ]
172,353
<p>I am writing a C# program which captures signals from a external device, and sends keystrokes to another application. I am using SendKeys and it works fine.</p> <p>SendKeys does "press" a key by holding and releasing it immediately. I would like to make it push key and release it at will.</p> <p>My question is : "is there a way to send a "push" signal to a key, then a "release" signal after a certain amount of time ?"</p> <p>I am not sure SendKeys is able to do this. Any clue ?</p>
[ { "answer_id": 9509588, "author": "Ohad Schneider", "author_id": 67824, "author_profile": "https://Stackoverflow.com/users/67824", "pm_score": 2, "selected": false, "text": "keybd_event" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/172353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24472/" ]
172,365
<p>I've created a web page that lets you input some information and then draws an image in a canvas element based on that info. I have it pretty much working the way I want except for the printing.</p> <p>Is there a way to print out the canvas element or is creating a new window to draw in, the only way to do it?</p> <p>Update:</p> <p>The answer was so simple. I was thinking of a lot more complicated solution. </p> <p>I wish I could pick more than 1 answer. I wasn't able to get the canvas to print when I used * to disable display. The simplest solution was to just turn off the form that I was using for input, using form {display:none;} in the CSS inside an @media print{}. Thanks for the quick response.</p> <pre><code> @media print { form { display:none; } } </code></pre>
[ { "answer_id": 172376, "author": "Darryl Hein", "author_id": 5441, "author_profile": "https://Stackoverflow.com/users/5441", "pm_score": 1, "selected": false, "text": "<link>" }, { "answer_id": 172377, "author": "Zack The Human", "author_id": 18265, "author_profile": ...
2008/10/05
[ "https://Stackoverflow.com/questions/172365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/791/" ]
172,372
<p>I am wondering about what the difference between logging and tracing is.</p> <p>Is the difference basically that tracing is more detailed log giving developers a tool to debug applications at runtime?</p> <p>I have been experimenting with log4net and doing logging. Now I am wondering if I should be doing tracing as well and if I could/should use log4net for that purpose. Should I be doing tracing with log4net and is there some trace level for log4net loggers? Should I use a different log level for debug and trace purposes or is it ok to use the same? Can you give a simple example on how I would do logging and tracing for a simple method?</p> <p>Edit: Despite a few helpful answers below I am still unsure how I should be doing tracing versus logging. </p> <p>I have the following method in my Business layer and I want to add logging/tracing to it. I am wondering how to do it efficiently. Is the following method acceptable in terms of logging/tracing? Should the log messages be of type Info instead of Debug? Are the Debug messages I am logging considered trace? How would you change it?</p> <pre> <code> IEnumerable&lt;Car&gt; GetCars() { try { logger.Debug("Getting cars"); IEnumerable&lt;Car&gt; cars = CarAccessor.GetCars().ConvertAll(DataAccessToBusinessConverter); logger.Debug("Got total of " + cars.Count + " cars"); } catch (Exception e) { logger.Error("Error when getting cars", e); throw new Exception("Unexpected error when getting cars"); } } </code> </pre>
[ { "answer_id": 172488, "author": "Bob Nadler", "author_id": 2514, "author_profile": "https://Stackoverflow.com/users/2514", "pm_score": 4, "selected": false, "text": "Debug()" }, { "answer_id": 172525, "author": "martin", "author_id": 8421, "author_profile": "https://...
2008/10/05
[ "https://Stackoverflow.com/questions/172372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15771/" ]
172,393
<p>I have a method that takes an IQueryable. Is there a LINQ query that will give me back the size of each column in the IQueryable?</p> <p>To be more clear: this is Linq-to-objects. I want to get the length of the ToString() of each "column".</p>
[ { "answer_id": 172413, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 2, "selected": true, "text": "\npublic IEnumerable GetColumnSize(IQueryable source)\n{\n var types = MapTypeToMembers(source).Select(x => x.Type);\n r...
2008/10/05
[ "https://Stackoverflow.com/questions/172393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5189/" ]
172,439
<p>I have a multi-line string that I want to do an operation on each line, like so:</p> <pre><code>inputString = &quot;&quot;&quot;Line 1 Line 2 Line 3&quot;&quot;&quot; </code></pre> <p>I want to iterate on each line:</p> <pre><code>for line in inputString: doStuff() </code></pre>
[ { "answer_id": 172454, "author": "UnkwnTech", "author_id": 115, "author_profile": "https://Stackoverflow.com/users/115", "pm_score": 10, "selected": true, "text": "inputString.splitlines()\n" }, { "answer_id": 172468, "author": "efotinis", "author_id": 12320, "author_...
2008/10/05
[ "https://Stackoverflow.com/questions/172439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1546/" ]
172,443
<p>I'm looking for a getopt library for c#. So far I found a few (<a href="http://www.phpguru.org/static/getopt.html" rel="noreferrer">phpguru</a>, <a href="http://69.10.233.10/KB/cs/XGetoptCS.aspx" rel="noreferrer">XGetOptCS</a>, <a href="http://www.codeproject.com/KB/cs/geoptfordotnet.aspx" rel="noreferrer">getoptfordotnet</a>) but these look more like unfinished attempts that only support a part of C's getopt. Is there a full getopt c# implementation?</p>
[ { "answer_id": 9068889, "author": "kostix", "author_id": 720999, "author_profile": "https://Stackoverflow.com/users/720999", "pm_score": 0, "selected": false, "text": "src\\ClientUtilities\\util\\CommandLineOptions.cs" }, { "answer_id": 47006226, "author": "Watercolor Games",...
2008/10/05
[ "https://Stackoverflow.com/questions/172443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2798/" ]
172,465
<pre><code>y: &amp;pause cd ptls5.0 &amp;pause sdp describe Integration.dpk &amp;pause z: &amp;pause cd ptls5.0 &amp;pause dir &amp;pause </code></pre> <p>I have those commands in the 1.cmd file. First three are executed fine. The result of it is that after "sdp describe Integration.dpk &amp;pause" is executed I'm given "press any key to continue..." after I hit any key. The command prompt quits. Instead of changing drive to z:>. What is wrong with it?</p>
[ { "answer_id": 172471, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 1, "selected": false, "text": "call" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/172465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
172,484
<p>I recently added <a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-pedantic-1" rel="nofollow noreferrer">-pedantic</a> and <a href="https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-pedantic-errors-1" rel="nofollow noreferrer">-pedantic-errors</a> to my make GCC compile options to help clean up my cross-platform code. All was fine until it found errors in external-included header files. Is there a way to turn off this error checking in external header files, i.e.:</p> <p>Keep checking for files included like this:</p> <pre><code>#include &quot;myheader.h&quot; </code></pre> <p>Stop checking for include files like this:</p> <pre><code>#include &lt;externalheader.h&gt; </code></pre> <p>Here are the errors I am getting:</p> <pre class="lang-none prettyprint-override"><code>g++ -Wall -Wextra -Wno-long-long -Wno-unused-parameter -pedantic --pedantic-errors -O3 -D_FILE_OFFSET_BITS=64 -DMINGW -I&quot;freetype/include&quot; -I&quot;jpeg&quot; -I&quot;lpng128&quot; -I&quot;zlib&quot; -I&quot;mysql/include&quot; -I&quot;ffmpeg/libswscale&quot; -I&quot;ffmpeg/libavformat&quot; -I&quot;ffmpeg/libavcodec&quot; -I&quot;ffmpeg/libavutil&quot; -o omingwd/kguimovie.o -c kguimovie.cpp In file included from ffmpeg/libavutil/avutil.h:41, from ffmpeg/libavcodec/avcodec.h:30, from kguimovie.cpp:44: ffmpeg/libavutil/mathematics.h:32: error: comma at end of enumerator list In file included from ffmpeg/libavcodec/avcodec.h:30, from kguimovie.cpp:44: ffmpeg/libavutil/avutil.h:110: error: comma at end of enumerator list In file included from kguimovie.cpp:44: ffmpeg/libavcodec/avcodec.h:277: error: comma at end of enumerator list ffmpeg/libavcodec/avcodec.h:303: error: comma at end of enumerator list ffmpeg/libavcodec/avcodec.h:334: error: comma at end of enumerator list ffmpeg/libavcodec/avcodec.h:345: error: comma at end of enumerator list ffmpeg/libavcodec/avcodec.h:2249: warning: `ImgReSampleContext' is deprecated (declared at ffmpeg/libavcodec/avcodec.h:2243) ffmpeg/libavcodec/avcodec.h:2259: warning: `ImgReSampleContext' is deprecated (declared at ffmpeg/libavcodec/avcodec.h:2243) In file included from kguimovie.cpp:45: ffmpeg/libavformat/avformat.h:262: error: comma at end of enumerator list In file included from ffmpeg/libavformat/rtsp.h:26, from ffmpeg/libavformat/avformat.h:465, from kguimovie.cpp:45: ffmpeg/libavformat/rtspcodes.h:38: error: comma at end of enumerator list In file included from ffmpeg/libavformat/avformat.h:465, from kguimovie.cpp:45: ffmpeg/libavformat/rtsp.h:32: error: comma at end of enumerator list ffmpeg/libavformat/rtsp.h:69: error: comma at end of enumerator list </code></pre>
[ { "answer_id": 172536, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": -1, "selected": true, "text": "-pedantic" }, { "answer_id": 761156, "author": "Good Person", "author_id": 87280, "author_profile": "https...
2008/10/05
[ "https://Stackoverflow.com/questions/172484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13676/" ]
172,504
<p>I like to read about new and clever algorithms. And I like to think out of the box, so all kinds of algorithms from all fields of computation are welcome.</p> <p>From time to time I read research papers to keep up with the current research and expand my horizon. I also like to learn new tricks. Unfortunately I tend to concentrate only on my field of interest, so I miss a lot of usefull stuff.</p> <p>Let's just not post mainstream things. Instead write about something special that made you think: "Wow - now <em>that's</em> a clever solution!".</p>
[ { "answer_id": 172535, "author": "Dark Shikari", "author_id": 11206, "author_profile": "https://Stackoverflow.com/users/11206", "pm_score": 2, "selected": false, "text": "P" }, { "answer_id": 172585, "author": "Brent.Longborough", "author_id": 9634, "author_profile": ...
2008/10/05
[ "https://Stackoverflow.com/questions/172504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15955/" ]
172,524
<p>Last time <a href="https://stackoverflow.com/questions/169506/get-form-input-fields-with-jquery">I asked about the reverse process</a>, and got some very efficient answers. I'm aiming for least lines of code here. I have a form of fields and an associative array in the {fieldname:data} format, I want to populate a corresponding form with it.</p>
[ { "answer_id": 172532, "author": "Adam Bellaire", "author_id": 21632, "author_profile": "https://Stackoverflow.com/users/21632", "pm_score": 4, "selected": false, "text": "$.each(myAssocArry, function(i,val) { $('#'+i).val(val); });\n" }, { "answer_id": 172579, "author": "Era...
2008/10/05
[ "https://Stackoverflow.com/questions/172524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7883/" ]
172,526
<p>I'll go first.</p> <p>I'm 100% in the set-operations camp. But what happens when the set logic on the entire desired input domain leads to a such a large retrieval that the query slows down significantly, comes to a crawl, or basically takes infinite time?</p> <p>That's one case where I'll use a itty-bitty cursor (or a while loop) of perhaps most dozens of rows (as opposed to the millions I'm targeting). Thus, I'm still working in (partitioned sub) sets, but my retrieval runs faster.</p> <p>Of course, an even faster solution would be to call the partioned input domains in parallel from outside, but that introduces an interaction will an external system, and when "good enough" speed can be achieved by looping in serial, just may not be worth it (epecially during development).</p>
[ { "answer_id": 172879, "author": "Greg Beech", "author_id": 13552, "author_profile": "https://Stackoverflow.com/users/13552", "pm_score": 3, "selected": true, "text": "sp_getapplock" } ]
2008/10/05
[ "https://Stackoverflow.com/questions/172526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23422/" ]
172,544
<p>I am trying to display a list of all files found in the selected directory (and optionally any subdirectories). The problem I am having is that when the GetFiles() method comes across a folder that it cannot access, it throws an exception and the process stops.</p> <p>How do I ignore this exception (and ignore the protected folder/file) and continue adding accessible files to the list?</p> <pre><code>try { if (cbSubFolders.Checked == false) { string[] files = Directory.GetFiles(folderBrowserDialog1.SelectedPath); foreach (string fileName in files) ProcessFile(fileName); } else { string[] files = Directory.GetFiles(folderBrowserDialog1.SelectedPath, "*.*", SearchOption.AllDirectories); foreach (string fileName in files) ProcessFile(fileName); } lblNumberOfFilesDisplay.Enabled = true; } catch (UnauthorizedAccessException) { } finally {} </code></pre>
[ { "answer_id": 172575, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 7, "selected": true, "text": "using System;\nusing System.IO;\nstatic class Program\n{\n static void Main()\n {\n string path = \"\"; /...
2008/10/05
[ "https://Stackoverflow.com/questions/172544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2493/" ]
172,546
<p>I'd like to use the new <b>CMFCListCtrl</b> features with my <b>CListView</b> class (and, of course, the new CMFCHeaderCtrl inside it). Unfortunately, you can't use <i>Attach()</i> or <i>SubclassWindow()</i> because the SysListView32 window is already associated with a CListView object.</p> <p>Do I have to override CListView's <i>OnCmdMsg()</i> and route all messages to my own instance of CMFCListCtrl? (Will that even work?) Or is there an easier/cleaner solution?</p>
[ { "answer_id": 2809830, "author": "Frekers", "author_id": 338149, "author_profile": "https://Stackoverflow.com/users/338149", "pm_score": 2, "selected": false, "text": "CMFCHeaderCtrl& CMyMFCListCtrl::GetHeaderCtrl() \n{ \n return m_myHeaderCtrl; \n}\n\nvoid CMyMFCListCtrl::InitHeader(...
2008/10/05
[ "https://Stackoverflow.com/questions/172546", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4858/" ]
172,552
<p>I wrote a short bash script to complete a task that involves creating a temporary directory and storing various files in it and performing various operations on it.</p> <p>In my first pass I just created the temp dir at /tmp/$$.$script", but then I tested the script on a computer where I didn't have write access to /tmp/, and I'd like to take that case into account. So my question is where's a good secondary location for this temp dir? Should I just use the current directory? The home directory? ~/tmp/? The output location of the script?</p> <p>All created files do get cleaned up on script exit.</p>
[ { "answer_id": 172555, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 1, "selected": false, "text": "/var/tmp" }, { "answer_id": 172556, "author": "Community", "author_id": -1, "author_profile": "h...
2008/10/05
[ "https://Stackoverflow.com/questions/172552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1512/" ]
172,559
<pre><code>function returnsAnArray () { return array ('test'); } echo returnsAnArray ()[0]; </code></pre> <p>generates a syntax error in PHP. What's the most efficient way to directly obtain an element from a returned array without assigning the result to a temp variable?</p>
[ { "answer_id": 172570, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 1, "selected": false, "text": " <?php\n echo current(returnsAnArray());\n ?>\n" }, { "answer_id": 172582, "author": "Paul Dixon", "...
2008/10/05
[ "https://Stackoverflow.com/questions/172559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24288/" ]
172,573
<p>I've been using <a href="http://www.jcraft.com/jsch/" rel="nofollow noreferrer">JSch</a> for a couple of weeks now. It seems to <em>work</em> okay, but its API is a little bit cumbersome. I'm also a little off put by its total lack of documentation (not even javadoc style comments). Has anyone used a good Java SSH2 library that they'd recommend. I'm particularly interested in SCP file transfer and issuing commands to a remote Linux box programmatically via the SSH protocol.</p>
[ { "answer_id": 172570, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 1, "selected": false, "text": " <?php\n echo current(returnsAnArray());\n ?>\n" }, { "answer_id": 172582, "author": "Paul Dixon", "...
2008/10/05
[ "https://Stackoverflow.com/questions/172573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
172,587
<p>What is the difference between g++ and gcc? Which one of them should be used for general c++ development?</p>
[ { "answer_id": 172592, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 11, "selected": true, "text": "gcc" }, { "answer_id": 172613, "author": "njsf", "author_id": 4995, "author_profile": "https://Stackoverfl...
2008/10/05
[ "https://Stackoverflow.com/questions/172587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
172,598
<p>I just started programming Objective-C and, having a background in Java, wonder how people writing Objective-C programs deal with private methods.</p> <p>I understand there may be several conventions and habits and think about this question as an aggregator of the best techniques people use dealing with private methods in Objective-C. </p> <p>Please include an argument for your approach when posting it. Why is it good? Which drawbacks does it have (that you know of) and how you deal with them?</p> <hr/> <p>As for my findings so far.</p> <p>It is possible to use <a href="http://www.otierney.net/objective-c.html#categories" rel="noreferrer">categories</a> [e.g. MyClass (Private)] defined in MyClass.m file to group private methods.</p> <p>This approach has 2 issues:</p> <ol> <li>Xcode (and compiler?) does not check if you define all methods in private category in corresponding @implementation block</li> <li>You have to put @interface declaring your private category in the begin of MyClass.m file, otherwise Xcode complains with a message like "self may not respond to message "privateFoo".</li> </ol> <p>The first issue can be worked around with <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_5.html#//apple_ref/doc/uid/TP30001163-CH20-SW2" rel="noreferrer">empty category</a> [e.g. MyClass ()].<br/> The second one bothers me a lot. I'd like to see private methods implemented (and defined) near the end of the file; I do not know if that's possible.</p>
[ { "answer_id": 173287, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 6, "selected": false, "text": "@interface" }, { "answer_id": 651623, "author": "Barry Wark", "author_id": 2140, "author_profile": "https:...
2008/10/05
[ "https://Stackoverflow.com/questions/172598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20294/" ]
172,600
<p>When I try this with a generic class where this.value is T:</p> <pre><code>if (this.value.GetType() == typeof(int)) { ((int)this.value)++; } else { throw new InvalidOperationException ("T must be an int to perform this operation"); } </code></pre> <p>I get a compile-time error: "Cannot convert type 'T' to 'int'"</p> <p>What should I do to perform an integral operation on this.value when it's an int?</p> <p>Note that this is just an example. The code does type conversions with generics, and "int" is just an example of one type for T. </p>
[ { "answer_id": 172639, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 6, "selected": true, "text": "int i = (int)(object)this.value;\ni++;\nthis.value = (T)(object)i;\n" }, { "answer_id": 172651, "author": ...
2008/10/05
[ "https://Stackoverflow.com/questions/172600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11574/" ]
172,648
<p>I have a photo website and i want to support tags as my original category bucketing is starting to fail (some pictures are family and vacations, or school and friends). Is there an agreed tagging db schema? </p> <p>I still want to support having photos as part of an album.</p> <p>Right now i have a few tables:</p> <p><strong>Photos</strong></p> <ul> <li>PhotoID</li> <li>PhotoAlbumID</li> <li>Caption</li> <li>Date</li> </ul> <p><strong>Photo Album</strong></p> <ul> <li>AlbumID</li> <li>AlbumName</li> <li>AlbumDate</li> </ul>
[ { "answer_id": 172833, "author": "Neall", "author_id": 619, "author_profile": "https://Stackoverflow.com/users/619", "pm_score": 4, "selected": false, "text": "photos\n photoid\n caption\n filename\n date\n\ntags\n tagid\n tagname\n\nphototags\n photoid\n tagid\n" }, { "a...
2008/10/05
[ "https://Stackoverflow.com/questions/172648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]