instruction stringlengths 27 22.5k | chosen stringlengths 27 28.2k | rejected stringlengths 19 24.9k | __index_level_0__ int64 0 10k |
|---|---|---|---|
<h2>Summary</h2>
<p>Hi All,<br />
OK, further into my adventures with custom controls...</p>
<p>In summary, here is that I have learned of three main "classes" of custom controls. Please feel free to correct me if any of this is wrong!</p>
<ol>
<li><strong>UserControls</strong> - Which inherit from <em>UserCo... | <p>I say go ahead with the custom rendered control. I find that in most cases the composite can be easier done and used in a UserControl, but anything beyond that and you'd need to have a finer degree of control (pun unintended) to merit your own rendering strategy.</p>
<p>There maybe controls that are simple enough t... | <p>You might be able to make use of this technique to make design-time easier:</p>
<p><a href="http://aspadvice.com/blogs/ssmith/archive/2007/10/19/Render-User-Control-as-String-Template.aspx" rel="nofollow noreferrer">http://aspadvice.com/blogs/ssmith/archive/2007/10/19/Render-User-Control-as-String-Template.aspx</a>... | 3,815 |
<p>When you add a raft in Slic3r, the first layer of the raft prints at the first layer speed. After the raft is finished, the first layer of the print prints at the standard speed. How can I make the first layer of the actual print slow down to the first layer speed?</p>
| <p>This is still work in progress, and here is what I have so far, but first:</p>
<p><strong>A useful alternative for similar problems:</strong></p>
<p>A problem very similar to this would be to use different settings for different parts of a model in Slic3r. For most settings, this can be achieved through <a href="h... | <p>You shouldn't need to. The purpose of a slower first layer is to help with need adhesion. With a raft the first layer of the model is printing on the raft so it can go at regular speeds.</p>
| 111 |
<p>Is it possible to use a standard color inkjet cartridge to color filament for full color 3D printing?</p>
<p>It seems like a natural next step to me, but I haven't seen much of anything on this. (Just a few ancient experiments on reprap wiki.)</p>
<p>I've learned that some inkjet printers have the heads built into t... | <p>I don't think it makes a lot of sense - you don't need that kind of resolution, and getting a sufficient amount of ink that way to coat the filament would be hard. If you're going to be switching colors rapidly, you'd need a long purge between colors anyway. I also doubt the type of ink is suitable for sticking to f... | <p>AS an FYI, this is becoming available commercially:
<a href="https://www.xyzprinting.com/en-US/product-level/PROFESSIONAL/color-series" rel="nofollow noreferrer">https://www.xyzprinting.com/en-US/product-level/PROFESSIONAL/color-series</a></p>
| 1,734 |
<p>Usually when I'm creating indexes on tables, I generally guess what the <code>Fill Factor</code> should be based on an educated guess of how the table will be used (many reads or many writes).</p>
<p>Is there a more scientific way to determine a more accurate <code>Fill Factor</code> value?</p>
| <p>You could try running a big list of realistic operations and looking at IO queues for the different actions.</p>
<p>There are a lot of variables that govern it, such as the size of each row and the number of writes vs reads.</p>
<p>Basically: high fill factor = quicker read, low = quicker write.</p>
<p>However it... | <p>I would tend to be of the opinion that if you're after performance improvements, your time is much better spent elsewhere, tweaking your schema, optimising your queries and ensuring good index coverage. Fill factor is one of those things that you only need to worry about when you <em>know</em> that everything else i... | 3,212 |
<p>I just assembled a Prusa i3 MK3 and went through the calibration process, but when I print the first layer doesn't look good and my prints come unstuck from the bed. I think it might be Z height but this was as high as I could put the probe without the paper moving on the calibration test. The layers after the first... | <p>Judging by the images you posted in your question, the first layer distance is too far away from the bed for the current filament flow.</p>
<p>This could either be related to:</p>
<ul>
<li>having an offset on the first layer like a height correction in the slicer,</li>
<li>an incorrectly levelled (read height adju... | <p>I used the live-z adjustment feature and set it to +0.150 and now my prints look much better.</p>
| 1,068 |
<p>I've recently discovered that it's possible to place .net assemblies on SQL Server >=2005 servers so that .net functions can be called in T/SQL statements.</p>
<p>I wondered what uses people found for these and how they perform?</p>
| <p>The first general purpose use for the CLR in SQL 2005 I created was a SQL 2005 assembly that has a variety of functions that perform string operations and pattern matches using regular expressions. The native string functions in SQL 2005 can be augmented so that you can validate common formats like phone numbers or ... | <p>I found it to be very useful. </p>
<p>I used this possibility to extend MSSQL2005 XML related functions. </p>
<p>If I remember correctly you can even introduce your own data types.</p>
| 6,076 |
<p>The code</p>
<pre><code>private SomeClass<Integer> someClass;
someClass = EasyMock.createMock(SomeClass.class);
</code></pre>
<p>gives me a warning "Type safety: The expression of type SomeClass needs unchecked conversion to conform to SomeClass<Integer>".</p>
| <p>AFAIK, you can't avoid the unchecked warning when a class name literal is involved, and the <code>SuppressWarnings</code> annotation is the only way to handle this.</p>
<p>Note that it is good form to narrow the scope of the <code>SuppressWarnings</code> annotation as much as possible. You can apply this annotation... | <p>I know this goes against the question, but why not create a List rather than a Mock List?</p>
<p>It's less code and easier to work with, for instance if you want to add items to the list.</p>
<pre><code>MyItem myItem = createMock(myItem.class);
List<MyItem> myItemList = new ArrayList<MyItem>();
myItemL... | 8,114 |
<p>Erasing programs such as Eraser recommend overwriting data maybe 36 times.</p>
<p>As I understand it all data is stored on a hard drive as 1s or 0s.</p>
<p>If an overwrite of random 1s and 0s is carried out once over the whole file then why isn't that enough to remove all traces of the original file?</p>
| <p>A hard drive bit which used to be a 0, and is then changed to a '1', has a slightly weaker magnetic field than one which used to be a 1 and was then written to 1 again. With sensitive equipment the previous contents of each bit can be discerned with a reasonable degree of accuracy, by measuring the slight variances ... | <p>There are "disk repair" type applications and services that can still read data off a hard drive even after it's been formatted, so simply overwriting with random 1s and 0s one time isn't sufficient if you really need to securely erase something.</p>
<p>I would say that for the average user, this is more than suffi... | 8,432 |
<p>Is there a way of mapping data collected on a stream or array to a data structure or vice-versa?
In C++ this would simply be a matter of casting a pointer to the stream as a data type I want to use (or vice-versa for the reverse)
eg: in C++</p>
<pre><code>Mystruct * pMyStrct = (Mystruct*)&SomeDataStream;
pMyStr... | <p>Most people use .NET serialization (there is faster binary and slower XML formatter, they both depend on reflection and are version tolerant to certain degree)</p>
<p>However, if you want the fastest (unsafe) way - why not:</p>
<p>Writing:</p>
<pre><code>YourStruct o = new YourStruct();
byte[] buffer = new byte[M... | <p>if its .net on both sides:</p>
<p>think you should use binary serialization and send the byte[] result.</p>
<p>trusting your struct to be fully blittable can be trouble.</p>
<p>you will pay in some overhead (both cpu and network) but will be safe.</p>
| 2,443 |
<p>How are people unit testing code that uses Linq to SQL? </p>
| <p>Update:</p>
<p>Fredrik has put an example solution on how to do unit test linq2sql applications over at his blog. You can download it at:</p>
<p><a href="http://web.archive.org/web/20120415022448/http://iridescence.no/post/DataContext-Repository-Pattern-Example-Code.aspx" rel="nofollow noreferrer">http://web.archi... | <p>LINQ to SQL is actually really nice to unit test as it has the ability to create databases on the fly from what is defined in your DBML.</p>
<p>It makes it really nice to test a ORM layer by creating the DB through the DataContext and having it empty to begin with.</p>
<p>I cover it on my blog here: <a href="http:... | 7,590 |
<p>HI All,</p>
<p>We have a .Net 2.0 application which has a MySQL backend. We want to be able to deploy MySQl and the DB when we install the application and im trying to find the best solution. The current setup is to copy the required files to a folder on the local machine and then perform a "NET START" commands to... | <p>Not sure where you're at in the project, but if it's a simple and small database you might consider converting it to <a href="http://www.sqlite.org/" rel="noreferrer">SQLite</a>. It's not ideal for Client/Server operations, but if it's low volume/transactions it might work.</p>
| <p>With a Client/Sever setup, you're allowed to require that whoever installs the server install it as an admin. That should solve most of your problems.</p>
<p>Again- that's the server. The clients might be another story.</p>
| 7,190 |
<p>I didn't get the answer to this anywhere. What is the runtime complexity of a Regex match and substitution?</p>
<p>Edit: I work in python. But would like to know in general about most popular languages/tools (java, perl, sed).</p>
| <p>From a purely theoretical stance:</p>
<p>The implementation I am familiar with would be to build a Deterministic Finite Automaton to recognize the regex. This is done in O(2^m), m being the size of the regex, using a standard algorithm. Once this is built, running a string through it is linear in the length of th... | <p>You can trade space for speed by building a nondeterministic finite automaton instead of a DFA. This can be traversed in linear time. Of course, in the worst case this could need O(2^m) space. I'd expect the tradeoff to be worth it.</p>
| 4,180 |
<p>Say I have the following C++:</p>
<pre><code>char *p = new char[cb];
SOME_STRUCT *pSS = (SOME_STRUCT *) p;
delete pSS;
</code></pre>
<p>Is this safe according to the C++ standard? Do I need to cast back to a <code>char*</code> and then use <code>delete[]</code>? I know it'll work in most C++ compilers, because it'... | <p>It's not guaranteed to be safe. Here's a relevant link in the C++ FAQ lite:</p>
<p>[16.13] Can I drop the <code>[]</code> when deleting array of some built-in type (<code>char</code>, <code>int</code>, etc.)?</p>
<p><a href="https://isocpp.org/wiki/faq/freestore-mgmt#delete-array-built-ins" rel="nofollow noreferr... | <p>While this <em>should</em> work, I don't think you can guarantee it to be safe because the SOME_STRUCT is not a char* (unless it's merely a typedef).</p>
<p>Additionally, since you're using different types of references, if you continue to use the *p access, and the memory has been deleted, you will get a runtime e... | 9,635 |
<p>My team is moving from Visual SourceSafe to Subversion soon, while developing/supporting a legacy project in Visual Basic 6.0, so I have a couple of questions:</p>
<ul>
<li>What's the best tool for Subversion IDE integration in Visual Studio 6? (or is it not worth the trouble...)</li>
<li>Are there any best practic... | <p>I would agree that Tortoise SVN in Windows Explorer would be the best way to use SVN with VB6.</p>
<p>The biggest change you will find migrating to SVN is the idea of "Check out" and "Check in" aren't exactly the same as "Update" and "Commit". . . thus, any IDE integration with VB6 is limited because VB6 supports M... | <p>For the server side, VisualSVN Server, is a super simple solution, we are running it in a vmware virtual, and its humming along.</p>
<p>If you are a command line guy, I really like the command line interface for svn, I find it less confusing to get to certain actions than tortoise, such as status of the folder. But... | 4,434 |
<p>From a <a href="http://www.joelonsoftware.com/items/2007/01/26.html" rel="nofollow noreferrer">Joel's post on Copilot</a>:</p>
<blockquote>
<p>Direct Connect! We’ve always done
everything we can to make sure that
Fog Creek Copilot can connect in any
networking situation, no matter what
firewalls or NATs... | <p>It's pretty tricky and interesting. I'm sure I have some details wrong, but the overview is this:</p>
<p>The programs can already talk to each other through Joel's server, so they can exchange information with each other and Joel's server. Further, Joel has their external IP addresses, and they give joel informat... | <p>There is a technique called "<a href="https://en.wikipedia.org/wiki/Hole_punching_(networking)" rel="nofollow noreferrer">Hole Punching</a>" that works well with "Cone" NAT (Cone is a technical familly of router). That's not an 100% sure technique, today, it works well with UDP on about 80% of the router.</p>
<p>Th... | 6,591 |
<p>I'm interested in doing comparisons between the date string and the MySQL timestamp. However, I'm not seeing an easy conversion. Am I overlooking something obvious?</p>
| <p>Converting from timestamp to format:</p>
<pre><code>date('Y-m-d', $timestamp);
</code></pre>
<p>Converting from formatted to timestamp:</p>
<pre><code>mktime(0, 0, 0, $month, $day, $year, $is_dst);
</code></pre>
<p>See <a href="http://www.php.net/manual/en/function.date.php" rel="noreferrer">date</a> and <a href... | <p><a href="http://ca.php.net/manual/en/function.strtotime.php" rel="nofollow noreferrer">strtotime()</a> and <a href="http://ca.php.net/manual/en/function.getdate.php" rel="nofollow noreferrer">getdate()</a> are two functions that can be used to get dates from strings and timestamps. There isn't a standard library fun... | 4,094 |
<p>As part of a project with my university, I have developed a new extruder to attach to a Prusa i3 MK2. My problem is that both the nozzle and PINDA probe have moved 17mm forward and 0.5mm to the right. As a result when I try and calibrate the printer it moves to the home position and the PINDA probe is too far out ov... | <p>Consider the original installation with the orientation of the Pinda probe to the nozzle. Let's say for argument's sake that the Pinda probe is 3 mm to the right and directly in line with the nozzle on the y axis.</p>
<p>If you examine your new nozzle, I would expect that the relationship of the nozzle to the Pinda ... | <blockquote>
<p>What is the simplest method of moving the home position...</p>
</blockquote>
<p>I think the solution outline by @fred_dot_u is very elegant, so I would go with it.</p>
<blockquote>
<p>...so that the printer can be properly calibrated?</p>
</blockquote>
<p>I'm not sure that will be possible.</p>
... | 827 |
<p>I need to copy hundreds of gigs of random files around on my computer and am pretty leery of using the vanilla file copy built into Windows.</p>
<p>I don't want it to hang on a "Are you sure?", "Are you really sure?", "Even zip files?", "Surely not read-only files too!" loop as soon as I step away.</p>
<p>I don't ... | <p>Use <a href="http://en.wikipedia.org/wiki/Robocopy" rel="noreferrer">Robocopy (Robust File Copy)</a>.</p>
<p>NOTE:</p>
<p>In Windows Vista and Server 2008 when you type:</p>
<pre><code>xcopy /?
</code></pre>
<p>you get:</p>
<blockquote>
<p>NOTE: Xcopy is now deprecated, please use Robocopy.</p>
</blockquote>
... | <p>Reboot into Linux, mount the drive, and use GNU <code>cp</code>.</p>
| 2,375 |
<p>So, the wife got me a Creality Ender-3 Pro 3d Printer for Christmas.</p>
<p>Assembly was easy, axis movements are all solid... when I go to print the <a href="https://www.thingiverse.com/thing:2879047" rel="nofollow noreferrer">test-dog.gcode</a> file provided with the machine, it comes out looking... flat.</p>
<p... | <p>It turned out that there's something wrong with the G-code file that came with my printer.</p>
<p>I downloaded a calibration cube from Thingiverse and printed it - while it wasn't 100%, it did print viable. Now I need to get into details as to quality, and I suspect that too will be a factor for the G-code used in ... | <p>I had the same problem on an Ender 3. Totally bewildering, because G-code commands <code>G0</code> & <code>G1</code> moved Z as expected, as did Pronterface commands, but Z did not advance during printing.</p>
<p>It turned out to be binding in the Z-axis lead screw caused by installing a BondTech style extruder.... | 1,155 |
<h1>Outline</h1>
<p>OK, I have Google'd this and already expecting a big fat <strong>NO!!</strong> But I thought I should ask since I know sometimes there can be the odd little gem of knowledge lurking around in peoples heads ^_^</p>
<p>I am working my way through some excercises in a book for study, and this particu... | <p>I think to be honest you a better just boning up on your standard design patterns and applying them to the individual problems that you face in developing your UI.</p>
<p>While there are common UI "themes" (such as dealing with modifier keys) the actual implementation may vary widely.</p>
<p>I have O'Reill... | <p>I don't think the that benefit of design patterns come from trying to find a design pattern to fit a problem. You can however use some heuristics to help clean up your design in this quite a bit, like keeping the UI as decoupled as possible from the rest of the objects in your system.</p>
<p>There is a pattern that... | 3,240 |
<p>I have an Access database in which I drop the table and then create the table afresh. However, I need to be able to test for the table in case the table gets dropped but not created (i.e. when someone stops the DTS package just after it starts -roll-eyes- ). If I were doing this in the SQL database I would just do... | <blockquote>
<p>I would reccomend sticking to what you know - PHP is more than capable.</p>
</blockquote>
<p>That's true of course, but:</p>
<blockquote>
<p>I don't mind, and I would even like to use this as an excuse, learning some new thing like Python or Ruby.</p>
</blockquote>
<p>Then writing a browser game ... | <p>I would reccomend sticking to what you know - PHP is more than capable.</p>
<p>I used to play a game called <a href="http://www.hyperiums.com/" rel="nofollow noreferrer">Hyperiums</a> - a text based browser game like yours - which is created using Java (it's web-based quivalent is JSP?) and servlets. It works fairl... | 4,564 |
<p>I broke 2 keys (i.e. left ctrl, enter) on my Asus UX31A laptop and it seems that this model is too old to find replacement keys.</p>
<p>Is there any way I can find a 3D model of the needed keys to have them 3D printed?</p>
<p>I do not have a printer nor I have any experience in this field.
What I need is either some... | <p>This is more off-topic as an answer, but serves as a possible solution.</p>
<p>Replacementlaptopkeys.com is a resource that appears to have keycaps for the model you've noted.</p>
<p><a href="https://www.replacementlaptopkeys.com/asus-zenbook-ux31a-db71-laptop-keys-replacement-dark-brown-black/" rel="nofollow norefe... | <p>You're better off if you can get the key from Fred's link. I was impressed by the detail of a 3D-printed battery cover for electronic calipers, but I'm sure it took much work to get it right. Also, ebay has keyboards for your model.</p>
| 1,943 |
<p>Test Driven Development has been the rage in the .NET community for the last few years. Recently, I have heard grumblings in the ALT.NET community about BDD. What is it? What makes it different from TDD?</p>
| <p>I understand BDD to be more about <strong>specification</strong> than <strong>testing</strong>. It is linked to Domain Driven Design (don't you love these *DD acronyms?). </p>
<p>It is linked with a certain way to write user stories, including high-level tests. An example by <a href="http://tomtenthij.nl/2008/1/25/... | <p>Here's the quick snapshot:</p>
<blockquote>
<ul>
<li><p>TDD is just the process of testing code before writing it!</p></li>
<li><p>DDD is the process of being informed about the Domain before each cycle of touching code!</p></li>
<li><p>BDD is an implementation of TDD which brings in some aspects of DDD!... | 2,461 |
<p>What are the advantages/disadvantages between MS VS C++ 6.0 and MSVS C++ 2008? </p>
<p>The main reason for asking such a question is that there are still many decent programmers that prefer using the older version instead of the newest version.</p>
<p>Is there any reason the might prefer the older over the new?</p... | <p>Advantages of Visual Studio 2008 over Visual C++ 6.0:</p>
<ul>
<li>Much more standards compliant C++ compiler, with better template handling</li>
<li>Support for x64 / mobile / XBOX targets </li>
<li>Improved STL implementation</li>
<li>Support for C++0x TR1 (smart pointers, regular expressions, etc)</li>
<li>Secu... | <p>Visual C++ 2008 is much more standards compliant (Visual Studio 6 doesn't support the C++ standard set in 1998).</p>
| 8,778 |
<p>Are we supposed to find workarounds in our web applications so that they will work in every situation? Is it time to do away with IE6 programming?</p>
| <p>This depends so much on the context of the application, and of its users. There are two key aspects: what browsers are your users using; and how important is it that they can access/interact with your site.</p>
<p>The first part is generally easily establish, <strong>if</strong> you have an existing version with st... | <p>I'm all for pushing users to upgrade to the newest available version of IE (since problems improve with every release), however I'm also against telling people to upgrade or change their browsers.</p>
<p>I still support IE6 on my website. I even support as far back as IE5.5 pretty well I think. </p>
<p>Generally i... | 3,473 |
<p>Some e-Marketing tools claim to choose which web page to display based on where you were before. That is, if you've been browsing truck sites and then go to Ford.com, your first page would be of the Ford Explorer.</p>
<p>I know you can get the immediate preceding page with HTTP_REFERRER, but how do you know where t... | <p>Javascript this should get you started: <a href="http://www.dicabrio.com/javascript/steal-history.php" rel="noreferrer">http://www.dicabrio.com/javascript/steal-history.php</a><br />
There are more nefarius means to: <a href="http://ha.ckers.org/blog/20070228/steal-browser-history-without-javascript/" rel="noreferre... | <p>The browser history can't be directly accessed, but you can compare a list of sites with the user's history. This can be done because the browser attributes a different CSS style to a link that hasn't been visited and one that has.</p>
<p>Using this style difference you can change the content of you pages using pu... | 7,126 |
<p>I have just ordered some filament samples (each sample is 10m x 1.75mm). How should I test the samples, given that there is only 10 metres of each to play with? Just printing a benchy will use about 4 metres. I would probably want to print a benchy, so that leaves 6 metres to play with. I am mostly interested in pro... | <p>Select an STL that exhibits characteristics you want to test (bridging, resistance to various pressures) and print it with each material. Preferably, run the <strong>same exact gcode</strong>, only changing temperatures, so that you get an apples-to-apples comparison.</p>
| <p>Select an STL that exhibits characteristics you want to test (bridging, resistance to various pressures) and print it with each material. Preferably, run the <strong>same exact gcode</strong>, only changing temperatures, so that you get an apples-to-apples comparison.</p>
| 648 |
<p>How can I set the background color of an HTML element using css in JavaScript?</p>
| <p>In general, CSS properties are converted to JavaScript by making them camelCase without any dashes. So <code>background-color</code> becomes <code>backgroundColor</code>.</p>
<pre><code>function setColor(element, color)
{
element.style.backgroundColor = color;
}
// where el is the concerned element
var el = do... | <pre><code>$(".class")[0].style.background = "blue";
</code></pre>
| 2,549 |
<p>Using win forms with an <a href="http://en.wikipedia.org/wiki/Model-view-controller" rel="noreferrer">MVC</a>/<a href="http://msdn.microsoft.com/en-us/magazine/cc188690.aspx" rel="noreferrer">MVP</a> architecture, I would normally use a class to wrap a view to test the UI while using mocks for the model and controll... | <p>As for the testing itself, you're probably best off using the <a href="https://msdn.microsoft.com/library/ms747327.aspx" rel="noreferrer">UI Automation</a> framework. Or if you want a more fluent and wpf/winforms/win32/swt-independent way of using the framework, you could download <a href="http://www.codeplex.com/wh... | <p>Definitely look at TestAutomationFX.com. One can invest (OK, I did) a lot of time trying to capture / record events with White. (At the start of my quest I ignored the post or two in other places referring to it).</p>
<p>I of course second the other points about the best type of testing not being UI testing.</p>
<... | 8,270 |
<p>I do some minor programming and web work for a local community college. Work that includes maintaining a very large and soul destroying website that consists of a hodge podge of VBScript, javascript, Dreamweaver generated cruft and a collection of add-ons that various conmen have convinced them to buy over the years... | <p>Stefan's iframe solution works, but if that's not elegant enough, I find the following JavaScript also solves it:</p>
<pre><code>window.onunload = function(){};
</code></pre>
<p>That is, if your menu is JavaScript, then you might prefer to solve this issue with JavaScript too.</p>
<p>The unload event handler defi... | <p>Had the same problem on iPad.</p>
<p>Not that beautiful but it works :). How it works.</p>
<p>I realised that on iPad Safari, the page was not reloaded when the back button was pressed. I put a counter every second on the page and I save the current timestamp.</p>
<p>When the page is loaded the counter and time a... | 4,384 |
<p>What does it mean if a task is declared with the automatic keyword in Verilog?</p>
<pre><code>task automatic do_things;
input [31:0] number_of_things;
reg [31:0] tmp_thing;
begin
// ...
end
endtask;
</code></pre>
<p>Note: This question is mostly because I'm curious if there are any hardware programmers... | <p>It means that the task is re-entrant - items declared within the task are dynamically allocated rather than shared between different invocations of the task.</p>
<p>You see - some of us do Verilog... (ugh)</p>
| <p>In computing, a computer program or subroutine is called re-entrant if multiple invocations can safely run concurrently (Wikipedia).
In simple words, the keyword automatic makes it safe, when multiple instances of a task run at a same time.
:D</p>
| 5,559 |
<p>What would be the easiest way to separate the directory name from the file name when dealing with <code>SaveFileDialog.FileName</code> in C#?</p>
| <p>Use:</p>
<pre><code>System.IO.Path.GetDirectoryName(saveDialog.FileName)
</code></pre>
<p>(and the corresponding <code>System.IO.Path.GetFileName</code>). The Path class is really rather useful.</p>
| <p>Since the forward slash is not allowed in the filename, one simple way is to divide the SaveFileDialog.Filename using String.LastIndexOf; for example:</p>
<pre><code>string filename = dialog.Filename;
string path = filename.Substring(0, filename.LastIndexOf("\"));
string file = filename.Substring(filename.LastIndex... | 3,700 |
<p>For my Ender 3 Pro I bought this touch sensor set <a href="https://tr.aliexpress.com/item/4001209045993.html?spm=a2g0s.9042311.0.0.68ea4c4d3CjwfW" rel="nofollow noreferrer">Chinese clone BLTouch set</a> and changed the printer's firmware to the latest TH3D firmware (first I tried with Creality's original BLTouch fir... | <p>Following <a href="https://3dprinting.stackexchange.com/a/14765/5740">Nathan's</a> answer, I've solved my problem with Nathan's suggestions and the method in <a href="https://www.youtube.com/watch?v=W8ouBPnRV4s&ab_channel=cheule" rel="nofollow noreferrer">this video</a>.</p>
<p>What I did?</p>
<ol>
<li>Flashed ... | <p>I would suggest you read <a href="https://www.reddit.com/r/ender3/comments/jdd2nf/for_some_reason_my_bltouch_isnt_working_quite_as/g9amvfn/?context=3" rel="nofollow noreferrer">this</a>, even tho it's a different mainboard it may help.</p>
<p>Next to that you should level the bed the old fashion way first with a pap... | 1,773 |
<p>I am wondering if anyone has any experience using a JQuery plugin that converts a html </p>
<pre><code><select>
<option> Blah </option>
</select>
</code></pre>
<p>combo box into something (probably a div) where selecting an item acts the same as clicking a link.</p>
<p>I guess you coul... | <p>The simple solution is to use</p>
<pre><code>$("#mySelect").change(function() {
document.location = this.value;
});
</code></pre>
<p>This creates an onchange event on the select box that redirects you to the url stored in the value field of the selected option.</p>
| <p>This bit of javascript in the 'select':</p>
<pre><code>onchange="if(this.options[this.selectedIndex].value!=''){this.form.submit()}"
</code></pre>
<p>It's not ideal (because form submissions in ASP.NET MVC which I'm using don't appear to use the routing engine for URLs) but it does its job.</p>
| 7,141 |
<p>I have a big string (let's call it a CSV file, though it isn't actually one, it'll just be easier for now) that I have to parse in C# code.<br>
The first step of the parsing process splits the file into individual lines by just using a <code>StreamReader</code> object and calling <code>ReadLine</code> until it's thr... | <p>Since this isn't a true CSV file, does it have any sort of schema?</p>
<p>From your example, it looks like you have:
int, int, int, int, string , bool, bool, int</p>
<p>With that making up your record / object.</p>
<p>Assuming that your data is well formed (I don't know enough about your source to know how valid ... | <p><strong>EDIT:</strong> Sorry, I've misinterpreted your post. If you're looking for a regex, then here is one:</p>
<pre><code>content = Regex.Replace(content, "'([^']*)\n([^']*)'", "'\1TOKEN\2'");
</code></pre>
<p>There might be edge cases and that two problems but I think it should be ok most of the time. What the... | 5,303 |
<p>There are lots of widgets provided by sites that are effectively bits of JavaScript that generate HTML through <em>DOM</em> manipulation or <code>document.write()</code>. Rather than slow the browser down even more with additional requests and trust yet another provider to be fast, reliable and not change the widget... | <p>Wikipedia's <a href="http://en.wikipedia.org/wiki/Server-side_JavaScript" rel="nofollow noreferrer">"Server-side JavaScript"</a> article lists numerous implementations, many of which are based on Mozilla's <strong>Rhino</strong> JavaScript-to-Java converter, or its cousin <strong>SpiderMonkey</strong> (the same engi... | <p>If you're just using plain JS, <a href="http://www.mozilla.org/rhino/" rel="nofollow noreferrer">Rhino</a> should do the trick. But if the JS code is actually calling DOM methods and so on, you're going to need a full-blown browser. <a href="http://simile.mit.edu/wiki/Crowbar" rel="nofollow noreferrer">Crowbar</a> ... | 3,576 |
<p>As I learn more and more about OOP, and start to implement various design patterns, I keep coming back to cases where people are hating on <a href="http://en.wikipedia.org/wiki/Active_record_pattern" rel="noreferrer">Active Record</a>.</p>
<p>Often, people say that it doesn't scale well (citing Twitter as their pri... | <p>There's <a href="http://en.wikipedia.org/wiki/Active_record_pattern" rel="noreferrer">ActiveRecord the Design Pattern</a> and <a href="http://api.rubyonrails.com/classes/ActiveRecord/Base.html" rel="noreferrer">ActiveRecord the Rails ORM Library</a>, and there's also a ton of knock-offs for .NET, and other languages... | <p>The problem that I see with Active Records is, that it's always just about <strong>one</strong> table. That's okay, as long as you really work with just that one table, but when you work with data in most cases you'll have some kind of join somewhere.</p>
<p>Yes, <strong>join</strong> usually is worse than <strong>... | 2,941 |
<p>I have a problem with a little .Net web application which uses the Amazon webservice. With the integrated Visual Studio web server everything works fine. But after deploying it to the IIS on the same computer i get the following error message:</p>
<pre><code>Ein Verbindungsversuch ist fehlgeschlagen, da die Gegenst... | <p>Proxy use can be configured in the web.config.
The system.net/defaultProxy element will let you specify whether a proxy is used by default or provide a bypass list.</p>
<p>For more info see: <a href="http://msdn.microsoft.com/en-us/library/kd3cf2ex.aspx" rel="noreferrer"><a href="http://msdn.microsoft.com/en-us/lib... | <p>IIS is a destination. The configuration issue is in whatever is doing the call (acting like a client). If you are using the built-in .Net communication methods you will need to make the adjustment inside of ... Wait for it ... Internet Explorer. </p>
<p>Yep! That little bugger has bitten me more times than I ca... | 8,642 |
<p>The following code works great in IE, but not in FF or Safari. I can't for the life of me work out why. The code is <em>supposed</em> to disable radio buttons if you select the "Disable 2 radio buttons" option. It should enable the radio buttons if you select the "Enable both radio buttons" op... | <p>To get FF to mimic IE's behavior when using the keyboard, you can use the keyup event on the select box. In your example (I am not a fan of attaching event handlers this way, but that's another topic), it would be like this:</p>
<pre><code><select name="user" id="selUser" onchange="javascript:SetLocationOptions(... | <p>Why not grab one of the AJAX scripting libraries, they abstract away a lot of the cross browser DOM scripting black magic and make life a hell of a lot easier.</p>
| 2,819 |
<p>I'm designing a mount for a cylindrical speaker to attach to my bicycle. It will mount on the bottle cages. I've printed a few iterations with various infill settings (using PLA) and the weak point is always the bolts holding the entire mount to the bike. They can't handle the compression needed to secure it properl... | <ol>
<li><p>Infill has minimal effect on the strength of printed parts, so I would expect the part to break in the same spot regardless of what infill percentage you used. </p></li>
<li><p>PLA is especially poor in this exact application, and it undergoes significant creep/cold flow under mechanical compression over t... | <p>Try heating op your PLA while mounting it. The PLA wil temporarily weaken and will become a bit moldable. PETG is a bit more brittle than PLA is my experience so I'd say stick to PLA. Otherwise you might try Arnitel ECO. I can try to find an amazon purchase link for you if you want. Anyway, it is more rubber like an... | 1,526 |
<p>Does anyone know how to debug <code>JSP</code> in <strong>IntelliJ</strong> IDEA?</p>
<p>When I set breakpoint in my <code>JSP</code> files, those breakpoints never seem to take effect. The debugger never hits them. IDEA seems to think that the breakpoints are valid. I do see a red dot placed to the left of the lin... | <p>For JSP debugging in Intellij there are some configurations that must be in order. The fact that Intellij always allows you to add a breakpoint on a JSP line does not necessarily imply that you’ve configured JSP debugging. In the following I refer to Intellij 8 configuration, w.r.t. previous versions you will need ... | <p>For the second part of your question ("jsp files placed under web-inf won't be directly accessible by user") that is correct. To allow users to access JSP files in the WEB-INF folder servlet and servlet-mapping entries need to be made in the web.xml file for each JSP page. </p>
| 5,381 |
<p>I am currently developing a Drupal webpage using PDT. When running without XDebug, the site works fine.</p>
<p>When I enable XDebug, the site works fine but opens up tons of Javascript errors that I need to click through.</p>
<p>Example:</p>
<p>A Runtime Error has occurred.
Do you wish to Debug?</p>
<p>Line: 1
E... | <p>here is how to solve this problem:</p>
<p>Turn off XDebug output capture:</p>
<p>Window -> Preferences, expand PHP, expand Debug, select "Installed Debuggers", choose "XDebug", click "Configure" on the right to bring up the configure dialog. In the middle "Output Capture Settings", set "Capture stdout" to "Off".</... | <p>This is a bit of a guess, but try
Windows => Preferences => JavaScript => Include Path</p>
| 9,131 |
<p>We have some input data that sometimes appears with &nbsp characters on the end.</p>
<p>The data comes in from the source system as varchar() and our attempts to cast as decimal fail b/c of these characters.</p>
<p>Ltrim and Rtrim don't remove the characters, so we're forced to do something like:</p>
<pre><co... | <p><a href="http://www.lazydba.com/sql/1__4390.html" rel="noreferrer">This page</a> has a sample of how you can remove non-alphanumeric chars:</p>
<pre><code>-- Put something like this into a user function:
DECLARE @cString VARCHAR(32)
DECLARE @nPos INTEGER
SELECT @cString = '90$%45623 *6%}~:@'
SELECT @nPos = ... | <p>For large datasets I have had better luck with this function that checks the ASCII value. I have added options to keep only alpha, numeric or alphanumeric based on the parameters.</p>
<pre><code>--CleanType 1 - Remove all non alpanumeric
-- 2 - Remove only alpha
-- 3 - Remove only numeric
CREATE F... | 7,555 |
<p>There are many options for editing and writing Stored Procedures in Oracle; what is the best tool for you and why? (one tool per answer.)</p>
| <p><a href="http://www.toadsoft.com/lic_agree.html" rel="nofollow noreferrer"><strong>T</strong>ool for <strong>O</strong>racle <strong>A</strong>pplication <strong>D</strong>evelopers (TOAD)</a>, from <a href="http://www.quest.com/" rel="nofollow noreferrer">Quest Software</a> (formerly <a href="http://www.toadsoft.co... | <p>I just used a standard editor (vim which then gave me syntax highlighting).</p>
<p>/Allan</p>
| 9,516 |
<p>Given a latitude and longitude, what is the easiest way to find the name of the city and the US zip code of that location.</p>
<p>(This is similar to <a href="https://stackoverflow.com/questions/23572/latitude-longitude-database">https://stackoverflow.com/questions/23572/latitude-longitude-database</a>, except I wa... | <p>This is the web service to call.
<a href="http://developer.yahoo.com/search/local/V2/localSearch.html" rel="nofollow noreferrer">http://developer.yahoo.com/search/local/V2/localSearch.html</a></p>
<p>This site has ok web services, but not exactly what you're asking for here.
<a href="http://www.usps.com/webtools/" ... | <p>geonames has an extensive set of ws that can handle this (among others):
<br><br>
<a href="http://www.geonames.org/export/web-services.html#findNearbyPostalCodes" rel="nofollow noreferrer">http://www.geonames.org/export/web-services.html#findNearbyPostalCodes</a><br>
<a href="http://www.geonames.org/export/web-serv... | 5,081 |
<p>I am currently building in Version 3.5 of the .Net framework and I have a resource (.resx) file that I am trying to access in a web application. I have exposed the .resx properties as public access modifiers and am able to access these properties in the controller files or other .cs files in the web app. My questi... |
<pre class="lang-cs prettyprint-override"><code><%= Resources.<ResourceName>.<Property> %>
</code></pre>
| <p>If you are using ASP.NET 2.0 or higher, after you compile with the resource file, you can reference it through the Resources namespace:</p>
<pre><code>text = Resources.YourResourceFilename.YourProperty;
</code></pre>
<p>You even get Intellisense on the filenames and properties.</p>
| 8,852 |
<p><a href="http://www.devexpress.com/Products/NET/ORM/" rel="noreferrer">XPO</a> is the object relational mapper of choice at my company. Any thoughts on the pros and cons?</p>
<hr>
<p>I was just looking for general feeling and anecdotes about the product. We are not switching to XPO. We are just getting rid of hard... | <p>Others will probably pitch in with technical answers (e.g. the query syntax, use of caching, ease or otherwise of mapping to an existing database structure) -- but if you have an established ORM layer the answer is probably </p>
<p>"Why change"?</p>
<p>I've used XPO successfully for years in an established commerc... | <p>The pros and cons compared to what? There are a lot of alternatives out there, the most popular being nHibernate, with the new kid 'ADO.NET Entity Framework' on the block.</p>
<p>Anyways, there are hundreds of answers depending on your situation and requirements.</p>
| 5,150 |
<p>Is it really viable to use GCJ to publish server-side applications? Webapps? </p>
<p>My boss is convinced that compiling our (<strong><em>my</em></strong>) webapp into a binary executable is a brilliant idea. (Then again, he likes nice, small simple things with blinky lights that he can understand.) He instinct... | <p>FWIW: I have never had good luck with GCJ, I have had a lot of problems using it and have had some obscure issues pop up that took forever to diagnose to GCJ rather than me (I am always very very reluctant to blame things on external libraries). I will openly admit this happened several years ago and I have never wa... | <p>I don't think that a large application like yours will compile to machine code. Remember that java is not only java syntax (might compile to machine code) but also a virtual machine which is more like an application / process environment. I would suggest making an <a href="http://classworlds.codehaus.org/uberjar.htm... | 9,071 |
<p>I'm not talking about tools that let one view a page in combinations of operating systems and browsers like crossbrowsertesting.com but in creating or figuring out the actual CSS.</p>
| <p>If you guys are still coding for IE6, you're making a mistake. </p>
<p>I use <strong>IE7.js</strong> to get IE6 to render pages like IE7. IE7 is not perfect, but at least it has some semblance of standards. Since I only have to code for IE7 and FF it makes me 33% more efficient in terms of testing against browse... | <p>I write to the standards and both Firefox and IE7 follow a pretty good set in common. </p>
<p>IE6 is dead as far as I am concerned but if I get back into professional web dev I'll probably have to revise that ;)</p>
| 4,570 |
<p>I'm thinking of recycling some filament from a couple of recently failed prints. I can reuse them in the future for basic prototypes, so I'm not concerned with whatever weird mixture of colors come out (they are of a few different colors).</p>
<p>The thing is, I have both PLA and ABS, in small quantities. I origina... | <p>This is not a good idea. Both filaments have different melting points, that of ABS being much higher than that of PLA. To melt the ABS you have to heat the plastic to the point where the PLA starts to degrade.</p>
| <p>yes but you would have to experiment with the settings to see were it afectivly melts.</p>
| 140 |
<p>How can I change the title of the command prompt window every time I execute a dos-based program by double clicking it, in c language. Should I use the Windows API?</p>
| <p>Try <a href="http://msdn.microsoft.com/en-us/library/ms686050.aspx" rel="nofollow noreferrer">SetConsoleTitle</a>.</p>
| <p>you can do </p>
<p>%comspec% /c start "testtest" %comspec%</p>
<p>at application launcher of Windows+R </p>
| 6,715 |
<p>Grails scaffolding defaults to 10 rows per page. I would like to increase that number without generating the views and changing the 10 in every file. Where do I change the default?</p>
| <p>You have to install scaffold templates with:</p>
<p>grails install-templates</p>
<p>Now, edit in src/templates/scaffolding Controller.groovy and increase the value params.max as you want</p>
| <p>Add to the uri:</p>
<pre><code>?max=<num_rows_desired>
</code></pre>
<p>For instance:</p>
<pre><code>http://projecthost:8080/Library/Books/list?max=20
</code></pre>
| 8,234 |
<p>I'd like some sorthand for this:</p>
<pre><code>Map rowToMap(row) {
def rowMap = [:];
row.columns.each{ rowMap[it.name] = it.val }
return rowMap;
}
</code></pre>
<p>given the way the GDK stuff is, I'd expect to be able to do something like:</p>
<pre><code>Map rowToMap(row) {
row.columns.collectMap... | <p>I've recently came across the need to do exactly that: converting a list into a map. This question was posted before Groovy version 1.7.9 came out, so the method <a href="http://docs.groovy-lang.org/latest/html/api/org/codehaus/groovy/runtime/DefaultGroovyMethods.html#collectEntries(java.lang.Iterable,%20groovy.lang... | <p>What about something like this?</p>
<pre><code>// setup
class Pair {
String k;
String v;
public Pair(def k, def v) { this.k = k ; this.v = v; }
}
def list = [ new Pair('a', 'b'), new Pair('c', 'd') ]
// the idea
def map = [:]
list.each{ it -> map.putAt(it.k, it.v) }
// verify
println map['c']
</... | 3,910 |
<p>How do I write the results from a mysql query to file? I just need something quick. Output can be CSV, XML, HTML, etc.</p>
| <pre><code>SELECT a,b,a+b
FROM test_table
INTO OUTFILE '/tmp/result.txt'
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
</code></pre>
<p>(the docs show INTO OUTFILE up in the SELECT .. portion which may work as well, but I've never tried it that way)
<a href="http://dev.mysql.com... | <p>if you have phpMyAdmin installed, it is a nobrainer: Run the query (haven't got a copy loaded, so I can't tell you the details, but it really is easy) and check neer bottom for export options. CSV will be listed, but I think you can also have SQL if you like :)</p>
<p>phpMyAdmin will give CSV in Excels dialect, whi... | 5,071 |
<p>I'm working on a project were we need more performance. Over time we've continued to evolve the design to work more in parallel(both threaded and distributed). Then latest step has been to move part of it onto a new machine with 16 cores. I'm finding that we need to rethink how we do things to scale to that many cor... | <p>A couple of other books that are going to be helpful are:</p>
<ul>
<li><a href="https://rads.stackoverflow.com/amzn/click/com/0131972596" rel="noreferrer" rel="nofollow noreferrer" title="Synchronization Algorithms and Concurrent Programming">Synchronization Algorithms and Concurrent Programming</a></li>
<li><a hre... | <p>Take a look at <a href="http://www.hoard.org/" rel="nofollow noreferrer">Hoard</a> if you are doing a lot of memory allocation.</p>
<p>Roll your own <a href="http://www.boyet.com/Articles/LockfreeFreeList.html" rel="nofollow noreferrer">Lock Free List</a>. A good resource is here - it's in C# but the ideas are port... | 2,853 |
<p>Some have suggested that filament costs are asymptotically approaching a baseline cost - others that costs are linearly decreasing. Does anyone know where to find the trending costs on a single class of filament over the past decade or more?</p>
<p>Part of the reason we are asking is to get enough longitudinal data... | <p>I'm not clear as to the intent of your question, but I would like to provide some insight. Typically, the biggest differentiating factor between a mediocre data scientist, and a good one, is based on the hypothesis they put forth. Therefore, understanding where the cost of filament is derived from is much more impor... | <p>You could have a look though the various price trackers for Amazon (like <a href="http://uk.camelcamelcamel.com/Kg-Yellow-MakerGear-Ultimaker-THING-O-MATIC-Universal/product/B00MVKOSM8?context=browse" rel="nofollow">ccc</a> and <a href="https://thetracktor.com/detail/B010P3EE6W/" rel="nofollow">thetractor</a>), for ... | 265 |
<p>Is it possible to design a heat block without cartridge heater?</p>
<p>My idea is to build a very small heat block to increase/decrease the heat as fast as possible. The resistance of the heat block will be used. The current to this block is 500mA and is set constant with a circuit. The voltage will be set with pwm... | <p>I have a Kill-A-Watt meter so I got a pretty good measurement for you with my Anet A6. Like Petar said each model is different but this should give you a idea. When heating both the nozzle and heat bed the printer consumes 160 W of power, once to temp it backs down to 9 W (it also uses 9 W when just "... | <p>To answer the underlying (X-Y) question, yes it is possible to power a small 3D printer from a battery pack. <a href="https://www.3ders.org/articles/20171005-naomi-sexycyborg-wu-3d-prints-on-the-go-with-awesome-wearable-3d-printer.html" rel="nofollow noreferrer">This Article</a> describes a printer built by Naomi Wu... | 832 |
<p>I am maintaining an app for a client that is used in two locations. One in England and one in Poland.</p>
<p>The database is stored in England and uses the format £1000.00 for currency, but the information is being gathered locally in Poland where 1000,00 is the format.</p>
<p>My question is, in VB6 is there a fun... | <p>The data is not actually stored as the string <code>"£1000.00"</code>; it's stored in some numeric format.</p>
<blockquote>
<p><strong>Sidebar:</strong> Usually databases are set up to store money amounts using either the <strong>decimal</strong> data type (also called <strong>money</strong> in some DBs), ... | <p>What database are you using? And what data type is the amount stored in?</p>
<p>As long as you are always converting from one format to another, you do not need to do any parsing, just replace "." with "," or the other way around. You may need to remove the "£"-sign as well if that is stored in your string.</p>
| 4,017 |
<p>When should I use an interface and when should I use a base class? </p>
<p>Should it always be an interface if I don't want to actually define a base implementation of the methods?</p>
<p>If I have a Dog and Cat class. Why would I want to implement IPet instead of PetBase? I can understand having interfaces for IS... | <p>
Let's take your example of a Dog and a Cat class, and let's illustrate using C#:</p>
<p>Both a dog and a cat are animals, specifically, quadruped mammals (animals are waaay too general). Let us assume that you have an abstract class Mammal, for both of them:</p>
<pre class="lang-cs prettyprint-override"><code>pub... | <p>In addition to those comments that mention the IPet/PetBase implementation, there are also cases where providing an accessor helper class can be very valuable.</p>
<p>The IPet/PetBase style assumes that you have multiple implementations thus increasing the value of PetBase since it simplifies implementation. Howev... | 8,099 |
<p>I have a bunch of classes I want to rename. Some of them have names that are small and that name is reused in other class names, where I don't want that name changed. Most of this lives in Python code, but we also have some XML code that references class names.</p>
<p>Simple search and replace only gets me so far... | <p>In the meantime, I've tried it two tools that have some sort of integration with vim.</p>
<p>The first is <a href="https://github.com/python-rope/rope" rel="noreferrer">Rope</a>, a python refactoring library that comes with a Vim (and emacs) plug-in. I tried it for a few renames, and that definitely worked as expe... | <p>You can use sed to perform this. The trick is to recall that regular expressions can recognize word boundaries. This works on all platforms provided you get the tools, which on Windows is Cygwin, Mac OS may require installing the dev tools, I'm not sure, and Linux has this out of the box. So grep, xargs, and sed sho... | 4,842 |
<p>I have an HBot 3D 1.1 printer (it's a CoreXY style printer, newer versions are produced by ZMorph). I think that a filament guide tube inside the hotend got damaged, resulting in decreased diameter, which means I can't push the filament through it. It stops halfway through the heatsink (black marker in the attached ... | <p>This is an old hotend type, it is called a <a href="https://www.google.com/search?q=j+head+nozzle" rel="noreferrer">J-Head</a> (see e.g. the <a href="https://reprap.org/wiki/J_Head_Nozzle#Mk_V" rel="noreferrer">J-Head Nozzle Mk V</a>, I'm unsure which exact version you have). The hotend is serviceable, you can buy s... | <p>Not exactly the type of answer you probably want, but this hotend does not look servicable. The nozzle is usually considered a consumable part unless it's made of something like tungsten carbide, or at least steel. The nozzle is almost surely long past its useful life unless the printer was barely used, and the enti... | 2,209 |
<p>I am using VMWare tools for Ubuntu Hardy, but for some reason <code>vmware-install.pl</code> finds fault with my LINUX headers. The error message says that the "address space size" doesn't match.</p>
<p>To try and remediate, I have resorted to <code>vmware-any-any-update117</code>, and am now getting the following ... | <p>This error ofter occurs because incompatibility of VMWare Tools Version and recent Kernels (You can test it using older Kernels). Sometimes you can fix some thing with patches all over the internet, but I prefer to downgrade my kernel or don't using latest distribution's version in VMWare. It can be really annoying.... | <p>I've heard a lot of good things about VirtualBox from Sun. If you get fed up with VMWare, it's worth a look.</p>
| 5,118 |
<p>I have a requirement to make a large amount of code MISRA compliant.<br>
First question: Can somebody to give an <strong>estimation</strong> for passing well written code for embedded system based on experience. I understand that "well written" is poorly defined and vague so i ask for raw estimation.<br>
Second ques... | <p>I also highly recommend PC-Lint. If you happen to be compiling your code with Visual Studio I recommend a plug-in 'Visual Lint' from Riverblade. If you cannot compile the code in Visual Studio, you can still run PC-Lint from the command line to good effect.</p>
<p>Some embedded system compilers provide MISRA comp... | <p>I appreciate that this is an old question, but for the benefit of any other Archaeologists (or searchers), it is important to remember that MISRA provides <strong>guidelines</strong> that should not always be blindly followed.</p>
<p>I commend writing new code with MISRA in mind; therefore it will be a lot easier t... | 8,848 |
<p>I'm not really sure where to ask this question as I think it is a design question, but also a printing question. So if there is a better place to post, I'd be happy to harass someone else.<br>
I'm (re)designing a sprinkler manifold for a dripper system because the stupid pegs for this <a href="https://rads.stackove... | <p>I examined and sliced your STL file, and the profile of your threads looks very strange.</p>
<p>It's definitely possible to do very strong, perfectly-fitting threads down to small sizes (at least down to M4 or slightly smaller) using modern inexpensive 3D printers, and contrary to widespread belief (there's a well-... | <p>If I may suggest a slight alternative: don't try to make the threads part of the 3Dprint. Instead, thicken the walls where the threads would have been, increasing the ID (inner diameter) of the hole, maybe even "thread" to match the outside of : metal <a href="https://www.homedepot.com/p/Everbilt-1-4-in-20-tpi-x-20... | 1,327 |
<p>I'd like to display 100 floating cubes using <code>DirectX</code> or <code>OpenGL</code>.</p>
<p>I'm looking for either some sample source code, or a description of the technique. I have trouble getting more one cube to display correctly.</p>
<p>I've combed the net for a good series of tutorials and although they... | <p>You say you have enough trouble getting one cube to display... so I am not sure if you have got one to display or not.</p>
<p>Basically... put your code for writing a cube in one function, then just call that function 100 times.</p>
<pre><code>void DrawCube()
{
//code to draw the cube
}
void DisplayCubes()
{
... | <p>This answer isn't just for OP's question. It also answers a more general question - displaying many cubes <em>in general</em>.</p>
<h3>Drawing many cube meshes</h3>
<p>This is probably the most naive way of doing things. We draw the same cube mesh with many different transformation matrices:</p>
<pre class="lang-cpp... | 2,349 |
<p>I am creating a program that will be installed using the .net installer project. The program writes to settings files to its directory in the Program Files dir. It believe there are some active directory settings that will prevent the application from righting to that directory if a limited user is running the progr... | <p>Writing to the Program Files folder is a really bad idea, you should assume that this location is "read only" once installed. </p>
<p>Saving user settings in Program Files causes problems if more than two people use the computer at once (eg. Terminal Services) who's settings should be saved, do you want other users... | <p>You can write a custom installer class which can change the security permissions of the folder. This would assume the installation is done by a user who has permission to change file/directory security.</p>
<p>The best option is to not write to directories under Program Files at all.</p>
| 3,921 |
<p>I often have to sort a dictionary (consisting of keys & values) by value. For example, I have a hash of words and respective frequencies that I want to order by frequency.</p>
<p>There is a <code>SortedList</code> which is good for a single value (say frequency), that I want to map back to the word.</p>
<p><a hr... | <p>Use:</p>
<pre><code>using System.Linq.Enumerable;
...
List<KeyValuePair<string, string>> myList = aDictionary.ToList();
myList.Sort(
delegate(KeyValuePair<string, string> pair1,
KeyValuePair<string, string> pair2)
{
return pair1.Value.CompareTo(pair2.Value);
}
);
</c... | <p>You can sort the Dictionary by value and get the result in dictionary using the code below:</p>
<pre><code>Dictionary <<string, string>> ShareUserNewCopy =
ShareUserCopy.OrderBy(x => x.Value).ToDictionary(pair => pair.Key,
pair => ... | 2,279 |
<p>I'm writing a mobile phone game using j2me. In this game, I am using multiple Canvas objects.
For example, the game menu is a Canvas object, and the actual game is a Canvas object too.
I've noticed that, on some devices, when I switch from one Canvas to another, e.g from the main menu to the game, the screen momenta... | <p>I would say, that using multiple canvases is generally bad design. On some phones it will even crash. The best way would really be using one canvas with tracking state of the application. And then in paint method you would have</p>
<pre><code>protected void paint(final Graphics g) {
if(menu) {
paintMenu(g);
... | <p>Do you use double buffering? If the device itself does not support double buffering you should define a off screen buffer (Image) and paint to it first and then paint the end result to the real screen. Do this for each of your canvases. Here is an example:</p>
<pre><code>public class MyScreen extends Canvas {
pr... | 9,195 |
<p>I have a reprap printer with 0.3mm nozzle. It prints quite well, I am really surprised with quality of all the surfaces and the general precision of the parts printed. BUT I HAVE a problem: when making (for example) a 10mm x 10mm x 10mm cube with a 2.8mm diameter hole from top to bottom (to fit a screw) after I prin... | <p>It's a generally accepted fact that FDM/FFF printers will have <a href="https://innovationstation.utexas.edu/tip-design/" rel="nofollow noreferrer">deviations when it comes to holes and perimeters</a>. Typically, holes print smaller than designed and external surfaces end up larger than designed.</p>
<p>In your cas... | <p>For one thing, the entire part generally shrinks, as it's printed (at whatever precision of nozzle location) as molten plastic, and then cools and solidifies.</p>
<p>Given that you are getting a bigger hole in the finished part, I'd start by measuring the part's actual overall outside size, as printed (is that 10mm... | 568 |
<p>I wondered whether anybody knows how to obtain membership of local groups on a remote server programmatically via C#. Would this require administrator permissions? And if so is there any way to confirm the currently logged in user's membership (or not) of these groups?</p>
| <p><a href="http://www.codeproject.com/KB/system/everythingInAD.aspx" rel="nofollow noreferrer">Howto: (Almost) Everything In Active Directory via C#</a> is very helpfull and also includes instructions on how to iterate AD members in a group.</p>
<pre><code>public ArrayList Groups(string userDn, bool recursive)
{
... | <p>Perhaps this is something that can be done via WMI?</p>
| 6,732 |
<p>How can I write G-code for a triangle without sharp tips?</p>
<p><a href="https://i.stack.imgur.com/T0hpu.jpg" rel="nofollow noreferrer" title="Example of required triangle"><img src="https://i.stack.imgur.com/T0hpu.jpg" alt="Example of required triangle" title="Example of required triangle"></a></p>
<p>I want to ... | <p>First, convert the given measurements into a sketch...</p>
<p><a href="https://i.stack.imgur.com/ivxIW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ivxIW.png" alt="Sketched out dimensions" /></a></p>
<h2>G-code shenanigans</h2>
<p>we actually have the printer do circles.. let's plot that out...... | <p>Marlin has <code>G2</code> (clockwise arc) and <code>G3</code> (counterclockwise arc) commands that could be used to do this. <a href="http://marlinfw.org/docs/gcode/G002-G003.html" rel="nofollow noreferrer">You can find detailed documentation for the command here.</a></p>
<p>Basically, you can use</p>
<blockquote... | 1,393 |
<p>I am looking for a way to delete all files older than 7 days in a batch file. I've searched around the web, and found some examples with hundreds of lines of code, and others that required installing extra command line utilities to accomplish the task.</p>
<p>Similar things can be <a href="https://stackoverflow.co... | <p>Enjoy:</p>
<pre><code>forfiles -p "C:\what\ever" -s -m *.* -d <number of days> -c "cmd /c del @path"
</code></pre>
<p>See <a href="http://ss64.com/nt/forfiles.html" rel="noreferrer"><code>forfiles</code> documentation</a> for more details.</p>
<p>For more goodies, refer to <em><a href="http://www.ss64.com/n... | <p>More flexible way is to use <a href="https://github.com/npocmaka/batch.scripts/blob/master/hybrids/jscript/FileTimeFilterJS.bat" rel="nofollow noreferrer"><code>FileTimeFilterJS.bat</code></a>:</p>
<pre><code>@echo off
::::::::::::::::::::::
set "_DIR=C:\Users\npocmaka\Downloads"
set "_DAYS=-5"
... | 7,393 |
<p>Is it possible to write a <code>doctest</code> unit test that will check that an exception is raised?<br />
For example, if I have a function <code>foo(x)</code> that is supposed to raise an exception if <code>x < 0</code>, how would I write the <code>doctest</code> for that?</p>
| <p>Yes. You can do it. The <a href="https://docs.python.org/3/library/doctest.html" rel="noreferrer">doctest module documentation</a> and Wikipedia has an <a href="http://en.wikipedia.org/wiki/Doctest#Example_2:_doctests_embedded_in_a_README.txt_file" rel="noreferrer">example</a> of it.</p>
<pre><code> >>> ... | <pre><code>>>> import math
>>> math.log(-2)
Traceback (most recent call last):
...
ValueError: math domain error
</code></pre>
<p>ellipsis flag <em># doctest: +ELLIPSIS</em> is not required to use ... in Traceback doctest </p>
| 3,363 |
<h2>Backstory</h2>
<p>I've had issues in the past with my drive gear "eating" my filament. It seemed that the filament quit extruding for one reason or another and the drive gear would slowly eat away at the side of the filament.</p>
<p>I eventually assumed it was the plastic filament guides causing unnecessary tensi... | <p>For an easy test, try manually pulling the filament through the U-loop of guide tube. How hard is it to pull through? It should only take 1-2 lbs of tension at most. </p>
<p>Then do a "tug test" on the extruder. Start it loading and grab the filament by hand to try to stop it from extruding. The Replicator 1/2/2x e... | <p>The friction inside of the guide tubes is fairly minimal assuming that the lines are straight and there isn't anything else inside them. My guess would be that you may have another issue. Reducing the drag in the guide tubes while it may reduce the problem of clogged nozzle, might just be hiding the symptoms of anot... | 224 |
<p>Why does <code>n</code> not equal to <code>8</code> in the following function?</p>
<pre><code>void foo(char cvalue[8])
{
int n = sizeof (cvalue);
}
</code></pre>
<p>But <code>n</code> <em>does</em> equal to <code>8</code> in this version of the function:</p>
<pre><code>void bar()
{
char cvalue[8];
int n = s... | <p>Because you can't pass entire arrays as function parameters in C. You're actually passing a pointer to it; the brackets are syntactic sugar. There are no guarantees the array you're pointing to has size 8, since you could pass this function any character pointer you want.</p>
<pre><code>// These all do the same t... | <p>The size of the parameter on 32-bit systems will be 4 and on 64-bit systems compiled with -m64 will be 8. This is because arrays are passed as pointers in functions. The pointer is merely a memory address.</p>
| 7,146 |
<p>For best performance, is it better to use a virtual IDE HDD or virtual SCSI HDD?
If, SCSI, does it matter whether you use an BusLogic or LSILogic?</p>
| <p>Go for the SCSI and LSILogic. IDE and BusLogic are for compatibility reasons. Like when you do physical2virtual...</p>
<p>There's a whitepaper from vmware showing the difference between LSILogic and BusLogic, which in my opinion is rather small:
<a href="http://www.vmware.com/pdf/ESX2_Storage_Performance.pdf" rel="... | <p>I don't think that your choice of Virtual Disk type in VMWare matters for performance. What matters is the following: How much memory you have (the more the better), How many CPU cores you have (the more the better), and more specifically about disks, what matters most is the speed of the physical drive (a 15K RPM S... | 9,630 |
<p>Does anyone have a good solution for integrating some C# code into a java application? </p>
<p>The code is small, so I could re-write in java, but I would rather reuse the code if possible. Don't repeat yourself, etc. </p>
<p>Also, I know I can expose the C# as a web service or whatever, but it has some security/e... | <p>You would use the Java Native Interface to call your C# code compiled into a DLL.</p>
<p>If its a small amount of C#, it would be much easier to port it to Java. If its a lot, this might be a good way to do it.</p>
<p>Here is a highlevel overview of it:</p>
<p><a href="http://en.wikipedia.org/wiki/Java_Native_Int... | <p>I would rewrite it if it's not too much trouble.
The web service would work, but it seems like that would be a lot of overhead just to reuse a little code.</p>
| 7,320 |
<p>I've been dealing with 3D printing for 1.5 years, but now own a CR-6 SE myself since the beginning of 2021. Most things are already quite clear but for 2 days I have had a problem with the adhesion of the prints.</p>
<p>Nearly all prints I have done so far used the filament shipped with the printer (PLA 1.75) and th... | <p>It is likely the surface was damaged by the chemical cleaning, based on your description and <a href="https://3dprinting.stackexchange.com/questions/15392/cr-6-se-glass-build-plate-no-lifting-possible#comment28974_15392">octopus8's comment</a>. If you are unable to mechanically release the print, there is a chemical... | <p>Sounds like the bed came with a coating on it. If you can't find out what the coating is, but believe you already removed it, you could try glue sticks or hair spray. You can also find glue sticks specified for 3D printing. Elmer's glue sticks work. I'm yet to try glue sticks specified for a 3D printer. You can... | 1,838 |
<p>I'm using repository pattern with LINQ, have IRepository.DeleteOnSubmit(T Entity). It works fine, but when my entity class has interface, like this: </p>
<pre><code>public interface IEntity { int ID {get;set;} }
public partial class MyEntity: IEntity {
public int ID {
get { return this.IDfield; }
... | <p>It appears Microsoft dropped support for <code>==</code> operator in interfaces when using linq-to-sql in MVC4 (or maybe it was never supported). You can however use <code>i.ID.Equals(someId)</code> in place of the <code>==</code> operator.</p>
<p>Casting <code>IQueryable</code> to <code>IEnumerable</code> works bu... | <p>Try this:</p>
<pre><code>using System.Data.Linq.Mapping;
public partial class MyEntity: IEntity
{ [Column(Storage="IDfield", DbType="int not null", IsPrimaryKey=true)]
public int ID
{
get { return this.IDfield; }
set { this.IDfield=value; }
}
}
... | 3,514 |
<p>What materials work well for lubricating moving PLA, ABS, or PETG parts? I'm talking items like the
the <a href="https://www.thingiverse.com/thing:53451" rel="nofollow noreferrer">Gear Bearings</a> or <a href="https://www.thingiverse.com/thing:4575774" rel="nofollow noreferrer">Print in Place Engine</a>.</p>
<p>I've... | <p>When dealing with lubrication of plastics, any solvent or reactive substance is to be avoided. Petroleum is risky and Vaseline™ is a brand name for petroleum jelly.</p>
<p>I've had quite good results using inert lubrication such as PTFE and silicone based lubes. PTFE is the generic term for <a href="http://www.chm.b... | <p>After some testing, I can say that any oil is a bad option.</p>
<p>I've found that light oils tend to soak into and <strong>through</strong> any 3D printed FDM parts because of the small voids between lines and in turns and corners.</p>
<p>It is possible that resin-printed parts could be more oil-resistant, but I do... | 1,751 |
<p>I have some ASP.NET web services which all share a common helper class they only need to instantiate one instance of <em>per server</em>. It's used for simple translation of data, but does spend some time during start-up loading things from the web.config file, etc. <em>The helper class is 100% thread-safe. Think of... | <p>You can place your Helper in the Application State. Do this in global.asax:</p>
<pre><code> void Application_Start(object sender, EventArgs e)
{
Application.Add("MyHelper", new MyHelperClass());
}
</code></pre>
<p>You can use the Helper that way:</p>
<pre><code> MyHelperClass helper = (MyHelperClass)Htt... | <p>I 'v done something like this in my own app in the past and it caused all kinds of weird errors.
Every user will have access to everyone else's data in the property. Plus you could end up with one user being in the middle of using it and than getting cut off because its being requested by another user.</p>
<p>No th... | 8,807 |
<p>I want to get an overview of files that are updated in TFS (that someone else checked in) that I don't have the latest version for.</p>
| <p>In Visual Studio Source Control Explorer, right click on the directory you want to compare, and select "Compare". It will pop up a dialog with a couple of filtering options, and then show you what's out of date. </p>
| <p>if they checked them in as part of a single changeset then you can find them that way. </p>
<p>(right click file in solution explorer, view history, double-click on the relevant changeset and you'll see all the related files for that checkin)</p>
<p>Is your question about finding this info via the TFS API via the ... | 5,445 |
<p>What are some of the strategies that are used when implementing FxCop / static analysis on existing code bases with existing violations? How can one most effectively reduce the static analysis violations?</p>
| <p>Make liberal use of [SuppressMessage] attribute to begin with. At least at the beginning. Once you get the count to 0 via the attribute, you then put in a rule that new checkins may not introduce FxCop violations. </p>
<p>Visual Studio 2008 has a nice code analysis feature that allows you to ensure that code analys... | <p>An alternative to FxCop would be to use the tool <a href="http://www.ndepend.com/" rel="nofollow noreferrer">NDepend</a>. This tool lets write <strong>Code Rules over C# LINQ Queries</strong> (what we call <a href="http://www.ndepend.com/Features.aspx#CQL" rel="nofollow noreferrer">CQLinq</a>). <em>Disclaimer: I am ... | 4,663 |
<p>It's fairly common for E3D to sell silicone socks for their hot ends. There are also other companies that sell these silicone socks for their hot end cartridges.</p>
<p>According to a brief internet search, it seems the ignition temperature of silicone is surprisingly low - around 450 °C. This surprised me... | <p>Neither your thermistor nor your heater cartridge should ever be capable of becoming loose from your hotend, let alone the fact it's capable of reaching 800 °C before your printer even notices (This is a massive issue in itself!!!)</p>
<p>Silicone socks are safe, unless you're printing materials with extre... | <p>Silicone socks are <strong>safe to use</strong>, provided your <strong>printer is safely operating</strong> and you are <strong>using the silicone socks in their operating temperature range</strong>.</p>
<hr />
<h1>Your current setup is NOT SAFE!</h1>
<hr />
<p>When the heater element falls out of the heater block ... | 1,515 |
<p>I am trying to <code>INSERT INTO</code> a table using the input from another table. Although this is entirely feasible for many database engines, I always seem to struggle to remember the correct syntax for the <code>SQL</code> engine of the day (<a href="http://en.wikipedia.org/wiki/MySQL" rel="noreferrer">MySQL</a... | <p>Try:</p>
<pre><code>INSERT INTO table1 ( column1 )
SELECT col1
FROM table2
</code></pre>
<p>This is standard ANSI SQL and should work on any DBMS</p>
<p>It definitely works for:</p>
<ul>
<li>Oracle</li>
<li>MS SQL Server</li>
<li>MySQL</li>
<li>Postgres</li>
<li>SQLite v3</li>
<li>Teradata</li>
<li>DB2</li>
<l... | <p>In informix it works as Claude said:</p>
<pre><code>INSERT INTO table (column1, column2)
VALUES (value1, value2);
</code></pre>
| 4,553 |
<p>I've been tasked with redesigning part of a ms-sql database structure which currently involves a lot of views, some of which contain joins to other views. </p>
<p>Anyway, I wonder if anyone here could recommend a utility to automatically generate diagrams to help me visualise the whole structure.</p>
<p>What's the... | <p>I am a big fan of Embarcadero's <a href="http://www.embarcadero.com/products/er-studio" rel="nofollow noreferrer">ER/Studio</a>. It is very powerful and produces excellent on-screen as well as printed results. They have a free trial as well, so you should be able to get in and give it a shot without too much strif... | <p>If you are talking about MS SQL Server tables, I like the diagram support in SQL Server Management Studio. You just drag the tables from the explorer onto the canvas, and they are laid out for you along with lines for relationships. You'll have to do some adjusting by hand for the best looking diagrams, but it is ... | 2,611 |
<p>I'm not overly familiar with Tomcat, but my team has inherited a complex project that revolves around a Java Servlet being hosted in Tomcat across many servers. Custom configuration management software is used to write out the server.xml, and various resources (connection pools, beans, server variables, etc) written... | <p>I've had some luck with <a href="http://wrapper.tanukisoftware.org/doc/english/introduction.html" rel="noreferrer">the Java Service Wrapper</a></p>
| <p>It's possible to implement a Windows service in 100% Java code by combining the use of <a href="https://jdk.java.net/panama/" rel="nofollow noreferrer">Foreign Memory and Linker API</a> (previewing from JDK16 upwards) with <a href="https://github.com/openjdk/jextract" rel="nofollow noreferrer">OpenJDK jextract proje... | 9,363 |
<p>I'm absolutely stunned by the fact that MS just couldn't get it right to navigate to the definition of a method, when you're combining C# and VB projects in one solution. If you're trying to navigate from VB to C#, it brings up the "Object Explorer", and if from C# to VB, it generates a metadata file.</p>
<p>Hones... | <p>This is general to both languages.</p>
<ul>
<li>F12 in VB.Net always takes you to the object browser</li>
<li>F12 in C# always takes you to a meta-data definition</li>
</ul>
<p>This is a deliberate mechanism to try and match expected behaviour for upgrading users. The C# way gives you the right information, but th... | <p>Make sure that your reference is to the VB <em>project</em> and not just a DLL file.</p>
| 8,897 |
<p>Lately I had to change some code on older systems where not all of the code has unit tests.<br>
Before making the changes I want to write tests, but each class created a lot of dependencies and other anti-patterns which made testing quite hard.<br>
Obviously, I wanted to refactor the code to make it easier to test, ... | <p>First of all, <a href="http://devver.net/blog/2008/07/tips-for-unit-testing/" rel="noreferrer">here's a great article with tips on unit testing</a>. Secondly, I found a great way to avoid making tons of changes in old code is to just refactor it a little until you can test it. One easy way to do this is to make pr... | <p>I am not sure why would you say that unit tests are going be removed once refactoring is completed. Actually your unit-test suite should run after main build (you can create a separate "tests" build, that just runs the unit tests after the main product is built). Then you will immediately see if changes in one piece... | 2,894 |
<p>When implementing a needle search of a haystack in an object-oriented way, you essentially have three alternatives:</p>
<pre><code>1. needle.find(haystack)
2. haystack.find(needle)
3. searcher.find(needle, haystack)</code></pre>
<p>Which do you prefer, and why?</p>
<p>I know some people prefer the second altern... | <p>Usually actions should be applied to what you are doing the action on... in this case the haystack, so I think option 2 is the most appropriate.</p>
<p>You also have a fourth alternative that I think would be better than alternative 3:</p>
<pre><code>haystack.find(needle, searcher)
</code></pre>
<p>In this case, ... | <p>Definitely the third, IMHO.</p>
<p>The question of a needle in a haystack is an example of an attempt to find one object in a large collection of others, which indicates it will need a complex search algorithm (possibly involving magnets or (more likely) child processes) and it doesn't make much sense for a haystac... | 4,361 |
<p>I have a Crystal Report which is viewed via a CrystalReportViewer control on an .aspx page (using VS2008). </p>
<p>The report has two data-driven FieldObjects (which can contain a variable number of chars) which I would like to display on the same line beside each other. </p>
<p>Problem is when the text in the f... | <p>you can add a text object to the report. And while editing the text of the text object, drag the field you want to show from the object explorer into the text box. Then hit space, then drag the second field in to the same text box. Your two fields will always be one space a part. You could, of course, add more space... | <p>Or you can create a function which returns field1 + " " + field2 and add the function to the report.</p>
| 5,407 |
<p>If you create an Oracle dblink you cannot directly access LOB columns in the target tables.</p>
<p>For instance, you create a dblink with:</p>
<pre><code>create database link TEST_LINK
connect to TARGETUSER IDENTIFIED BY password using 'DATABASESID';
</code></pre>
<p>After this you can do stuff like:</p>
<pre... | <p>Yeah, it is messy, I can't think of a way to avoid it though.<br>
You could hide some of the messiness from the client by putting the temporary table creation in a stored procedure (and using "execute immediate" to create they table)<br>
One thing you will need to watch out for is left over temporary tables (should ... | <p>Do you have a specific scenario in mind?
For example, if the LOB holds files, and you are on a company intranet, perhaps you can write a stored procedure to extract the files to a known directory on the network and access them from there.</p>
| 5,901 |
<p>When I first got my 3D printer (a FlashForge Adventurer 3), it came with a sample pack of filament. With this filament, I was able to use skirts for my first layer. When the sample filament ran out, I switched to Hatchbox PLA filament. For some reason, I cannot use skirts with the Hatchbox filament. Now, whenever I ... | <p>PLA is a forgiving filament, you can even print such filament without a heated bed. Although there are differences in quality between brands, PLA shouldn't need a raft to be printed. Hatchbox filament is not considered as a low quality type of filament; it is economical and has been around since 2013. A raft is a st... | <p>Please try one (or more) of the following:</p>
<ol>
<li><p>Change the temperature of your heated bed (50 - 60 °C)</p>
</li>
<li><p>Check your nozzle height (0.15 - 0.25 mm is what I use)</p>
</li>
<li><p>Make sure your bed is level (Maybe use a leaving stick (or whatever those bubble things are called))</p>
</li>
<l... | 1,933 |
<p>What is the most efficient way to determine how many comments a particular blog post has? We want to store the data for a new web app. We have a list of permalink URl's as well as the RSS feeds. </p>
| <p>If I understand correctly, you want a heuristic to estimate the number of comments in an HTML page which is known to be a blog post, yes?</p>
<p>Very often, a specific blog will have some features which make it easy to work out. If you look at mine over at <a href="http://kstruct.com/" rel="nofollow noreferrer">htt... | <p>Blogs almost always have an RSS feed for comments. If you have that, then you can determine the exact number of comments, since the feeds 99% of the time follow a standard. Even if the blog is your own, if you are already generating an RSS feed, then don't bother making a call to your DB. You already did that to gen... | 7,018 |
<p>Are the naming conventions similar in different languages? If not, what are the differences?</p>
| <p>As others have said, things vary a lot, but here's a rough overview of the most commonly used naming conventions in various languages:</p>
<p><code>lowercase, lowercase_with_underscores</code>:</p>
<p>Commonly used for local variables and function names (typical C syntax).</p>
<p><code>UPPERCASE, UPPERCASE_WITH_U... | <p>Years ago an wise old programmer taught me the evils of <a href="http://en.wikipedia.org/wiki/Hungarian_notation" rel="nofollow noreferrer">Hungarian notation</a>, this was a real legacy system, Microsoft adopted it some what in the Windows SDK, and later in MFC. It was designed around loose typed languages like C, ... | 7,192 |
<p>Do you have any experience of designing a Real Shared-Nothing Architecture?
Would you have some readings to recommend me?</p>
| <p><a href="https://rads.stackoverflow.com/amzn/click/com/0596102356" rel="nofollow noreferrer" rel="nofollow noreferrer">Building Scalable Web Sites</a> by <a href="http://flickr.com" rel="nofollow noreferrer">Flickr</a> architect <a href="http://www.iamcal.com/" rel="nofollow noreferrer">Cal Henderson</a> is pretty m... | <p>I think that <a href="http://www.sitepoint.com/blogs/2004/07/01/the-j2ee-guy-still-doesnt-get-php/" rel="nofollow noreferrer">The J2EE guy still doesn’t get PHP</a> is (still) worth a read.</p>
| 3,981 |
<p>Is it possible to delete an GAE application after it has been created?</p>
<p>I made a mistake while typing the name and now have a dummy application that I haven't been able to remove.</p>
| <p>With the new Google Cloud console, you can still disable GAE applications as before (App Engine --> Settings --> Disable). They cannot currently be deleted. However you can delete the entire project by going to IAM --> Settings --> Shut Down. This button is in the header and a bit tricky to spot. It looks like thi... | <p>I wanted to delete some legacy Google App Engine applications I made years ago, but when I tried to delete them from the new Google Cloud Platform (like this: <a href="https://support.google.com/cloud/answer/6251787#shut-down-a-project" rel="nofollow">https://support.google.com/cloud/answer/6251787#shut-down-a-proje... | 6,403 |
<p>I need to call a web service written in .NET from Java. The web service implements the WS-Security stack (either WSE 2 or WSE 3, it's not clear from the information I have). </p>
<p>The information that I received from the service provider included WSDL, a policyCache.config file, some sample C# code, and a sampl... | <p>This seems to be a popular question so I'll provide an overview of what we did in our situation.</p>
<p>It seems that services built in .NET are following an older ws-addressing standard (<a href="http://schemas.xmlsoap.org/ws/2004/03/addressing/" rel="noreferrer">http://schemas.xmlsoap.org/ws/2004/03/addressing/</... | <p><a href="http://cwiki.apache.org/CXF20DOC/ws-support.html" rel="nofollow noreferrer">CXF</a> - I'd look into CXF. I've used it to create a web service and client in java using ws-secuirty. I also connected a .net web service to it.</p>
<p>They have pretty good documentation too. I had more luck with it than axis.</... | 3,717 |
<p>I have some code for starting a thread on the .NET CF 2.0:</p>
<pre><code>ThreadStart tStart = new ThreadStart(MyMethod);
Thread t = new Thread(tStart);
t.Start();
</code></pre>
<p>If I call this inside a loop the items completely out of order. How do introduce a wait after <code>t.Start()</code>, so that the work... | <p>How much order do you need to impose on the threads? If you just need all of the work started in the loop to finish before the code continues, but you don't care about the order the work within the loop finishes, then calling Join is the answer. To add more detail to <a href="https://stackoverflow.com/questions/6890... | <p>If I'm reading this properly, you're starting work items on bunch of threads but you're concerned that the threads are completing out of order, and, would prefer to wait until each thread completes in the order they were started ? </p>
<p>If this is the case then I'm not sure why you're creating a thread per work i... | 2,856 |
<p>I'm looking for a way to poll different servers and check that SQL server is up and running. I'm writing my code in C#. I don't particularly care about individual databases, just that SQL server is running and responsive.</p>
<p>Any ideas?</p>
| <p>Well, the brute force solution is to attempt to initiate a connection with the database on each server. That will tell you whether it's running, though you could have timeout issues.</p>
<p>The more elegant (but more difficult... isn't that always the way?) solution would be to use WMI to connect to the remote mach... | <p>I would certainly go with Vincent's answer. Just make absolutely certain you are closing and disposing the tcp connections properly etc. WMI seems a bit of overkill to me if that is all you're after.</p>
| 4,297 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.