instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have written a custom control, that has several sub panels. I want these sub panels to accept any additional controls dropped on them at design time.</p> <p>Unfortunately any control that gets dropped at design time ends up on my custom control, not on the panels. This shows in particular if I try to drop a label...
<p>This is a good question. You can allow your custom TWinControl to have other controls dropped on it at design-time by adding csAcceptControls to your controls ControlStyle property.</p> <pre><code>constructor TMyContainer.Create(AOwner: TComponent); begin inherited; ControlStyle := ControlStyle + [csAcceptContr...
<p>I did this, but ended up replacing the controls with regular panels which would be shown/hidden when required. </p> <p>Instead of descending from TPanel my controls descend from TCustomControl. I don't think I could get it to work descending from TPanel but can't remember what the issue was. </p> <p><strong>The co...
48,973
<p>Which profiler is better for general purpose profiling and heap analysis? 90% of our apps are standalone command line programs with substantial database and numeric processing. The other 10% are webapps/servlet container apps (with very little JSP and NO SCRIPLETS!). Target user would be Sr Software Engineer with 5-...
<p>I've used both JProfiler 4 and YourKit 7.5, and YourKit wins hands down. It's so much less invasive than JProfile, in that I'll happy run production servers with the YourKit agent installed, which I would never do with JProfiler.</p> <p>Also, the analysis tool that comes with YourKit is more intuitive (in my opinio...
<p>I've only used JProfiler (and some JProbe). As far as I can tell, one limitation of YourKit is that they don't appear to support JDK 1.4.2. That's not an issue for many people, but it might be.</p>
19,792
<p>I am taking in a string from user input, and splitting it on whitespace (using \w) into an array of strings. I then loop through the array, and append a part of the where clause like this:</p> <pre><code> query += " AND ( " + "field1 LIKE '%" + searchStrings[i] +"%' " ...
<p>Any time you allow a user to enter data into a query string like this you are vulnerable to SQL injection and it should be avoided like the plague!</p> <p>You should be very careful how you allow your searchStrings[] array to be populated. You should always append variable data to your query using parameter object...
<p>Yes, they could still inject items, without spaces it might not do much, but it is still a vulnerability.</p> <p>In general blindly adding user input to a query is not a good idea.</p>
48,758
<p>VB 6.0 does not have any global handler.To catch runtime errors,we need to add a handler in each method where we feel an error can occur.But, still some places might be left out.So,we end up getting runtime errors.Adding error handler in all the methods of an application,the only way?</p>
<p>No there is no way to add a global error handler in VB6. However, you do not need to add an error handler in every method. You only really need to add an error handler in every event handler. E.g. Every click event,load event, etc</p>
<p>on error resume next - is kinda close but its been a while. you might want to look up any caveats</p>
9,072
<p>I'd like to use gSOAP in a product which will be distributed commercially. The use I have in mind is what I suspect is a pretty typical workflow—generating a header using wsdl2h, consuming the header with soapcpp2, and then calling the functions generated in the stub in my code.</p> <p>I'm not 100 percent sure whic...
<p>I hope the following clarification helps. Please contact us at contact@genivia.com for questions.</p> <p>The gSOAP software requires a commercial license for commercial product development if any one of the following conditions hold:</p> <ol> <li><p>If you use wsdl2h to generate code. Because the generated code is...
<p>As I understand the GPL, as long as you release all derived products under the GPL, the code is free for even commercial use. Of course most companies don't want to release their source code for anyone to copy freely, hence the commercial license. I think Genivia's summary is not as clear as it could be on this on...
42,773
<p>I was wondering if someone would be able to help me write a CQL query for NDepend that will show me all the methods in my form class that handle the form events. So I would like to be able to find all the methods that look like this:</p> <pre><code>Private Sub AddFolderButton_Click(ByVal sender As System.Object, B...
<p>I am Patrick from the NDepend team and I confirm, so far using a condition 'Namelike + regular expression' on the 'method name + signature' is the best way to achieve what you want with CQL.</p>
<p>I have sort of got something that works but its not really 100% correct, because all the form generated event handlers have an underscores in there name, I used the underscore as a filter, I also filter where the name has "EventArgs" in it. The query looks like this:</p> <pre><code>SELECT METHODS WHERE NameLike "...
35,815
<p>What issues or refactoring did you have to do when you upgraded from ASP.NET MVC Preview 5 to the newly released <a href="http://www.microsoft.com/downloads/details.aspx?familyid=a24d1e00-cd35-4f66-baa0-2362bdde0766&amp;displaylang=en&amp;tm" rel="nofollow noreferrer">Beta</a> version?</p>
<p>I'm about to do this myself. Here's the list of changes from the readme:</p> <h2>Changes Made Between CodePlex Preview 5 and Beta</h2> <ul> <li>Changed the default validation messages to be more end-user friendly. </li> <li>Renamed CompositeViewEngine to AutoViewEngine.</li> <li>Added a Url property to Controlle...
<p>If you are using Html.Form from the futures assembly (Microsoft.Web.Mvc) you might get a name collision on the FormMethod enum. For example:</p> <pre><code>Html.Form&lt;FooController&gt;(c =&gt; c.Bar(), FormMethod.Post, new Hash(@class =&gt; "foobar")) </code></pre> <p>This will complain that FormMethod is an am...
25,575
<p>I have a Tronxy P802M (very similar to the Anet A8, but using a Melzi2.0V5 board) that seems to work fine (I just finished building, and axes movement and the integrated display work) but when I try to connect to the printer from my Simplify3D on Windows 10, I get the following:</p> <pre><code>[...] Connected to ...
<p>The <a href="https://www.simplify3d.com/support/faq/#faq-4630" rel="nofollow noreferrer">Simplify3D support site</a> mentions to disable the "wait for startup command" option in the firmware configuration for S3D.</p> <p>This allows me to make a rudimentary connection to control the printer, however e.g. during the...
<p>Try changing your port in the control menu. By default, mine is set to <code>COM 1</code> and I have to change it to <code>COM 3</code>.</p>
498
<p>Where I work, we have small teams of 2 - 5 people. As a dev lead, what are some things that you've implemented which makes your team stand out from the others? Meaning, it makes the others teams say, "that's cool" or "why didn't we think of that". Just some thinking out of the box that made your team extremely ef...
<p>Automated unit testing and an automated build system (like CruiseControl)</p>
<p>First and foremost -- we get things done on time that meet the done criteria. That's the best thing to do, in my opinion :)</p>
41,012
<p>I have a c# class which uses the WindowsIdentity namespace to return details of the current Active Directory user. This is accessible through a web part on SPS and sure enough returns the desired record values specific to that user. </p> <p>I have a classic ASP application which I would like to have inherit this f...
<p><a href="http://weblogs.asp.net/scottgu/about.aspx" rel="noreferrer">Scott Guthrie</a> (the guy who runs the .Net dev teams at MS) covered how to do this on his blog some months ago much better than I ever could, <strong><a href="http://weblogs.asp.net/scottgu/archive/2007/08/16/linq-to-sql-part-6-retrieving-data-us...
<p>Just curious, if a Post have have one or many Categories, is it possible to instead of using the for loop, to load the Post.PostCategories with the list of Categories (one to many), all in one shot, using a JOIN?</p> <pre><code>var rslt = from p in results.GetResult&lt;Post&gt;() join c in results.GetRes...
48,543
<p>Usually pagination queries look like this. Is there a better way instead of making two almost equal methods, one of which executing "select *..." and the other one "count *..."?</p> <pre><code>public List&lt;Cat&gt; findCats(String name, int offset, int limit) { Query q = session.createQuery("from Cat where na...
<p>If you don't need to display the total number of pages then I'm not sure you need the count query. Lots of sites including google don't show the total on the paged results. Instead they just say "next>".</p>
<p>here's the way pagination is done in hibernate</p> <pre><code>Query q = sess.createQuery("from DomesticCat cat"); q.setFirstResult(20); q.setMaxResults(10); List cats = q.list(); </code></pre> <p>you can get more info from hibernate docs at : <a href="http://www.hibernate.org/hib_docs/v3/reference/en-US/html_singl...
20,298
<p>I've got this problem with dynamically created TextBox.</p> <p>When the TextBox is created in PageLoad, it's TextChanged event was fired.<br> But when I dynamically delete and recreated the TextBox, the TextChanged was not fired.</p> <p>This is the code:</p> <p><strong>.aspx file</strong></p> <pre><code>&lt;body...
<p>Event handling is done by ASP.NET by matching up control's ID &amp; the request parameters. In your case, the TextBox created during txtTextChanged() will have an auto ID because you don't specify any explicit ID. That ID will be posted back during the text changed event. </p> <p>After page load event, ASP.NET wil...
<p>When I was researching this issue, it was in the context of Dynamic Menus, and there are a bunch of Google responses that, together, got me through it (because it's a common enough requirement, I guess.) I don't have a summary of the answer, but it might be a helpful place to start (i.e. google for Dynamic Menus .NE...
39,619
<p>I haven't a clue about encryption at all. But I need it. How?</p> <p>Say you have a system of nodes communicating with each other on a network via asynchronous messages. The nodes do not maintain session information about other nodes (this is a design restriction).</p> <p>Say you want to make sure only your nodes ...
<p>Your first thought should be channel security - either SSL/TLS, or IPSec.<br> Admittedly, these both have a certain amount of setup overhead, IPSec more than SSL/TLS, especially when it comes to PKI etc. - but it more than pays for itself in simplicity of development, reliability, security, and more. Just make sure ...
<p>I'd probably go for <a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard#Implementations" rel="nofollow noreferrer">AES</a>.</p>
20,775
<p>Should be available to non-U.S. companies, easy to setup, reliable, cheap, customizable, etc. What are your experiences?</p>
<p>You can't really answer this kind of question with a &quot;I like 'insert provide name here'&quot; type answer because like so many things it is a balance and the reasons for choosing a payment processing solution tend to be complex.</p> <h2>Volume / Value</h2> <p>The most important factor in choosing a secure payme...
<p>Try AlertPay, they have very competetive fees.</p>
2,470
<p>Currently I am working very basic game using the C++ environment. The game used to be a school project but now that I am done with that programming class, I wanted to expand my skills and put some more flourish on this old assignment.</p> <p>I have already made a lot of changes that I am pleased with. I have centra...
<p>In all honeasty, you're probably approaching this from the wrong end.</p> <p>Your item class should have a string "bow", in a private member. The function Item::GetFilePath would then (at runtime) do "..\DATA\Images\" + this->name + ".png".</p> <p>The fundamental property of the "bow" item object isn't the filenam...
<p>One thing that looks wrong is that the second parameter to substr should be the number of chars to copy, not the position.</p>
47,985
<p>I am trying to come up with the best data structure for use in a high throughput C++ server. The data structure will be used to store anything from a few to several million objects, and no sorting is required (though a unique sort key can be provided very cheaply).</p> <p>The requirements are that it can support ef...
<p>Personally, I'm quite fond of persistent immutable data structures in highly-concurrent situations. I don't know of any specifically for C++, but Rich Hickey has created some excellent (and blisteringly fast) immutable data structures in Java for <a href="http://clojure.org" rel="noreferrer">Clojure</a>. Specifica...
<p>I am a bit late to the party. But if someone is still looking for a practical solution to this problem and they have not yet decided on a server, let me suggest <a href="https://developers.google.com/appengine/" rel="nofollow">Google's App Engine</a>. Their Datastore is optimized for these type of requirements.</p>
32,810
<p>I have just got a Monoprice Maker Select 3d printer (which is really just a Wanhao Duplicator i3). </p> <p>I want to print a model that came on the included SD card (<code>1.gcode</code>) with ABS filament. I first press "<code>Preheat ABS</code>" and wait for the display to show the correct temperatures, 245°C for...
<p>The demo files are gcode files generated for use with the sample PLA that comes with the printer. If you want to print it with ABS select the file and set the temperature manually afterwards. </p>
<p>If you want to use the demo files, you can probably pause the print as soon as it starts, and manually set the extruder temperatures before resuming the print. Easier to generate new g-code though.</p>
465
<p>I have a dictionary where keys are strings, and values are integers.</p> <pre><code>stats = {'a': 1, 'b': 3000, 'c': 0} </code></pre> <p>How do I get the key with the maximum value? In this case, it is <code>'b'</code>.</p> <hr /> <p>Is there a nicer approach than using an intermediate list with reversed key-value t...
<p>You can use <code>operator.itemgetter</code> for that:</p> <pre><code>import operator stats = {'a': 1000, 'b': 3000, 'c': 100} max(stats.iteritems(), key=operator.itemgetter(1))[0] </code></pre> <p>And instead of building a new list in memory use <code>stats.iteritems()</code>. The <code>key</code> parameter to the ...
<p>I tested the accepted answer AND @thewolf's fastest solution against a very basic loop and the loop was faster than both:</p> <pre><code>import time import operator d = {"a"+str(i): i for i in range(1000000)} def t1(dct): mx = float("-inf") key = None for k,v in dct.items(): if v &gt; mx: ...
33,662
<p>Our application defines a URL scheme whose resolution is context-sensitive: The content of the URL depends on the state of an in-progress database transaction. As such, to retrieve the content I cannot, for example, open a new database connection. However, I can't see a way to get at external context from the <co...
<p>See <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/net/URL.html#setURLStreamHandlerFactory(java.net.URLStreamHandlerFactory)" rel="nofollow noreferrer">URL.setURLStreamHandlerFactory</a></p> <p>This is a static method and:</p> <blockquote> <p>Sets an application's URLStreamHandlerFactory. This method ...
<p>It turns out that for our purposes, at least, the thread-local context object works best.</p>
32,833
<pre><code>SELECT DISTINCT 'LRS-TECH 1' || rpad(code,7) || rpad('APPTYPE',30) || rpad(licensing_no,30) || rpad(' ',300) AS RECORD FROM APPS WHERE L_code = '1000' AND licensing_no IS NOT NULL </code></pre> <p>This seems to be the primary culprit in why I cannot export these records to a textfile in my deve...
<p>You cannot diagnose this problem unless you know how the query is being optimised.</p> <p>Try this:</p> <pre><code>explain plan for SELECT DISTINCT 'LRS-TECH 1' || rpad(code,7) || rpad('APPTYPE',30) || rpad(licensing_no,30) || rpad(' ',300) AS RECORD FROM APPS WHERE L_code = '1000' AND licensing_no IS NOT NUL...
<p>Get rid of the DISTINCT.</p>
36,646
<p>As you know, in ASP.NET, you can store session data in one of following three modes:</p> <ul> <li>InProc</li> <li>Session State </li> <li>SQL Server</li> </ul> <p>For InProc mode, you can store any kind of data objects even it's not serializable. However, in Session State and SQL Server modes, you can only store s...
<p>Below is a quick (and simple) ISAPI Filter example. I found it very useful when trying to write my first ISAPI plugin. <a href="http://blogs.msdn.com/rakkimk/archive/2007/03/01/writing-a-simple-isapi-filter.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/rakkimk/archive/2007/03/01/writing-a-simple-isapi-filter...
<p>Visual Studio used to have an ISAPI wizard which was great for writing plugins. If you have 6.0, it might still be there. VS 2003 has one under MFC for ISAPI with MFC support (not hard to remove if you don't want it).</p> <p>If you are doing an Extension (not a filter) -- here is the minimal code you need:</p> <...
30,112
<p>I have a custom user control with a textbox on it and I'd like to expose the baseline (of the text in the textbox) snapline outside of the custom control. I know that you create a designer (inherited from ControlDesigner) and override SnapLines to get access to the snaplines, but I'm wondering how to get the text b...
<p>I just had a similar need, and I solved it like this:</p> <pre><code> public override IList SnapLines { get { IList snapLines = base.SnapLines; MyControl control = Control as MyControl; if (control == null) { return snapLines; } IDesigner designer = TypeDescriptor.CreateDes...
<p>You're on the right track. You will need to override the SnapLines property in your designr and do something like this:</p> <pre><code>Public Overrides ReadOnly Property SnapLines() As System.Collections.IList Get Dim snapLinesList As ArrayList = TryCast(MyBase.SnapLines, ArrayList) Dim offset...
11,906
<p>I am looking for a simple system to manage inbound emails from a support mailbox for a group with about 3 support people. I've looked at <a href="http://otrs.org/" rel="nofollow noreferrer">OTRS</a> which seems to have the features that we need. Unfortunately, so far the UI still looks like a confusing mess.</p> ...
<p>I have to agree, Fogbugz is probably the best out there. I have used both the hosted version and the purchased version which I hosted. It is top-notch.</p>
<p>We use FogBugz...er, "fooogzeeebugzo"...and while it may be a bit expensive for your needs, it works very well.</p>
6,205
<p>What is the best way to initialize a private, static data member in C++? I tried this in my header file, but it gives me weird linker errors:</p> <pre><code>class foo { private: static int i; }; int foo::i = 0; </code></pre> <p>I'm guessing this is because I can't initialize a private member from out...
<p>The class declaration should be in the header file (Or in the source file if not shared).<br> File: foo.h</p> <pre><code>class foo { private: static int i; }; </code></pre> <p>But the initialization should be in source file.<br> File: foo.cpp</p> <pre><code>int foo::i = 0; </code></pre> <p>If the initial...
<p>Does this serves your purpose?</p> <pre><code>//header file struct MyStruct { public: const std::unordered_map&lt;std::string, uint32_t&gt; str_to_int{ { "a", 1 }, { "b", 2 }, ... { "z", 26 } }; const std::unordered_map&lt;int , std::string&gt; int_to_str{ { 1, "...
22,481
<p>How do I put a gridview row in edit mode programmatically?</p>
<p>Set the EditIndex property to the appropriate row and then ReBind the GridVIew again to it's DataSource.</p> <p>Hope this helps.</p>
<pre><code>protected void btnEdit_Click(object sender, EventArgs e) { GridView1.EditIndex = 1; } </code></pre> <p>Tested with vs-2008. fork fine.</p>
25,364
<p>I've just started looking into M-V-VM for a WPF application. Everything makes sense so far besides this particular issue...</p> <p>I have a ViewModel I'll call Search. This ViewModel binds to a datagrid and lists results of items. Now, I have a command that needs to bring up <strong>another view</strong>, the it...
<p>Views should never be instantiated anywhere "below" the UI layer. VMs exist below that realm, therefore this is not the place to put that logic (as you've already realized).</p> <p>There will almost always be some UI level event that will indicate the need to create the view. In your example, it might be a row (d...
<p>We use a variant on this pattern, Here we have controllers that represent the VM, so the datacontext of the View is the VM and our DTOs are properties of the VM/Controller. We call it a controller still as we use this as the control point and thus handle certain command from the View. This is (I think) where we woul...
38,924
<p>A have a design question. I have wrote a couple of c# applications. Most of these apps have their own sql or access database, but then they also share a common database, but they are entirely different apps which have their own responsibilities in their own business domains.</p> <p>Some people I spoke with believe ...
<p>There is a line, somewhere... sharing library code is positively encouraged - but you need to be a <em>little</em> bit careful when apps consume each-other, simply to prevent spaghetti code and circular references.</p> <p>If the code you mention is really library code (i.e. neither project is the "master" for this ...
<p>You should share everything (within the limits of common sense of course.) You are a team of developers, not a set of individual developers. Sharing code has numerous benefits: reusability means quicker development, simpler maintenance (you only need to fix a bug once), a new feature or improvement is potentially ab...
27,272
<p>What datatype would be used for storing video files in sql server2000?</p>
<p>Use BLOBs (binary large objects). <a href="http://www.microsoft.com/technet/prodtechnol/sql/2000/reskit/part3/c1161.mspx" rel="noreferrer">Documentation here</a>. More specifially:</p> <blockquote> <p>In SQL Server, BLOBs can be text, ntext, or image data type</p> <p><strong>image</strong> </p> <p>Varia...
<p>Save yourself a headache and store them on the file system. Store the path in the DB. </p> <p>Currently I can't think of a <em>really</em> good reason to store videos in a database, when there is a file system available. What are your's?</p>
47,822
<p>I whant to make a web interface on a server that will manage a few dns servers on another servers.</p> <h3>How can i remotely manage a bind dns server programmaticly ?</h3> <ul> <li>I would like to add/edit/delete zones.</li> <li>I see that there is rndc but that only allows reloading of zones and not adding/deletin...
<p>If there isn't a hard requirement on writing something like this from scratch, why not simply use an already existing interface without having to reinvent the wheel? A simple <a href="http://www.google.com/search?q=bind+dns+web+interface" rel="noreferrer">Google search for the keywords bind dns web interface</a> yie...
<p>You could set up something that does remote SSH commands? That may be a bit insecure, though, unless the server running the commands themselves is pre-authenticated with an SSH key, and that's the only way you can access the server.</p>
44,297
<p>How do I check if an object property in JavaScript is undefined?</p>
<p>The usual way to check if the value of a property is the special value <code>undefined</code>, is:</p> <pre class="lang-js prettyprint-override"><code>if(o.myProperty === undefined) { alert(&quot;myProperty value is the special value `undefined`&quot;); } </code></pre> <p>To check if an object does not actually ha...
<pre><code>if (somevariable == undefined) { alert('the variable is not defined!'); } </code></pre> <p>You can also make it into a function, as shown <a href="http://verens.com/archives/2005/07/25/isset-for-javascript/" rel="nofollow noreferrer">here</a>:</p> <pre><code>function isset(varname){ return(typeof(windo...
4,711
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/273209/are-memory-leaks-ever-ok">Are memory leaks ever ok?</a> </p> </blockquote> <p>I read somewhere that there are special cases when memory leaks are needed and actually a good thing in some rare circumstanc...
<p>The only situations I can think of where a memory leak would be desirable are as follows:</p> <p>(they're all a little convoluted though apart from the 1st)</p> <ul> <li><p>An academic situation where a memory leak would be a good learning excercise in a programming class; including <em>tracking down of</em> and <...
<p>They're good if you're a hosting company that get to charge $$$++ for memory upgrades to servers.</p>
41,938
<p>Ok, so PHP isn't the best language to be dealing with arbitrarily large integers in, considering that it only natively supports 32-bit signed integers. What I'm trying to do though is create a class that could represent an arbitrarily large binary number and be able to perform simple arithmetic operations on two of ...
<p>The <a href="http://us2.php.net/gmp" rel="nofollow noreferrer">PHP GMP extension</a> will be better for this. As an added bonus, you can use it to do your decimal-to-binary conversion, like so:</p> <pre><code>gmp_strval(gmp_init($n, 10), 2); </code></pre>
<p>I implemented the following <a href="https://github.com/alixaxel/phunction/blob/ac2bc87e0d6d6c944a46d9714ca79004b18319c0/phunction/Math.php#L74-L143" rel="nofollow">PEMDAS complaint BC evaluator</a> which may be useful to you.</p> <pre><code>function BC($string, $precision = 32) { if (extension_loaded('bcmath')...
5,807
<p>I came across this topic today while investigating something very strange. Doing certain things in our Flex app can cause the number of frames rendered to rocket, from 12fps to ~30fps: loaded animations start playing at high speed and the GUI starts to lock up.</p> <p>Since everything I've read on Flex/Flash hammer...
<p>Flex sets the frame rate to 1000 during "phased instantiation" of Flex components, which occurs only during initial load of a flex swf. This allows it to build all components very quickly.</p> <p>Are you waiting for the Flex app to be fully loaded and constructed? You should be waiting for FlexEvent.CREATION_COMP...
<p>One thing I'm not clear on - are you seeing that the actual screen refreshes are occurring faster than the published framerate? Or is it that your animations are moving faster but the screen refreshes are unchanged? (i.e., it used to move 10 pixels per second, but now it moves faster than that, regardless of how oft...
17,079
<p>I have been bitten by something unexpected recently. I wanted to make something like that:</p> <pre><code>try : thing.merge(iterable) # this is an iterable so I add it to the list except TypeError : thing.append(iterable) # this is not iterable, so I add it </code></pre> <p>Well, It was working fine unti...
<p>Note that what is happening is not related to any kind of implicit string conversion etc, but because the <code>Exception</code> class implements <code>___getitem__</code> to return the values from the args tuple (<code>ex.args</code>). You can see this by the fact that you get the whole string as your first and onl...
<p>NOT VALID. Check Brian anwser.</p> <p>Ok, I just got it :</p> <pre><code>for x in Exception("test") : print x ....: ....: test </code></pre> <p>Don't bother ;-)</p> <p>Anyway, it's good to know.</p> <p>EDIT : looking to the comments, I feel like adding some explanations.</p> <p>An exception...
32,229
<p>This is a continuation question from a previous question <a href="https://stackoverflow.com/questions/142237/integrating-external-sources-in-a-build.">I have asked</a></p> <p>I now have a /externals directory in the root of my project tree. Inside this I have a reference to another project. I'm able to script the b...
<p>I'd recommend taking a look at the UK Government Data Standard for postcodes [link now dead; <a href="http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/media/291370/bs7666-v2-0-xsd-PostCodeType.htm" rel="noreferrer">archive of XML</a>, see <a href="http://en.wikipedia.org/wiki/Postcodes_in_...
<p>I needed a version that would work in SAS with the <code>PRXMATCH</code> and related functions, so I came up with this:</p> <pre><code>^[A-PR-UWYZ](([A-HK-Y]?\d\d?)|(\d[A-HJKPSTUW])|([A-HK-Y]\d[ABEHMNPRV-Y]))\s?\d[ABD-HJLNP-UW-Z]{2}$ </code></pre> <p>Test cases and notes:</p> <pre><code>/* Notes The letters QVX ...
19,941
<p>I am having an VB Script. I need to log the error information in a file. I need to log every information like error number error description and in which sub routine does the error occured.</p> <p>Please provide some code</p>
<p>You can make use of the <a href="http://www.w3schools.com/asp/asp_ref_filesystem.asp" rel="nofollow noreferrer">FileSystemObject</a> and the <a href="http://www.devguru.com/technologies/vbscript/QuickRef/err.html" rel="nofollow noreferrer">Error</a> object if you're using VBScript.</p> <p>Paste the following into e...
<p>For error handling in VBScript is used "On Error" clausule. There are 3 ways, how to handle errors:</p> <ul> <li>On Error Resume Next '' ignore errors</li> <li>On Error GoTo 0 '' removes error handlning</li> <li>On Error GoTo HandleError '' on error will code jump to specified signal</li> </ul> <p>Samples:</p> <p...
25,446
<p>As in the subject, how can one get the total width of an element, including its border and padding, using jQuery? I've got the jQuery dimensions plugin, and running <code>.width()</code> on my <code>760px-wide</code>, <code>10px padding</code> DIV returns <code>760</code>.</p> <p>Perhaps I'm doing something wrong,...
<p><strong>[Update]</strong></p> <p>The original answer was written prior to jQuery 1.3, and the functions that existed at the time where not adequate by themselves to calculate the whole width.</p> <p>Now, as <a href="https://stackoverflow.com/questions/349705/total-width-of-element-including-padding-and-border-in-j...
<p>same browsers may return string for border width, in this parseInt will return NaN so make sure you parse value to int properly.</p> <pre><code> var getInt = function (string) { if (typeof string == "undefined" || string == "") return 0; var tempInt = parseInt(string);...
45,499
<p>I've been using Eclipse pretty regularly for several years now, but I admit to not having explored all the esoterica it has to offer, particularly in the areas of what formatting features the editors offer.</p> <p>The main thing I miss from (X)emacs is the "align-regex" command, which let me take several lines into...
<p>You can set the formatter to do this:</p> <p>Preferences -> Java -> Code Style -> Formatter. Click 'Edit' on the profile (you may need to make a new one since you can't edit the default).</p> <p>In the indentation section select 'Align fields with columns'.</p> <p>Then, in your code <kbd>CTRL</kbd>+<kbd>SHIFT</kb...
<p>This plug-in does exactly what you want: <a href="https://github.com/eduardp/OCDFormat/" rel="nofollow">OCDFormat</a></p> <p>It works in all text files, not only Java.</p>
18,211
<p>I'm trying to get my head around <a href="https://jira.amqp.org/confluence/display/AMQP/About+AMQP" rel="nofollow noreferrer">AMQP</a>. It looks great for inter-machine (cluster, LAN, WAN) communication between applications but I'm not sure if it is suitable (in architectural, and current implementation terms) for u...
<p>AMQP is not an RPC framework. It provides the building blocks to model things like shared queues, RPC, pubsub etc. but it does not mandate any specific way to use it.</p> <p>If you want to partition your application (making it distributable on the way) and to wire it together with AMQP I think it's the right techno...
<p>AMQP looks more like a reliable transport middleware offering for SOA than something to be used internally.</p>
31,408
<p>I am using the rounded corners plugin for jquery and have it working rounding elements in my page. The only issue I have is that the elements appear on the page un-rounded and then round. What do I need to do so that the elements only appear rounded?</p> <p>I originally put my script tags in the head element but sh...
<p>Yes, vim settings can be included within the document.</p> <p>They are mostly found within comments, so they don't mess up the original file. An example for tab-specific settings is:</p> <pre><code>/* ex: set tabstop=8 expandtab: */ </code></pre> <p>Note that this command works in most cases, however, servers are...
<p>You could maybe save the file as a particular type, e.g. special filename format or extension, and then define an autocommand in your .vimrc for that filetype.</p> <p>I do this for my makefiles to ensure that I have the various settings I need for specific files.</p> <p>For example, here's my autocommand dec.</p> ...
40,415
<p>If A references assembly B 1.1 and C, and C references B 1.2, how do you avoid assembly conflicts?</p> <p>I nievely assumed C's references would be encapsulated away and would not cause any problems, but it appears all the dll's are copied to the bin, which is where the problem occurs.</p> <p>I understand the two ...
<p>I've achieved the same results using the GAC in the past, but you should question your reasons for having to reference more than one version and try to avoid it if possible. If you must do it, a <a href="http://msdn.microsoft.com/en-us/library/2fc472t2(VS.80).aspx" rel="noreferrer">binding redirect</a> may help in y...
<p>You can add a <a href="http://msdn.microsoft.com/en-us/library/eftw1fys.aspx" rel="nofollow noreferrer">bindingRedirect element</a> to your configuration file to specify which version of the assembly you want to use at runtime.</p> <pre><code>&lt;configuration&gt; &lt;runtime&gt; &lt;assemblyBinding xmlns=...
27,552
<p>Is it possible to integrate <a href="http://hudson.dev.java.net/" rel="noreferrer" title="hudson: an extensible continuous integration engine">Hudson</a> with MS Test?</p> <p>I am setting up a smaller CI server on my development machine with Hudson right now, just so that I can have some statistics (ie. <a href="ht...
<p>Hudson has a new plugin for MSTest. Just specify the location of the .trx file and the work is done for you. It wouldn't surprise me if the plugin used Allen's solution.</p>
<p>Hudson has a <a href="http://hudson.gotdns.com/wiki/display/HUDSON/Plot+Plugin" rel="nofollow noreferrer">Plot Plugin</a> which can be used to plot generic data. It's not the easiest plugin to configure and use if you have multiple data points per graph, but if you can parse your MS Test output and generate input fi...
45,938
<p>I'm using Visual Studio 2008 for an ASP .Net application, and Visual Studio keeps adding blank lines to my aspx file whenever I save, switch to design mode and back to code view, switch to split mode, or switch between files. Before I save, I will have:</p> <pre><code> &lt;/ContentTemplate&g...
<p>The only time I've seen Visual Studio do something close to this is when the XML/HTML in question is invalid, for example you are missing a closing tag somewhere.</p>
<p>I can't say I've ever experience this with any Visual Studio yet, but try this</p> <p><strong>Ctrl-E, D</strong> command will automatically reformat the document. (Assuming C# Development Enviroment)</p> <p><strong>Ctrl-K, Ctrl-D</strong> for Web Development Enviroment</p> <p>If the document remains as it is with...
10,338
<p>I need to convert a bunch of files to utf-8 in Python, and I have trouble with the "converting the file" part.</p> <p>I'd like to do the equivalent of:</p> <pre><code>iconv -t utf-8 $file &gt; converted/$file # this is shell code </code></pre> <p>Thanks!</p>
<p>You can use the <a href="https://docs.python.org/2/library/codecs.html" rel="noreferrer">codecs module</a>, like this:</p> <pre><code>import codecs BLOCKSIZE = 1048576 # or some other, desired size in bytes with codecs.open(sourceFileName, "r", "your-source-encoding") as sourceFile: with codecs.open(targetFileN...
<p>This is my brute force method. It also takes care of mingled \n and \r\n in the input.</p> <pre><code> # open the CSV file inputfile = open(filelocation, 'rb') outputfile = open(outputfilelocation, 'w', encoding='utf-8') for line in inputfile: if line[-2:] == b'\r\n' or line[-2:] == b'\n\r': ...
23,237
<p>I'm trying to control the main timeline of my flash application from a MovieClip that is a child of the main stage. Apparently, in ActionScript 2, you could do that using _root, but using root (since _root no longer exists) now gives an error:</p> <pre><code>root.play(); </code></pre> <p>"1061: Call to a possibly ...
<p>You need to cast it to a MovieClip</p> <pre><code>(root as MovieClip).play() </code></pre>
<p>Another way is separate your movieclip code into separate class while setting document class for your main fla.</p> <p>Assume the document class of your main fla is Main.as and your movieclip's class file is Movie.as, you can add Main class pointer as parameter in the Movie class constructor</p> <p>In Main.as</p> ...
33,722
<p>If I have two UIColors, what's the best way to draw an even gradient between them over an arbitrarily-sized area?</p> <p>I am guessing you would create a UIView subclass and use the CG drawing methods in the drawRect method. I just don't know which ones, or if there are any pitfalls to watch out for, like performan...
<pre><code>#import &lt;QuartzCore/QuartzCore.h&gt; - (void) setGradient { CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.frame = self.view.bounds; gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor whiteColor] CGColor], (id)[[UIColor blackColor] CGColor], nil]; [self.view.layer...
<p>I found that using CAGradientLayer produced a gradient with noticeable stepping Ended up using this</p> <blockquote> <p><a href="http://evilrockhopper.com/tag/cggradient/" rel="nofollow noreferrer">http://evilrockhopper.com/tag/cggradient/</a></p> </blockquote> <p>As per this question <a href="https://stackoverf...
28,085
<p>From my understanding, the power of heater must higher than heat dissipate to ambient air so the bed can heat up. The reason why a bed heats up too slowly is due to its heat capacity compared to heater power.</p> <p>As the heater is a resistive load, I think we can put higher voltage to get more heating power.</p> <...
<p>Yes, this method will work. Some (LED) power supplies have a small potentiometer that you can use to slightly adjust the voltage. On a 12 V printer, adjusting the supply from 12 V to 14 V will give a 36% increase in power.</p> <p>Obviously there is a limit to how much you can increase the voltage. The voltage itself...
<h1>Not necessarily</h1> <p><strong>Potential differential U</strong>, aka <em>Voltage</em> of a part, is not to be ignored: a 24 V part needs only 24 V, not 36 V. A 12 V heartbeat is only safe for 12 V. There is a little tolerance for those measurements, but rule of thumb is about 10-15% of the rated voltage, so a 12 ...
1,824
<p>My Windows application runs under Wine, but the installation is a bit of a headache for laymen, and the wrappers I've seen online (PlayOnLinux, Wine Doors) require even more packages to be installed. Is there a way to make a package that will install Wine if the user needs it to be installed, install the application...
<p>I don't believe there's any pre-made way to do this, but you could probably make a Debian package pretty easily that would depend on Wine, copy an MSI onto the machine, then run Wine's <code>msiexec /i /q</code> as the post-install script</p> <p>Edit: Make sure to think about the uninstall case too! I.e. in the pre...
<p>Answer is simple:</p> <ol> <li>Create Elf installer.</li> <li>Pack Elf installer onto Exe installer resources.</li> <li>Exe installer should unpack Elf installer on startup.</li> <li>Exe installer must tries to run Elf installer after unpack (system call or some think).</li> <li>If operation fail, we do normal inst...
47,760
<p>I'm specifying my doctype as xhtml strict, but it's being sent over the wire as a content type of text/html. I'd like to specify that the content type is application/xhtml+xm, but I can't figure out where, or if, I can configure this from within my application</p>
<p>You can specify it in the @ page attributes section, like this:</p> <pre><code>&lt;%@ Page ContentType="application/xhtml+xm" %&gt; </code></pre> <p>...more on <a href="http://msdn.microsoft.com/en-us/library/ydy4x04a(v=vs.100).aspx" rel="noreferrer">MSDN</a>.</p>
<p>=========aspx===============</p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %&gt; &lt;asp:literal runat="server" id="dt"&gt;&lt;/asp:literal&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; </code></pre> <p>=======...
21,093
<p>I'm trying to send messages to Objective-C objects in gdb.</p> <pre><code>(gdb) p $esi $2 = (void *) 0x1268160 (gdb) po $esi &lt;NSArray: 0x1359c0&gt; (gdb) po [$esi count] Target does not respond to this message selector. </code></pre> <p>I can't send any message to it. Am I missing something? Do I really need th...
<p>If you must override gdb and send a message to an object when it will not let you, you can use performSelector:</p> <pre><code>(gdb) print (int)[receivedData count] Target does not respond to this message selector. (gdb) print (int)[receivedData performSelector:@selector(count) ] 2008-09-15 00:46:35.854 Executable...
<p>@[John Calsbeek]</p> <p>Then it complains about missing symbols.</p> <pre><code>(gdb) p (NSUInteger)[(NSObject*)$esi retainCount] No symbol table is loaded. Use the "file" command. (gdb) p [(NSArray *)$esi count] No symbol "NSArray" in current context. </code></pre> <p>I tried to load the symbols for Foundation:...
8,041
<p>What is a good way to select all or select no items in a listview without using:</p> <pre><code>foreach (ListViewItem item in listView1.Items) { item.Selected = true; } </code></pre> <p>or</p> <pre><code>foreach (ListViewItem item in listView1.Items) { item.Selected = false; } </code></pre> <p>I know the under...
<p>EASTL is a possibility, but still not perfect. Paul Pedriana of Electronic Arts did an investigation of various STL implementations with respect to performance in game applications the summary of which is found here: <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2271.html" rel="noreferrer">http:...
<p>STL containers should not run "really slowly" in debug or anywhere else. Perhaps you're misusing them. You're not running against something like ElectricFence or Valgrind in debug are you? They slow anything down that does lots of allocations.</p> <p>All the containers can use custom allocators, which some people u...
11,260
<p>When prototyping initial GUI functionality with a customer is it better to use a pen/paper drawing or to mock something up using a tool and show them that ?</p> <p>The argument against a tool generated design being that the customer can sometimes focus on the low-level specifics of the mock-up rather than taking a ...
<p>Always start with paper or paper-like mock-ups first. You do not want to fall into a trap of giving the impression of completeness when the back-end is completely hollow.</p> <p>A polished prototype or pixel-perfect example puts too much emphasis on the design. With an obvious sketch, you have a better shot of di...
<p>You can try out <a href="http://www.foreui.com/" rel="nofollow noreferrer">ForeUI</a>, it allow prototyping with different styles, what's more, it can make interactive prototype and run it in browser.</p>
2,580
<p>Is it okay to run Hibernate applications configured with <code>hbm2ddl.auto=update</code> to update the database schema in a production environment?</p>
<p>No, it's unsafe.</p> <p>Despite the best efforts of the Hibernate team, you simply cannot rely on automatic updates <strong>in production</strong>. Write your own patches, review them with DBA, test them, then apply them manually.</p> <p>Theoretically, if <strong>hbm2ddl update</strong> worked in development, it s...
<p>I agree with Vladimir. The administrators in my company would definitely not appreciate it if I even suggested such a course.</p> <p>Further, creating an SQL script in stead of blindly trusting Hibernate gives you the opportunity to remove fields which are no longer in use. Hibernate does not do that.</p> <p>And I...
27,282
<pre><code>SELECT NR_DZIALU, COUNT (NR_DZIALU) AS LICZ_PRAC_DZIALU FROM PRACOWNICY GROUP BY NR_DZIALU HAVING NR_DZIALU = 30 </code></pre> <p>or</p> <pre><code>SELECT NR_DZIALU, COUNT (NR_DZIALU) AS LICZ_PRAC_DZIALU FROM PRACOWNICY WHERE NR_DZIALU = 30 GROUP BY NR_DZIALU </code></pre>
<p>The theory (by theory I mean <a href="http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt" rel="noreferrer">SQL Standard</a>) says that WHERE restricts the result set before returning rows and HAVING restricts the result set after bringing all the rows. So WHERE is faster. On SQL Standard compliant DBMSs in th...
<p>Both the statements will be having same performance as SQL Server is smart enough to parse both the same statements into a similar plan.</p> <p>So, it does not matter if you use WHERE or HAVING in your query.</p> <p>But, ideally you should use WHERE clause syntactically.</p>
42,579
<p>Came across this:</p> <p><a href="http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp" rel="nofollow noreferrer">http://www.eggheadcafe.com/articles/adonet_source_code_generator.asp</a></p> <p>And wondering if this is the right solution as I am not that big of a fan of creating a class for every s...
<p>You definitely shouldn't be creating a class for every stored procedure. There are a number of approaches you can take to handling your database interactions. You should have a good look at the major frameworks out there and decide which one best suits you. The Castle Project solution is great, and relies on nHibern...
<p>Is there any possibility of upgrading to framework 3.5? if so take a look at LINQ to SQL and Entity Framework as this will accomplish alot of this for you. </p> <p>If not then as long as it generates standard code that doesnt tie you into 3rd party libraries then you could certainly use it. At my workplace we have ...
27,078
<p>I'm trying add a tab to my web page that looks like this: <img src="https://i.stack.imgur.com/DT3e7.png" alt="alt text"></p> <p>Using <a href="http://mattberseth.com/blog/2007/09/using_css_image_sprites_with_t.html" rel="nofollow noreferrer">this example</a> as a basis, I've gotten it partially working. My case di...
<p>I think the <a href="http://alistapart.com/articles/slidingdoors/" rel="nofollow noreferrer">Sliding Doors Technique</a> may be what you're looking for.</p>
<p>This <a href="http://www.pagecolumn.com/tool/top_tabs_generator.htm" rel="nofollow noreferrer">tool</a> may be a help.</p>
21,181
<p>What is a tool or technique that can be used to perform spell checks upon a whole source code base and its associated resource files?</p> <p>The spell check should be <em>source code aware</em> meaning that it would stick to checking string literals in the code and not the code itself. Bonus points if the spell ch...
<p>Set the existing TotalLogins property as either private or protected and remove the readonly attribute. You may also want to rename it e.g. InternalTotalLogins.</p> <p>Then create a new property by hand in the partial class that exposes it publically as a read-only property:</p> <pre><code>Public ReadOnly Property...
<pre><code>Make a second property that is protected or internal(?) &lt;Column(Name:="totalLogins", Storage:="_TotalLogins", DbType:="Int", UpdateCheck:=UpdateCheck.Never)&gt; _ protected Property TotalLogins2() As System.Nullable(Of Integer) Get Return Me._TotalLogins End Get Set(byval value as S...
12,096
<p>I'm dealing with an issue with my current employer that has seriously made me consider seeking employment elsewhere. They are under the impression that 100% of custom development should be eliminated and replaced with COTS products, such as SharePoint. While I realize that this is not a realistic expectation, I've...
<p>If you don't share the vision of the company and if you can't enlighten them then sure, it is a good time to start looking.</p> <p>Have you pointed out that there is risk in forcing a "solution" on a client that does not help them or is missing functionality or is unusable? </p> <p>Perhaps come up with plans to ad...
<p>how about not calling it custom code. If instead you call it 'anticipated SharePoint user extensions' or something it may soften the misconception surrounding a specific term.</p> <p>also, as has been said, there may be other hidden from you reasons that management is pushing this agenda. It is probably best to n...
43,982
<p>I have a problem with time<br> My server is in the USA and I'm in Denmark (Europa) and I would like to have my site show the time in my local time. How can I do that?</p> <p>I try this </p> <pre><code>Datetime localtime = DateTimeOffset.Now.ToOffset(new TimeSpan(1,0,0)).DateTime; </code></pre> <p>and it works, ...
<p>The only way you should do it is as follows:</p> <pre><code>string zoneId = "Central European Standard Time"; TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById(zoneId); DateTime result = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow,tzi); Console.WriteLine("Time is " + result + " in Denmark"); </code></pre> ...
<p>You can get the time off the server and do this.</p> <pre><code>DateTime myTimeGMT = ServerTime.ToUniversalTime(); </code></pre> <p>This do this:</p> <pre><code>DateTime myTimeLocal = myTimeGMT.ToLocalTime(); </code></pre> <p>The only restriction here is the computer you are on must be set to the time zone you a...
41,290
<p>I am using LINQ to query a generic dictionary and then use the result as the datasource for my ListView (WebForms).</p> <p>Simplified code:</p> <pre><code>Dictionary&lt;Guid, Record&gt; dict = GetAllRecords(); myListView.DataSource = dict.Values.Where(rec =&gt; rec.Name == "foo"); myListView.DataBind(); </code></p...
<p>Try this:</p> <pre><code>var matches = dict.Values.Where(rec =&gt; rec.Name == "foo").ToList(); </code></pre> <p>Be aware that that will essentially be creating a new list from the original Values collection, and so any changes to your dictionary won't automatically be reflected in your bound control.</p>
<p>Just adding knowledge the next sentence doesn´t recover any data from de db. Just only create the query (for that it is iqueryable type). For launching this query you must to add .ToList() or .First() at the end.</p> <pre><code>dict.Values.Where(rec =&gt; rec.Name == "foo") </code></pre>
5,164
<p>How can I make a style have all of the properties of the style defined in <code>.a .b .c</code> except for <code>background-color</code> (or some other property)? This does not seem to work.</p> <pre><code>.a .b .c { background-color: #0000FF; color: #ffffff; border: 1px solid #c0c0c0; margin-top: 4...
<pre><code>.a, .b, .c {color: #ffffff; border: 1px solid #c0c0c0; margin-top: 4px; padding: 3px; text-align: center; font-weight: bold; } .a {background-color: red;} .b {background-color: blue;} .c {background-color: green;} </code></pre>
<p>I think you're thinking about this a little backwards, so let's try to sort out the language your are using. </p> <pre><code>.a .b .c{ background-color: #0000FF; color: #ffffff; } </code></pre> <p>Looking at the above CSS, the ".a .b .c" part is the <strong>selector</strong>, and the part between the braces is t...
13,551
<p>I am learning Python for a class now, and we just covered tuples as one of the data types. I read the Wikipedia page on it, but, I could not figure out where such a data type would be useful in practice. Can I have some examples, perhaps in Python, where an immutable set of numbers would be needed? How is this diffe...
<ul> <li>Tuples are used whenever you want to return multiple results from a function.</li> <li>Since they're immutable, they can be used as keys for a dictionary (lists can't).</li> </ul>
<p>In addition to the places where they're syntactically required like the string % operation and for multiple return values, I use tuples as a form of lightweight classes. For example, suppose you have an object that passes out an opaque cookie to a caller from one method which is then passed into another method. A ...
6,344
<p>I've been using Linq to SQL for some time now and I find it to be really helpful and easy to use. With other ORM tools I've used in the past, the entity object filled from the database normally has a property indicating the length of the underlying data column in the database. This is helpful in databinding situatio...
<p>Using the LINQ ColumnAttribute to Get Field Lengths from your Database :</p> <p><a href="http://www.codeproject.com/KB/cs/LinqColumnAttributeTricks.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/cs/LinqColumnAttributeTricks.aspx</a></p>
<p>If you need to know the exact column length you can resort to the System.Data classes themselves. Something a bit like this:</p> <pre><code>var context = new DataContextFromSomewhere(); var connection = context.Connection; var command = connection.CreateCommand( "SELECT TOP 1 * FROM TableImInterestedIn" ); var read...
4,101
<p>Today I was printing some parts and I got these burn marks at the corners:</p> <p><a href="https://i.stack.imgur.com/D8b3n.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/D8b3n.jpg" alt="1"></a></p> <p>This is the first time I see this on this printer (Anycubic I3 Mega). I was using more or less...
<p>In addition to <a href="https://3dprinting.stackexchange.com/a/7933/5740">this answer</a> which addresses <strong><em>what</em></strong> is actually the cause (<em>but doesn't explain where the burnt corners come from</em>), I've added some information <strong><em>why</em></strong> this is showing burnt corners.</p>...
<p>Could be a dirty nozzle and temperature too high. When the head changes direction on the corner, the nozzle wipes off burnt PLA. This might explain why there are no dark marks on the long runs and only the corners.</p> <p>Heat nozzle up and clean with acetone and then see if the problem persists.</p>
1,175
<p>I'm working on an application developed by another mob and am confounded by the use of a char field instead of bit for all the boolean columns in the database. It uses "Y" for true and "N" for false (these have to be uppercase). The type name itself is then aliased with some obscure name like <em>ybln</em>.</p> <p>...
<p>I've seen this practice in older database schemas quite often. One advantage I've seen is that using CHAR(1) fields provides support for more than Y/N options, like "Yes", "No", "Maybe".</p> <p>Other posters have mentioned that Oracle might have been used. The schema I referred to was in-fact deployed on Oracle a...
<p>They probably were used to using Oracle and didn't properly read up on the available datatypes for SQL Server. I'm in exactly that situation myself (and the Y/N field is driving me nuts).</p>
32,019
<p>I have been playing around with creating scripts to generate some custom G-code for a Malyan M180 and I am having trouble understand what commands to use to switch nozzles. Sometimes I can get the nozzles to switch and it doesn't recenter but sometimes it does. I have been using:</p> <pre><code>G54 M108 T0; switch t...
<p>No, M108 does not do that. You are looking for <strong>T#</strong>, where # is the tool position you want:</p> <pre><code>T1 ; switch to tool position 1 T3 ; switch to tool position 3 </code></pre> <p>This tells the processor to send all heating, cooling and flow commands to this tool until another tool change ...
<p>As @tbm0115 has mentioned - it differs. Your <code>M108 T{index of tool}</code> command is perfectly fine on some FlashForge printers, a company known for its different sorts of proprietary code. It is indeed used for tool changing here.</p> <p>While on the common Marlin firmware (e.g. used on the popular Creality E...
538
<p>I just learned about the C++ construct called "placement new". It allows you to exactly control where a pointer points to in memory. It looks like this:</p> <pre><code> #include &lt;new&gt; // Must #include this to use "placement new" #include "Fred.h" // Declaration of class Fred void someCode() {...
<p>It is also used for embedded programming, where IO devices are often mapped to specific memory addresses</p>
<p>seems to me like a way of allocating an object on the stack .. </p>
47,375
<p>I would like to make my Java/Swing application compatible with the Services-menu available on Mac OS X. For example, so that the user could select some text in JTextArea and have it converted into speech by <strong>Services -> Speech -> Start Speaking Text</strong>. Is there a simple way to achieve that? (The applic...
<p>Have a look at apple's <a href="https://developer.apple.com/samplecode/OSXAdapter/index.html" rel="nofollow noreferrer">OSXAdapter package</a> (link requires free apple developer login) for java development. The samples included in the package shows you how to integrate nicely to the OS X application menu in a way t...
<p>If all you want is the end result of the text being converted to speech, you could try invoking the "<strong>say</strong>" command using ProcessBuilder, something like this:</p> <pre><code>String stuffYouWantToSay = "StackOverflow Rocks!"; Process p = null; try { ProcessBuilder pb = new ProcessBuilder("/usr/bin...
33,451
<p>I cannot use the Resource File API from within a file system plugin due to a PlatSec issue:</p> <pre><code>*PlatSec* ERROR - Capability check failed - Can't load filesystemplugin.PXT because it links to bafl.dll which has the following capabilities missing: TCB </code></pre> <p>My understanding of the issue is th...
<p>The Symbian file server has the following capabilities:</p> <pre><code>TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD </code></pre> <p>So any DLL being loaded into the file server process must have at least these capabilities. There is no way around this, short of writing a new proxy process as you allude to.</p...
<p>Tell us what kind of data you are storing in the resource file.</p> <p>Things that usually go into resource files have no place in a file server plugin, even that means hardcoding a few values.</p> <p>Technically, you can send data to a file server plugin using RFile.Write() but that's not a great solution (interc...
11,911
<p>I have the following class:</p> <pre><code>public abstract class AbstractParent { static String method() { return "OriginalOutput"; } } </code></pre> <p>I want to mock this method. I decide to use <a href="http://jmockit.dev.java.net" rel="noreferrer">JMockit</a>. So I create a mock class:</p> <pr...
<p>Found the solution: you simply need to make the mock's method public (the original method can stay in its original visibility).</p> <p>I don't know why this works while the original way doesn't (someone who does is more than welcome to chime in), but all you need to do is simply change the mock class in the example...
<p>Apparently the new way to do this is to use <code>MockUp&lt;T&gt;</code></p> <pre><code>new MockUp&lt;AbstractParent&gt;(){ @Mock String method() { return "MOCK"; } }; assertEquals("MOCK" AbstractParent.method()); </code></pre> <p>Another alternative is apparently to continue with something like <...
27,774
<p>I have a list of States in an ItemsControl, the DataTemplate is a CheckBox. I would like to add a function to select(check) all states. However I need to loop through the CheckBoxs rather then the data items since the checked state is stored in a separate data structure then the list of states the ItemsControl's It...
<p>Have a property in your DataObject called IsChecked and bind that to the Checkbox in DataTemplate(Default is TwoWay)</p>
<p>Have a property in your DataObject called IsChecked and bind that to the Checkbox in DataTemplate(Default is TwoWay)</p>
22,960
<p>How do I remove the last character of a string if it is a newline?</p> <pre><code>&quot;abc\n&quot; --&gt; &quot;abc&quot; </code></pre>
<p>Try the method <code>rstrip()</code> (see doc <a href="http://docs.python.org/2/library/stdtypes.html#str.rstrip" rel="noreferrer">Python 2</a> and <a href="https://docs.python.org/3/library/stdtypes.html#str.rstrip" rel="noreferrer">Python 3</a>)</p> <pre><code>&gt;&gt;&gt; 'test string\n'.rstrip() 'test string' </...
<p>A catch all:</p> <pre><code>line = line.rstrip('\r|\n') </code></pre>
34,655
<p>How do I force Python's <code>print</code> function to flush the buffered output to the screen?</p>
<p>In Python 3, <a href="https://docs.python.org/library/functions.html#print" rel="noreferrer"><code>print</code></a> can take an optional <code>flush</code> argument:</p> <pre><code>print(&quot;Hello, World!&quot;, flush=True) </code></pre> <p>In Python 2, after calling <code>print</code>, do:</p> <pre><code>import s...
<p>I did it like this in Python 3.4:</p> <pre><code>'''To write to screen in real-time''' message = lambda x: print(x, flush=True, end="") message('I am flushing out now...') </code></pre>
28,564
<p>Using <code>add(new Include())</code> syntax, I was able to include jsps which are at the top level. </p> <p>However those which are present inside 'WEB-INF' cannot be referenced, is there any way to achieve this?</p>
<p>I think the Include class makes an external request instead of including/forwarding current one, which makes your case impossible. WEB-INF is not available to external requests, only include/forward if I remember correctly.</p>
<p>Why are you trying to include both inside one application? If I were you, and if you are in fact trying to migrate from JSP to Wicket, I would create a new Wicket application which you could mount under a separate context path on your server, and let Wicket sit by itself. You can then also include resources such as ...
22,992
<p>I'm trying to grab a div's ID in the code behind (C#) and set some css on it. Can I grab it from the DOM or do I have to use some kind of control?</p> <pre><code>&lt;div id="formSpinner"&gt; &lt;img src="images/spinner.gif" /&gt; &lt;p&gt;Saving...&lt;/p&gt; &lt;/div&gt; </code></pre>
<p>Add the <code>runat="server"</code> attribute to it so you have:</p> <pre><code>&lt;div id="formSpinner" runat="server"&gt; &lt;img src="images/spinner.gif"&gt; &lt;p&gt;Saving...&lt;/p&gt; &lt;/div&gt; </code></pre> <p>That way you can access the class attribute by using:</p> <pre><code>formSpinner.Attri...
<p>If all you want to do is conditionally show or hide a &lt;div>, then you could declare it as an &lt;asp:panel > (renders to html as a div tag) and set it's .Visible property.</p>
21,143
<p>I am working on an ASP.NET web application, it seems to be working properly when I try to debug it in Visual Studio. However when I emulate heavy load, IIS crashes without any trace -- log entry in the system journal is very generic, "The World Wide Web Publishing service terminated unexpectedly. It has done this 4 ...
<p>Crash dump of <a href="http://blogs.msdn.com/tess/archive/tags/ASP.NET/default.aspx" rel="nofollow noreferrer">asp.net process</a> should give you <a href="http://blogs.msdn.com/tess/pages/net-debugging-demos-information-and-setup-instructions.aspx" rel="nofollow noreferrer">tons of info</a>..If you want to quickly ...
<p>The key is <em>"without any trace"</em>. You need to put your own trace logging in to create some chatter. Then you'll be able to spot where the chatter stops.</p>
8,823
<p>Is there a PHP class/library that would allow me to query an XHTML document with CSS selectors? I need to scrape some pages for data that is very easily accessible if I could somehow use CSS selectors (jQuery has spoiled me!). Any ideas?</p>
<p>After Googling further (initial results weren't very helpful), it seems there is actually a Zend Framework library for this, along with some others:</p> <ul> <li><a href="https://github.com/PHPPowertools/DOM-Query" rel="noreferrer">DOM-Query</a></li> <li><a href="http://code.google.com/p/phpquery/" rel="noreferrer"...
<p>I wrote mine, based on Mootools CSS selector engine <a href="http://selectors.svn.exyks.org/" rel="nofollow noreferrer">http://selectors.svn.exyks.org/</a>. it rely on simplexml extension ability (so, it's read-only)</p>
32,583
<p>I have a <a href="http://www.visualsvn.com/server/" rel="nofollow noreferrer">VisualSVN Server</a> installed on a Windows server, serving several repositories.</p> <p>Since the web-viewer built into VisualSVN server is a minimalistic subversion browser, I'd like to install <a href="http://websvn.tigris.org/" rel="n...
<p>I got WebSVN authentication working with VisualSVN server, albeit with a lot of hacking/trial-error customization of my own.</p> <p>Here's how I did it:</p> <ol> <li><p>If you haven't already, install PHP manually by downloading the zip file and going through the online php manual install instructions. I installed...
<p>I am the author of the article you mentioned. The information I published was only meant for WebSVN running on IIS. It is my understanding that the software should "just work" when you use PHP on Apache, although I have never set it up in that environment. Have you tried doing some "echo"-debugging (for the lack of ...
3,826
<p>When I disable input elements the text is taking the font color: <code>#000000</code> in Firefox. This is not happening in IE. Please check the below page in IE and Firefox. Let me know how to give it a gray look as in IE.<br /> <a href="http://shivanand.in/tmp/test.html" rel="nofollow noreferrer">test</a></p>
<p>Different browsers style disabled elements differently. Here is how you can control the style of disabled elements in Firefox.</p> <pre><code>[disabled] { color:#ff0000; background-color:#00ff00; } </code></pre>
<p>Reenable it, change the color, disable it again. It will only take .001 seconds.</p>
48,910
<p>I'm new to .Net and do not understand the difference. Can someone point me in the right direction?</p>
<p>ASP.NET Web services was developed for building applications that send and receive messages by using the Simple Object Access Protocol (SOAP) over HTTP.</p> <p>WCF is for enabling .NET Framework applications to exchange messages with other software entities. SOAP is used by default, but the messages can be in any f...
<p>They are two different things all together. WCF is a more generic framework through which you can write one service type component and deploy it in many ways (even as an Asp.Net Web Service).</p> <p>Here's a brief thread about this <a href="http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/2d6a7ff2-f15c-4599...
26,671
<p>I'm having a problem with IE7 when clicking on images that open up using the Lightbox 2 javascript image viewer. Instead of overlaying the image on the current page it opens the image into a separate page.</p> <p>Not sure if this is an AJAX problem possibly ? Works fine in Firefox.</p> <p>Anybody else come across ...
<p>Your page is performing the fall-back behaviour you would expect in the following scenarios...</p> <ol> <li>JavaScript is disabled</li> <li>There is an error in the JavaScript that is creating the lightbox effect (look out for a very brief flash of the yellow error icon before the next page loads - or fire up some ...
<p>The only thing I can think of is that I have google toolbar amd McAfee security installed that may be blocking the overlay (????) but don't think that should make any difference.</p>
26,085
<p>I'm looking for a PHP (with MYSQL) nested sets class with all needed functions. For example:</p> <p>createLeftNode, createRightNode,createRootNode, createSubNode,deleteNode and <strong>moveTree</strong>. Not only 1 left, 1 right, 1 up and 1 down but also a part of a tree in a nother tree.</p> <p>Thanks!</p>
<p>Well nested sets are great if you are working with hierarchical data. It's much more complex to implement it only with php arrays especially if you want to save these information in a database.</p> <p>you could try this on. Never used it but after a short code screening it looks almost complete.</p> <p><a href="ht...
<p>It was long overdue, but I updated <a href="https://github.com/fpietka/Zend-Nested-Set" rel="nofollow">https://github.com/fpietka/Zend-Nested-Set</a> (even with unit tests).</p>
34,233
<p>Normally to attach a debuger to a running jvm you would need start the jvm with arguments such as the following:</p> <pre><code>&gt; java -Xdebug -Xrunjdwp:transport=dt_socket,address=1000,server=y,suspend=n </code></pre> <p>Now if I want to debug a process that wasn't started in debug mode, what can I do?</p> <p...
<p>You may be able to use <a href="http://docs.oracle.com/javase/7/docs/technotes/tools/share/jsadebugd.html" rel="noreferrer">jsadebugd</a> (<a href="http://docs.oracle.com/javase/7/docs/technotes/tools/" rel="noreferrer">JDK</a>) to attach a debug server to the process (available on Windows with the <a href="http://m...
<p>You can always use jdb and debug by hand :P </p>
49,242
<p>SVN and CVS are two very different systems that aim to address the same basic issue - source control.</p> <p>They both work in distinct ways, so it's probably difficult to deal with them exactly the same.</p> <p>What I'm wondering is, would it be conceivable to develop a programming library or API that exposes the...
<p>Personally I would ignore CVS for a new product. My feeling would be that the enormous extra effort to coerce it into looking like SVN would be better spent on other other stuff. I don't know your market, so I might be wrong, but that's got to be worth thinking about.</p>
<p>The MSSCCI API does something very similar: </p> <p><a href="http://alinconstantin.homeip.net/webdocs/scc/msscci.htm" rel="nofollow noreferrer">http://alinconstantin.homeip.net/webdocs/scc/msscci.htm</a></p> <p>The MSSCCI tries to make all source controls look the same from the perspective of the IDE.</p>
40,355
<p>I got a little stuck and I'm hoping someone can point me in the right direction. I have an NSMutableArray that stores a sequence. I created an enumerator so that a while loop can get the content of the array one by one.</p> <p>Everything works fine however I want the methods to be called with a 10 second gap in bet...
<p>You almost certainly don't want to stick a "delay" in your loop, which will block the thread until it's over (and, unless your app is multi-threaded, block the entire thing). You could use multiple threads, but instead I'd probably split the loop out over repeated timed calls of another selector. Store the enumerato...
<p>So here was the solution that I came up with based on everyones input.</p> <pre><code>NSEnumerator * enumerator = [gameSequenceArray objectEnumerator]; NSTimeInterval time = 5; for (NSString *element in enumerator) { id elementId = element; time++; [self.view performSelector:@selector(showButton:) w...
47,746
<p>Is anybody using JSON.NET with nHibernate? I notice that I am getting errors when I try to load a class with child collections.</p>
<p>I was facing the same problem so I tried to use @Liedman's code but the <code>GetSerializableMembers()</code> was never get called for the proxied reference. I found another method to override:</p> <pre><code> public class NHibernateContractResolver : DefaultContractResolver { protected override JsonContra...
<p>The problem can happen when NHibernate wraps the nested collection properties in a PersistentGenericBag&lt;&gt; type.</p> <p>The GetSerializableMembers and CreateContract overrides cannot detect that these nested collection properties are &quot;proxied&quot;. One way to resolve this is to override the CreateProperty...
36,455
<h2>What should happen when I call <code>$user-&gt;get_email_address()</code>?</h2> <h3>Option 1: Pull the email address from the database on demand</h3> <pre><code>public function get_email_address() { if (!$this-&gt;email_address) { $this-&gt;read_from_database('email_address'); } return $this-&...
<p>There really isn't a correct answer for this. Depends on how many users you're loading at once, how many text/blob fields are in your User table, whether your user table loads any associated child objects. As aaronjensen says, this pattern is called <strong>lazy loading</strong> - and the opposite behaviour (loading...
<p>I would agree with aaronjensen, except when the amount of data you are pulling is to so great that you'll start to use up an excessive amount of memory. I'm thinking where a row has 3 text fields that are all quite large and all you want is the ID field.</p>
20,496
<p>I'm using a small site to experiment with the uploading of pictures and displaying them.</p> <p>When someone clicks "add a picture", they get taken to a page with a form on it. They can select a file and click the submit button.</p> <p>But what I want to do now is this: put a second submit button labeled "Cancel" ...
<p>You can't look at the button with php - the whole request will have been sent before PHP gets that information.</p> <p>What you could do is put the cancel button in a different <code>&lt;form&gt;</code>, like this:</p> <pre><code>&lt;form&gt; &lt;input type="file&gt; &lt;input type="submit" value="upload"&gt; &lt;...
<p>There's no way for PHP to stop a file upload in progress. Your PHP code isn't even started until the file upload is done, so by the time it's running, it's too late.</p>
28,562
<p>Might be subjective and/or discussion.. but here goes.</p> <p>I've been asked to estimate a feature for the next big thing at work. I break it down.. use story points come up with a estimate. The feature however calls for interfacing with GoDiagrams a third party diagramming component in addition to various other c...
<p>I guess you are constantly <strong>underestimating</strong> </p> <ul> <li>what you do already know about the 3rd party component </li> <li>how long it takes you to create usable/helpful spikes for unknown areas</li> </ul> <p><strong>1. Get better at estimating those two things.</strong></p> <p>So, it's all about ...
<p>@pointernil.. It's more of no estimation coupled with a Indy-Jones Head-First approach to tackling a story. I estimate stories by their content.. currently I don't take into account the time required to find the right incantation for the control library to play nice. That sometimes takes more time than my applicatio...
13,689
<p>How do I start a process, such as launching a URL when the user clicks a button?</p>
<p>As suggested by Matt Hamilton, the quick approach where you have limited control over the process, is to use the static Start method on the System.Diagnostics.Process class...</p> <pre><code>using System.Diagnostics; ... Process.Start("process.exe"); </code></pre> <p>The alternative is to use an instance of the Pr...
<p>You can use this syntax:</p> <pre><code>private void button1_Click(object sender, EventArgs e) { System.Diagnostics.Process.Start(/*your file name goes here*/); } </code></pre> <p>Or even this:</p> <pre><code>using System; using System.Diagnostics; //rest of the code private void button1_Click(object sender, Ev...
21,940
<p>I have an install that upgrades a previous version of an app if it exits. I'd like to skip certain actions when the install is upgrade mode. How can I determine if the install is running in upgrade mode vs. first time install mode?</p> <p>I'm using Wise Installer, but I don't think that matters. I'm assuming that W...
<p>Can you elaborate what kind of tools are you using to create this installer?</p> <p>I use Windows Installer XML(<a href="http://wix.sourceforge.net/" rel="nofollow noreferrer">WIX</a>). In WIX you could do something like this:</p> <pre><code> &lt;!-- Property definitions --&gt; &lt;?define SkuName = "MyCoolApp"...
<p>I am not sure I understood your question.<br> If you are writting the install script yourself, the best way, on Windows, is to check the registry keys such program usually creates. Unlike install directory (and start menu entries, etc.), it is an invariant. One of these keys can even be the version number of the sof...
17,588
<p>Does anyone know of an application or system out there for tracking changes (files added/removed, diffs on text files) to a <em>non-source controlled</em> directory over time? Something that would let you</p> <ol> <li><p>Take a snapshot of a certain directory tree at time A</p></li> <li><p>Come back at time period...
<p>Write a scripted scheduled task which copies the directory tree to another place, perhaps on a different machine, which is part of a version controlled repostiory. Then, the scheduled task would automatically commit changes, using the version control system of your choice (Mercurial should work nicely for this syste...
<p>I'd like something that looks, tastes and smells just like milk. But it shouldn't be milk. </p> <p>In other words: you're describing a vcs. If you tell us why a vcs can't be used, it might be easier to answer.</p> <p>Only thing I can think of is Apple's Time Machine, which (again) is basically vcs for the masses.<...
19,696
<p>I'm having trouble getting a rails app on Dreamhost's Passenger to see compiled libraries in my ~/opt/lib directory. I have to put them here because I don't have root access. </p> <p>I can boot up my app in ./script/console and it sees them libraries just fine because I updated my .bash_profile's <code>LD_LIBRARY...
<p>I had similar issue with Passenger that I described in <a href="http://blog.rayapps.com/2008/05/21/using-mod_rails-with-rails-applications-on-oracle/" rel="nofollow noreferrer">http://blog.rayapps.com/2008/05/21/using-mod_rails-with-rails-applications-on-oracle/</a></p> <p>But in your case this migth not work as yo...
<p>This is an old thread, but for completeness this is how to achieve your goal:</p> <ol> <li>Do not set the LD_LIBRARY_PATH if possible - it's horrendous.</li> <li>As you do not have control over the environment that the Apache user's environment, attempting to set a LD_LIBRARY_PATH env var per the methods above will...
31,196
<p>This is probably a simple question but I am not an ASP.NET developer and I am quite stuck.</p> <p>I have a simple search routine that returns between zero and several hundred results. Each of these must be added to the page as a button and I want to set the text of the button and the CommandArgument property so tha...
<p>You mentioned in another answer that you are adding these when a button is clicked. Looking at your code, I would suggest that you try setting a unique ID for each button added, then ensure that on loading the page that buttons with the same IDs and CommandArgument values are reloaded. When a dynamically loaded butt...
<p>I think you need to use the OnCommand event handler, rather than the OnClick i.e. try changing this:</p> <pre><code>result.Click += new EventHandler(SearchResultClicked); </code></pre> <p>to this:</p> <pre><code>result.Command += new EventHandler(SearchResultClicked); </code></pre> <h2>UPDATE</h2> <p>Try changi...
46,360
<p>I have some code that effectively does this :</p> <pre><code>File file = new File("C:\\Program Files (x86)\\Something\\fred.txt"); System.out.println("file.canWrite() = " + file.canWrite()); </code></pre> <p>It prints true. Now the odd thing is, I can create the file without any exceptions. Furthermore, another pr...
<p>You are most likely a "victim" of folder redirection. When UAC is enabled, any writes to Program Files is redirected to somewhere else when you're not running the program as an administrator.</p> <p>You should find your file in C:\Users\&lt;username&gt;\AppData\Local\VirtualStore\&lt;insert&gt;\&lt;expected&gt;\&lt...
<p>I believe that update 10 might have changed this behavour. I know the reimplemented a lot of the browser stuff to work better with vista. I'm not 100% certain though but I suggest you take a look.</p>
35,488
<p>I specifically want to test </p> <ul> <li>calibration</li> <li>tolerances</li> <li>precision</li> <li>accuracy</li> </ul> <p>I'm having trouble with Print in Place models and I'm trying to find out if there's something I can do to improve my print quality. </p> <p>The printer I am using is a Kossel clone, specifi...
<p>This is a fairly open ended subject, but the different calibration/test models can be broken down into a few different groups. Although there are a few common 'standards', as soon as you get to looking at a specific parameter, you will need to look for something that is a good match for your problem (not everything ...
<p>The best place to start looking is to go to <a href="http://www.thingiverse.com" rel="nofollow noreferrer">Thingiverse</a> and search on '<a href="https://www.thingiverse.com/search?q=benchmark" rel="nofollow noreferrer">benchmark</a>'. There are a great many models there intended to test various aspects of printing...
975
<p>Can anyone help me to put a vertical scroll bar for an <code>&lt;asp:CheckBoxList&gt;</code>?</p>
<p>I've actually just figured out the answer. Thank you both for your answers, but it turns out that all i had to do was this:</p> <pre><code>p.StandardInput.Close() </code></pre> <p>which causes the program I've spawned to finish reading from stdin and output what i need.</p>
<p>Try actually sending the Key Combination Ctrl+C, instead of directly terminating the process:</p> <pre><code> [DllImport("user32.dll")] public static extern int SendMessage( int hWnd, // handle to destination window uint Msg, // message long wParam, // f...
35,876
<p>So I got this question from one of the developers in my team: What is domain driven design? I could of course point to the book from Evans but is that actually an answer? </p> <p>How would you explain DDD in a few sentences to junior software engineers in your team?</p>
<p>I would say this practice promotes concentrating your efforts on the 'problem space' rather than the 'solution space'. Driving an emergent solution (the design) by studying and really getting to know and understand the domain. One of the practices (taken from XP) would be the writing of stories that occur in the pro...
<p>An important part of DDD is the so called ubiquitous language; i.e. speak the same language as the business experts. And make your code / architecture so that it reflects this language to avoid impedance problems.</p>
12,631
<p>This may not be the correct way to use controllers, but I did notice this problem and hadn't figured out a way to correct it. </p> <pre><code>public JsonResult SomeControllerAction() { //The current method has the HttpContext just fine bool currentIsNotNull = (this.HttpContext == null); //which is false ...
<p>For now I'm going to do the following. This seems to be an acceptable fix...</p> <pre><code>public new HttpContextBase HttpContext { get { HttpContextWrapper context = new HttpContextWrapper(System.Web.HttpContext.Current); return (HttpContextBase)context; } } </...
<p>Is it that you want to use some functionality from the controller? Or have the controller perform an action?</p> <p>If it's the former, maybe that's some code that should be split out into another class. If it's the latter, you can do this to simply have that controller do a specific action:</p> <pre> <code> retur...
27,568
<p>If I create an index on columns (A, B, C), in that order, my understanding is that the database will be able to use it even if I search only on (A), or (A and B), or (A and B and C), but not if I search only on (B), or (C), or (B and C). Is this correct?</p>
<p>There are actually three index-based access methods that Oracle can use when a predicate is placed on a non-leading column of an index.</p> <p>i) Index skip-scan: <a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14211/optimops.htm#PFGRF10105" rel="noreferrer">http://download.oracle.com/docs/cd/B193...
<p>That is not correct. Always best to come up with a test case that represents your data and see for yourself. If you want to really understand the Oracle SQL Optimizer google Jonathan Lewis, read his books, read his blog, check out his website, the guy is amazing, and he always generates test cases.</p> <pre><code>c...
8,231