instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Does anyone know, or have a link to an article or a step by step tutorial, that would tell me how to distribute a .net MONO application with a minimum install? The full package of Mono is like 75 MB but I know al lot of that is the compiler and libraries that I don't need.</p> <p>I just want the minimum runtime file...
<p>You need to use &quot;mkbundle&quot; to create a self-contained executable file that can be used in a Windows environment. The end-result is an executable that contains all of the Mono libraries you need, and none of the ones you don't.</p> <p>Look for the &quot;bundles&quot; heading on <a href="http://www.mono-proj...
<p>You need to use &quot;mkbundle&quot; to create a self-contained executable file that can be used in a Windows environment. The end-result is an executable that contains all of the Mono libraries you need, and none of the ones you don't.</p> <p>Look for the &quot;bundles&quot; heading on <a href="http://www.mono-proj...
41,112
<p>I am designing a part that has to clamp around a 11mm bushing, and due to other design constraints, it has to be printed with a semicircle-shaped overhang:</p> <p><a href="https://i.stack.imgur.com/LcLSm.png" rel="noreferrer"><img src="https://i.stack.imgur.com/LcLSm.png" alt="enter image description here"></a></p>...
<p>You could modify it as shown in my picture. I added lines tangent to the 11mm circle and in this example I set them to a 40 degree overhang which should be fine, the top line is also tangent to the circle and in my experience it's easier to bridge a small section rather than do a bunch of small overhangs like an ar...
<blockquote> <p>if I printed it in a different orientation it would delaminate too easily</p> </blockquote> <p>If you flip it around, the orientation of the layers would be the same, except that you would print from top to bottom instead of bottom to top.</p> <p>With the arch opening to the top, there would be <str...
139
<p>How do I do the above? I've started using MVC and I'm having issues passing data around.</p> <p>My specific problem is to do with a list of objects I have in my Model which I need to access in a View and iterate through.</p> <p>Thanks in advance.</p>
<p>Let's say your controller action looks something like</p> <pre><code>public ActionResult List() { List&lt;string&gt; myList = database.GetListOfStrings(); (...) } </code></pre> <p>Now you want to pass your list to the view, say "List.aspx". You do this by having the action return a ViewResult (ViewResult i...
<p>If I'm not mistaken, the repeater control requires the page model. (Page model being what classic ASP.NET uses)</p> <p>But you should take a look at this link: <a href="http://haacked.com/archive/2008/05/03/code-based-repeater-for-asp.net-mvc.aspx" rel="nofollow noreferrer">http://haacked.com/archive/2008/05/03/cod...
40,651
<p>For example, I want to populate a gridview control in an ASP.NET web page with only the data necessary for the # of rows displayed. How can NHibernate support this?</p>
<p><code>ICriteria</code> has a <code>SetFirstResult(int i)</code> method, which indicates the index of the first item that you wish to get (basically the first data row in your page). </p> <p>It also has a <code>SetMaxResults(int i)</code> method, which indicates the number of rows you wish to get (i.e., your page si...
<p>You don't need to define 2 criterias, you can define one and clone it. To clone nHibernate criteria you can use a simple code:</p> <pre><code>var criteria = ... (your criteria initializations)...; var countCrit = (ICriteria)criteria.Clone(); </code></pre>
7,835
<p>I've been researching modules for Nginx (my preferred webserver) to serve a Lisp webapp, but I haven't been able to find anything.</p> <p>Is there modules for Nginx, or is there better ways to serve Lisp webapps? If so, what are they?</p>
<p>If Nginx support proxying, you could always proxy to a Hunchentoot server running on localhost.</p>
<p>There's always <a href="http://www.cliki.net/mod_lisp" rel="nofollow" title="mod_lisp">mod_lisp</a> if you're interested in using Apache. (It's like Phusion Passenger for ruby webapps.) Nginx is nice but you have to compile it every time you want to extend it, which isn't too intuitive. Keeps it fast though. :)</p>
33,772
<p>I have the following enum:</p> <pre><code>public enum Status implements StringEnum{ ONLINE("on"),OFFLINE("off"); private String status = null; private Status(String status) { this.status = status; } public String toString() { return this.status; } public static Stat...
<p>It's not possible to specify either constructors or static methods in an interface. For a good, concise explanation, check out this article: <a href="http://zoom.z3950.org/bind/java/comment/static.html" rel="nofollow noreferrer">No static methods in interfaces</a></p>
<ol> <li>static methods cannot be defined in interfaces </li> <li>constructors cannot be defined in interfaces</li> <li><code>toString</code> is defined in <code>java.lang.Object</code>, requiring it in an interface will never result in a compile error if the method isn't defined.</li> </ol> <p>Why do you want to enfo...
13,758
<p>I want to take the value stored in a 32 bit unsigned int, put it into four chars and then store the integer value of each of these chars in a string.</p> <p>I think the first part goes like this:</p> <pre><code>char a = orig &lt;&lt; 8; char b = orig &lt;&lt; 8; char c = orig &lt;&lt; 8; char d = orig &lt;&lt; 8; ...
<p>If you really want to extract the individual bytes first:</p> <pre><code>unsigned char a = orig &amp; 0xff; unsigned char b = (orig &gt;&gt; 8) &amp; 0xff; unsigned char c = (orig &gt;&gt; 16) &amp; 0xff; unsigned char d = (orig &gt;&gt; 24) &amp; 0xff; </code></pre> <p>Or:</p> <pre><code>unsigned char *chars = (...
<p>For hexadecimal:</p> <pre><code>sprintf(buffer, "%lX", orig); </code></pre> <p>For decimal:</p> <pre><code>sprintf(buffer, "%ld", orig); </code></pre> <p>Use <code>snprintf</code> to avoid a buffer overflow.</p>
21,669
<p>I have colleagues working on a .NET 1.1 project, where they obtain XML files from an external party and programmatically instruct iTextSharp to generate PDF content based on the XML data.</p> <p>The tricky part is, within this XML are segments of arbitrary HTML content. These are HTML code users copied and pasted f...
<p>I have found .NET 2.0-based components like <a href="http://www.html-to-pdf.net/" rel="nofollow noreferrer">ExpertPDF</a> and <a href="http://www.websupergoo.com/products.htm#pd" rel="nofollow noreferrer">ABCpdf</a> do a fairly good job interpreting the CSS styles and aligning the tables properly in PDF. Right now I...
<p>I don't have any solid answers, but I'll give you two directions to explore, both of which I have used before.</p> <p>1 - use something like <a href="http://www.codeplex.com/htmlagilitypack" rel="nofollow noreferrer">HtmlAgilityPack</a> to cleanse your HTML - you can traverse the DOM and remove styles and classes, ...
49,078
<p>I have this Java code (JPA):</p> <pre><code>String queryString = "SELECT b , sum(v.votedPoints) as votedPoint " + " FROM Bookmarks b " + " LEFT OUTER JOIN Votes v " + " on (v.organizationId = b.organizationId) " + ...
<p>You definitely have an issue with the version of hibernate and ANTLR jars that you are using. The recover method wasn't present in the ANTLR Parser class until version 2.7.6? If you are using an earlier version of ANTLR, such as 2.7.2, then you will see this problem.</p> <p>Using maven can cause this sort of situat...
<p>I have the consistent set of jars because simple queries like this one </p> <pre>"SELECT b FROM table_name b WHERE b.userId = 102 " </pre> <p>are working. I have verified all double quotes and everything is alright.</p> <p>My database is: mysql, and I use jpa to connect to it. I don't know what is causing the ...
39,750
<p>I have an game application I have written for Windows Mobile and I want to have a timer associated with the puzzle. If the program loses focus for any reason (call comes in, user switches programs, user hits the Windows button) then I want a pop up dialog box to cover the puzzle and the timer to stop. When the user ...
<p>Take a look at the <a href="http://community.opennetcf.com/articles/cf/archive/2008/08/13/determining-form-and-process-changes-in-windows-ce.aspx" rel="nofollow noreferrer">article over at OpenNETCF's Community site on determining when a Form or Process changes</a>.</p>
<p>A quick way would be to <strong>use PInvoke to call GetForegroundWindow() and GetWindowText(</strong>) whenever your timer ticks (once a second?). </p> <p>GetForegroundWindow() returns a windows handle which you can use to call GetWindowText(). If the text of the foreground window matches your form's Text propert...
16,262
<p>I am working on a Rails application that needs to handle dates and times in users' time zones. We have recently migrated it to Rails 2.1 and added time zone support, but there are numerous situations in which we use Time#utc and then compare against that time. Wouldn't that be the same as comparing against the origi...
<p>If you've set:</p> <pre><code>config.time_zone = 'UTC' </code></pre> <p>In your environment.rb (it's there by default), then times will automagically get converted into UTC when ActiveRecord stores them.</p> <p>Then if you set Time.zone (in a before_filter on application.rb is the usual place) to the user's Time ...
<p>If your application has users in multiple time zones, you should always store your times in UTC (any timezone would work, but you should stick with the most common convention).</p> <p>Let the user input in local time, but convert to UTC to store (and compare, and manipulate). Then, convert back from UTC to display...
12,481
<p>In Visual Studio as most of you will have noticed that related file can be collapsed in to one. E.G.</p> <ul> <li>Form1.cs <ul> <li>Form1.Designer.cs</li> </ul></li> </ul> <p>I'm creating a DAL library and will be splitting partial classes in to several files such as:</p> <ul> <li>SomeTableClass.cs <ul> <li>So...
<p>In my (VisualStudio 2005) system, they are stored in the registry under</p> <p><code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\8.0\Projects\{E24C65DC-7377-472B-9ABA-BC803B73C61A}\RelatedFiles</code></p> <p>For VisualStudio 2008, change the <code>\8.0\</code> to <code>\9.0\</code></p> <p>Note, however, th...
<p>In VS 2008, there is also a project file-level way to do this via the <code>DependentUpon</code> tag. You would edit your project file to look like this:</p> <pre><code>&lt;Compile Include="SomeTableClass.cs" /&gt; &lt;Compile Include="SomeTableClass.Generated.cs"&gt; &lt;DependentUpon&gt;SomeTableClass.cs&lt;...
43,781
<p>I have an abstract generic class <code>BLL&lt;T&gt; where T : BusinessObject</code>. I need to open an assembly that contains a set of concrete BLL classes, and return the tuples (businessObjectType, concreteBLLType) inside a Dictionary. There is the part of the method I could do until now, but I'm having problems t...
<p>So the concrete classes will be closed rather than generic? Here's a short program which demonstrates what I <em>think</em> you're after...</p> <pre><code>using System; using System.Reflection; public abstract class Base&lt;T&gt; { } public class Concrete : Base&lt;string&gt; { } class Test { static void Mai...
<p>Jon, that is exactly what I was looking for. I use the basics of reflection and generics, so when it is needed a more profound knowledge of the API to confront both, I miss things like this one, thanks for answering.</p> <p>Your assumptions are right, the concrete classes are closed, and T is defined on the base cl...
28,867
<p>My VS 2005 goes unresponsive all the time. I have tried all of the optimization tricks that have been listed on StackOverflow. I am running with Resharper 4.1. (not sure if that could cause this). What other ways could I try to isolate the root issue here? </p> <p>Is it possible upgrading to VS 2008 might help me?<...
<p>1) If you're remoting to it, then turn off animations. I turn it off all the time, that 0.5 second window slide in is slowing me down! But it is really bad on a remote desktop or VM.</p> <p>In VS2008 this is at: Tools - Options - Environment - Animate Environment Tools</p> <p>2) Outlook seems to not play nicely w...
<p>I have had the very same issue as well for many months now. When I open a different tab, start debugging, close a tab, or even sometimes just edit the code, my installation of VS2005 will hang for 5-10 seconds, sometimes longer. I've tried running it without Outlook running, disabling Edit and Continue, enabling the...
37,535
<p>I'm writing a class that renders some content in WPF, and I want to give the user control over how the content is rendered. The rendering is mostly stroking lines, so I decided to look to the System.Windows.Forms.Shapes.Line class to get an idea of what properties I might want to implement. This led me to implemen...
<p>It is very safe and useful to borrow DPs... Read the <a href="http://www.drwpf.com/blog/Home/tabid/36/EntryID/20/Default.aspx" rel="nofollow noreferrer">following</a> post by Dr WPF about the subject!</p> <p>Here is a few of the "tips" he provide:</p> <ul> <li>You should always know what the owner class does with ...
<p>I'd just keep creating my own dependency properties, personally. It really isn't much extra work, and then you don't have to worry about any of the possible caveats.</p>
28,089
<p>Given a (source) patch file, what's the easiest way to apply this patch on the source files under Windows?</p> <p>A GUI tool where I can visually compare the unchanged-changed source lines would be great.</p>
<p><a href="http://gnuwin32.sourceforge.net/packages/patch.htm" rel="noreferrer">Patch for Windows</a> is what you're looking for.</p>
<p>WinMerge is awesome.</p> <p><a href="http://winmerge.org/" rel="nofollow noreferrer">http://winmerge.org/</a></p>
4,004
<p>I am executing a <code>diff</code> command in <code>perl</code>.</p> <pre><code>my @lines = `/usr/local/bin/diff -udr \"$expected_file\" \"$gen_file\"`; if ($? != 0) { print ERRFILE "Diff between $expected_file and $gen_file failed\n"; return $diff_err; } </code></pre> <p>Here the <code>diff</code> might ...
<p>This is answered in <a href="http://learn.perl.org/faq/perlfaq8.html#How-can-I-capture-STDERR-from-an-external-command" rel="nofollow noreferrer">perlfaq8: How can I capture STDERR from an external command?</a></p> <p>If I want to read STDOUT and STDERR of a process, I use IPC::Open3, which comes with Perl. That wa...
<p>There are several CPAN modules that make this easy and let you keep STDOUT and STDERR separate. For example, <a href="http://search.cpan.org/perldoc?IO::CaptureOutput" rel="nofollow noreferrer">IO::CaptureOutput</a> would let you do it like this (though you'll need to split the lines yourself):</p> <pre><code>use I...
38,630
<p>This seems like something simple, but I can't seem to figure it out! I'm trying to get 2-way data-binding to work on an ASP.net page with a check box as one of the columns. How do I get the updated values (from check boxes) back from the gridview ?????</p> <p>Here is my data type:</p> <pre><code>[Serializable] pub...
<p>foreach (GridViewRow di in GridView1.Rows) { HtmlInputCheckBox chkBx = (HtmlInputCheckBox)di.FindControl("chkBox1");</p> <pre><code> if (chkBx != null &amp;&amp; chkBx.Checked) { /// put your code here } } </code></pre>
<p>try something like this to get the value on change:</p> <pre><code>protected void OnCheckedChanged(object sender, EventArgs e) { CheckBox c = (CheckBox)sender as CheckBox; string checkBoxId = c.ID; bool checkBoxValue = c.Checked; //update database } </code></pre> <p><strong>[EDIT]</strong><...
39,312
<p>I want to ditch my current editor. I feel I need something else. That do not expose my hands to the risk of RSI. I need to see why I should change editor. And it would be nice to believe, that I will be coding when I'm 80 years old.</p> <p>All the big guys out there are using Vim. The only Emacs guy I know are RMS....
<p><code>.</code> (dot) - repeats the last editing action. Really handy when you need to perform a few similar edits.</p>
<p>To be truly inspired, you must see a vim guru in action. If you do not have a local guru, here is a video to inspire you.</p> <p><a href="http://www.youtube.com/watch?v=jDWBJOXs_iI&amp;feature=related" rel="nofollow">http://www.youtube.com/watch?v=jDWBJOXs_iI&amp;feature=related</a></p> <p>If you don't already kn...
11,281
<p>Is there a way to use <strong>THE LOOP</strong> in <strong>Wordpress</strong> to load pages instead of posts?</p> <p>I would like to be able to query a set of child pages, and then use <strong>THE LOOP</strong> function calls on it - things like <code>the_permalink()</code> and <code>the_title()</code>.</p> <p>Is ...
<p>Yes, that's possible. You can create a new WP_Query object. Do something like this:</p> <pre><code>query_posts(array('showposts' =&gt; &lt;number_of_pages_to_show&gt;, 'post_parent' =&gt; &lt;ID of the parent page&gt;, 'post_type' =&gt; 'page')); while (have_posts()) { the_post(); /* Do whatever you want to do...
<p>Given the age of this question I wanted to provide an updated answer for anyone who stumbles upon it.</p> <p>I would suggest avoiding query_posts. Here's the alternative I prefer:</p> <pre><code>$child_pages = new WP_Query( array( 'post_type' =&gt; 'page', // set the post type to page 'posts_per_page'...
23,872
<p>Does SubSonic.SqlQuery have a between/and for date ranges? If not, what would be the best way to get a range.</p>
<p>Try something like this:</p> <pre><code>SqlQuery query = new SqlQuery().From("Table") .WhereExpression("Column") .IsBetweenAnd("1/1/2008", "12/31/2008"); DataSet dataSet = query.ExecuteDataSet(); // Or whatever output you need </code></pre>
<p>Combined Northwind answer: </p> <pre><code> SqlQuery query = new SqlQuery().From("Orders") .WhereExpression("OrderDate") .IsBetweenAnd("1996-07-02", "1996-07-08"); DataSet dataSet...
19,961
<p>The ISO C committee (<a href="http://www.open-std.org/JTC1/SC22/WG14/" rel="noreferrer">ISO/IEC JTC1/SC21/WG14</a>) has published <a href="http://www.open-std.org/JTC1/SC22/WG14/www/projects#24731-1" rel="noreferrer">TR 24731-1</a> and is working on <a href="http://www.open-std.org/JTC1/SC22/WG14/www/projects#24731-...
<p>I have been a vocal critic of these TRs since their inception (when it was a single TR) and would never use them in any of my software. They mask symptoms instead of addressing causes and it is my opinion that if anything they will have a negative impact on software design as they provide a false sense of security ...
<blockquote> <p>Do you use a library or compiler with support for the TR24731-1 functions? If so, which compiler or library and on which platform(s)? </p> </blockquote> <p>Yes, Visual Studio 2005 &amp; 2008 (for Win32 development obviously).</p> <blockquote> <p>Did you uncover any bugs as a result of fixing yo...
48,766
<p>SharePoint 2007 (both Moss and Wss) exposes document libraries via web dav, allowing you to create documents via essentially file system level activities (e.g. saving documents to a location).</p> <p>SharePoint also seems to expose lists via the same web dav interface, as directories but they are usually empty. Is...
<p>In short: No. </p> <p>Longer answer: Kinda. Any item stored in sharepoint is in a list, including files. But not all lists have files. A document library is a list with each element being a file+metadata. Other lists (like announcments) are just metadata. Only lists that contain files are exposed via webdav, and ev...
<p>Agreed. The only thing exposed to webdav is a list item's attachment (or a library's documents). Even if you bring up a file's properties in explorer, there's no options for list data.</p> <p>If you're working with Office 2007 documents, you can create a <a href="http://msdn.microsoft.com/en-us/library/ms550037.asp...
9,838
<p>As a developer I often release different versions of applications that I want tested by users to identify bugs and to confirm requirements are being met.</p> <p>I give the users a rough idea of what I have changed or new features that need testing, but this seems a bit slap-dash and not very well strucutured.</p> ...
<p>I find that writing test scripts is increadibly time consuming, often longer than the time taken to put the fix into place. With the large volume of work we do here we just don't have the time to create effective testing scripts.</p> <p>With our changes we push the testing through two levels, applicaiton support a...
<p>You're seeking an efficient and effective way to conduct UAT in a structured manner. I highly recommend using a pairwise or combinatorial test design approach. I have used this approach in more than 2 dozen proof of concept projects and found that, as compared to traditional methods of identifying test cases manua...
16,548
<p>What is the best way to allow a team of programmers to use Netbeans, Eclipse and IntelliJ on the same project, thus eliminating the "which IDE is better" question.</p> <p>Which files should or should not be checked into source code control?</p>
<p>I think the best way is to make the build process independent of IDE. This means that your project should not rely on any IDE-specific files to build, but rather use an external build system, like <a href="http://maven.apache.org/" rel="nofollow noreferrer">Apache Maven</a>, <a href="http://ant.apache.org" rel="nofo...
<p>Typically, I would consider this a bad idea. I'm not sure what kind of environment this is (perhaps open source?), but it would really suck to support multiple IDEs. One thing I would recomend if this is unavoidable, would be to standardize your builds in ant scripts. If you have a large set of dependencies, this...
25,392
<p>I'm working on +1M LOC C/C++ project on Solaris (remote, via VNC or SSH). I have a daily updated copy of source code on my local machine too (Windows, just for browsing code).</p> <p>I use VIM and ctags combo (on both Solaris and Windows) but I'm not happy with results / speed. What settings for ctags would you rec...
<p>Your SQL statement scares me. XML is case-sensitive, and your comparison there is likely to fail if the input XML and XSLT (including all elements, attributes, and values) aren't cased exactly like that used in the original database insert.</p> <p>I believe both Oracle (certain) and SQL Server (think so) have mecha...
<p>Here is how it can be done:</p> <pre><code>&lt;xsl:output method="xml" /&gt; &lt;xsl:template match="/"&gt;&lt;xsl:apply-templates select="/a/b" mode="normalize-space" /&gt;&lt;/xsl:template&gt; &lt;xsl:template match="text()" mode="normalize-space"&gt;&lt;xsl:value-of select="normalize-space(.)" /&gt;&lt;/xsl:te...
41,260
<p>Presently I'm starting to introduce the concept of Mock objects into my Unit Tests. In particular I'm using the Moq framework. However, one of the things I've noticed is that suddenly the classes I'm testing using this framework are showing code coverage of 0%.</p> <p>Now I understand that since I'm just mocking th...
<p>You are not using your mock objects correctly. When you are using mock objects you meant to be testing how your code interacts with other objects without actually using the real objects. See the code below:</p> <pre><code>using Moq; using NUnitFramework; namespace MyNameSpace { [TestFixture] ...
<p>I would recommend staying away from mocking frameworks until you understand the interactions that are going on here. </p> <p>IMO it's better to learn with manually created test doubles, then graduate to a mocking framework afterwards. My reasoning:</p> <ol> <li><p>Mocking frameworks abstract away what's actually...
43,623
<p>I see this in a stack trace:</p> <blockquote> <p>myorg.vignettemodules.customregistration.NewsCategoryVAPDAO.getEmailContentByID(I)Lmyorg/pushemail/model/EmailContent;</p> </blockquote> <p>What does the "<code>(I)L</code>" mean?</p>
<p>It means the method takes an <code>int</code>, and returns <code>myorg.pushemail.model.EmailContent</code></p> <p>The string from "L" to ";" is one type descriptor, for the return type. The stuff inside parentheses are the method parameters (in this case, there's just one).</p> <p>These type descriptors are define...
<p>It's a minor point but I don't think this is name mangling. Name mangling implies adding extra stuff to a name. ZBC etc is just how java encodes method signatures in class files. Instead of writing boolean, they put a Z. It saves space.</p> <p>According to wikipedia (standard disclaimer applies), the only name mang...
46,593
<p>Let's say we have a simple function defined in a pseudo language.</p> <pre><code>List&lt;Numbers&gt; SortNumbers(List&lt;Numbers&gt; unsorted, bool ascending); </code></pre> <p>We pass in an unsorted list of numbers and a boolean specifying ascending or descending sort order. In return, we get a sorted list of num...
<p>Don't waste too much time trying to think of <em>every</em> boundry condition. Your tests won't be able to catch <em>every</em> bug first time around. The idea is to have tests that are <em>pretty good</em>, and then each time a bug <em>does</em> surface, write a new test specifically for that bug so that you neve...
<p>A good code coverage tool really helps.</p> <p>100% coverage doesn't mean that it definitely is adequately tested, but it's a good indicator.</p> <p>For .Net NCover's quite good, but is no longer open source.</p> <hr> <p>@Mike Stone - Yeah, perhaps that should have been "high coverage" - we aim for 80% minimum,...
3,359
<p>If a variable is declared as <code>static</code> in a function's scope it is only initialized once and retains its value between function calls. What exactly is its lifetime? When do its constructor and destructor get called?</p> <pre><code>void foo() { static string plonk = "When will I die?"; } </code></pre...
<p>The lifetime of function <code>static</code> variables begins the first time<sup>[0]</sup> the program flow encounters the declaration and it ends at program termination. This means that the run-time must perform some book keeping in order to destruct it only if it was actually constructed.</p> <p>Additionally, sinc...
<p>The <em>Static variables</em> are come into play once the <em>program execution starts</em> and it remain available till the program execution ends.</p> <p>The Static variables are created in the <strong>Data Segment of the Memory</strong>.</p>
30,608
<p>What is the difference in C# between <code>Convert.ToDecimal(string)</code> and <code>Decimal.Parse(string)</code>?</p> <p>In what scenarios would you use one over the other?</p> <p>What impact does it have on performance?</p> <p>What other factors should I be taking into consideration when choosing between the t...
<p>From <a href="http://bytes.com/forum/thread266344.html" rel="noreferrer">bytes.com</a>:</p> <blockquote> <p>The Convert class is designed to convert a wide range of Types, so you can convert more types to Decimal than you can with Decimal.Parse, which can only deal with String. On the other hand Decimal...
<p>Convert.ToDecimal apparently does not always return 0. In my linq statement</p> <pre><code>var query = from c in dc.DataContext.vw_WebOrders select new CisStoreData() { Discount = Convert.ToDecimal(c.Discount) }; </code></pre> <p>Discount is still null after converting from a Decimal? that is null. Howeve...
11,478
<p>When using Html.ActionLink passing a string containing the # char renders it like it is but if you UrlEncode it renders as %2523.</p> <p>I believe it's a bug. MVC Beta Release.</p> <p>Is it really a bug?</p> <p><a href="http://example.com/test#" rel="nofollow noreferrer">http://example.com/test#</a> is rendered a...
<p>Not a bug :) You don't want to UrlEncode actual urls - UrlEncode helps you encode text <em>within</em> urls that might conflict with the URI control characters. In the same way, you wouldn't pass actual HTML into HtmlEncode unless you wanted to show your users the HTML itself.</p>
<p>Is HttpUtility.UrlEncode the same as Server.UrlEncode? (HttpContext.Current.Server.UrlEncode)</p> <p>I cannot do a check right now, not near a .NET machine.</p>
41,324
<p>In SQL SERVER Is it possible to store data with carriage return in a table and then retrieve it back again with carriage return.</p> <p>Eg:</p> <pre><code>insert into table values ('test1 test2 test3 test4'); </code></pre> <p>When I retrieve it, I get the message in a line </p> <p>test1 test2 test3 test4<...
<p>You can store Carriage return in the database. The problem here is that you are using SQL Server Management Studio to display the results of your query. You probably have it configured to show the results in a grid. Change the configuration of SSMS to show results to text and you will see the carriage returns.</p...
<p>You might need to put in a "\n" instead of a literal carriage return. </p>
16,895
<p>Is it a good idea or do I need to calibrate my E steps after I switch to a new filament due to the different types I use (to make my prints accurate)?</p> <p>E.g. calibrate when switching from PLA to ABS/PETG? </p>
<p>No that will not be necessary.</p> <p>However, you could use calipers to measure the diameter of the filaments (e.g. at 5 positions over a few meters) and calculate the mean diameter, if there is a significant difference between the new and the currently used filament you could change the diameter in the slicer (or...
<p>That above is not entirely true. Maybe in a perfect world but we are far away from that. Just this week I tested it with an All-Metal MicroSwiss.</p> <ul> <li>Calibrated with PETG at 240 °C. Result E116</li> <li>Calibrated with PLA at 180 °C. Result E96...</li> </ul> <p>A huge deviation one can't control with the fl...
1,090
<p>I read all over the place about how Spring encourages you to use interfaces in your code. I don't see it. There is no notion of interface in your spring xml configuration. What part of Spring actually encourages you to use interfaces (other than the docs)?</p>
<p>When you define an interface for your classes, it helps with dependency injection. Your Spring configuration files don't have anything about interfaces in them themselves -- you just put in the name of the class.</p> <p>But if you want to inject another class that offers "equivalent" functionality, using an interfa...
<p>Spring won't force you to use interfaces anywhere, it's just good practice. If you have a bean that has a some properties that are interfaces instead of concrete classes, then you can simply switch out some objects with mockups that implement the same interface, which is useful for certain test cases.</p> <p>If you...
31,977
<p>break line tag is not working in firefox, neither in chrome. When i see the source of my page i get: </p> <pre><code>&lt;p&gt;Zugang zu Testaccount:&lt;/br&gt;&lt;/br&gt;peter petrelli &lt;/br&gt;&lt;/br&gt;sein Standardpwd.&lt;/br&gt;&lt;/br&gt;peter.heroes.com&lt;/p&gt; </code></pre> <p>However when i do view se...
<p>You're looking for <code>&lt;br /&gt;</code> instead of <code>&lt;/br&gt;</code></p> <p>Self closing tags such as <em>br</em> have the slash at the end of the tag.</p> <p>Here are the other self-closing tags in XHTML:</p> <ul> <li><a href="https://stackoverflow.com/questions/97522/what-are-all-the-valid-self-clos...
<p>Alternatively to <code>&lt;br /&gt;</code> or <code>&lt;br&gt;</code> you can use <code>&lt;p&gt;&lt;/p&gt;</code> or <code>&lt;/p&gt;</code></p>
19,177
<p>I am looking for a way to localize properties names displayed in a PropertyGrid. The property's name may be "overriden" using the DisplayNameAttribute attribute. Unfortunately attributes can not have non constant expressions. So I can not use strongly typed resources such as: </p> <pre><code>class Foo { [Display...
<p>There is the <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.displayattribute.aspx" rel="nofollow noreferrer">Display attribute</a> from System.ComponentModel.DataAnnotations in .NET 4. It works on the MVC 3 <code>PropertyGrid</code>.</p> <pre><code>[Display(ResourceType = type...
<p>I apologize for the VB.NET code, my C# is a bit rusty... But you'll get the idea, right?</p> <p>First of all, create a new class: <code>LocalizedPropertyDescriptor</code>, which inherits <code>PropertyDescriptor</code>. Override the <code>DisplayName</code> property like this:</p> <pre><code>Public Overrides ReadO...
46,475
<p>I am very new to grails.I am doing one sample project for image uploading and displaying.Right now my project uploads the images and stores into the images directory.Now i want to display all the images stored in the "image" directory. I dont know how to write the gsp code for display all images.</p> <p>For display...
<p>If your imageList has list of image objects try the following</p> <p><strong>${createLinkTo(dir: 'images', file: image.filename)}.</strong></p> <p>If your imageList like this['1.jpg','2.jpg','3.jpg'] try the following</p> <pre><code>**${createLinkTo(dir: 'images', file: image)}** </code></pre>
<p>Depending on what's in your imageList, you can do a :</p> <pre><code>&lt;g:each in="${imageList}" var="image"&gt; &lt;img src="${createLinkTo(dir: 'images', file: image.filename)}" alt="Grails"/&gt; &lt;/g:each&gt; </code></pre>
46,944
<p>I've seen a few print time-lapse videos lately which use gyroid infill: wavy lines, which deform across layers so that the waves end up alternating between the two axes. Other than making the time-lapse videos look much cooler, what are the benefits of this infill style compared to the more common hatching or cross-...
<p>From <a href="https://mattshub.com/2018/03/15/gyroid-infill/" rel="noreferrer">this reference</a> you can read that:</p> <blockquote> <p>A gyroid is a naturally occurring structure which be found in butterfly wings and even within membranes inside cells. In 2017, MIT researchers discovered that when graphene ...
<p>This answer builds on to both 0scar and tedder42's answer:</p> <p>Martin's experiment was about shear strength, where as Stefan of CNC Kitchen's experiment was about compressive strength on 2 directions.</p> <p>From their experiments, it is reasonable to conclude that gyroid does well on sheer strength, and above ...
1,052
<p>I'm using C++ .NET 2.0</p> <p>I have 2 forms</p> <p>the first one is declared as follow</p> <pre><code>#include "stdafx.h" namespace myNamespace{ public ref class frmMain : public System::Windows::Forms::Form { /*... snip ...*/ public void addNewRow(String^ text){ /*... snip... */ } ...
<p>This is because <i>both</i> of these header files include "stdafx.h", and stdafx.h includes "SubForm.h" <i>before</i> "frmMain.h".</p> <p>So, in "SubForm.h", the compiler wants to define SubForm before frmMain has been defined, leading to the error.</p> <p>The proper way to solve this problem is to keep all of the...
<p>In C++ you can only forward declare a class if you are not calling a method on a pointer or reference to that class. Any time you attempt to call a method on a class pointer or reference, you need to have the class definition available.</p> <p>Deleting an incomplete type is legal, but very dangerous.</p> <p>Pleas...
49,245
<p>I have have some code which adds new cells to a table and fills them with text boxes. </p> <p>The way I've coded it so far works fine:</p> <pre><code> TableCell tCell1 = new TableCell(); TableCell tCell2 = new TableCell(); TableCell tCell3 = new TableCell(); TableCell tCell4 = new Ta...
<p>I think this should do it: </p> <pre><code> for (int i = 0; i &lt; 7; i++) { TableCell tCell = new TableCell(); TextBox txt = new TextBox(); tCell.Controls.Add(txt); tRow.Cells.Add(tCell); } </code></pre> <p>Make sure that 6 is changed to a 7.</p>
<p>This should work fine?</p> <pre><code>for (int i = 0; i &lt; 6; i++) { TableCell tCell = new TableCell(); TextBox txt = new TextBox(); tCell.Controls.Add(txt); tRow.Cells.Add(tCell); } </code></pre> <p>I don't really get what you need the names for though.<br> Do you plan on using the "txt5" name a...
22,056
<p>I downloaded and installed this version of <a href="http://en.wikipedia.org/wiki/WxPython" rel="nofollow noreferrer">wxPython</a> for use with my Python 2.6 installation:</p> <p><a href="http://downloads.sourceforge.net/wxpython/wxPython2.8-win32-unicode-2.8.9.1-py26.exe" rel="nofollow noreferrer">http://downloads....
<p>I was getting the same error. </p> <p>After some googling found this link to <a href="http://www.microsoft.com/downloads/details.aspx?familyid=9B2DA534-3E03-4391-8A4D-074B9F2BC1BF&amp;displaylang=en" rel="nofollow noreferrer">MSVC++ 2008 Redestributable</a> and installed it. </p> <p>That solved the problem.</p>
<p>Maybe too late, but I had the same problem and solved that by downloading that from their <a href="http://www.wxpython.org/download.php" rel="nofollow">own website</a> : wxPython2.8-win64-unicode-py27 In my case it initially wanted to setup in somewhere else than my python folder. So I changed it to be in ../python...
40,843
<p>I'm trying to decide how to allow users to register for my website... there's openID, clickpass, facebook connect, google friend connect, etc, or the good old fashioned in-house "enter a username, email, password, etc."</p> <p>Looking briefly at <a href="http://www.plaxo.com/api/openid_recipe" rel="noreferrer">How ...
<p>It really depends on the type of site and who your users are.</p> <p>We looked at the possibility of using OpenID for our e-commerce store (we sell apparel), and the conclusion was that we would be flat out nuts to implement it. I'm not the smartest software developer in the world by any means, but if <strong>I</st...
<p>I am planning to do something simialr on my social network site but a little different then other sites do. Most sites allow users to login with these services, I plan to add these services to my signup form, they then pick there service, openID, facebook connect, myspace ID, then what I plan to do is get all info ...
45,789
<p>I have a string with a length that is a multiple of 8 that contains only 0's and 1's. I want to convert the string into a byte array suitable for writing to a file. For instance, if I have the string "0010011010011101", I want to get the byte array [0x26, 0x9d], which, when written to file, will give 0x269d as the...
<pre><code>py&gt; data = "0010011010011101" py&gt; data = [data[8*i:8*(i+1)] for i in range(len(data)/8)] py&gt; data ['00100110', '10011101'] py&gt; data = [int(i, 2) for i in data] py&gt; data [38, 157] py&gt; data = ''.join(chr(i) for i in data) py&gt; data '&amp;\x9d' </code></pre>
<h1>Python 3 and number.to_bytes</h1> <p>With Python 3 you can convert numbers to bytes natively with <a href="https://docs.python.org/3/library/stdtypes.html#int.to_bytes" rel="nofollow noreferrer">number.to_bytes</a>. The byte array can be written directly to a file.</p> <pre><code>&gt;&gt;&gt; import math,sys &gt;&...
42,314
<p>I have a Dictionary that when I add multiple values to it, the items that were entered before take the values of the item added. I am using the .Net 3.5 Here is the code:</p> <pre><code>public static Dictionary&lt;string, Neighborhoods&gt; Families() { if (File.Exists(calculatePath() + "Family.txt")){} ...
<p>With the sample data you've given and the code you've given, it works okay using a <code>Neighborhoods</code> class like this:</p> <pre><code>public class Neighborhoods { public string Name { get; set; } public string Neighbourhood_Input1 { get; set; } public string University_Input1 { get; set; } p...
<p>Like Jon Skeet noted, you can't use static like that.</p> <p>replace static with private and all should be well.</p>
34,852
<p>I need in a bash script to get details about a file when I know the inode.The system is Linux.</p>
<p>Something like so:</p> <pre><code>find $SEARCHPATH -maxdepth $N -inum $INUM -exec ls -l {} \; </code></pre> <p>Since the filename links to the inode, ans not vice-versa, you need to do this in a brute force manner. The -maxdepth is to narrow it down if you have some idea of where it should be. You can also ad -xde...
<p>You can use <code>find</code> with a combination of <code>-inum</code> and <code>-xdev</code>. This gives you the file's names (it can have more than one name), and from them you can find whatever information you want.</p>
39,282
<p>Unchecked exceptions are alright if you want to handle every failure the same way, for example by logging it and skipping to the next request, displaying a message to the user and handling the next event, etc. If this is my use case, all I have to do is catch some general exception type at a high level in my system,...
<p>IMO, wrapping exceptions (checked or otherwise) has several benefits that are worth the cost:</p> <p>1) It encourages you to think about the failure modes for the code you write. Basically, you have to consider the exceptions that the code you call may throw, and in turn you'll consider the exceptions you'll throw ...
<p>You can catch unchecked exceptions without needing to wrap them. For example, the following is valid Java.</p> <pre><code>try { throw new IllegalArgumentException(); } catch (Exception e) { System.out.println("boom"); } </code></pre> <p>So in your action/controller you can have a try-catch block around the...
5,359
<p>From time to time, there will be student attached to our projects, i would certainly like to assign him/her many things to do so can learn more. But alot of times we are resigned to assigning stuff like documentaiton, updating of ui mockup screens etc. As problem is that is it bit hard to trust the quality of work p...
<p>I am afraid it might sound disappointing but it is not the best idea to utilise students to cut your organisational unit workload down. Probably, if your goal is cutting workload the best thing is not to take students. Read on to understand why.</p> <p>Though you haven't specified the level of work-related expertis...
<p>Why not assign one or more engineers as "sheperds" to the student and let them oversee their work or even better pair with them. The student will gain a good understanding of your project and real work and have a known fallback when in trouble and someone who can give provide direction. The sheperd/mentor gains a f...
18,942
<p>I started using subversion for one of my projects and it would be absolutely amazing if I could just export the latest version from the repository on my production server by for example running a php or perl script.</p> <p>The production site is hosted with a shared hosting provider who doesn't allow shell access o...
<p>As far as I know there is no SVN client fully written in PHP or Perl. SO without exec you're out of luck. </p> <p>Workarounds:</p> <ul> <li>Depending on your own OS and what methods you have to access your web space you might be able to mount the web space in your local file system and just use your system's SVN c...
<p>SVN supports access over WebDAV (i.e. HTTPS). This means for simple read access you don't actually need an SVN client to access an SVN repository. You can even use a web browser, or in your case any PHP function that accepts a URL as its argument. SVN has to be set up on the server side to work with apache, for more...
15,814
<p>I decided to try <a href="http://www.screwturn.eu/" rel="nofollow noreferrer">http://www.screwturn.eu/</a> wiki as a code snippet storage utility. So far I am very impressed, but what irkes me is that when I copy paste my code that I want to save, '&lt;'s and '[' (<a href="http://en.wikipedia.org/wiki/Character_enco...
<p>You can use the <strong>@@...@@</strong> tag to escape the code and automatically wrap it in <strong>PRE</strong> tags.</p>
<p>To post C++ code on a web page, you should convert it to valid HTML first, which will usually require the use of <a href="http://en.wikipedia.org/wiki/Html_entities#HTML_character_entity_references" rel="nofollow noreferrer">HTML character entities</a>, as others have noted. This is not limited to replacing <code>&l...
12,711
<p>How much can a developer charge for an iPhone app like <a href="http://en.wikipedia.org/wiki/Twitterrific" rel="noreferrer">Twitterrific</a>?</p> <p>I want to know this because I need such an application with the same functionality for a new community website. I can do Ruby but have no experience with Objective-C. ...
<p>I'm one of the developers for Twitterrific and to be honest, I can't tell you how many hours have gone into the product. I can tell you everyone who upvoted the estimate of 160 hours for development and 40 hours for design is fricken' high. (I'd use another phrase, but this is my first post on Stack Overflow, so I'm...
<p>The rates that were quoted above are what you would expect to pay US developers; however, I do know some people who have been able to get their apps built for as little as $4,000 by using offshore developers.</p> <p>Here is a blog post from a group that did this: <a href="http://www.lolerapps.com/why-outsourcing-ip...
25,664
<p>I'm hoping that someone has found a way of doing this already or that there is a library already in existence. It's one of those things that would be nice but is in no way necessary for the time being.</p> <p>The functionality I'm looking for is something like <a href="http://www.datejs.com/" rel="nofollow noreferr...
<p>Actually, what you really want is the Custom DateTime Format strings: <a href="http://msdn.microsoft.com/en-us/library/8kb3ddd4(VS.71).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/8kb3ddd4(VS.71).aspx</a></p> <pre><code>DateTime.Now.ToString("ggyyyy$dd-MMM (dddd)") </code></pre> <p>will return "A...
<p><a href="http://msdn.microsoft.com/en-us/library/az4se3k1(VS.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/az4se3k1(VS.71).aspx</a> should get you on your way,</p>
33,689
<p>How can you strip non-ASCII characters from a string? (in C#)</p>
<pre><code>string s = "søme string"; s = Regex.Replace(s, @"[^\u0000-\u007F]+", string.Empty); </code></pre>
<p>Necromancing.<br /> Also, the method by bzlm can be used to remove characters that are not in an arbitrary charset, not just ASCII:</p> <pre><code>// https://en.wikipedia.org/wiki/Code_page#EBCDIC-based_code_pages // https://en.wikipedia.org/wiki/Windows_code_page#East_Asian_multi-byte_code_pages // https://en.wikip...
15,009
<p>We have a website running on Apache, access to which has a number of static pages protected via HTTP Basic authentication.</p> <p>I've written a new part of the site with Django using Django's built in support for user management.</p> <p>The problem I have is that users have to log in once via the HTTP Basic authe...
<p>This has been added to the Django 1.3 release. See more current documentation for this here: <a href="http://docs.djangoproject.com/en/dev/howto/auth-remote-user/" rel="noreferrer">http://docs.djangoproject.com/en/dev/howto/auth-remote-user/</a></p>
<p>Because django can be run in several ways, and only modpython gives you close integration with Apache, I don't believe there is a way for django to log you in basic on Apache's basic auth. Authentication should really be done at the application level as it'll give you much more control and will be simpler. You reall...
18,365
<p>I want to run a web application on php and mysql, using the CakePHP framework. And to keep the threshold of using the site at a very low place, I want to not use the standard login with username/password. (And I don't want to hassle my users with something like OpenID either. Goes to user type.)</p> <p>So I'm think...
<p>I have used the <a href="http://www.phpclasses.org/browse/file/3.html" rel="nofollow noreferrer">pop3 php class</a> with great success (there is also a <a href="http://pear.php.net/package/Net_POP3" rel="nofollow noreferrer">Pear POP3 module</a>).</p> <p>Using the pop3 class looks something like this:</p> <pre><co...
<p>I would seriously reconsider this approach. E-mail hasn't got very high reliability. There's all kinds of spamfilters that might intercept e-mails with links thereby rendering the "command" half-finished, not to mention the security risks.</p> <p>It's very easy to spoof the sender-address on an e-mail. You are basi...
6,894
<p>We're experimenting with following an agile approach to software development where I work. It's working well so far, however, towards the end of the iteration, we had a problem with a build and it cost a day's worth of time fixing: time that should have been dedicated to testing.</p> <p>As a result, our QA doesn't...
<p>It depends on the scheduling of your QA - can you let them continue testing while developers are working on the next iteration already or not? <BR></p> <p>If yes, I'd let them finish testing.<BR> Just continue on with the next iteration with the data that you have already. You really don't want to hold back a numb...
<p>Agile canon is that you only count those stories/backlog items as done which are DONE - and typically your definition of DONE should include "being tested". So, you simply don't get credit for the stories that aren't tested yet. After all, a similar problem might arise next iteration, too.</p> <p>It's not totally c...
41,421
<p>my goal is to write a stored proc that can collect all field values from multiple rows into one single output variable (maybe varchar(some_length)). It may seem strange solution but i've quite positive its the only one i can use at that situation im in. I have not used Firebird before and stored procs look way diffe...
<p>The following procedure does what you describe:</p> <pre><code>SET TERM !!; CREATE PROCEDURE concat_names RETURNS (concat VARCHAR(2000)) AS DECLARE VARIABLE name VARCHAR(100); BEGIN concat = ''; FOR SELECT first_name || ' ' || last_name FROM employee INTO :name DO BEGIN concat = concat || name || ', '; ...
<p>You have to test for null values when concatenating, here is an example for two fields and a separator between them:</p> <pre><code> CREATE PROCEDURE CONCAT( F1 VARCHAR(385), F2 VARCHAR(385), SEPARATOR VARCHAR(10)) RETURNS ( RESULT VARCHAR(780)) AS begin if ((:f1 is not null) and (:f1 &lt;&gt;...
22,211
<p>Here's what I am trying to do:</p> <p>Select text from a webpage I pulled up using my web browser control.After clicking a button while this text is still selected I would like a message box to pop-up displaying the text that was highlighted by the user. How do I get this functionality to work in my wpf application...
<p>Well, for starters it would be a lot simpler to use <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx" rel="nofollow noreferrer"><code>WebBrowser</code></a> than mshtml (note that you can still host <code>WebBrowser</code> in WPF) - this will certainly let you do simple things a l...
<p>Figured it out that error was because this wasn't in my form class</p>
29,404
<p>I recently asked a question about what I called "method calls". The answer referred to "messages". As a self-taught hobby programmer trying to phrase questions that don't make me look like an idiot, I'm realizing that the terminology that I use reveals a lot about how I learned to program.</p> <p>Is there a distinc...
<p>I've found this to be a language and programming-paradigm thing. One paradigm — OOP — refers to objects with member methods, which conceptually are how you send messages to those objects (this view is reflected in UML, for example).</p> <p>Another paradigm — functional — may or may not involve classes of objects, ...
<p>I'm not sure about origin of <em>message</em> terminology. Most ofter I encounter <em>messages</em> in UML design. Objects (Actors in UML terminology) can communicate with each other by means of <em>messages</em>. In real-world code <em>message</em> is just a function call usually. I think of message as of attempt t...
6,536
<p>I have a custom UIView that generates a set of subviews and display them in rows and columns like tiles. What I am trying to achieve is to allow the user to touch the screen and as the finger move, the tiles beneath it disappears. </p> <p>The code below is the custom UIView that contains the tiles:</p> <pre><code>...
<ol> <li>Not really, in my experience.</li> <li>From the way you've set up your views, there would seem to be a much more efficient way to determine which one was tapped:</li> </ol> <p><code><pre></p> <pre><code> //In your init method, make sure each tile doesn't respond to clicks on its own ... tile.userInteractio...
<p>Just an idea that may help... I have not tested this, but, after detecting the tap on a particular imageview turn off userInteractionEnabled of the all other imageviews... </p> <p>I suppose this will help increase a little bit the speed, as iPhone will not last resources trying to find which image is being tapped d...
26,469
<p>What is the best way to create redundant subversion repositories?</p> <p>I have a subversion repository (linked through apache2 and WebDAV) and would like to create a mirror repository on a different server in the event of outages, but I am not certain of the best way to proceed.</p> <p>I am thinking that post-com...
<p>Sounds like what you are looking for is basically federated (synced) servers... I asked the same question recently...and while I didn't find the exact solution I was looking for it came close. <a href="https://stackoverflow.com/questions/1790/federated-synced-subversion-servers">See here:</a></p>
<p>If you only need read-only access to the mirrored repository, you can use <a href="https://svn.apache.org/repos/asf/subversion/trunk/notes/svnsync.txt" rel="nofollow noreferrer">svnsync</a> which was added in SVN 1.4 for mirroring.</p> <p>We use a secondary repository on our build server to run CruiseControl.NET ag...
2,975
<p>I'm using the Marlin firmware (1.1.0-RC7 - 31 July 2016) for a 3d printer. Currently the printing is not perfect due to slight inaccuracies in movements along the x and y axis. I'm trying to change the feedrate for speed along the xy axis whilst the printer is in operation to make sure the printer stops on time and ...
<p>You can change the <em>maximum</em> allowable feedrate in Configuration.h, but the actual feedrate that is used isn't determined by your firmware. The feedrate is specified in the G-Code file. A command like</p> <pre><code>G0 X10.0 Y15.0 Z3.0 F9000 </code></pre> <p>indicates a move to (10,15,3) at a feedrate of 90...
<p>You have the lines to adjust the feed rate. The first one (line 742) is relevant to the maximum feed rate XY while homing (not during printing). I think this is not an issue in your particular case and you may leave it as it is.</p> <p>The second one (line 753) is the feed rate while printing for XY. Particularly ...
419
<p>Do the same best practis rules regarding subscribing/unsubscribing to events apply in asp.net?</p> <p>I know it might seem like a silly question, but when I think about it, I have never really seen any code where people first subscribe to an event on a page and then unsubscribe later on in the web request.</p> <p>...
<p>The page instance and all of its components will "go out of scope" when request completes, e.g. they become eligible for GC. So your ListView will go out of scope along with the Page/user controls on it. You don't need to unsubscribe (unless you subscribe to an event that belongs to some kind of singleton that survi...
<p>Generally, no. Events are supposed to be dumped automatically when the page unloads. SUPPOSED to be. I've run into a bug before (in .NET 1.1) where that wasn't the case.</p> <p>I won't bother unsubscribing, unless I notice a problem with the page (like, a method being called 20 times from a phantom in the call stac...
44,901
<p>Is it right to use a private constant in the following situation:</p> <p>Say I have a game with a lives variable and a startingLives variable. At the start of the game I set the lives variable to equal the startingLives variable. This is how I would normally do it:</p> <pre><code>private var lives:int = 0; private...
<p>Put it in a constant named <code>DEFAULT_STARTING_LIVES</code>, but also have a variable named startingLives. For now, set startingLives = <code>DEFAULT_STARTING_LIVES</code>. Later, you can set startingLives based on a value from a configuration file. If the file has not been created or is not found, you have a bac...
<p>This seems to be a good use of a <strong>constant</strong>. If this necessarily needs to be <strong>private</strong> is another question. Might be helpful to be able to read such a value from the outside (especially since it is not modifiable).</p> <p>Generally speaking constant private fields especially might make ...
26,920
<p>When running a CherryPy app it will send server name tag something like CherryPy/version. Is it possible to rename/overwrite that from the app without modifying CherryPy so it will show something else? </p> <p>Maybe something like MyAppName/version (CherryPy/version) </p>
<p>Actually asking on IRC on their official channel fumanchu gived me a more clean way to do this (using latest svn):</p> <pre><code>import cherrypy from cherrypy import _cpwsgi_server class HelloWorld(object): def index(self): return "Hello World!" index.exposed = True serverTag = "MyApp/%s (CherryP...
<p>This string appears to be being set in the CherrPy <a href="http://www.cherrypy.org/browser/trunk/cherrypy/_cprequest.py" rel="nofollow noreferrer">Response</a> class:</p> <pre><code>def __init__(self): self.status = None self.header_list = None self._body = [] self.time = time.time() self.headers = http...
16,391
<p>I think questions like this are the reason why I don't like working with PHP. The manual is good, if you can find what you are looking for. After reading through the <a href="http://us3.php.net/array" rel="nofollow noreferrer">Array Functions</a>, I didn't see one that provides the functionality I need.</p> <p>I ha...
<p><a href="http://de.php.net/array_diff" rel="nofollow noreferrer"><code>array_diff</code></a> is what you want.</p> <pre><code>$array1 = array("a" =&gt; "green", "red", "blue", "red"); $array2 = array("b" =&gt; "green", "yellow", "red"); $result = array_diff($array1, $array2); </code></pre> <p>Result: <code>"blue"<...
<p>I like the array_diff function, but I have my one scripted one if you dont want to pass down an array:</p> <pre><code>function array_unset_value($value, &amp;$array) { $key = array_search($value, $array); while ($key !== false) { unset($array[$key]); $key = array_search($value, $array); ...
27,880
<p>I have two options - to buy either the Ender 3 or the Mega Zero. I'm heading towards Ender 3 because the Mega Zero doesn't have a heated bed. </p> <p>My question is, how is a printer without a heated bed (the Mega Zero) a better option than one with a heated bed (the Ender 3)?</p> <p>Why would I even consider buyi...
<p>Lack of a heated bed does not necessarily limit you to using PLA. I would say (among those I've used) the material that's least sensitive to whether you have a heated bed is probably TPU. Depending on your model, it can even be hard to print PLA without a heated bed, unless perhaps you're willing to use a brim or ra...
<p>Lack of a heated bed does not necessarily limit you to using PLA. I would say (among those I've used) the material that's least sensitive to whether you have a heated bed is probably TPU. Depending on your model, it can even be hard to print PLA without a heated bed, unless perhaps you're willing to use a brim or ra...
1,635
<p>I'm being asked to look into a problem that occurs intermittently on a WebServer running my team's application.</p> <p>Essentially, we have a webservice that does a lookup between codes. If you have Code Type A, you can use it to look up the corresponding Code Type B. Periodically, when memory is running low, whe...
<p>There's nothing magical or about a rails model, it's just a normal class with a bunch of pre-existing methods,</p> <p>So, the question is &quot;can I define_method in a class&quot;?</p> <h3>Part 1: Yes you can.</h3> <p>The important distinction is than you can define method <em>in a class</em> not <em>in an instance...
<p>The answer to your question is "yes, you can". As for why it's not working for you - it's impossible to say for sure why, if you don't provide some context for the code.</p>
38,897
<p>I tried to install Delphi 7 on Vista several times and Vista prevented me from doing so by telling me that there are known problems with this application (Delphi 7). Several other people in my company experienced problems with installing D7 on Vista.</p> <p>This lead to the conclusion that we were at risk with our ...
<p>Running Delphi 7 under Vista is no problem if you can turn UAC off. With UAC on, you get an error message when starting D7, but it still works, just click ok and go on.</p> <p>Programs compiled with D7 have no problem with Vista. But new features of Vista are supported by Delphi 2007/2009 only.</p> <p>We use D7 on...
<p>I have been using D4 with Vista for year as one of our key products uses it, its good version still and there are workarounds to make it use new Vista features. You can call any win32 API (new functions) so there is no point to update to D7.</p> <p>I installed/moved D4 to my new machine by hand: 1. by exporting re...
13,266
<p>In C# how do I still show the headers of a gridview, even with the data source is empty. </p> <p>I am not auto generating the columns as they are all predefined. </p> <p>Currently what I am doing is the following.</p> <p>Get a DataTable back from a stored procedure, then set the DataSource of the gridview, and th...
<p>ASP.Net 4.0 added the boolean <code>ShowHeaderWhenEmpty</code> property.</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.showheaderwhenempty.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.showheaderwhenempty.aspx</a></p> ...
<p>Use an EmptyDataTemplate like below. When your DataSource has no records, you will see your grid with headers, and the literal text or HTML that is inside the EmptyDataTemplate tags.</p> <pre><code>&lt;asp:GridView ID="gvResults" AutoGenerateColumns="False" HeaderStyle-CssClass="tableheader" runat="server"&gt; ...
46,163
<p>I look for a JComponenet based RDF editor which I could embed in my application?</p> <p>It does'n need to be fancy .</p> <p>Thanks in advance.</p>
<p>Swoop is a good editor that's released under an MIT style license. It's <a href="http://code.google.com/p/swoop/source/browse/#svn/trunk" rel="nofollow noreferrer">available on Google code</a>. They also have an example test.java (<a href="http://code.google.com/p/swoop/source/browse/trunk/test.java" rel="nofollow n...
<p>I don't know whether it's embeddable (or whether it even works), but take a look at <a href="http://sourceforge.net/projects/rdfeditor/" rel="nofollow noreferrer">http://sourceforge.net/projects/rdfeditor/</a>.</p>
39,180
<p>I'd like to have an HTML page which displays a single PNG or JPEG image. I want the image to take up the whole screen but when I do this:</p> <pre><code>&lt;img src=&quot;whatever.jpeg&quot; width=&quot;100%&quot; height=&quot;100%&quot; /&gt; </code></pre> <p>It just stretches the image and messes up the aspect rat...
<p>Here's a quick function that will adjust the height or width to 100% depending on which is bigger. Tested in FF3, IE7 &amp; Chrome</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script&gt; function resizeToMax(id){ myImage = new Image() var img = document.getElementById(id); myImage.src = img.src; ...
<p>For this, JavaScript is your friend. What you want to do, is on page load, walk through the dom, and for every image (or alterantively, pass a function an image id if it's just a single image) check if which attribute of the image is greater, it's height or width. </p> <p>This is the IMAGE itself, not the tag. </p>...
19,422
<p>Say I have a struct "s" with an int pointer member variable "i". I allocate memory on the heap for i in the default constructor of s. Later in some other part of the code I pass an instance of s by value to some function. Am I doing a shallow copy here? Assume I didn't implement any copy constructors or assignme...
<p>To follow up on what @[don.neufeld.myopenid.com] said, it is not only a shallow copy, but it is either (take your pick) a memory leak or a dangling pointer.</p> <pre><code>// memory leak (note that the pointer is never deleted) class A { B *_b; public: A() : _b(new B) { } }; // dangling ptr (who delete...
<p>You will have two copies of the <code>s</code> struct, each of which will have their own <code>i</code> pointer, but both <code>i</code> pointers will have the same value pointing to the same address in memory - so yes, it will be a shallow copy.</p>
26,571
<p>The code below is the code i am using. It works fine in thunderbird but not in mac mail client (and i assume anything made by microsoft. I currently do not have access to this to test it in). Much as i am aware of the idiosyncrasies of the various mail clients, I am flummoxed by this! It's fairly self explanatory bu...
<p>Rather than try and roll your own mailer, try e.g. <a href="http://phpmailer.codeworxtech.com/" rel="nofollow noreferrer">PHPMailer</a>. It has very good support for multipart/alternative. It's much easier to integrate this than to roll your own solution. I've been there - after working endlessly around strange MIME...
<p>You're not using output buffering correctly - see man page for <a href="http://php.net/ob_end_clean" rel="nofollow noreferrer">ob_end_clean</a> to see that it doesn't return the captured output, you need <a href="http://php.net/ob_get_contents" rel="nofollow noreferrer">ob_get_contents</a> for that:</p> <pre><code>...
45,415
<p>I have a collection of orders. I would like to hit the database once, retrieve the orders, store them and then be able to access this collection over multiple forms. I know in asp.net, you can use things like Application Object or Session Object but how do you do it in a win form app? I was thinking of creating a st...
<p>The fundamental difference in WebForms &amp; WinForms is that WinForms are stateful. In other words, you can ensure the objects you load once are available till the program is shutdown. The same is not true for WebForms as HTTP is stateless and ASP.Net weaves lots of "magic" [ViewState, Server session, Cookies, Hid...
<p>You should have some Data Object that accesses the database anyways, right? Wrap that in a CacheProxy class, that hits the database if it doesn't have a local copy. I hear you can <a href="http://www.codeproject.com/KB/cs/cacheinwinformapps.aspx" rel="nofollow noreferrer">use the System.Web cache in Winforms</a> as ...
47,474
<p>Is it possible to reference a .NET Assembly from a SQL Server Stored procedure or function, or otherwise access the clr code from SQL Server?</p> <p><strong>EDIT</strong> Whilst this solution will require to be somewhat generic, I am fairly confident expecting SQL 2005+</p>
<p>It depends on your version of SQL Server. SQL Server 2005 and higher supports CLR Stored Procedures. If you have an older version, you need to register the Assembly as a COM class (using attributes on the objects/methods/assembly), and then registering it using regasm. Then you can call it like any other COM Obje...
<p>You can indeed.</p> <p>Some information <a href="http://blogs.msdn.com/sqlclr/archive/2006/06/29/651644.aspx" rel="nofollow noreferrer">here</a>.</p>
16,556
<pre><code> $('input[type=checkbox]').unbind().click(function(e){ $(this).attr('checked', true) return false; }); </code></pre> <p>I NEED to return false because I have an event on its parent and I don't want to trigger that. It just WON'T check that checkbox.</p>
<pre><code>$('input[type=checkbox]').unbind().click(function(e){ e.stopPropagation(); }); </code></pre> <p>Edit: I'm not sure what you need <code>.unbind()</code> for, but you should beware that that is canceling any other events you've put on those checkboxes.</p>
<p>You're missing a ] at the end of your jQuery selector</p>
32,874
<p>I have a value like this:</p> <pre class="lang-none prettyprint-override"><code>"Foo Bar" "Another Value" something else </code></pre> <p>What regex will return the values enclosed in the quotation marks (e.g. <code>Foo Bar</code> and <code>Another Value</code>)?</p>
<p>I've been using the following with great success:</p> <pre><code>(["'])(?:(?=(\\?))\2.)*?\1 </code></pre> <p>It supports nested quotes as well.</p> <p>For those who want a deeper explanation of how this works, here's an explanation from user <a href="https://stackoverflow.com/users/20713/ephemient">ephemient</a>:...
<p>For me worked this one: </p> <pre><code>|([\'"])(.*?)\1|i </code></pre> <p>I've used in a sentence like this one:</p> <pre><code>preg_match_all('|([\'"])(.*?)\1|i', $cont, $matches); </code></pre> <p>and it worked great.</p>
20,672
<p>Is there a good, up-to-date listing anywhere that maps User-Agent HTTP Header strings --> operating systems?</p>
<p>Here's a quick list... let me know if I missed one you are interested in.</p> <p><a href="http://www.geekpedia.com/code47_Detect-operating-system-from-user-agent-string.html" rel="noreferrer">http://www.geekpedia.com/code47_Detect-operating-system-from-user-agent-string.html</a>:</p> <blockquote> <p>// Match use...
<p>I was searching for the same thing, then found:<br> <a href="http://www.useragentstring.com" rel="nofollow">http://www.useragentstring.com</a> </p> <p>Great, but extremely elaborate: you'll probably want to re-think the project you need the list for, since this one puts 'things in perspective'.</p> <p>Just want...
28,247
<p>I have a web form with a button and a DetailsView control on it. In the button's click event I change the DetailsView control to insert mode so I can add records:</p> <p>DetailsView1.ChangeMode(DetailsViewMode.Insert)</p> <p>Everything works fine, except for a checkbox in the DetailsView. When the DetailsView goes...
<p>I was able to fix my problem by changing it to a template field. Not sure why it wouldn't work the other way. </p>
<p>Is the text in a Label that is in the item template? If so, you'd need to add it to the Edit Item Template. Also check that the width of the control is wide enough for all the controls and text. It may be getting hidden due to absolute positioning.</p>
12,937
<p>I work for a smallish software shop with a mix of internal products, and external consulting. For the last few years I've been working on in house apps at the office with a bunch of other geeks. Fairly laid back and productive. Pretty much perfect coding conditions:</p> <ul> <li>good equipment</li> <li>quiet, focus...
<p>Just quit. Life is too short to be miserable. You clearly know what environment works for you and what environment doesn't. Find another job like the first one. I know it's easier said than done... but you really owe it to yourself.</p>
<p>For the noise, I bring a good headphone and use music.</p> <p>Slow equipment and constant interruption are concern that you should talk to your project manager. I am just he wants you to work the fast that you can. He might help you.</p>
27,653
<p>I've installed Ubuntu Server (8.04) into Parallels and found that the system time/clock ran fast to the extent that it would gain hours over time.</p>
<p>What about using <a href="http://en.wikipedia.org/wiki/Network_Time_Protocol" rel="nofollow noreferrer">an NTP service</a> to keep it sync'd?</p>
<p>You could just want to install ntpd, it works well enough on real servers, should also do the trick on virtual ones. Another possibility is to check if Parallels has a configuration option like "Sync guest clock to host clock".</p>
11,388
<p>I don't want this to be a specific producer question, but I would like to know if the Sparkmaker is good enough to print small details in OO/HO scale objects. I'm referring here to objects like furniture, and other house appliances at scale. I wasn't able to find any visuals with very small objects for this printer....
<p>Can you tell by looking at the de-adhesion what isn't sticking? </p> <p>It may be that printing the ASA at higher temperature is melting the BVOH enough that it doesn't stick, being molten. If so, then it may be possible to print the first layer of ASA at a cooler temperature, slower if necessary to still succeed...
<p>Here's how I got it to work. I set the heat bed to 110°C and disabled the underlayer of the raft layer. I set the BVOH and the ASA to 235°C after the 4th layer I set the heatbed to 90°C and after the 6th layer I set the bed down to 60°C so that the BVOH hardened and adhered to the bed making sure that nothing curle...
1,307
<p>I'm trying to learn bash string handling. How do I create a bash script which is equivalent to this Java code snippet?</p> <pre><code>String symbols = "abcdefg12345_"; for (char i : symbols.toCharArray()) { for (char j : symbols.toCharArray()) { System.out.println(new StringBuffer().append(i).append(j))...
<p>That is so simple, Bash does it in the input parser. No code required. Try:</p> <pre><code>echo {a,b,c,d,e,f,g,1,2,3,4,5,_}{a,b,c,d,e,f,g,1,2,3,4,5,_} </code></pre> <p>You might need a second pass to split it into lines, though.</p> <p>Or, you could of course use a couple of nested loops like in your example:</p>...
<pre><code>for i in a b c d e f g 1 2 3 4 5 _; do for j in a b c d e f g 1 2 3 4 5 _; do echo $i$j done done </code></pre> <p><code>man bash</code> is your friend. It has large sections on its variable replacement and internal commands.</p>
45,498
<p>Choosing the correct lifecycle and methodology isn't as easy as it was before when there weren't so many methodologies, this days a new one emerges every day.</p> <p>I've found that most projects require a certain level of evolution and that each project is different from the rest. That way, extreme programming wor...
<p>Depending on what you're doing, you might want to move the audit out of the data layer into the data access layer. It give you more control.</p> <p>I asked a similar question wrt NHibernate and SqlServer <a href="https://stackoverflow.com/questions/15917/data-auditing-in-nhibernate-and-sqlserver">here</a>.</p>
<p>Here is the implementation I use to audit tables: <a href="http://www.simple-talk.com/sql/database-administration/pop-rivetts-sql-server-faq-no.5-pop-on-the-audit-trail/" rel="nofollow noreferrer">Pop Rivett's SQL Server FAQ No.5: Pop on the Audit Trail</a></p>
8,602
<p>I have this big data-entry sort of page, a table kind of layout using divs. Each row has subrows which can be toggled open/closed. The toggling is triggered using css visibility settings. Each "cell" of the table has a little image in its corner, you click on the image, and a popup window opens that allows you to pu...
<p>in addition to block elements the z-index works for all elements that have what IE calls hasLayout <a href="http://haslayout.net/haslayout" rel="noreferrer">read more</a></p>
<p>I've had the exact same problem with both input fields and textareas in IE7, but only if I gave them a width.</p> <p>I don't remember where I got it from, but I found this solution, it may not be very elegant, but it solved the issue. Just add:</p> <pre><code>filter:alpha(opacity=100) </code></pre> <p>to your css...
18,261
<p>I was wondering if there is a way to implement an action listener for a Jbutton without a name. For example, I have the following for loop that creates a button for each letter of the alphabet.</p> <pre><code>for (int i = 65; i &lt; 91; i++){ alphabetPanel.add(new JButton("&lt;html&gt;&lt;center&gt;" + (char)i...
<p>Your question is a little vague. it would be trivial to modify the loop to add a listener inside the loop:</p> <pre><code>ActionListener listener = something; for (int i = 65; i &lt; 91; i++){ JButton button = new JButton("&lt;html&gt;&lt;center&gt;" + (char)i); button.addActionListener( listener ); ...
<p>It is possible to add ActionListener to anonymous components like below:</p> <pre><code>new JButton().addActionListener(new ActionListener(){ @Override public void actionPerformed(ActionEvent arg0) { // TODO your action } }); </code...
35,783
<p>I understand that there's no universal answer to the attribute vs. element debate (and I read through the other questions I saw on this), but any insight into this particular circumstance would be greatly appreciated. </p> <p>In our case we're going to be receiving very large amounts of master and transactional da...
<p>If performance is the only requirement, I think you have to go with the attributes, just because it takes up less space. I don't see any advantage to the elements.</p>
<p>I have used both methods with very large files both with DOM and with a line-by-line reader. Certainly you need to use a line-by-line reader to get good performance for very large files. Beyond this my gut feeling is that attributes are more efficient but I have no hard data to back that opinion up with!</p>
35,674
<p>This is a bit of a stretch, but I have an interesting (to me) programming (err... scripting? algorithmic? organizational?) problem. (I am tagging this in Ruby, because of my preference for Ruby for scripting.)</p> <p>Imagine you have 100 gigabytes of pictures floating around on multiple drives. There are likely a t...
<p>I like my photos to be sorted by date taken, so I wrote a groovy script to look at the EXIF data of pictures and put them into directories in ISO date format (2008-12-11). It keeps them organised. It doesn't solve the tagging according to content though, I use flickr for that.</p> <p>As for the duplication problem,...
<p>You could use something like <a href="http://www.sno.phy.queensu.ca/~phil/exiftool/" rel="nofollow noreferrer">Exiftool</a> which does exist for Windows to reorganize your pictures according to the CaptureTime (which is my own scheme) or any other Exif parameters that can be found inside a JPG or RAW file. You'll b...
46,602
<p>The code</p> <pre><code>private SomeClass&lt;Integer&gt; someClass; someClass = EasyMock.createMock(SomeClass.class); </code></pre> <p>gives me a warning "Type safety: The expression of type SomeClass needs unchecked conversion to conform to SomeClass&lt;Integer&gt;".</p>
<p>AFAIK, you can't avoid the unchecked warning when a class name literal is involved, and the <code>SuppressWarnings</code> annotation is the only way to handle this.</p> <p>Note that it is good form to narrow the scope of the <code>SuppressWarnings</code> annotation as much as possible. You can apply this annotation...
<p>I know this goes against the question, but why not create a List rather than a Mock List?</p> <p>It's less code and easier to work with, for instance if you want to add items to the list.</p> <pre><code>MyItem myItem = createMock(myItem.class); List&lt;MyItem&gt; myItemList = new ArrayList&lt;MyItem&gt;(); myItemL...
8,114
<p>When doing calculations on very large numbers where integral data types such as double or int64 falls short, a separate class to handle such large numbers may be needed. </p> <p>Does anyone care to offer an efficient algorithm on how best to do this?</p>
<p>There are 2 solutions to your problem:</p> <ul> <li><p><strong>Easy way:</strong> Use an external library such as '<a href="http://gmplib.org/" rel="noreferrer">The GNU MP Bignum Library</a> and forget about implementation details.</p></li> <li><p><strong>Hard way:</strong> Design your own class/structure containin...
<p>Using the built-in features of a language work for me.</p> <p>Java has <code>BigInteger</code> and <code>BigDecimal</code>, and Python automagicaly switches to an object similar to Java's if a number gets out of the range of an <code>integer</code> or whatnot.</p> <p>As for other languages though, I have no idea.<...
4,567
<h2>How do you find the phone numbers in 50,000 HTML pages?<br><br></h2> <blockquote> <h3>Jeff Attwood posted 5 Questions for programmers applying for jobs:</h3> <p>In an effort to make life simpler for phone screeners, I've put together this list of Five Essential Questions that you need to ask during an S...
<pre><code>egrep "(([0-9]{1,2}.)?[0-9]{3}.[0-9]{3}.[0-9]{4})" . -R --include='*.html' </code></pre>
<p>Here's why phone interview coding questions don't work: </p> <p>phone screener: how do you find the phone numbers in 50,000 HTML pages?</p> <p>candidate: hang on one second (covers phone) hey (roommate/friend/etc who's super good at programming), how do you find the phone numbers in 50,000 HTML pages?</p> <p>Sav...
7,118
<p>Within our Active Directory domain, we have a MS SQL 2005 server, and a SharePoint (MOSS 3.0 I believe) server. Both authenticate against our LDAP server. Would like to allow these authenticated SharePoint visitors to see some of the data from the MS SQL database. Primary challenge is authentication.</p> <p>Any ...
<p>If you are using C# the code and connection string is:</p> <pre><code>using System.Data.SqlClient; ... SqlConnection oSQLConn = new SqlConnection(); oSQLConn.ConnectionString = "Data Source=(local);" + "Initial Catalog=myDatabaseName;" + "Integrated Security=SSPI"; //Or // "Server=(local);" + /...
<p>What do you mean by "users of SharePoint"?</p> <p>Do you mean that they want to see data from inside a SharePoint page? In that case you have to do impersonation in that page/application, and possible set up Kerberos correctly.</p> <p>Then you will have to assign those SharePoint users (or better, their AD group) ...
14,510
<p>Has anyone used jQuery to populate an autocomplete list on a textbox using ASP.NET webforms? If so, can anyone recommend a good method? From my reading so far, it seems like most people are using delimited lists rather than JSON to bring the items back. I'm open to any ideas that will get me up and running rather qu...
<p>There are many, many examples on the web. I've used this one before, and if I recall you only need to create an aspx that will return matching terms as a <code>&lt;BR/&gt;</code> separated list:</p> <p><a href="http://www.dyve.net/jquery/?autocomplete" rel="nofollow noreferrer">http://www.dyve.net/jquery/?autocompl...
<p>I wrote an Asp.Net WebControl and some Asp.Net MVC extension methods wrapping the JQuery UI autocomplete widget.</p> <p>I wrote documentation as well about how to implement a working resource providing a JSon result.</p> <p>You can find it at:</p> <p><a href="http://autocompletedotnet.codeplex.com/" rel="nofollow...
29,795
<p>I don't want customers to be able to make backups of my sql server database and access the tables data etc.</p> <p>I know there are some products that will encrypt the data in the tables, and their product will decrypt it when displaying in my application.</p> <p>What products do you guys know of? What options do...
<p>There is the 3rd party <a href="http://www.xpcrypt.com" rel="nofollow noreferrer">xp_crypt</a>. It's been around for years. It's an extended stored proc (that is, DLL)</p>
<p>SQL Server 2008 supports database encryption natively. Check the documentation for <a href="http://msdn.microsoft.com/en-us/library/bb934049.aspx" rel="nofollow noreferrer">Transparent Data Encryption (TDE)</a>. </p>
41,518
<p>Ok, do you do <code>Business.Name</code> or <code>Business.BusinessName</code> <code>SubCategory.ID</code> or <code>SubCategory.SubCategoryID</code></p> <p>What about in your database?</p> <p>Why?</p> <p>I'm torn with both. Would love there to be a "right answer"</p>
<p>The only "right" answer is to be consistent. Decide upfront which one you will be using in a project, and stick to it.</p>
<p>For very common properties like "Name" and "ID", the convention I have used is to not put the entity name in the field. For more unusual properties, I do put the entity name.</p> <p>This is a naming convention decision, but I have not regretted projects where this is the convention, if you put the name of the enti...
6,626
<p>I would like to be able to manipulate the DOM just before my page is sent to be printed. Internet Explorer has an event on the window object called "onbeforeprint" but this is proprietary and isn't supported by other browsers. Is it possible to do this via javascript (jQuery in particular, if possible)?</p> <p>Befo...
<p>Adding <code>!important</code> after a property in your CSS will allow it to override the inline styles. For example:</p> <pre><code>&lt;div class="test" style="color: blue;"&gt;Some Text&lt;/div&gt; </code></pre> <p>css:</p> <pre><code> .test { color: red !important; } </code></pre> <p>will be displayed...
<p>Why not just call the print() function from within an other function?</p> <p>Like:</p> <pre><code>function myPrint() { $("#myDiv").css({"border-color":"red"}); window.print(); } </code></pre> <p>Then you could call it from where you need it.</p>
38,068
<p>I'm trying to abstract out all database code into a separate library and then use that library in all my code. All database connections are done using typed TableAdapters that I create by dragging and dropping in datasets in VS2005, using a connection string from the appSettings.</p> <p>The problem that I haven't b...
<p>Is there a reason you disable the asynchronous nature of the AJAX request? it will lock the browser until the request is completed. You are better off using a callback instead:</p> <pre><code>$.ajax({ type: "GET", url: "download.php?ajax=true", data: "what=" + what, dataType: "script", success: function(m...
<p>Is there a reason you disable the asynchronous nature of the AJAX request? it will lock the browser until the request is completed. You are better off using a callback instead:</p> <pre><code>$.ajax({ type: "GET", url: "download.php?ajax=true", data: "what=" + what, dataType: "script", success: function(m...
45,975
<p>I discovered <a href="http://en.wikipedia.org/wiki/Template_metaprogramming" rel="noreferrer">template metaprogramming</a> more than 5 years ago and got a huge kick out of reading <a href="https://rads.stackoverflow.com/amzn/click/com/0201704315" rel="noreferrer" rel="nofollow noreferrer">Modern C++ Design</a> but I...
<p>I once used template metaprogramming in C++ to implement a technique called "symbolic perturbation" for dealing with degenerate input in geometric algorithms. By representing arithmetic expressions as nested templates (i.e. basically by writing out the parse trees by hand) I was able to hand off all the expression ...
<p>Many programmers don't use templates much because of the poor compiler support up until recently. However, while templates have had a lot of issues in the pas, newer compilers have much better support. I write code that has to work with GCC on Mac and Linux as well as Microsoft Visual C++ and it's only with GCC 4 a...
8,895
<p>It may not be best practice but are there ways of removing unsused classes from a third party's jar files. Something that looks at the way in which my classes are using the library and does some kind of coverage analysis, then spits out another jar with all of the untouched classes removed.</p> <p>Obviously there ...
<p>There is a way.</p> <p>The JarJar project does this AFAIR. The first goal of the JarJar project is to allow one to embed third party libraries in your own jar, changing the package structure if necessary. Doing so it can strip out the classes that are not needed.</p> <p>Check it out at <a href="http://code.google....
<p>jar is just a zip file, so I guess you can. If you could get to the source, it's cleaner. Maybe try disassembling the class?</p>
5,921