instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Ok, so I want an autocomplete dropdown with linkbuttons as selections. So, the user puts the cursor in the "text box" and is greated with a list of options. They can either start typing to narrow down the list, or select one of the options on the list. As soon as they click (or press enter) the dataset this is linke...
<p>This widget can be made with three items: a text input, button input, and an unordered list to hold the results.</p> <pre><code> __________ _ |__________||v|__ &lt;-- text and button | | &lt;-- ul (styled to appear relative to text input) | | | | ...
<p>In my opinion, you shouldn't use AJAX for this at all. </p> <p>here's why:</p> <p>(1) On focus: ALL the options that he can select are shown in the dropdown. This means that all possible options are already sent to the client.</p> <p>(2) If the user types something in, the number of entries in the drop down are f...
6,165
<p>I have a table with one column and about ten rows. The first column has rows with text as row headers, "header 1", "header 2". The second column contains fields for the user to type data (<em>textboxes</em> and <em>checkboxes</em>). </p> <p>I want to have a button at the top labelled "<em>Add New...</em>", and h...
<p>Something along the lines of</p> <blockquote> <pre><code>function(table) { for(var i=0;i&lt;table.rows.length;i++) { newcell = table.rows[i].cells[0].cloneNode(true); table.rows[i].appendChild(newcell); } } </code></pre> </blockquote>
<p>Something along the lines of</p> <blockquote> <pre><code>function(table) { for(var i=0;i&lt;table.rows.length;i++) { newcell = table.rows[i].cells[0].cloneNode(true); table.rows[i].appendChild(newcell); } } </code></pre> </blockquote>
20,361
<p>I'd really like to get into some D3D coding, but I don't have the time lately to learn C++ for what will amount to a hobby project.</p>
<p>Threads are fine, but as others have noted, you have to be highly aware of your bottlenecks. Your algorithm sounds like it would be susceptible to cache contention between multiple CPUs - this is particularly nasty because it has the potential to hit the performance of all of your threads (normally you think of usi...
<p>The benefit of using threads is to reduce wall-clock execution time of your program by allowing your program to work on a different part of the job while another part is waiting for something to happen (usually I/O). If your program is totally CPU bound adding threads will only slow it down. If it is fully or part...
15,847
<p>I've asked this question over on the MSDN forums also and haven't found a resolution:</p> <p><a href="http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3686852&amp;SiteID=1" rel="nofollow noreferrer">http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=3686852&amp;SiteID=1</a></p> <p>The basic problem here as...
<p>To answer your question - it's not possible to instrument interop assemblies for code coverage. They contain only metadata, and no executable code as you mention yourself.</p> <p>Besides, I don't see much point in trying to code coverage the interop assembly. You should be measuring the code coverage of code you wr...
<p>Plan C:</p> <p>use something like <a href="http://www.mono-project.com/Cecil" rel="nofollow noreferrer">Mono.Cecil</a> to weave simple execution counters into the interop assembly. For example, check out this one section in the <a href="http://www.mono-project.com/Cecil:FAQ" rel="nofollow noreferrer">Faq</a>: "I wo...
12,472
<p>This is a follow on question to "<a href="https://stackoverflow.com/questions/33778/how-do-i-delete-1-file-from-a-revision-in-svn">How do I delete 1 file from a revision in SVN?</a>" but because it probably has a very different answer and I believe that others would benefit from knowing the answer. (I don't know the...
<p>With a simple </p> <pre><code>svn log -v [folder] </code></pre> <p>you can browse quickly the adding and deletion.</p> <pre><code>------------------------------------------------------------------------ r14 | kame | 2008-08-29 04:23:43 +0200 (ven., 29 aoû2008) | 1 line Chemins modifié : A /a.txt Readded a ---...
<p>I would have said you can't - you have created a new file and thus revision tree in the eyes of SVN.</p> <p>It may be possible to recover the old tree independently (not sure if you managed an actual delete or just SVN Delete) but there is no link between the old revision tree and the new one.</p>
5,394
<p>A long time ago when I was a young lat I used to do a lot of assembler and optimization programming. Today I mainly find myself building web apps (it's alright too...). However, whenever I create fields for database tables I find myself using values like 16, 32 &amp; 128 for text fields and I try to combine boolean ...
<p>Database optimization is quite unlike machine code optimization. With databases, most of the time you want to reduce disk I/O, and wastefully trying to align fields will only make less records fit in a disk block/page. Also, if any alignment is beneficial, the database engine will do it for you automatically.</p> <...
<p>Something that is implied above, but which can stand being made explicit. You don't have any way of knowing what the computer is actually doing. It's not like the old days when you could look at the assembler and know pretty well what steps the program is going to take. A value that "looks" like it's in a CPU regist...
26,367
<p>I've recently have a reason to include into our build script the creation of an XML configuration file. The most straightforward way I can think of to do this is to hard-code the XML content as a string into the script and then to simply create a file and write that XML string to the file (named appropriately etc). ...
<p>you could use an XmlWriter to avoid printing strings. This will make writing well-formed XML documents a lot easier. </p> <p>You can find free sample code in VBScript here</p> <blockquote> <p><a href="http://www.matthewflickinger.com/lab/xmlwriter/" rel="nofollow noreferrer">http://www.matthewflickinger.com/lab/...
<p>Very important read if you consider strings: <a href="http://hsivonen.iki.fi/producing-xml/" rel="nofollow noreferrer">HOWTO Avoid Being Called a Bozo When Producing XML</a></p>
44,164
<p>I want to scale an image in C# with quality level as good as Photoshop does. Is there any C# image processing library available to do this thing?</p>
<p>Here's a nicely commented Image Manipulation helper class that you can look at and use. I wrote it as an example of how to perform certain image manipulation tasks in C#. You'll be interested in the <strong>ResizeImage</strong> function that takes a System.Drawing.Image, the width and the height as the arguments.<...
<p>There's an <a href="http://www.codeproject.com/KB/GDI-plus/imageresize.aspx" rel="nofollow noreferrer">article on Code Project</a> about using GDI+ for .NET to do photo resizing using, say, Bicubic interpolation.</p> <p>There was also another article about this topic on another blog (MS employee, I think), but I ca...
31,035
<p>In my experience it seems that most people will tell you that it is unwise to force a garbage collection but in some cases where you are working with large objects that don't always get collected in the 0 generation but where memory is an issue, is it ok to force the collect? Is there a best practice out there for ...
<p>The best practise is to not force a garbage collection.</p> <p>According to MSDN:</p> <blockquote> <p>"It is possible to force garbage collection by calling Collect, but most of the time, this should be avoided because it may create performance issues. "</p> </blockquote> <p>However, if you can reliably...
<p>I do NOT recommend manual garbage collection. I assure you that you're not disposing of large objects properly. Make use of the USING statement. Whenever you instantiate an object, be sure to DISPOSE of it when you are through using it. This sample code creates a connection with USING statements. Then it instantiate...
28,915
<p>I have tried to use ASP.NET MVC for a while, then I face a problem that I don't want to include all of my js and css in master page. But how can I register it in head of master page from my specific view?</p>
<p>The default master page template includes a Content PlaceHolder for the head. If it doesn't you can easily add one:</p> <pre><code>&lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;asp:ContentPlaceHolder ID="head" runat="server" /&gt; &lt;/head&gt; </code></pre> <p>Your views can then put anythin...
<p>technically you should be putting all your js at the bottom of the page for the best performance. </p> <p>I think the only way you could do this though would be to include the javascript in the VIewData and have the ViewData displayed on the masterpage (not a great solution).</p>
41,349
<p>I am looking for a CSS-based web page template where the main content <code>div</code> occupies the full height of the view port (minus header and footer heights) when its content has few lines. The footer should be at the bottom of the viewport, rather than right below content, where it's more in the middle of the ...
<p>Example here: <a href="http://www.rossdmartin.com/aitp/index.htm" rel="nofollow noreferrer">http://www.rossdmartin.com/aitp/index.htm</a></p> <p>More in-depth resources:</p> <ul> <li><a href="http://www.themaninblue.com/experiment/footerStickAlt/" rel="nofollow noreferrer">http://www.themaninblue.com/experiment/fo...
<p>Look for "Footer Stick Alt"... there was a long blog write up on how to make this work.</p> <p><a href="http://www.themaninblue.com/writing/perspective/2005/08/29/" rel="nofollow noreferrer">Done by Cameron Adams a.k.a. "The Man in Blue"</a>.</p>
13,225
<p>For example, I issued an ALTER TABLE statement to create an index on a MEDIUMTEXT field in an InnoDB table that has 134k rows where the size of the index was 255 bytes and the average size of the data in the field is 30k. This command has been running for the last 15 minutes or so (and is the only thing running on ...
<p>I was able to perform these 2 queries and figure out how many rows remain to be moved.</p> <pre><code>select count(*) from `myoriginalrable`; select count(*) from `#sql-1e8_11ae5`; </code></pre> <p>this was WAY more helpful than comparing the file size on disk, because changing from myisam to innodb etc changes th...
<p><a href="http://www.percona.com/software/percona-server" rel="nofollow">Percona Server</a>, which is a branched version of MySQL with some enhancements, has this feature.</p> <p>You can observe extra columns in SHOW PROCESSLIST for ROWS_SENT and ROWS_EXAMINED. For example, if your table has 1000000 rows, and you s...
6,502
<p>I joined a new company about a month ago. The company is rather small in size and has pretty strong "start-up" feel to it. I'm working as a Java developer on a team of 3 others. The company primarily sells a service to for businesses/business-type people to use in communicating with each other.</p> <p>One of the ma...
<p>Your best bet is probably to refactor it slowly as you go along. Few us of have the resources that would be required to completely start from scratch with something that has so many business rules buried in it. Management really hates it when you spend months on developing an app that has more bugs than the one yo...
<p>The best way is to print out the code, crumple it up, and throw it out. Don't even recycle the paper.</p> <p>You've got an application that is written in 1,000+ line long JSPs. It probably has a god-awful Domain Model (if it even has one at all) and doesn't just MIX presentation with business logic, it BLENDS it an...
6,145
<p>What is the best available tool to monitor the memory usage of my C#/.Net windows service over a long period of time. As far as I know, tools like perfmon can monitor the memory usage over a short period of time, but not graphically over a long period of time. I need trend data over days, not seconds.</p> <p>To b...
<p>Perfmon in my opinion is one of the best tools to do this but make sure you properly configure the sampling interval according to the time you wish to monitor.</p> <p>For example if you want to monitor a process:</p> <ul> <li>for 1 hour : I would use 1 second intervals (this will generate 60*60 samples)</li> <li>f...
<p>I've used ProcessMonitor if you need something more powerful than perfmon.</p>
12,309
<p>I've got several developers about to start working on the front end of a jquery-based web application. How can we structure the application so that multiple developers can work on the ui at the same time. The end result for the user will just be one web "page", but I don't all of the client development to occur in o...
<p>If you're starting completely from scratch, you could break it up into the standard 3 tier architecture. </p> <p>Have one person working on the database structure and creating the appropriate access libraries to the data. </p> <p>Have one person working on the business/workflow tier, setting up all the interaction...
<p>It sounds like you already know which portion of the product you want which developers working on, and have planned the workloads to prevent overlap. Something like <a href="http://subversion.tigris.org/" rel="nofollow noreferrer">subversion</a> will allow you track who added which item to what document when, as we...
30,335
<p>Why wouldn't I choose abstract? What are the limitations to declaring a class member virtual? Can only methods be declared virtual?</p>
<p>An abstract method or property (both can be virtual or abstract) can only be declared in an abstract class and cannot have a body, i.e. you can't implement it in your abstract class.</p> <p>A virtual method or property must have a body, i.e. you must provide an implementation (even if the body is empty).</p> <p>If...
<p>If you want to give it an implementation in your base class you make it virtual, if you don't you make it abstract.</p> <p>Yes, only methods can be declared virtual.</p>
10,661
<p>I've seen the <code>@</code> symbol used in PowerShell to initialise arrays.</p> <p>What exactly does the <code>@</code> symbol denote and where can I read more about it?</p>
<p>PowerShell will actually treat any comma-separated list as an array:</p> <pre><code>"server1","server2" </code></pre> <p>So the @ is optional in those cases. However, for associative arrays, the @ is required:</p> <pre><code>@{"Key"="Value";"Key2"="Value2"} </code></pre> <p>Officially, @ is the "array operator."...
<p>I hope this helps to understand it a bit better. You can store &quot;values&quot; within a key and return that value to do something. In this case I have just provided @{a=&quot;&quot;;b=&quot;&quot;;c=&quot;&quot;;} and if not in the options i.e &quot;keys&quot; (a, b or c) then don't return a value</p> <pre><code>...
47,502
<p>We use GUIDs for primary key, which you know is clustered by default.</p> <p>When inserting a new row into a table it is inserted at a random page in the table (because GUIDs are random). This has a measurable performance impact because the DB will split data pages all the time (fragmentation). But the main reason I...
<p>It should be possible to create a sequential GUID in c# or vb.net using an API call to UuidCreateSequential. The API declaration (C#) below has been taken from <a href="http://www.pinvoke.net/default.aspx/rpcrt4/UuidCreateSequential.html" rel="noreferrer">Pinvoke.net</a> where you can also find a full example of how...
<p>The key problem is knowing what the last value was in a .NET application. SQL Server keeps track of this for you. You will need to hold the last value yourself and use the Guid constructor with a byte array containing the next value. Of course, on a distributed application this probably isn't going to help and you m...
25,993
<p>Which CMS are you using in Java and what is your experience with it (in terms of extensibility, usage comfort, framework API, memory usage, performance etc.). I am looking for suggestions.</p> <p>Specifically any one that supports a search engine(probably lucene or similar).</p>
<p>We are using <a href="http://www.opencms.org/en/" rel="nofollow noreferrer">opencms</a>. I haven't tried to extend it beyond changing page templates (writing JSPs) but where usage is concerned it gets the job done, albeit the feeling you get is that you fight the system all the way through. </p> <p>Memory consumpti...
<p>take a look at alfresco and day.com</p>
12,530
<p>I've implemented a custom item renderer that I'm using with a combobox on a flex project I'm working on. It displays and icon and some text for each item. The only problem is that when the text is long the width of the menu is not being adjusted properly and the text is being truncated when displayed. I've tried twe...
<p>Just a random thought (no clue if this will help):</p> <p>Try setting the parent HBox and the Label's widths to 100%. That's generally fixed any problems I've run into that were similar.</p>
<p>Have you tried using the <strong>calculatePreferredSizeFromData()</strong> method?</p> <pre><code>protected override function calculatePreferredSizeFromData(count:int):Object </code></pre>
12,954
<p>I have a web service, that takes an input xml message, transforms it, and then forwards it to another web service.</p> <p>The application is deployed to two web logic app servers for performance, and resilience reasons.</p> <p>I would like a single website monitoring page that allows two things</p> <ul> <li><p>ab...
<p>This sounds like a good match for <a href="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/" rel="nofollow noreferrer">Java Management Extensions (JMX)</a></p> <ul> <li>JMX allows you to expose certain operations (eg: start/stop forwarding messages)</li> <li>JMX allows you to monitor certain p...
<p>Sounds like you are looking for a Message Queue, some MDBs and a configurable design would let you do all these. Spring has support for JMS Queues if I'm not wrong</p>
20,956
<p>Has anybody used C# to write a sample screen scraper for IBM as400?</p>
<p><a href="http://www.codeproject.com/KB/cs/all_ehllapi.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/cs/all_ehllapi.aspx</a></p> <p>I've modified this example and it works just fine.</p>
<p>I wrote one in C many years ago for a project at Frigidaire. The internal card would cause all sorts of fun with memory leaks but I eventually found a solution by allocating arrays at the boundary of the communication card. This was over 8 years ago, I'm sure today's cards are much better and/or using native comm ...
9,050
<p>The Zend Framework based site I have been working on is now being migrated to its production server. This server turns out to be nginx (surprise!). Naturally the site does not work correctly as it was developed on Apache and relies on an htaccess file. </p> <p>My question is... anyone have any experience with this?...
<p>I know it's a pretty old thread but it might help some people anyway.</p> <p>Basically it redirects any 404 error to index.php, but if the file exists (type file) it will set the right root.</p> <p>I did it from the top of my head. It might not be working right away, and you have to put the right path and fastcgi ...
<p>If it were at all possible, I would recommend that they setup Apache on a nonstandard port accessible only from the Nginx box, and have Nginx proxy to Apache.</p> <p><a href="http://wiki.nginx.org/NginxHttpProxyModule" rel="nofollow noreferrer">Nginx Proxy documentation</a></p>
49,319
<p>I am looking to write a function like </p> <pre><code>ref String TestIt( int index ) { return this.TestArray[index]; }; </code></pre> <p>so that I could write code like:</p> <pre><code>MyClass.TestIt(0) = "Hello World"; </code></pre> <p>My goal is to mimic this c++ declaration</p> <pre><code>CString&amp; MyClas...
<p>To do this you need to write a setter property. Unfortunately, setters can’t take further arguments in C# so you won't be able to write this code 1:1 in C#. The closest you can get is a nested class with a default property:</p> <pre><code>class YourClass { public class Nested { public Nested(YourClass o...
<p>You don't need to return a reference to achieve your goal. String types are reference types but has special handling for comparisons. So if you just return a string from TestIt the equality check will do a string comparison.</p>
37,972
<p>How do you implement the fastest possible <a href="http://en.wikipedia.org/wiki/Gaussian_blur" rel="noreferrer">Gaussian blur</a> algorithm?</p> <p>I am going to implement it in Java, so <a href="http://en.wikipedia.org/wiki/Graphics_processing_unit" rel="noreferrer">GPU</a> solutions are ruled out. My application,...
<p>Math jocks are likely to know this, but for anyone else..</p> <p>Due to a nice mathematical propertiy of the Gaussian, you can blur a 2D image quickly by first running a 1D Gaussian blur on each row of the image, then run a 1D blur on each column. </p>
<p>There are several fast methods for gauss blur of 2d data. What you should know about.</p> <ol> <li>This is separable filter , so only require two 1d convolution. </li> <li>For big kernels you can process reduced copy of image and than upscale back.</li> <li>Good approximation can be done by multiple box filters (al...
12,378
<p>I am running a MakerBot Replicator 2. During the print, the printer just stops executing and I am running out of ways to troubleshoot.</p> <p>After restarting, I can load and extrude filament.</p> <p>I have replaced the SD card, and even borrowed one from another working replicator, and the freeze still occurs.</p...
<p>There are a few options. First your board could be overheating etc. That is harder to verify without some overpriced replacements. So to start lets take everything apart (photo and labeling is Strongly recommended). Then simply put it back together. Hopefully it is just a loose connection.</p>
<p>Seems like others have had similar issues: <a href="https://www.thingiverse.com/groups/engineering/topic:3849" rel="nofollow noreferrer">https://www.thingiverse.com/groups/engineering/topic:3849</a>. Their issue was a bit more mechanical than firmware, though. I hope this helps!</p> <p>You might also want to check ...
474
<p>I'm asking with regards to c#, but I assume its the same in most other languages.</p> <p>Does anyone have a good definition of <em>expressions</em> and <em>statements</em> and what the differences are?</p>
<p><strong>Expression:</strong> Something which evaluates to a value. Example: <em>1+2/x</em><br> <strong>Statement:</strong> A line of code which does something. Example: <em>GOTO 100</em></p> <p>In the earliest general-purpose programming languages, like FORTRAN, the distinction was crystal-clear. In FORTRAN, a stat...
<p>Most precisely, a statement must have a <strong>&quot;side-effect&quot;</strong> (i.e. <a href="https://stackoverflow.com/questions/602444/what-is-functional-declarative-and-imperative-programming/8357604#8357604">be imperative</a>) and an expression must <em>have</em> a <strong>value</strong> type (i.e. not the bot...
3,962
<p>In trying to figure out <a href="https://stackoverflow.com/questions/52981/cannot-delete-from-the-database">this problem</a> (which is still unsolved and I still have no clue what is going on), I am wondering if maybe an external reference to the table in question is causing the problem. For example, a trigger or v...
<p>Wow, I wouldn't have thought it, but there seems to be.. Good ole DB2.</p> <p>I find the publib db2 docs view very very handy by the way:</p> <p><a href="http://publib.boulder.ibm.com/infocenter/db2luw/v8//index.jsp" rel="nofollow noreferrer">http://publib.boulder.ibm.com/infocenter/db2luw/v8//index.jsp</a></p> <...
<p>You can write a query search the information schema views (definition column) to find the table in all views, triggers, procedure, etc. Not sure about FK &amp; indexes though. </p>
7,657
<p>I often have to convert a retreived value (usually as a string) - and then convert it to an int. But in C# (.Net) you have to choose either int16, int32 or int64 - how do you know which one to choose when you don't know how big your retrieved number will be? </p>
<p>Everyone here who has mentioned that declaring an Int16 saves ram should get a downvote.</p> <p>The answer to your question is to use the keyword "int" (or if you feel like it, use "Int32").</p> <p>That gives you a range of up to 2.4 billion numbers... Also, 32bit processors will handle those ints better... also (...
<p>If we're just talking about a couple numbers, choosing the largest won't make a noticeable difference in your overall ram usage and will just work. If you are talking about lots of numbers, you'll need to use TryParse() on them and figure out the smallest int type, to save ram.</p>
33,959
<p>In using our TeamCity Continuous Integration server we have uncovered some issues that we are unsure as to the best way to handle. Namely how to reference external applications that our application requires on the CI server. </p> <p>This was initially uncovered with a dependency on Crystal Reports, so we went and i...
<p>Where possible make the external dependencies part of your build system. For instance check the installer in to your version control system and have a step that checks it out and runs it in silent mode (many installers support a mode with no user action sometimes using the commandline /s).</p> <p>This way if you ne...
<p>If you use Maven to build, you can define your dependencies in the pom.xml file. They will then be automatically downloaded if necessary.</p>
14,557
<p>I have a large-ish Oracle table containing rows representing units of work, with columns for start time and end time in addition to other meta-data.</p> <p>I need to generate usage graphs from this data, given some arbitrary filtering criteria and a reporting time period. E.g., show me a graph of all of Alice's jo...
<p>In terms of getting the data out, you can use 'group by' and '<a href="http://www.techonthenet.com/oracle/functions/trunc_date.php" rel="nofollow noreferrer">truncate</a>' to slice the data into 1 minute intervals. eg: </p> <pre><code>SELECT user_name, truncate(event_time, 'YYYYMMDD HH24MI'), count(*) FROM job_tab...
<p>Your best bet is to have a table (a temporary one generated on the fly would be fine if the time-slice is dynamic) and then join against that.</p>
49,728
<p>I'm using the Apache Commons EqualsBuilder to build the equals method for a non-static Java inner class. For example:</p> <pre><code>import org.apache.commons.lang.builder.EqualsBuilder; public class Foo { public class Bar { private Bar() {} public Foo getMyFoo() { return Foo.this ...
<p>No. </p> <p>The best way is probably what you suggested: add a getFoo() method to your inner class.</p>
<p>yes:</p> <pre><code>public class Foo { public class Bar { public Foo getMyFoo() { return Foo.this; } } public Foo foo(Bar bar) { return bar.getMyFoo(); } public static void main(String[] arguments) { Foo foo1=new Foo(); Bar bar1=foo1.new Bar()...
39,906
<p>I recently got an Ender 3 V2 and when I go to Info -&gt; Version it says V1.0.0. <a href="https://www.creality.com/download/" rel="nofollow noreferrer">However online, there is V1.0.1 available.</a></p> <p>How can I update the Ender 3 V2. It is different as it isn't a ATMEL chip like the ATMEGA 2560 but rather an AR...
<p>I've designed similar sensor casings, sometimes the filament catches a ridge/ledge or part of the cavity, even when it is chamfered or rounded. The arm of the limit switch pushes the filament up, away from the filament straight path.</p> <p>Have you tried cutting the filament under a very sharp angle, that may work....
<p>Here is 3D model that better explains why it was catching and how to remedy the problem:</p> <p><a href="https://i.stack.imgur.com/ooe48.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ooe48.png" alt="enter image description here" /></a></p> <p><a href="https://i.stack.imgur.com/dTy92.png" rel="no...
1,705
<p>I am looking for open source or free data collaboration software. Specifically this is for a non-profit organization that wants to teach remote students how a foreign language. The idea is that an instructor would teach a class and there would be up to 10 students in the class at a time. The instructor would be ab...
<p>I know a few of the developers on the Carleton University developed <a href="http://code.google.com/p/blindside/" rel="nofollow noreferrer">Blindside Project</a>. They are actively developing an open-source web conferencing and presentation tool for e-learning, with the intent of eventually offering university cour...
<p>Although it's not what you're looking for, <a href="http://moodle.org/" rel="nofollow noreferrer">Moodle</a> might be of use to you if you're looking into having online courses. </p>
4,355
<p>I'm looking into the feasibility of adding a function to my Rails-based intranet site that allows users to upload files.</p> <p>Two purposes: My users are widely distributed geographically and linking to documents on the shared network storage doesn't always work (different addresses, DNS entries and stuff outside ...
<p>You could read the data from the params object, and write it straight to your model.</p> <p>For example, you could have a form like this.</p> <pre><code>&lt;% form_for :upload, :url =&gt; {:action=&gt;:upload}, :html=&gt;{:multipart=&gt;true} do |f| %&gt; &lt;%= f.file_field :file %&gt; &lt;%= f.submit 'Upload...
<p>So this code in my controller:</p> <pre><code> def upload file_content = params[:upload][:file] render :text =&gt; [ [:original_path, :content_type, :local_path, :path, :original_filename].collect {|m| file_content.send(m)}, file_content.class, file_content.size.to_s].flatten.join("&lt;b...
37,315
<p>Simple question: Can I mix in my desktop application Java and JavaFX Script code? If it is possible could you provide me with some link with examples? Or could I pack my custom made javafx CustomNode-s in a jar and use them in my project side by side with standard SWING components?</p>
<p><a href="http://java.dzone.com/news/calling-javafx-from-java" rel="nofollow noreferrer">This article</a> gives an example of calling JavaFX from Java, using the <a href="http://java.sun.com/javase/6/docs/technotes/guides/scripting/programmer_guide/index.html" rel="nofollow noreferrer">Scripting API</a>.</p>
<p>Supposedly all you have to do is drag and drop the JavaFX application to your desktop in order to make it a desktop application. You can also use Java code in a JavaFX application. Not sure about the other way around.</p>
46,922
<p>We're looking to encrypt a field using DB-side encryption via NHibernate (most examples we've come across are app-side, which is not what we would like). The issue has been raised a couple of times, but no answers yet it seems. </p> <p>On SQL Server 2005, for instance, and forgetting key-related issues for now, thi...
<p>Posted outline of nasty hack on the <a href="http://forum.hibernate.org/viewtopic.php?p=2400105#2400105" rel="nofollow noreferrer">NHibernate forum</a></p>
<p>There is a project on SourceForge, MindLib, that has useful NHibernate utility functions and libraries. One of those is an EncryptedString library which allows you to store an encrypted string. Unfortunately, this is not doing it on the server side, as you originally requested.</p> <p>I've been looking for someth...
37,054
<p>How can I hide the title bar from a Windows Form but still have a Resizing Frame?</p>
<p>Setting FormBorderStyle = None will remove the title bar (at both design and run time) - and also remove your ability to resize the form.</p> <p>If you need a border you can set:</p> <pre><code>ControlBox = false Text = "" </code></pre>
<p>Set the ControlBox property of the form to False, and the Text property to empty string. The form will open with no perceivable (to the user) title bar, but they will be able to resize the form.</p>
11,932
<p>I am building a fun little app to determine if I should bike to work.</p> <p>I would like to test to see if it is either Raining or Thunderstorm(ing).</p> <pre><code>public enum WeatherType : byte { Sunny = 0, Cloudy = 1, Thunderstorm = 2, Raining = 4, Snowing = 8, MostlyCloudy = 16 } </code></pre> <p>I was think...
<p>Your current code will say whether it's <em>exactly</em> "raining and thundery". To find out whether it's "raining and thundery and possibly something else" you need:</p> <pre><code>if ((currentWeather.Type &amp; _badWeatherTypes) == _badWeatherTypes) </code></pre> <p>To find out whether it's "raining <em>or</em> ...
<p>You need to use the [Flags] attribute (<a href="http://weblogs.asp.net/wim/archive/2004/04/07/109095.aspx" rel="nofollow noreferrer">check here</a>) on your enum; then you can use bitwise and to check for individual matches.</p>
19,881
<p>How would I go about creating a Google map that allows the user to zoom beyond the default zoom levels for the map? Would I have to create a new map type that has a greater maximum zoom? Are there any tutorials out there that show how to do this?</p>
<p>I'm not familiar enough with the Decimal class to help you out, but your problem is due to the fact that decimal fractions can often not be accurate represented in binary, so what you're seeing is the closest possible approximation; there's no way to avoid this problem without using a special class (like Decimal, pr...
<p>Also see <a href="https://stackoverflow.com/questions/249467/what-is-a-simple-example-of-floating-pointrounding-error">What is a simple example of floating point error</a>, here on SO, which has some answers. The one I give actually uses python as the example language...</p>
36,340
<p>In my slicing software (Slic3r) some of the vertices/walls of my model seem to have disappeared, so that the inside of the model - which should be solid - is visible, while the surface appears as a thin shell.</p> <p>Why does this happen? Is it still safe to export the model for printing?</p>
<p>My understanding is that this occurs when the object is not a true solid. Since an STL holds the triangulation of each face and spline, the slicing engine is not &quot;smart&quot; enough to determine if there is a gap in the model and therefore if it should be filled in and how. When the slicer encounters a gap, it ...
<p>Had similar problems with blender &lt;-> Slic3r, modified a stl in blender then slic3r started acting up, showing strange faces where it shouldn't. The solution was (as suggested by @tbm0115) to solidify the exported object. Just add a Solidify modifier to the object(no need to apply), and when exporting to stl make...
121
<p>I am big into code generation for the service/data layer of my apps. What I would really love to do is generate some basic WPF Controls, Data Templates, or some other XAML code based on the metadata I use to generate my service/data layer. EDIT: This generation is done before compile time.</p> <p>What I envision i...
<p>Use <code>Grid.SetColumn( UIElement, value )</code> &amp; <code>Grid.SetRow( UIElement, value )</code>.</p>
<p>If I understand correctly, you want to generate XAML dynamically, then parse it and use it?</p> <p>If so, you can parse/load it into memory using System.Windows.Application.LoadComponent(Uri uri). OR you can use XamlReader.Load(...).</p> <p>Edit (read the question again, so adding some things): You can use WPF Sty...
49,959
<p>I'd like to create a basic "Hello World" style application for the IPhone using Java - can anyone tell me how?</p>
<p>You can't code in Java for iPhone. The iPhone only supports C/C++/Objective-C - Cocoa.</p> <p>However, under the current license you can use translation tools that generate such code. There are several solutions that do exactly that:</p> <p><a href="http://www.codenameone.com/" rel="nofollow noreferrer">Codename O...
<p>According to <a href="http://www.mono-project.com/Mono:Iphone" rel="nofollow noreferrer">http://www.mono-project.com/Mono:Iphone</a> Mono has been ported to the iPhone and is available as a commercial product named MonoTouch. This might be a good way to get up and running quickly if you know C# but not Objective C....
28,435
<p>I have a Progress database that I'm performing an ETL from. One of the tables that I'm reading from does not have a unique key on it, so I need to access the ROWID to be able to uniquely identify the row. What is the syntax for accessing the ROWID in Progress?</p> <p>I understand there are problems with using ROW...
<p>A quick caveat for my answer - it's nearly 10 years since I worked with <a href="http://www.progress.com/" rel="noreferrer">Progress</a> so my knowledge is probably more than a little out of date.</p> <p>Checking the <a href="http://www.psdn.com/library/servlet/KbServlet/download/1078-102-885/langref.pdf" rel="nore...
<p>A quick google search turns up this: <a href="http://bytes.com/forum/thread174440.html" rel="nofollow noreferrer">http://bytes.com/forum/thread174440.html</a></p> <p>Read the message towards the bottom by greg@turnstep.com (you either want oid or ctid depending on what guarantees you want re persistence and unique...
12,298
<p>I have been having some issues with LINQ-To-SQL around memory usage. I'm using it in a Windows Service to do some processing, and I'm looping through a large amount of data that I'm pulling back from the context. Yes - I know I could do this with a stored procedure but there are reasons why that would be a less th...
<p>A DataContext tracks all the objects it ever fetched. It won't release this until it is garbage collected. Also, as it implements <code>IDisposable</code>, you must call <code>Dispose</code> or use the <code>using</code> statement.</p> <p>This is the right way to go:</p> <pre><code>using(DataContext myDC = new D...
<p>I just ran into a similar problem. In my case, helped establish the properties of <strong>DataContext.ObjectTrackingEnabled</strong> to false. But it works only in the case of iterating through the rows as follows:</p> <pre><code>using (var db = new DataContext()) { db.ObjectTrackingEnabled = false; var do...
14,976
<p>Ruby has two different exceptions mechanisms: Throw/Catch and Raise/Rescue.</p> <p>Why do we have two?</p> <p>When should you use one and not the other? </p>
<p>I think <a href="http://hasno.info/ruby-gotchas-and-caveats" rel="noreferrer">http://hasno.info/ruby-gotchas-and-caveats</a> has a decent explanation of the difference:</p> <blockquote> <p>catch/throw are not the same as raise/rescue. catch/throw allows you to quickly exit blocks back to a point where a catch is ...
<p><a href="https://coderwall.com/p/lhkkug/don-t-confuse-ruby-s-throw-statement-with-raise" rel="noreferrer">https://coderwall.com/p/lhkkug/don-t-confuse-ruby-s-throw-statement-with-raise</a> offers an excellent explanation that I doubt I can improve on. To summarize, nicking some code samples from the blog post as I g...
7,387
<p>I have string like this</p> <pre><code> /c SomeText\MoreText "Some Text\More Text\Lol" SomeText </code></pre> <p>I want to tokenize it, however I can't just split on the spaces. I've come up with somewhat ugly parser that works, but I'm wondering if anyone has a more elegant design.</p> <p>This is in C# btw.</p> ...
<p>The computer term for what you're doing is <a href="http://en.wikipedia.org/wiki/Lexical_analysis" rel="nofollow noreferrer">lexical analysis</a>; read that for a good summary of this common task.</p> <p>Based on your example, I'm guessing that you want whitespace to separate your words, but stuff in quotation mark...
<p><a href="https://stackoverflow.com/questions/54866/best-way-to-parse-space-seperated-text#54880">Craig</a> is right &#8212; use regular expressions. <a href="http://msdn.microsoft.com/en-us/library/8yttk7sy.aspx" rel="nofollow noreferrer">Regex.Split</a> may be more concise for your needs.</p>
7,851
<p>Using NHibernate ICriteria and adding .AddOrder ... I want to sort by a property that is sometimes null with all the populated ones at the top. Will .AddOrder allow me to do this? If not is there an alternative? </p> <p>The sorting options for ILists leave a lot to be desired. </p>
<p>You should get the non-null values first by using that method. We use sorting in that way on my project, and have not had any issues with the null values... they get listed at end.</p>
<p>You should get the non-null values first by using that method. We use sorting in that way on my project, and have not had any issues with the null values... they get listed at end.</p>
18,095
<p>I'm trying to bind the following shortcut: <strong>Ctrl + W</strong> to close tabs</p> <p>How can you customize VS to add/change shortcuts? Also, what are the most useful shortcuts you guys have found?</p>
<p>Tools > Options > (Show all settings), then Environment > Keyboard.</p> <p>Here, rebind the key “File.Close” to <kbd>Ctrl</kbd>+<kbd>W</kbd>.</p>
<p><kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>Space</kbd> shows the syntax/overloads for the current function you are typing parameters for.</p>
4,600
<p>Here's what it looks like <a href="https://i.stack.imgur.com/XjFer.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XjFer.jpg" alt="enter image description here"></a></p> <p>This is the model <a href="https://www.thingiverse.com/thing:2991851" rel="nofollow noreferrer">thingiverse linky</a></p> <...
<p>No, <strong><em>your problem is not related to slicing</em></strong>, <strong><em>this is a hardware problem</em></strong>. Your complete print has shifted, this is called <a href="https://www.simplify3d.com/support/print-quality-troubleshooting/#layer-shifting-or-misalignment" rel="nofollow noreferrer">layer shift<...
<p>There are many problems caused with this. It could be a faulty motors, an unlevel bed, a dirty nozzle, or even something as simple as using the wrong filament settings. It would be best to go through a checklist of things that might be wrong with your printer. It could also just be caused by the wear and tear of a ...
1,163
<p>When java was young, people were excited about writing applets. They were cool and popular, for a little while. Now, I never see them anymore. Instead we have flash, javascript, and a plethora of other web app-building technologies.</p> <p>Why don't sites use java applets anymore?</p> <p>I'm also curious: histo...
<p>I think Java applets were overshadowed by Flash and ActionScript (pun unintended), being much easier to use for what Java Applets were being used at the time (animations + stateful applications). </p> <p>Flash's success in this respect in turn owes to its much smaller file sizes, as well as benefiting from the Sun ...
<p>The JVM is very widespread, especially in the coorporate world, at least where I've worked, there was always a JVM installed.</p> <p>I'm currently working on a Java Applet, but in general, I would never an applet unless I had to. But then again, I wouldn't use Flash or Silverlight, either. Applets have a slow load ...
7,444
<p>In WinXP (SP2) you can store mapped network passwords...</p> <p>Start->Control Panel->User Accounts->Pick one then choose "Manage my network passwords" from Related Tasks.</p> <p>I normally have about 25-30 servers mapped this way to a few different accounts/domains. The problem is that at some point during our p...
<ul> <li><a href="http://technet.microsoft.com/en-us/library/cc754243.aspx" rel="nofollow noreferrer">cmdkey.exe</a> is the CLI version of the tool - but I believe it's only included on Win2003+. I'd suspect a copy to XP would work - but may violate your EULA.</li> <li><a href="http://technet.microsoft.com/en-us/librar...
<p><a href="http://www.ss64.com/nt/net_use.html" rel="nofollow noreferrer">NET USE</a>(command) and <a href="http://www.ss64.com/wsh/drivemap.html" rel="nofollow noreferrer">WshNetwork.MapNetworkDrive</a>(windows scripting host) are two common ways of scripting the mapping of network drives, both allow you to specify u...
24,318
<p>While refactoring some old code I have stripped out a number of public methods that should actually of been statics as they a) don't operate on any member data or call any other member functions and b) because they might prove useful elsewhere.</p> <p>This led me to think about the best way to group 'helper' functi...
<p>Overhead is not an issue, namespaces have some advantages though</p> <ul> <li>You can reopen a namespace in another header, grouping things more logically while keeping compile dependencies low</li> <li><p>You can use namespace aliasing to your advantage (debug/release, platform specific helpers, ....)</p> <p>e.g...
<p>The main advantage to using a namespace is that you can reopen it and add more stuff later, you can't do that with a class. This makes this approach better for loosely coupled helpers (for example you could have a Helpers namespace for your entire library, much like all of STL is in ::std)</p> <p>The main advantag...
10,609
<p>Is it possible in ASP.NET to take a string containing some HTML and make ASP.NET to parse it and create a Control for me? For example:</p> <pre><code>string rawHTML = "&lt;table&gt;&lt;td&gt;&lt;td&gt;Cell&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;"; HTMLTable table = MagicClass.ParseTable(rawHTML); </code></pre> <p>I kn...
<p>The closest I think you'll get is <a href="http://msdn.microsoft.com/en-us/library/kz3ffe28.aspx" rel="noreferrer">Page.ParseControl</a>, which is the ASP.NET parser. The downside is that the text you have <em>is</em> a LiteralControl, since it doesn't have runat="server" on it - so you 'll do a very tiny bit of str...
<p>You could traverse the HTML string a token at a time (token defined here as HTML Element or HTML InnerText), and determine which control needs to be instantiated, and what attributes it needs. But, that would be something highly... evil in the writing. </p> <p>Why exactly do you need it to be a "proper" control as ...
30,872
<p>I'm developing a Django app, and I'm trying to use Python's logging module for error/trace logging. Ideally I'd like to have different loggers configured for different areas of the site. So far I've got all of this working, but one thing has me scratching my head.</p> <p>I have the root logger going to sys.stderr...
<p>Allow me to answer my own question. The underlying problem here is that settings.py gets imported twice, or maybe even more (See <a href="http://www.mail-archive.com/django-users@googlegroups.com/msg39059.html" rel="noreferrer">here</a>). (I still don't understand why this is. Maybe some Django expert could expla...
<p>A hackish way, but you can try to put the logging code inside an admin.py. It is supposed to be imported only once.</p> <p>Alternatively; can you first check if <code>MyApp.views.scans</code> log exists? If it exists (maybe an error is raised) you can simply skip creation (and therefore not add the handler again). ...
44,517
<p>I've written a .NET console app that wraps CuteFTP's Transfer Engine - a COM object (ftpte). The version I wrapped is CuteFTP 7.0. I'd like to also support the 8.0 version, as some of the clients I integrate with have that version.</p> <p>I have a reference in my Visual Studio project to the CuteFTP COM object......
<p>You need to reference the lowest version you need to support, and given that the new version do not change the API, but just add new functionality, you should be OK. But it clearly depends on application developers to not break the API.</p> <p>That way, you will miss any new functionality added in the newer version...
<p>Look at my hobby open source project <a href="http://www.codeplex.com/msofficefornet" rel="nofollow noreferrer">MS Office Wrapper for .NET</a>. There is used a "late-binding" which allows you to use a different version of COM libraries.</p>
32,339
<p>Please give me the advantages and disadvantages of using the particular framework.</p> <p>Can give me examples of successes where you have used AOP in you .net applications?</p>
<p>Index your databases differently. You probably need different indexes (maybe fewer indexes) to suppor the process of writing to the Write database than you do with the read database. If an index is only used for reading, then leave it off the Write database.</p> <p>I'm no expert on this, and my thinking might b...
<p>The most obvious difference will be the differing indexes required. Disk IO pattern will also be different but don't forget that the read database is also being written to by the replication procedure, you can't just optimise it completly for read. Other differences may also be evident in things like optimum memory ...
30,592
<p>I'm using MySQL 5.0.45 on CentOS 5.1.</p> <p><code>SELECT DISTINCT(email) FROM newsletter</code></p> <p>Returns 217259 rows</p> <p><code>SELECT COUNT(DISTINCT(email)) FROM newsletter</code></p> <p>Returns 180698 for the count.</p> <p><code>SELECT COUNT(*) FROM (SELECT DISTINCT(email) FROM newsletter) AS foo</co...
<p>could you possibly intersect the differing results to see what the extra rows are?</p>
<p>In the first case, what happens if you change it to "<code>select distinct(email) from newsletter order by email;</code>" I don't think it should make a difference, but it might.</p>
30,275
<p>I'm having a lot of issues leveling my printer and one failed print came out like this. Is there something wrong with the surface that I need a new bed? This happens to me quite often and I literally can't get it off.</p> <p><a href="https://i.stack.imgur.com/vOVeZ.jpg" rel="nofollow noreferrer" title="Magnetic bed ...
<p>Presuming that you're talking about an 8 hour period, your printer should be designed to run for 8 hours continuous anyway, so nothing will happen regarding the bed or screen that wouldn't happen with a normal print.</p> <p>If the first few layers stick to the bed, it's likely that you're print will at least be part...
<p>There are software solutions like &quot;Spaghetti Detective&quot; (recently renamed to &quot;Obico&quot;) which can watch your print via a camera, and potentially stop the job if it looks bad.</p> <p>Most of the time my print failures come early, in the form of poor bed adhesion - watch the job start for a while be...
2,157
<p>I'm trying to get the name of the executable of a window that is outside my C# 2.0 application. My app currently gets a window handle (hWnd) using the GetForegroundWindow() call from "user32.dll".</p> <p>From the digging that I've been able to do, I think I want to use the GetModuleFileNameEx() function (from PSAPI...
<p>You can call <a href="http://msdn.microsoft.com/en-us/library/ms633522(VS.85).aspx" rel="nofollow noreferrer">GetWindowThreadProcessId</a> and that will return you the process associated with the window.</p> <p>From that, you can call <a href="http://msdn.microsoft.com/en-us/library/ms684320.aspx" rel="nofollow nor...
<p>try this to get the file name of the executable :</p> <p>C#:</p> <pre><code>string file = System.Windows.Forms.Application.ExecutablePath; </code></pre> <p>mfg</p>
34,960
<p>Let's face it: writing proper, standards compliant HTML is quite difficult to do. Writing semantic HTML is even more so, but I don't think it's possible for a computer to figure that out.</p> <p>So my question to you is what would the "ideal" feedback for a user who entered HTML be? Would it be a W3C validator styl...
<p>I had a similar problem:</p> <p><a href="https://stackoverflow.com/questions/34183/cnet-why-is-my-processstart-hanging">C#.Net: Why is my Process.Start() hanging?</a></p> <p>It seems that Microsoft, in all their infinite wisdom, has blocked batch files from being executed by IIS in Windows Server 2003. Brenden Tom...
<p>Not sure how you are using 'shell()' but <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx?ppud=4" rel="nofollow noreferrer">Process.Start</a> is the way to go.</p>
18,763
<p>Does anyone see server-side JavaScript taking off? There are a couple of implementations out there, but it all seems to be a bit of a stretch (as in, "doing it BECAUSE WE CAN" type of attitude). </p> <p>I'm curious to know if anyone actually writes JavaScript for the server-side and what their experiences with it h...
<p>I like to read Googler Steve Yegge's blog, and recently I came across <a href="http://steve-yegge.blogspot.com/2008/06/rhinos-and-tigers.html" rel="nofollow noreferrer" title="Rhinos and Tigers">this article of his</a> where he argues that <a href="http://www.mozilla.org/rhino" rel="nofollow noreferrer" title="Mozil...
<p>I can't see most developers getting over their distaste for client-side JavaScript programming. I'd rather go to Java for server-side stuff before choosing JavaScript.</p>
3,810
<p>I have implemented what I thought was a pretty decent representation of MVC in several web applications but since having joined crackoverflow, I'm finding that perhaps my initial definitions were a bit simplistic and thus I'd really like some clarification on the differences between the Data Access Layer and the Mod...
<p>The <strong>model</strong> classes stand alone as a good, clean, high-fidelity model of real-world entities. If it's a business domain, they might be customers, plans, products, payments, all that kind of stuff. Your application works with these classes. The idea is that your application is a model of real-worl...
<p>It's just a matter of higher abstraction. If you think about some business problem you are about to solve, you want to think about it in terms of concepts (entities, relationships, processes, etc.) of that business, not in terms of database objects or on more detailed level, in terms of internals of some specific da...
24,095
<p>Here's my situation:</p> <ul> <li>Windows Server</li> <li>Apache</li> <li>CruiseControl</li> </ul> <p>The last step of my CruiseControl deploy scripts copies the build to Apache's htdocs folder, in a "demos" folder (I believe this is referred to as a "hot deploy"?)</p> <p>All is good and dandy, except that SOMETI...
<p>I would suggest creating a backup of the old files prior to copying the new files out. Name the old files with the timestamp for when they were replaced. Doing this and then seeing what is in the directory the next time it fails will most likely give you a clue as to where to look next.</p>
<p>Apache won't delete the contents of the directory. Something in the script is removing the contents would be my guess. Does the script create a backup of any kind? Maybe it moves the contents to a backup folder and then copies the build. </p> <p>You could add a bit of security to that folder to prevent its deletion...
16,002
<p>I am using Spry (<code>SpryData.js,xpath.js</code>)</p> <pre><code> var ds1 = new Spry.Data.XMLDataSet("_db/db.xml", "bildiriler/bildiri",{useCache:false}); // load the xml tree </code></pre> <p>....</p> <pre><code>&lt;!-- use it in a loop - Sometimes the page use "ds1.loadData();" to refresh the data --&gt...
<p>I am not quite good at Spry, but can't you add a css background to the div placeholder (&lt;div spry:region="ds1" ...) which will be shown at all time (and probably can be replaced through an observer that sets the background-image of the placeholder when the rows are loaded)...</p>
<p>Yes. I found it (strangely, not from the docs of Spry on <a href="http://labs.adobe.com/technologies/spry" rel="nofollow noreferrer">http://labs.adobe.com/technologies/spry</a>) I found it from this example -> <a href="http://www.infoaccelerator.net/blog/archives.cfm/date/2006/7" rel="nofollow noreferrer">http://www...
20,948
<p>What is this error? </p> <pre><code>cannot find symbol, symbol: method getstring(java.lang.String) Location: class InternalFrameDemo if &lt;!windowTitleField.getText().equals(getstring("InternalFrameDemo.frame_label"))) </code></pre>
<p>Java is case-sensitive. Because "getstring" is not equal to "getString", the compiler thinks the "getstring" method does not exist in the InternalFrameDemo class and throws back that error.</p> <p>In Java, methods will generally have the first letter of each word after the first word capitalized (e.g. toString(), t...
<p>Perhaps getstring() should be getString()?</p> <p>Basically it is saying InternalFrameDemo has no getstring() method.</p>
22,450
<p>I'm struggling to find the name of a connector I just broke, so I can order a new one.</p> <p>It's a six pin nylon terminal, that plugs into a set of header pins on a stepper motor.</p> <p>What do I search for to find these?! Also, how would I go about finding something like this in the future? I seem to struggle to...
<p>Short answer: It's probably 6 pin JST PH</p> <p>Long answer:</p> <p>Without seeing the socket, it's hard to say for sure, however most Nema 17 stepper motors use 6 pin JST PH connectors with 2.0mm pitch on the motor side. Many control boards use JST XH connectors with 2.5mm pitch on the board side. The two are not c...
<p>In an attempt to salvage my (sadly) previously incorrect answer (at the bottom), <em>and</em> to add to <a href="https://3dprinting.stackexchange.com/a/18388/4762">anttix's superlative answer</a>, here is a quote from <a href="https://gulfcoast-robotics.com/pages/stepper-cable-for-mks-boards-pinout" rel="nofollow no...
2,051
<p>As a lot of people pointed out in <a href="https://stackoverflow.com/questions/4724/learning-lisp-why">this question</a>, Lisp is mostly used as a learning experience. Nevertheless, it would be great if I could somehow use my Lisp algorithms and combine them with my C# programs. In college my profs never could tell...
<p>Try these .Net implementations of Lisp:</p> <ul> <li><a href="https://github.com/leppie/IronScheme" rel="nofollow noreferrer">IronScheme</a></li> </ul> <blockquote> <p>IronScheme will aim to be a R6RS conforming Scheme implementation based on the Microsoft DLR.</p> </blockquote> <ul> <li><a href="https://gi...
<p>If it's merely the routines you want to use you might try LSharp, which lets you have Lisp expressions in .NET:</p> <p><a href="http://www.lsharp.org/" rel="nofollow noreferrer">http://www.lsharp.org/</a></p> <p>The other way around (using .NET from Lisp) would be RDNZL:</p> <p><a href="http://www.weitz.de/rdnzl/...
9,543
<p>As they are in .Net 3.5. I know they are in 4.0, as that's what the DLR works with, but I'm interested in the version we have now.</p>
<p>In the early draft of the C# 3.0 spec there was a comment in the margin of the section on expression trees that said:</p> <blockquote> <p>I have a truly marvellous proof of Turing-completeness which this margin is too narrow to contain.</p> </blockquote> <p>Sadly no one has been able to find out who wrote it or ...
<p>Well, why don't you try to prove it? I bet it's a fun challenge ;)</p> <p>But expression trees only represent an expression and as such you'll have to define what you are allowed to do, as stated by Earwicker.</p> <p>If you allow expression trees to use recursion you can achieve repetition i.e. for loops and such....
31,149
<p>There's a famous bug in Visual Studio that prevents you from using the form designer on a subclass of an abstract form. </p> <p>This problem has already been elucidated and solved most elegantly by <a href="http://www.urbanpotato.net/default.aspx/document/2001" rel="nofollow noreferrer" title="Please read this pag...
<p>If it were me, I'd try attaching a debugger (maybe another instance of Visual Studio) to the instance that throws the error dialog, and see if the stack trace gives you any insights into what's causing the error.</p>
<p>The reason your are getting this problem might be that your base form is an abstracted class. The reason why the IDE will crashes is because the IDE tries to create an instance of the the abstract class which it cannot do. </p> <p>It might be that you accidentally marked the internal class as abstract too.</p> <p>...
21,020
<p>SQL Server 2000 Guru's,</p> <p>I've setup SQL 2000 to accept HTTP Queries i.e. <a href="http://74.22.98.66/MYDATABASE?sql=" rel="nofollow noreferrer">http://74.22.98.66/MYDATABASE?sql=</a>{CALL+sp_XMLDATA}+&amp;root=root (ficticious url) It works great and returns the following XML via I.E.7 url -</p> <pre><code>...
<p>This may be a job for <a href="http://tutorials.freeskills.com/sql-server-2000-and-xml-part-5-xml-templates.htm" rel="nofollow noreferrer">XML Templates</a>. When using a template you can control the header and make it exactly the way you want it.</p>
<p>What I have found out: in common case content-length is not a XML header attribute, <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html" rel="nofollow noreferrer">it's a HTTP field</a>. Need more information:<br> Which technology are you using to retrieve XML data from SQL server?<br> Are there any troub...
39,855
<p>How do I use <a href="http://www1.cs.columbia.edu/~lok/csharp/refdocs/System.Xml.XPath/types/XPathNavigator.html#Evaluate(System.String)" rel="nofollow noreferrer">XPathNavigator.Evaluate</a> ( or other methods in XPathNavigator) to obtain the ISBN value for the following xml input?</p> <pre><code>&lt;?xml version=...
<p>If you want to declare the dictionary once and never change it then declare it as readonly:</p> <pre><code>private static readonly Dictionary&lt;string, string&gt; ErrorCodes = new Dictionary&lt;string, string&gt; { { "1", "Error One" }, { "2", "Error Two" } }; </code></pre> <p>If you want to dictionar...
<pre><code>public static class ErrorCode { public const IDictionary&lt;string , string &gt; m_ErrorCodeDic; public static ErrorCode() { m_ErrorCodeDic = new Dictionary&lt;string, string&gt;() { {"1","User name or password problem"} }; } } </code></pre> <p>Probably initi...
40,391
<p>Having started with an Ender 3, it just seemed natural to me that the heatbreak should not be load-bearing; Creality's stock hotend has 2 bolts holding the heat block to the heat sink, which of course waste some heating power and increase the cooling needed to avoid heat creep, but serve the important purpose of kee...
<p>The drop-in replacement all metal hotends for the Ender 3 that I've looked at seem to have the two screws -- though I've read/heard opinions that these are intended to be removed after assembly, these are common Mk. 8 type hot ends, but with 2 mm bore through the entire heat break instead of 4 mm. That seems to be ...
<p>You ask in general, not specifically for Ender, so since you mention the Mosquito, which has a characteristic shape and a size, the obvious alternative which doesn't cost that much is the Phaetus Dragon.</p> <p>It copies the idea of the Mosquito, but it is repackaged in a shape and size fully equivalent to standard ...
1,973
<p>I'm experiencing this weird problem which my scrollbar jumps by itself to somewhere that I don't want it to. </p> <p>I have a table with scrollbar inside this page, if the user have a smaller screen, the page automatically adds a scrollbar. If I scroll down to the bottom of the table and click on it, the scrollbar ...
<p>There are a number of things that can be causing this.</p> <ul> <li>You clicked on a hyperlink with a href of "#", which will cause most browsers to scroll to the top of the page,</li> <li>There's possibly a CSS <code>:focus</code> or <code>:active</code> rule somewhere being triggered that causes the height of the...
<p>My scrollbar jumps when I hit Page Up or Page Down. Also, my laptop trackpad can cause odd mouse behavior if I bounce my thumb against it.</p> <p>And when I poured a large Latte into my keyboard, I had problems, then. But then the whole computer stopped working about an hour later.</p>
43,533
<p>What's a better way to start a thread, <code>_beginthread</code>, <code>_beginthreadx</code> or <code>CreateThread</code>?</p> <p>I'm trying to determine what are the advantages/disadvantages of <code>_beginthread</code>, <code>_beginthreadex</code> and <code>CreateThread</code>. All of these functions return a th...
<p><code>CreateThread()</code> is a raw Win32 API call for creating another thread of control at the kernel level.</p> <p><code>_beginthread()</code> &amp; <code>_beginthreadex()</code> are C runtime library calls that call <code>CreateThread()</code> behind the scenes. Once <code>CreateThread()</code> has returned, ...
<p>There is no difference anymore between the both. </p> <p>All comments about memory leaks etc are based on very old &lt; VS2005 versions. I've done some stress testing years ago and could debunk this myth. Even Microsoft mixes the styles in their examples, almost never using _beginthread. </p>
42,955
<p>I have a <code>Dictionary&lt;string, someobject&gt;</code>.</p> <p>EDIT: It was pointed out to me, that my example was bad. My whole intention was not to update the references in a loop but to update different values based on differnt threads need to update/get the data. I changed the loop to a method.</p> <p>I ne...
<p>Locking on an object that is accessible outside of the code locking it is a big risk. If any other code (anywhere) ever locks that object you could be in for some deadlocks that are hard to debug. Also note that you lock the <em>object</em>, not the reference, so if I gave you a dictionary, I may still hold refer...
<p>In your example, you can not do what you want to do! </p> <p>You will get a <strong>System.InvalidOperationException</strong> with a message of <strong>Collection was modified; enumeration operation may not execute.</strong></p> <p>Here is an example to prove:</p> <pre><code>using System.Collections.Generic; usi...
19,051
<p>I want to perform integration testing of my webservices before shipping them out and am wondering if anyone can point out some tools for performing these tests automatically?</p> <p>I have both ASMX webservices as well as a few WCF ones.</p> <p>I want to be able to add this as a task to my build scripts and execut...
<p>You could use <a href="http://www.soapui.org" rel="nofollow noreferrer">SoapUI</a>.</p>
<p><a href="http://jakarta.apache.org/jmeter/" rel="nofollow noreferrer">JMeter</a> is a java application, but of course it can also be used for .NET web services. You can create scripts (sending SOAP requests) and monitor the results both in text and graphically. It can emulate high - traffic conditions and in general...
45,865
<p>I have noticed a common technique is to place a generic container <em>div</em> in the root of the <em>body</em> tag:</p> <pre><code>&lt;html&gt; &lt;head&gt; ... &lt;/head&gt; &lt;body&gt; &lt;div id=&quot;container&quot;&gt; ... &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Is ...
<p>The container div, and sometimes content div, are almost always used to allow for more sophisticated CSS styling. The body tag is special in some ways. Browsers don't treat it like a normal div; its position and dimensions are tied to the browser window.</p> <p>But a container div is just a div and you can style ...
<p>Most of the browsers are taking the web page size by default.</p> <p>So, sometimes the page will not display same in different browser. So, by using &lt;div&gt;&lt;/div&gt;, the user can change for a specific HTML element. For example, the user can add margin, size, width, height, etc. of a specific HTML tag.</p>
46,219
<p>I have a command line executable that alters some bits in a file that i want to use from my program. Is it possible to create my own executable that uses this tool and distribute only one executable?</p> <p>[edit] Clarification:</p> <p>The command line tool takes an offset and some bits and changes the bits at thi...
<p>It would be easier to roll your own implementation of this program than to write the wrapper; it sounds like it is trivial -- just open the file, seek to the right location, write your bits, close the file, you're done.</p>
<p>I think the easiest way to do this for your purposes is probably to use a self extracting executable package. For example, use a tool like <a href="http://www.gdgsoft.com/pb/index.aspx" rel="nofollow noreferrer">Paquet Builder</a> which will package the exe (and any other files you want) and can be configured to cal...
15,870
<p>Is there a simple way to detect, within Python code, that this code is being executed through the Python debugger?</p> <p>I have a small Python application that uses Java code (thanks to JPype). When I'm debugging the Python part, I'd like the embedded JVM to be passed debug options too.</p>
<p>Python debuggers (as well as profilers and coverage tools) use the <code>sys.settrace</code> function (in the <code>sys</code> module) to register a callback that gets called when interesting events happen.</p> <p>If you're using Python 2.6, you can call <code>sys.gettrace()</code> to get the current trace callback...
<p>I found a cleaner way to do it,</p> <p>Just add the following line in your <code>manage.py</code></p> <pre><code>#!/usr/bin/env python import os import sys if __debug__: sys.path.append('/path/to/views.py') if __name__ == "__main__": .... </code></pre> <p>Then it would automatically add it when you are...
43,301
<p>Say I have a form like:</p> <pre><code>class GeneralForm(forms.Form): field1 = forms.IntegerField(required=False) field2 = forms. IntegerField(required=False) </code></pre> <p>And I want to show it twice on a page within one form tag each time with a different prefix e.g.,:</p> <pre><code>rest of page ......
<p>You process each form as you normally would, ensuring that you create instances which have the same prefixes as those used to generate the form initially.</p> <p>Here's a slightly awkward example using the form you've given, as I don't know what the exact use case is:</p> <pre><code>def some_view(request): if ...
<p>Even better, I think <a href="http://docs.djangoproject.com/en/dev/topics/forms/formsets/" rel="noreferrer">formsets</a> is exactly what you're looking for. </p> <pre><code>class GeneralForm(forms.Form): field1 = forms.IntegerField(required=False) field2 = forms. IntegerField(required=False) from django.fo...
28,012
<p>In the application I'm working on porting to the web, we currently dynamically access different tables at runtime from run to run, based on a "template" string that is specified. I would like to move the burden of doing that back to the database now that we are moving to SQL server, so I don't have to mess with a dy...
<pre><code>CREATE PROCEDURE TemplateSelector ( @template varchar(40), @code varchar(80) ) AS EXEC('SELECT * FROM ' + @template + ' WHERE ProductionCode = ' + @code) </code></pre> <p>This works, though it's not a UDF.</p>
<p>The only way that this would be possible is with dynamic SQL, however, dynamic SQL is not supported by SqlServer within a function.</p> <p>I'm sorry to say that I'm quite sure that it is NOT possible to do this within a function.</p> <p>If you were working with stored procedures it would be possible.</p>
45,561
<p>How do I create a self-signed certificate for code signing using tools from the Windows SDK?</p>
<h2>Updated Answer</h2> <p>If you are using the following Windows versions or later: Windows Server 2012, Windows Server 2012 R2, or Windows 8.1 then <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/aa386968(v=vs.85).aspx" rel="noreferrer">MakeCert is now deprecated</a>, and Microsoft recommends using ...
<p>This post will only answer the &quot;how to sign an EXE file if you have the crtificate&quot; part:</p> <p>To sign the exe file, I used MS &quot;signtool.exe&quot;. For this you will need to download the bloated MS Windows SDK which has a whooping 1GB. FORTUNATELY, you don't have to install it. Just open the ISO and...
11,036
<p>I have a legacy database and I am trying to create a NHibernate DAL. I have a problem with a mapping on Many-To-Many table.</p> <p>The Database tables:</p> <ul> <li><code>studio_Subscribers</code></li> <li><code>studio_Groups</code> (contains a IList of Subscribers)</li> <li><code>studio_Subscribers_Groups</code> ...
<p>Shouldn't you have an appropriate bag on your subscriber aswell with a many-to-many relation to the group?</p> <pre><code>&lt;bag name="Groups" table="studio_Groups_Subscribers" access="nosetter.camelcase"&gt; &lt;key column="SubscriberId"&gt;&lt;/key&gt; &lt;many-to-many column="GroupId" class="Gro...
<p>I believe it is to do with the cascade options, check out Ayende's post on it and I imagine with a bit of Googling you can find the correct syntax to go into your hbm file. I use fluent-NHibernate so I can't help you with the XML file.</p> <p><a href="http://ayende.com/Blog/archive/2006/12/02/NHibernateCascadesTheD...
40,961
<p>I am well aware that the Rest based approach is targeting HTTP. I would love to use the REST APIs and other goodness between processes on the same computer. Since ADO.NET data services is built on top of WCF it would seem reasonable to assume that the transport in configurable to work with any of the WCF supported...
<p>Actually the REST architectural style does not in any way require HTTP. That just happens to be the most common implementation protocol. However, ADO.Net data services uses System.ServiceModel.Web which IS tied to http. You can certainly do REST over named pipes, you will just have to find a different protocol.</p>...
<p>In .NET 3.5 there is built-in named pipe binding for WCF. See the <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.netnamedpipebinding.aspx" rel="nofollow noreferrer">MSDN</a> for details.</p>
31,476
<p>Anyone familiar with error below? When I run my webapp to generate a dynamic excel doc from my local machine it works fine but when the same piece of code is invoked on the server I get the below error. It seems like it's a permissions issues since it works on my machine but not the server but I don't know where to ...
<p>Using Office Interop requires that the Office components you're using actually be installed on the server.</p>
<p>Do you have a licensed, activated copy of Excel on the server? It probably works on your local machine because you have Office/Excel installed locally.</p>
31,701
<p>The following two C# code snippets produce different results (assuming the variable level is used both before and after the recursive call). Why?</p> <pre><code>public DoStuff(int level) { // ... DoStuff(level++); // ... } </code></pre> <p>,</p> <pre><code>public DoStuff(int level) { // ... DoStuff(leve...
<p><strong>level++</strong> will pass <strong>level</strong> into <strong>DoStuff</strong> and then increment <strong>level</strong> for use in the rest of the function. This could be a fairly nasty bug as the recursion will never end (from what is shown <strong>DoStuff</strong> is always being passed the same value). ...
<p>As far as my experience goes, the parameter expression is evaluated first, and gets a value of level. The variable itself is incremented before the function is called, because the compiler doesnt care whether you are using the expression as a parameter or otherwise... All it knows is that it should increment the va...
13,973
<p>It obviously depends on the context you are using them in but, I was wondering if there is a universally accepted way to name such variables, or at least in a mathematical context.</p> <p>I've often seen:</p> <pre><code>float k = someValue; float oneMinusK = 1 - k; </code></pre> <p>...which seems as descr...
<p>In probability 1-k is the probability of X not occurring, given that k is the probability of X occurring.</p> <p>So</p> <pre><code>float will_win_lottery = 0.00000000001; float will_not_win_lottery = 1 - will_win_lottery; </code></pre>
<p>Does it really matter? Use i; it's not any less descriptive than k. Things like this need to be documented/commented if you're that OCD about code descriptiveness.</p>
23,573
<p>I have a .net app that I've written in c#. On some forms I frequent update the display fields. In some cases every field on the form (textboxes, labels, picturebox, etc) has its value changed. Plus the frequency of the changes could possibly be every second. However, currently there is a horrible flickering everytim...
<p>the short answer is</p> <pre><code>SetStyle(ControlStyles.OptimizedDoubleBuffer, true); </code></pre> <p>the long answer is: see <a href="http://msdn.microsoft.com/en-us/library/3t7htc9c(VS.80).aspx?ppud=4" rel="nofollow noreferrer">MSDN</a> or <a href="http://www.google.com/search?hl=en&amp;q=C%23+form+double+buf...
<p>The ghosting is usually caused because you're running in a single thread and it's being held up with the field updates so the paint event doesnt fire. One way to fix this would be to put the heavy lifting in asynchronous methods. This will allow the form to repaint itself and update whatever is needed when they asyn...
21,892
<p>I am developing a mid-size application with VB2008. To better test my application I am following a MVP/Supervising Controller approach.</p> <p>My question is: What are your recommendations to separate responsibilites? So far I've come up with a winform with an instance of a controller and with an instance of my cla...
<p>I would suggest you spend time reading Jeremy Millers '<a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/07/25/the-build-your-own-cab-series-table-of-contents.aspx" rel="nofollow noreferrer">Build your own CAB</a>' series of posts to get a feel for what you might like/need to implement as your applicat...
<p>Martin Fowler is a good source of information on all things design patterns including MVC. Fowler discusses Passive View and separation of responsibilities is demonstrated also</p> <p><a href="http://martinfowler.com/eaaDev/ModelViewPresenter.html" rel="nofollow noreferrer">http://martinfowler.com/eaaDev/ModelViewP...
8,865
<p>Speaking entirely in technology-free terms, what is the best way to make a mobile friendly site? That is, I want to make a site that will work on a regular computer but also have mobile versions of the pages. Should I rewrite each page? The pages will probably have different functionality, so should I rewrite the...
<p>I added a mobile presentation layer to an operational site about a year ago. Based on the architecture of the site (hopefully this isn't too technology dependent for you) I added a new set of JSPs to accommodate mobile browsers (sidenote: see <a href="http://wurfl.sourceforge.net/" rel="nofollow noreferrer">http://w...
<p>In addition to the WURFL / WALL capabilities system that todd mentioned, there are Java Server Faces libraries available that use alternate WML renderkits for mobile phones.</p>
12,882
<p>How do you rewrite this in Linq?</p> <pre><code>SELECT Id, Name FROM TableA WHERE TableA.Id IN (SELECT xx from TableB INNER JOIN Table C....) </code></pre> <p>So in plain english, I want to select Id and Name from TableA where TableA's Id is in a result set from a second query.</p>
<pre><code>from a in TableA where (from b in TableB join c in TableC on b.id equals c.id where .. select b.id) .Contains(a.Id) select new { a.Id, a.Name } </code></pre>
<p>There is no out of box support for IN in LINQ. You need to join 2 queries.</p>
6,761
<p>I have a project written in Java (>1.5).</p> <p>Is it possible to write parts of the project with C#?<br> For instance the GUI and calling the methods and instantiate the classes written in java?</p> <p>If yes, how?</p>
<p>There is something called <a href="http://msdn.microsoft.com/en-nz/vjsharp/aa718346.aspx" rel="noreferrer">Java Language Conversion Assistant</a> for .NET. You can convert your Java classes to c# and start coding.</p> <p>There is also something called <a href="http://www.jnbridge.com/" rel="noreferrer">JNBridge</a>...
<p>I did some research on this a few years ago (2005 I believe) and I liked JNBridgePro as the best third party product to do this. Check it out here <a href="http://www.jnbridge.com/" rel="nofollow noreferrer">http://www.jnbridge.com/</a></p> <p>Good luck!</p>
20,702
<p>Several years back, I innocently tried to write a little app to save my tactically placed desktop icons because I was sick of dragging them back to their locations when some event reset them. I gave up after buring WAY too much time having failed to find a way to query, much less save and reset, my icons' desktop p...
<p>If I'm not mistaken the desktop is just a ListView, and you'll have to send the <a href="http://msdn.microsoft.com/en-us/library/bb761192(VS.85).aspx" rel="noreferrer">LVM_SETITEMPOSITION</a> message to the handle of the desktop.</p> <p>I googled a bit for some c# code and couldn't find a example, but I did found t...
<p>I have no idea about the API, but I know Ultramon (<a href="http://www.realtimesoft.com/ultramon/" rel="nofollow noreferrer">http://www.realtimesoft.com/ultramon/</a>) has a feature included for preserving icon placement (although I've never used it for preserving icon location, it is indispensable for multiple moni...
15,977
<p>The Java AtomicInteger class has a method -</p> <pre><code>boolean weakCompareAndSet(int expect,int update) </code></pre> <p>Its documnentation says:</p> <blockquote> <p>May fail spuriously.</p> </blockquote> <p>What does 'failing spuriously' here mean?</p>
<p>spuriously: for no apparent reason</p> <p>According to <a href="http://gee.cs.oswego.edu/dl/jsr166/dist/docs/java/util/concurrent/atomic/package-summary.html" rel="noreferrer"><code>atomic</code></a> package javadoc:</p> <blockquote> <p>The atomic classes also support method weakCompareAndSet, which has limited appl...
<p>It means it might return false (and will not set the new value) even if it currently contains the expected value.</p> <p>In other words, the method may do nothing and return false for no apparent reason...<br> There are CPU architectures where this may have a performance advantage over a strong <code>CompareAndSet(...
46,317
<p>I have developed a VB.NET WCF service that recives and sends back data. When the first client connects it starts the data output that continues also if the client is closed. If a new client connects then a new object is created and the data output starts at the begninning and continues in parallel with the old insta...
<p><a href="http://schotime.net/blog/index.php/2008/03/18/importing-data-files-with-linq/" rel="nofollow noreferrer">Here</a> is a very interesting approach about importing tabulated data using Linq.</p> <p>It's simple and elegant, you only need an Enumerable method that yields the lines from the file:</p> <pre><code...
<p>Looks like a fixed length format?</p> <p>With a bit of pre-processing, you could use an OLEDB driver to get the data out using standard APIs:</p> <ul> <li><a href="http://www.codeproject.com/KB/database/ReadTextFile.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/database/ReadTextFile.aspx</a></li> <...
26,727
<p>say p.products_price equals 1</p> <p>why does:</p> <blockquote> <pre><code>UPDATE products p SET p.products_price = (1 + p.products_price) WHERE p.products_id = 8 </code></pre> </blockquote> <p>make p.products_price equals 3?</p> <p>It is adding 1 to the price and then doing it all over again? I am trying to do ...
<pre><code>UPDATE products SET products_price = (1 + products_price) WHERE products_id = 8 </code></pre> <p>works like it should (removed table alias 'p')</p>
<p>That should definitely set products_price to 2. There must be something else going on.</p> <p>This is similar to <a href="https://stackoverflow.com/questions/238800/problem-with-updating-a-mysql-field-with-php">Problem with updating a MySQL field with PHP</a> but there was no good solution there so I'll leave this...
44,891
<p>Is there a library that will convert a Double to a String with the whole number, followed by a fraction?</p> <p>For example</p> <pre><code>1.125 = 1 1/8 </code></pre> <p>I am only looking for fractions to a 64th of an inch. </p>
<p>One problem you might run into is that not all fractional values can be represented by doubles. Even some values that look simple, like 0.1. Now on with the pseudocode algorithm. You would probably be best off determining the number of 64ths of an inch, but dividing the decimal portion by 0.015625. After that, y...
<p>To solve this problem (in one of my projects), I took the following steps:</p> <ul> <li>Built a dictionary of decimal/fraction strings. </li> <li>Wrote a function to search the dictionary for the closest matching fraction depending on the "decimal" part of the number and the matching criteria.</li> </ul>
49,674
<p>One of the many quirks of Reporting Services we've run across is the complete and utter lack of a CheckBox control or even something remotely similar.</p> <p>We have a form that should appear automatically filled out based on information pulled from a database. We have several bit datatype fields. Printing out "T...
<p>I, along with others in my shop, have used images, toggling the hidden attribute based on the field value (true or false). We haven't had any problems with blurring or scaling, unless we tried to increase the scale of the image beyond 100% obviously.</p> <p>Another option I've used is similar to the wingdings idea...
<p>I think there is a bug with SSRS and embedding font characters above 128 (some thing todo with ANSI encoding). Basically you can use 1-128 fine, the rest show up as tall rectangular blocks. </p> <p>I like NY's idea of the textbox with a border and an optional X - this sounds simple and effective.</p>
32,405
<p>I'm looking for a way to determine if a specific tray on a given printer in Windows is out of paper. Currenly I'm using the WMI Win32_Printer object to get the status of the entire printer, and if one of the trays is out of paper I do get a status that tells me the entire printer is out of paper. </p> <p>But I'd ...
<p>That is because they are usually hardware specific interfaces. If you use one hardware vendor like HP or Dell then you can probably find a way to figure this out. But the Windows interface seems to only allow notification of the printer being totally out of paper.</p>
<p>I haven't done this but I seem to recall you can do it via SNMP.</p>
30,826