instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Let's have the following class definition:</p> <pre><code>CThread::CThread () { this-&gt;hThread = NULL; this-&gt;hThreadId = 0; this-&gt;hMainThread = ::GetCurrentThread (); this-&gt;hMainThreadId = ::GetCurrentThreadId (); this-&gt;Timeout = 2000; //milliseconds } CThrea...
<p>The memory space for your application is accessible to all threads. By default any variable is visible to any thread regardless of context (the only exception would be variables declared __delcspec(thread) )</p> <p>You are getting a crash due to a race condition. The thread you just created hasn't started running...
<p>As Rob Walker pointed out - I really missed the race condition. Also the crash is not when getting the pointer, but when using it.</p> <p>A simple wait did the job:</p> <pre><code>MyClass* myPointer = thread.getMyPointer(); while (myPointer == 0) { ::Sleep(1000); } myPointer-&gt;someMethod(); // Working :)...
25,622
<p>How does one invoke a groovy method that prints to stdout, appending the output to a string?</p>
<p>This demonstrates how you can do this. Paste this into a Groovy script file and run it. You will see the first call functions as normal. The second call produces no results. Finally, the last step in the main prints the results of the second call that were redirected to a ByteArrayOutputStream.</p> <p>Have fun!...
<p>I'm not sure what you mean by "appending the output to a string", but you can print to standard out using "print" or "println".</p>
14,791
<p>I have a variable that contains a 4 byte, network-order IPv4 address (this was created using pack and the integer representation). I have another variable, also a 4 byte network-order, subnet. I'm trying to add them together and add one to get the first IP in the subnet.</p> <p>To get the ASCII representation, I ...
<p>What's happening is that you make a byte string with <code>$ip&amp;$netmask</code>, and then try to treat it as a number. This is not going to work, as such. What you have to feed to <code>inet_ntoa</code> is.</p> <pre><code>pack("N", unpack("N", $ip&amp;$netmask) + 1) </code></pre> <p>I don't think there is a sim...
<p>Confusing integers and strings. Perhaps the following code will help:</p> <pre><code>use Socket; $ip = pack("C4", 192,168,250,66); # why not inet_aton("192.168.250.66") $netmask = pack("C4", 255,255,255,0); $ipi = unpack("N", $ip); $netmaski = unpack("N", $netmask); $ip1 = pack("N", ($ipi&amp;$netmaski)+1); pri...
27,386
<p>What made it hard to find? How did you track it down?</p> <p>Not close enough to close but see also<br> <a href="https://stackoverflow.com/questions/175854/what-is-the-funniest-bug-youve-ever-experienced">https://stackoverflow.com/questions/175854/what-is-the-funniest-bug-youve-ever-experienced</a></p>
<p>A jpeg parser, running on a surveillance camera, which crashed every time the company's CEO came into the room.</p> <p>100% reproducible error.</p> <p>I kid you not!</p> <p>This is why:</p> <p>For you who doesn't know much about JPEG compression - the image is kind of broken down into a matrix of small blocks wh...
<p>A nasty crash in a GUI app written in Turbo Pascal. Three days plus before i discovered, by single stepping in the debugger, at a machine code level, over simple and obviously correct code, that i was putting a 16-bit integer on the call stack for a function expecting 32-bit (or some such mismatch)</p> <p>Now i am ...
20,483
<p>I'm starting a hobby project in which I would like to have a graphical, touchscreen interface for interacting with a kiosk-like device running on top of Windows XP Embedded. For development of a rich UI experience, I was considering using WPF. However, a number of demonstration videos that I have come across have ...
<p>It seems that WPF works fine on embedded. See <a href="http://blogs.msdn.com/mikehall/archive/2006/07/10/661539.aspx" rel="nofollow noreferrer">here</a> the second comment. </p> <p>I think that your choice should be dependent on the type of kyosk you want to build. Some kyosks are just an open browser page. And the...
<p>I would recommend also WPF, have done few kiosk apps using it. </p> <p>also I would recommend <a href="http://fpscomponents.com/Product.aspx?id=8" rel="nofollow noreferrer">http://fpscomponents.com/Product.aspx?id=8</a> as a virtual touch screen keyboard software component. it's done in WPF and very flexible and cu...
28,920
<p>In a C++ Linux app, what is the simplest way to get the functionality that the <a href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked.aspx" rel="noreferrer">Interlocked</a> functions on Win32 provide? Specifically, a lightweight way to atomically increment or add 32 or 64 bit integers? </p>
<p>Intel's open-source <a href="http://www.threadingbuildingblocks.org/" rel="noreferrer">ThreadBuildingBlocks</a> has a template, Atomic, that offers the same functionality as .NET's Interlocked class.</p> <p>Unlike gcc's Atomic built-ins, it's cross platform and doesn't depend on a particular compiler. As Nemanja Tr...
<p>Upon further review, <a href="http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html" rel="nofollow noreferrer">this</a> looks promising. Yay stack overflow.</p>
18,039
<p>I always hear that programmers try to pick the right tool for the job. I've never programmed in Java, so I was wondering What are its benefits? Why is it so popular? What should I use it for?</p> <p>I just program recreationally. Is there anything about it that makes it particularly fun??</p>
<p>I think after 12 years or so, the "write once, run anywhere" mantra is <em>almost</em> true. Writing Java code pretty much isolates you from the platform dependent aspects of the systems on which you deploy it.</p>
<p>There are only two reasons to use Java:</p> <ul> <li>The Java Virtual Machine (Hotspot).</li> <li>The huge amount of available libraries and tools.</li> </ul> <p><a href="http://scala-lang.org" rel="nofollow noreferrer">There are other languages that run on the JVM and make better use of Java libraries than Java d...
29,981
<p>Would like to get a list of advantages and disadvantages of using Stored Procedures. The main advantage of SPs seems to be precompiled and an abstraction of data from the application. Give me your thoughts....</p>
<p>Correction: Whether they're precompiled depends on the database. In SQL Server, for instance, they're not. Stored procedures and parameterized SQL are both compiled before being run. A stored procedure can sometimes reuse an execution plan if a corresponding one exists...but so can parameterized SQL.</p> <p><str...
<p>Advantages - </p> <ol> <li>Organized at one place (not sprinkled all over the code)</li> <li>Much faster than dynamic queries</li> </ol>
28,059
<p>Which of theese two alternatives do you find yourself using most often, and which is more "idiomatic"?</p> <ol> <li>f arg (obj.DoStuff())</li> <li>f arg &lt;| obj.DoStuff()</li> </ol>
<p>Overall, I don't know that one or the other is more idiomatic.</p> <p>Personally, the only time I use &lt;| is with "raise":</p> <pre><code>raise &lt;| new FooException("blah") </code></pre> <p>Apart from that, I always use parens. Note that since most F# code uses curried functions, this does not typically impl...
<p>I use () much much more often, but thats just preference, I'm pretty sure that &lt;| is more idomatic, but I use () by habit.</p>
18,413
<p>I´m trying to expose services using jax-ws but the first surprise i got was that Weblogic does not support inner classes for request/response objects. After get over this situation <a href="https://stackoverflow.com/questions/144118/jaxb-binding-customization">here</a>, i´m facing another challenge:</p> <p>Generate ...
<p>This has been fixed or better to say supported in jaxb 2.1.13 ( see <a href="http://java.net/jira/browse/JAXB-131" rel="noreferrer">JAXB-131</a> for more details). Upgrade your dependencies and configure enableIntrospection xjc option. More details on xjc options can be found on <a href="http://jaxb.java.net/nonav/2...
<p>BooleanGetter XJC plugin for JAXB is available at <a href="http://fisheye5.cenqua.com/browse/~raw,r=1.1/jaxb2-commons/www/boolean-getter/index.html" rel="nofollow noreferrer">http://fisheye5.cenqua.com/browse/~raw,r=1.1/jaxb2-commons/www/boolean-getter/index.html</a></p> <p>If you are working with JavaSE 6 then it ...
24,701
<p>I wan't to change the background color of a div dynamicly using the following HTML, CSS and javascript. HTML:</p> <pre><code>&lt;div id=&quot;menu&quot;&gt; &lt;div class=&quot;menuItem&quot;&gt;&lt;a href=#&gt;Bla&lt;/a&gt;&lt;/div&gt; &lt;div class=&quot;menuItem&quot;&gt;&lt;a href=#&gt;Bla&lt;/a&gt;&lt;/...
<p>Your code looks fine to me.</p> <p>Make sure the DOM is ready before your javascript is executed by using jQuery's $(callback) function:</p> <pre><code>$(function() { $('.menuItem').hover( function(){ $(this).css('background-color', '#F00'); }, function(){ $(this).css('background-color', '#000...
<p>I just coded up an example in jQuery on how to create div overlays over radio buttons to create a compact, interactive but simple color selector plug-in for jQuery</p> <p><a href="http://blarnee.com/wp/jquery-colour-selector-plug-in-with-support-for-graceful-degradation/" rel="nofollow noreferrer">http://blarnee.co...
34,778
<p>I have the problem that an specific step in Ant can only be executed when we have Java 1.5 installed in the build computer. The task definition uses uses a jar file that was compiled using 1.5, so running with a 1.4 virtual machine will throw an IncompatibleClassVersion exception.</p> <p>I have to find a solution...
<p>The Java version is exposed via the <em>ant.java.version</em> property. Use a <em>condition</em> to set a property and execute the task only if it is true.</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;project name="project" default="default"&gt; &lt;target name="default" depends="javaCheck"...
<p>The property to check in the buildfile is <code>${ant.java.version}</code>.</p> <p>You could use the <a href="http://ant.apache.org/manual/Tasks/conditions.html" rel="nofollow noreferrer"><code>&lt;condition&gt;</code></a> element to make a task conditional when a property equals a certain value:</p> <pre><code>&l...
17,805
<p>Please could someone help me with writing a regex expression to replace 0044 token which will be at the start of the string with a 0. Please note that I do not want to replace all 0044 tokens with 0, only those that appear at the start of the string.</p> <p>Thanks a lot</p>
<p>In perl: </p> <pre><code>s/^0044/0/; </code></pre> <p>The <code>^</code> means that the match will only happen at the beginning of the string.</p>
<p>Then why you dont put an space at the begining in the search and replace boxes, i mean:</p> <pre><code>Search: " 0044" Replace " 0" </code></pre> <p>Good luck!</p>
28,847
<p>I wonder if there is a way to use ungreedy matching in JavaScript? I tried the U modifer, but it doesn't seem to work.</p> <p>I want to write a small BBCode parser in JavaScript, but without ungreedy matching it isn't possible (at least as far as I see it) to do something like this:</p> <pre><code>'[b]one[/b] two ...
<p>You can use <code>?</code> after <code>*</code> or <code>+</code> to make it ungreedy, e.g. <code>(.*?)</code></p>
<p>I'm late, but I'll post the regex anyway.</p> <pre><code>'[b]one[/b] two [b]three[/b]'.replace( /\[b\](.+?)\[\/b\]/g, '&lt;b&gt;$1&lt;/b&gt;' ); </code></pre>
47,517
<p>I need to do a join with a table/result-set/whatever that has the integers <code>n</code> to <code>m</code> inclusive. Is there a trivial way to get that without just building the table?</p> <p>(BTW what would that type of construct be called, a "<em>Meta query</em>"?)</p> <p><code>m-n</code> is bounded to somethi...
<p>I found this solution on the web </p> <pre><code>SET @row := 0; SELECT @row := @row + 1 as row, t.* FROM some_table t, (SELECT @row := 0) r </code></pre> <p>Single query, fast, and does exactly what I wanted: now I can "number" the "selections" found from a complex query with unique numbers starting at 1 and incr...
<p>If you were using Oracle, 'pipelined functions' would be the way to go. Unfortunately, MySQL has no such construct.</p> <p>Depending on the scale of the numbers you want sets of, I see two simple ways to go : you either populate a temporary table with just the numbers you need (possibly using memory tables populate...
39,125
<p>Are there some practical programming situations for someone to declare a class abstract when all the methods in it are concrete?</p>
<p>Well you could be using a template method pattern where there are multiple override points that all have default implementations but where the combined default implementations by themselves are not legal - any functional implementation must subclass.</p> <p>(And yes, I dislike the template method pattern ;))</p>
<p>Nice question :)</p> <p>One thing is for sure ... this is certainly possible. The template suggestion by krosenvold is one good reason for doing this. </p> <p>I just want to say that a class must not be declared <code>abstract</code> just for preventing it's instantiation.</p> <p>This is referred in the Java Lang...
47,306
<p>So I have something like this:</p> <pre><code>var xmlStatement:String = "xmlObject.node[3].@thisValue"; </code></pre> <p>What mystery function do I have to use so that I can execute xmlStatement and get thisValue from that xmlObject? Like....</p> <pre><code>var attribute:String = mysteryFunction(xmlStatement); </...
<p>Unfortunately this is not possible in ActionScript 3. This however might be a solution: <a href="http://blog.betabong.com/2008/09/23/e4x-string-parser/" rel="nofollow noreferrer">http://blog.betabong.com/2008/09/23/e4x-string-parser/</a></p>
<p>For your example it would be: var attribute : String = String( E4X.evaluate( XMLList(xmlobject) , 'node[3].@thisValue' ) );</p>
19,267
<p><strong>Before you answer: Yes I have read the jtable tutorial over at Sun</strong>. No, it did not help me. Yes, I am a dolt. <strong>Please don't answer with a reference to that document</strong>. What I am specifically interested in is how to dynamically add rows and columns to my Jtable via the Netbeans IDE. I a...
<p>A <code>JTable</code> uses a <code>TableModel</code> to hold its data. Your hash/vector of data will need to be adapted to be used; you can write a <code>TableModel</code> implementation, using the hash/vector as backing data, or, if you won't be dynamically updating the hash/vector and needing it to show automatica...
<p>To add to my previous answer, for what it's worth, I've actually written a table model that uses (essentially) an <code>ArrayList&lt;Row&gt;</code> as backing data, where <code>Row</code> is a <code>HashMap&lt;String, Object&gt;</code>, mapping column names to values.</p> <p>The whole thing is about 1500 lines of c...
13,198
<p>As in the topic...</p> <p>I was thinking about something like "in memory changes". On recent blogs by Jaroslaw Kowalski i have found similar approach but i was thinking about sth much simpler </p>
<p>The best book on this topic is <a href="http://www.amazon.com/exec/obidos/tg/detail/-/1402071418/ref=ase_penguintelecomin/102-8353601-4848123?v=glance&amp;s=books" rel="noreferrer">Reuse Methodology Manual</a>. It covers both VHDL and Verilog.</p> <p>And in particular some issues that don't have an exact match in ...
<ul> <li><p>in HDL, some parts of the code can work at the same time, for example two lines of code "can work" at the same time, this is an advantage, to use wisely. this is something that a programmer who is accustomed to line by line languages may find hard to grasp at first:</p> <ul> <li>Long and specific for your...
42,350
<p>Can someone explain to me the difference between these 3 approaches to processing messages that fail delivery?</p> <ul> <li>Poison Queue service</li> <li>Dead-Letter Queue service</li> <li>Using a response service to handle failures</li> </ul> <p>I have "Programming WCF", but I don't really understand when you wou...
<p>Dead and poison are two different concepts. Poison messages are messages that can be read from the queue, but your code doesn't know how to handle it so your code gives an exception. If this goes on for some time you want this message to be put on a different queue so your other messages can be handled. A good apro...
<p>Poison message / dead letter message queues are used to place messages that have been determined to be undeliverable in a queue that will not try to deliver them anymore. You would do this if you might want to manually take a look at failed messages and process them at a later point. You use these type of queues whe...
36,721
<p>I've bought a new type of filament (GreenTEC Pro Natural) for my Anycubic Mega i3 to print some food-safe cookie cutters. Now I have changed the print settings to an extruder temperature of 210&nbsp;&deg;C and a heated bed temperture of 60&nbsp;&deg;C and everything works well.</p> <p>But when I look at the print, ...
<p>Check your retraction settings.. It's either too far or one of your priming/wipe settings is off, some slicers call it priming or extra restart distance. </p> <p>Your linear advance "k" might be set wrong if you're using linear advance. </p> <p>I see a bit of under-extrusion on the between walls and center, your...
<p>I think there's a retraction issue(had the same issue). You need to change retraction and check whether there are any improvements. Some times different filament types need slight filament setting calibration.</p>
1,525
<p>I just got into 3D printing with an Ender-3 Pro. The test dog printed great, some custom small/thin objects printed good, and now I tried my first big object.</p> <p>Designed in Tinkercad (<a href="https://www.tinkercad.com/things/1JZRKfOQHxr" rel="nofollow noreferrer">link to my (updated) design</a>), exported to ....
<p>One hundred percent infill is not necessarily stronger than lower values. By having such a high infill figure, the forces on the model as it cools are magnified and not in a particularly good manner.</p> <p>Consider that you could use twenty to thirty percent infill to get the strength you require for this applicat...
<p>The reason for this sort of error might be either 1) a clogged nozzel, <a href="https://www.youtube.com/watch?v=bg4sOaSvimY" rel="nofollow noreferrer">try doing this </a> 2) disturbed bed level,<a href="https://www.youtube.com/watch?v=lL3Gmy4hh3Y" rel="nofollow noreferrer">resolve this issue </a> 3) poor filament q...
1,643
<p>Over the years as I have gone through school and been working in the industry I have often asked people for advice on commenting. Sadly, as we all know, commenting with many developers is something that is taken as a side note and not much else. With that said I usually get a fairly general answer. Really this do...
<p>At the very least, I would comment all parts of your public API, using a <a href="http://www.winnershtriangle.com/w/Articles.XMLCommentsInCSharp.asp" rel="nofollow noreferrer">triple-slash XML comment block</a>. This will make it easy to auto-generate documentation if and when the time comes.</p> <p>Beyond that, I...
<p>Personally I use a combination of triple slash, SandCastle XML comments and inline comments for more complicated sections. Comment often but keep it concise, nobody needs to read reams of fluff before then can figure out what something does :-)</p>
22,823
<p>I am using Xcode to develop a GUI application. I have a model class and a controller class. I have a NSTextView data member in my controller class. How do I access this variable from the model class?</p>
<p>First of all, a model class shall not talk to a view class. A TextView is part of the view.</p> <p><a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/Art/cocoa_mvc.gif">alt text http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/Art/cocoa_mvc.gif</a></p> <...
<p>Re: the recursive <code>#import</code> problem, what you're looking for is the <code>@class</code> directive. In most cases, all your class interface needs to know about other classes is their names, since all of the actual implementation-specific stuff is in your <code>*.m</code> files. The <code>@class</code> di...
38,632
<p>I had my printer printing fine when using the stock trigger switch as I used it to print the green bracket you see in the picture. </p> <p><a href="https://i.stack.imgur.com/6kxYw.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/6kxYw.jpg" alt="Photo of probe atached to hotend"></a></p> <p>My problem now ...
<p>If using <code>marlin firmware</code> center your prints.</p> <p>In my case...</p> <pre><code>#define NOZZLE_X 8 #define NOZZLE_Y -56 </code></pre> <p>Then, set the Z-Probe offset from nozzle. In my case the Z-Probe is 50mm behind the hotend.</p> <pre><code>#define SENSOR_LEFT 0 #define ...
<p>There are at least 2 options to address the problem that you have:</p> <ol> <li>Adjust end-stops so that in 0,0 position Z-sensor would still hang above the printing table. This would reduce printing surface but allow perfect calibration</li> <li>Mount extra metal plate at the table mount where it would not bump in...
421
<p>What does it indicate to see a query that has a low cost in the explain plan but a high consistent gets count in autotrace? In this case the cost was in the 100's and the CR's were in the millions.</p>
<p>The 3.5 framework still runs on top of the 2.0 CLR so what you are seeing is correct.</p> <p>Scott Hanselman has a nice <a href="http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx" rel="nofollow noreferrer">blog post</a> about the details of this:</p> <blockquote> <p>Th...
<p>You do not need to do anything more, other than have a properly configured web.config</p>
19,212
<p>I am creating a WPF Application using VS 2005. I download the add on to create the WPF application. Now for deploying the application I need the installer to automatically download the WPF components. Please note that I cannot installed 3.5 framework on the client's machine. There are some rules and things that prev...
<p>The .NET framework client profile will help you. <a href="http://blogs.windowsclient.net/trickster92/archive/2008/05/21/introducing-the-net-framework-client-profile.aspx" rel="nofollow noreferrer">Go here for more details</a> or a <a href="http://channel9.msdn.com/posts/mtaulty/WPF-ClickOnce-and-the-NET-Client-Prof...
<p>In order to run a WPF application you need .net 3.0 installed (it's always preinstalled on Vista).</p> <p>There are some tricks to copy some dlls from 3.0 or 3.5 into a .net 2.0 installations but this is unsupported - that means that it may work but it also may break other applications and it can stop working every...
46,934
<p>I am writing a addressbook module for my software right now. I have the database set up so far that it supports a very flexible address-book configuration.</p> <p>I can create n-entries for every type I want. Type means here data like 'email', 'address', 'telephone' etc.</p> <p>I have a table named 'contact_profil...
<p>You have reinvented a database design called <a href="http://en.wikipedia.org/wiki/Entity-attribute-value_model" rel="nofollow noreferrer">Entity-Attribute-Value</a>. This design has a lot of weaknesses, including the weakness you've discovered: it's very hard to reproduce a query result in a conventional format, ...
<p>You will need to generate a query like:</p> <pre><code>select #profile, max(case when type='email' then value end) as email, max(case when type='name' then value end) as name, max(case when type='website' then value end) as website from mytable group by #profile </code></pre> <p>However, that ...
48,219
<p>How would you maintain the legacy applications that:</p> <ol> <li><p>Has no unit tests have big methods</p></li> <li><p>with a lot of duplicated logic have</p></li> <li>have No separation of concern</li> <li>have a lot of quick hacks and hard coded strings</li> <li>have Outdated and wrong documentation</li> <li><st...
<p>You need the book <a href="https://rads.stackoverflow.com/amzn/click/com/0131177052" rel="nofollow noreferrer" rel="nofollow noreferrer">Working Effectively with Legacy Code by Michael C. Feathers</a>.</p> <p><img src="https://i.stack.imgur.com/hVs5x.jpg" alt="alt text"></p>
<p>I basically agree with everything Paul C said. I'm not a TDD priest, but anytime you're touching a legacy codebase -- especially one with which you're not intimately familiar -- you need to have a solid way to retest and make sure you've followed Hippocrates: First, do no harm. Testing, good unit and regression test...
31,642
<p>I am refactoring a stack of ASP.NET pages. I'd like to compile and test the ones I've completed. However, Visual Studio won't let me run the Web Site with compile errors on the non-refactored pages. How can I temporarily exclude them without removing them from the project itself? Can you do so through configurat...
<p>On Visual studio 2010 or later, you can achieve the functionality in two ways.</p> <p>1)Right click the file, select '<strong>Exclude From Project</strong>'</p> <p>2)Right click the file, select '<strong>Properties</strong>' --> select '<strong>Configuration Properties</strong>' --> select '<strong>General</strong...
<p>I would create two projects and copy over the completed ones to the new project as they are refactored, then build the new project.</p>
27,007
<p>Is there a simple way to prevent browser from downloading and displaying images, best would be via some magic style tag or javasctipe.</p> <p>The thing is, I'd like to tweak the company's website a bit to be more usable via mobile devices. The company is a gaming one, there's like 5MBs of images on it's main page (...
<p>You can use htaccess to redirect image requests made from mobile browser users. I haven't tested this but it should work:</p> <pre><code>RewriteCond %{HTTP_USER_AGENT} (nokia¦symbian¦iphone¦blackberry) [NC] RewriteCond %{REQUEST_URI} !^/images/$ RewriteRule (.*) /blank.jpg [L] </code></pre> <p>This code redirects...
<p>Why not use <a href="http://www.howtocreate.co.uk/tutorials/css/mediatypes" rel="nofollow noreferrer">alternative style sheets</a>? I just don't know how well they are supported by mobile browsers.</p> <p>You can specify a seperate css for mobile devices:</p> <pre><code>&lt;link rel="stylesheet" media="screen,proj...
21,389
<p>I'm trying to add a label to my toolbar. Button works great, however when I add the label object, it crashes. Any ideas?</p> <pre><code>UIBarButtonItem *setDateRangeButton = [[UIBarButtonItem alloc] initWithTitle:@"Set date range" style:UIBarBut...
<p>Have a look into this</p> <pre><code>[[UIBarButtonItem alloc] initWithCustomView:yourCustomView]; </code></pre> <p>Essentially every item must be a "button" but they can be instantiated with any view you require. Here is some example code. Note, since other buttons are typically on the toolbar, spacers are placed ...
<p>could use a disabled BarButtonItem</p> <pre><code>let resultsLabel = UIBarButtonItem(title: &quot;number of results&quot;, style: .plain, target: self, action: nil) resultsLabel.isEnabled = false </code></pre>
43,219
<p>I am working on a new version of a firefox extension, but after releasing it, and incrementing the em:version in install.rdf and update.rdf, when I click "Find updates" Firefox reports that "No updates were found." When I run it with debugging on, the output in the console is actually identical to what I see when I...
<p>Make sure your update.rdf file is being served with an appropriate Content-Type, i.e. text/rdf, text/xml or application/xml+rdf </p>
<p>There are lots of things to mess up, one of which is installing an extension from AMO and expecting it to update when you change your update.rdf :)</p>
25,420
<p>TL;DR - For a given Kossel frame size (w.r.t. the vertical and horizontal frame lengths of the aluminium extrusion), what would the length of the carbon fibre rods be?</p> <hr> <p>A case in point, from <a href="http://reprap.org/wiki/Kossel" rel="nofollow noreferrer">RepRapWiki - Kossel</a>, there is an intriguing...
<p>I had the same problem, and I solved it by changing the <em>Z-Axis Feed Rate</em> to a much higher value (1000 mm/min.) in Repetier Host via <em>Config -> Printer Settings -> Printer</em>.</p>
<p>Try changing the travel speed in you r slicer, if that doesn't work , try changing out the motors for newer ones.</p>
589
<p>I am attempting to write a Windows Service in C#. I need to find the path to a certain file, which is stored in an environment variable. In a regular C# console application, I can achieve that with the following line:</p> <pre><code>string t = System.Environment.GetEnvironmentVariable("TIP_HOME"); </code></pre> ...
<p>I've no idea if this is useful, but I've found that for every service, there is an option to add environment variables directly to a service.</p> <p>It is done via the registry.</p> <p>Say the key to your service is ...</p> <p>HKLM\SYSTEM\CurrentControlSet\Services\YourService</p> <p>Create a REG_MULTI_SZ called...
<p>I modified that line of code to this:</p> <p>string t = System.Environment.GetEnvironmentVariable("TIP_HOME", EnvironmentVariableTarget.Machine);</p> <p>I can look through my registry and see that TIP_HOME is set.</p> <p>This is from MSDN: Machine: The environment variable is stored or retrieved from the HKEY...
39,349
<p>How to get a file's creation date or file size, for example this Hello.jpg at <a href="http://www.mywebsite.com/now/Hello.jpg(note" rel="nofollow noreferrer">http://www.mywebsite.com/now/Hello.jpg(note</a>: This URL does not exist)? The purpose of this question is to make my application re-download the files from th...
<p>If you use the HEAD request it will send the headers for the resource, there you can check the cache control headers which will tell you if the resource has been modified, last modification time, size (content-length) and date. </p> <pre><code>$ telnet www.google.com 80 Trying 216.239.59.103... Connected to www.l.g...
<p>The webserver might send a last-modified and/or etag header for that purpose. And you might send an if-modified-since header in your request.</p> <p>see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html" rel="nofollow noreferrer">http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html</a> sections 14.1...
9,627
<p>Have you ever had alternating background colors in a Jasper report and then exported it to Excel? The Excel export seems to ignore the alternating color.</p> <p>I've got a Jasper report where the rows alternating background color using the procedure referenced <a href="http://www.brianburridge.com/2006/06/19/highl...
<p>Did you try the idea suggested in the <a href="http://www.brianburridge.com/2006/06/19/highlighting-odd-even-rows-jasperreports/comment-page-2/#comment-8837" rel="nofollow noreferrer">comment</a> of the very procedure you are referring to ?</p> <p>First how to create new report style with condition:</p> <blockquote>...
<p>Did you try the idea suggested in the <a href="http://www.brianburridge.com/2006/06/19/highlighting-odd-even-rows-jasperreports/comment-page-2/#comment-8837" rel="nofollow noreferrer">comment</a> of the very procedure you are referring to ?</p> <p>First how to create new report style with condition:</p> <blockquote>...
37,206
<p>I am using a .Net <code>HtmlTextWriter</code> to generate HTML.</p> <pre><code>try { htw.RenderBeginTag( HtmlTextWriterTag.Span ); htw.Write(myObject.GenerateHtml()); htw.RenderEndTag( ); } catch (Exception e) { GenerateHtmlErrorMessage(htw); } </code></pre> <p>In this example, if an error exception ...
<p>If you are only concerned about errors that occur during the GenerateHtml() call, and don't like the second approach (which seems fine to me), why not move the closing span tag into a finally block, and pull out the open call:</p> <pre><code>htw.RenderBeginTag( HtmlTextWriterTag.Span ); try { htw.Write(myObject....
<p>You should avoid using try/catch, and instead check if the result is not what you expected. The only thing I can see here, is that myHTML can be null, so try something like this:</p> <p>string myHtml = myObject.GenerateHtml();</p> <pre><code>if (myHTML != null) { htw.RenderBeginTag( HtmlTextWriterTag.Span ); ...
36,434
<p>I have a written a Visual C++ console application (i.e. subsystem:console) that prints useful diagnositic messages to the console.</p> <p>However, I would like to keep the application minimized most of the time, and instead of minimizing to the taskbar, appear as a nice icon on the system tray. I would also like to...
<p>This is going to be an ugly hack.</p> <p>First, you have to retrieve the <code>hWnd</code> / <code>hInstance</code> of you console application. Right now, I can only come up with one way:</p> <ul> <li>Create a Guid with <code>CoCreateGuid()</code></li> <li>Convert it to a string</li> <li>Set the title of the conso...
<p>Probably your best bet is to create a <a href="http://msdn.microsoft.com/en-us/library/ms632599.aspx#message_only" rel="nofollow noreferrer">"Message-only window"</a> (a message queue without a visible window) to receive the Notification Area messages.</p>
33,661
<p>In C++, static library A is linked into dynamic libraries B and C. If a class, Foo, is used in A which is defined in B, will C link if it doesn't use Foo?</p> <p>I thought the answer was yes, but I am now running into a problem with xlc_r7 where library C says Foo is an undefined symbol, which it is as far as C is ...
<p>When you statically link, two modules become one. So when you compile C and link A into it, its as if you had copied all the source code of A into the source code of C, then compiled the combined source. So C.dll includes A, which has a dependency on B via Foo. You'll need to link C to B's link library in order t...
<p>Sounds like it's probably the linker (ld/unix), as (most versions that I've used of) ld links the libraries in from left to right - and if there is a reference in the first one that is required by a later one the usual trick is to append the first library (or any required library) to the end of the command.</p> <p>...
20,396
<p>I'm using ant to generate javadocs, but get this exception over and over - why?</p> <p>I'm using JDK version <strong>1.6.0_06</strong>.</p> <pre><code>[javadoc] java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc [javadoc] at com.sun.tools.java...
<p>It looks like this has been reported as a <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6442982" rel="noreferrer">Java bug</a>. It appears to be caused by using annotations from a 3rd party library (like JUnit) and not including the jar with that annotation in the javadoc invocation. </p> <p>If that...
<p>I got this problem too. I can compile properly without any errors or warnings. But when I generating javadoc , I got below error.</p> <blockquote> <p><strong><em>[javadoc] java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl cannot be cast to com.sun.javadoc.AnnotationTypeDoc</em></strong></p> </block...
6,663
<p>Say you want to generate a matched list of identifiers and strings</p> <pre><code>enum { NAME_ONE, NAME_TWO, NAME_THREE }; myFunction(NAME_ONE, "NAME_ONE"); myFunction(NAME_TWO, "NAME_TWO"); myFunction(NAME_THREE, "NAME_THREE"); </code></pre> <p>..without repeating yourself, and without auto-generating the code, ...
<p>For your second #define, you need to use the # preprocessor operator, like this:</p> <pre><code>#define myDefine(a) myFunc(a, #a); </code></pre> <p>That converts the argument to a string.</p>
<p>Here's a good way to declare name-list:</p> <pre><code>#define FOR_ALL_FUNCTIONS(F)\ F(NameOne)\ F(NameTwo)\ F(NameThree)\ #define DECLARE_FUNCTION(N)\ void N(); #define IMPLEMENT_FUNCTION(N)\ void N(){} FOR_ALL_FUNCTIONS(DECLARE_FUNCTION); FOR_ALL_FUNCTIONS(IMPLEMENT_FUNCTION); </code></pre> <p>T...
15,358
<p>I am working on my website, and I am trying to get the url parameter "page" which is an integer that tells which entry to read in the MySQL database that hols the HTML for all the pages. Here is my code, with the MySQL username and password removed for security reasons:</p> <pre><code> if ($_GET["page"]) { $con ...
<p>Apart from the injection vulnerability (see John's answer) you should get the title from the mysql_query using</p> <pre><code> $res = mysql_query("SELECT title FROM pageContent WHERE pageID=" . $escapedpage); $title = mysql_fetch_assoc($res); $title = $title['title'] $res2 = mysql_query("SELECT content FROM page...
<p>You should read the manual <a href="http://de.php.net/mysql_query" rel="nofollow noreferrer">http://de.php.net/mysql_query</a></p> <blockquote> <p><strong>Return Values</strong></p> <p>For <code>SELECT</code>, <code>SHOW</code>, <code>DESCRIBE</code>, <code>EXPLAIN</code> and other statements returnin...
38,619
<p>I am trying to filter an IEnumerable object of the duplicate values, so I would like to get the distinct values from it, for example, lets say that it holds days:</p> <p>monday tuesday wednesday wednesday</p> <p>I would like to filter it and return:</p> <p>monday tuesday wednesday</p> <p>What is the most effici...
<pre><code>Dictionary&lt;object, object&gt; list = new Dictionary&lt;object, object&gt;(); foreach (object o in enumerable) if (!list.ContainsKey(o)) { // Do the actual work. list[o] = null; } </code></pre> <p>Dictionary will use a hash table to hold keys therefore lookup is efficient.</p> ...
<p>Another alternative is to use HashSet&lt;T&gt; - a HashSet doesn't allow duplicate items to be used and doesn't require a key/value pair.</p>
44,814
<p>I am using <strong>Flashforge Creator Pro</strong> and a <strong>Flashforge Finder</strong></p> <p><a href="https://i.stack.imgur.com/CE1Aa.jpg" rel="noreferrer" title="Flashforge 3D printers"><img src="https://i.stack.imgur.com/CE1Aa.jpg" alt="Flashforge 3D printers" title="Flashforge 3D printers"></a></p> <p>I w...
<p>Nema 17 is about the physical size of the motor, ie screw hole placement. It doesn't specify anything about the power of the motor. If you are looking to replace the motor, you need quite a bit more info than that it is Nema 17, such as the steps/rotation and the holding torque.</p>
<p>It most likely uses a nema 17 stepper motor. These are the most commonly used stepper motors. Since it is also the same company there is good reason to believe it uses the same steppers. Why must you know, anyways?</p>
755
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/710288/where-are-the-best-explanations-of-memory-management-for-iphone">Where are the best explanations of memory management for iPhone?</a> </p> </blockquote> <p>I come from a web development background. I'm g...
<p>On top of the official Apple resources listed in the post arul linked to, here are some other good reads on the topic:<br><br> <a href="http://web.archive.org/web/20060418151507/http://www.stepwise.com/Articles/Technical/HoldMe.html" rel="nofollow noreferrer">Hold me, use me, free me</a><br> <a href="http://www.coco...
<p>I used the Memory Management video training course from the <a href="http://www.macdevnet.com" rel="nofollow noreferrer">Mac Developer Network</a>. Gave me exactly what I needed when I was starting out. It immediately paid benefits when I started having my own memory management problems. </p>
48,391
<p>I have a simple page that displays a user's email addresses in a table. I also have a textbox underneath the table and an "add" button. Currently, I am using a simple form post that is handled by a controller that will add the e-mail address to the database and reload the page. This works fine, but I'm looking to...
<p>You should use XML or JSON. I prefer JSON because it's easy to parse back on the javascript side.</p> <p>In the click handler for the add button, make an AJAX call to some MVC path specifies what email has been added. Make the code for that path insert the email specified. Then, just return a result:</p> <pre><cod...
<p>When you apply EnganderedMassa's anwser, you could also the client side capability with a <a href="http://ejohn.org/blog/javascript-micro-templating/" rel="nofollow noreferrer">micro-template</a>. This is a technique used by John Resig / jQuery god to parse and format data sets returned from a post. Your table is ...
38,016
<p>this is my first question to stackoverflow so here it goes...</p> <p>I use cruise control for my continuous integration scheme, i want to use obfuscation in order to add another protection layer to my assemblies. The thing is that i don't know how to go about it since i couldn't find articles describing about this....
<p>@konstantinos.konstantinidis.myopenid.com: your problem seems to be with the setup project not the continuous integration server. </p> <p>You have the setup project picking up the primary outputs for the project. </p> <p>Change it to use file references to the outputs. It's a little more configuration in the set...
<p>Nice to hear someone is using CruiseControl.NET. That is a nice tool. You can use a command line tool for obfuscation as RemoteSoft .NET Obfuscator and integrate a call to the tool in the build script. See example on how to execute a file below from CruiseControl.NET wiki.</p> <p><a href="http://www.remotesoft.com/...
11,653
<p>Would it be useful to be able to provide method return value for null objects?</p> <p>For a List the null return values might be:</p> <pre><code>get(int) : null size() : 0 iterator() : empty iterator </code></pre> <p>That would allow the following code that has less null checks.</p> <pre><code>List items = null;...
<p>It's a pattern called Null Object</p> <p><a href="http://en.wikipedia.org/wiki/Null_Object_pattern" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Null_Object_pattern</a></p>
<p><strong>This is a good idea.</strong></p> <p>Smalltalk does this.</p> <p>There is a NULL object. It <em>doesn't</em> descend from Object. (Smalltalk is a singly-rooted class hierarchy like Java)</p> <p>For the advanced student, you can sub-class it for making proxies!</p>
12,436
<p>How can I efficiently and effectively detect the version and, for that matter, any available information about the instance of <a href="http://silverlight.net/" rel="nofollow noreferrer">Silverlight</a> currently running on the browser?</p>
<p>The Silverlight control only has an <a href="http://msdn.microsoft.com/en-us/library/system.windows.interop.silverlighthost.isversionsupported(VS.95).aspx" rel="nofollow noreferrer">IsVersionSupported function</a>, which returns true / false when you give it a version number, e.g.:</p> <pre><code>if(slPlugin.isVers...
<p>Look in silverlight.js:</p> <p><a href="http://forums.asp.net/p/1135746/1997617.aspx#1997617" rel="nofollow noreferrer">http://forums.asp.net/p/1135746/1997617.aspx#1997617</a></p>
4,104
<p>I want to create a VB.NET generic factory method that creates instances of classes (as a home-grown inversion of control container). If I pass the interface IDoSomething as the generic parameter, I want to return an instance of DoSomething (that implements IDoSomething). I cannot figure out the syntax of the if st...
<pre><code>Public Function Build(Of T) As T Dim foo As Type = GetType(T) If foo Is GetType(IDoSomething) Then Return New DoSomething() ... End If End Function </code></pre>
<pre><code>Public Function Build(Of T) as T If T.gettype Is gettype(IDoSomething) then Return New DoSomething() ElseIf T.gettype Is gettype(IAndSoOn) Then Return New AndSoOn() Else Throw New WhatWereYouThinkingException("Bad") End If End Sub </code></pre>
18,012
<p>I've tried this both with and without the 'ExceptionType' parameter. I have an Error.aspx page in both the Views/Shared folder and the Views/thisController folder. But everytime I run this I get a "Server Error in '/' Application." error page, rather than the nice one in Views/Shared.</p> <p>Any idea what could be ...
<p>I do indeed have this in my web.config</p> <pre><code>&lt;customErrors mode="On"&gt;&lt;/customErrors&gt; </code></pre> <p>Must be something else at play.</p>
<p>It doesn't work for me on my current project or a new one. It's probably a "feature".</p> <p><strong>EDIT:</strong> it looks like you have customErrors enabled (mode="On") for it to work according to this snippet from HandleErrorAttribute.cs:</p> <pre><code>// If custom errors are disabled, we need to let the norm...
43,569
<p>Edit: Warning - I now realize that the following technique is generally regarded as a bad idea because it creates hidden dependencies for the sake of looking neat.</p> <hr> <p>I recently discovered that you can use the StackTrace to infer information about the caller of a method.</p> <p>This enables you to create...
<p>There's two reasons why not to do this:</p> <ul> <li>It's slow</li> <li>It's creates a brittle solution.</li> </ul> <p>If you wanted to do this, you'd better off using a tool that supports Aspect Oriented Programming, such as Castle's Dynamic Proxy.</p>
<p>That doesn't seem cool to me at all. Why would you want to put every possible way to get required state in the method itself? This is like an anti pattern for dependency injection. Don't go there.</p>
41,141
<p>I need to evaluate a mathmatical expression that is presented to me as a string in C#. Example noddy but gets the point across that the string as the expression.</p> <p>I need the evaluate to then populate an int.</p> <p>There is no Eval() in C# like in others langugaes...</p> <pre><code>String myString = "3*4";...
<p>The way I see it, you have two options - use an expression evaluator or construct, compile and run C# code on the fly.</p> <p>I would go with an expression evaluator library, as you do not have to worry about any security issues. That is, you might not be able to use code generation in medium trust environments, s...
<p>In an interpreted language you might have a chance of evaluating the string using the interpreter. In C# you need a parser for the language the string is written in (the language of mathematical expressions). This is a non-trivial exercise. If you want to do it, use a recursive-descent parser. The early chapters ...
21,053
<p>I just started diving into ADO.NET Data Services for a project, and I quickly ran into a problem. At first I was amazed by the performance, but then I realized that the data was cached. My project relies on real-time data, and I'd love to use the ADO.NET Data Services REST query syntax (without needing to use WCF or...
<p>By default the data context has MergeOption set to AppendOnly. This means that re-requests will only add new entities and will not update existing ones. Try setting MergeOption to OverwriteChanges:</p> <pre><code>this.context.MergeOption = MergeOption.OverwriteChanges; </code></pre> <p>This worked for me when I no...
<p>That link is helpful, but it doesn't really talk about ETags and caching, it just mentions that ETags can be <em>used</em> for caching. Do you have an example?</p>
46,009
<p>The following JavaScript supposes to read the popular tags from an XML file and applies the XSL Stylesheet and output to the browser as HTML.</p> <pre><code>function ShowPopularTags() { xml = XMLDocLoad("http://localhost/xml/tags/popular.xml?s=94987898"); xsl = XMLDocLoad("http://localhost/xml/xsl/popular-tag...
<p>Are you forced into the synchronous solution you are using now, or is an asynchronous solution an option as well? I recall Firefox has had it's share of problems with synchronous calls in the past, and I don't know how much of that is still carried with it. I have seen situations where the entire Firefox interface w...
<p>Well, that code follows entirely different paths for IE and everything-else. I assume the problem is limited to one of them. What browsers have you tried it on, and which exhibit this error?</p> <p>The only other thing I can think of is that the popularTags element may not exist when you're trying to do stuff to it...
12,605
<p>I'm looking to create an Intellij IDEA language support plugin for Erlang.</p> <p>The first and biggest problem I've had is in making the JFlex Erlang syntax definition.</p> <p>Does anyone know where can I get the EBNF or BNF for Erlang?</p>
<p>Why not go <a href="http://www.erlang.org/doc.html" rel="noreferrer">straight to the source</a>? The <a href="http://www.erlang.org/download/erl_spec47.ps.gz" rel="noreferrer">Erlang 4.7 specification</a> lists productions in a grammar.</p>
<p>Have a look at <code>lib/compiler/src/core_parse.yrl</code> in the otp source distribution.</p>
28,833
<p>You've just written a pile of code to deliver some important feature under pressure. You've cut a few corners, you've mashed some code into some over-bloated classes with names like SerialIndirectionShutoffManager..</p> <p>You tell your boss you're going to need a week to clean this stuff up.</p> <p>"Clean what u...
<p>It's important to include refactoring time in your original estimates. Going to your boss after you've delivered the product and then telling him that you're not actually done is lying about being done. You didn't actually make the deliverable deadline. It's like a surgeon doing surgery and then not making sure he p...
<p>Less money now for me to refactor...</p> <p>or more money later to fix whatever goes wrong and for me to refactor.</p>
10,277
<p>I develop web applications and in my job so far, I have been waging battles with various browsers whenever some JS or CSS quirks happen. I believe using GWT will help me tremendously from what I understand from <a href="http://code.google.com/webtoolkit/" rel="nofollow noreferrer">this</a> description:</p> <blockqu...
<p>You don't say if you've got any background with Java. If you don't, then, well, I can't speak to what your learning curve may be.</p> <p>However...as someone who's been working with Java for ~9 years, and much of that time spent with Swing, I've found GWT very easy to learn.</p> <p>The widgets are different from S...
<p>I maybe a little late to the party... but for future readers...</p> <p>I have been building GWT apps for a little less than 3 years now, so I maybe in a good position to answer the "how easy it is to learn GWT" question. </p> <p>When I decided to write GWT apps, my Java skills weren't as comfy, so my GWT learning ...
46,981
<p>I have many unused computers at home. What would be the easiest way for me to utilize them to parallelize my C# program with little or no code changes?</p> <p>The task I'm trying to do involves looping through lots of english sentences, the dataset can be easily broken into smaller chunks, processed in different ma...
<blockquote> <p>… with little or no code changes?</p> </blockquote> <p>Difficult. Basically, look into WCF as a way to communicate between various instances of the program across the network. Depending on the algorithm, the structure might have to be changed drastically, or not at all. In any case, you have to find ...
<p>Before I would invest in parallelizing your program, why not just try breaking the datasets down into pieces and manually run your program on each computer and collate the outputs by hand. If that works, then try automating it with scripts and write a program to collate the outputs.</p>
34,665
<p>I would like to store my FreeMarker templates in a database table that looks something like:</p> <pre><code>template_name | template_content --------------------------------- hello |Hello ${user} goodbye |So long ${user} </code></pre> <p>When a request is received for a template with a particular nam...
<p>We use a StringTemplateLoader to load our tempates which we got from the db (as Dan Vinton suggested)</p> <p>Here is an example:</p> <pre><code>StringTemplateLoader stringLoader = new StringTemplateLoader(); String firstTemplate = "firstTemplate"; stringLoader.putTemplate(firstTemplate, freemarkerTemplate); // It'...
<p>Implement configuration.</p> <p>Example : </p> <pre><code>@Configuraton public class FreemarkerConfig { @Autowired TemplateRepository tempRepo; @Autowired TemplateUtils tempUtils; @Primary @Bean public FreeMarkerConfigurationFactoryBean getFreeMarkerConfiguration() { // Create new configuration bean ...
46,596
<p>I traditionally deploy a set of web pages which allow for manual validation of core application functionality. One example is LoggerTest.aspx which generates and logs a test exception. I've always chosen to raise a DivideByZeroException using an approach similar to the following code snippet: </p> <pre><code>try { ...
<pre><code>try { throw new DivideByZeroException(); } catch (DivideByZeroException ex) { LogHelper.Error("TEST EXCEPTION", ex); } </code></pre>
<p>For testing purposes you probably want to create a specific class (maybe TestFailedException?) and throw it rather than hijacking another exception type.</p>
43,584
<p>On Ubuntu Linux with Gnome, running my Swing application by double clicking on the jar file in Gnomes file browser leads to errors because required libraries that are dynamically loaded via the Java Plugin Framework (residing in subdirectories) are not found.</p> <p>The base libraries for the framework itself are r...
<p>I believe if you add to the jar a META-INF/MANIFEST.MF file containing a "Classpath:" attribute, with a value specifying the relative paths to the jars you need (I'm not sure whether they are space or comma separated), that might work.</p>
<p>Java loads jars in order in its classpath, i.e. jar1:jar2:jar3... Most java applications ship with some sort of script which sets all of this up by specifying a classpath and a list of jars that the application will need. </p> <p>What you want to do is probably not terribly advisable, as it means globally specifyin...
32,831
<p>Can someone explain to or link to an article that explains how the parameters passed into the action of a controller are populated? I understand the basic mapping when you have the Controller/Action/ID and the ID is passed in as a variable, if it doesn't convert to the type that you are asking for then it won't be p...
<p>Generally, its a function of ControllerActionInvoker. Objects are passing into the action after they instantiated in custom ControllerActionInvoker implementation. For more info about how ControllerActionInvoker works take a look at <a href="http://lostintangent.com/2008/07/03/aspnet-mvc-controlleractioninvoker-part...
<p>First of all, the only way you'll get parameters passed to a method with the [AcceptVerbs(HttpVerbs.Get)] attribute is via query parameters. Example:</p> <pre><code>http://localhost/Task/Index/?task=mytask&amp;todolist=a,b,c,d </code></pre> <p>Many of the action methods you see with complex parameters are called v...
47,824
<p>Some electronics come as a single PCB. They have CPU and everything on just one board.</p> <p>Other electronics are a shield for an Arduino. So these are always two boards. The Arduino and the other PCB.</p> <p>You probably don't want to exchange the Arduino unless it is broken. Does it break that often or are the...
<p>Many 3d printer motherboards are based on Arduino/Atmega microcontroller and just add some stepper motor drivers, MOSFETs and such in a single board. That explains why you use the Arduino IDE to update or modify their firmware.</p> <p>Now why you would want to use an Arduino + an Arduino shield board like RAMPS? We...
<p>There isn't really a big advantage to one solution or the other. The approach of having separate boards means it is more modular and broken parts can be replaced more easily, but electronics don't break on their own: it is almost always user error. If you are even a tiny bit careful when assembling your electronics,...
189
<p>Often while editing config files, I'll open one with vi and then when I go to save it realize that I didn't type</p> <pre><code>sudo vi filename </code></pre> <p>Is there any way to give vi sudo privileges to save the file? I seem to recall seeing something about this while looking up some stuff about vi a while a...
<p><code>%</code> is replaced with the current file name, thus you can use:</p> <pre><code>:w !sudo tee % </code></pre> <p>(<code>vim</code> will detect that the file has been changed and ask whether you want to it to be reloaded. Say yes by choosing <code>[L]</code> rather than OK.)</p> <p>As a shortcut, you can de...
<p>A quick hack you can consider is doing a chmod on the file you're editing, save with vim, and then chmod back to what the file was originally.</p> <pre><code>ls -l test.file (to see the permissions of the file) chmod 777 test.file [This is where you save in vim] chmod xxx test.file (restore the permissions you foun...
2,340
<p>I have a page which is largely created by DOM script, which generates a table of images (normal img elements) from several webcams (helping out a friend with a pet boarding and my HTML/DOM is a bit rusty).</p> <p>It works fine in FF3 or Chrome, but not in IE7, In fact, the whole table is not visible in IE (but the...
<p>One gotcha I found is that in IE, if you dynamically create tables using <code>document.createElement()</code>, you need <code>table(tbody(tr(tds)))</code>. Without a <code>tbody</code>, the table will not show.</p>
<p>Have you started by resetting the CSS to a common base? Have a look at <a href="http://meyerweb.com/eric/tools/css/reset/" rel="nofollow noreferrer">CSS Reset</a> or <a href="http://developer.yahoo.com/yui/reset/" rel="nofollow noreferrer">YUI Reset CSS</a>. (But without an example page to look at, we're going to ...
17,783
<p>I was wondering if anybody could point me towards a free ftps module for python.</p> <p>I am a complete newbie to python, but this is something I need for a work project. I need an ftps client to connect to a 3rd party ftps server.</p> <p>thanks,</p> <p>David.</p>
<p>I believe you could use Twisted to implement FTPS by simply using its FTP implementation, but changing the <a href="http://twistedmatrix.com/trac/browser/trunk/twisted/protocols/ftp.py?rev=24609#L2186" rel="nofollow noreferrer"><code>FTPClient.connectFactory</code></a> attribute to be a function that does something ...
<p>I haven't tried it myself (yes, I just used Google and followed some links), but <a href="http://www.lag.net/paramiko/" rel="nofollow noreferrer">http://www.lag.net/paramiko/</a> seems to be the recommended solution. From a cursory glance, it's an SSH implementation in pure Python, which allows tunneling for things ...
25,495
<p>What is the purpose of the code behind view file in ASP.NET MVC besides setting of the generic parameter of ViewPage ?</p>
<p>Here's my list of reasons why code-behind can be useful taken from <a href="https://stackoverflow.com/questions/489415/how-to-get-a-codebehind-file-for-an-asp-net-mvc-view-in-rc1-to-be-created-by-de">my own post</a>. I'm sure there are many more.</p> <ul> <li>Databinding legacy ASP.NET controls - if an alternative ...
<p>This is a great question. Doesn't MVC exist in the ASP.NET environment, without using the specific MVC pattern. </p> <p>View = aspx</p> <p>Controller = aspx.cs (codebehind)</p> <p>Model = POCO (Plain Old C#/VB/.NET objects)</p> <p>I'm wondering why the added functionality of MVC framework is helpful. I worked...
13,369
<p>I'm a developer so I'm a little lost in the DBA world. Our systems guys have given me a backup of an Oracle 9i database. I have installed oracle 9i on my pc and am now trying to 'import' the backup files so I have a normal database to work with.</p> <p>The backup folder has on SNCF[SID].ora file and around 150 [S...
<p>OK, first things first. Exactly what version of Oracle was the backup taken from? 9i is a marketing label-- we need the full 4 digit version number (i.e. 9.2.0.4). Is your PC running exactly the same version of Oracle? Is your PC running exactly the same operating system?</p> <p>How was the backup done? Are you loo...
<p>.ora files??? That's usually the extension for a pfile (in 9i you would prefer having an spfile instead).</p> <p>No idea about the dated/numbered files. Maybe they're alert logs? or are they exp dumps with a weird extension. or are they part of an rman backup?</p> <p>You say "The backup was done specifically so I ...
37,946
<p>I have a ticker which items are updated using polling. I have written a simple jQuery plugin for the ticker which is invoked like so:</p> <pre><code>$("#cont ul").ticker(); </code></pre> <p>Which turns a ul into a ticker, scrolling through the li. To add new items I have to add lis to the ul, which works fine. How...
<p>what you should do is extend the settings for your plugin:</p> <pre><code>jQuery.ticker = function(settings) { var settings = jQuery.extend( { action : 'create', item : $(this) } ,settings); return $(this).each(function(){ if(settings.action =='create') { //initialize ticker.. } else if(settings.action == 'add'...
<p>jQuery isn't really an OO solution, so you're correct in saying that it's not really the "jQuery way". I've heard Prototype is all about OO, so you might want to look into that one day.</p> <p>There's no reason you couldn't add another function to the jQuery object though:</p> <pre><code>$.fn.addTickerItem = funct...
44,976
<p>I have a VB.net test application that clicks a link that opens the Microsoft Word application window and displays the document. How do I locate the Word application window so that I can grab some text from it?</p>
<p>This method has several limitations, but I still find it very useful. I'll list the limitations (I know of) up front and let whoever wants to use it do so at their own risk.</p> <ol> <li>The original version I posted over-reported time spent in recursive calls (as pointed out in the comments to the answer).</li> <l...
<p>The article <em>Code profiler and optimizations</em> has lots of information about C++ code profiling and also has a free download link to a program/class that will show you a graphic presentation for different code paths/methods.</p>
8,646
<p>Here is a stripped down version of what I use to authenticate users, it works fine on my PHP v5.0.2/MySQL 4.0.21 server, but fails on my PHP v5.1.6/MySQL v5.0.45 server.</p> <p>In the code below, should I be aware of anything that might not be supported by the newer version of PHP &amp; MySQL? Global variables have...
<p>I'm guessing it might be because of <code>$HTTP_POST_VARS</code>. Try replacing that with <code>$_POST</code>. If it still doesn't work, try putting the following snippet right after <code>&lt;?php</code>:</p> <pre> <code>// Enable displaying errors error_reporting(E_ALL); ini_set('display_errors', '1'); </code></p...
<p>Try setting <a href="http://www.php.net/manual/en/ini.core.php#ini.register-long-arrays" rel="nofollow noreferrer">register_long_arrays</a> = On in php.ini and see if that fixes your issues. </p> <p>On another note you shouldn't be building your queries up like that. Look into using <a href="http://www.php.net/mysq...
26,987
<p>Where would you recommend that I find a company to develop or buy a CD/DVD loading arm similar to: <a href="http://www.dextimus.com/" rel="nofollow noreferrer">http://www.dextimus.com/</a></p> <p>Preferably programmable via USB but if I only can get one with a serial interface that would be fine. Drivers dont matte...
<p>If you have some experience with electronics, you can give it a shot and build it yourself, like <a href="http://www.sentex.net/~mwandel/tech/changer.html" rel="nofollow noreferrer">this</a> or <a href="http://www.redfrontdoor.org/cd-changer.html" rel="nofollow noreferrer">this</a>.</p> <p>I should add that the sch...
<p>You might want to contact Aaron Shephard about his <a href="http://www.mini-itx.com/projects/florian/" rel="nofollow noreferrer">Florian</a> project.</p>
44,993
<p>Here's a wierd one. I'm reusing a code base that unfortunately must not be updated. This code makes a call to <code>HttpContext.Current.Request.QueryString</code>. Ideally, I need to push a value into this collection with every request that is made. Is this possible - perhaps in an HTTP Module?</p>
<p>Without using reflection, the simplest way to do it would be to use the RewritePath function on the current HttpContext object in order to modify the querystring. </p> <p>Using an <a href="http://msdn.microsoft.com/en-us/library/system.web.ihttpmodule.aspx" rel="noreferrer">IHttpModule</a>, it might look something ...
<p>Ditto Espo's answer and I would like to add that usually in medium trust (specific to many shared hostings) you will not have access to reflection so ... RewritePath will remain your probably only choice.</p>
5,458
<p>I work with a number of new tech support folks. Sometimes, they like to fix small issues which may not be a high priority for our developers. This requires teaching SVN basics to non-programmers, which I've found can get a little tricky.</p> <p>What resources have you found useful? Are there diagrams you typica...
<p>Basically you can discuss what SVN can do, that it's not just for code, and can be used for any documents in general.</p> <p>Examples without mentioning code will be useful:</p> <p>An author writes his book and put a copy of it in a central location. That document is named 1. When he makes a change, he puts a copy...
<p>I would just explain a scenario where tracking previous revisions is important as well as having a branch for a client. </p> <p>There are more general version control tutorials out there that are not specific to svn or others that might be useful. </p> <p>You don't want to overwhelm them - just give them the bas...
44,416
<p>What is the simplest and most elegant way to simulate the hover pseudo-class for non-Anchor tags in IE6?</p> <p>I am specifically trying to change the cursor in this instance to that of a pointer.</p>
<p>I think the simplest way is to use the <a href="http://www.xs4all.nl/~peterned/csshover.html" rel="nofollow noreferrer">hover.htc</a> approach. You add the hover.htc file to your site, then reference it in your stylesheet:</p> <pre class="lang-css prettyprint-override"><code>body { behavior:url("csshover.htc"); } <...
<p>I liked the mouseover/out best since I actually already needed to swap the image anyhow. I really should have thought of doing this with javascript to begin with.</p> <p>Thanks for the quick answers.</p> <p>@Joseph</p> <p>Thanks for that link. I had never heard of this technique before and really like the idea....
5,721
<p>How do I perform a reverse DNS lookup, that is how do I resolve an IP address to its DNS hostname in Perl?</p>
<p>gethostbyaddr and similar calls. See <a href="http://perldoc.perl.org/functions/gethostbyaddr.html" rel="noreferrer"><a href="http://perldoc.perl.org/functions/gethostbyaddr.html" rel="noreferrer">http://perldoc.perl.org/functions/gethostbyaddr.html</a></a></p>
<p>This might be useful...</p> <pre><code>$ip = "XXX.XXX.XXX.XXX" # IPV4 address. my @numbers = split (/\./, $ip); if (scalar(@numbers) != 4) { print "$ip is not a valid IP address.\n"; next; } my $ip_addr = pack("C4", @numbers); # First element of the array returned by gethostbyaddr is host name. my ($name) =...
11,106
<p>Most text editors have a navigation pane that lets you see all the files you currently have open. Or a pane that lets you browse a file directory.</p> <p>How do I do this in Emacs?</p>
<p>Try <kbd>Ctrl-x</kbd> followed by <kbd>Ctrl-b</kbd> (in Emacs terminology <kbd>C-x C-b</kbd>) to list buffers.</p>
<p>Also, if you want to get rid of the list of open buffers, type <kbd>C-x 1</kbd>.</p>
9,041
<p>Applications which run on mobile devices have special user interface requirements. I think Apple did a great job introducing innovative controls on the iPhone/iPod touch platform.</p> <p>Now, I have to design an application for the Windows Mobile platform using the .NET Compact Framework (Visual Studio 2008). I won...
<p>A few months ago, I searched and found nothing (satisfactory). I had to implement my own control library. Lack of good existing "touch-aware" libraries makes me think I should commercialize mine, but it's very incomplete.</p>
<p>mirabyte, it seems good, but you can't try in some test application their touch controls component, the are only provide a sample application. Otherwise, you can't see how to look inside of your application. </p> <p>In my opinion, you should choice resco, they are working in PocketPC platform many year and they kno...
23,204
<p>I have several &lt;li> elements with different id's on ASP.NET page:</p> <pre><code>&lt;li id="li1" class="class1"&gt; &lt;li id="li2" class="class1"&gt; &lt;li id="li3" class="class1"&gt; </code></pre> <p>and can change their class using JavaScript like this:</p> <pre><code>li1.className="class2" </code></pre> ...
<p>Add <code>runat="server"</code> in your HTML page</p> <p>then use the attribute property in your asp.Net page like this</p> <pre><code>li1.Attributes["Class"] = "class1"; li2.Attributes["Class"] = "class2"; </code></pre>
<p>You also can try this too if u want to add some few styles:</p> <pre><code>li1.Style.add("color","Blue"); li2.Style.add("text-decoration","line-through"); </code></pre>
14,685
<p>Somewhere in the code, a waitHandle is used to perfom some actions. However the thing with waithandle is that the form freezes while waiting for some action to complete. So the following code would not work:</p> <pre><code>frmProgressBar.show(); int successOrFail = PerformSynchronousActionUsingWaitHandle(); frmProg...
<p>Can't you use the BackgroundWorker Class? <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx</a></p>
<p>Use two different threads to handle this... one thread for progress bar and one thread for PerformSynchronousActionUsingWaitHandle() .. Hope this helps in some way</p>
43,655
<p>I can't quite figure out this syntax problem with a <code>case</code> expression in a <code>do</code> block.</p> <p>What is the correct syntax? </p> <p>If you could correct my example and explain it that would be the best.</p> <pre><code>module Main where main = do putStrLn "This is a test" s &lt;-...
<p>return is an (overloaded) function, and it's not expecting its first argument to be a keyword. You can either parenthesize:</p> <pre><code>module Main where import System(getArgs) main = do putStrLn "This is a test" s &lt;- foo putStrLn s foo = do args &lt;- getArgs return (case arg...
<p>Equivalently:</p> <pre><code>foo = do args &lt;- getArgs case args of [] -&gt; return "No Args" [s]-&gt; return "Some Args" </code></pre> <p>It's probably preferable to do as wnoise suggests, but this might help someone understand a bit better.</p>
18,877
<p>iMacros is a very nice tool which allows to authomatically fill HTML forms and extract content, includes cycles and many other features. The problem is that it is quite tricky to make it extracting content properly. For example, I have failed to extract all London-to-Tokio flight prices for all the dates between 1/1...
<p>Bah, I installed it but never really used it: I am happy enough with <a href="https://addons.mozilla.org/firefox/addon/748" rel="nofollow noreferrer" title="Greasemonkey :: Firefox Add-ons">Greasemonkey</a>.<br> <a href="http://groups.csail.mit.edu/uid/chickenfoot/install.html" rel="nofollow noreferrer" title="Chick...
<p>Bah, I installed it but never really used it: I am happy enough with <a href="https://addons.mozilla.org/firefox/addon/748" rel="nofollow noreferrer" title="Greasemonkey :: Firefox Add-ons">Greasemonkey</a>.<br> <a href="http://groups.csail.mit.edu/uid/chickenfoot/install.html" rel="nofollow noreferrer" title="Chick...
19,349
<p>I have to deploy my php/html/css/etc code to multiple servers and i am looking at my options for software that allows easy and secure deployment to multiple servers.</p> <p>Also helps if it could be tied into my SVN.</p> <p>Any suggestions?</p>
<p><a href="http://capify.org/" rel="noreferrer">Capistrano</a> is pretty handy for that. There's a few people using it (<a href="http://www.simplisticcomplexity.com/2006/8/16/automated-php-deployment-with-capistrano/" rel="noreferrer">1</a>, <a href="http://www.contentwithstyle.co.uk/Blog/178" rel="noreferrer">2</a>, ...
<p>I had marked a post on how to deploy your websites using Subversion : <a href="http://blog.lavablast.com/post/2008/02/I2c-for-one2c-welcome-our-new-revision-control-overlords!.aspx" rel="nofollow noreferrer">http://blog.lavablast.com/post/2008/02/I2c-for-one2c-welcome-our-new-revision-control-overlords!.aspx</a></p>...
12,201
<p>Does anyone know of any good C++ code that does this?</p>
<p>I faced the encoding half of this problem the other day. Unhappy with the available options, and after taking a look at <a href="http://www.geekhideout.com/urlcode.shtml" rel="nofollow noreferrer">this C sample code</a>, i decided to roll my own C++ url-encode function:</p> <pre><code>#include &lt;cctype&gt; #includ...
<p>Had to do it in a project without Boost. So, ended up writing my own. I will just put it on GitHub: <a href="https://github.com/corporateshark/LUrlParser" rel="nofollow">https://github.com/corporateshark/LUrlParser</a></p> <pre><code>clParseURL URL = clParseURL::ParseURL( "https://name:pwd@github.com:80/path/res" )...
18,678
<p>(The original question was asked there : <a href="http://www.ogre3d.org/phpBB2/viewtopic.php?t=44832" rel="nofollow noreferrer">http://www.ogre3d.org/phpBB2/viewtopic.php?t=44832</a> )</p> <p>Someone asked : "While I would like to build everything in vs2008 (VC9), the PhysX SDK is built with vs2005 (VC8). Would th...
<p>The <a href="http://www.ctan.org/pkg/pgfgantt" rel="noreferrer">pgfgantt</a> package is quite easy to use and does linking.</p>
<p>There is the <a href="http://www.ctan.org/tex-archive/graphics/pstricks/contrib/pst-gantt/" rel="nofollow noreferrer">pst-gantt package</a>. The bad news is, that you have to draw dependencies between the tasks yourself. So you need to use the <code>\psline</code> macro to draw lines and arrows.</p>
20,713
<h2>The question proper</h2> <p>Has anyone experienced this exception on a <strong>single core</strong> machine?</p> <blockquote> <p><code>The I/O operation has been aborted because of either a thread exit or an application request.</code></p> </blockquote> <h2>Some context</h2> <p>On a single CPU system, only on...
<p>Based on your description, my inclination would be to blame the COM port driver. Was the driver for it developed prior to the multicore era? I once had a similar issue with such a device which a later driver revision thankfully fixed.</p> <p>Addition: To answer your question on how to limit your app to a single CPU...
<p>Prior to Vista any async IO that was in progress when the thread that issued it terminates is terminated. This tends to give the error that you report, i.e.</p> <blockquote> <p>The I/O operation has been aborted because of either a thread exit or an application request.</p> </blockquote> <p>I'm not sure if t...
38,570
<p>I'm in a situation where I would to generate a script for a database that I could run on another server and get a database identical to the original one, but without any of the data. In essence, I want to end up with a big create script that captures the database schema. </p> <p>I am working in an environment that...
<p>Run SQL Server Management Studio, right click on the database and select <code>Script Database as &gt; Create to &gt; file</code></p> <p>That's for SQL Server 2005. SQL Server 2000 Enterprise Manager has a similar command. Just right-click on the database <code>&gt; All Tasks &gt; Generate Scripts</code>.</p> <p>E...
<p>The others are correct, but in order to create a full database from scratch, you need to create a 'device' in SQL before you run the create tables, and procedures scripts...</p> <p>Use ADODB, since just about every (if not every) Windows box has it installed to execute the script.</p> <p>Hell, you could even write...
20,409
<p>We have the TAncestor class which has a virtual method GetFile.<br> We will have some TDescendant = class(TAncestor) which may override GetFile.<br> We want to insure that in such a case those overriden methods do not call inherited in their implementation.<br> But if they don't implement GetFile and just use the on...
<p>No. There is no way to force code outside your control to <em>not</em> call something that is otherwise perfectly accessible. The best you can do is strongly discourage the practice in the documentation for the class.</p> <p>What are the consequences if a descendant calls the inherited method? If it means the progr...
<p>I do not think you really want to do this, but in any case it doesn't sound like you're using inheritance properly.</p> <p>If you really need to do something like this, maybe you could use the <a href="http://en.wikipedia.org/wiki/Strategy_pattern" rel="nofollow noreferrer">strategy pattern</a> instead? Extract Get...
37,110
<p>We are in the process of selecting a workflow solution for a company that uses Microsoft products end to end. Given the news on WF4, in that it seems to be essentially a rewrite of previous versions, is it a wise move to back the current version or should we be looking elsewhere?</p> <p>Ie - is the current version ...
<p>Haiving just launched a project which .NET 3.5 and workflow I'd say that the current release of WF is <strong>good enough</strong> to use and run with. It has helped us to get a product out quickly (we have the usual feature creep and requirements changing weekly). However, I have a list of complaints with it:</p> ...
<p>I don't know why people have such negative impressions about WF. Sure it has it drawbacks, but I thought it was pretty useful. The one major issue I have about it is the lack of support for upgrading existing workflow (bullent #2 in gbanfill's list).</p>
44,113
<p>State should include at least the following:</p> <ul> <li>All settings set via SetStreamResource()</li> <li>Indices</li> </ul> <p>I have a class whose Draw() function will call SetStreamResource, set Indices and eventually call DrawIndexedPrimitive(). I would like to restore the device state before Draw() returns....
<p>State blocks are the mechanism provided by the API to save and restore chunks of device state. I cover the details of state blocks in Chapter 3. Direct3D Devices from my book <a href="http://www.xmission.com/~legalize/book/download/" rel="nofollow noreferrer">The Direct3D Graphics Pipeline</a>. You can download th...
<p>Looks like these will do it:</p> <pre><code>Microsoft::DirectX::Direct3D::Device::BeginStateBlock Microsoft::DirectX::Direct3D::Device::EndStateBlock </code></pre>
30,144
<p>I am trying to implement performance testing on ActiveMQ, so have setup a basic producer and consumer to send and receive messages across a queue. I have created a producer with no problems, getting it to write a specific number of messages to the queue:</p> <pre><code> for(int i = 0; i &lt; numberOfMessages; i++){...
<p>Not many views on this yet, but for future reference if anyone has the same problem, I have found the solution. The configuration for activeMQ limits the amount of memory used by the senders and receivers before slowing them down, the default values given to me were:</p> <pre><code>&lt;systemUsage&gt; &...
<p>Its a classic issue with messaging; what to do with slow consumers. FWIW more recent ActiveMQ releases such as 5.2 allow you to spool to disk rather than blocking producers when memory gets low</p>
40,629
<p>Where is the best documentation of ffmpeg and libavcodec?</p> <p>It appears that ffmpeg supports many undocumented options that it is very hard to find a good reference.</p>
<ul> <li>ffmpeg -formats</li> <li>ffmpeg -help</li> <li>ffmpeg.org/documentation.html and the</li> <li>source code as last resort.</li> </ul> <p>Unfortunately, this is not easy to figure out.</p>
<p>You could also use <a href="https://ffmpeg.org/doxygen/trunk/index.html" rel="nofollow noreferrer">https://ffmpeg.org/doxygen/trunk/index.html</a> for the libav code and api documentation.</p>
38,462
<p>I have a object to print for which I want the base to be printed very rapidly because it's just a cube but as the print reached around 70 % a complex circular structure needs to be printed at a slower speed. Is there any way I could control the speed at the given percentage of job done?</p> <p>I want the cube to be ...
<p><a href="https://www.simplify3d.com/" rel="nofollow">Simplify3D</a> has the ability to create more than one process, to be applied to the model at specific layers. It appears that feature fits perfectly with your requirements. As an example, you might create a process within S3D for layers 1 to 500 at the desired 50...
<p>Cura has a plugin called &quot;Tweak at Z&quot; that lets you change the speed at a specific layer/height, I used it when printing an object that's basically a curved box for 100 mm and then has tiny features in the last 10 mm and it worked very well.</p>
364
<p>I'm having trouble capturing this data:</p> <pre><code> &lt;tr&gt; &lt;td&gt;&lt;span class="bodytext"&gt;&lt;b&gt;Contact:&lt;/b&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style='font-size:10.0pt;font-family:Verdana; mso-bidi-font-family:Arial'&gt;&lt;b&gt; &lt;/b&gt; ...
<p>If I understand you correctly, you're only interested in the text between the HTML tags. To ignore the HTML tags, simply strip them first:</p> <pre><code>$text = preg_replace('/&lt;[^&lt;&gt;]+&gt;/', '', $html); </code></pre> <p>To grab everything between "Contact:" and "Phone:", use:</p> <pre><code>if (preg_ma...
<p>The seemingly arbitrary stack overflow response to these sort of questions seems to be "omg don't use regexes! Use <a href="http://www.crummy.com/software/BeautifulSoup/" rel="nofollow noreferrer">Beautiful Soup</a> instead!!". Personally I prefer not having to use external libraries for small tasks like this, and r...
49,317
<p>When reading from a <a href="http://search.cpan.org/dist/IO" rel="nofollow noreferrer">IO::Socket::INET</a> filehandle it can not be assumed that there will always be data available on the stream. What techniques are available to either peek at the stream to check if data is available or when doing the read take no ...
<p>Set the <code>Blocking</code> option to <code>0</code> when creating the socket:</p> <pre><code>$sock = IO::Socket::INET-&gt;new(Blocking =&gt; 0, ...); </code></pre>
<p>Checkout <a href="http://search.cpan.org/~gbarr/IO-1.2301/IO/Select.pm" rel="nofollow noreferrer" title="IO::Select">IO::Select</a>; it's very often what I end up using when handling sockets in a non-blocking way.</p>
40,753
<p>There is div named "dvUsers". there is an anchor tag "lnkUsers".</p> <p>When one clicks on anchortag, the div must open like a popup div just below it.</p> <p>Also the divs relative position should be maintained at window resize and all. How to do that using javascript/jquery?</p>
<p>Perhaps you should look for a premade script like <strong>overLIB</strong>: <a href="http://www.bosrup.com/web/overlib/" rel="nofollow noreferrer">http://www.bosrup.com/web/overlib/</a> !-)</p>
<pre><code>$(document).ready(function(){ $("#lnkUsers").click(function(){ $("#dvUser").show("slow"); }); </code></pre> <p>style="display: none" should be applied to dvUser at the first place to make it invisible.</p>
30,064
<p>MySQL has this incredibly useful yet proprietary <code>REPLACE INTO</code> SQL Command. </p> <p>Can this easily be emulated in SQL Server 2005?</p> <p>Starting a new Transaction, doing a <code>Select()</code> and then either <code>UPDATE</code> or <code>INSERT</code> and <code>COMMIT</code> is always a little bit ...
<p>This is something that annoys me about MSSQL (<a href="http://bizvprog.blogspot.com/2008/04/annoying-fundamental-flaw-with-sql.html" rel="noreferrer">rant on my blog</a>). I wish MSSQL supported <code>upsert</code>. </p> <p>@Dillie-O's code is a good way in older SQL versions (+1 vote), but it still is basically tw...
<p>I wrote a <a href="http://www.samsaffron.com/blog/archive/2007/04/04/14.aspx" rel="nofollow noreferrer">blog post</a> about this issue.</p> <p>The bottom line is that if you want cheap updates and want to be safe for concurrent usage, try:</p> <pre><code>update t set hitCount = hitCount + 1 where pk = @id if @@rowc...
2,273
<p>I'm writing a program in C# that runs in the background and allows users to use a hotkey to switch keyboard layouts in the active window. (Windows only supports <kbd>CTRL</kbd>+<kbd>SHIFT</kbd> and <kbd>ALT</kbd>+<kbd>SHIFT</kbd>)</p> <p>I'm using RegisterHotKey to catch the hotkey, and it's working fine.</p> <p>...
<pre><code>PostMessage(handle, WM_INPUTLANGCHANGEREQUEST, 0, LoadKeyboardLayout( StrCopy(Layout,'00000419'), KLF_ACTIVATE) ); </code></pre>
<pre><code> function ChangeRemoteWndKeyboardLayoutToRussian( const RemoteHandle: THandle): Boolean; var Dumme: DWORD; Layout: HKL; begin Layout := LoadKeyboardLayout('00000419', KLF_ACTIVATE); Result := SendMessageTimeOut(RemoteHandle, WM_INPUTLANGCHANGEREQUEST, 0, Layout, SMTO_ABORTIFHUN...
32,958