qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
309,506
<p>I want to reveal a div with an input inside when you click a button, and set its focus.</p> <p>If I use show(), it works, but if I use slideDown() <strong>the focus is lost after the animation completes</strong>. How can I prevent this from happening?</p> <p>Sample code:</p> <pre><code>$("document").ready(function(){ $("#MyButton").click(function(e){ e.preventDefault(); $(".SlidingDiv").slideDown(); $("#MyInput").focus(); }); }); &lt;input type="button" value="Click Me" id="MyButton" /&gt; &lt;div class="SlidingDiv" style="display:none;"&gt;&lt;input type="text" id="MyInput" /&gt;&lt;/div&gt; </code></pre>
[ { "answer_id": 309562, "author": "James", "author_id": 21677, "author_profile": "https://Stackoverflow.com/users/21677", "pm_score": 4, "selected": true, "text": "$(function(){\n $(\"#MyButton\").click(function(e){\n e.preventDefault();\n $(\".SlidingDiv\").slideDown(fun...
2008/11/21
[ "https://Stackoverflow.com/questions/309506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1842/" ]
309,522
<p>(This is related to <a href="https://stackoverflow.com/questions/85373/floor-a-date-in-sql-server">Floor a date in SQL server</a>.)</p> <p>Does a deterministic expression exist to floor a DATETIME? When I use this as a computed column formula:</p> <pre><code>DATEADD(dd, DATEDIFF(dd, 0, [datetime_column]), 0) </code></pre> <p>the I get an error when I place an index on that column:</p> <blockquote> <p>Cannot create index because the key column 'EffectiveDate' is non-deterministic or imprecise.</p> </blockquote> <p>But both DATEDIFF and DATEADD are deterministic functions by definition. Where is the catch? Is it possible?</p>
[ { "answer_id": 309559, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 1, "selected": false, "text": "CAST(FLOOR(CAST([datetime_column] as FLOAT)) AS DateTime)\n" }, { "answer_id": 309642, "author": "James Cu...
2008/11/21
[ "https://Stackoverflow.com/questions/309522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18771/" ]
309,533
<p>I have a webservice @ <a href="http://recpushdata.cyndigo.com/Jobs.asmx" rel="nofollow noreferrer">http://recpushdata.cyndigo.com/Jobs.asmx</a> but I'm not able to access it though I am adding it as a WebReference properly.</p> <p>Any Help would be great.</p>
[ { "answer_id": 309559, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 1, "selected": false, "text": "CAST(FLOOR(CAST([datetime_column] as FLOAT)) AS DateTime)\n" }, { "answer_id": 309642, "author": "James Cu...
2008/11/21
[ "https://Stackoverflow.com/questions/309533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
309,539
<p>I would like to generate a list of files within a directory. Some of the filenames contain Chinese characters.</p> <p>eg: [试验].Test.txt</p> <p>I am using the following code:</p> <pre><code>require 'find' dirs = ["TestDir"] for dir in dirs Find.find(dir) do |path| if FileTest.directory?(path) else p path end end end </code></pre> <p>Running the script produces a list of files but the Chinese characters are escaped (replaced with backslashes followed by numbers). Using the example filename above would produce:</p> <p>"TestDir/[\312\324\321\351]Test.txt" instead of "TestDir/[试验].Test.txt".</p> <p>How can the script be altered to output the Chinese characters?</p>
[ { "answer_id": 309707, "author": "rpattabi", "author_id": 15139, "author_profile": "https://Stackoverflow.com/users/15139", "pm_score": 3, "selected": true, "text": "$KCODE = 'utf-8'\n" }, { "answer_id": 10933975, "author": "David", "author_id": 1442494, "author_profi...
2008/11/21
[ "https://Stackoverflow.com/questions/309539", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39731/" ]
309,553
<p>I commonly find myself extracting common behavior out of classes into helper/utility classes that contain nothing but a set of static methods. I've often wondered if I should be declaring these classes as abstract, since I can't really think of a valid reason to ever instantiate these? </p> <p>What would the Pros and Cons be to declaring such a class as abstract.</p> <pre><code>public [abstract] class Utilities{ public static String getSomeData(){ return "someData"; } public static void doSomethingToObject(Object arg0){ } } </code></pre>
[ { "answer_id": 311474, "author": "shsteimer", "author_id": 292, "author_profile": "https://Stackoverflow.com/users/292", "pm_score": 0, "selected": false, "text": "import static Utilities.getSomeData;\n\npublic class Consumer {\n\n public void doSomething(){\n\n String data = ...
2008/11/21
[ "https://Stackoverflow.com/questions/309553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/292/" ]
309,565
<p>I'm using the StAX event based API's to modify an XML stream. The stream represents an HTML document, complete with DTD declaration. I would like to copy this DTD declaration into the output document (written using an <code>XMLEventWriter</code>). When I ask the factory to disregard DTD's it will not download the DTD, but remove the whole statement and only leave a "<code>&lt;!DOCUMENTTYPE</code>" string. When not disregarding, the whole DTD gets downloaded, and included when verbatim outputting the DTD event. I don't want to use the time to download this DTD, but include the complete DTD specification (resolving entities is already disabled and I don't need that). Does anyone know how to disable the fetching of external DTD's.</p>
[ { "answer_id": 309643, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 3, "selected": true, "text": "class CustomResolver implements javax.xml.stream.XMLResolver {\n\n public Object resolveEntity(String publicID,\n ...
2008/11/21
[ "https://Stackoverflow.com/questions/309565", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4100/" ]
309,574
<p>I want my errors to float above, left-justified, the input field that doesn't validate. How can I do this?</p> <p>If I can't, how can I turn the errors off? I still want the fields to validate (and highlight on error), but not for the actual error messages to display. I couldn't seem to find anything in the jQuery docs that would let me turn them on/off... ??</p>
[ { "answer_id": 312102, "author": "strager", "author_id": 39992, "author_profile": "https://Stackoverflow.com/users/39992", "pm_score": 4, "selected": false, "text": "$(...).validate({\n errorPlacement: function(error, element) {\n error.insertBefore(element);\n }\n});\n" }...
2008/11/21
[ "https://Stackoverflow.com/questions/309574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32154/" ]
309,581
<p>What is the difference between a <code>const_iterator</code> and an <code>iterator</code> and where would you use one over the other?</p>
[ { "answer_id": 309589, "author": "Dominic Rodger", "author_id": 20972, "author_profile": "https://Stackoverflow.com/users/20972", "pm_score": 8, "selected": true, "text": "const_iterator" }, { "answer_id": 309610, "author": "jalf", "author_id": 33213, "author_profile"...
2008/11/21
[ "https://Stackoverflow.com/questions/309581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18664/" ]
309,604
<p>I need to do the following for hundreds of files: Append the name of the file (which may contain spaces) to the end of each line in the file.</p> <p>It seems to me there should be some way to do this:</p> <pre><code>sed -e 's/$/FILENAME/' * </code></pre> <p>where <code>FILENAME</code> represents the name of the current file. Is there a sed variable representing the current filename? Or does anyone have a different solution using bash, awk, etc.?</p>
[ { "answer_id": 309616, "author": "Tyler McHenry", "author_id": 39375, "author_profile": "https://Stackoverflow.com/users/39375", "pm_score": 2, "selected": false, "text": "for i in * \ndo\n sed -e \"s/\\$/$i/\" \"$i\" \ndone\n" }, { "answer_id": 309621, "author": "ayaz", ...
2008/11/21
[ "https://Stackoverflow.com/questions/309604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1094969/" ]
309,615
<p>I'd like to establish an ssh tunnel over ssh to my mysql server.</p> <p>Ideally I'd return a mysqli db pointer just like I was connecting directly.</p> <p>I'm on a shared host that doesn't have the <a href="http://ca.php.net/ssh2" rel="noreferrer">SSH2</a> libraries but I might be able to get them installed locally using PECL.</p> <p>If there's a way that uses native commands that would be great.</p> <p>I was thinking something like this, but without those libraries it won't work.</p> <pre><code>$connection = ssh2_connect('SERVER IP', 22); ssh2_auth_password($connection, 'username', 'password'); $tunnel = ssh2_tunnel($connection, 'DESTINATION IP', 3307); $db = new mysqli_connect('127.0.0.1', 'DB_USERNAME', 'DB_PASSWORD', 'dbname', 3307, $tunnel) or die ('Fail: ' . mysql_error()); </code></pre> <p>Anyone have any ideas? I'm running a shared CentOS linux host at liquidweb.</p> <p>Any thoughts on making the tunnel persistent? Is it possible to establish it with another script and just take advantage of it in <code>PHP</code>?</p> <p>Thanks.</p>
[ { "answer_id": 310932, "author": "Brian C. Lane", "author_id": 27461, "author_profile": "https://Stackoverflow.com/users/27461", "pm_score": 4, "selected": false, "text": "ssh -L 3306:localhost:3306 user@domain.com\n" }, { "answer_id": 472586, "author": "Community", "auth...
2008/11/21
[ "https://Stackoverflow.com/questions/309615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1430/" ]
309,631
<p>In what cases is it necessary to synchronize access to instance members? I understand that access to static members of a class always needs to be synchronized- because they are shared across all object instances of the class.</p> <p>My question is when would I be incorrect if I do not synchronize instance members? </p> <p>for example if my class is</p> <pre><code>public class MyClass { private int instanceVar = 0; public setInstanceVar() { instanceVar++; } public getInstanceVar() { return instanceVar; } } </code></pre> <p>in what cases (of usage of the class <code>MyClass</code>) would I <em>need</em> to have methods: <code>public synchronized setInstanceVar()</code> and <code>public synchronized getInstanceVar()</code> ?</p> <p>Thanks in advance for your answers.</p>
[ { "answer_id": 309652, "author": "bruno conde", "author_id": 31136, "author_profile": "https://Stackoverflow.com/users/31136", "pm_score": 2, "selected": false, "text": "instanceVar" }, { "answer_id": 309670, "author": "Steve B.", "author_id": 19479, "author_profile":...
2008/11/21
[ "https://Stackoverflow.com/questions/309631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39732/" ]
309,638
<p>How can I prevent the pocket PC device from shutting down from my application when the power button pressed? I am using C#.</p>
[ { "answer_id": 311892, "author": "Jérôme Laban", "author_id": 26346, "author_profile": "https://Stackoverflow.com/users/26346", "pm_score": 0, "selected": false, "text": " [DllImport(\"coredll\")]\n private extern static IntPtr SetPowerRequirement(string pvDevice, int deviceState, ...
2008/11/21
[ "https://Stackoverflow.com/questions/309638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
309,639
<p>The following questions are about XML serialization/deserialization and schema validation for a .net library of types which are to be used for data exchange.</p> <hr> <p>First question, if I have a custom xml namespace say "<a href="http://mydomain/mynamespace" rel="nofollow noreferrer">http://mydomain/mynamespace</a>" do I have to add a</p> <pre><code>[XmlRoot(Namespace = "http://mydomain/mynamespace")] </code></pre> <p>to every class in my library. Or is there a way to define this namespace as default for the whole assembly?</p> <hr> <p>Second question, is there a reason behind the always added namespaces</p> <pre><code>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" </code></pre> <p>even if there is no actual reference to any of the namespaces? I just feel they add noise to the resulting xml. Is there a way to remove them an only have the custom namespace in the resulting xml?</p> <hr> <p>Third question, are there tools to support the generation of schema definitions (e.g. for all public [Serializable] classes of an assembly) and the validation of xml against specific schemas available?</p> <p>If there are, would you recommend XML Schema from W3C or RELAX NG?</p>
[ { "answer_id": 310150, "author": "david valentine", "author_id": 36627, "author_profile": "https://Stackoverflow.com/users/36627", "pm_score": 0, "selected": false, "text": "xsd /c /n:myNamespace.Schema.v2_0 myschema_v2_0.xsd\n" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/309639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21566/" ]
309,651
<p>I'm new to development on the iPhone. Just about every sample project (as well as the default project templates) have one or more delegates and controllers. Can someone give me a breakdown of what the delegates are responsible for vs. what the controllers are supposed to do?</p>
[ { "answer_id": 310250, "author": "wisequark", "author_id": 33159, "author_profile": "https://Stackoverflow.com/users/33159", "pm_score": 2, "selected": false, "text": "UIApplication" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/309651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/678/" ]
309,668
<p>Our web team has been asked to build some user interfaces in Sharepoint. The UI's would primarily be forms that would need to write to a SQL Server database.</p> <p>Is ASP.NET the best way to do this? If so what's the best way to integrate the ASP.NET application into Sharepoint?</p>
[ { "answer_id": 309684, "author": "Mauro", "author_id": 2208, "author_profile": "https://Stackoverflow.com/users/2208", "pm_score": 3, "selected": true, "text": "1. Build web parts \n2. build user controls , and use smart part to display them.\n3. use infopath \n4. host the asp.net in an ...
2008/11/21
[ "https://Stackoverflow.com/questions/309668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/67719/" ]
309,674
<p>I am looking for a good menu to use in an ASP.NET. I am currently using the asp menu. I need it to work in IE 6,7,8, Firefox and Safari. I also need it to not add a lot of overhead to the page client-side. I need to be able to load it from the database.</p>
[ { "answer_id": 1010268, "author": "CRice", "author_id": 55693, "author_profile": "https://Stackoverflow.com/users/55693", "pm_score": 0, "selected": false, "text": " .HorizontalMenu_DynamicMenuStyle\n{\n font-family: Verdana;\n font-size: medium;\n background-color: #FCFCFC;\...
2008/11/21
[ "https://Stackoverflow.com/questions/309674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5633/" ]
309,675
<p>I am creating an touch screen application using Swing and have a request to change one of buttons so that it will behave like a keyboard when the button is held down.<br> (First of all, I am not sure that the touch screen will allow the user to "hold down" the button, but pretend that they can for now)</p> <p>I was going to go down the path of starting a loop when <code>mousePressed</code> was called and then ending the loop when <code>mouseReleased</code> was called. This will involve starting a thread and having to deal with synchronization as well as <code>invokeLater()</code> to get events back on the <code>EventQueue</code>.</p> <p>Is there a very simple way to do what I want? I hope I am just not seeing the API to do it.</p>
[ { "answer_id": 37165865, "author": "Mike Lima", "author_id": 6320298, "author_profile": "https://Stackoverflow.com/users/6320298", "pm_score": 0, "selected": false, "text": "import java.awt.Font;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\nimport java.awt....
2008/11/21
[ "https://Stackoverflow.com/questions/309675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8517/" ]
309,680
<p>I have the following code that creates two objects (ProfileManager and EmployerManager) where the object EmployerManager is supposed to inherit from the object ProfileManager. However, when I do alert(pm instanceof ProfileManager); it returns false.</p> <pre><code>function ProfileFactory(profileType) { switch(profileType) { case 'employer': return new EmployerManager(); break; } } function ProfileManager() { this.headerHTML = null; this.contentHTML = null; this.importantHTML = null; this.controller = null; this.actions = new Array(); this.anchors = new Array(); } ProfileManager.prototype.loadData = function(action, dao_id, toggleBack) { var step = this.actions.indexOf(action); var prv_div = $('div_' + step - 1); var nxt_div = $('div_' + step); new Ajax.Request(this.controller, { method: 'get', parameters: {action : this.actions[step], dao_id : dao_id}, onSuccess: function(data) { nxt_div.innerHTML = data.responseText; if(step != 1 &amp;&amp; !prv_div.empty()) { prv_div.SlideUp(); } nxt_div.SlideDown(); for(i = 1; i &lt;= step; i++) { if($('step_anchor_' + i).innerHTML.empty()) { $('step_anchor_' + i).innerHTML = this.anchors[i]; } } } } ) } EmployerManager.prototype.superclass = ProfileManager; function EmployerManager() { this.superclass(); this.controller = 'eprofile.php'; this.anchors[1] = 'Industries'; this.anchors[2] = 'Employer Profiles'; this.anchors[3] = 'Employer Profile'; this.actions[1] = 'index'; this.actions[2] = 'employer_list'; this.actions[3] = 'employer_display'; } var pm = new ProfileFactory('employer'); alert(pm instanceof ProfileManager); </code></pre> <p>BTW, this is my very first attempt at Object-Oriented JavaScript, so if you feel compelled to comment on the stupidity of my approach please feel free to do so, but offer suggestions on how to approach the problem better.</p>
[ { "answer_id": 311331, "author": "Noah Goodrich", "author_id": 20178, "author_profile": "https://Stackoverflow.com/users/20178", "pm_score": 2, "selected": true, "text": "function EmployerManager() {\n\n this.controller = 'eprofile.php';\n this.anchors = new Array('Industries', 'Em...
2008/11/21
[ "https://Stackoverflow.com/questions/309680", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20178/" ]
309,682
<p>I'm writing a HTML form that's divided in fieldsets, and I need to get the form fields from a specific fiedset in a function.<br> Currently it's like this: </p> <pre><code>function conta(Fieldset){ var Inputs = Fieldset.getElementsByTagName("input"); var Selects = Fieldset.getElementsByTagName("select"); /* Doing the stuff I need to do in two iterations, one for each field type */ } </code></pre> <p>But who knows what the future may hold, and if the form gets some new field types (radios, checkboxes) this could become awful to mantain.<br> I know that <code>form</code> elements have the <code>elements</code> attribute that returns all the form fields and I was hoping I could use something like that.<br> (I know I still gotta discriminate the field type in a bunch of conditionals inside the iteration, but I think it would be faster and easier to keep. Unless it isn't and I should not be doing it)</p>
[ { "answer_id": 309691, "author": "Ryan Eastabrook", "author_id": 105, "author_profile": "https://Stackoverflow.com/users/105", "pm_score": 0, "selected": false, "text": "//$(\"input select textarea\").each(function() {\n$(\":input\").each(function() { //even better\n // do stuff here\...
2008/11/21
[ "https://Stackoverflow.com/questions/309682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9835/" ]
309,683
<p>I have a page with a few fields and a runtime-generated image on it. The contents of this page are inside an UpdatePanel. There is a button to take the user to a secondary page, which has a button that calls javascript:history.go(-1) when clicked.</p> <p>The problem is, the first page does a full request instead of a postback or just using the state it was in before navigating away from it. That is, the fields are all reset to their default values, thereby confusing the user. I'd like their values to be retained regardless of navigation. I do not want to create a new history state for every field change.</p> <p>Any ideas?</p>
[ { "answer_id": 309691, "author": "Ryan Eastabrook", "author_id": 105, "author_profile": "https://Stackoverflow.com/users/105", "pm_score": 0, "selected": false, "text": "//$(\"input select textarea\").each(function() {\n$(\":input\").each(function() { //even better\n // do stuff here\...
2008/11/21
[ "https://Stackoverflow.com/questions/309683", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
309,706
<p>So i'm not really sure why this is happening but I'm running through some DataRows where I have the control name, property, and value that I want to set. Everything works fine except when I set the TEXT property of a button. For some reason, the click event is called...</p> <p>Here's some of the code I've got:</p> <pre><code>string controlName, value, property; Control currentControl = null; System.Reflection.PropertyInfo propertyInfo = null; // run through all rows in the table and set the property foreach (DataRow r in languageDataset.Tables[_parentForm.Name].Rows) { controlName = r["ControlName"].ToString().ToUpper(); value = r["Value"].ToString(); property = r["Property"].ToString(); // check all controls on the form foreach (Control c in formControls) { // only change it if its the right control if (c.Name.ToUpper() == controlName) { propertyInfo = c.GetType().GetProperty(property); if (propertyInfo != null) propertyInfo.SetValue(c, value, null); ******Calls Event Handler?!?!****** // currentControl = c; break; } } } </code></pre> <p>So why in the world would it call the event handler when setting the value? Here's what I'm setting it with that's causing this:</p> <pre><code>&lt;SnappletChangePassword&gt; &lt;ControlName&gt;buttonAcceptPassword&lt;/ControlName&gt; &lt;Property&gt;Text&lt;/Property&gt; &lt;Value&gt;Accept&lt;/Value&gt; &lt;/SnappletChangePassword&gt; </code></pre>
[ { "answer_id": 309766, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "using System;\nusing System.Drawing;\nusing System.Reflection;\nusing System.Windows.Forms;\n\nclass Test\n{\n static ...
2008/11/21
[ "https://Stackoverflow.com/questions/309706", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21828/" ]
309,713
<p>I'm using a Flash TextField control to display some HTML content inside a Flash presentation to be shown on a large touch-screen kiosk. Unfortunately, if any image tag in the displayed HTML content points to a non-existent image, a dialogue is shown with the error message </p> <pre><code>Error #2044: Unhandled IOErrorEvent:. text=Error #2035: URL Not Found. </code></pre> <p>I am trying to avoid having that dialogue pop up. The <a href="http://www.kirupa.com/forum/showthread.php?t=287501" rel="nofollow noreferrer">solution</a> for loading content through a loader class is to catch <code>IOErrorEvent.IO_ERROR</code>, but I've tried listening for that on the TextField, on stage, Main and loaderInfo to no avail. I've tried wrapping the whole thing in a try-catch, and that also doesn't work.</p> <p>Here's the simplified code I'm using to find solutions:</p> <pre><code>package { import flash.display.Sprite; import flash.errors.IOError; import flash.events.Event; import flash.events.IOErrorEvent; import flash.text.TextField; import flash.text.TextFieldType; public class Main extends Sprite { public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); var html:TextField = new TextField(); html.type = TextFieldType.DYNAMIC; html.multiline = true; html.htmlText = "Bogus image: &lt;img src=\"foo.jpg\" /&gt;"; addChild(html); } } } </code></pre> <p><strong>Edit: And here's the entire working code.</strong></p> <p>For dynamic content and so forth, of course, you would need a list of images and a function to generate handlers, etc.</p> <pre><code>package { import flash.display.Loader; import flash.display.Sprite; import flash.errors.IOError; import flash.events.Event; import flash.events.IOErrorEvent; import flash.text.TextField; import flash.text.TextFieldType; public class Main extends Sprite { public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); var html:TextField = new TextField(); html.type = TextFieldType.DYNAMIC; html.multiline = true; html.htmlText = "Bogus image: &lt;img id=\"image\" src=\"foo.jpg\" /&gt;"; var loader:Loader = html.getImageReference("image") as Loader; if(loader){ loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function(e:Event):void { trace("Error loading foo.jpg!"); }); } addChild(html); } } } </code></pre>
[ { "answer_id": 329881, "author": "aaaidan", "author_id": 26331, "author_profile": "https://Stackoverflow.com/users/26331", "pm_score": -1, "selected": false, "text": "stage.addEventListener(IOError.IO_ERROR, myErrorHandler);\n" }, { "answer_id": 917971, "author": "Community",...
2008/11/21
[ "https://Stackoverflow.com/questions/309713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7526/" ]
309,723
<p>Is there a way to view the list of <em>recent documents</em> you've opened in Vim?</p> <p>I realize I could view the cursor <em>jump list</em>, <code>:ju</code>, and then go to a cursor position in the list but this is not ideal because there will be multiple listings of the same document in the list.</p> <p>Is there another command which would do what I'm looking for?</p>
[ { "answer_id": 4633847, "author": "Alex Bolotov", "author_id": 66473, "author_profile": "https://Stackoverflow.com/users/66473", "pm_score": 9, "selected": true, "text": ":help old" }, { "answer_id": 47565251, "author": "ZHOU Ling", "author_id": 4505813, "author_profi...
2008/11/21
[ "https://Stackoverflow.com/questions/309723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16973/" ]
309,734
<p>I need to be able to take an arbitrary text input that may have a byte order marker (BOM) on it to mark its encoding, and output it as ASCII. We have some old tools that don't understand BOM's and I need to send them ASCII-only data.</p> <p>Now, I just got done writing this code and I just can't quite believe the inefficiency here. Four copies of the data, not to mention any intermediate buffers internally in StreamReader. Is there a better way to do this?</p> <pre><code>// i_fileBytes is an incoming byte[] string unicodeString = new StreamReader(new MemoryStream(i_fileBytes)).ReadToEnd(); byte[] unicodeBytes = Encoding.Unicode.GetBytes(unicodeString.ToCharArray()); byte[] ansiBytes = Encoding.Convert(Encoding.Unicode, Encoding.ASCII, unicodeBytes); string ansiString = Encoding.ASCII.GetString(ansiBytes); </code></pre> <p>I need the StreamReader() because it has an internal BOM detector to choose the encoding to read the rest of the file. Then the rest is just to make it convert into the final ASCII string.</p> <p>Is there a better way to do this?</p>
[ { "answer_id": 309791, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": true, "text": "Encoding.Unicode.GetString" }, { "answer_id": 3347509, "author": "Joshua", "author_id": 14768, "autho...
2008/11/21
[ "https://Stackoverflow.com/questions/309734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14582/" ]
309,737
<p>I'm using the Apache Commons EqualsBuilder to build the equals method for a non-static Java inner class. For example:</p> <pre><code>import org.apache.commons.lang.builder.EqualsBuilder; public class Foo { public class Bar { private Bar() {} public Foo getMyFoo() { return Foo.this } private int myInt = 0; public boolean equals(Object o) { if (o == null || o.getClass() != getClass) return false; Bar other = (Bar) o; return new EqualsBuilder() .append(getMyFoo(), other.getMyFoo()) .append(myInt, other.myInt) .isEquals(); } } public Bar createBar(...) { //sensible implementation } public Bar createOtherBar(...) { //another implementation } public boolean equals(Object o) { //sensible equals implementation } } </code></pre> <p>Is there syntax by which I can refer to <code>other</code>'s <code>Foo</code> reference apart from declaring the <code>getMyFoo()</code> method? Something like <code>other.Foo.this</code> (which doesn't work)?</p>
[ { "answer_id": 309891, "author": "p3t0r", "author_id": 16685, "author_profile": "https://Stackoverflow.com/users/16685", "pm_score": 2, "selected": false, "text": "public class Foo {\n\n public Bar createBar(){\n Bar bar = new Bar(this)\n return bar;\n }\n}\n\npublic class Bar {\...
2008/11/21
[ "https://Stackoverflow.com/questions/309737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/390636/" ]
309,740
<p>I read about this ages ago but never tried it now I can't remember if this is possible or not. Is it possible to extend a class from two parents on php5 e.g.</p> <p>class_d extends class_c and class_b</p> <p>moreover can you do this if class_c and class_b are themselves extended from class_a ... so you get something like this</p> <pre><code> class_a class_b class_c class_d </code></pre>
[ { "answer_id": 309891, "author": "p3t0r", "author_id": 16685, "author_profile": "https://Stackoverflow.com/users/16685", "pm_score": 2, "selected": false, "text": "public class Foo {\n\n public Bar createBar(){\n Bar bar = new Bar(this)\n return bar;\n }\n}\n\npublic class Bar {\...
2008/11/21
[ "https://Stackoverflow.com/questions/309740", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
309,744
<p>Is there a basic php method that accepts a URL and retrieves the date last modified from the header? </p> <p>It would seem like something php can do, but I'm not sure which object to check.</p> <p>Thanks</p>
[ { "answer_id": 309770, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 3, "selected": false, "text": "$c = curl_init('http://...');\ncurl_setopt($c, CURLOPT_HEADER, 1); // Include the header\ncurl_setopt($c, CURLOPT_RETURNTRANS...
2008/11/21
[ "https://Stackoverflow.com/questions/309744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26577/" ]
309,745
<p>How do I check to see if a variable is a number, or contains a number, in UNIX shell?</p>
[ { "answer_id": 309789, "author": "Piotr Lesnicki", "author_id": 38796, "author_profile": "https://Stackoverflow.com/users/38796", "pm_score": 4, "selected": false, "text": "test" }, { "answer_id": 309804, "author": "Adam Rosenfield", "author_id": 9530, "author_profile...
2008/11/21
[ "https://Stackoverflow.com/questions/309745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
309,769
<p>What's the most common way to deal with a series of block elements that need to be on a line (if javascript needs to be able to modify their widths, for example)? What are the pros and cons to applying float:left to each of them vs. using positioning to place them?</p>
[ { "answer_id": 310435, "author": "Darko", "author_id": 32943, "author_profile": "https://Stackoverflow.com/users/32943", "pm_score": 3, "selected": true, "text": "<div id=\"con\">\n <div class=\"float\"></div>\n <div class=\"float\"></div>\n</div>\n" }, { "answer_id": 31048...
2008/11/21
[ "https://Stackoverflow.com/questions/309769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32771/" ]
309,775
<p>I want to design a class that will parse a string into tokens that are meaningful to my application.</p> <p>How do I design it?</p> <ol> <li>Provide a ctor that accepts a string, provide a Parse method and provide methods (let's call them "minor") that return individual tokens, count of tokens etc. OR</li> <li>Provide a ctor that accepts nothing, provide a Parse method that accepts a string and minor methods as above. OR</li> <li>Provide a ctor that accepts a string and provide only minor methods but no parse method. The parsing is done by the ctor.</li> </ol> <p>1 and 2 have the disadvantage that the user may call minor methods without calling the Parse method. I'll have to check in every minor method that the Parse method was called.</p> <p>The problem I see in 3 is that the parse method may potentially do a lot of things. It just doesn't seem right to put it in the ctor.</p> <p>2 is convenient in that the user may parse any number of strings without instantiating the class again and again.</p> <p>What's a good approach? What are some of the considerations?</p> <p>(the language is c#, if someone cares).</p> <p>Thanks</p>
[ { "answer_id": 309806, "author": "Garry Shutler", "author_id": 6369, "author_profile": "https://Stackoverflow.com/users/6369", "pm_score": 2, "selected": false, "text": "ValueObject values = parsingClass.Parse(theString);\n" }, { "answer_id": 309937, "author": "Jeromy Irvine"...
2008/11/21
[ "https://Stackoverflow.com/questions/309775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
309,786
<p>How do I force Postgres to use an index when it would otherwise insist on doing a sequential scan?</p>
[ { "answer_id": 309814, "author": "Patryk Kordylewski", "author_id": 30927, "author_profile": "https://Stackoverflow.com/users/30927", "pm_score": 7, "selected": false, "text": "enable_seqscan" }, { "answer_id": 13409114, "author": "Niraj Bhawnani", "author_id": 1810915, ...
2008/11/21
[ "https://Stackoverflow.com/questions/309786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91385/" ]
309,790
<p>In Java, what is the difference between the twin methods?</p> <pre><code>public void methodA() throws AnException { //do something throw new AnException(); } public void methodA() { //do the same thing throw new AnException(); } </code></pre> <p>I have a intuition that it has something to do with being a well-designed method (because I put methodA in an interface, declared it the way methodA* does in its implementation and received a warning from Java that "A* cannot override A because A* doesn't throw AnException"). </p> <p>Is this speculation correct? </p> <p>Is there any other subtle connotations in the two ways of doing things?</p>
[ { "answer_id": 671252, "author": "Yuval", "author_id": 2819, "author_profile": "https://Stackoverflow.com/users/2819", "pm_score": 2, "selected": false, "text": "public abstract class AbstractBox {\n public abstract void addItem(Item newItem);\n public abstract void removeItem(Item old...
2008/11/21
[ "https://Stackoverflow.com/questions/309790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8203/" ]
309,802
<p>Is there any way to set an event handler without doing it manually in the classname.designer.cs file other than double clicking the UI element?</p>
[ { "answer_id": 309807, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 2, "selected": false, "text": "myButton.Click += myHandler;\n" }, { "answer_id": 309810, "author": "Dan C.", "author_id": 26391, ...
2008/11/21
[ "https://Stackoverflow.com/questions/309802", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2184/" ]
309,815
<p>How do you control the column width in a gridview control in ASP.NET 2.0?</p>
[ { "answer_id": 309863, "author": "DCNYAM", "author_id": 30419, "author_profile": "https://Stackoverflow.com/users/30419", "pm_score": 2, "selected": false, "text": "<asp:BoundField HeaderText=\"Name\" DataField=\"LastName\">\n <HeaderStyle Width=\"20em\" />\n</asp:BoundField>\n" }, ...
2008/11/21
[ "https://Stackoverflow.com/questions/309815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
309,818
<p>I'm try to extract info from a MySQL DB into a MS SQL DB. The DB is a mess and the developer is no longer available.</p> <p>All dates are in char fields, and I use </p> <pre><code>SELECT concat( mid(DueDate, 7, 4), mid(DueDate, 4, 2), mid(DueDate, 1, 2)) as DueDate FROM TableName </code></pre> <p>to get the date field in a format so MS sql server can import them.</p> <p>Now, I want to export only the record with the date greater than today, so the questions are:</p> <ul> <li>What is the equivalent of GetDate() in MySQL?</li> <li>Is there a better way to cast the date to make the comparison?</li> </ul>
[ { "answer_id": 309823, "author": "Dónal", "author_id": 2648, "author_profile": "https://Stackoverflow.com/users/2648", "pm_score": 5, "selected": true, "text": "mysql> SELECT STR_TO_DATE('04/31/2004', '%m/%d/%Y');\n -> '2004-04-31'\n" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/309818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2385/" ]
309,819
<p>Has there been any attempt and creating a formalized method for organizing CSS code? Before I go and make up my own strategy for keeping things readable, I'm wondering what else is out there. Google hasn't been very helpful, as I'm not entirely sure what terms to search for.</p> <p>I'm thinking more along the lines of indenting/spacing, when to use new lines, naming conventions, etc.</p> <p>Any ideas?</p>
[ { "answer_id": 310072, "author": "cowgod", "author_id": 6406, "author_profile": "https://Stackoverflow.com/users/6406", "pm_score": 2, "selected": false, "text": "#page_container" }, { "answer_id": 310104, "author": "Andy Ford", "author_id": 17252, "author_profile": "...
2008/11/21
[ "https://Stackoverflow.com/questions/309819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5291/" ]
309,834
<p>I have a read query that I execute within a transaction so that I can specify the isolation level. Once the query is complete, what should I do?</p> <ul> <li>Commit the transaction </li> <li>Rollback the transaction</li> <li>Do nothing (which will cause the transaction to be rolled back at the end of the using block)</li> </ul> <p>What are the implications of doing each?</p> <pre><code>using (IDbConnection connection = ConnectionFactory.CreateConnection()) { using (IDbTransaction transaction = connection.BeginTransaction(IsolationLevel.ReadUncommitted)) { using (IDbCommand command = connection.CreateCommand()) { command.Transaction = transaction; command.CommandText = "SELECT * FROM SomeTable"; using (IDataReader reader = command.ExecuteReader()) { // Read the results } } // To commit, or not to commit? } } </code></pre> <p>EDIT: The question is not if a transaction should be used or if there are other ways to set the transaction level. The question is if it makes any difference that a transaction that does not modify anything is committed or rolled back. Is there a performance difference? Does it affect other connections? Any other differences?</p>
[ { "answer_id": 309848, "author": "StingyJack", "author_id": 16391, "author_profile": "https://Stackoverflow.com/users/16391", "pm_score": -1, "selected": false, "text": "SELECT * FROM SomeTable WITH (NOLOCK)\n" }, { "answer_id": 309849, "author": "Joel Coehoorn", "author_...
2008/11/21
[ "https://Stackoverflow.com/questions/309834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8739/" ]
309,880
<p>I'm trying to create a custom transition, to serve as a replacement for a default transition you would get here, for example:</p> <pre><code>[self.navigationController pushViewController:someController animated:YES]; </code></pre> <p>I have prepared an OpenGL-based view that performs an effect on some static texture mapped to a plane (let's say it's a copy of the flip effect in Core Animation). What I don't know how to do is:</p> <ul> <li>grab current view content and make a texture out of it (I remember seeing a function that does just that, but can't find it)</li> <li>how to do the same for the view that is currently offscreen and is going to replace current view </li> <li>are there some APIs I can hook to in order to make my transition class as native as possible (make it a kind of Core Animation effect)?</li> </ul> <p>Any thoughts or links are greatly appreciated!</p> <p><strong>UPDATE</strong></p> <p>Jeffrey Forbes's answer works great as a solution to capture the content of a view. </p> <p>What I haven't figured out yet is how to capture the content of the view I want to transition to, which should be invisible until the transition is done.</p> <p>Also, which method should I use to present the OpenGL view? For demonstration purposes I used pushViewController. That affects the navbar, though, which I actually want to go one item back, with animation, check this vid for explanation:</p> <p><a href="http://vimeo.com/4649397" rel="noreferrer">http://vimeo.com/4649397</a>.</p> <p>Another option would be to go with presentViewController, but that shows fullscreen. Do you think maybe creating another window (or view?) could be useful?</p>
[ { "answer_id": 312112, "author": "Jeffrey Forbes", "author_id": 28019, "author_profile": "https://Stackoverflow.com/users/28019", "pm_score": 3, "selected": true, "text": "UIGraphicsBeginImageContext(self.view.frame.size);\n[[self.view layer] renderInContext:UIGraphicsGetCurrentContext()...
2008/11/21
[ "https://Stackoverflow.com/questions/309880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9804/" ]
309,884
<p>The code golf series seem to be fairly popular. I ran across some code that converts a number to its word representation. Some examples would be (powers of 2 for programming fun):</p> <ul> <li>2 -> Two</li> <li>1024 -> One Thousand Twenty Four</li> <li>1048576 -> One Million Forty Eight Thousand Five Hundred Seventy Six</li> </ul> <p>The algorithm my co-worker came up was almost two hundred lines long. Seems like there would be a more concise way to do it.</p> <p>Current guidelines:</p> <ul> <li>Submissions in any <strong>programming</strong> language welcome (I apologize to PhiLho for the initial lack of clarity on this one)</li> <li>Max input of 2^64 (see following link for words, thanks mmeyers)</li> <li><a href="http://en.wikipedia.org/wiki/Long_and_short_scales" rel="nofollow noreferrer">Short scale</a> with English output preferred, but any algorithm is welcome. Just comment along with the programming language as to the method used.</li> </ul>
[ { "answer_id": 309962, "author": "gpojd", "author_id": 28071, "author_profile": "https://Stackoverflow.com/users/28071", "pm_score": 5, "selected": false, "text": "perl -MNumber::Spell -e 'print spell_number(2);'\n" }, { "answer_id": 309982, "author": "Robert Gamble", "au...
2008/11/21
[ "https://Stackoverflow.com/questions/309884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2470/" ]
309,892
<p>I ran into an interesting behavior recently. It seems that if I override .equals() to take a parameter other than Object, it doesn't get called. Can anyone explain to me why this is happening? It seems to violate my understanding of polymorphism in OOP, but maybe I'm missing something.</p> <p>Here's much simpler code that shows what I'm seeing:</p> <pre><code>public class MyClass { private int x; public MyClass(int n) { x = n; } public boolean equals(Object o) { return false; } public boolean equals(MyClass mc) { return x == mc.x; } public static void main(String[] args) { List&lt;MyClass&gt; list = new ArrayList&lt;MyClass&gt;(); list.add(new MyClass(3)); System.out.println("Contains 3? " + list.contains(new MyClass(3))); } } </code></pre> <p>When this is run, it prints "<code>Contains 3? false</code>". It looks like the equals(Object) function is called, even though there is another that would work. By contrast, if I write equals like this the code works as expected:</p> <pre><code>public boolean equals(Object o) { if(!(o instanceof MyClass)) return false; MyClass mc = (MyClass)o; return x == mc.x; } </code></pre> <p>Why isn't it figuring out which version of the function to call based on the type of the parameter?</p>
[ { "answer_id": 309974, "author": "InverseFalcon", "author_id": 39455, "author_profile": "https://Stackoverflow.com/users/39455", "pm_score": -1, "selected": false, "text": "contains()" }, { "answer_id": 310165, "author": "blizpasta", "author_id": 20646, "author_profil...
2008/11/21
[ "https://Stackoverflow.com/questions/309892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18511/" ]
309,921
<p>Wondering how to open many new windows with Javascript. I have found plenty of places on the internet that show you how to open a new browser window with Javascript, but I want to open a new UNIQUE window. For Example.</p> <p>I have two links on a page. the user clicks on both links and they are both opened in the same window. I want each link to open a new window WITH JAVASCRIPT.</p> <p>Another Example. <strong>I just opened a window with javascript and I have a link inside my newly opened window. I click on the link and it opens in the same window. I want to pop it out of that window WITH JAVASCRIPT, NOT use the same window.</strong></p> <p>Help?</p>
[ { "answer_id": 309926, "author": "Gavin Miller", "author_id": 33226, "author_profile": "https://Stackoverflow.com/users/33226", "pm_score": 3, "selected": true, "text": "window.open('page.html','WindowTitle','width=400,height=200')\n" }, { "answer_id": 310129, "author": "ibst...
2008/11/21
[ "https://Stackoverflow.com/questions/309921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7644/" ]
309,922
<p>Is it only to allow logical grouping?</p>
[ { "answer_id": 310030, "author": "Roddy", "author_id": 1737, "author_profile": "https://Stackoverflow.com/users/1737", "pm_score": 0, "selected": false, "text": "PROPERTY(int, MyVal);\n" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/309922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37952/" ]
309,930
<p>I've got a database with three tables: Books (with book details, PK is CopyID), Keywords (list of keywords, PK is ID) and KeywordsLink which is the many-many link table between Books and Keywords with the fields ID, BookID and KeywordID.</p> <p>I'm trying to make an advanced search form in my app where you can search on various criteria. At the moment I have it working with Title, Author and Publisher (all from the Book table). It produces SQL like:</p> <pre><code>SELECT * FROM Books WHERE Title Like '%Software%' OR Author LIKE '%Spolsky%'; </code></pre> <p>I want to extend this search to also search using tags - basically to add another OR clause to search the tags. I've tried to do this by doing the following</p> <pre><code>SELECT * FROM Books, Keywords, Keywordslink WHERE Title LIKE '%Joel%' OR (Name LIKE '%good%' AND BookID=Books.CopyID AND KeywordID=Keywords.ID) </code></pre> <p>I thought using the brackets might separate the 2nd part into its own kinda clause, so the join was only evaluated in that part - but it doesn't seem to be so. All it gives me is a long list of multiple copies of the one book that satisfies the <code>Title LIKE '%Joel%'</code> bit.</p> <p>Is there a way of doing this using pure SQL, or would I have to use two SQL statements and combine them in my app (removing duplicates in the process).</p> <p>I'm using MySQL at the moment if that matters, but the app uses ODBC and I'm hoping to make it DB agnostic (might even use SQLite eventually or have it so the user can choose what DB to use).</p>
[ { "answer_id": 309942, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 1, "selected": false, "text": "SELECT * FROM books WHERE title LIKE'%Joel%' OR bookid IN \n (SELECT bookid FROM keywordslink WHERE keywordid I...
2008/11/21
[ "https://Stackoverflow.com/questions/309930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1912/" ]
309,939
<p>I have a class library with all my database logic. My DAL/BLL. </p> <p>I have a few web projects which will use the same database and classes, so I thought it was a good idea to abstract the data layer into its own project.</p> <p>However, when it comes to adding functionality to classes for certain projects I want to add methods to certain classes.</p> <p>For example, my data layer has Product and SomeItem objects:</p> <pre><code>// Data Access Layer project namespace DAL { public class Product { //implementation here } public class SomeItem { //implementation here } } </code></pre> <p>In one project I want to add an interface that is used by different content items, so I have a class called:</p> <pre><code>// This is in Web Project namespace DAL { public partial class Product : ICustomBehaviour { #region ICustomBehaviour Implementation TheSharedMethod(); #endregion } } </code></pre> <p><strong>Is it a good idea to write a partial class in a separate project (creating a dependency) using the <em>same</em> namespace? If it's a bad idea, how can I get this type of functionality to work?</strong></p> <p>It doesn't seem to want to merge them at compile time, so I'm not sure what I'm doing wrong.</p>
[ { "answer_id": 383654, "author": "user47460", "author_id": 47460, "author_profile": "https://Stackoverflow.com/users/47460", "pm_score": 0, "selected": false, "text": "Northind.DAL (prj)\n-NorthindDataContext (EntityNamespace set to \"Northwind.BLL\")\n--Product() (Entity, partial class ...
2008/11/21
[ "https://Stackoverflow.com/questions/309939", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26931/" ]
309,943
<p>Need to an expression that returns only things with an "I" followed by either a "J" or a "V" (No Quotes) and then a minimum of 1 number up to 3 numbers.</p> <p>I J### <br /> I V### <br /> I J## <br /> I V## <br /> I J# <br /> I v# <br /></p>
[ { "answer_id": 309952, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 3, "selected": true, "text": "I(J|V)[0-9]{1,3}\n" }, { "answer_id": 309955, "author": "Vinko Vrsalovic", "author_id": 5190, "author_pro...
2008/11/21
[ "https://Stackoverflow.com/questions/309943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38349/" ]
309,945
<p>For some reasons, I would like to do an explicit quoting of a string value (becoming a part of constructed SQL query) instead of waiting for implicit quotation performed by <code>cursor.execute</code> method on contents of its second parameter.</p> <p>By "implicit quotation" I mean:</p> <pre><code>value = "Unsafe string" query = "SELECT * FROM some_table WHERE some_char_field = %s;" cursor.execute( query, (value,) ) # value will be correctly quoted </code></pre> <p>I would prefer something like that:</p> <pre><code>value = "Unsafe string" query = "SELECT * FROM some_table WHERE some_char_field = %s;" % \ READY_TO_USE_QUOTING_FUNCTION(value) cursor.execute( query ) # value will be correctly quoted, too </code></pre> <p>Is such low level <code>READY_TO_USE_QUOTING_FUNCTION</code> expected by Python DB API specification (I couldn't find such functionality in <a href="http://www.python.org/dev/peps/pep-0249/" rel="noreferrer">PEP 249</a> document). If not, maybe Psycopg2 provides such function? If not, maybe Django provides such function? I would prefer not to write such function myself...</p>
[ { "answer_id": 310011, "author": "davidavr", "author_id": 8247, "author_profile": "https://Stackoverflow.com/users/8247", "pm_score": 0, "selected": false, "text": "connection" }, { "answer_id": 310078, "author": "Richard Levasseur", "author_id": 36805, "author_profil...
2008/11/21
[ "https://Stackoverflow.com/questions/309945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26141/" ]
309,953
<p>Is it possible to catch an error when using JSONP with jQuery? I've tried both the $.getJSON and $.ajax methods but neither will catch the 404 error I'm testing. Here is what I've tried (keep in mind that these all work successfully, but I want to handle the case when it fails):</p> <pre><code>jQuery.ajax({ type: "GET", url: handlerURL, dataType: "jsonp", success: function(results){ alert("Success!"); }, error: function(XMLHttpRequest, textStatus, errorThrown){ alert("Error"); } }); </code></pre> <p>And also:</p> <pre><code>jQuery.getJSON(handlerURL + "&amp;callback=?", function(jsonResult){ alert("Success!"); }); </code></pre> <p>I've also tried adding the $.ajaxError but that didn't work either:</p> <pre><code>jQuery(document).ajaxError(function(event, request, settings){ alert("Error"); }); </code></pre> <p>Thanks in advance for any replies!</p>
[ { "answer_id": 2085814, "author": "Fhansen", "author_id": 253158, "author_profile": "https://Stackoverflow.com/users/253158", "pm_score": 2, "selected": false, "text": "jQuery(document).ajaxError(function(event, request, settings){\n alert(\"Error\");\n});\n" }, { "answer_id": ...
2008/11/21
[ "https://Stackoverflow.com/questions/309953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12367/" ]
309,979
<p>I have a LinkButton that has to postback to perform some logic.</p> <p>Once it is finished, instead of loading the page back up in the browser, I want to leave it alone and pop open a new window.</p> <p>So far, the best idea I've had is to put the LinkButton in an UpdatePanel, and have it render some JavaScript out when it reloads, yet I think that is totally hacky. Also, if I recall right, JavaScript within a update panel won't run anyways.</p> <p>Any other ideas?</p>
[ { "answer_id": 310231, "author": "azamsharp", "author_id": 3797, "author_profile": "https://Stackoverflow.com/users/3797", "pm_score": 2, "selected": false, "text": "protected void Button1_Click(object sender, EventArgs e)\n\n{\n\n// Do some server side work\n\nstring script = \"window.o...
2008/11/21
[ "https://Stackoverflow.com/questions/309979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
309,991
<p>I have a just one table mapped in a datacontext. Here's the property and attribute on the column of interest:</p> <pre><code>[Column(Storage="_CustomerNumber", DbType="VarChar(25)")] public string CustomerNumber { </code></pre> <p>This column is, in fact, a varchar(25) and has an index.</p> <p>I've got some simple code:</p> <pre><code>DataClasses1DataContext myDC = new DataClasses1DataContext(); myDC.Log = Console.Out; List&lt;string&gt; myList = new List&lt;string&gt;() { "111", "222", "333" }; myDC.Customers .Where(c =&gt; myList.Contains(c.CustomerNumber)) .ToList(); </code></pre> <p>Which generates this SQL text:</p> <pre><code>SELECT [t0].[CustomerNumber], [t0].[CustomerName] FROM [dbo].[Customers] AS [t0] WHERE [t0].[CustomerNumber] IN (@p0, @p1, @p2) -- @p0: Input NVarChar (Size = 3; Prec = 0; Scale = 0) [111] -- @p1: Input NVarChar (Size = 3; Prec = 0; Scale = 0) [222] -- @p2: Input NVarChar (Size = 3; Prec = 0; Scale = 0) [333] -- Context: SqlProvider(Sql2005) Model: AttributedMetaModel Build: 3.5.21022.8 </code></pre> <p>Notice that the paramaters are nvarchar!</p> <p>When this query hits the database, it generates a horrible plan which involves <strong>converting the multi-million row index on CustomerNumber to nvarchar</strong> before seeking within it.</p> <p>I'm not allowed to change the table, but I can change the query and the dbml. What can I do to get the data out without getting this index conversion?</p>
[ { "answer_id": 310024, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 0, "selected": false, "text": "List<IQueryable<Customer>> myQueries = \n myList.Select(s => myDC.Customers.Where(c => c.CustomerNumber == s)).ToList();\nI...
2008/11/21
[ "https://Stackoverflow.com/questions/309991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8155/" ]
310,010
<p>There are (at least) two ways that technical debts make their way into projects. The first is by conscious decision. Some problems just are not worth tackling up front, so they are consciously allowed to accumulate as technical debt. The second is by ignorance. The people working on the project don't know or don't realize that they are incurring a technical debt. This question deals with the second. Are there technical debts that you let into your project that would have been trivial to keep out ("If I had only known...") but once they were embedded in the project, they became dramatically more costly? </p>
[ { "answer_id": 310076, "author": "Kornel", "author_id": 27009, "author_profile": "https://Stackoverflow.com/users/27009", "pm_score": 3, "selected": false, "text": "alert('hello there!')" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/310010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17834/" ]
310,017
<p>I see two types of examples in various places. One uses form fields like</p> <blockquote> <p>curl -X PUT -d "phone=123.456.7890" "<a href="http://127.0.0.1/services/rest/user/123" rel="nofollow noreferrer">http://127.0.0.1/services/rest/user/123</a>"</p> </blockquote> <p>and the other uses an XML content like (some variation of) this</p> <blockquote> <p>echo "&lt;user>&lt;id>123&lt;/id>&lt;phone>123.456.7890&lt;/phone>&lt;/user>" | curl -X PUT -d @- "<a href="http://127.0.0.1/services/rest/user/" rel="nofollow noreferrer">http://127.0.0.1/services/rest/user/</a>"</p> </blockquote> <p>It seems like using the form fields has the advantage of brevity and clearly identifying the client's intent by targeting just the modified fields, but makes it awkward to address "deeper" metadata.</p> <p>Using the XML content has an advantage of being more complete, but the disadvantage of the overhead of figuring out which field the client is actually modifying (assuming that they send back the entire resource with small modifications).</p> <p>Is there a best practice, or even a more-common practice?</p>
[ { "answer_id": 310172, "author": "Kornel", "author_id": 27009, "author_profile": "https://Stackoverflow.com/users/27009", "pm_score": 0, "selected": false, "text": "<phone type=\"work, mobile\"><num>555-555</num><ext>123</ext></phone>\n" }, { "answer_id": 313126, "author": "j...
2008/11/21
[ "https://Stackoverflow.com/questions/310017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39784/" ]
310,018
<p>Is there any GUI-based tools to assist you with writing and maintaining the configuration file? Any code tools to codegen the config file? What are the best ways to make this a little bit easier? Are most people just using Castle ActiveRecord now?</p>
[ { "answer_id": 310221, "author": "Erik Öjebo", "author_id": 276, "author_profile": "https://Stackoverflow.com/users/276", "pm_score": 3, "selected": true, "text": "public CustomerMap : ClassMap<Customer>\n{\n public CustomerMap()\n {\n Id(x => x.ID);\n Map(x => x.Name);\n Map(...
2008/11/21
[ "https://Stackoverflow.com/questions/310018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36590/" ]
310,031
<p>I am using Borland Builder C++ 2009. I want to add a button to a form that allows the user to open a file in Excel that I specify. I can't think of how to do this. I know how to link with other code and executables -- is there a Microsoft Excel executable that I could use? How could I specify the file then? Any hints on this, or at least a place to look online, would be greatly appreciated.</p>
[ { "answer_id": 310598, "author": "Shishiree", "author_id": 23970, "author_profile": "https://Stackoverflow.com/users/23970", "pm_score": 2, "selected": false, "text": "ShellExecute(NULL, \"open\" ,\"Excel.exe\", \"C:\\\\Documents and Settings\\\\Lab1\\\\My Documents\\\\Waypoint Tool.xls\...
2008/11/21
[ "https://Stackoverflow.com/questions/310031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23970/" ]
310,032
<p>When printing a single character in a C program, must I use "%1s" in the format string? Can I use something like "%c"?</p>
[ { "answer_id": 310040, "author": "Evan Teran", "author_id": 13430, "author_profile": "https://Stackoverflow.com/users/13430", "pm_score": 7, "selected": false, "text": "%c" }, { "answer_id": 310100, "author": "Douglas Leeder", "author_id": 3978, "author_profile": "htt...
2008/11/21
[ "https://Stackoverflow.com/questions/310032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37952/" ]
310,035
<p>Is tilde a legitimate character in an XML SOAP message? I get a <code>SAXParseException:Content not allowed in prolog</code>. I included most of the SOAP message just in case I'm barking up the wrong tree.</p> <pre><code>POST /... HTTP/1.0 Content-Type: text/xml; charset=utf-8 Accept: application/soap+xml, application/dime, multipart/related, text/* User-Agent: Axis/1.4 Host: 127.0.0.1:1234 Cache-Control: no-cache Pragma: no-cache SOAPAction: &quot;&quot; Content-Length: 1497 Authorization: Basic b3BlbnBkbTpvdHRvMTIz &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;soapenv:Envelope xmlns:soapenv=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot; xmlns:xsd=&quot;http://www.w3.org/2001/XMLSchema&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&gt; &lt;soapenv:Body&gt; &lt;ns1:query soapenv:encodingStyle=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot; xmlns:ns1=&quot;http://localhost&quot;&gt; &lt;where xsi:type=&quot;soapenc:string&quot; xmlns:soapenc=&quot;http://schemas.xmlsoap.org/soap/encoding/&quot;&gt;type ~~ 'command'&lt;/where&gt; &lt;/ns1:query&gt; &lt;/soapenv:Body&gt; &lt;/soapenv:Envelope&gt; </code></pre>
[ { "answer_id": 310135, "author": "Tim Pietzcker", "author_id": 20670, "author_profile": "https://Stackoverflow.com/users/20670", "pm_score": 2, "selected": false, "text": "codecs.open(filename, \"UTF-8\")" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/310035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39787/" ]
310,036
<p>Evidently hash keys are compared in a case-sensitive manner.</p> <pre><code>$ perl -e '%hash = ( FOO =&gt; 1 ); printf "%s\n", ( exists $hash{foo} ) ? "Yes" : "No";' No $ perl -e '%hash = ( FOO =&gt; 1 ); printf "%s\n", ( exists $hash{FOO} ) ? "Yes" : "No";' Yes </code></pre> <p>Is there a setting to change that for the current script?</p>
[ { "answer_id": 2886996, "author": "amphetamachine", "author_id": 237955, "author_profile": "https://Stackoverflow.com/users/237955", "pm_score": 3, "selected": false, "text": "my %hash = (FOO => 1);\nmy $key = 'fOo'; # or 'foo' for that matter\n\nmy %lookup = map {(lc $_, $hash{$_})} key...
2008/11/21
[ "https://Stackoverflow.com/questions/310036", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39153/" ]
310,058
<p><strong>Problem Statement:</strong> I would like to create an offline database to lookup prices/info on the n most useful books to sell in the United States (where n is probably 3 million or so). </p> <p><strong>Question:</strong> So, my question is (and I am open to other approaches here as well), I am trying to figure out how to use Amazon AWS to download a list of the n higest salesrank books being sold as well as some information about the book (i.e. title, prices, etc...).</p> <p><strong>What I have done so far:</strong> First, something like this exists already (asellertool.com), however, I thought this would be an interesting project to work on and quite frankly, we aren't serious enough to need to pay the $30/month subscription.</p> <p>Now, AWS is great (and easy) if you have a few items you want to look up, but I can't seem to figure out how enumerate on sales rank. Originally, I was hoping to enumerate all of the book items Amazon had by ISBN. But that wasn't available either. Then I thought I could find a list of all ISBN numbers out there, but that was a dead end too. Finally I thought I could create my own list of ISBN numbers, but as I did some back of the envelope calculations, I thought better of it as my solutions would take roughly a year to go through a third of the 10 digit space at 100/second (and it was overkill anyway).</p> <p>So, I am back on Sales Ranking, which is currently seems like a dead end as well. So, if you have any thoughts, I would appreciate it.</p>
[ { "answer_id": 364339, "author": "alexandrul", "author_id": 19756, "author_profile": "https://Stackoverflow.com/users/19756", "pm_score": 1, "selected": false, "text": "Amazon E-Commerce Service" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/310058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39758/" ]
310,062
<p>I can handle the process that file part, but before I go crazy, has someone built a simple wcf service &amp; client (running under windows services or IIS) that I can use to upload a file, and download that file back? with the fewest lines of code? (C# or VB)</p> <p>compression &amp; encryption would be cool, but i'll layer that on later!!</p> <p>Thanks!!</p>
[ { "answer_id": 310955, "author": "Mitch Baker", "author_id": 37896, "author_profile": "https://Stackoverflow.com/users/37896", "pm_score": 3, "selected": true, "text": "[ServiceContract]\npublic interface IFileService\n{\n [OperationContract]\n byte[] ProcessFile(byte[] FileData);\n}\n...
2008/11/21
[ "https://Stackoverflow.com/questions/310062", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3522/" ]
310,090
<p>For 2 child template files inheriting a block, the <code>{{ block.super }}</code> does not resolve</p> <p>Python 2.5.2, Django 1.0, Windows XP SP3</p> <p>Sample skeleton code for files involved:</p> <ol> <li><code>base.html</code></li> <li><code>item_base.html</code></li> <li><code>show_info_for_all_items.html</code></li> <li><code>show_info_for_single_item.html</code></li> </ol> <p>FILE : <code>base.html</code></p> <pre><code>{% block content %} {% endblock %} </code></pre> <p>FILE : <code>item_base.html</code></p> <pre><code>{% extends "base.html" %} {% block item_info %} Item : {{ item.name }}&lt;br/&gt; Price : {{ item.price }}&lt;br/&gt; {% endblock %} </code></pre> <p>FILE : <code>show_info_for_all_items.html</code></p> <pre><code>{% extends "item_base.html" %} {% block content %} &lt;h1&gt;info on all items&lt;/h1&gt; &lt;hr/&gt; {% for item in items %} {% block item_info %} {{ block.super }} {% endblock %} &lt;hr/&gt; {% endfor %} {% endblock %} </code></pre> <p>FILE : <code>show_info_for_single_item.html</code></p> <pre><code>{% extends "item_base.html" %} {% block content %} &lt;h1&gt;info on single item&lt;/h1&gt; {% block item_info %} {{ block.super }} {% endblock %} {% endblock %} </code></pre> <p><code>show_info_for_all_items.html</code> shows a list of items along with each item's info.</p> <p><code>show_info_for_single_item.html</code> shows a single item with the item's info.</p> <p><code>show_info_for_all_items.html</code> and <code>show_info_for_single_item.html</code> share same code for showing item info, so I moved it to <code>item_base.html</code> into <code>block item_info</code></p> <p>but the <code>{{ block.super }}</code> in <code>show_info_for_all_items.html</code> and <code>show_info_for_single_item.html</code> does not work. <code>{{ block.super }}</code> resolves as blank.</p> <p>If I move the code back from <code>block item_info</code> in <code>item_base.html</code> into <code>show_info_for_all_items.html</code> and <code>show_info_for_single_item.html</code> it works but then I have to duplicate same <code>block item_info</code> code in 2 files.</p> <p>If the block.super issue can not be solved, does Django offer something like INCLUDE => <code>{% INCLUDE "item_base.html" %}</code> so blocks from a template file can be included ( instead of <code>extends</code> )</p> <p>How do I avoid duplicating <code>block item_info</code> in both html files?</p>
[ { "answer_id": 310123, "author": "David Arcos", "author_id": 30300, "author_profile": "https://Stackoverflow.com/users/30300", "pm_score": 4, "selected": true, "text": "{% include 'foo.html' %}\n" }, { "answer_id": 310819, "author": "Matthew Marshall", "author_id": 39856,...
2008/11/21
[ "https://Stackoverflow.com/questions/310090", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11452/" ]
310,094
<p>In the tradition of <a href="https://stackoverflow.com/questions/309492/user-defined-functions-sql-server-2005-flagged-incorrectly-as-non-deterministic">this question</a> and in light of <a href="http://msdn.microsoft.com/en-us/library/ms178091(SQL.90).aspx" rel="nofollow noreferrer">the documentation</a>, how does one make this function deterministic:</p> <pre><code>ALTER FUNCTION [udf_DateTimeFromDataDtID] ( @DATA_DT_ID int -- In form YYYYMMDD ) RETURNS datetime WITH SCHEMABINDING AS BEGIN RETURN CONVERT(datetime, CONVERT(varchar, @DATA_DT_ID)) END </code></pre> <p>Or this one (because of the string/date literals - and yes, I've also tried '1900-01-01'):</p> <pre><code>ALTER FUNCTION udf_CappedDate ( @DateTimeIn datetime ) RETURNS datetime WITH SCHEMABINDING AS BEGIN IF @DateTimeIn &lt; '1/1/1900' RETURN '1/1/1900' ELSE IF @DateTimeIn &gt; '1/1/2100' RETURN '1/1/2100' RETURN @DateTimeIn END </code></pre>
[ { "answer_id": 310113, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 3, "selected": false, "text": "CONVERT(datetime, '2008-01-01', 121)\n" }, { "answer_id": 310146, "author": "P Daddy", "author_id": 36388, ...
2008/11/21
[ "https://Stackoverflow.com/questions/310094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18255/" ]
310,105
<p>I've been discussing a code style issue with a friend. We have a series of packages that implement an interface by returning a specific type of value via a named subroutine. For example:</p> <pre><code>package Foo::Type::Bar; sub generate_foo { # about 5-100 lines of code return stuff here; } </code></pre> <p>So you can go:</p> <pre><code>my $bar_foo = Foo::Type::Bar-&gt;generate_foo; my $baz_foo = Foo::Type::Baz-&gt;generate_foo; </code></pre> <p>We have many of these, all under the same <code>Foo::Type::*</code> hierarchy.</p> <p>I think the packages should clearly indicate that they implement the <code>foo_generate</code> interface, e.g.:</p> <pre><code>package Foo::Type::Bar; use base 'Foo::Type'; sub generate_foo { ... return stuff here; } </code></pre> <p>I think this is good code style, much more clear and clean for other coders exploring the code. It also lets you check <code>Foo::Type::Bar-&gt;isa('Foo::Type')</code> to see if it implements the interface (other parts of the subsystem are entirely OO).</p> <p>My friend disagrees. Some arguments he makes are:</p> <ul> <li><code>Foo::Type::*</code> packages are clearly named, and used only in an internal project, and therefore there's no question of wondering whether or not a given package implements an interface</li> <li>the packages are often small and part of a standalone subsystem, and they feel to him like batch files or conf files, not heavy Perl OO code</li> <li>Perl expresses implementation via inheritance, which may be complex or problematic, particularly when one gets to multiple inheritance</li> <li>adding a <code>Foo::Type</code> superclass doesn't add any value, as it would literally be an empty package, used only to enable <code>-&gt;isa</code> lookups</li> <li>programmatically indicating interface implementation is a matter of personal code style</li> </ul> <p>Is one or the other of us "right"? What would you do?</p> <p><em>Edit: in examples, renamed Foo::Generator to Foo::Type</em></p>
[ { "answer_id": 310433, "author": "Joe McMahon", "author_id": 39791, "author_profile": "https://Stackoverflow.com/users/39791", "pm_score": 1, "selected": false, "text": "Foo::Type" }, { "answer_id": 310471, "author": "Axeman", "author_id": 11289, "author_profile": "ht...
2008/11/21
[ "https://Stackoverflow.com/questions/310105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31100/" ]
310,108
<p>Following is some obviously-defective code for which I think the compiler should emit a diagnostic. But neither <code>gcc</code> nor <code>g++</code> does, even with all the warnings options I could think of: <code>-pedantic -Wall -Wextra</code></p> <pre><code>#include &lt;stdio.h&gt; short f(short x) { return x; } int main() { long x = 0x10000007; /* bigger than short */ printf("%d\n", f(x)); /* hoping for a warning here */ return 0; } </code></pre> <p>Is there a way to make <code>gcc</code> and <code>g++</code> warn about this? On a side note, do you have another compiler which warns about this by default or in a fairly common extra-warnings configuration?</p> <p>Note: I'm using GCC (both C and C++ compilers) version 4.2.4.</p> <p>Edit: I just found that <code>gcc -Wconversion</code> does the trick, but the same option to <code>g++</code> doesn't, and I'm really using C++ here, so I need a solution for <code>g++</code> (and am now wondering why <code>-Wconversion</code> doesn't seem to be it).</p> <p>Edit: <a href="http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34389" rel="noreferrer">http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34389</a> suggests that this may be fixed in <code>g++ 4.4</code>...maybe? It's not clear to me yet if it's the same issue and/or if the fix is really coming in that version. Maybe someone with 4.3 or 4.4 can try my test case.</p>
[ { "answer_id": 310163, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 0, "selected": false, "text": "diy.cpp 14 Info 734: Loss of precision (arg. no. 1) (31 bits to 15 bits)\n" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/310108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4323/" ]
310,115
<p>I am writing a script which is likely to be modified by users. Currently I am storing the configuration settings inside the script. It exists in the form of a hash-of-hashes.</p> <p>I would like to guard against people accidentally using lowercase characters in the hash keys, because that will break my script.</p> <p>It would be simple to inspect the hash keys and merely issue warnings for any keys with lowercase characters, but I would rather fix the case sensitivity automatically.</p> <p>In other words, I want to convert all the hash keys in the top-level hash to uppercase.</p>
[ { "answer_id": 310134, "author": "Andy Lester", "author_id": 8454, "author_profile": "https://Stackoverflow.com/users/8454", "pm_score": 4, "selected": false, "text": "for my $key ( grep { uc($_) ne $_ } keys %hash ) {\n my $newkey = uc $key;\n $hash{$newkey} = delete $hash{$key};\...
2008/11/21
[ "https://Stackoverflow.com/questions/310115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39153/" ]
310,117
<p><strong>Caveat:</strong> I try all the posibilities listed here: <a href="https://stackoverflow.com/questions/254002/how-can-i-ignore-everything-under-a-folder-in-mercurial">How can I ignore everything under a folder in Mercurial</a>.<br> None works as I hope. </p> <p>I want to ignore every thing under the folder <code>test</code>. But not ignore <code>srcProject\test\TestManager</code> </p> <p>I try</p> <pre><code>syntax: glob test/** </code></pre> <p>And it ignores <code>test</code> and <code>srcProject\test\TestManager</code></p> <p>With:</p> <pre><code>syntax: regexp ^/test/ </code></pre> <p>It's the same thing.</p> <p>Also with:</p> <pre><code>syntax: regexp test\\* </code></pre> <p>I have install TortoiseHG 0.4rc2 with Mercurial-626cb86a6523+tortoisehg, Python-2.5.1, PyGTK-2.10.6, GTK-2.10.11 in Windows</p>
[ { "answer_id": 310416, "author": "Nathan Kitchen", "author_id": 31000, "author_profile": "https://Stackoverflow.com/users/31000", "pm_score": 2, "selected": false, "text": "test" }, { "answer_id": 313392, "author": "Ry4an Brase", "author_id": 8992, "author_profile": "...
2008/11/21
[ "https://Stackoverflow.com/questions/310117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1356709/" ]
310,121
<p>In HTML in the td of a table you can break text by using <code>&lt;BR&gt;</code> between the words. This also works in the HeaderText of a TemplateItem but not the HeaderText of a BoundField. How do I break up the Header text of a BoundField.</p>
[ { "answer_id": 310145, "author": "Aleris", "author_id": 20417, "author_profile": "https://Stackoverflow.com/users/20417", "pm_score": 6, "selected": true, "text": "HtmlEncode = false" }, { "answer_id": 27554073, "author": "Tom Padilla", "author_id": 724317, "author_pr...
2008/11/21
[ "https://Stackoverflow.com/questions/310121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4491/" ]
310,126
<p>I have a project with a post build event:</p> <pre><code>copy $(ProjectDir)DbVerse\Lunaverse.DbVerse.*.exe $(TargetDir) </code></pre> <p>It works fine every time on my machine. I have a new developer who always gets the "exited with code 1" error. I had her run the same command in a DOS prompt, and it worked fine. What could be causing this? Is there any way to get to the real error?</p> <p>We are both using Visual Studio 2008.</p>
[ { "answer_id": 2291724, "author": "JanBorup", "author_id": 276414, "author_profile": "https://Stackoverflow.com/users/276414", "pm_score": 6, "selected": false, "text": "copy $(TargetDir)$(TargetName).* $(SolutionDir)bin\n" }, { "answer_id": 10441677, "author": "Valamas", ...
2008/11/21
[ "https://Stackoverflow.com/questions/310126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29493/" ]
310,160
<p>I'm experimenting with WCF Services, and have come across a problem with passing Interfaces.</p> <p>This works:</p> <pre><code>[ServiceContract] public interface IHomeService { [OperationContract] string GetString(); } </code></pre> <p>but this doesn't:</p> <pre><code>[ServiceContract] public interface IHomeService { [OperationContract] IDevice GetInterface(); } </code></pre> <p>When I try to compile the client it fails on the GetInterface method. I get an Exception saying that it can't convert Object to IDevice.</p> <p>On the clientside the IHomeService class correctly implements GetString with a string as it's returntype, but the GetInterface has a returntype of object. Why isn't it IDevice?</p>
[ { "answer_id": 310179, "author": "Brian Genisio", "author_id": 36687, "author_profile": "https://Stackoverflow.com/users/36687", "pm_score": 5, "selected": true, "text": "[ServiceKnownType(typeof(ConcreteDeviceType)]\n" }, { "answer_id": 310291, "author": "Frode Lillerud", ...
2008/11/21
[ "https://Stackoverflow.com/questions/310160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33431/" ]
310,164
<p>I'm trying to work my way through Ron Jeffries's Extreme Programming Adventures in C#. I am stuck, however, in Chapter 3 because the code does not, and <b>cannot</b>, do what the author says it does. </p> <p>Basically, the text says that I should be able to write some text in a word-wrap enabled text box. If I then move the cursor to an intermediate line and hit enter, the code should re-display the lines before the cursor, add a couple of lines and a set of HTML paragraph tags, then append the rest of the lines. The code doesn't match the text because it uses the textbox.lines property. Well, no matter how many word-wrapped lines there are in a text box, there's only ONE line in the Lines property until you hit a carriage return. So, the statement that the code should, "Copy the rest of the lines into the buffer" appears wrong to me. </p> <p>I'd appreciate anybody having experience with the book telling me what I'm reading, or doing, wrong!</p> <p>Thanks.</p> <p>EoRaptor</p>
[ { "answer_id": 310367, "author": "EoRaptor013", "author_id": 16851, "author_profile": "https://Stackoverflow.com/users/16851", "pm_score": 0, "selected": false, "text": "print(\"using System;\n" }, { "answer_id": 1819581, "author": "Knightlore", "author_id": 221310, "...
2008/11/21
[ "https://Stackoverflow.com/questions/310164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16851/" ]
310,167
<p>At the XmlSerializer constructor line the below causes an InvalidOperationException which also complains about not having a default accesor implemented for the generic type.</p> <pre><code>Queue&lt;MyData&gt; myDataQueue = new Queue&lt;MyData&gt;(); // Populate the queue here XmlSerializer mySerializer = new XmlSerializer(myDataQueue.GetType()); StreamWriter myWriter = new StreamWriter("myData.xml"); mySerializer.Serialize(myWriter, myDataQueue); myWriter.Close(); </code></pre>
[ { "answer_id": 310171, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": true, "text": "List<T>" }, { "answer_id": 54520107, "author": "Gianmaria Dalla Torre", "author_id": 9935017, "aut...
2008/11/21
[ "https://Stackoverflow.com/questions/310167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16260/" ]
310,178
<p>I need to design a SOAP api (my first one!). What are the best practices regarding errors returned to the caller.</p> <p>Assuming an api as follow</p> <pre><code>[WebMethod] public List&lt;someClass&gt; GetList(String param1) { } </code></pre> <p>Should I</p> <ul> <li>Throw an exception. Let the SOAP infrastructure generate a SOAP fault -- and the caller would have to try/catch. This is not very explanatory to the caller <ol start="2"> <li>Have the return parameter be a XMLDOcument of some sort, with the first element being a return value and then the List. </li> <li>Looking at the return SOAP packet I see that the response generated looks like the following</li> </ol></li> </ul> <blockquote> <p></p> </blockquote> <pre><code> &lt;GetListResponse&gt; &lt;GetListResult&gt; ... ... &lt;/GetListResult&gt; &lt;/GetListResponse&gt; </code></pre> <p>Can we somehow change the return packet so that the "GetListResult" element is changed to "GetListError" in case of error</p> <ul> <li>Any other way?</li> </ul> <p>Thanks!</p>
[ { "answer_id": 310356, "author": "Guy Starbuck", "author_id": 2194, "author_profile": "https://Stackoverflow.com/users/2194", "pm_score": 2, "selected": false, "text": "public partial interface MyServiceContract\n{\n [System.ServiceModel.FaultContract(typeof(MyService.FaultContracts.E...
2008/11/21
[ "https://Stackoverflow.com/questions/310178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37955/" ]
310,191
<p>My log file is:</p> <pre><code> Wed Nov 12 blah blah blah blah cat1 Wed Nov 12 blah blah blah blah Wed Nov 12 blah blah blah blah Wed Nov 12 blah blah blah blah cat2 more blah blah even more blah blah Wed Nov 12 blah blah blah blah cat3 Wed Nov 12 blah blah blah blah cat4 </code></pre> <p>I want to parse out the full multiline entries where cat is found on the first line. What's the best way to do this in <code>sed</code> and/or <code>awk</code>?</p> <p>i.e. i want my parse to produce:</p> <pre><code> Wed Nov 12 blah blah blah blah cat1 Wed Nov 12 blah blah blah blah cat2 more blah blah even more blah blah Wed Nov 12 blah blah blah blah cat3 Wed Nov 12 blah blah blah blah cat4 </code></pre>
[ { "answer_id": 310266, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 1, "selected": false, "text": "'\\01'" }, { "answer_id": 310293, "author": "flolo", "author_id": 36472, "author_profile": "http...
2008/11/21
[ "https://Stackoverflow.com/questions/310191", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39529/" ]
310,199
<p>I am battling regular expressions now as I type. </p> <p>I would like to determine a pattern for the following example file: <code>b410cv11_test.ext</code>. I want to be able to do a search for files that match the pattern of the example file aforementioned. Where do I start (so lost and confused) and what is the best way of arriving at a solution that best matches the file pattern? Thanks in advance. </p> <p><strong><em>Further clarification of question:</em></strong></p> <p>I would like the pattern to be as follows: must start with 'b', followed by three digits, followed by 'cv', followed by two digits, then an underscore, followed by 'release', followed by .'ext'</p>
[ { "answer_id": 310924, "author": "Brian C. Lane", "author_id": 27461, "author_profile": "https://Stackoverflow.com/users/27461", "pm_score": 0, "selected": false, "text": "/^b\\d\\d\\dcv\\d\\d_test\\.ext$/\n" }, { "answer_id": 311033, "author": "Jan Goyvaerts", "author_id...
2008/11/21
[ "https://Stackoverflow.com/questions/310199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37804/" ]
310,226
<p>We currently have a heated internal debate as to whether the actual .NET assembly name should include the code's version number (e.g. CodeName02.exe or CompanyName.CodeName02.dll). Does anyone know of an authoritative source, like Microsoft, that provides guidance on this issue?</p>
[ { "answer_id": 310241, "author": "csexton", "author_id": 19839, "author_profile": "https://Stackoverflow.com/users/19839", "pm_score": 5, "selected": true, "text": "[assembly: AssemblyVersion(\"1.1.0.256\"]\n[assembly: AssemblyFileVersion(\"1.1.0.256\")]\n" }, { "answer_id": 3102...
2008/11/21
[ "https://Stackoverflow.com/questions/310226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21410/" ]
310,245
<p>I'm trying to get a stored procedure to work for a co-worker who is out sick (and thus can't be asked for guidance).</p> <p>I have a SQL Server 2005 database that has this exact procedure, and I'm trying to make the scripts to convert a test database to match this dev database. My script has several lines like:</p> <pre><code>CAST(RELATIVE_ERROR_RATIO AS FLOAT), CAST(REPORTING_LIMIT AS FLOAT), </code></pre> <p>The procedure is essentially doing an "insert into table (all the fields) from another table where field = @input"</p> <p>When I run the script, I get the error:</p> <pre><code>CAST or CONVERT: invalid attributes specified for type 'float' </code></pre> <p>and the procedure is not created. But, I've compared the source tables in both the dev and test environments, and they match exactly. And the procedure exists exactly as scripted in the dev environment. </p> <p>I can't ask my co-worker if he had to do any special acrobatics to create this script, so I'm asking you. I've done some searching, and see that perhaps float should be of the form FLOAT(6,1) (or some such), but that's NOT what he has, and I'm not comfortable changing the test environment so that it won't really match dev.</p> <p><strong>Added</strong></p> <p>The commenter is correct. I've been told that the error is with the following cast: </p> <pre><code>CAST(TRACER_YIELD AS FLOAT(10,3)), </code></pre> <p>I could post the entire query, but it's a long one! So, instead, I'll just include the casted fields, and the first and last field. I'd like to ask my co-worker if that one field was a mistake, and it just needed a straight cast. He'll be back next monday, so it may need to wait that long.</p> <pre><code>CREATE PROCEDURE [dbo].[our_LOAD_INPUT] @ourNUMBER INT AS INSERT INTO our_FILE (our_NUMBER, DILUTION_FACTOR, DISTILLATION_VOLUME, MAXIMUM_CONTROL_LIMIT, MDA, MINIMUM_CONTROL_LIMIT, NUMBER_OF_TICS_FOUND, PERCENT_MOISTURE, PERCENT_RECOVERY, PERCENT_SOLIDS, RELATIVE_ERROR_RATIO, REPORTING_LIMIT, REQUIRED_DETECTION_LIMIT, RER_MAX, RESULT, RETENTION_TIME, RPD, RPD_MAXIMUM, SAMPLE_ALIQUOT_SIZE, SPIKE_CONCENTRATION, TOTAL_PROPAGATED_UNCERTAINTY, TRACER_YIELD, TWO_SIGMA_COUNTING_ERROR, VERSION) SELECT FILE_NUMBER, CAST(DILUTION_FACTOR AS FLOAT), CAST(DISTILLATION_VOLUME AS FLOAT), CAST(MAXIMUM_CONTROL_LIMIT AS FLOAT), CAST(MDA AS FLOAT), CAST(MINIMUM_CONTROL_LIMIT AS FLOAT), CAST(NUMBER_OF_TICS_FOUND AS FLOAT), CAST(PERCENT_MOISTURE AS FLOAT), CAST(PERCENT_RECOVERY AS FLOAT), CAST(PERCENT_SOLIDS AS FLOAT), CAST(RELATIVE_ERROR_RATIO AS FLOAT), CAST(REPORTING_LIMIT AS FLOAT), CAST(REQUIRED_DETECTION_LIMIT AS FLOAT), CAST(RER_MAX AS FLOAT), CAST(RESULT AS FLOAT), CAST(RETENTION_TIME AS FLOAT), CAST(RPD AS FLOAT), CAST(RPD_MAXIMUM AS FLOAT), CAST(SAMPLE_ALIQUOT_SIZE AS FLOAT), CAST(SPIKE_CONCENTRATION AS FLOAT), CAST(TOTAL_PROPAGATED_UNCERTAINTY AS FLOAT), CAST(TRACER_YIELD AS FLOAT(10,3)), CAST(TWO_SIGMA_COUNTING_ERROR AS FLOAT), VERSION FROM our_FILE_CHAR WHERE our_NUMBER = @ourNUMBER GO </code></pre> <p>our_File_CHAR is defined as</p> <pre><code>CREATE TABLE [dbo].[our_FILE_CHAR] ( [our_NUMBER] [int] NOT NULL, [DILUTION_FACTOR] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [DISTILLATION_VOLUME] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [MAXIMUM_CONTROL_LIMIT] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [MDA] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [MINIMUM_CONTROL_LIMIT] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [NUMBER_OF_TICS_FOUND] [varchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [PERCENT_MOISTURE] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [PERCENT_RECOVERY] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [PERCENT_SOLIDS] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [RELATIVE_ERROR_RATIO] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [REPORTING_LIMIT] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [REQUIRED_DETECTION_LIMIT] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [RER_MAX] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [RESULT] [varchar] (13) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [RETENTION_TIME] [varchar] (6) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [RPD] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [RPD_MAXIMUM] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [SAMPLE_ALIQUOT_SIZE] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [SPIKE_CONCENTRATION] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [TOTAL_PROPAGATED_UNCERTAINTY] [varchar] (13) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [TRACER_YIELD] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [TWO_SIGMA_COUNTING_ERROR] [varchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL, [VERSION] [varchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) </code></pre> <p>our_File is defined as</p> <pre><code>CREATE TABLE [dbo].[our_FILE] ( [our_NUMBER] [int] NOT NULL, [DILUTION_FACTOR] [numeric] (10, 3) NULL, [DISTILLATION_VOLUME] [numeric] (5, 1) NULL, [MAXIMUM_CONTROL_LIMIT] [numeric] (10, 3) NULL, [MDA] [numeric] (10, 3) NULL, [MINIMUM_CONTROL_LIMIT] [numeric] (10, 3) NULL, [NUMBER_OF_TICS_FOUND] [numeric] (2, 0) NULL, [PERCENT_MOISTURE] [numeric] (5, 1) NULL, [PERCENT_RECOVERY] [numeric] (10, 3) NULL, [PERCENT_SOLIDS] [numeric] (5, 1) NULL, [RELATIVE_ERROR_RATIO] [numeric] (10, 3) NULL, [REPORTING_LIMIT] [numeric] (10, 2) NULL, [REQUIRED_DETECTION_LIMIT] [numeric] (10, 2) NULL, [RER_MAX] [numeric] (10, 3) NULL, [RESULT] [numeric] (13, 3) NULL, [RETENTION_TIME] [numeric] (6, 2) NULL, [RPD] [numeric] (10, 3) NULL, [RPD_MAXIMUM] [numeric] (10, 3) NULL, [SAMPLE_ALIQUOT_SIZE] [numeric] (10, 3) NULL, [SPIKE_CONCENTRATION] [numeric] (10, 3) NULL, [TOTAL_PROPAGATED_UNCERTAINTY] [numeric] (13, 3) NULL, [TRACER_YIELD] [numeric] (10, 3) NULL, [TWO_SIGMA_COUNTING_ERROR] [numeric] (10, 3) NULL, [VERSION] [varchar] (2) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ) </code></pre>
[ { "answer_id": 315330, "author": "thursdaysgeek", "author_id": 22523, "author_profile": "https://Stackoverflow.com/users/22523", "pm_score": 1, "selected": true, "text": "CAST(TRACER_YIELD AS FLOAT(10,3)),\n" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/310245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22523/" ]
310,247
<p>Whenever I create a method signature in VS 2008 (C#), I type the two braces:</p> <p>public void Something() {}</p> <p>This leaves the cursor to the right of the closing brace. Then I have to use the arrow keys to reposition the cursor in between the braces. Is there a better way to do this without using the arrow keys?</p> <p>I'd expect it to place the cursor in between the braces when I type the closing one so I can start typing code.</p>
[ { "answer_id": 310616, "author": "CrashCodes", "author_id": 16260, "author_profile": "https://Stackoverflow.com/users/16260", "pm_score": 3, "selected": false, "text": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<CodeSnippets xmlns=\"http://schemas.microsoft.com/VisualStudio/2005/Code...
2008/11/21
[ "https://Stackoverflow.com/questions/310247", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
310,269
<p>I am unable to build my Web Application (not Web Site) in our build environement. We use DMAKE in our build environment (this unfortunately is non negotiable, therefore using MSBUILD is not permitted ) and when invoking the asp.net precompiler through</p> <p>C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_compiler -d -nologo -p Site -f -fixednames -errorstack -v / Debug</p> <p>We get the following error</p> <p>error ASPPARSE: Could not load type 'X.Y.Admin.Site.Global</p> <p>If I compile from the ide it is successful. If i then compile with aspnet_compilier it is successful. So i only get a successful compile with aspnet_compiler when the target dll i am trying to compile is in the bin of the web application i am compiling.</p> <p>I keep running into postings that talk about solutions using MSBUILD which unfortunately I cant try.</p> <p>Any help would be appreciated</p>
[ { "answer_id": 19512633, "author": "user2537805", "author_id": 2537805, "author_profile": "https://Stackoverflow.com/users/2537805", "pm_score": 0, "selected": false, "text": "aspnet_compiler -p D:\\Projects\\MGM\\mgm\\mgm -v / D:\\Projects\\MGM-deploy\\mgm_compiled\n" }, { "answ...
2008/11/21
[ "https://Stackoverflow.com/questions/310269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39802/" ]
310,271
<p>I'm an end-user of one of my company's products. It is not very suitable for integration into Spring, however I am able to get a handle on the context and retrieve the required bean by name. However, I would still like to know if it was possible to inject a bean into this class, even though the class is not managed by Spring itself.</p> <p>Clarification: The same application which is managing the lifecycle of some class MyClass, is also managing the lifecycle of the Spring context. Spring does not have any knowledge of the instance of MyClass, and I would like to some how provide the instance to the context, but cannot create the instance in the context itself.</p>
[ { "answer_id": 312367, "author": "Yonatan Maman", "author_id": 20065, "author_profile": "https://Stackoverflow.com/users/20065", "pm_score": 2, "selected": false, "text": "class C implmenets ApplicationContextAware{\n public static ApplicationContex ac;\n void setApplicationContex...
2008/11/21
[ "https://Stackoverflow.com/questions/310271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8528/" ]
310,276
<p>I'm working on a programming language, and today I got the point where I could compile the factorial function(recursive), however due to the maximum size of an integer the largest I can get is factorial(12). What are some techniques for handling integers of an arbitrary maximum size. The language currently works by translating code to C++.</p>
[ { "answer_id": 310464, "author": "Bill K", "author_id": 12943, "author_profile": "https://Stackoverflow.com/users/12943", "pm_score": 2, "selected": false, "text": "class BigAssNumber {\n private byte[] value;\n\n // This constructor can handle numbers where overflows have occurred...
2008/11/21
[ "https://Stackoverflow.com/questions/310276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37181/" ]
310,282
<p>Recently, I found myself having to write up some concerns I have about race conditions in an application that is in development (not by me). This will likely be brought to the attention of stakeholders who are non-technical and with whom I do not have a direct line of communication, so my explanation needs to be in written form.</p> <p>I have already made an attempt at this write-up. I gloss over the technical specifics as best I can, give an example of how a race condition would occur in the application, and describe its impact. I feel I did pretty well, but it's far from perfect.</p> <p>The problem is, as much as I try to shield the reader from computer science, I have still found it difficult to eliminate phrases like "threads of execution" and "mutual exclusion" without losing correctness and substance. The risk is that, with too much hand-waving, these concerns could be dismissed as a made-up boogeyman.</p> <p>Anyway, my question to you is this: <strong>How would <em>you</em> explain race conditions to a non-technical audience?</strong> Would you dare to explain CPU scheduling? Would you invoke the <a href="http://en.wikipedia.org/wiki/Dining_philosophers_problem" rel="noreferrer">dining philosophers</a>?</p> <p><em>You don't have to work within the constraints of my situation (but it would be awesomely helpful if you did).</em></p>
[ { "answer_id": 35898639, "author": "Michiel van der Blonk", "author_id": 219041, "author_profile": "https://Stackoverflow.com/users/219041", "pm_score": 0, "selected": false, "text": "player 1 grabs a red block\nplayer 1 places red block - player 2 grabs an orange block\nplayer 1...
2008/11/21
[ "https://Stackoverflow.com/questions/310282", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28340/" ]
310,286
<p>The default behavior of NHibernate is the write all changes to objects to the database when Session.Flush() is called. It does this whether you want it to or not.</p> <p>How do we prevent writing bad data to the database when we need to do things like validate business rules or input?</p> <p>For instance .. </p> <ul> <li>Customer Name is not null. </li> <li>User opens a web browser (without javascript) and deletes the customer name. </li> <li>Hits update. </li> <li><code>Customer.Name</code> property is updated and .. </li> <li><code>Customer.IsValid()</code> is called. </li> <li>Even if <code>IsValid()</code> is false and we show error messages NHibernate still updates the database.</li> </ul>
[ { "answer_id": 310891, "author": "KevinT", "author_id": 39561, "author_profile": "https://Stackoverflow.com/users/39561", "pm_score": 0, "selected": false, "text": "SessionScope session = new SessionScope(FlushAction.Never);\n" }, { "answer_id": 310906, "author": "yfeldblum",...
2008/11/21
[ "https://Stackoverflow.com/questions/310286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34133/" ]
310,294
<p>I'm using a regex that <a href="http://regexlib.com/REDetails.aspx?regexp_id=646" rel="nofollow noreferrer">strips the href tags out of an html doc</a> saved to a string. The following code is how I'm using it in my C# console app.</p> <pre><code>Match m = Regex.Match(htmlSourceString, "href=[\\\"\\\'](http:\\/\\/|\\.\\/|\\/)?\\w+(\\.\\w+)*(\\/\\w+(\\.\\w+)?)*(\\/|\\?\\w*=\\w*(&amp;\\w*=\\w*)*)?[\\\"\\\']"); if (m.Success) { Console.WriteLine("values = " + m); } </code></pre> <p>However, it only returns one result, instead of a list of all the href tags on the html page. I know it works, because when I trying <code>RegexOptions.RightToLeft</code>, it returns the last href tag in the string. </p> <p>Is there something with my if statement that doesn't allow me to return all the results?</p>
[ { "answer_id": 314097, "author": "Martin Brown", "author_id": 20553, "author_profile": "https://Stackoverflow.com/users/20553", "pm_score": 3, "selected": true, "text": " Match m = Regex.Match(htmlSourceString, \"href=[\\\\\\\"\\\\\\'](http:\\\\/\\\\/|\\\\.\\\\/|\\\\/)?\\\\w+(\\\\.\\\...
2008/11/21
[ "https://Stackoverflow.com/questions/310294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/557/" ]
310,307
<p>Earlier I asked this question <a href="https://stackoverflow.com/questions/309708/how-to-correctly-unit-test-my-dal">How to correctly unit test my DAL?</a>, one thing left unanswered for me is if to really test my DAL is to have a Test DB, then what is the role of mocking vs. a testing DB?</p> <p>To add on this, another person suggested to "use transactions and rollback at the end of the unit test, so the db is clean", test db that is. What do you guys think of this testing + test DB + transaction rollback (so db is not really written) approach to test DAL?</p> <p>To be complete, my DAL is built with Entity Framework, there is no stored proc in DB. Since EF is so new, I really need to test DAL to make sure they work correctly.</p>
[ { "answer_id": 310609, "author": "miceuz", "author_id": 24443, "author_profile": "https://Stackoverflow.com/users/24443", "pm_score": 1, "selected": false, "text": "List<Item> getAllItems()" }, { "answer_id": 12303003, "author": "Darren Rich", "author_id": 1652428, "a...
2008/11/21
[ "https://Stackoverflow.com/questions/310307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32240/" ]
310,333
<p>What's wrong with the following snippet ?</p> <pre><code>#include &lt;tr1/functional&gt; #include &lt;functional&gt; #include &lt;iostream&gt; using namespace std::tr1::placeholders; struct abc { typedef void result_type; void hello(int) { std::cout &lt;&lt; __PRETTY_FUNCTION__ &lt;&lt; std::endl; } void hello(int) const { std::cout &lt;&lt; __PRETTY_FUNCTION__ &lt;&lt; std::endl; } abc() {} }; int main(int argc, char *argv[]) { const abc x; int a = 1; std::tr1::bind(&amp;abc::hello, x , _1)(a); return 0; } </code></pre> <p>Trying to compile it with g++-4.3, it seems that <em>cv</em>-qualifier overloaded functions confuse both <code>tr1::mem_fn&lt;&gt;</code> and <code>tr1::bind&lt;&gt;</code> and it comes out the following error:</p> <pre><code>no matching function for call to ‘bind(&lt;unresolved overloaded function type&gt;,... </code></pre> <p>Instead the following snippet compiles but seems to break the <strong>const-correctness</strong>:</p> <pre><code>struct abc { typedef void result_type; void operator()(int) { std::cout &lt;&lt; __PRETTY_FUNCTION__ &lt;&lt; std::endl; } void operator()(int) const { std::cout &lt;&lt; __PRETTY_FUNCTION__ &lt;&lt; std::endl; } abc() {} }; ... const abc x; int a = 1; std::tr1::bind( x , _1)(a); </code></pre> <p>Any clue?</p>
[ { "answer_id": 310364, "author": "John Zwinck", "author_id": 4323, "author_profile": "https://Stackoverflow.com/users/4323", "pm_score": 3, "selected": true, "text": "this" }, { "answer_id": 311169, "author": "Nicola Bonelli", "author_id": 19630, "author_profile": "ht...
2008/11/21
[ "https://Stackoverflow.com/questions/310333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19630/" ]
310,342
<p>A quick search gave me this <a href="http://www.mail-archive.com/dbdi-dev@perl.org/msg00002.html" rel="nofollow noreferrer">announcement of Parrot DBDI</a> from January 2004 and a <a href="http://www.mail-archive.com/dbdi-dev@perl.org/" rel="nofollow noreferrer">dbdi-dev mailing list</a> which appears to be long dead. Is Parrot DBDI still being developed? Is anyone working on a different database API or interface for Parrot?</p>
[ { "answer_id": 310364, "author": "John Zwinck", "author_id": 4323, "author_profile": "https://Stackoverflow.com/users/4323", "pm_score": 3, "selected": true, "text": "this" }, { "answer_id": 311169, "author": "Nicola Bonelli", "author_id": 19630, "author_profile": "ht...
2008/11/21
[ "https://Stackoverflow.com/questions/310342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/311/" ]
310,355
<p>Is there any way to access the Windows Event Log from a java class. Has anyone written any APIs for this, and would there be any way to access the data from a remote machine?</p> <p>The scenario is:</p> <p>I run a process on a remote machine, from a controlling Java process. This remote process logs stuff to the Event Log, which I want to be able to see in the controlling process.</p> <p>Thanks in advance.</p>
[ { "answer_id": 786129, "author": "Dan Fleet", "author_id": 95492, "author_profile": "https://Stackoverflow.com/users/95492", "pm_score": 4, "selected": false, "text": "import java.io.IOException;\nimport java.util.logging.Level;\n\nimport org.jinterop.dcom.common.JIException;\nimport org...
2008/11/21
[ "https://Stackoverflow.com/questions/310355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1836/" ]
310,363
<p>I have a time represented as the number of seconds elapsed since midnight, January 1, 1970, UTC (the results of an earlier call to time()). How do I add one day to this time?</p> <p>Adding 24 * 60 * 60 works in most cases, but fails if the daylight saving time comes on or off in between. In other words, I mostly want to add 24 hours, but sometimes 23 or 25 hours.</p> <p>To illustrate - the program:</p> <pre><code>#include &lt;time.h&gt; #include &lt;iostream&gt; int main() { time_t base = 1142085600; for(int i = 0; i &lt; 4; ++i) { time_t time = base + i * 24 * 60 * 60; std::cout &lt;&lt; ctime(&amp;time); } return 0; </code></pre> <p>}</p> <p>Produces:</p> <pre><code>Sat Mar 11 08:00:00 2006 Sun Mar 12 09:00:00 2006 Mon Mar 13 09:00:00 2006 Tue Mar 14 09:00:00 2006 </code></pre> <p>I want the times for March 12, 13, ... to also be 8 AM.</p> <hr> <p>The answer provided by FigBug pointed me in the right direction. But I had to use localtime instead of gmtime.</p> <pre><code>int main() { time_t base = 1142085600; for(int i = 0; i &lt; 4; ++i) { struct tm* tm = localtime(&amp;base); tm-&gt;tm_mday += i; std::cout &lt;&lt; asctime(tm); } return 0; } </code></pre> <p>Give me:</p> <pre><code>Sat Mar 11 08:00:00 2006 Sat Mar 12 08:00:00 2006 Sat Mar 13 08:00:00 2006 Sat Mar 14 08:00:00 2006 </code></pre> <p>Which is what I want. Using gmtime gives me the times at 14:00:00</p> <p>However, note that all days are Sat. Also, it goes to March 32, 33, etc. If I throw in the mktime function I am back where I started:</p> <pre><code>#include &lt;time.h&gt; #include &lt;iostream&gt; int main() { time_t base = 1142085600; for(int i = 0; i &lt; 4; ++i) { struct tm* tm = localtime(&amp;base); tm-&gt;tm_mday += i; time_t time = mktime(tm); std::cout &lt;&lt; asctime(tm); } return 0; } </code></pre> <p>Gives me:</p> <pre><code>Sat Mar 11 08:00:00 2006 Sun Mar 12 09:00:00 2006 Mon Mar 13 09:00:00 2006 Tue Mar 14 09:00:00 2006 </code></pre> <p>What am I missing???</p> <hr> <p>OK, I have tried out FigBug's latest suggestion that is to use:</p> <pre><code> std::cout &lt;&lt; ctime(&amp;time); </code></pre> <p>instead of asctime, but I get the same results. So I guess that my library and/or compiler is messed up. I am using g++ 3.4.4 on cygwin. I copied the files over to Solaris 5.8 and used g++ 3.3 there to compile. I get the correct results there! In fact I get the correct results whether I use ctime or asctime for output:</p> <pre><code>Sat Mar 11 08:00:00 2006 Sun Mar 12 08:00:00 2006 Mon Mar 13 08:00:00 2006 Tue Mar 14 08:00:00 2006 </code></pre> <p>I also get the correct results (with both output functions) on Red Hut Linux with g++ 3.4.6.</p> <p>So I guess that I have come across a Cygwin bug. </p> <p>Thank you for all your help and advice....</p>
[ { "answer_id": 310374, "author": "Roland Rabien", "author_id": 39138, "author_profile": "https://Stackoverflow.com/users/39138", "pm_score": 6, "selected": true, "text": "int main()\n{\n time_t base = 1142085600;\n for(int i = 0; i < 4; ++i) {\n struct tm* tm = localtime(&base);\n ...
2008/11/21
[ "https://Stackoverflow.com/questions/310363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13029/" ]
310,376
<p>Many (most?) sites aiming for accessibility and standards compliance use unordered lists for their navigation. Does this make the site more accessible or does it just provide useful elements for styling?</p> <p>I don't mind them, and I have been using unordered lists in this way. It's just that, when I remove the styling from a page to try to gauge it's accessibility, it strikes me that it could just as well could be plain links. Where does this come from?</p>
[ { "answer_id": 310391, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 3, "selected": false, "text": "<div>" }, { "answer_id": 310447, "author": "Carl Camera", "author_id": 12804, "author_profile": "https...
2008/11/21
[ "https://Stackoverflow.com/questions/310376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16526/" ]
310,394
<p>I am still learning sql server somewhat and recently came across a select query in a stored procedure which was causing a very slow fill of a dataset in c#. At first I thought this was to do with .NET but then found a suggestion to put in the stored procedure:</p> <p>set implicit_transactions off</p> <p>this seems to cure it but I would like to know why also I have seen other options such as:</p> <ul> <li>set nocount off</li> <li>set arithabort on</li> <li>set concat_null_yields_null on</li> <li>set ansi_nulls on</li> <li>set cursor_close_on_commit off</li> <li>set ansi_null_dflt_on on</li> <li>set ansi_padding on</li> <li>set ansi_warnings on</li> <li>set quoted_identifier on</li> </ul> <p>Does anyone know where to find good info on what each of these does and what is safe to use when I have stored procedures setup just to query of data for viewing. </p> <p>I should note just to stop the usual use/don't use stored procedures debate these queries are complex select statements used on multiple programs in multiple languages it is the best place for them.</p> <p><strong>Edit: Got my answer didn't end up fully reviewing all the options but did find</strong></p> <p><strong>SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED</strong></p> <p><strong>Sped up the complex queries dramatically, I am not worried about the dirty read in this instance.</strong></p>
[ { "answer_id": 339581, "author": "Sam Saffron", "author_id": 17174, "author_profile": "https://Stackoverflow.com/users/17174", "pm_score": 2, "selected": false, "text": "set implicit_transactions on \ngo\nselect top 10 * from sysobjects\n" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/310394", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16989/" ]
310,408
<p>Let's say we have a concrete <code>class Apple</code>. (Apple objects can be instantiated.) Now, someone comes and derives an abstract <code>class Peach</code> from Apple. It's abstract because it introduces a new pure virtual function. The user of Peach is now forced to derive from it and define this new function. Is this a common pattern? Is this correct to do?</p> <p>Sample:<pre><code> class Apple { public: virtual void MakePie(); // more stuff here };</p> <p>class Peach : public Apple { public: virtual void MakeDeliciousDesserts() = 0; // more stuff here };</code></pre> Now let's say we have a concrete <code>class Berry</code>. Someone derives an abstract <code>class Tomato</code> from Berry. It's abstract because it overwrites one of Berry's virtual functions, and makes it pure virtual. The user of Tomato has to re-implement the function previously defined in Berry. Is this a common pattern? Is this correct to do?</p> <p>Sample:<pre><code> class Berry { public: virtual void EatYummyPie(); // more stuff here };</p> <p>class Tomato : public Berry { public: virtual void EatYummyPie() = 0; // more stuff here };</code></pre> Note: The names are contrived and do not reflect any actual code (hopefully). No fruits have been harmed in the writing of this question.</p>
[ { "answer_id": 310499, "author": "fizzer", "author_id": 18167, "author_profile": "https://Stackoverflow.com/users/18167", "pm_score": 4, "selected": true, "text": "Juice()" }, { "answer_id": 310529, "author": "Ray Tayek", "author_id": 51292, "author_profile": "https:/...
2008/11/21
[ "https://Stackoverflow.com/questions/310408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22724/" ]
310,418
<p>I've given up trying to apply lipstick to the pigs of installers that come out of <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio" rel="noreferrer">Visual Studio</a> and have decided to look at <a href="http://en.wikipedia.org/wiki/WiX" rel="noreferrer">WiX</a>.</p> <p>What resources would you recommend to learn and reference?</p> <p><em>(Note - this is not a which-installer-technology-do-you-use question - it's specific to WiX.)</em></p>
[ { "answer_id": 310760, "author": "Rob Mensching", "author_id": 23852, "author_profile": "https://Stackoverflow.com/users/23852", "pm_score": 3, "selected": false, "text": "wix-users@lists.wixtoolset.org" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/310418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20198/" ]
310,425
<p>Currently I have a table that I search upon 4 fields, FirstName, LastName, MiddleName, And AKA's. I currently have a <strong>CONTAINSTABLE</strong> search for the rows and it works. Not well but it works. Now <strong>I want to make the First Name weighted higher and middle name lower.</strong></p> <p>I found the command <strong>ISABOUT</strong> but that seems pretty worthless if I have to do it by word not column (hopefully I understood this wrong). This is not an option if its by word because I do not know how many words the user will enter.</p> <p>I found the thread <a href="https://stackoverflow.com/questions/198152/how-do-i-assign-weights-to-different-columns-in-a-full-text-search">here</a> that talks about this same solution however I was unable to get the accepted solution to work. Maybe I have done something wrong but regardless I cannot get it to work, and its logic seems really... odd. There has to be an easier way. </p>
[ { "answer_id": 322191, "author": "Dave_H", "author_id": 17109, "author_profile": "https://Stackoverflow.com/users/17109", "pm_score": 4, "selected": true, "text": "DECLARE @Results TABLE (PersonId Int, Rank Int, Source Int)\n" }, { "answer_id": 4124995, "author": "Pavel Urban...
2008/11/21
[ "https://Stackoverflow.com/questions/310425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1925/" ]
310,426
<p>To do the equivalent of Python list comprehensions, I'm doing the following:</p> <pre><code>some_array.select{|x| x % 2 == 0 }.collect{|x| x * 3} </code></pre> <p>Is there a better way to do this...perhaps with one method call?</p>
[ { "answer_id": 310466, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 7, "selected": true, "text": "class Array\n def comprehend(&block)\n return self if block.nil?\n self.collect(&block).compact\n end\nend\n\...
2008/11/21
[ "https://Stackoverflow.com/questions/310426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
310,436
<p>Is there a way to only load child nodes when the parent node is expanded? The problem that I’m running into is that the “expand” icon doesn’t show up if a node doesn’t have any children. Since I don’t want to load the children until the icon is clicked, I’m left with a bit of a catch 22.</p>
[ { "answer_id": 1535877, "author": "Homer", "author_id": 176537, "author_profile": "https://Stackoverflow.com/users/176537", "pm_score": 2, "selected": false, "text": "public class TreeViewItemEx : TreeViewItem {\n protected override DependencyObject GetContainerForItemOverride() {\n ...
2008/11/21
[ "https://Stackoverflow.com/questions/310436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13181/" ]
310,441
<p>I need to reformat a text file into a PDF. Using Perl, I am modifying an existing PostScript template file based on what is in the text file. Sometimes this text file will be long enough to require a two page PDF.</p> <p>Can I create a two page PDF file from one .ps file using GhostScript? If so, what tells GhostScript where the page break should occur?</p> <p>Maybe I need to use two template files. One for a one page pdf and another for a two page PDF.</p>
[ { "answer_id": 310463, "author": "Alnitak", "author_id": 6782, "author_profile": "https://Stackoverflow.com/users/6782", "pm_score": 0, "selected": false, "text": "showpage" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/310441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7519/" ]
310,451
<p>Both <code>static_cast</code> and <code>reinterpret_cast</code> seem to work fine for casting <code>void*</code> to another pointer type. Is there a good reason to favor one over the other?</p>
[ { "answer_id": 310489, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 8, "selected": false, "text": "static_cast" }, { "answer_id": 1899898, "author": "Pavel Radzivilovsky", "author_id": 73656, "aut...
2008/11/21
[ "https://Stackoverflow.com/questions/310451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37992/" ]
310,456
<p>I'm trying to find a way to get the open tasks in C#. I've been searching on google and can only find how to get a list of the <strong>processes</strong>. I want the only the tasks that would show up on the taskbar.</p> <p>Also, along with that, it would be cool if I could get the process the task is associated with. And if possible get the thumbnail images that Vista uses for the ALT-TAB menu, like in this image:</p> <p><a href="https://i.stack.imgur.com/CcPQP.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CcPQP.png" alt="alt-tab"></a></p> <p>I assume that I will have to use pinvokes because it really doesn't look like there are any libraries to do this already. Any ideas?</p>
[ { "answer_id": 310481, "author": "abelenky", "author_id": 34824, "author_profile": "https://Stackoverflow.com/users/34824", "pm_score": 1, "selected": false, "text": "using System.Diagnostics;\nstatic void MyFunc()\n{\n Process[] processes = Process.GetProcesses();\n foreach(Proces...
2008/11/21
[ "https://Stackoverflow.com/questions/310456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13713/" ]
310,458
<p>In ASP.NET (not MVC), what is the best approach to programmatically setting styles on an unordered list used for navigation so the appropriate menu item is styled as the active item if that page is being viewed? </p> <p>This would most likely be used in conjunction with a MasterPage.</p>
[ { "answer_id": 310477, "author": "Frank V", "author_id": 18196, "author_profile": "https://Stackoverflow.com/users/18196", "pm_score": 2, "selected": true, "text": "<{...} class=\"GeneratedMenuItem\"> {...}\n" }, { "answer_id": 310535, "author": "Dillie-O", "author_id": 7...
2008/11/21
[ "https://Stackoverflow.com/questions/310458", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30552/" ]
310,459
<p>I'm trying to transform each element of a numpy array into an array itself (say, to interpret a greyscale image as a color image). In other words:</p> <pre><code>&gt;&gt;&gt; my_ar = numpy.array((0,5,10)) [0, 5, 10] &gt;&gt;&gt; transformed = my_fun(my_ar) # In reality, my_fun() would do something more useful array([ [ 0, 0, 0], [ 5, 10, 15], [10, 20, 30]]) &gt;&gt;&gt; transformed.shape (3, 3) </code></pre> <p>I've tried:</p> <pre><code>def my_fun_e(val): return numpy.array((val, val*2, val*3)) my_fun = numpy.frompyfunc(my_fun_e, 1, 3) </code></pre> <p>but get:</p> <pre><code>my_fun(my_ar) (array([[0 0 0], [ 5 10 15], [10 20 30]], dtype=object), array([None, None, None], dtype=object), array([None, None, None], dtype=object)) </code></pre> <p>and I've tried:</p> <pre><code>my_fun = numpy.frompyfunc(my_fun_e, 1, 1) </code></pre> <p>but get:</p> <pre><code>&gt;&gt;&gt; my_fun(my_ar) array([[0 0 0], [ 5 10 15], [10 20 30]], dtype=object) </code></pre> <p>This is close, but not quite right -- I get an array of objects, not an array of ints.</p> <p><b>Update 3!</b> OK. I've realized that my example was too simple beforehand -- I don't just want to replicate my data in a third dimension, I'd like to transform it at the same time. Maybe this is clearer?</p>
[ { "answer_id": 310493, "author": "Piotr Lesnicki", "author_id": 38796, "author_profile": "https://Stackoverflow.com/users/38796", "pm_score": 1, "selected": false, "text": " numpy.resize(my_ar, (3,3)).transpose()\n" }, { "answer_id": 310893, "author": "Mr Fooz", "author_i...
2008/11/21
[ "https://Stackoverflow.com/questions/310459", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12779/" ]
310,469
<p>I want a workflow that, when an entry is created in List A, will generate one entry in List B for each entry in List C. Is this possible? If so, how?</p>
[ { "answer_id": 310493, "author": "Piotr Lesnicki", "author_id": 38796, "author_profile": "https://Stackoverflow.com/users/38796", "pm_score": 1, "selected": false, "text": " numpy.resize(my_ar, (3,3)).transpose()\n" }, { "answer_id": 310893, "author": "Mr Fooz", "author_i...
2008/11/21
[ "https://Stackoverflow.com/questions/310469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
310,479
<p>I am developing a cocoa application that will be making heavy use of both web services and a standard dbms (most likely MySQL) and I am wondering if anyone has a good option for a database library or ORM solution they have used. CoreData is not an option due to the need to support a standard DBMS and to be able to modify the data outside of the normal application operation.</p> <p>I have found a number of possible options from new open source libraries: <a href="http://github.com/aptiva/activerecord/tree/master" rel="noreferrer">http://github.com/aptiva/activerecord/tree/master</a></p> <p>To writing my own wrapper for the C MySQL api.</p> <p>Any advice is welcome,</p> <p>Thanks!</p> <p>Paul</p>
[ { "answer_id": 468461, "author": "Dirk Stoop", "author_id": 24051, "author_profile": "https://Stackoverflow.com/users/24051", "pm_score": 4, "selected": true, "text": "NSBundle *pluginBundle = [NSBundle bundleWithPath:pluginPath];\n[pluginBundle load];\n" } ]
2008/11/21
[ "https://Stackoverflow.com/questions/310479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39819/" ]