instruction
stringlengths 27
22.5k
| chosen
stringlengths 27
28.2k
| rejected
stringlengths 19
24.9k
| __index_level_0__
int64 0
10k
|
|---|---|---|---|
<p>Well the subject is the question basically. Are there any version control systems out there for 3d models. An open source approach would be preferred of course.</p>
<p>I am looking for functionality along the lines of subversion however more basic systems would be of interest as well. Basic operations like branching / merging / commit should be available in one form or another. </p>
<p>UPDATE: With open source approach I don't mean free but the option of heavily expanding and customizing the system when needed</p>
<p>UPDATE2: I don't know how to describe this in the best way but the format of the 3d model is not that important. We will be using IFC models and mostly CAD programs. The approach Adam Davis describes is probably what I am looking for.</p>
|
<p>This is going to be difficult since most 3D CAD programs do not take into account the possibility of revision, so when you load something and then save it again it may completely re-order the points (there are reasons for this, usually done for performance).</p>
<p>Further, large models represented in a text format are huge files, and will take forever to copy/merge/etc.</p>
<p>There is no current system that will manage this, but there's a really big need in the industry for it.</p>
<p>I would expect such a system would have a model normalizer that converts to and from the desired CAD format and the revision format. It could then handle merges and track changes more easily.</p>
<p>It would also need to output diffs in a form that you could open a "diffed" model in a cad program and the changes are shown in a different color or otherwise highlighted. No one is going to be able to look at a text diff and understand what they're looking at. This diffing program would ultimately need to support understanding that two models are the same even though the 0,0,0 location and rotation are not the same (difficult matching problem) and give the user some interface to allow them to help it when it gets stuck.</p>
<p>You'd probably have to deal with the parts of the model separately (bones, mesh, textures, etc) and have a third file that synchronizes them when converting them to an inclusive model file for use and modification.</p>
<p>It's not a trivial problem... But if you started on something that just handled meshes and open sourced it, you'd probably get a lot of people interested.</p>
|
<p>I was under the impression that SVN is perfect for any kind of project that uses text files. So if your model is made up of text files, then it would be fine. </p>
<p>I don't see how binary data would work, as all version control that I know of makes use of diff management, which uses text comparisons.</p>
| 6,337
|
<p>What is the best technique to improve removing PETG from the print bed?</p>
<p>PETG is known for sticking well to the bed; so well that it does not need a heated bed. If it weren’t for printing other materials, I would try printing directly on the glass bed instead of a build surface. However, the build surface may help protect the glass from excessive force.</p>
<p>To reduce how strong the PETG sticks to the build surface I’ve reduced the bed temperature to 35 °C. It is easier to remove the skirt and brim by heating the bed up to 90 °C, so that the PETG is soft. However, if one tries to remove the printed object at 90 °C, the printed object is like to distort and ruin.</p>
<p>I did sharpen the putty knife on the top side only. This helps, but it still takes excessive time to remove the print job and clear the bed. The excessive force on the bed from the putty knife seems to increase the need to level the bed. It also seems to affect the flatness of the build surface.</p>
<p>I’m looking for techniques to make it easier and less time consuming to remove the PETG print from the bed.</p>
<p>P.S. Additions after input from answers.</p>
<ol>
<li>Added keeping the initial Z-height high enough to keep adhesion to the bed from being too high. This resolved the adhesion to the bed issue, but seemed to make adhesion between layers worse.</li>
<li>Set hot end to 230°C for first layer, then increased hot end temperature to 250°C for better adhesion between layers.</li>
</ol>
|
<p>Playing around with the nozzle height will help: back it off until just before you have first layer adhesion issues. Don't jam the filament into the bed as you might for ABS. This helps with small prints. However, my experience has been that if you have a large enough continuous contact area (i.e. more than a few square inches) with the print bed, there will be problems getting the print off. So I still use painters tape (in case I have to rip the print off with force) and glue sticks (so that I don't often need to) on my aluminum print bed as I've found that makes it much easier to deal with without damaging either the bed or the print.</p>
<p>You can also try dialing back the heated bed temperature a bit (I think I've got mine set to 70-75c for PETG) but that also doesn't eliminate the issue with larger prints. Also, if I lowered it too much I had problems with first layer adhesion on any size print.</p>
<p>I also have a glass plate that I use for ABS, which I don't use with PETG. I've read too many accounts of it sticking too well to glass as well (to the point of the plate being destroyed) and didn't want to try using the amount of force on it that I sometimes have to when removing a PETG print. I also considered trying BuildTak but read accounts of similar issues with it and PETG. So I stayed with what's been working for me: tape and glue sticks.</p>
|
<p>Correctly level your bed. Seriously, that's the answer. PETG does stick well, but it only gets difficult to remove if you're smashing the first layer against the bed with a nozzle that's way too close. With the bed leveled properly - using feeler gauges or test prints and a sub-0.1-mm-precision caliper - I have no trouble taking PETG prints off a buildtak-clone bed. Glass should be easier.</p>
<p>If you already have PETG stuck to a build surface you care about and don't want to risk destroying it, try heat, or alternating heat and cold.</p>
| 1,776
|
<p>My CR-10 is starting prints, BUT then makes weird spiral pattern, layers go up vertically with large gaps. Hollow infill.</p>
<p><img src="https://i.stack.imgur.com/cQynM.jpg" alt="wierd vertical spiral layering pattern">
<img src="https://i.stack.imgur.com/bEbhg.jpg" alt="printed fine at base then randomly happened">
<img src="https://i.stack.imgur.com/kkMB3.jpg" alt="This one was printing the weird pattern at base but not as obviously, but got worse about six inches up until it made the top completely hollow"></p>
<p>I don’t know if it’s:
- My Slicing skills
- original files
- the printer itself
Long explanation. Questions at the end. I’ve had beautiful normal prints. Then I’ve had these abnormal spiral layer prints with infill issues and spaghetti monsters (the images don’t show but, where the prints pictured end, is not the full print, it did the weird spiral then just stopped layering altogether). I’m semi-new to printing and don’t have too much of a tech background apart from average use. Been researching a couple months, I’ve only been printing for about a week. I’ve had an amazing couple prints. Baby groot was flawless, barely noticeable layers. The test print (a rather thick disk with deep grid marks and a puppy on top) that came with the printer was the same smooth flawless, it wasn’t my first print though. So the behavior seems erratic. The two prints pictured had several successful print in between them. </p>
<p>I do know:</p>
<p>The elder wand file was in several tutorials and was printed successfully. Its in two parts. The first part, which is way shorter and thicker printed Amazingly. The second part pictured was double the height+ and 1/4 the thickness. I even printed it successfully once before going horizontally and flat against the bed. BUT I had to run the print three times because the filament would not stick to the glass. It was just being dragged along behind the nozzle. But I was observing so I ended the print before it went too far. All I did to change this was add a brim and supports. Which gave a “successful print” except the fact that one of the knobs has a flat spot and the support remnants were very noticeable. Resolution was terrible too. Hence why I decided to try printing it vertically.</p>
<p>The bigger print pictured is the base of a hufflepuff horecrux cup, the first time I printed it was with cura slicer, it came out beautifully but the stem snapped right under the base of the cup part st some point, and the left handle had some wierd stringing issues, like 7 pure strands of filament hanging out one corner, and the print failed s fee layers from top. However the file description only had one previous make listed and the thing with the top of the handle and print failed about the same with that persons print.</p>
<p>Sorry for the long post. I’d just really appreciate any help, and I wanted to give all the details.</p>
|
<p><sub>This is partial answer and comment as it was too big to fit the comment section, it will be a proper answer once the question is updated by the OP.</sub></p>
<p>What you call a weird spiral pattern is the result of under-extrusion. When there is under-extrusion, the resulting print is sparsely filled. The reason for this under-extrusion is most probably partial clogging of the nozzle, or an issue with the extruder itself. One explanation could be that you are suffering from heat creep, but the information you provide is not enough to explain this or any other solution further in detail. Clogging can e.g. be caused by retraction settings and/or temperature settings, without your settings it is a guess what this is actually causing this.</p>
<hr />
<p>Looking at the print deteriorate the higher the Z becomes this is most probably a heat creep issue, so you print too hot with too large retraction settings.</p>
|
<p>While uncommon, this issue could be caused by having no minimum layer time set. This could lead to printing on a still very hot surface, which in turn ripples and moves, creating a little wave pattern. The wave pattern then can grow into this diagonal pattern.</p>
<p>You might manage to reduce the issue by setting a minimum layer time of 10 to 15 seconds.</p>
| 1,191
|
<p>Is there a list of 3D cards available that provide full scene antialiasing as well as which are able to do it in hardware (decent performance)?</p>
|
<p>Pretty much all cards since DX7-level technology (GeForce 2 / Radeon 7000) can do it. Most notable exceptions are Intel cards (Intel 945 aka GMA 950 and earlier can't do it; I think Intel 965 aka GMA X3100 can't do it either).</p>
<p>Older cards (GeForce 2 / 4MX, Radeon 7000-9250) were using supersampling (render everything into internally larger buffer, downsample at the end). All later cards have multisampling, where this expensive process is only performed at polygon edges (simply speaking, shaders are run for each pixel, while depth/coverage is stored for each sample).</p>
|
<p>Having seen a pile of machines recently that don't do it, I don't think that's quite true. The GMA 950 integrated ones don't do it to start with, and I don't think that the 3100/X3100 do either (at least not in hardware... the 3100 was enormously slow in a demo). Also, I don't believe that the GeForce MX5200 supported it either.</p>
<p>Or perhaps I'm just misunderstanding what you mean when you refer to "AA mode". Are there a lot of cards which support modes that are virtually unnoticable? :)</p>
| 4,896
|
<p>I have a development vm which is running sql server as well as some other apps for my stack, and I found that the other apps are performing awfully. After doing some digging, SQL Server was hogging the memory. After a quick web search I discovered that by default, it will consume as much memory as it can in order to cache data and give it back to the system as other apps request it, but this process often doesn't happen fast enough, apparently my situation is a common problem. </p>
<p><a href="http://blog.stevehorn.cc/2007/10/limit-memory-usage-in-sql-server-2005.html" rel="nofollow noreferrer">There however is a way to limit the memory SQL Server is allowed to have</a>. My question is, how should I set this limit. Obviously I'm going to need to do some guess and check, but is there an absolute minimum threshhold? Any recommendations are appreciated. </p>
<p>Edit:</p>
<p>I'll note that out developer machines have 2 gigs of memory so I'd like to be able to run the vm on 768 mb or less if possible. This vm will be only used for local dev and testing , so the load will be very minimal. After code has been tested locally it goes to another environment where the SQL server box is dedicated. <strong>What I'm really looking for here is recommendations on minimums</strong></p>
|
<p>Since this is a development environment, I agree with Greg, just use trial and error. It's not that crucial to get it perfectly right.</p>
<p>But if you do a lot of work in the VM, why not give it at least half of the 2GB?</p>
|
<blockquote>
<p>so id like to be able to run the vm on
768 mb or less if possible.</p>
</blockquote>
<p>That will depend on your data and the size of your database. But I usually like to give SQL server at least a GB</p>
| 4,805
|
<p>I feel like I’ve tried everything. I’ve had an Ender 3 for seven months now printing in PLA. </p>
<p>I’ve modded it plenty including BLTouch. I’m now doing a project that really requires ABS so I have the white hatch box ABS. It wasn’t sticking at first but I got that well under control with glue tape and proper leveling with an enclosure. And I’m assuming this is important. I do indeed have an enclosure. Anyone I’m printing this part that has two long but thin-sideways protrusions coming out. Each one keeps de-laying at two specific points. I’ve tried everything including temperature and everything in Cura settings. I’m up to four failed prints now. I also tried other prints with the ABS and they also delayered in specific spots over and over. </p>
<p>Please help I’m close to completely giving up on my projects. The de-layerings are all the same with this one being the worse of them.</p>
<p><a href="https://i.stack.imgur.com/s3MRr.jpg" rel="nofollow noreferrer" title="Photo of print"><img src="https://i.stack.imgur.com/s3MRr.jpg" alt="Photo of print" title="Photo of print"></a></p>
|
<p>Welcome Fox_89 to the SE 3D Printing site. Thank you for bringing your question, and I hope you contribute both questions and answers in the years ahead.</p>
<p>I understand that you've tried everything, so I have nothing new to suggest.</p>
<p>Never the less, I would suggest some possibilities, perhaps one of which you haven't yet tried:</p>
<ul>
<li>Extrude hotter filament. Increase the nozzle temperature. My
printer (Pruse3D i3m3s) prints ABS at 255 degrees C. Give the layers
a better chance to melt together.</li>
<li>Print slower, so that the layers have a longer time to melt together,
and they have a longer time to cool before the next layer reheats
them.</li>
<li>Use a cooling fan to bring the part to equilibrium more quickly.</li>
<li>Try a different filament. Not all filaments have the same shrinkage.
Hatchbox has worked pretty well for me, but try another manufacturer.
Try another color, like transparent. White can be a difficult color
because it must carry a high pigment load. Black can carry less
pigment, and might be easier to print. "Transparent" or "natural"
carries no pigment.</li>
<li>Check for anything that might increase the strain on the part at that
layer. It could be a geometry change on the other side of the part,
since that changes the thermal profile of the whole layer.</li>
<li>Must it be ABS? PETG has a higher working temperature than PLA, but will print
differently than ABS.</li>
</ul>
|
<p>I'd second printing slow and near as hot as your filament can stand and still hold shapes in test runs.</p>
<p>Extruding thin has worked well for me in cases with ABS pull/shrinkage. I've also had luck heating up the environment my printer is in. ABS stays gummy above 105C (its Tg is around there), so I've had good luck running my deck at 105C, and either setting up my print so that parts that were likely to have problems are close to the heat element (on my Ender 3 it's the ~5cm in the center of the plate) or using other external heat (with no fan). [Note to people who might want to try external heat: ABS is flammable - stick with other methods unless you feel sure you understand the safety factors.]</p>
<p>ABS grinds down nicely - if it's feasible, consider making these parts thicker/adding a raft on a super hot deck, so you can print much hotter, then sanding to your desired shape.</p>
<p>Lastly, and least elegantly: I'm not sure if this is possible - depends on the exact project - but you might think about ways to print these parts separately (close to the hot deck) for connection post-printing. ABS is acetone-soluble, so it's pretty straight-forward to melt some spare bits, and voilà: glue.</p>
<p>Good luck! ABS is a pretty sweet polymer - don't give up on that project just yet!</p>
| 1,367
|
<p>I've never used a printer with auto bed leveling, but my understanding is that most or all of them don't actually level anything, but rather compensate for the unlevel bed in firmware by transforming the coordinates. It seems to me this would necessarily introduce aliasing artifacts in all your prints by making it so that line widths are no longer a whole number of microsteps - I immediately observed such an effect on top/bottom skin when I tried to use steps-per-mm tweaking in firmware to compensate for a dimensional error rather than fixing the mechanical source of the error, and concluded that it was a dead-end approach.</p>
<p>If the auto-leveling firmware only makes adjustments with the Z motor as it moves, rather than transforming all three coordinates, it seems like that would be mostly or entirely mitigated, but with slight errors in dimensional accuracy dependent on how tilted the bed actually is.</p>
<p>Do any of the printers with (or add-on kits for) auto bed leveling actually level the bed mechanically, with servos attached to the adjustment knobs? Why isn't an approach like that more common?</p>
|
<p>Automatic bed levelling is not magic; it still requires you to level the bed properly (as level as possible). The upside of automatic bed levelling is that it compensates for small deviations like a slightly slanted surface or a (somewhat large) dent in the surface (as long it is probed and can be digitized by the firmware). It will keep the nozzle at a distance to the bed that it maintains proper distance to the bed for the filament to adhere properly (first layer adherence is key for successful prints). The slight imperfections are smeared out over about 10 mm (set in the firmware), this way you do not need transformations for the whole print (so if you deliberately make the bed very skew, the print will follow the Z axis, not the direction perpendicular to the bed).</p>
<p>While systems to level or align the bed exist, it is not very practical and expensive as it requires more parts, that is why it is not commonly used. Apart from the suggested printer in <a href="/a/10408">this answer</a>, printers with e.g. 4 ball screw Z movement lead screws exist (mostly printers for companies, not for use at home); ball screws are way more expensive, but also way more accurate than trapezoidal lead screws. A low accuracy is preferable as such systems generally have no guiding linear rods (as that would mean that you fix the plane/alignment of the build platform!).</p>
|
<p>The only 'consumer' approach to this would be providing adjustment feedback to the user, after the bed has been probed to determine an optimal position so that most of the bed is in the same plane.</p>
<p>This seems to me like a 'free' enhancement, but users don't seem to be overly worried by the distortions introduced (or perform the calibrations manually already).</p>
| 1,381
|
<p>Hey so theres a product we have been prototyping.
We cant do FDM. The item has a ball valve.
and the ball ~ 1.6-1.9mm
I cant seem to prototype it. I have tried SLS, SLA, Polyjet.
Anybody knows what could be wrong, or what should be the dimension i should be using?
I thought I would post this at engineering section, but since I have to prototype I thought its best if its in 3D Printing section</p>
<p>Edit:</p>
<p><a href="https://i.stack.imgur.com/0neFf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0neFf.png" alt="Ball is 2mm in dia. clearance of 0.1mm is used "></a></p>
<p>Update: </p>
<p><a href="https://i.stack.imgur.com/Byftf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Byftf.png" alt="Figure explains the direction of air"></a></p>
<p>So heres a figure showing the direction of air flow. </p>
<p>Update:
Thanks both answers are helpful. though not a precise answer. Then again, there is no correct answer.
Thanks a bunch. Lets see how the coming months are. :p</p>
|
<p>Hey why to make it soooo sophisticated and poor?
Air valve cannot be designed with 2 stiff elements - it will never work.</p>
<p>Make the air your friend but not the enemy. Use old good rubber (silicone) "flake" instead. Especially when you have such small design.</p>
<p>Take a look on the picture.</p>
<p><a href="https://i.stack.imgur.com/Sk4Lj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sk4Lj.png" alt="enter image description here"></a></p>
<p>Here you have black element which is rubber or silicone. It's sticked on one side. When air goes from the pipe (goes up) then rubber is slack so the air can flow. When you suck then rubber seals the pipe.</p>
<p><strong>[edit]</strong></p>
<p>You can find such solution in for example bike pumps, inflatable matterss pumps also gas masks and so on. It's pretty fine for low pressure. </p>
<p>Of course ball valves are also widely use but then such device has to have "rubber" ball nest so ball lies on the rubber ring to seal it. There has to be a spring to tight the ball to the ring. Without such spring turning the device upside down would cause the valve would not work at all.
Ball solutions are intended to higher pressure.</p>
<p>Please note the spring which tights a ball creates kinda threshold on the pressure level which means that pressure has to exceed a spring force to reduce a pressure. This doesn't occure in rubber valve.</p>
<p>I don't know what device you are trying to prototype but I'm pretty sure a rubber valve will be just fine.</p>
<p>Please also note that sealing surface is very low in ball valve solution but in rubber valve it can be almost unlimited so it can seal quite well even when the surface is not perfect.</p>
|
<p>As mentioned above in the comments, this really isn't a good application of 3D Printing. At least, not with expectation that it functions. I'd suggest using 3D printing to verify other dimensions and having the part machined traditionally. That ball and "seal" needs to be precision ground or honed to fit in order to stop air flow.</p>
<p>My company has manufactured parts similar to this and the way to go was to produce a concave "cup" for the ball to settle into and hone the edges with a diamond slush using a ball end mill. That way, the ball settles into the cup and the pressure creates the seal.</p>
<p><sup>Omitted due to update in OP's image</sup><s><strong>Update</strong>
Excuse the poor SketchUp drawing, but this might help explain a potential design change:
<a href="https://i.stack.imgur.com/PHCM4.png" rel="nofollow noreferrer">Deprecated image</a>
</s></p>
<p>Please see <a href="https://3dprinting.stackexchange.com/questions/1065/ball-valve-to-be-prototyped/1075#1081">DarthPixel's answer</a> for a good design choice.</p>
| 268
|
<p><a href="https://3dprinting.stackexchange.com/questions/12153/updating-marlin-firmware-step-by-step-guide">Updating Marlin Firmware - Step by Step Guide</a></p>
<p>Page asks for step by step updates, but is locked for comments, answers, or edits. How does one help?</p>
|
<p>Users with a high enough reputation were able to edit the question and the answer, it has been locked for lower reputation users to prevent adding other answers while we were establishing a framework for the answer. Once the answer is visible the whole community will be able to add to the answer within the framework of the answer. Note that we possibly will lock the addition of new answers.</p>
|
<p>The question was locked when several of the vets [0scar and me mainly] were working on the infancy of the answer - it was 2 days of a hot mess as we went through the source code to find all the essential settings we usually forget after we have set them for our own machine distributions - if we even do our own distribution and not take one from another that was so kind to make it for the same machine.</p>
| 75
|
<p>Using C# and WPF under .NET (rather than <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="noreferrer">Windows Forms</a> or console), what is the correct way to create an application that can only be run as a single instance?</p>
<p>I know it has something to do with some mythical thing called a mutex, rarely can I find someone that bothers to stop and explain what one of these are.</p>
<p>The code needs to also inform the already-running instance that the user tried to start a second one, and maybe also pass any command-line arguments if any existed.</p>
|
<p>Here is a very good <a href="http://sanity-free.org/143/csharp_dotnet_single_instance_application.html" rel="noreferrer">article</a> regarding the Mutex solution. The approach described by the article is advantageous for two reasons.</p>
<p>First, it does not require a dependency on the Microsoft.VisualBasic assembly. If my project already had a dependency on that assembly, I would probably advocate using the approach <a href="https://stackoverflow.com/a/19326/3195477">shown in another answer</a>. But as it is, I do not use the Microsoft.VisualBasic assembly, and I'd rather not add an unnecessary dependency to my project.</p>
<p>Second, the article shows how to bring the existing instance of the application to the foreground when the user tries to start another instance. That's a very nice touch that the other Mutex solutions described here do not address.</p>
<hr>
<h3>UPDATE</h3>
<p>As of 8/1/2014, the article I linked to above is still active, but the blog hasn't been updated in a while. That makes me worry that eventually it might disappear, and with it, the advocated solution. I'm reproducing the content of the article here for posterity. The words belong solely to the blog owner at <a href="http://sanity-free.org/" rel="noreferrer">Sanity Free Coding</a>.</p>
<blockquote>
<p>Today I wanted to refactor some code that prohibited my application
from running multiple instances of itself.</p>
<p>Previously I had use <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx" rel="noreferrer">System.Diagnostics.Process</a> to search for an
instance of my myapp.exe in the process list. While this works, it
brings on a lot of overhead, and I wanted something cleaner.</p>
<p>Knowing that I could use a mutex for this (but never having done it
before) I set out to cut down my code and simplify my life.</p>
<p>In the class of my application main I created a static named <a href="http://msdn.microsoft.com/en-us/library/system.threading.mutex(v=vs.110).aspx" rel="noreferrer">Mutex</a>:</p>
</blockquote>
<pre><code>static class Program
{
static Mutex mutex = new Mutex(true, "{8F6F0AC4-B9A1-45fd-A8CF-72F04E6BDE8F}");
[STAThread]
...
}
</code></pre>
<blockquote>
<p>Having a named mutex allows us to stack synchronization across
multiple threads and processes which is just the magic I'm looking
for.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/58195swd(v=vs.110).aspx" rel="noreferrer">Mutex.WaitOne</a> has an overload that specifies an amount of time for us
to wait. Since we're not actually wanting to synchronizing our code
(more just check if it is currently in use) we use the overload with
two parameters: <a href="http://msdn.microsoft.com/en-us/library/85bbbxt9(v=vs.110).aspx" rel="noreferrer">Mutex.WaitOne(Timespan timeout, bool exitContext)</a>.
Wait one returns true if it is able to enter, and false if it wasn't.
In this case, we don't want to wait at all; If our mutex is being
used, skip it, and move on, so we pass in TimeSpan.Zero (wait 0
milliseconds), and set the exitContext to true so we can exit the
synchronization context before we try to aquire a lock on it. Using
this, we wrap our Application.Run code inside something like this:</p>
</blockquote>
<pre><code>static class Program
{
static Mutex mutex = new Mutex(true, "{8F6F0AC4-B9A1-45fd-A8CF-72F04E6BDE8F}");
[STAThread]
static void Main() {
if(mutex.WaitOne(TimeSpan.Zero, true)) {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
mutex.ReleaseMutex();
} else {
MessageBox.Show("only one instance at a time");
}
}
}
</code></pre>
<blockquote>
<p>So, if our app is running, WaitOne will return false, and we'll get a
message box.</p>
<p>Instead of showing a message box, I opted to utilize a little Win32 to
notify my running instance that someone forgot that it was already
running (by bringing itself to the top of all the other windows). To
achieve this I used <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms644944(v=vs.85).aspx" rel="noreferrer">PostMessage</a> to broadcast a custom message to every
window (the custom message was registered with <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms644947(v=vs.85).aspx" rel="noreferrer">RegisterWindowMessage</a>
by my running application, which means only my application knows what
it is) then my second instance exits. The running application instance
would receive that notification and process it. In order to do that, I
overrode <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.form.wndproc(v=vs.110).aspx" rel="noreferrer">WndProc</a> in my main form and listened for my custom
notification. When I received that notification I set the form's
TopMost property to true to bring it up on top.</p>
<p>Here is what I ended up with:</p>
<ul>
<li>Program.cs</li>
</ul>
</blockquote>
<pre><code>static class Program
{
static Mutex mutex = new Mutex(true, "{8F6F0AC4-B9A1-45fd-A8CF-72F04E6BDE8F}");
[STAThread]
static void Main() {
if(mutex.WaitOne(TimeSpan.Zero, true)) {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
mutex.ReleaseMutex();
} else {
// send our Win32 message to make the currently running instance
// jump on top of all the other windows
NativeMethods.PostMessage(
(IntPtr)NativeMethods.HWND_BROADCAST,
NativeMethods.WM_SHOWME,
IntPtr.Zero,
IntPtr.Zero);
}
}
}
</code></pre>
<blockquote>
<ul>
<li>NativeMethods.cs</li>
</ul>
</blockquote>
<pre><code>// this class just wraps some Win32 stuff that we're going to use
internal class NativeMethods
{
public const int HWND_BROADCAST = 0xffff;
public static readonly int WM_SHOWME = RegisterWindowMessage("WM_SHOWME");
[DllImport("user32")]
public static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam);
[DllImport("user32")]
public static extern int RegisterWindowMessage(string message);
}
</code></pre>
<blockquote>
<ul>
<li>Form1.cs (front side partial)</li>
</ul>
</blockquote>
<pre><code>public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
protected override void WndProc(ref Message m)
{
if(m.Msg == NativeMethods.WM_SHOWME) {
ShowMe();
}
base.WndProc(ref m);
}
private void ShowMe()
{
if(WindowState == FormWindowState.Minimized) {
WindowState = FormWindowState.Normal;
}
// get our current "TopMost" value (ours will always be false though)
bool top = TopMost;
// make our form jump to the top of everything
TopMost = true;
// set it back to whatever it was
TopMost = top;
}
}
</code></pre>
|
<p>Based Matt Davis' answer, wrapped into a class for convenience.</p>
<pre><code>public static class SingleAppInstanceChecker
{
/// <summary>
/// Arbitrary unique string
/// </summary>
private static Mutex _mutex = new Mutex(true, "0d12ad74-026f-40c3-bdae-e178ddee8602");
public static bool IsNotRunning()
{
return _mutex.WaitOne(TimeSpan.Zero, true);
}
}
</code></pre>
<p>Example usage:</p>
<pre><code>private void Application_Startup(object sender, StartupEventArgs e)
{
if (!SingleAppInstanceChecker.IsNotRunning())
{
MessageBox.Show("Application is already running.");
// Exit application using:
// Environment.Exit(1);
// Application.Current.Shutdown();
// Etc...
return;
}
// Allow startup and continue with normal processing
// ...
}
</code></pre>
| 3,963
|
<p>Let's say I want to represent <code>\q</code> (or any other particular "backslash-escaped character"). That is, I want to match <code>\q</code> but not <code>\\q</code>, since the latter is a backslash-escaped backslash followed by a <code>q</code>. Yet <code>\\\q</code> would match, since it's a backslash-escaped backslash followed by a backslash-escaped <code>q</code>. (Well, it would match the <code>\q</code> at the end, not the <code>\\</code> at the beginning.)</p>
<p>I know I need a negative lookbehind, but they always tie my head up in knots, especially since the backslashes themselves have to be escaped in the regexp.</p>
|
<p>Updated:
My new and improved Perl regex, supporting more than 3 backslashes:</p>
<pre>/(?<!\\) # Not preceded by a single backslash
(?>\\\\)* # an even number of backslashes
\\q # Followed by a \q
/x;</pre>
<p>or if your regex library doesn't support extended syntax.</p>
<pre>/(?<!\\)(?>\\\\)*\\q/</pre>
<p>Output of my test program:</p>
<pre>q does not match
\q does match
\\q does not match
\\\q does match
\\\\q does not match
\\\\\q does match</pre>
<p>Older version</p>
<pre>/(?:(?<!\\)|(?<=\\\\))\\q/</pre>
|
<p>The best solution to this is to do your own string parsing as Regular Expressions don't really support what you are trying to do. (rep @Frank Krueger if you go this way, I'm just repeating his advice)</p>
<p>I did however take a shot at a exclusionary regex. This will match all strings that do not fit your criteria of a "\" followed by a character.</p>
<pre><code>(?:[\\][\\])(?!(([\\](?![\\])[a-zA-Z])))
</code></pre>
| 8,051
|
<p>I've noticed that a few Wordpress blogs have query statistics present in their footer that simply state the number of queries and the total time required to process them for the particular page, reading something like:</p>
<blockquote>
<p>23 queries. 0.448 seconds</p>
</blockquote>
<p>I was wondering how this is accomplished. Is it through the use of a particular Wordpress plug-in or perhaps from using some particular php function in the page's code?</p>
|
<p>Try adding this to the bottom of the footer in your template:</p>
<pre><code><?php echo $wpdb->num_queries; ?> <?php _e('queries'); ?>. <?php timer_stop(1); ?> <?php _e('seconds'); ?>
</code></pre>
|
<p>wordpress has a easy solution now</p>
<p>There is a function called <a href="http://codex.wordpress.org/Function_Reference/get_num_queries" rel="nofollow"><code>get_num_queries()</code></a> and as specified in other answers <a href="http://codex.wordpress.org/Function_Reference/timer_stop" rel="nofollow"><code>timer_stop()</code></a>.</p>
<pre><code><?php echo get_num_queries(); _e(' queries'); ?> in <?php timer_stop(1); _e(' seconds'); ?></p>
</code></pre>
<p><code>get_num_queries()</code> - returns the number of database queries during the WordPress execution and accepts no parameters </p>
| 3,565
|
<p>I am about to build a piece of a project that will need to construct and post an XML document to a web service and I'd like to do it in Python, as a means to expand my skills in it. </p>
<p>Unfortunately, whilst I know the XML model fairly well in .NET, I'm uncertain what the pros and cons are of the XML models in Python. </p>
<p>Anyone have experience doing XML processing in Python? Where would you suggest I start? The XML files I'll be building will be fairly simple.</p>
|
<p>Personally, I've played with several of the built-in options on an XML-heavy project and have settled on <a href="http://docs.python.org/lib/module-xml.dom.pulldom.html" rel="noreferrer">pulldom</a> as the best choice for less complex documents.</p>
<p>Especially for small simple stuff, I like the event-driven theory of parsing rather than setting up a whole slew of callbacks for a relatively simple structure. <a href="http://www.prescod.net/python/pulldom.html" rel="noreferrer">Here is a good quick discussion of how to use the API</a>.</p>
<p>What I like: you can handle the parsing in a <code>for</code> loop rather than using callbacks. You also delay full parsing (the "pull" part) and only get additional detail when you call <code>expandNode()</code>. This satisfies my general requirement for "responsible" efficiency without sacrificing ease of use and simplicity.</p>
|
<p>I assume that the .NET way of processing XML builds on some version of MSXML and in that case I assume that using, for example, minidom would make you feel somewhat at home. However, if it is simple processing you are doing, any library will probably do.</p>
<p>I also prefer working with ElementTree when dealing with XML in Python because it is a very neat library.</p>
| 2,284
|
<p>I have two arrays of <code>System.Data.DataRow</code> objects which I want to compare. </p>
<p>The rows have two columns A and B. Column A is a key and I want to find out which rows have had their B column changed and which rows have been added or deleted. </p>
<p><strong>How do I do this in PowerShell?</strong></p>
|
<p>I wrote a script to do this a little while back. The script (Compare-QueryResults.ps1) is available <a href="http://podcast.acoupleofadmins.com/media/Scripts/Compare-QueryResults.ps1" rel="nofollow noreferrer">here</a> and you will also need my Run-SQLQuery script (available <a href="http://podcast.acoupleofadmins.com/media/scripts/Run-SQLQuery.ps1" rel="nofollow noreferrer">here</a>) or you can replace that with a script or function of your own.</p>
<p>Basically, what the script does is take the results of each of your queries and break the datarows apart so that each field is its own object. It then uses Compare-Object to check for any differences between the data in those rows. It returns a comparison object that shows you all the differences between the data returned.</p>
<p>The results are an object, so you can save them to a variable and use Sort-Object or the Format-* cmdlets with them.</p>
<p>Good luck. If you have any problems with the scripts, let me know, I'd be happy to walk you through them. I've been using them for application testing, seeing what rows are being modified by different actions in a program.</p>
|
<p>Do you need two arrays of DataRows? the DataRow object has a RowState property which will give you what you require. See the MSDN Docs: <a href="http://msdn.microsoft.com/en-us/library/system.data.datarow.rowstate.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/</a></p>
| 4,196
|
<p>What materials, available as filaments for use in FDM printing, are known to be the most physically and chemically inert? In particular, stability (not necessarily simultaneously) in the presence of the following should be assumed:</p>
<ul>
<li>pH 0-14</li>
<li>oxidizing agents (ozone, permanganates, dichromates, acidic hydrogen
peroxide)</li>
<li>organic solvents (particularly acetone, methanol, toluene, formamide)</li>
<li>temperature up to 160 degrees Celsius</li>
<li>pressures between ~10^-7 torr and ~2 bar</li>
<li>oxygen or argon plasma</li>
</ul>
|
<p>PEEK, a plastic known for its superior chemical and physical resilience (<a href="http://www.zeusinc.com/materials/peek/chemical-resistance-chart-peek" rel="nofollow">http://www.zeusinc.com/materials/peek/chemical-resistance-chart-peek</a>), has been successfully used for filament-based printing (<a href="https://3dprint.com/52713/indmatec-peek-fdm-printing-filament/" rel="nofollow">https://3dprint.com/52713/indmatec-peek-fdm-printing-filament/</a>). However, it is unlikely to be an option on most existing printers given its high melting temperature (around 343 degrees Celsius, <a href="https://en.wikipedia.org/wiki/PEEK" rel="nofollow">https://en.wikipedia.org/wiki/PEEK</a>). Though it does not meet all the criteria proposed (for instance, its glass transition temperature is around 143 degrees Celsius), overall it is a fairly good choice.</p>
<p>Teflon, an obvious choice, unfortunately has a decomposition temperature very close to its melting temperature, and appears to be unsuitable for extrusion.</p>
|
<p>PEEK, a plastic known for its superior chemical and physical resilience (<a href="http://www.zeusinc.com/materials/peek/chemical-resistance-chart-peek" rel="nofollow">http://www.zeusinc.com/materials/peek/chemical-resistance-chart-peek</a>), has been successfully used for filament-based printing (<a href="https://3dprint.com/52713/indmatec-peek-fdm-printing-filament/" rel="nofollow">https://3dprint.com/52713/indmatec-peek-fdm-printing-filament/</a>). However, it is unlikely to be an option on most existing printers given its high melting temperature (around 343 degrees Celsius, <a href="https://en.wikipedia.org/wiki/PEEK" rel="nofollow">https://en.wikipedia.org/wiki/PEEK</a>). Though it does not meet all the criteria proposed (for instance, its glass transition temperature is around 143 degrees Celsius), overall it is a fairly good choice.</p>
<p>Teflon, an obvious choice, unfortunately has a decomposition temperature very close to its melting temperature, and appears to be unsuitable for extrusion.</p>
| 398
|
<p>I am aware of several "clear" filaments for a ABS or PLA printer. They, however, have a cloudy or frosted glass appearance. I do not believe this is possible to eliminate but I believe it can be reduced.</p>
<p>Are there effective ways to make a print have a more transparent appearance?</p>
|
<p>It depends on a lot of factors, type of plastic, whether the parts need to be strong, can you use a vase print, etc. Here's a few thoughts.</p>
<p>PLA - The brand of PLA makes a big difference, some can be printed very clear, some can't. Most of the transparent PLAs I've used print much more clear at around 240°C.</p>
<p>ABS - I've seen some pretty impressive clear parts printed as a single layer shell in ABS and then vapor smoothed. I tend to find ABS more translucent and less transparent though.</p>
<p>PETG - Again the specific PETG you use matters, but I haven't seen nearly as much variation as with PLA. I'm not sure how much temperature matters, but if it's too hot you get bubbles which will decrease clarity.</p>
<p>Thin Wall Prints - I don't have much experience here, but the Smooth On XTC-3D or vapor smoothing seem to be effective.</p>
<p>Solid Prints
If I want transparency, I usually print it at 100% infill (should be a real 100%, too much overextrusion or underextrusion will decrease transparency). Printing slower and with less cooling sometimes helps. It's easier to get the infill solid with a direct drive extruder, I couldn't get decent results with a long bowden tube (a short bowden tube works fine).</p>
<p>Here's a page where I tested 10 transparent filaments, the printed samples are 2mm thick, 100% infill - <a href="http://thrinter.com/10-transparent-filaments">http://thrinter.com/10-transparent-filaments</a>. Those samples are all overextruded a bit, you can get better results if you dial in the extrusion precisely, but that's hard to get right, and the optimal settings may change slightly depending on the part geometry. Larger nozzles and thicker layers may help to, but I haven't experimented much with that as there are significant downsides to that approach.</p>
|
<p>Use Taulman t-glase and after a light sanding with really fine paper (optional really, but go for it if you can), spray it with polyurethane varnish or something similar. Check out the article <a href="http://3dprint.com/29292/taulman-hacks-clear-t-glase-3d-printing-material/">here</a>.</p>
| 92
|
<p>As part of our product release we ship Apache HTTP Server binaries that we have compiled on our (UNIX) development machine.</p>
<p>We tell our clients to install the binaries (on their UNIX servers) under the same directory structure that we compiled it under. For some clients this is not appropriate, e.g. where there are restrictions on where they can install software on their servers and they don't want to compile Apache themselves.</p>
<p>Is there a way of compiling Apache HTTP Server so its installation location(s) can be specified dynamically using environment variables ?</p>
<p>I spent a few days trying to sort this out and couldn't find a way to do it. It led me to believe that the Apache binaries were hard coding some directory paths at compilation preventing the portability we require.</p>
<p>Has anyone managed to do this ?</p>
|
<p>I think the way to do(get around) this problem is to develop a "./configure && make" script that your client uses to install, specify and compile the binaries. That would offcourse require that the client has all the source-code installed on his server or you can make it available on an NFS share.</p>
|
<blockquote>
<p>I think the way to do(get around) this problem is to develop a "./configure && make" script that your client uses to install, specify and compile the binaries. That would offcourse require that the client has all the source-code installed on his server or you can make it available on an NFS share.</p>
</blockquote>
<p>Not to mention a complete build toolchain. These days, GCC doesn't come default with most major distributions. Wouldn't it be sane to force the client to install it to <code>/opt/my_apache2/</code> or something like that?</p>
| 4,213
|
<p>For those of us that like to use the graphical version of Vim or Emacs, instead of the console version, which version do you recommend?</p>
<p>For Vim, there's <a href="http://sourceforge.net/projects/macosxvim/" rel="nofollow noreferrer">Mac OS X Vim</a>, <a href="http://code.google.com/p/macvim/" rel="nofollow noreferrer">MacVim</a>, <a href="http://code.google.com/p/vim-cocoa/" rel="nofollow noreferrer">Vim-Cocoa</a>.</p>
<p>For Emacs, <a href="http://www.apple.com/downloads/macosx/unix_open_source/carbonemacspackage.html" rel="nofollow noreferrer">CarbonEmacs</a>, <a href="http://www.xemacs.org/" rel="nofollow noreferrer">XEmacs</a>, and <a href="http://aquamacs.org/" rel="nofollow noreferrer">Aquamacs</a>.</p>
<p>Are there more? Which of these are ready for prime-time? If it's a tough call, what are the trade-offs? Are all of these still being maintained?</p>
<p>No discussion of Vim versus Emacs, if you don't mind, or comparisons with other editors.</p>
|
<p><strong>MacVim</strong> works well and certainly looks more mature than Vim-Cocoa, moreover there is a Cocoa plugin architecture in the pipeline for MacVim (and someone is already working on a TextMate style file browser tray plugin which is a huge ++ IMHO).</p>
<p>There was also a Carbon version of Vim, but this didn't offer a great deal over the Terminal version. i.e. only allowed one window open, not very OSX in appearance...</p>
<p><strong>Aquamacs</strong> is very usable and looks pretty good. Supports both traditional Mac OS style keyboard shortcuts (command-O, command-S) and the Control/Meta shortcuts for those raised on traditional Emacs. It is definitely more Mac-like than Carbon Emacs. It seems stable and fast, but I am not an Emacs guru so I don't stress it all that much when I use it. I can't speak to the extensiveness of the included elisp packages, either.</p>
<p>Someone syncs Carbon Emacs with the upstream tree quarterly I think. Aquamacs has a more irregular schedule, but it's seen some pretty major updates over the last year.</p>
<p><strong>GNU Emacs</strong> for OSX can be found at <a href="http://emacsformacosx.com" rel="nofollow noreferrer">emacsformacosx.com</a>. In addition to the latest stable release, there are also pre-release test builds and nightly builds, and Atom feeds are provided for tracking all three release types.</p>
|
<p>I love CarbonEmacs because it sticks very close to the standard GNU Emacs distribution, while still fitting in nicely with the Mac desktop. To me, it "felt" like Emacs on my Ubuntu desktop even if it looked like a Mac application.</p>
| 2,386
|
<p>Java has a convenient split method:</p>
<pre><code>String str = "The quick brown fox";
String[] results = str.split(" ");
</code></pre>
<p>Is there an easy way to do this in C++?</p>
|
<p>C++ standard library algorithms are pretty universally based around iterators rather than concrete containers. Unfortunately this makes it hard to provide a Java-like <code>split</code> function in the C++ standard library, even though nobody argues that this would be convenient. But what would its return type be? <code>std::vector<std::basic_string<…>></code>? Maybe, but then we’re forced to perform (potentially redundant and costly) allocations.</p>
<p>Instead, C++ offers a plethora of ways to split strings based on arbitrarily complex delimiters, but none of them is encapsulated as nicely as in other languages. The numerous ways <a href="https://www.fluentcpp.com/2017/04/21/how-to-split-a-string-in-c/" rel="noreferrer">fill whole blog posts</a>.</p>
<p>At its simplest, you could iterate using <a href="http://en.cppreference.com/w/cpp/string/basic_string/find" rel="noreferrer"><code>std::string::find</code></a> until you hit <code>std::string::npos</code>, and extract the contents using <a href="https://en.cppreference.com/w/cpp/string/basic_string/substr" rel="noreferrer"><code>std::string::substr</code></a>.</p>
<p>A more fluid (and idiomatic, but basic) version for splitting on whitespace would use a <a href="https://en.cppreference.com/w/cpp/io/basic_istringstream" rel="noreferrer"><code>std::istringstream</code></a>:</p>
<pre><code>auto iss = std::istringstream{"The quick brown fox"};
auto str = std::string{};
while (iss >> str) {
process(str);
}
</code></pre>
<p>Using <a href="https://en.cppreference.com/w/cpp/iterator/istream_iterator" rel="noreferrer"><code>std::istream_iterator</code>s</a>, the contents of the string stream could also be copied into a vector using its iterator range constructor.</p>
<p>Multiple libraries (such as <a href="https://www.boost.org/doc/libs/1_70_0/libs/tokenizer/doc/tokenizer.htm" rel="noreferrer">Boost.Tokenizer</a>) offer specific tokenisers.</p>
<p>More advanced splitting require regular expressions. C++ provides the <a href="https://en.cppreference.com/w/cpp/regex/regex_token_iterator" rel="noreferrer"><code>std::regex_token_iterator</code></a> for this purpose in particular:</p>
<pre><code>auto const str = "The quick brown fox"s;
auto const re = std::regex{R"(\s+)"};
auto const vec = std::vector<std::string>(
std::sregex_token_iterator{begin(str), end(str), re, -1},
std::sregex_token_iterator{}
);
</code></pre>
|
<p>This a simple loop to tokenise with only standard library files</p>
<pre><code>#include <iostream.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <conio.h>
class word
{
public:
char w[20];
word()
{
for(int j=0;j<=20;j++)
{w[j]='\0';
}
}
};
void main()
{
int i=1,n=0,j=0,k=0,m=1;
char input[100];
word ww[100];
gets(input);
n=strlen(input);
for(i=0;i<=m;i++)
{
if(context[i]!=' ')
{
ww[k].w[j]=context[i];
j++;
}
else
{
k++;
j=0;
m++;
}
}
}
</code></pre>
| 7,745
|
<p>I have a strange problem when I publish my website. I inherited this project and the problem started before I arrived so I don't know what conditions lead to the creation of the problem.</p>
<p>Basically, 3 folders below the website project fail to publish properly. When the PrecompiledWeb is transferred to the host these three folders have to be manually copied from the Visual Studio project (i.e. they are no longer the published versions) to the host for it to work.</p>
<p>If the results of the publish operation are left, any page in the folder results in the following error:</p>
<blockquote>
<p>Server Error in '/' Application.
Unable to cast object of type
'System.Web.Compilation.BuildResultNoCompilePage'
to type
'System.Web.Compilation.BuildResultCompiledType'.
Description: An unhandled exception
occurred during the execution of the
current web request. Please review the
stack trace for more information about
the error and where it originated in
the code.</p>
<p>Exception Details:
System.InvalidCastException: Unable to
cast object of type
'System.Web.Compilation.BuildResultNoCompilePage'
to type
'System.Web.Compilation.BuildResultCompiledType'.</p>
<p>Source Error:</p>
<p>An unhandled exception was generated
during the execution of the current
web request. Information regarding the
origin and location of the exception
can be identified using the exception
stack trace below.</p>
<p>Stack Trace:</p>
<p>[InvalidCastException: Unable to cast
object of type
'System.Web.Compilation.BuildResultNoCompilePage'
to type
'System.Web.Compilation.BuildResultCompiledType'.]
System.Web.UI.PageParser.GetCompiledPageInstance(VirtualPath
virtualPath, String inputFile,
HttpContext context) +254<br>
System.Web.UI.PageParser.GetCompiledPageInstance(String
virtualPath, String inputFile,
HttpContext context) +171<br>
URLRewrite.URLRewriter.ProcessRequest(HttpContext
context) +2183<br>
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+405 System.Web.HttpApplication.ExecuteStep(IExecutionStep
step, Boolean& completedSynchronously)
+65</p>
<p>Version Information: Microsoft .NET
Framework Version:2.0.50727.832;
ASP.NET Version:2.0.50727.832</p>
</blockquote>
<p>Does anyone have any idea what the possible causes of these pages not publishing correctly could be? Anything I can look at that may indicate the root of the problem?</p>
<p><strong>Addition:</strong>
It is a completely clean build each time, so there shouldn't be a problem with old bin files lying around. I've also checked the datestamp on the items in the bin folder and they are up-to-date.</p>
<p><strong>Second Addition:</strong>
The project was originally created as a <em>Web Site</em>, not a Web Application. Sorry for the ambiguity.</p>
|
<p>I would try cleaning the bin\ folder.
In any case our shop completely dropped websites in favour of web form applications, which are arguably far better.</p>
<p>EDIT: <a href="http://webproject.scottgu.com/CSharp/Migration2/Migration2.aspx" rel="nofollow noreferrer">Migration HOW TO here</a></p>
|
<p>I had a similar problem a while back, where the publish would say it was successful, but the publish folder remained empty.</p>
<p>Besides looking at the <a href="http://msdn.microsoft.com/en-us/asp.net/aa336619.aspx" rel="nofollow noreferrer">Web Deployment Projects</a> you should also set the verbosity to Diagnostic (Tools=> Options=>Project and Solutions =>Build and Run=> Msbuild project build output verbosity)</p>
<p>This, in my case had the effect of displaying meaningful compiler errors that helped me resolve the issue. </p>
<p>You could then also run the <code>aspnet_compiler</code> with the <code>-errorstack</code> directive in the shell prompt to display additional errors.</p>
| 8,955
|
<p>Visual Basic code does not render correctly with <a href="https://code.google.com/archive/p/google-code-prettify" rel="nofollow noreferrer">prettify.js</a> from Google.</p>
<p>on Stack Overflow:</p>
<pre><code>Partial Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'set page title
Page.Title = "Something"
End Sub
End Class
</code></pre>
<p>in Visual Studio...</p>
<p><img src="https://i.stack.imgur.com/Fl1CM.jpg" alt="Visual Basic in Visual Studio" /></p>
<p>I found this in the <a href="https://web.archive.org/web/20160428230325/http://google-code-prettify.googlecode.com:80/svn/trunk/README.html" rel="nofollow noreferrer">README</a> document:</p>
<blockquote>
<p>How do I specify which language my
code is in?</p>
<p>You don't need to specify the language
since prettyprint() will guess. You
can specify a language by specifying
the language extension along with the
prettyprint class like so:</p>
<pre><code><pre class="prettyprint lang-html">
The lang-* class specifies the language file extensions.
Supported file extensions include
"c", "cc", "cpp", "cs", "cyc", "java", "bsh", "csh", "sh",
"cv", "py", "perl", "pl", "pm", "rb", "js",
"html", "html", "xhtml", "xml", "xsl".
</pre>
</code></pre>
</blockquote>
<p>I see no <em>lang-vb</em> or <em>lang-basic</em> option. Does anyone know if one exists as an add-in?</p>
<hr />
<p>Note: This is related to the <a href="https://web.archive.org/web/20080914043525/http://stackoverflow.uservoice.com:80/pages/general/suggestions/18775" rel="nofollow noreferrer">VB.NET code blocks</a> suggestion for Stack Overflow.</p>
|
<p>/EDIT: I've rewritten the whole posting.</p>
<p>Below is a pretty complete solution to the VB highlighting problem. If SO has got nothing better, <em>please</em> use it. VB syntax highlighting is definitely wanted.</p>
<p>I've also added a code example with some complex code literals that gets highlighted correctly. However, I haven't even tried to get XLinq right. Might still work, though. The <a href="http://msdn.microsoft.com/en-us/library/ksh7h19t.aspx" rel="nofollow noreferrer">keywords list</a> is taken from the MSDN. Contextual keywords are not included. Did you know the <code>GetXmlNamespace</code> operator?</p>
<p>The algorithm knows literal type characters. It should also be able to handle identifier type characters but I haven't tested these. Note that the code works on <strong>HTML</strong>. As a consequence, &, < and > are required to be read as named (!) entities, not single characters.</p>
<p>Sorry for the long regex.</p>
<pre><code>var highlightVB = function(code) {
var regex = /("(?:""|[^"])+"c?)|('.*$)|#.+?#|(&amp;[HO])?\d+(\.\d*)?(e[+-]?\d+)?U?([SILDFR%@!#]|&amp;)?|\.\d+[FR!#]?|\s+|\w+|&amp;|&lt;|&gt;|([-+*/\\^$@!#%&<>()\[\]{}.,:=]+)/gi;
var lines = code.split("\n");
for (var i = 0; i < lines.length; i++) {
var line = lines[i];
var tokens;
var result = "";
while (tokens = regex.exec(line)) {
var tok = getToken(tokens);
switch (tok.charAt(0)) {
case '"':
if (tok.charAt(tok.length - 1) == "c")
result += span("char", tok);
else
result += span("string", tok);
break;
case "'":
result += span("comment", tok);
break;
case '#':
result += span("date", tok);
break;
default:
var c1 = tok.charAt(0);
if (isDigit(c1) ||
tok.length > 1 && c1 == '.' && isDigit(tok.charAt(1)) ||
tok.length > 5 && (tok.indexOf("&amp;") == 0 &&
tok.charAt(5) == 'H' || tok.charAt(5) == 'O')
)
result += span("number", tok);
else if (isKeyword(tok))
result += span("keyword", tok);
else
result += tok;
break;
}
}
lines[i] = result;
}
return lines.join("\n");
}
var keywords = [
"addhandler", "addressof", "alias", "and", "andalso", "as", "boolean", "byref",
"byte", "byval", "call", "case", "catch", "cbool", "cbyte", "cchar", "cdate",
"cdec", "cdbl", "char", "cint", "class", "clng", "cobj", "const", "continue",
"csbyte", "cshort", "csng", "cstr", "ctype", "cuint", "culng", "cushort", "date",
"decimal", "declare", "default", "delegate", "dim", "directcast", "do", "double",
"each", "else", "elseif", "end", "endif", "enum", "erase", "error", "event",
"exit", "false", "finally", "for", "friend", "function", "get", "gettype",
"getxmlnamespace", "global", "gosub", "goto", "handles", "if", "if",
"implements", "imports", "in", "inherits", "integer", "interface", "is", "isnot",
"let", "lib", "like", "long", "loop", "me", "mod", "module", "mustinherit",
"mustoverride", "mybase", "myclass", "namespace", "narrowing", "new", "next",
"not", "nothing", "notinheritable", "notoverridable", "object", "of", "on",
"operator", "option", "optional", "or", "orelse", "overloads", "overridable",
"overrides", "paramarray", "partial", "private", "property", "protected",
"public", "raiseevent", "readonly", "redim", "rem", "removehandler", "resume",
"return", "sbyte", "select", "set", "shadows", "shared", "short", "single",
"static", "step", "stop", "string", "structure", "sub", "synclock", "then",
"throw", "to", "true", "try", "trycast", "typeof", "variant", "wend", "uinteger",
"ulong", "ushort", "using", "when", "while", "widening", "with", "withevents",
"writeonly", "xor", "#const", "#else", "#elseif", "#end", "#if"
]
var isKeyword = function(token) {
return keywords.indexOf(token.toLowerCase()) != -1;
}
var isDigit = function(c) {
return c >= '0' && c <= '9';
}
var getToken = function(tokens) {
for (var i = 0; i < tokens.length; i++)
if (tokens[i] != undefined)
return tokens[i];
return null;
}
var span = function(class, text) {
return "<span class=\"" + class + "\">" + text + "</span>";
}
</code></pre>
<p>Code for testing:</p>
<pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
'set page title
Page.Title = "Something"
Dim r As String = "Say ""Hello"""
Dim i As Integer = 1234
Dim d As Double = 1.23
Dim s As Single = .123F
Dim l As Long = 123L
Dim ul As ULong = 123UL
Dim c As Char = "x"c
Dim h As Integer = &amp;H0
Dim t As Date = #5/31/1993 1:15:30 PM#
Dim f As Single = 1.32e-5F
End Sub
</code></pre>
|
<p>In the meantime, you can put an extra comment character at the end of your comments to get it to look okay. For example:</p>
<pre><code>Sub TestMethod()
'Method body goes here'
End Sub
</code></pre>
<p>You also need to escape internal comment characters in the normal vb-fashion:</p>
<pre><code>Sub TestMethod2()
'Here''s another comment'
End Sub
</code></pre>
<p>Prettify still treats it as a string literal rather than a comment, but at least it looks okay.</p>
<p>Another method I've seen is to start comments with an extra <code>'//</code>, like this:</p>
<pre><code>Sub TestMethod3()
''// one final comment
End Sub
</code></pre>
<p>Then it's handled like a comment, but you have to deal with C-style comment markers</p>
| 5,100
|
<p>We are planning to use the jQuery library to augment our client side JavaScript needs. </p>
<p>Are there any major issues in trying to use both ASP.Net AJAX and jQuery? Both libraries seem to use $ for special purposes. Are there any conflicts that we need to be aware of? </p>
<p>We also use Telerik controls that use ASP.Net AJAX.</p>
<p>TIA</p>
|
<p>We have used ASP.NET Ajax, jQuery and Telerik components on a large project for quite a while and haven't had any issues</p>
<p>I would definitely recommend using jQuery</p>
|
<p>I have been using ext which is another javascript framework with .net. It is far easier to use than old fashioned HTML form controls</p>
<pre><code><input type="text" id="whatever" />
</code></pre>
<p>Than using ASP.net form controls. You probably want to use the cool javascript framework form validation as opposed to the not so great built in .net validators too, but I guess that's down to your preference</p>
<p>If you do want to carry on using .net controls, remember that the ID generated in markup is different to what you define, so if you want to reference a control by id in JS use:</p>
<pre><code><%=MyControlId.ClientID%>
</code></pre>
| 9,089
|
<p>We are working on designing an application that is typically OLTP (think: purchasing system). However, this one in particular has the need that some users will be offline, so they need to be able to download the DB to their machine, work on it, and then sync back once they're on the LAN.</p>
<p>I would like to note that I know this has been done before, I just don't have experience with this particular model.</p>
<p>One idea I thought about was using GUIDs as table keys. So for example, a Purchase Order would not have a number (auto-numeric) but a GUID instead, so that every offline client can generate those, and I don't have clashes when I connect back to the DB.</p>
<p>Is this a bad idea for some reason?
Will access to these tables through the GUID key be slow?</p>
<p>Have you had experience with these type of systems? How have you solved this problem?</p>
<p>Thanks!<br>
Daniel</p>
|
<p>Using Guids as primary keys is acceptable and is considered a fairly standard practice for the same reasons that you are considering them. They can be overused which can make things a bit tedious to debug and manage, so try to keep them out of code tables and other reference data if at all possible.</p>
<p>The thing that you have to concern yourself with is the human readable identifier. Guids cannot be exchanged by people - can you imagine trying to confirm your order number over the phone if it is a guid? So in an offline scenario you may still have to generate <strong>something</strong> - like a publisher (workstation/user) id and some sequence number, so the order number may be 123-5678 -. </p>
<p>However this may not satisfy business requirements of having a sequential number. In fact regulatory requirements can be and influence - some regulations (SOX maybe) require that invoice numbers are sequential. In such cases it may be neccessary to generate a sort of proforma number which is fixed up later when the systems synchronise. You may land up with tables having OrderId (Guid), OrderNo (int), ProformaOrderNo (varchar) - some complexity may creep in.</p>
<p>At least having guids as primary keys means that you don't have to do a whole lot of cascading updates when the sync does eventually happen - you simply update the human readable number.</p>
|
<p>Guids will certainly be slower (and use more memory) than standard integer keys, but whether or not that is an issue will depend on the type of load your system will see. Depending on your backend DB there may be issues with indexing guid fields.</p>
<p>Using guids simplifies a whole class of problems, but you pay for it part will performance and also debuggability - typing guids into those test queries will get old real fast!</p>
| 6,144
|
<p>I've been thinking about the number of projects we have in-house that are still being developed using visual studio 6 and how best to migrate them forward onto visual studio 2008. The projects range in flavours of C/C++ and VB.</p>
<p>Is it better to let VS2008 convert the work-spaces into solutions, fix any compile errors and be on your merry way? Or, is it better to start with a clean solution and migrate code across project by project discarding dead code along the way?</p>
|
<p>The Microsoft p&p team has recommended some <a href="http://msdn.microsoft.com/en-us/library/ms978506.aspx" rel="nofollow noreferrer">strategies</a> that answers this. Basically they recommend something like the project by project approach you mention. Of course, they're assuming a neatly architected application that has no nasty, dark corners from which late nights of coding and copious amounts of coffee spring from.</p>
<p>It doesn't hurt to let VS2008 convert the project for you and see how much effort is required to fix the errors.</p>
|
<p>When I had to convert a VB6 app to VS2003 several years ago, I ran the converter and it produced something that basically compiled, but wasn't very good at all. I ended up having to modify a big chunk of the code it generated.</p>
<p>I would start with a clean solution, then run the converter on a project and copy over only the code you need. One of the big differences I noticed between a VB6 project and the converted VB.NET project (WinForm) was with the built-in controls. The converter would try to preserve the type of controls you were using, even if they were old and outdated. So you might be better served by creating new forms with modern controls (text boxes, tab controls, etc), then copy in the code that you need.</p>
| 7,922
|
<p>I recently upgraded to <a href="https://www.creality3donline.com/creality-polypropylene-build-plate-for-ender-3-ender-5-cr20_p0124.html" rel="nofollow noreferrer">a Polypropylene</a> print bed, but I haven't actually been able to complete a print. </p>
<p>Adhesion seems incredibly inconsistent, even on the same spot. Sometimes it goes down great, and sometimes it just curls up and clumps on the nozzle. I even cranked the temp up to 220 °C for the PLA and 70 °C for the bed in an effort to get it to stick for an initial layer, and it still isn't sticking. </p>
<p>Any tips? I've been cleaning with rubbing alcohol, but I don't know if there's any trick. Clean when hot? Cold? Let sit after cleaning before using? Is it just a matter of incredibly precise bed leveling?</p>
|
<p>When you updated the print bed, you may have affected either the manual or auto calibration of the bed height and bed leveling.</p>
<p>First layer adhesion is depends critically on an accurate first layer thickness, which depends on the bed height calibration. Adding or, perhaps more critically, removing any bed surface thickness could cause a problem.</p>
<p>With many forms of auto bed calibration, a sensor detects a steel or metallic reference under the surface. The thickness from that reference to the surface of the bed is not automatically detected or compensated. Changing the bed surface, even renewing the surface with another sheet of the same material, may alter the bed thickness enough to affect the adhesion fo the first layer.</p>
<p>If the bed is properly adjusted, the problem may be the surface of the polypropylene. I see that some instructions for cleaning polypropylene build surfaces suggest isopropyl alcohol and/or a mild soap solution. I find that with a PEI build plate, it is sometimes necessary to clean the surface with acetone.</p>
<p>Acetone is superior at removing oils and films from the surface and will do better than multiple isopropanol cleanings. I checked a table of chemical compatibility, and polypropylene is highly compatible with acetone, so a thorough cleaning will not degrade it.</p>
|
<p>If you are using PLA, 200 for the extruder sticks the best for me. The other issue with adhesion is the greater the difference between the extruder temperature and the bed the poorer adhesion. There are other things can help with this. Using a higher bed temperature for the first layer can help. A slower extrusion speed allows the extrusion to cool more before getting as long of a length to for the contraction force; thus improving adhesion. </p>
| 1,285
|
<p>In Windows, in any windows form or web browser, you can use the tab button to switch focus through all of the form fields. </p>
<p>It will stop on textboxes, radiobuttons, checkboxes, dropdown menus, etc. </p>
<p>However, in Mac OSX, tab skips dropdown menus. Is there anyway to change this behavior, or access the above items mentioned, without using a mouse?</p>
|
<p>Go to System Preferences > Keyboard and Mouse, then choose Keyboard Shortcuts. At the bottom, ensure Full Keyboard Access is set to "All controls". It's a long time since I turned it on but I think that's all you need to do</p>
|
<p>It's in the System Preferences - <a href="http://www.howtogeek.com/howto/apple/why-doesnt-tab-work-for-drop-down-controls-in-firefox-on-os-x/" rel="nofollow noreferrer">this blog post</a> shows where the setting is.</p>
| 2,451
|
<p>I am using the function below to match URLs inside a given text and replace them for HTML links. The regular expression is working great, but currently I am only replacing the first match.</p>
<p>How I can replace all the URL? I guess I should be using the <em>exec</em> command, but I did not really figure how to do it.</p>
<pre><code>function replaceURLWithHTMLLinks(text) {
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/i;
return text.replace(exp,"<a href='$1'>$1</a>");
}
</code></pre>
|
<p>First off, rolling your own regexp to parse URLs is a <em>terrible idea</em>. You must imagine this is a common enough problem that someone has written, debugged and <a href="http://benalman.com/code/test/js-linkify/" rel="noreferrer">tested</a> a library for it, according to <a href="https://metacpan.org/pod/Regexp::Common::URI#REFERENCES" rel="noreferrer">the RFCs</a>. <strong>URIs are complex</strong> - check out the <a href="https://github.com/joyent/node/blob/master/lib/url.js" rel="noreferrer">code for URL parsing in Node.js</a> and the Wikipedia page on <a href="http://en.wikipedia.org/wiki/URI_scheme" rel="noreferrer">URI schemes</a>.</p>
<p>There are a ton of edge cases when it comes to parsing URLs: <a href="http://en.wikipedia.org/wiki/Top-level_domain#IDN_test_domains" rel="noreferrer">international domain names</a>, actual (<code>.museum</code>) vs. nonexistent (<code>.etc</code>) TLDs, weird punctuation including <a href="http://www.codinghorror.com/blog/2008/10/the-problem-with-urls.html" rel="noreferrer">parentheses</a>, punctuation at the end of the URL, IPV6 hostnames etc.</p>
<p>I've looked at <a href="https://github.com/search?l=JavaScript&q=linkify&ref=cmdform&search_target=global&type=Repositories" rel="noreferrer">a ton</a> of <a href="https://github.com/search?l=JavaScript&q=autolink&ref=cmdform&search_target=global&type=Repositories" rel="noreferrer">libraries</a>, and there are a few worth using despite some downsides:</p>
<ul>
<li>Soapbox's <a href="http://soapbox.github.io/jQuery-linkify/" rel="noreferrer">linkify</a> has seen some serious effort put into it, and <a href="https://github.com/SoapBox/jQuery-linkify/pull/51" rel="noreferrer">a major refactor in June 2015</a> <a href="https://github.com/SoapBox/jQuery-linkify/issues/56" rel="noreferrer">removed the jQuery dependency</a>. It still has <a href="https://github.com/SoapBox/linkifyjs/issues/92" rel="noreferrer">issues with IDNs</a>.</li>
<li><a href="http://alexcorvi.github.io/anchorme.js/" rel="noreferrer">AnchorMe</a> is a newcomer that <a href="https://github.com/ali-saleem/anchorme.js/issues/2" rel="noreferrer">claims to be faster</a> and leaner. Some <a href="https://github.com/ali-saleem/anchorme.js/issues/1" rel="noreferrer">IDN issues</a> as well.</li>
<li><a href="https://github.com/gregjacobs/Autolinker.js" rel="noreferrer">Autolinker.js</a> lists features very specifically (e.g. <em>"Will properly handle HTML input. The utility will not change the <code>href</code> attribute inside anchor () tags"</em>). I'll thrown some tests at it when a <a href="https://github.com/gregjacobs/Autolinker.js/issues/138" rel="noreferrer">demo becomes available</a>.</li>
</ul>
<p>Libraries that I've disqualified quickly for this task:</p>
<ul>
<li>Django's urlize <a href="https://github.com/ljosa/urlize.js/pull/18" rel="noreferrer">didn't handle certain TLDs properly</a> (here is the official <a href="http://data.iana.org/TLD/tlds-alpha-by-domain.txt" rel="noreferrer">list of valid TLDs</a>. <a href="https://github.com/ljosa/urlize.js/issues/21" rel="noreferrer">No demo</a>.</li>
<li><a href="https://github.com/bryanwoods/autolink-js/issues/12" rel="noreferrer">autolink-js</a> wouldn't detect "www.google.com" without http://, so it's not quite suitable for autolinking "casual URLs" (without a scheme/protocol) found in plain text.</li>
<li><a href="https://github.com/cowboy/javascript-linkify" rel="noreferrer">Ben Alman's linkify</a> hasn't been maintained since 2009.</li>
</ul>
<p>If you insist on a regular expression, the most comprehensive is the <a href="https://github.com/component/regexps/blob/master/index.js#L3" rel="noreferrer">URL regexp from Component</a>, though it will falsely detect some non-existent two-letter TLDs by looking at it.</p>
|
<p>Replace URLs in text with HTML links, ignore the URLs within a href/pre tag.
<a href="https://github.com/JimLiu/auto-link" rel="nofollow">https://github.com/JimLiu/auto-link</a></p>
| 5,848
|
<p>What's the best way to make a linked list in Java?</p>
|
<p>The obvious solution to developers familiar to Java is to use the <strong>LinkedList</strong> class already provided in <strong>java.util</strong>. Say, however, you wanted to make your own implementation for some reason. Here is a quick example of a linked list that inserts a new link at the beginning of the list, deletes from the beginning of the list and loops through the list to print the links contained in it. <strong>Enhancements</strong> to this implementation include making it a <strong>double-linked list</strong>, adding methods to <strong>insert</strong> and <strong>delete</strong> from the middle or end, and by adding <strong>get</strong> and <strong>sort</strong> methods as well. </p>
<p><strong>Note</strong>: In the example, the Link object doesn't actually contain another Link object - <em>nextLink</em> is actually only a reference to another link. </p>
<pre><code>class Link {
public int data1;
public double data2;
public Link nextLink;
//Link constructor
public Link(int d1, double d2) {
data1 = d1;
data2 = d2;
}
//Print Link data
public void printLink() {
System.out.print("{" + data1 + ", " + data2 + "} ");
}
}
class LinkList {
private Link first;
//LinkList constructor
public LinkList() {
first = null;
}
//Returns true if list is empty
public boolean isEmpty() {
return first == null;
}
//Inserts a new Link at the first of the list
public void insert(int d1, double d2) {
Link link = new Link(d1, d2);
link.nextLink = first;
first = link;
}
//Deletes the link at the first of the list
public Link delete() {
Link temp = first;
if(first == null){
return null;
//throw new NoSuchElementException(); // this is the better way.
}
first = first.nextLink;
return temp;
}
//Prints list data
public void printList() {
Link currentLink = first;
System.out.print("List: ");
while(currentLink != null) {
currentLink.printLink();
currentLink = currentLink.nextLink;
}
System.out.println("");
}
}
class LinkListTest {
public static void main(String[] args) {
LinkList list = new LinkList();
list.insert(1, 1.01);
list.insert(2, 2.02);
list.insert(3, 3.03);
list.insert(4, 4.04);
list.insert(5, 5.05);
list.printList();
while(!list.isEmpty()) {
Link deletedLink = list.delete();
System.out.print("deleted: ");
deletedLink.printLink();
System.out.println("");
}
list.printList();
}
}
</code></pre>
|
<p>Its much better to use java.util.LinkedList, because it's probably much more optimized, than the one that you will write.</p>
| 3,131
|
<p>I'm creating an ASP.NET web site where all pages hang off a database-driven tree-hierarchy. Pages typically present HTML content. But, some will execute programming.</p>
<p><em>Examples:</em> <br></p>
<ol>
<li>a "contact us" form </li>
<li>a report generator</li>
</ol>
<p>How should I represent/reference the programming within the database? Should I have a varchar value of a Web User Control (.ascx) name? Or a Web Form (.aspx) name? Something else? Or should it just be an integer or other such ID in a dictionary within my application?</p>
<p>Can I make an ASP.NET Site Map Provider with this structure?</p>
<p>See more information here: <a href="https://stackoverflow.com/questions/56981/which-is-the-best-database-schema-for-my-navigation">Which is the best database schema for my navigation?</a></p>
|
<p>You might consider inserting placeholders like <code><my:contact-us-form/></code> in the database on specific pages; that way the database can describe all the static text content instead of completely replacing that database-driven content with an <code>.ascx</code> control.</p>
|
<p>Our development team has had success with defining the name of a Web User Control in the database. Upon page load it checks too see what controls to dynamically load from the database. </p>
<p>We use Web User Controls instead of Web Forms in order to ensure we can use the control on any page.</p>
<p>You can also dynamically build a site map using ASP.Net's provider. <a href="http://www.codeproject.com/KB/aspnet/dynamicsitemap.aspx" rel="nofollow noreferrer">CodeProject</a> has a good example.</p>
| 8,087
|
<p>I have an iframe. The content is wider than the width I am setting so the iframe gets a horizontal scroll bar. I can't increase the width of the iframe so I want to just remove the scroll bar. I tried setting the scroll property to "no" but that kills both scroll bars and I want the vertical one. I tried setting overflow-x to "hidden" and that killed the horizontal scroll bar in ff but not in IE. sad for me.</p>
|
<pre><code>scrolling="yes" horizontalscrolling="no" verticalscrolling="yes"
</code></pre>
<p>Put that in your iFrame tag.</p>
<p>You don't need to mess around with trying to format this in CSS.</p>
|
<pre><code><iframe style="overflow:hidden;" src="about:blank"/>
</code></pre>
<p>should work in IE. IE6 had issues supporting overflow-x and overflow-y.</p>
<p>One other thing to note is that IE's border on the iframe can only be removed if you set the "frameborder" attribute in camelCase.</p>
<pre><code><iframe frameBorder="0" style="overflow:hidden;" src="about:blank"/>
</code></pre>
<p>it would be nice if you could style it properly with CSS but it doesn't work in IE.</p>
| 9,290
|
<p>If a customer sends me a non-commercial 3D model to print, am I allowed to charge money for the 3D printing process? I understand I cannot charge anything for the model nor offer it as a part of my business.</p>
<p>I cannot download the model myself, print and sell it, but if the customer downloads it and sends it to me for me to print it, is it a violation of the license or not?</p>
|
<p><em>I would have liked to answer linking to credible official sources, but I cannot add references either on direct B-spline printing. So I'm writing down my thoughts. I've familiarized myself in B-splines to understand what they are and read into the 2 references given by the OP.</em></p>
<hr />
<p>Basically, the printer software only allows printing of straight lines. Yes I know we can give orders to the printer to print a curve (using <code>G2</code> or <code>G3</code>), but these eventually will be converted to printing straight lines. There is no ready made printer firmware available to print cubic curves directly to my knowledge. If it would be possible, these curves should eventually be translated into smaller straight lines by the firmware of timed stepper rotational output. These extra calculations would demand a considerable effort of the printer board processor, most probably far more an 8-bit processor would be able to handle.</p>
<p>Comparing the <a href="https://m.box.com/shared_item/https%3A%2F%2Fumich.box.com%2Fs%2Fn9cvs27ckehdr64gzv5igtmboykymgk6" rel="nofollow noreferrer">paper released in 2017</a> to the <a href="https://hackaday.io/project/7045-splinetravel" rel="nofollow noreferrer">G-code pre-processing software</a> reveals that although both seem to refer to B-spline techniques, they are implemented differently. For example, the pre-processing software aims to reduce the linear travel moves by replacing these with B-spline curves (and not affect the actual print object), while the paper focuses on the optimization of the actual printing curves being optimized by B-spline curves (also using a pre-processor). Both eventually would need to create a multitude of small straight lines to have the printer be able to actually print the object as there is no 3D printing firmware solution to print curves. Do note that the method in the paper has been <a href="https://3dprint.com/195734/um-update-algorithm/" rel="nofollow noreferrer">questioned by the RepRap community</a>, which demonstrated that they could print the same object way faster than the B-spline optimized example. Furthermore, do note that the Marlin community is probably moving in that direction as can be seen from e.g. <a href="https://github.com/MarlinFirmware/Marlin/issues/8308" rel="nofollow noreferrer">this feature request</a> and <a href="http://marlinfw.org/meta/gcode/" rel="nofollow noreferrer">this G-code meta overview</a>; G-code instruction <code>G5</code>.</p>
<p>So, both methods rely on pre-processing G-codes by identification of sliced coordinate (print) moves, translation into Bézier/B-spline curves for (print) moves, which eventually are translated into normal <code>G0/G1</code> (print) moves. It does not appear that the Marlin community/developers are aiming to implement Bézier or B-spline curves soon. This implies that if you want to pursuit printing B-splines, you need to make your own pre-processor, or dive into Marlin C++ development; an 8-bit based printer board would not be sufficient indeed like the OP mentioned, up-scaling to 32-bit or interfacing with USB might be the only solution.</p>
|
<p>In more practical terms, you could design the part so that the corners are rounded (also known as fillets). This will help keep the print head moving and would prevent the sudden stop and start effect that causes "jerking". Further 8 bit controllers tend to get saturated when reading large amounts of g-code from the sd card or the serial port. Upgrading to a 32 bit controller will prevent that kind of jerking.</p>
<p>Both of these methods pale in comparison to just speeding up the print. Upgrading the hardware to be faster (various methods exist) would yield more of a reduced time than trying to optimize the g-code (in my humble opinion). Delta printers have the potential to be the fastest type of FDM printer, assuming that you could get the filament to melt fast enough.</p>
| 1,402
|
<p>I am a complete beginner so I apologise ahead for probably an obvious question. From what I understand up to now, slicer software basically takes a 3D model and turns it into instructions that say move your print head to this and this position and extrude up to this position and so forth. If that is correct then each slicing software can result in different "filament paths" in printing of the same model ultimately having the effect on the quality of print (unless the "Slicing algorithm" is some open industry accepted one and everyone uses that). But then, it would be advantageous to use other slicer software than the one supplied with the printer. On the other hand, if a slicer gives the instructions to the printer and assuming the G-code is a universal instruction kit (standard each printer understands), it needs to know, at the least, the parameters of the printer.</p>
<p>So the questions are:</p>
<ol>
<li>Can I use any slicing software with any 3D printer and are there any things that may cause a problem (e.g. "How do I set up the slicing software for a particular printer?")</li>
<li>If not, am I stuck with the software provided by the printer manufacturer and thus, before buying a printer, one should also analyse the slicing software provided or is there some compatibility chart?</li>
</ol>
<p>Regarding 2. I looked at both PrusaSlicer, Slic3r, Cura. None of them provide any information on the compatibility. I have access to Creality CR-10S printer but when I saw e.g. PrusaSlicer compared to the Creality, it has more options it seems. But during the installation of the Creality slicer, it forced me to choose the printer that I will be using which suggests that printers are locked to the manufacturer slicer.</p>
|
<p>Your printer will stop printing. So no.</p>
|
<p>Disconnecting the USB or connecting it triggers a reboot in the printer. As a result, you can not disconnect or turn off the print server running OctoPrint.</p>
| 1,817
|
<p>This question is overflow from the following question:</p>
<p><a href="https://stackoverflow.com/questions/70096/how-do-i-programmatically-convert-mp3-to-an-itunes-playable-aacm4a-file">How do I programmatically convert mp3 to an itunes-playable aac/m4a file?</a></p>
<p>Anyway, I learned how to create an aac file and then i found out that an aac is not just an m4a file with a different file extension. In fact, I need to somehow wrap the aac into an m4a container. Ideally I'd be able to simply make a call to the command line.</p>
|
<p><code>ffmpeg</code> is a general purpose (de)muxer/transcoder. <code>MP4Box</code> is a (de)muxer/transcoder from <a href="http://gpac.wp.institut-telecom.fr/mp4box/" rel="nofollow noreferrer">GPAC</a>, a package dedicated to MP4 related software tech. Right now it seems wiser to use MP4Box because it writes the moov atom at the beginning of the file, which is important for streaming and ipod playing.</p>
<p>Use ffmpeg like this:</p>
<pre><code>ffmpeg -i input.aac -codec: copy output.m4a
</code></pre>
<p>Use MP4Box like this:</p>
<pre><code>MP4Box -add input.aac#audio output.m4a
</code></pre>
|
<p>Just use any mp4-Muxer like Yamb to create an <code>mp4</code>-file with only the <code>aac</code> audio track in it, then change the file extension to <code>m4a</code>.</p>
| 9,591
|
<p>I'm writing a string containing some XML via System.Xml.XmlWriter. I'm stuck using WriteString(), and from the documentation:</p>
<blockquote>
<p>WriteString does the following:
The characters &, <, and > are replaced with &amp;, &lt;, and &gt;, respectively.</p>
</blockquote>
<p>I'd like this to stop, but I can't seem to find any XmlWriterSettings properties to control this behavior. What are some workarounds? Thanks!</p>
<p>David</p>
|
<p>Try wrapping your real content between the CDATA tags:</p>
<p><![CDATA[ <strong>it's my content</strong> ]]></p>
|
<blockquote>
<p>I'm stuck using WriteString(),</p>
</blockquote>
<p>I think that's the root of your problem. Can you explain more about your reason you're stuck using WriteString? My gut is you're using the wrong method for what you want to do</p>
| 9,199
|
<p>I have a file which is an XML representation of some data that is taken from a Web service and cached locally within a Web Application. The idea being is that this data is <em>very</em> static, but just <em>might</em> change. So I have set it up to cache to a file, and stuck a monitor against it to check if it has been deleted. Once deleted, the file will be refreshed from its source and rebuilt.</p>
<p>I am now running in to problems though, because obviously in a multi-threaded environment it falls over as it is trying to access the data when it is still reading/writing the file.</p>
<p>This is confusing me, because I added a object to lock against, and this is always locked during read/write. It was my understanding that attempted access from other threads would be told to "wait" until the lock was released?</p>
<p>Just to let you know, I am real new to multi-threaded development, so I am totally willing to accept this is a screw up on my part :)</p>
<ul>
<li><strong>Am I missing something?</strong></li>
<li><strong>What is the best file access strategy in a multi-threaded environment?</strong>
<hr></li>
</ul>
<h3>Edit</h3>
<p>Sorry - I should have said this is using <strong>ASP.NET 2.0</strong> :)</p>
|
<p>Here is the code that I use to make sure a file is not locked by another process. It's not 100% foolproof, but it gets the job done most of the time:</p>
<pre><code> /// <summary>
/// Blocks until the file is not locked any more.
/// </summary>
/// <param name="fullPath"></param>
bool WaitForFile(string fullPath)
{
int numTries = 0;
while (true)
{
++numTries;
try
{
// Attempt to open the file exclusively.
using (FileStream fs = new FileStream(fullPath,
FileMode.Open, FileAccess.ReadWrite,
FileShare.None, 100))
{
fs.ReadByte();
// If we got this far the file is ready
break;
}
}
catch (Exception ex)
{
Log.LogWarning(
"WaitForFile {0} failed to get an exclusive lock: {1}",
fullPath, ex.ToString());
if (numTries > 10)
{
Log.LogWarning(
"WaitForFile {0} giving up after 10 tries",
fullPath);
return false;
}
// Wait for the lock to be released
System.Threading.Thread.Sleep(500);
}
}
Log.LogTrace("WaitForFile {0} returning true after {1} tries",
fullPath, numTries);
return true;
}
</code></pre>
<p>Obviously you can tweak the timeouts and retries to suit your application. I use this to process huge FTP files that take a while to be written.</p>
|
<p>How about using <code>AutoResetEvent</code> to communicate between threads? I created a console app which creates roughly 8 GB file in <code>createfile</code> method and then copy that file in <code>main</code> method</p>
<pre><code> static AutoResetEvent waitHandle = new AutoResetEvent(false);
static string filePath=@"C:\Temp\test.txt";
static string fileCopyPath=@"C:\Temp\test-copy.txt";
static void Main(string[] args)
{
Console.WriteLine("in main method");
Console.WriteLine();
Thread thread = new Thread(createFile);
thread.Start();
Console.WriteLine("waiting for file to be processed ");
Console.WriteLine();
waitHandle.WaitOne();
Console.WriteLine();
File.Copy(filePath, fileCopyPath);
Console.WriteLine("file copied ");
}
static void createFile()
{
FileStream fs= File.Create(filePath);
Console.WriteLine("start processing a file "+DateTime.Now);
Console.WriteLine();
using (StreamWriter sw = new StreamWriter(fs))
{
for (long i = 0; i < 300000000; i++)
{
sw.WriteLine("The value of i is " + i);
}
}
Console.WriteLine("file processed " + DateTime.Now);
Console.WriteLine();
waitHandle.Set();
}
</code></pre>
| 6,258
|
<p>How do I save a jpg image to database and then load it in Delphi using FIBplus and TImage?</p>
|
<pre><code>var
S : TMemoryStream;
begin
S := TMemoryStream.Create;
try
TBlobField(AdoQuery1.FieldByName('ImageField')).SaveToStream(S);
S.Position := 0;
Image1.Picture.Graphic.LoadFromStream(S);
finally
S.Free;
end;
end;
</code></pre>
<p>if you are using JPEG images, add JPG unit to <strong>uses</strong> clause of your unit file.</p>
|
<p><a href="http://delphi.about.com/od/database/l/aa030601a.htm" rel="nofollow noreferrer">Take a look here.</a>
I think you have to convert it to a stream, store it and vice versa.</p>
| 8,759
|
<p>We used to use SourceSafe, and one thing I liked about it was that when you checked out a file, it automatically got you its latest version.</p>
<p>Now we work with Team System 2005, and it doesn't work that way - you have to "get latest version" before you start working on a file that you've checked out.</p>
<p>Is there a way to configure Team System (2005) to automatically get the latest version when checking out a file?</p>
|
<p>There's a Visual Studio Add-in for this that someone wrote: </p>
<p><a href="http://blogs.microsoft.co.il/blogs/srlteam/archive/2007/03/24/TFS-GetLatest-version-on-check_2D00_out-Add_2D00_In.aspx" rel="nofollow noreferrer">http://blogs.microsoft.co.il/blogs/srlteam/archive/2007/03/24/TFS-GetLatest-version-on-check_2D00_out-Add_2D00_In.aspx</a></p>
|
<p>Are you sure you want that?</p>
<p>It means that when you check out a file, it will be out of sync with the rest of your files. Your project may not build or function properly until you update all files.</p>
| 8,022
|
<p>I'm thinking about making a networked game. I'm a little new to this, and have already run into a lot of issues trying to put together a good plan for dead reckoning and network latency, so I'd love to see some good literature on the topic. I'll describe the methods I've considered.</p>
<p>Originally, I just sent the player's input to the server, simulated there, and broadcast changes in the game state to all players. This made cheating difficult, but under high latency things were a little difficult to control, since you dont see the results of your own actions immediately.</p>
<p><a href="http://www.gamasutra.com/features/19970919/aronson_01.htm" rel="noreferrer">This GamaSutra article</a> has a solution that saves bandwidth and makes local input appear smooth by simulating on the client as well, but it seems to throw cheat-proofing out the window. Also, I'm not sure what to do when players start manipulating the environment, pushing rocks and the like. These previously neutral objects would temporarily become objects the client needs to send PDUs about, or perhaps multiple players do at once. Whose PDUs would win? When would the objects stop being doubly tracked by each player (to compare with the dead reckoned version)? Heaven forbid two players engage in a sumo match (e.g. start pushing each other).</p>
<p><a href="http://www.gamedev.net/reference/articles/article1370.asp" rel="noreferrer">This gamedev.net bit</a> shows the gamasutra solution as inadequate, but describes a different method that doesn't really fix my collaborative boulder-pushing example. Most other things I've found are specific to shooters. I'd love to see something more geared toward games that play like SNES Zelda, but with a little more physics / momentum involved.</p>
<ul>
<li>Note: I'm not asking about physics simulation here -- other libraries have that covered. Just strategies for making games smooth and reactive despite network latency.</li>
</ul>
|
<p>Check out how Valve does it in the Source Engine: <a href="http://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking" rel="noreferrer">http://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking</a></p>
<p>If it's for a first person shooter you'll probably have to delve into some of the topics they mention such as: prediction, compensation, and interpolation.</p>
|
<p>Check out Networking education topics at the XNA Creator's Club website. It delves into topics such as network architecture (peer to peer or client/server), Network Prediction, and a few other things (in the context of XNA of course). This may help you find the answers you're looking for.</p>
<p><a href="http://creators.xna.com/education/catalog/?contenttype=0&devarea=19&sort=1" rel="nofollow noreferrer">http://creators.xna.com/education/catalog/?contenttype=0&devarea=19&sort=1</a></p>
| 6,404
|
<p>From the Displays pane in System Preferences, I can manually change the main monitor by dragging the menu bar from one display to the other. I'd like to automate this and make it part of an AppleScript.</p>
|
<p>The tool I wrote, <a href="https://github.com/jakehilborn/displayplacer" rel="noreferrer">displayplacer</a>, does this.</p>
<p>Configure your screens how you like, drag the "white bar" to your primary screen in the macOS system settings, and then execute <code>displayplacer list</code>. It will output the command to run to put your screens in their current configuration. The screen with <code>origin:(0,0)</code> is the main display with the "white bar". Run this terminal command through a script, Automator, BetterTouchTool, etc.</p>
<p>Example profile 1 puts the white bar on the menu bar on the left monitor.
<code>displayplacer "id:<leftScreenId> res:1920x1080 scaling:on origin:(0,0) degree:0" "id:<rightScreenId> res:1920x1080 scaling:on origin:(1920,0) degree:0"</code></p>
<p>Example profile 1 puts the white bar on the menu bar on the right monitor.
<code>displayplacer "id:<leftScreenId> res:1920x1080 scaling:on origin:(1920,0) degree:0" "id:<rightScreenId> res:1920x1080 scaling:on origin:(0,0) degree:0"</code></p>
<p>Also available via Homebrew <code>brew tap jakehilborn/jakehilborn && brew install displayplacer</code></p>
|
<p>Much like you can tell System Events.app to sleep your Mac, you can tell Image Events.app to mess with your displays. The Image Events application provides a "displays" collection. Each display has a "profile" with lots of goodies. However, everything I just mentioned is read-only, so I don't have a good way to do it from within script.</p>
<p>You might have better luck in Automator – Hit record, run System Preferences, go to Displays, drag the menu bar to the other screen, and hit stop. I bet something will work.</p>
| 9,392
|
<p>I have a question about Slic3r software.</p>
<p>I would like to subtract two parts. For example, I have an STL model, when I right click on the part, I can select <strong>Settings...</strong>, and in the <strong>Settings</strong> window, I can select modifier and I can select slab.with selecting proper thickness. Now we have two parts where one of them is inside of another. My problem is subtracting those two parts.</p>
<p>How can I subtract this part from another?</p>
|
<p>Given my limited familiarity with all the CAD tools that exist, I would fall back to something that I know does binary operations on volumes -- openScad.</p>
<p>One can create two objects, one from each of the two STL files, and subtract one from the other. One can also compute intersections, unions, and other operations.</p>
<p>There are probably other programs that also do this, but openScad allows for doing in programmatically, so that once you have it right, you can update the objects without needing to redo the finicky part of the operations.</p>
<p>slic3r may do this, but I haven't seen such features in my multi-year use of slic3r for slicing. </p>
<p>When in doubt, IMO it is better to script something. It is virtually never that I do something only once, especially in 3D printing where rapid prototype leads to rapid change and improvement.</p>
|
<p>I am assuming your trying to perforate, hollow or cut your design in a specific shape that is the same as the inner 3D object or vice versa? </p>
<p>Do this with 3Ds max its just really easy there for such operations.</p>
<p>Please load into Autodesk 3Ds max and perform Boolean.</p>
<p>This is the link on how to use the Boolean tool, <a href="https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/3DSMax/files/GUID-3DBEB7C2-43CC-4B78-9463-5DD448FD921C-htm.html" rel="nofollow noreferrer">Boolean Compound Object</a></p>
<p>There are other software like magics where this can be done but as you seem to be trying this for the first time. I will suggest only 3Ds max.</p>
| 937
|
<p>I finished the mount of my Anet A8, tested everything and apparently it was ok. I installed the driver that came with it, <code>CH341SER_MAC</code>, turned on the printer, connect USB cable, but nothing happened. </p>
<p>In Cura, I tried to add a printer many times and this message always appears</p>
<blockquote>
<p>The printer isn't connected. </p>
</blockquote>
<p>In OSX, I discover in System Information, an <strong>USB2.0-Serial</strong>, that I think can be the printer. Is it a printer driver problem? Is it the Cura setting? I'm completely lost...</p>
<p><a href="https://i.stack.imgur.com/wyfZ6.png" rel="nofollow noreferrer" title="OSX System Information - USB"><img src="https://i.stack.imgur.com/wyfZ6.png" alt="OSX System Information - USB" title="OSX System Information - USB"></a></p>
|
<p>There are a lot of problems with the CH340 chipset drivers to be found on 3D SE and various forums on the internet. To use this cheap CH340 chip that is used by a number of Arduino compatible (clone) boards to provide USB connectivity (a USB bus converter chip that converts USB bus signals to serial interface) you need to install a correct working driver. </p>
<p>For Mac OS X you can try to download a working version for the OS system you are using. You can try to use <a href="https://blog.sengotta.net/signed-mac-os-driver-for-winchiphead-ch340-serial-bridge/" rel="nofollow noreferrer">this driver installer</a> or <a href="https://github.com/adrianmihalko/ch340g-ch34g-ch34x-mac-os-x-driver" rel="nofollow noreferrer">this driver installer</a>. Both reported to work with Mac OS.</p>
<hr>
<p><strong>Edit</strong>: If you are using OSX El Capitan, please read <a href="https://www.kiwi-electronics.nl/blog?journal_blog_post_id=7&lang=en" rel="nofollow noreferrer">this</a>. To get the CH340 drivers to work you need to use the tool <strong>csrutil</strong>.</p>
<blockquote>
<ul>
<li>Reboot and press CMD+R immediately after hearing the startup sound to boot to Recovery Mode</li>
<li>Open Terminal</li>
<li>Execute the following command: <code>csrutil enable --without kext</code></li>
<li>Reboot</li>
</ul>
</blockquote>
<p>More information is found <a href="https://tzapu.com/making-ch340-ch341-serial-adapters-work-under-el-capitan-os-x/" rel="nofollow noreferrer">here</a>!</p>
|
<p>What Cura version do you have?
Cura only works with the Anet A8 via USB on versions 2.3 and lower according to this <a href="https://www.thingiverse.com/groups/anet-a8-prusa-i3/forums/general/topic:12212" rel="nofollow noreferrer">page</a>. The page is from thingiverse(A 3d printing forum + print files page)</p>
| 939
|
<p>I know about the "cooperative" threading of ruby using <a href="http://en.wikipedia.org/wiki/Green_threads" rel="noreferrer">green threads</a>. How can I create real "OS-level" threads in my application in order to make use of multiple cpu cores for processing?</p>
|
<p><strong>Updated with Jörg's Sept 2011 comment</strong></p>
<p>You seem to be confusing two <em>very</em> different things here: the
Ruby Programming Language and the specific threading model of one
specific implementation of the Ruby Programming Language. There
are currently around 11 different implementations of the Ruby
Programming Language, with <em>very</em> different and unique threading
models.</p>
<p>(Unfortunately, only two of those 11 implementations are actually
ready for production use, but by the end of the year that number
will probably go up to four or five.) (<strong>Update</strong>: it's now 5: MRI, JRuby, YARV (the interpreter for Ruby 1.9), Rubinius and IronRuby).</p>
<ol>
<li><p>The first implementation doesn't actually have a name, which
makes it quite awkward to refer to it and is really annoying and
confusing. It is most often referred to as "Ruby", which is even
more annoying and confusing than having no name, because it
leads to endless confusion between the features of the Ruby
Programming Language and a particular Ruby Implementation.</p>
<p>It is also sometimes called "MRI" (for "Matz's Ruby
Implementation"), CRuby or MatzRuby.</p>
<p><a href="http://RedMine.Ruby-Lang.Org/repositories/annotate/ruby-18/ext/thread/thread.c" rel="noreferrer">MRI implements Ruby Threads as Green Threads within its
interpreter</a>. Unfortunately, it doesn't allow those threads
to be scheduled in parallel, they can only run one thread at a
time.</p>
<p>However, any number of C Threads (POSIX Threads etc.) can run
in parallel to the Ruby Thread, so external C Libraries, or MRI
C Extensions that create threads of their own can still run in
parallel.</p></li>
<li><p>The second implementation is <a href="http://WWW.AtDot.Net/yarv/" rel="noreferrer">YARV</a> (short for "Yet
Another Ruby VM"). <a href="http://RedMine.Ruby-Lang.Org/repositories/annotate/ruby-19/thread.c" rel="noreferrer">YARV implements Ruby Threads as POSIX or
Windows NT Threads</a>, however, it uses a Global Interpreter
Lock (GIL) to ensure that only one Ruby Thread can actually be
scheduled at any one time.</p>
<p>Like MRI, C Threads <em>can</em> actually run parallel to Ruby Threads.</p>
<p>In the future, it is possible, that the GIL <em>might</em> get broken
down into more fine-grained locks, thus allowing more and more
code to actually run in parallel, but that's so far away, it is
not even <em>planned</em> yet.</p></li>
<li><p><a href="http://JRuby.Org/" rel="noreferrer">JRuby</a> <a href="http://www.restlessprogrammer.com/2013/02/multi-threading-in-jruby.html" rel="noreferrer">implements Ruby Threads as Native Threads</a>,
where "Native Threads" in case of the JVM obviously means "JVM
Threads". JRuby imposes no additional locking on them. So,
whether those threads can actually run in parallel depends on
the JVM: some JVMs implement JVM Threads as OS Threads and some
as Green Threads. (The mainstream JVMs from Sun/Oracle use exclusively OS threads since JDK 1.3)</p></li>
<li><p><a href="http://XRuby.GoogleCode.Com/" rel="noreferrer">XRuby</a> also <a href="http://Code.Google.Com/p/xruby/source/browse/trunk/src/com/xruby/runtime/builtin/RubyThread.java#21" rel="noreferrer">implements Ruby Threads as JVM Threads</a>. <strong>Update</strong>: XRuby is dead.</p></li>
<li><p><a href="http://IronRuby.Net/" rel="noreferrer">IronRuby</a> <a href="http://IronRuby.RubyForge.Org/svn/trunk/src/IronRuby.Libraries/Builtins/ThreadOps.cs" rel="noreferrer">implements Ruby Threads as Native Threads</a>,
where "Native Threads" in case of the CLR obviously means
"CLR Threads". IronRuby imposes no additional locking on them,
so, they should run in parallel, as long as your CLR supports
that.</p></li>
<li><p><a href="http://RubyDotNetCompiler.GoogleCode.Com/" rel="noreferrer">Ruby.NET</a> also <a href="http://Code.Google.Com/p/rubydotnetcompiler/source/browse/trunk/src/RubyRuntime/Built-in%20Classes/Thread.cs#21" rel="noreferrer">implements Ruby Threads as CLR
Threads</a>. <strong>Update:</strong> Ruby.NET is dead.</p></li>
<li><p><a href="http://Rubini.us/" rel="noreferrer">Rubinius</a> <a href="https://GitHub.Com/EvanPhx/Rubinius/tree/master/kernel/core/thread.rb#L9" rel="noreferrer">implements Ruby Threads as Green Threads
within its Virtual Machine</a>. More precisely: the Rubinius
VM exports a very lightweight, very flexible
concurrency/parallelism/non-local control-flow construct, called
a "<a href="https://GitHub.Com/EvanPhx/Rubinius/tree/cpp/vm/builtin/task.cpp" rel="noreferrer">Task</a>", and all other concurrency constructs (Threads in
this discussion, but also <a href="https://GitHub.Com/EvanPhx/Rubinius/tree/master/kernel/core/continuation.rb#L45" rel="noreferrer">Continuations</a>, <a href="https://GitHub.Com/EvanPhx/Rubinius/tree/master/lib/actor.rb#L31" rel="noreferrer">Actors</a> and
other stuff) are implemented in pure Ruby, using Tasks.</p>
<p>Rubinius can not (currently) schedule Threads in parallel,
however, adding that isn't too much of a problem: Rubinius can
already <a href="https://GitHub.Com/EvanPhx/Rubinius/tree/master/kernel/core/vm.rb#L5" rel="noreferrer">run several VM instances in several POSIX Threads in
parallel</a>, within one Rubinius process. Since Threads are
actually implemented in Ruby, they can, like any other Ruby
object, be serialized and sent to a different VM in a different
POSIX Thread. (That's the same model the BEAM <a href="http://Erlang.Org/" rel="noreferrer">Erlang</a> VM
uses for SMP concurrency. It is already <a href="https://GitHub.Com/EvanPhx/Rubinius/tree/master/lib/vmactor.rb" rel="noreferrer">implemented for
Rubinius Actors</a>.)</p>
<p><strong>Update</strong>: The information about Rubinius in this answer is about the Shotgun VM, which doesn't exist anymore. The "new" C++ VM does not use green threads scheduled across multiple VMs (i.e. Erlang/BEAM style), it uses a more traditional single VM with multiple native OS threads model, just like the one employed by, say, the CLR, Mono, and pretty much every JVM.</p></li>
<li><p><a href="http://MacRuby.Org/" rel="noreferrer">MacRuby</a> started out as a port of YARV on top of the
Objective-C Runtime and CoreFoundation and Cocoa Frameworks. It
has now significantly diverged from YARV, but AFAIK it currently
still <a href="http://MacRuby.Org/trac/browser/MacRuby/trunk/thread.c?annotate=blame" rel="noreferrer">shares the same Threading Model with YARV</a>.
<strong>Update:</strong> MacRuby depends on apples garbage collector which is declared deprecated and will be removed in later versions of MacOSX, MacRuby is undead.</p></li>
<li><p><a href="https://github.com/parrot/cardinal" rel="noreferrer">Cardinal</a> is a Ruby Implementation for the <a href="http://ParrotCode.Org/" rel="noreferrer">Parrot
Virtual Machine</a>. It doesn't implement threads yet, however,
when it does, it will probably implement them as <a href="http://SVN.Perl.Org/viewvc/parrot/trunk/src/thread.c?view=annotate" rel="noreferrer">Parrot
Threads</a>. <strong>Update</strong>: Cardinal seems very inactive/dead.</p></li>
<li><p><a href="http://MagLev.GemStone.Com/" rel="noreferrer">MagLev</a> is a Ruby Implementation for the <a href="http://GemStone.Com/products/smalltalk/" rel="noreferrer">GemStone/S
Smalltalk VM</a>. I have no information what threading model
GemStone/S uses, what threading model MagLev uses or even if
threads are even implemented yet (probably not).</p></li>
<li><p><a href="http://HotRuby.Yukoba.Jp/" rel="noreferrer">HotRuby</a> is <em>not</em> a full Ruby Implementation of its
own. It is an implementation of a YARV bytecode VM in
JavaScript. HotRuby doesn't support threads (yet?) and when it
does, they won't be able to run in parallel, because JavaScript
has no support for true parallelism. There is an ActionScript
version of HotRuby, however, and ActionScript might actually
support parallelism. <strong>Update</strong>: HotRuby is dead.</p></li>
</ol>
<p>Unfortunately, only two of these 11 Ruby Implementations are
actually production-ready: MRI and JRuby.</p>
<p>So, if you want true parallel threads, JRuby is currently your
only choice – not that that's a bad one: JRuby is actually faster
than MRI, and arguably more stable.</p>
<p>Otherwise, the "classical" Ruby solution is to use processes
instead of threads for parallelism. The Ruby Core Library
contains the <a href="http://Ruby-Doc.Org/core/classes/Process.html" rel="noreferrer"><code>Process</code> module</a> with the <a href="http://Ruby-Doc.Org/core/classes/Process.html#M003179" rel="noreferrer"><code>Process.fork</code>
method</a> which makes it dead easy to fork off another Ruby
process. Also, the Ruby Standard Library contains the
<a href="http://Ruby-Doc.Org/stdlib/libdoc/drb/rdoc/" rel="noreferrer">Distributed Ruby (dRuby / dRb)</a> library, which allows Ruby
code to be trivially distributed across multiple processes, not
only on the same machine but also across the network.</p>
|
<p>If you are using MRI, then you can write the threaded code in C either as an extension or using the ruby-inline gem. </p>
| 7,996
|
<p>What are your opinions on developing for the command line first, then adding a GUI on after the fact by simply calling the command line methods?</p>
<p>eg.</p>
<blockquote>
<p>W:\ todo AddTask "meeting with John, re: login peer review" "John's office" "2008-08-22" "14:00" </p>
</blockquote>
<p>loads <code>todo.exe</code> and calls a function called <code>AddTask</code> that does some validation and throws the meeting in a database. </p>
<p>Eventually you add in a screen for this: </p>
<pre>
============================================================
Event: [meeting with John, re: login peer review]
Location: [John's office]
Date: [Fri. Aug. 22, 2008]
Time: [ 2:00 PM]
[Clear] [Submit]
============================================================
</pre>
<p>When you click submit, it calls the same AddTask function.</p>
<p>Is this considered: </p>
<ul>
<li>a good way to code</li>
<li>just for the newbies</li>
<li>horrendous!.</li>
</ul>
<p><strong>Addendum:</strong> </p>
<p>I'm noticing a trend here for "shared library called by both the GUI and CLI executables." Is there some compelling reason why they would have to be separated, other than maybe the size of the binaries themselves? </p>
<p>Why not just call the same executable in different ways:</p>
<ul>
<li><code>"todo /G"</code> when you want the full-on graphical interface</li>
<li><code>"todo /I"</code> for an interactive prompt <em>within</em> <code>todo.exe</code> (scripting, etc)</li>
<li>plain old <code>"todo <function>"</code> when you just want to do one thing and be done with it.</li>
</ul>
<p><strong>Addendum 2:</strong> </p>
<p>It was mentioned that "the way [I've] described things, you [would] need to spawn an executable every time the GUI needs to do something." </p>
<p>Again, this wasn't my intent. When I mentioned that the example GUI called "the same <code>AddTask</code> function," I didn't mean the GUI called the command line program each time. I agree that would be totally nasty. I had intended (see first addendum) that this all be held in a single executable, since it was a tiny example, but I don't think my phrasing necessarily precluded a shared library.</p>
<p>Also, I'd like to thank all of you for your input. This is something that keeps popping back in my mind and I appreciate the wisdom of your experience.</p>
|
<p>I would go with building a library with a command line application that links to it. Afterwards, you can create a GUI that links to the same library. Calling a command line from a GUI spawns external processes for each command and is more disruptive to the OS.</p>
<p>Also, with a library you can easily do unit tests for the functionality.</p>
<p>But even as long as your functional code is separate from your command line interpreter, then you can just re-use the source for a GUI without having the two kinds at once to perform an operation.</p>
|
<p><strike>Command line tools generate less events then GUI apps and usually check all the params before starting. This will limit your gui because for a gui, it could make more sense to ask for the params as your program works or afterwards. </p>
<p>If you don't care about the GUI then don't worry about it. If the end result will be a gui, make the gui first, then do the command line version. Or you could work on both at the same time.</strike></p>
<p>--Massive edit--</p>
<p>After spending some time on my current project, I feel as though I have come full circle from my previous answer. I think it is better to do the command line first and then wrap a gui on it. If you need to, I think you can make a great gui afterwards. By doing the command line first, you get all of the arguments down first so there is no surprises (until the requirements change) when you are doing the UI/UX. </p>
| 3,949
|
<p>Yesterday evening i have been trying to print a few upgrades but after coming home after an hour, it is printing in the air because there is to much filament dust inside the extruder. Is this because the filament that is being extruded is getting to soft so the gear grinds parts off? I never had this problem before. </p>
<p>Printer:</p>
<p>Anet A8. </p>
|
<p>If you are using Repetier the code to test the endstops is m119 I think. If your z stop is triggered, you may have to invert it in the config.h file. I had this same issue for days before i figured out the control board was reading the switch as normal close instead of normal open. Hope that helps!</p>
|
<p>Try sending a motion command manually, such as G1 X20 Z10, to eliminate any bugginess from the software interface as a reason for the Z not moving properly when commanded to. Next you could check the park location in Pronterface, perhaps the extruder head is sitting there waiting for the next command.</p>
| 683
|
<p>As a novice developer who is getting into the rhythm of my first professional project, I'm trying to develop good habits as soon as possible. However, I've found that I often forget to test, put it off, or do a whole bunch of tests at the end of a build instead of one at a time.</p>
<p>My question is what rhythm do you like to get into when working on large projects, and where testing fits into it.</p>
|
<p>Well, if you want to follow the TDD guys, <strong>before you start to code</strong> ;)</p>
<p>I am very much in the same position as you. I want to get more into testing, but I am currently in a position where we are working to "get the code out" rather than "get the code out right" which scares the crap out of me. So I am slowly trying to integrate testing processes in my development cycle.</p>
<p>Currently, <strong>I test as I code, trying to bust the code as I write it</strong>. I do find it hard to get into the TDD mindset.. Its taking time, but that is the way I would <em>want</em> to work..</p>
<h3>EDIT:</h3>
<p>I thought I should probably expand on this, this is my basic "working process"...</p>
<ol>
<li>Plan what I want from the code,
possible object design, whatever.</li>
<li>Create my first class, add a huge comment to the top outlining
what my "vision" for the class is.</li>
<li>Outline the basic test scenarios.. These will basically
become the unit tests.</li>
<li>Create my first method.. Also writing a short comment explaining
how it is <em>expected</em> to work.</li>
<li>Write an automated test to see if it does what I expect.</li>
<li>Repeat steps 4-6 for each method (note the automated tests are in a huge list that runs on F5).</li>
<li>I then create some beefy tests to emulate the class in the working environment, obviously fixing any issues.</li>
<li>If any new bugs come to light following this, I then go back and write the new test in, make sure it fails (this also serves as proof-of-concept for the bug) then fix it..</li>
</ol>
<p>I hope that helps.. Open to comments on how to improve this, as I said it is a concern of mine..</p>
|
<p>When hacking something together for myself, I test at the end. Bad practice, but these are usually small things that I'll use a few times and that's it.</p>
<p>On a larger project, I write tests before I write a class and I run the tests after every change to that class.</p>
| 4,303
|
<p>Does anyone know of a good way to compress or decompress files and folders in C# quickly? Handling large files might be necessary.</p>
|
<p>I've always used the SharpZip Library.</p>
<p><a href="http://sharpdevelop.net/OpenSource/SharpZipLib/Download.aspx" rel="noreferrer">Here's a link</a></p>
|
<p>You can create zip file with this method:</p>
<pre class="lang-cs prettyprint-override"><code>public async Task<string> CreateZipFile(string sourceDirectoryPath, string name)
{
var path = HostingEnvironment.MapPath(TempPath) + name;
await Task.Run(() =>
{
if (File.Exists(path)) File.Delete(path);
ZipFile.CreateFromDirectory(sourceDirectoryPath, path);
});
return path;
}
</code></pre>
<p>and then you can unzip zip file with this methods:</p>
<p>1- This method work with zip file path</p>
<pre class="lang-cs prettyprint-override"><code>public async Task ExtractZipFile(string filePath, string destinationDirectoryName)
{
await Task.Run(() =>
{
var archive = ZipFile.Open(filePath, ZipArchiveMode.Read);
foreach (var entry in archive.Entries)
{
entry.ExtractToFile(Path.Combine(destinationDirectoryName, entry.FullName), true);
}
archive.Dispose();
});
}
</code></pre>
<p>2- This method work with zip file stream</p>
<pre class="lang-cs prettyprint-override"><code>public async Task ExtractZipFile(Stream zipFile, string destinationDirectoryName)
{
string filePath = HostingEnvironment.MapPath(TempPath) + Utility.GetRandomNumber(1, int.MaxValue);
using (FileStream output = new FileStream(filePath, FileMode.Create))
{
await zipFile.CopyToAsync(output);
}
await Task.Run(() => ZipFile.ExtractToDirectory(filePath, destinationDirectoryName));
await Task.Run(() => File.Delete(filePath));
}
</code></pre>
| 2,260
|
<p>I'm an Information Architect and JavaScript developer by trade nowadays, but recently I've been getting back into back-end coding again. And, whilst trying to get an HTML prototype integrated and working with our C#-based CMS, I've come to blows with our programmers over the HTML ID attributes being arbitrarily rewritten by .NET for form elements.</p>
<p>I can understand the code-behind reasoning for .NET changing IDs, but the fact you can no longer use IDs when trying to develop e.g. jQuery enhanced interfaces is causing some friction. What can I do to work around this?</p>
<p>I've tried using the class attribute instead, but that's really crappy, not what it's meant for and doesn't get around that problem of .NET effectively changing rendered source on the fly. It also means that CSS is less useful now and less efficient to create and maintain.</p>
<p>Any tips or advice greatly appreciated--anything for a few less sleepless nights...</p>
|
<p>The short answer is no, with webforms the id can always be rewritten depending on the nesting of the element. You can get access to the id through the ClientID property, so you could set the ids into variables in a script at the end of the page/control then put them into jQuery. </p>
<p>something like this:</p>
<pre><code><asp:button id="ImAButton" runat="server">Click Me</asp:button>
<script type="text/javascript">
var buttonId = "<%=ImAButton.ClientId%>";
$("#"+buttonId).bind('click', function() { alert('hi); });
</script>
</code></pre>
<p>It's a hack I know, but it will work.
(I should note for the un-initiated, I'm using the Prototype $ get by id method there)</p>
|
<p>If you're using jQuery then you have loads of <a href="http://docs.jquery.com/Selectors" rel="nofollow noreferrer">CSS selectors and jQuery custome selectors</a> at your disposal to target elements on your page. So rather than picking out a submit button by it's id, you could do something like:</p>
<pre><code>$('fieldset > input[type="submit"]').click(function() {...});
</code></pre>
| 6,001
|
<p>Well behaved windows programs need to allow users to save their work when they are shutting the PC down.</p>
<p>How can I make my app detect the shutdown event? Any solution should allow the user to abort the shutdown if user selects, say "Cancel".</p>
<p>The normal Swing window closing hook doesn't work, nor does adding a shutdown hook.</p>
<p>On testing, the methods of WindowListener (windowClosing,windowClosed, etc) do not get called.</p>
<p>The answer I have accepted requires the use of platform specific code (JNI to register for WM_QUERYENDSESSION ). Isn't this a bug on Swing?</p>
<p>See <a href="http://forums.sun.com/thread.jspa?threadID=481807&messageID=2246870" rel="nofollow noreferrer">http://forums.sun.com/thread.jspa?threadID=481807&messageID=2246870</a></p>
|
<p>Write some JNI code to WM_QUERYENDSESSION message. You can get details for this from the MSDN documentation or by googling it.</p>
<p>If you don't want to write too much C++ code to do this I can recommend the JNA library <a href="https://jna.dev.java.net/" rel="nofollow noreferrer">click here</a>. Which gives you some nice Java abstractions for C code.</p>
|
<p>The above seems to be the better answer.</p>
<p>I can't find any good information on detecting window shutdown events. I guess the best possible method would be to detect weather your application is trying to close, using a window closing event or the like then ask the question.</p>
<p><a href="http://www.javalobby.org/java/forums/t17933" rel="nofollow noreferrer">http://www.javalobby.org/java/forums/t17933</a></p>
| 9,740
|
<p>I am trying to <strong>replace the current selection in Word (2003/2007)</strong> by some <strong>RTF string</strong> stored in a variable.</p>
<p>Here is the current code:</p>
<pre><code>Clipboard.SetText(strRTFString, TextDataFormat.Rtf)
oWord.ActiveDocument.ActiveWindow.Selection.PasteAndFormat(0)
</code></pre>
<p>Is there any way to do the same thing without going through the clipboard. Or is there any way to push the clipboard data to a safe place and restore it after?</p>
|
<p>Put the RTF in a file instead of the clipboard, then insert from the file, e.g.</p>
<blockquote>
<p><code>Selection.InsertFile FileName:="myfile.rtf", Range :="", _
ConfirmConversions:=False, Link:=False, Attachment:=False</code></p>
</blockquote>
|
<p>You can use a RichTextbox to convert RTF to text or vice versa.</p>
<pre><code>RichTextBox r = new RichTextBox();
r.Rtf = strRTFString;
Console.WriteLine(r.Text);
</code></pre>
| 4,233
|
<p>Anyone else seeing this issue? Anyone know a solution?</p>
<p>While editing a part on TinkerCad.com (<a href="https://www.tinkercad.com/things/hrsKxOk1Xc7" rel="nofollow noreferrer">this part</a>, to be specific), I click the "Send To" button in the top-right --> click Thingiverse --> I see this screen: <a href="https://i.stack.imgur.com/PsCJO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PsCJO.png" alt="enter image description here" /></a></p>
<p>I then click on "Authorize". I'm already signed into Thingiverse, so I click "AGREE & AUTHORIZE APP" --> and I get this error window:</p>
<p><a href="https://i.stack.imgur.com/OCRGW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OCRGW.png" alt="enter image description here" /></a></p>
<p>It states:</p>
<blockquote>
<p>There was a problem authenticating you with Thingiverse</p>
<p>Close this window and return to Tinkercad.</p>
<p>Privacy settings |<br />
Privacy/Cookies</p>
</blockquote>
<p>Anyone know what could be the issue? I've tried in Google Chrome, on Firefox, in Chrome with incognito mode, and even with a <strong>2nd pair of separate TinkerCad and Thingiverse accounts!</strong> I get the same result each and every time.</p>
<p>Note: I used the Google sign-in for the Thingiverse account. Maybe I need to use the independent account login?</p>
<hr />
<p>Side note: this question is <a href="https://3dprinting.stackexchange.com/help/on-topic">on-topic</a>:</p>
<blockquote>
<p>Websites (could come under Software and/or Tools)</p>
<p>...</p>
<ul>
<li>Issues with web based tools <=== this one is my question</li>
</ul>
</blockquote>
<h2>I just sent in some support request tickets to both sites</h2>
<p>Update 22 Dec. 2021:</p>
<p>I posted a help support ticket to both TinkerCad <a href="https://tinkercad.zendesk.com/hc/en-us/requests/new" rel="nofollow noreferrer">here</a> (choose "Tinkercad Account" from the "Please choose from the options below" dropdown menu) and to Thingiverse <a href="https://www.thingiverse.com/support#" rel="nofollow noreferrer">here</a> (click link --> choose "Other" from dropdown menu for "What does your support request pertain to?"). I'll add an answer here if I get any useful response or solution from either of them. My support tickets on each site essentially contained the following information:</p>
<blockquote>
<h2>Subject:</h2>
<p>Can't "Send To" Thingiverse from Tinkercad.com</p>
<h2>Body:</h2>
<p>Please see a full description of my problem here: <a href="https://3dprinting.stackexchange.com/questions/18611/cant-send-to-thingiverse-from-tinkercad-com">Can't "Send To" Thingiverse from Tinkercad.com</a></p>
<p>Essentially, no matter what I do I get into an infinite loop of trying to click the "Send to" button to send a model to Thingiverse, and it repeatedly fails with the error shown in the attachment. Again, see the full description at the link above.</p>
<h2>OS:</h2>
<p>Linux Ubuntu 20.04</p>
<h2>Browser:</h2>
<p>Chrome Version 96.0.4664.110 (Official Build) (64-bit)</p>
</blockquote>
|
<h2>the 3D Benchy isn't a specific calibration test</h2>
<p>With the Benchy you don't see if your printer is calibrated in any axis, but it is a general use-case test for a model that can show you many of the issues you might face in a normal print. For all intents and purposes, it is more a general Benchmark item than a specific calibration test like a cube, stringing test, or temperature tower, where you go through iterations of a profile to dial in settings and printer properties.</p>
<h2>the 3D Benchy is a Benchmark for printer and settings</h2>
<p>Most of the printing issues that can be seen on a Benchy are related to the print settings, though some are also related to the physical properties.</p>
<h3>Overhangs</h3>
<p>The bow of the Benchy has a shape that is very conducive to seeing how much the printer can handle overhangs due to proper cooling and settings.</p>
<p>The arches in the sides of the cabin, as well as the back window, have a rather challenging overhang pattern (the extension needs to be larger and larger), and the front of the Benchy has a short bridge, which shows if cooling is happening properly.</p>
<p>The upper edge of the hull also is a little overhang, which shows how well small oversteps can be printed.</p>
<h3>Small Diameter</h3>
<p>The funnel of the Benchy is of sufficient small crossection, that with bad settings it can result in printing layers upon one another too fast, which can result in bulging, misinformation, or totally blobing that area.</p>
<h3>Sharp corners</h3>
<p>The front and back corners are rather sharp and can show the effects of ringing on the area next to them due to bad acceleration settings</p>
|
<p>Benchy is cute. That goes a long way in attracting attention.</p>
<p>The benchy is one of the earlier STLs that was freely available to download, dating from April 2015, and was released under the Creative Commons Sharealike licence, which clearly states the requirements and limitations/requirements.</p>
<p>Curiously, a printed Benchy can float in still water, provided no print problems crop up. It will also sit nicely on a shelf, with no risk of rolling off and makes a nice ornament.</p>
<p>Links:<br> <a href="https://en.wikipedia.org/wiki/3DBenchy" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/3DBenchy</a> and one of the earliest download sites <a href="https://www.thingiverse.com/thing:763622" rel="nofollow noreferrer">https://www.thingiverse.com/thing:763622</a></p>
<hr />
<p>I've had my printer for a year now, and have never printed a benchy.</p>
| 2,079
|
<p>Over the last two days I have tried everything I could come up with to fix the following issues.</p>
<p>It all started with bad bed adhesion.(pic.1) Solutions for these problems are readily available, so I calibrated my Z-axis (did the whole wizard from start to finish again) and started a calibration print over the whole buildplate, getting an interesting result.(pic.2) As you can see some area's are squashed nicely whilst others come off directly.</p>
<p>I then started looking for alternative Z-levelling solutions and came across an alternative calibration file (link1), at first glance the results seemed allright, -0,8mm seem to provide the best results (pic.3) however notice the darkened area to the left (could be the high temp of this test? 225c?).</p>
<p>To validate the number I did a full print on -0,8 and this is where it gets weird, the result shows a non uniform transparancy (pic.4) the mechanical properties are also a lot less. I used my caliper to check the printer and all seems to be well within expected ranges.
The bed is also flat, checked with a ruler for deformaties.</p>
<p>Printing with the first spool of Prusa fillament, do notice some changes in the Z-level calibration print, the edges now bend upwards, this is done with the same Gcode and spool as previous (pic.5). </p>
<p>Any advice on what to do next?
Printing on 210c with fan off for the first layer, test square on 225c, all PLA.
Cleaned the bed with Acetone (99% pure) before each attempt.</p>
<p>Picture 1:
<a href="https://i.stack.imgur.com/BEr9G.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BEr9G.jpg" alt="enter image description here"></a>
Picture 2:
<a href="https://i.stack.imgur.com/Jh52H.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jh52H.jpg" alt="enter image description here"></a>
Picture 3:
<a href="https://i.stack.imgur.com/d4wtl.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d4wtl.jpg" alt="enter image description here"></a>
Picture 4:
<a href="https://i.stack.imgur.com/WUwgq.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WUwgq.jpg" alt="enter image description here"></a>
Picture 5:
<a href="https://i.stack.imgur.com/Tqd5r.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Tqd5r.jpg" alt="enter image description here"></a></p>
<p>EDIT: So Mick mentioned cleaning the nozzle which helped with the inconsistent first layer. In the end it was me being unaware that Aceton doesn't help with grease, a thorough scrubbing of the buildplate with soap and really hot water helped.</p>
<p><a href="https://i.stack.imgur.com/Speny.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Speny.jpg" alt="enter image description here"></a></p>
|
<p>If you repeat a test and the problem occurs in the same location, then you probably have a problem with your bed or build plate. However, picture 3 suggests to me that you may have a partially clogged nozzle. Manually extrude some filament. It should fall straight down. If it curls as it comes out of the nozzle, then you have a partial clog. Brass nozzles do wear out, so if you've put some hours on your printer, it might be a good idea to fit a new one.</p>
<p>Edit: I meant picture 3, not picture 4.</p>
|
<p>The Prusa i3 is coated with a PEI sheet. PEI and other build plates stick to the build but don't like to be dirty. Fingerprints can build up and create an interference layer of fats that lessen the adhesion to a point the pieces spontaneously pop off.</p>
<p>A good cleaning is often needed. For PEI Isopropylic Alcohol is a fast cleaner, but if you can remove the build plate soap and water work too - but take care not to go too hot as PEI can get damaged. For BuildTak and similar, Acetone also can do the job.</p>
<p>When using Gluestick to create a deliberate destroyable adhesion layer (for filaments fusing with PEI that can result in chipping out chunks) clean the surface afterward with a little water. In the choice of gluestick, make sure you get a PVA based one.</p>
| 1,244
|
<p>Why does the Ender 3 only have 3 limit switches instead of 6?</p>
<p>How does it handle crashes on other sides?
Is it worth adding them with a new mainboard?</p>
|
<p>While better fitted to our friends at <a href="https://law.stackexchange.com/questions/tagged/copyright">law.SE</a>, the general gist is: <strong>No.</strong></p>
<p>Art is protected by copyright, and any adaption (<em>derivative work</em>) requires the OK from the right holders <em>per se</em>. Only 70-75 years after the death of the author (or publication for company works), a work enters the <em>public domain</em> and the copyright expires.</p>
<p>There are some exceptions (<em>fair use/fair dealing/</em>...), but <em>media transformation</em> is not one of them.</p>
<p>Giraud died in 2012, his estate or heirs - or whoever he/they sold the commercial rights to - own the right to ok derivative Works till around 2087.</p>
|
<p>This is something that might have a precedent, where the line is blurry, someone might have already tried, and in that case the judge's decision in that court case is the official interpretation of the law towards that specific scenario.</p>
<p>There might also be definitive laws regarding "derived works"...</p>
<p>Like the others, I would ask the Law SE for help.</p>
| 1,795
|
<p>I know that this should be easy but how do I export/save a DataGridView to excel?</p>
|
<p>You can use this library for more detailed formatting<br>
<a href="http://www.carlosag.net/Tools/ExcelXmlWriter/" rel="nofollow noreferrer">http://www.carlosag.net/Tools/ExcelXmlWriter/</a></p>
<p>There are samples in the page.</p>
|
<p>Here some code we use to do it across lots of our apps. We have a special method to clean up "not exportable" column. Additionally, we don't export cols without headers but you can adjust that logic to your needs.</p>
<p>Edit: The code formatter doesn't love vb.net - you can copy/paste into visual studio and it will be fine.</p>
<pre><code>
Public Overloads Shared Function BuildExcel(ByVal gView As System.Web.UI.WebControls.GridView) As String
PrepareGridViewForExport(gView)
Dim excelDoc As New StringBuilder
Dim startExcelXML As String = " " + _
" " + _
" " + _
" " + _
" " + _
" " + _
" " + _
" " + _
" "
Dim endExcelXML As String = ""
Dim rowCount As Int64 = 0
Dim sheetCount As Int16 = 1
excelDoc.Append(startExcelXML)
excelDoc.Append("")
excelDoc.Append("")
' write out column headers
excelDoc.Append("")
For x As Int32 = 0 To gView.Columns.Count - 1
'Only write out columns that have column headers.
If Not gView.Columns(x).HeaderText = String.Empty Then
excelDoc.Append("")
excelDoc.Append(gView.Columns(x).HeaderText.ToString)
excelDoc.Append("")
End If
Next
excelDoc.Append("")
For r As Int32 = 0 To gView.Rows.Count - 1
rowCount += rowCount
If rowCount = 64000 Then
rowCount = 0
sheetCount += sheetCount
excelDoc.Append("")
excelDoc.Append(" ")
excelDoc.Append("")
excelDoc.Append("")
End If
excelDoc.Append("")
For c As Int32 = 0 To gView.Rows(r).Cells.Count - 1
'Don't write out a column without a column header.
If Not gView.Columns(c).HeaderText = String.Empty Then
Dim XMLstring As String = gView.Rows(r).Cells(c).Text
XMLstring = XMLstring.Trim()
XMLstring = XMLstring.Replace("&", "&")
XMLstring = XMLstring.Replace(">", ">")
XMLstring = XMLstring.Replace("" + "")
excelDoc.Append(XMLstring)
excelDoc.Append("")
End If
Next
excelDoc.Append("")
Next
excelDoc.Append("")
excelDoc.Append(" ")
excelDoc.Append(endExcelXML)
Return excelDoc.ToString
End Function
Shared Sub PrepareGridViewForExport(ByVal gview As System.Web.UI.Control)
' Cleans up grid for exporting. Takes links and visual elements and turns them into text.
Dim lb As New System.Web.UI.WebControls.LinkButton
Dim l As New System.Web.UI.WebControls.Literal
Dim name As String = String.Empty
For i As Int32 = 0 To gview.Controls.Count - 1
If TypeOf gview.Controls(i) Is System.Web.UI.WebControls.LinkButton Then
l.Text = CType(gview.Controls(i), System.Web.UI.WebControls.LinkButton).Text
gview.Controls.Remove(gview.Controls(i))
gview.Controls.AddAt(i, l)
ElseIf TypeOf gview.Controls(i) Is System.Web.UI.WebControls.DropDownList Then
l.Text = CType(gview.Controls(i), System.Web.UI.WebControls.DropDownList).SelectedItem.Text
gview.Controls.Remove(gview.Controls(i))
gview.Controls.AddAt(i, l)
ElseIf TypeOf gview.Controls(i) Is System.Web.UI.WebControls.CheckBox Then
l.Text = CType(gview.Controls(i), System.Web.UI.WebControls.CheckBox).Checked.ToString
gview.Controls.Remove(gview.Controls(i))
gview.Controls.AddAt(i, l)
End If
If gview.Controls(i).HasControls() Then
PrepareGridViewForExport(gview.Controls(i))
End If
Next
End Sub
</code></pre>
| 4,694
|
<p>In <a href="https://stackoverflow.com/questions/32404/can-i-run-a-python-script-as-a-service-in-windows-how" title="Python scripts as Windows service">another question</a> I posted yesterday, I got very good advice on how a Python script could be run as a service in Windows. What I'm left wondering is: How is Windows aware of the services that can be managed in the native tools ("services" window in "administrative tools"). I. e. what is the Windows equivalent of putting a start/stop script in /etc/init.d under Linux?</p>
|
<p>Here is code to install a python-script as a service, written in python :)</p>
<p><a href="http://code.activestate.com/recipes/551780/" rel="noreferrer">http://code.activestate.com/recipes/551780/</a></p>
<p>This post could also help you out:</p>
<p><a href="http://essiene.blogspot.com/2005/04/python-windows-services.html" rel="noreferrer">http://essiene.blogspot.com/2005/04/python-windows-services.html</a></p>
|
<p>You can use srvany.exe from Windows NT Resource Kit to create a user defined service that will show up in the admin tools...</p>
<p><a href="http://support.microsoft.com/kb/137890" rel="nofollow noreferrer">http://support.microsoft.com/kb/137890</a></p>
<p>I am using this method to run tracd (a python script / server) for trac. </p>
<p>Here are some very clear instructions: <a href="http://www.tacktech.com/display.cfm?ttid=197" rel="nofollow noreferrer">http://www.tacktech.com/display.cfm?ttid=197</a></p>
<p>It does require some registry editing (very minimal and easy) but will allow you to make any command line / script a windows service. </p>
| 5,455
|
<p>I have a couple of pet projects where I'm the sole designer/programmer and I spend too much time changing the user interface to make it easier to use <strong>by real users</strong> and avoiding <strong>bright yellow and green</strong> that is so common on "programmer" designs.</p>
<p>Do you have tips to choose a color scheme when you do not have a graphics designer around? How do you avoid creating the typical "programmer" interface?</p>
<p></p>
|
<p><a href="http://kuler.adobe.com/" rel="noreferrer">kuler</a> has a lot of user submitted colour schemes</p>
<p>edit: just remembered... also try <a href="http://www.colourlovers.com/" rel="noreferrer">colorlovers</a></p>
|
<p>Adobe's <a href="http://kuler.adobe.com" rel="nofollow noreferrer">Kuler</a> website has a lot of user-created color schemes uploaded by designers. I normally search for higher ranked schemes first. </p>
| 5,305
|
<p>How much should one DataSet represent? Using the example of an ordering system: While showing your order I also show a list of items similar to one of yours as well as a list of our most popular items.
While your items are tangled in a web of relationships involving you and your past orders, preferred suppliers, and the various other kinds of information related to you as a client, the other items do not have these same relationships. The set of queries I use to navigate the set of stuff representing you is different than the queries I use for one of these other lists of items.</p>
<p>My inclination is to create different DataSets for different kinds of relationships but then I create ten separate item DataTables and that seems wrong. When I instantiate the larger DataSet even though I am only interested in a small subset that seems wrong, and when I try to pack all of these into one DataSet I have a big messy looking thing with several items tables next to each other and I am pretty sure that IS wrong.</p>
<p>Maybe I am over-valuing the relationship feature of DataSets or maybe I just need to get over myself, either way I could use some guidance.</p>
|
<p>The DataSet is vastly overrated and overused. Use strongly-typed collections (thank you, generics and automatic properties!). As icing on the cake, you can now even do cool query things against your custom objects with LINQ. </p>
<p>Good Esposito article on datasets versus custom objects:</p>
<p><a href="http://msdn.microsoft.com/en-us/magazine/cc163751.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc163751.aspx</a></p>
<p>Automatic properties:</p>
<p><a href="http://weblogs.asp.net/dwahlin/archive/2007/12/04/c-3-0-features-automatic-properties.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/dwahlin/archive/2007/12/04/c-3-0-features-automatic-properties.aspx</a></p>
<p>LINQ with your objects:</p>
<p><a href="http://blogs.msdn.com/wriju/archive/2006/09/16/linq-custom-object-query.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/wriju/archive/2006/09/16/linq-custom-object-query.aspx</a></p>
|
<p>The DataSet is vastly overrated and overused. Use strongly-typed collections (thank you, generics and automatic properties!). As icing on the cake, you can now even do cool query things against your custom objects with LINQ. </p>
<p>Good Esposito article on datasets versus custom objects:</p>
<p><a href="http://msdn.microsoft.com/en-us/magazine/cc163751.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc163751.aspx</a></p>
<p>Automatic properties:</p>
<p><a href="http://weblogs.asp.net/dwahlin/archive/2007/12/04/c-3-0-features-automatic-properties.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/dwahlin/archive/2007/12/04/c-3-0-features-automatic-properties.aspx</a></p>
<p>LINQ with your objects:</p>
<p><a href="http://blogs.msdn.com/wriju/archive/2006/09/16/linq-custom-object-query.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/wriju/archive/2006/09/16/linq-custom-object-query.aspx</a></p>
| 5,692
|
<p>What's a quick and easy way to view and edit ID3 tags (artist, album, etc.) using C#?</p>
|
<p>Thirding <a href="https://github.com/mono/taglib-sharp" rel="noreferrer">TagLib Sharp</a>.</p>
<pre><code>TagLib.File f = TagLib.File.Create(path);
f.Tag.Album = "New Album Title";
f.Save();
</code></pre>
|
<p>I wrapped mp3 decoder library and made it available for .net developers. You can find it here:</p>
<p><a href="http://sourceforge.net/projects/mpg123net/" rel="nofollow noreferrer">http://sourceforge.net/projects/mpg123net/</a></p>
<p>Included are the samples to convert mp3 file to PCM, and read ID3 tags.</p>
| 9,378
|
<p>I am working with fixtures on rails and I want one of the fixture fields to be blank.</p>
<p>Example:</p>
<pre><code>two:
name: test
path: - I want this blank but not to act as a group heading.
test: 4
</code></pre>
<p>But, I do not know how to leave <code>path:</code> blank without it acting as a group title. Does anybody know how to do that?</p>
|
<p>YAML files are based on indentation. Once you actually have correct indentation it will read everything at the same level as siblings.</p>
<pre><code>
two:
name: test
path:
test: 4
</code></pre>
|
<p>Google <a href="http://groups.google.com/group/ruby-talk-google/browse_thread/thread/f8b1635528665a85" rel="nofollow noreferrer">says</a> the following should work:</p>
<pre><code>path: \"\"
</code></pre>
| 7,990
|
<p>Does anyone have any experience getting MSTest to copy hibernate.cfg.xml properly to the output directory? All my MSTests fail with a cannot find hibernate.cfg.xml error (I have it set to Copy Always), but my MBUnit tests pass.</p>
|
<p>You can try adding the DeploymentItemAttribute to one of your tests, or edit your .testrunconfig file and add the file to the Deployment list.</p>
|
<p>a workaround rather than an answer: NHibernate supports <a href="http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/session-configuration.html#configuration-programmatic" rel="nofollow noreferrer">programmatic configuration</a>. so you can write your own native properties/config file and parse it into hibernate configurations on startup.</p>
| 4,052
|
<p>I have an Elegoo Mars.</p>
<p>I have printed a figure in Resin, but after some months I found this - the figure is as if it is not completely cured. The base is open (see picture below). it wasn't open before!</p>
<p>It was printed a month ago, I am not precisely sure. I think I only machine cured and sunlight.</p>
<p>How is this possible?</p>
<p><a href="https://i.stack.imgur.com/l4bBJ.jpg" rel="nofollow noreferrer" title="Base of 3D print"><img src="https://i.stack.imgur.com/l4bBJ.jpg" alt="Base of 3D print" title="Base of 3D print" /></a></p>
|
<p>Those are cracks as a result of overstressing due internal stresses to further curing of the print over the course of time (stress cracks).</p>
<p>Most probably the print wasn't cured properly or slicing wasn't optimal.</p>
|
<p>You should probably cure more, but curing should not be complete during print, or the layer will not stick properly.</p>
<p>Also, when you cure with UV light or the sun after the print is completed, you can cure only up to a certain depth, <a href="https://3dprinting.stackexchange.com/questions/13660/can-uv-cure-inside-opaque-or-more-massive-printed-object">likely around a couple of millimetres</a>.</p>
<p>If your object was massive and you didn't "hollow it" then some resin got trapped inside it and it didn't cure properly initially. It may slowly cure later, but by the time the object cracks due to stress, some resin may still be liquid enough to cause the issue.</p>
| 2,228
|
<p>I have a question on the best way of exposing an asynchronous remote interface.</p>
<p>The conditions are as follows:</p>
<ul>
<li>The protocol is asynchronous</li>
<li>A third party can modify the data at any time</li>
<li>The command round-trip can be significant</li>
<li>The model should be well suited for UI interaction</li>
<li>The protocol supports queries over certain objects, and so must the model</li>
</ul>
<p>As a means of improving my lacking skills in this area (and brush up my Java in general), I have started a <a href="http://Telharmonium.devjavu.com/" rel="nofollow noreferrer">project</a> to create an Eclipse-based front-end for <a href="http://xmms2.xmms.se" rel="nofollow noreferrer">xmms2</a> (described below).</p>
<p>So, the question is; how should I expose the remote interface as a neat data model (In this case, track management and event handling)?</p>
<p>I welcome anything from generic discussions to pattern name-dropping or concrete examples and patches :)</p>
<hr>
<p>My primary goal here is learning about this class of problems in general. If my project can gain from it, fine, but I present it strictly to have something to start a discussion around.</p>
<p>I've implemented a protocol abstraction which I call <a href="http://telharmonium.devjavu.com/browser/trunk/xmms2-client" rel="nofollow noreferrer">'client'</a> (for legacy reasons) which allows me to access most exposed features using method calls which I am happy with even if it's far from perfect.</p>
<p>The features provided by the xmms2 daemon are things like track searching, meta-data retrieval and manipulation, change playback state, load playlists and so on and so forth.</p>
<p>I'm in the middle of updating to the latest stable release of xmms2, and I figured I might as well fix some of the glaring weaknesses of my current implementation.</p>
<p>My plan is to build a better abstraction on top of the protocol interface, one that allows a more natural interaction with the daemon. The current <a href="http://telharmonium.devjavu.com/browser/trunk/xmms2-model" rel="nofollow noreferrer">'model'</a> implementation is hard to use and is frankly quite ugly (not to mention the UI-code which is truly horrible atm).</p>
<p>Today I have the <a href="http://telharmonium.devjavu.com/browser/trunk/xmms2-model/src/se/fnord/xmms2/model/Tracks.java" rel="nofollow noreferrer">Tracks</a> interface which I can use to get instances of <a href="http://telharmonium.devjavu.com/browser/trunk/xmms2-model/src/se/fnord/xmms2/model/Track.java" rel="nofollow noreferrer">Track</a> classes based on their id. Searching is performed through the <a href="http://telharmonium.devjavu.com/browser/trunk/xmms2-model/src/se/fnord/xmms2/model/Collections.java" rel="nofollow noreferrer">Collections</a> interface (unfortunate namespace clash) which I'd rather move to Tracks, I think.</p>
<p>Any data can be modified by a third party at any time, and this should be properly reflected in the model and change-notifications distributed</p>
<p>These interfaces are exposed when connecting, by returning an object hierarchy that looks like this:</p>
<ul>
<li>Connection
<ul>
<li>Playback getPlayback()
<ul>
<li>Play, pause, jump, current track etc</li>
<li>Expose playback state changes</li>
</ul></li>
<li>Tracks getTracks()
<ul>
<li>Track getTrack(id) etc</li>
<li>Expose track updates</li>
</ul></li>
<li>Collections getCollection()
<ul>
<li>Load and manipulate playlists or named collections</li>
<li>Query media library</li>
<li>Expose collection updates</li>
</ul></li>
</ul></li>
</ul>
|
<p>For the asynchronous bit, I would suggest checking into <code>java.util.concurrent</code>, and especially the <code>Future<T></code> interface. The future interface is used to represent objects which are not ready yet, but are being created in a separate thread. You say that objects can be modified at any time by a third party, but I would still suggest you use immutable return objects here, and instead have a separate thread/event log you can subscribe to to get noticed when objects expire. I have little programming with UIs, but I believe using Futures for asynchronous calls would let you have a responsive GUI, rather than one that was waiting for a server reply.</p>
<p>For the queries I would suggest using method chaining to build the query object, and each object returned by method chaining should be <code>Iterable</code>. Similar to how Djangos model is. Say you have <code>QuerySet</code> which implements <code>Iterable<Song></code>. You can then call <code>allSongs()</code> which would return a result iterating over all Songs. Or <code>allSongs().artist("Beatles")</code>, and you would have an iterable over all Betles songs. Or even <code>allSongs().artist("Beatles").years(1965,1967)</code> and so on. </p>
<p>Hope this helps as a starting place.</p>
|
<p>@<a href="https://stackoverflow.com/questions/37041/exposing-a-remote-interface-or-object-model#37093">Staale</a>: Thanks a bunch!</p>
<p>Using Future for the async operations is interesting. The only drawback being that it is doesn't provide callbacks. But then again, I tried that approach, and look where that got me :)</p>
<p>I'm currently solving a similar problem using a worker thread and a blocking queue for dispatching the incoming command replies, but that approach doesn't translate very well.</p>
<p>The remote objects can be modified, but since I do use threads, I try to keep the objects immutable. My current hypothesis is that I will send notification events on track updates on the form</p>
<pre><code>somehandlername(int changes, Track old_track, Track new_track)
</code></pre>
<p>or similar, but then I might end up with several versions of the same track.</p>
<p>I'll definitely look into Djangos method chaining. I've been looking at some similar constructs but haven't been able to come up with a good variant. Returning something iterable is interesting, but the query could take some time to complete, and I wouldn't want to actually execute the query before it's completely constructed.</p>
<p>Perhaps something like</p>
<pre><code>Tracks.allSongs().artist("Beatles").years(1965,1967).execute()
</code></pre>
<p>returning a Future might work...</p>
| 5,767
|
<p>The problem: Loading an excel spreadsheet template. Using the Save command with a different filename and then quitting the interop object. This ends up saving the original template file. Not the result that is liked.</p>
<pre><code>public void saveAndExit(string filename)
{
excelApplication.Save(filename);
excelApplication.Quit();
}
</code></pre>
<p>Original file opened is c:\testing\template.xls
The file name that is passed in is c:\testing\7777 (date).xls</p>
<p>Does anyone have an answer?</p>
<p>(The answer I chose was the most correct and thorough though the wbk.Close() requires parameters passed to it. Thanks.)</p>
|
<p>Excel interop is pretty painful. I dug up an old project I had, did a little fiddling, and I think this is what you're looking for. The other commenters are right, but, at least in my experience, there's a lot more to calling SaveAs() than you'd expect if you've used the same objects (without the interop wrapper) in VBA.</p>
<pre><code>Microsoft.Office.Interop.Excel.Workbook wbk = excelApplication.Workbooks[0]; //or some other way of obtaining this workbook reference, as Jason Z mentioned
wbk.SaveAs(filename, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, XlSaveAsAccessMode.xlNoChange,
Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing);
wbk.Close();
excelApplication.Quit();
</code></pre>
<p>Gotta love all those Type.Missings. But I think they're necessary.</p>
|
<p>Have you tried the SaveAs from the Worksheet?</p>
| 4,880
|
<p>I run quite a few Ender 3 Pro's using the same slicer settings (Simplify3D), and just recently I have noticed a very odd extrusion problem. </p>
<p>I find that at about the same height on several printers the printer under extrudes by quite a margin. After that, it either continues to under extrude for the rest of the print or it will go back to extruding proper amounts of filament with no problem. This destroys the print and makes it both structurally weak and defective. I am wasting quite a bit of PLA trying to fix this problem so any help would be appreciated.</p>
<p>Here is what I have done so far:</p>
<ul>
<li><p>I first made sure that the hobbed gear is clean.</p></li>
<li><p>I tried extruding the filament with a very hot temp (240C) there were no problems here and the filament extruded fine albeit, it was not on the bed, just extruding into the air to see if the problem was heat. </p></li>
<li><p>I tried the same thing as above but with a low temp (180) this also proved just fine again extruding in the air.</p></li>
<li><p>I calibrated my E steps per mm, those are fine and accurate.</p></li>
<li><p>I tried increasing my flow rate to 118%</p></li>
<li><p>I tried switching to a different nozzle</p></li>
<li><p>I tried switching to a different hobbed gear</p></li>
<li><p>I tried switching the mechanism that pushes the filament up against the hobbed gear</p></li>
</ul>
<p>That's about it. Not sure where to go from here so if anyone out there can think of anything I missed, I would love to hear it!</p>
<p>EDIT 1:</p>
<p>As per @fred_dot_u asked, the elapsed time at the layer of failure is roughly four hours in. I have also attached a picture of one example of this kind of failure below. I would also like to mention that this is happening on several of these printers as I have 18 printers running in one room. Our current theory is that the power draw is simply too high and so the printers are not getting the heat they need, however, the thermistors still register a solid 195C on my printers that are currently running.</p>
<p><a href="https://i.stack.imgur.com/c7D32.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/c7D32.jpg" alt="side of building with layer underextrusion"></a></p>
<p>EDIT 2:
Here is another picture of a different model with the same layer failure problem but at a lower layer height. This model was printed along with 11 other identical models on the same bed, all of which failed at the same height.
<a href="https://i.stack.imgur.com/bb3g2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bb3g2.jpg" alt="Model with layer failure at a different height"></a></p>
|
<p>It seems I misread your question. </p>
<h2>3D Printed Mold</h2>
<p>You were asking about (or the question now states) use of a mold release compound to prevent a molded part from sticking to a 3d print mold.</p>
<p>Yes. It is always beneficial for the molded part to not stick to the mold. Easy separation and part removal is important for the life of the mold and for the surface finish of the part.</p>
<p>There are two molding situations that seem important. </p>
<h2>Flexible Mold or Object</h2>
<p>In the first, either the part of the mold is elastic, so the actual sliding of one surface on the other isn't important. Here, a mold release agent would help by preventing the cast object from binding to the mold material.</p>
<h2>Stiff Mold and Object</h2>
<p>The second case is where both the mold and the object are stiff, and the object must slide out of the mold. Here the layer lines should be considered, since there may, locally, be reverse draft angles where the larger part can not slip past an obstructing filament line. Using a process that doesn't leave filament lines, or using the thinnest possible filament layers, or smoothing the mold internal surfaces, or possibly filling the spaces between the ridges with another material may eliminate the problem. A "mold release agent" would still be used to reduce the attachment of the object to the mold, although one may be able to use ample release agent both to fill the groves in the mold and prevent adhesion.</p>
|
<p>Welcome to the 3D Printing Stack Exchange site.</p>
<h2>Used in Casting</h2>
<p>A mold release agent is commonly used when a part is cast. The release agent is placed on the inside of the mold before the liquid object is added. As the object becomes solid, the release agent prevents the object from adhering to the mold. As a result, the objects are easier to pop out of the mold, and in some processes, the mold can be reused.</p>
<h2>3D Printing is Different</h2>
<p>A mold release agent is used to allow the desired part to be separated from the mold. In FDM (thin plastic extrusions bonding together into objects) 3D printing, the object is surrounded by air, except for the bottom where the object contacts the print bed.</p>
<h2>Bed Adhesion</h2>
<p>For most materials, getting the bottom of the object to stick firmly enough is the problem faced, rather than making it easy to remove. In many cases, a compound is placed on the top of the bed to help the plastic stick to the bed. It is a "mode adhesion agent" rather than a release agent.</p>
<p>For some combinations of materials, the bed material and the plastic have a particularly strong adhesion, such that it can be difficult to remove the object without damaging the bed surface. Notably, this occurs with a PEI bed and PETG plastic. In this and similar cases, the mold adhesion agents can be used on the bed. This slightly separates the plastic from the bed material, and we can avoid bed damage.</p>
<h2>Internal Adhesion</h2>
<p>With multimaterial printers becoming more common, there are cases where two parts which might touch and stich during printing should be isolated during the printing process. A second (or third) material can be used to isolate the parts. If the isolation material is sufficiently different from the desired objects, it can be removed by a solvent.</p>
<p>This approach is limited to cases where the objects should be separated by at least one printer thickness of the soluble material.</p>
| 1,460
|
<p>I am Attempting to print this, from Blender
<a href="https://i.stack.imgur.com/kKdun.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kKdun.jpg" alt="enter image description here"></a>
But Cura decides to fill in the middle part of the model.
<a href="https://i.stack.imgur.com/1fj3T.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1fj3T.png" alt="enter image description here"></a>
I exported and imported the model from an STL file.</p>
<p>If anyone can answer this, that would be greatly appreciated.</p>
|
<p>Try disabling the "Union Overlapping Volumes" option on Mesh Fixes section. Worked for me.</p>
|
<p>I would recommend using an actual CAD/CAM program, such as Autodesk Fusion 360, instead of using a 3d model program. Not only will this be able to directly export you finished model to Cura, and the models are made in a way that works with a 3d printing slicer, there will be more help around 3D printing for it.</p>
<p>Although it is slightly difficult to use to start with, as you become more proficient, it is a very powerful tool to have. . Fusion 360 is free for hobbyists or students. See this link for help activating: <a href="https://www.autodesk.com/campaigns/fusion-360-for-hobbyists" rel="nofollow noreferrer">https://www.autodesk.com/campaigns/fusion-360-for-hobbyists</a>.</p>
<p>Another option would be SolidWorks, although you do have to pay for this option, but it is much simpler to work with in my opinion.</p>
| 1,593
|
<p>I'm working on porting a Visual C++ application to GCC (should build on MingW and Linux).</p>
<p>The existing code uses <code>__try { ... } __except(1) { ... }</code> blocks in a few places so that almost nothing (short of maybe out of memory type errors?) would make the program exit without doing some minimal logging.</p>
<p>What are the options for doing something similar with GCC?</p>
<p>Edit: Thanks for the pointer to /EH options in Visual Studio, what I need now is some examples on how to handle signals on Linux. I've found <a href="http://gcc.gnu.org/ml/gcc-help/2002-04/msg00003.html" rel="nofollow noreferrer">this message</a> from 2002.</p>
<p>What other signals besides <code>SIGFPE</code> and <code>SIGSEVG</code> should I watch out for? (Mostly care about ones that might be raised from <em>me</em> doing something wrong)</p>
<p><strong>Bounty Information</strong>:
I want my application to be able to self-log as many error conditions as possible before it exits. </p>
<p>What signals might I get and which would generally be impossible to log an error message after? (Out of memory, what else?)</p>
<p>How can I handle exceptions and (most importantly) signals in a portable way that the code at least works the same on Linux and MingW. #ifdef is OK.</p>
<p>The reason I don't just have a wrapper process that logs the failure is that for performance reasons I save writing some data to disk till the last minute, so if something goes wrong I want to make all possible attempts to write the data out before exiting.</p>
|
<p>try { xxx } catch(...) { xxx } would be more portable but might not catch as much. It depends on compiler settings and environments.</p>
<p>Using the default VC++ settings, asynchronous (SEH) errors are not delivered to the C++ EH infrastructure; to catch them you need to use SEH handlers (__try/__except) instead. VC++ allows you to route SEH errors through C++ error-handling, which allows a catch(...) to trap SEH errors; this includes memory errors such as null pointer dereferences. <a href="http://msdn.microsoft.com/en-us/library/1deeycx5.aspx" rel="noreferrer">Details</a>.</p>
<p>On Linux, however, many of the errors that Windows uses SEH for are indicated through signals. These are not ever caught by try/catch; to handle them you need a signal handler.</p>
|
<p>One way that is easy to use, portable, and barely use any resources would be to catch empty classes. I know this may sound odd at first, but it can be very useful.</p>
<p>Here is an example I made for another question that applies for your question too: <a href="https://stackoverflow.com/questions/556255/how-to-throw-good-exceptions/1081443#1081443">link</a></p>
<p>Also, you can have more than 1 catch:</p>
<pre><code>try
{
/* code that may throw exceptions */
}
catch (Error1 e1)
{
/* code if Error1 is thrown */
}
catch (Error2 e2)
{
/* code if Error2 is thrown */
}
catch (...)
{
/* any exception that was not expected will be caught here */
}
</code></pre>
| 6,027
|
<p>I would like to print fancy plastic cutlery sets or plastic glasses.</p>
<p>Is it safe to do it? Or bad for your health, if so, why?</p>
|
<p>As others have pointed out, PLA isn't specifically not food safe, but materials that have been printed previously can contaminate the PLA.</p>
<p>Additionally, anything 3D printed is extremely porous. Once a part is used for food, moisture and bacteria will accumulate in the pores, and can never be completely cleaned out, contaminating any food that contacts it. It can't be sterilized either, because the temperatures needed for sterilization would deform or melt the plastic.</p>
|
<p>Having performed a quick search through all the resources at the FDA Food Contact Substance resource, I cannot find PLA in any list except an occasional notification that a specific manufacturer has obtained approval for use in specific circumstances, with the notice that such notifications are only valid for that manufacturer and cannot be used to validate another use of a substance.</p>
<p>There are companies that have received approval for their specific formulation and use of PLA as a food contact substance. You may wish to discuss this further with your material supplier to find out if they have approved PLA product available.</p>
<p>Without specific product approval, though, PLA is not on the lists of generally recognized as safe, nor approved for food contact use.</p>
<p>Regulations in other countries may differ, so you may want to search the EU directives, for instance, to find out their opinion on PLA as an FCS.</p>
| 120
|
<p>Is it possible to open a project in Visual Studio 2008 without opening all the files that were previously opened last time I had the project open. I have a habit of keeping many files open as I am working on them, so next time I open the project, it (very slowly) loads up a bunch of files into the editor that I may not even need open. I have searched through the settings and cannot find anything to stop this behavior. </p>
|
<p>Simply delete the .suo file.
It contains the list of open files.</p>
|
<p>The only way works for me is : change the project location and again reopen the solutions form there. :)</p>
| 3,679
|
<p>Not storing left-over photopolymer resin back with pristine resin in its original shipping can seems to be a common recommendation.</p>
<p>What is the best practice here? Store in a separate bottle and pour this "once around the block" resin first for the next print?</p>
|
<h2>Safety first</h2>
<p>I suggest the following handling of resins, some basic stuff first:</p>
<ul>
<li><strong>ALWAYS</strong> wear disposable, one-use gloves when handling resin.</li>
<li>Respirators are highly advised to be worn.</li>
<li>Work in a well-ventilated area.</li>
<li>Tools dedicated to resin handling are for resin only to prevent contamination of other tools.</li>
<li>Try to minimize the amount added to the vat, so you have as little rests as possible.</li>
</ul>
<h2>Re-cycling</h2>
<p>Now, what to do to get the used resin back to the cycle? Any resin that has been exosed to air and light, such as having been in the vat is best considered to be B-Quality. You can use it to cast greeblies or bits (aka disposal by curing), as one would do with leftover casting (2-component) resin, but that is a waste.</p>
<h3>Step 1: Re-botteling</h3>
<p>So, let's look at some better ways: first of all re-botteling the resin. We need to take in mind, that the quality of our resin will further degrade the longer it stays exposed to light (and to a lesser degree: air), so we need to handle the resin in a way that allows us to eliminate exposition to either. For this, it would be best to keep an empty resin bottle at hand and label it as the leftover bottle. To fill this bottle, you should use a <a href="https://www.thingiverse.com/search?q=resin%20vat&type=things&sort=relevant" rel="nofollow noreferrer">Jig</a> to keep the vat in a position that it pours into the bottle. You might want to use a funnel in some cases!</p>
<h2>Step 2: Re-conditioning</h2>
<p>Now, we know how to get the stuff back into the (B-quality) bottle. But how to make sure it has the best quality we can? As you notice, many of the jigs involve a funnel. This funnel is used in conjunction with a filter to remove larger particles. The finer the filter, the better. <a href="https://en.wikipedia.org/wiki/Coffee_filter#Paper_filter" rel="nofollow noreferrer">Coffee filters</a> manage to snatch particles down to about 10 to 15 micrometers. It is equivalent to about Grade 4 laboratory filter paper. However, laboratory filter paper of <a href="https://en.wikipedia.org/wiki/Filter_paper#Qualitative_filter_paper" rel="nofollow noreferrer">grades 1,2,3 or 602h</a> would allow to catch particles of even lower size, as the mesh gets even smaller, but might clog faster. Tea filters on the other hand have worse filtration ability and should be avoided.</p>
<p>To get the best out of it, use a filtration stack, that starts with a metal mesh filter before going through a rough and a fine filter to get out any chunks and large particles that would clog the fine filter.</p>
<p>It would be best to have this process run in the dark, so mounting the dripping and filtration stack in a box might first sound like overkill, but if you go through a large amount of resin (for example by running several printers) it might be an investment that can save a considerable amount of resin in the long run. However, if you run so many printers, you also might run them continually with the same resin colors and just refill them as needed and only filter if there had been a print failure.</p>
<h2>Step 3: Storage</h2>
<p>Store your bottles in a closed cupboard. It would be best if this cupboard is ventilated through a filtration unit and then outside. It should also keep a steady temperature above about 10 °C to prevent clumping. Just follow the storage manual for the normal resin actually.</p>
<h2>Step 4: Re-use</h2>
<p>Now comes the tricky part: re-using the resin. While technically the filtered and re-bottled resin should be almost as good as new, it would be best to make sure that we mix it with some virgin resin to make sure we have enough photoinitiator in the resin. For this, I would suggest mixing the recycled resin with between a sixth and half of the fresh stuff. Mix the two well to make sure you get the best possible. Make sure it's the same type and color of the used resin, best even from the same original batch.</p>
<p>Use up the re-cycled resin first, as you should consider it's best before date much shorter than on the virgin bottle.</p>
|
<p>Considerations for storing resin include using a light-tight bottle, preventing stray ultraviolet radiation from prematurely curing the resin.</p>
<p>You'll also note that users will filter the resin through a fine mesh filter. I've seen some videos in which the user pours through coffee filters to remove as many particulates as possible.</p>
<p>Left-over resin that has been carefully filtered is effectively the same as fresh-from-the-bottle material, from a purely technical view, but you can pick up contaminants that bypass the filter.</p>
| 1,752
|
<p>Please, now that I've re-written the question, and before it suffers from further <a href="https://stackoverflow.com/questions/56103/fastest-gun-in-the-west-problem">fast-gun answers</a> or premature closure by <a href="https://stackoverflow.com/users/905/keith">eager editors</a> let me point out that this is not a duplicate of <a href="https://stackoverflow.com/questions/9673/remove-duplicates-from-array">this question</a>. I know how to remove duplicates from an array.</p>
<p>This question is about removing <strong>sequences</strong> from an array, not duplicates in the strict sense.</p>
<p>Consider this sequence of elements in an array;</p>
<pre><code>[0] a
[1] a
[2] b
[3] c
[4] c
[5] a
[6] c
[7] d
[8] c
[9] d
</code></pre>
<p>In this example I want to obtain the following...</p>
<pre><code>[0] a
[1] b
[2] c
[3] a
[4] c
[5] d
</code></pre>
<p>Notice that duplicate elements are retained but that sequences of the same element have been reduced to a single instance of that element.</p>
<p>Further, notice that when two lines repeat they should be reduced to one set (of two lines).</p>
<pre><code>[0] c
[1] d
[2] c
[3] d
</code></pre>
<p>...reduces to...</p>
<pre><code>[0] c
[1] d
</code></pre>
<p>I'm coding in C# but algorithms in any language appreciated.</p>
|
<p>Here's C# app i wrote that solves this problem.</p>
<p><strong>takes</strong><br>
aabccacdcd </p>
<p><strong>outputs</strong><br>
abcacd </p>
<p>Probably looks pretty messy, took me a bit to get my head around the dynamic pattern length bit.</p>
<pre><code>class Program
{
private static List<string> values;
private const int MAX_PATTERN_LENGTH = 4;
static void Main(string[] args)
{
values = new List<string>();
values.AddRange(new string[] { "a", "b", "c", "c", "a", "c", "d", "c", "d" });
for (int i = MAX_PATTERN_LENGTH; i > 0; i--)
{
RemoveDuplicatesOfLength(i);
}
foreach (string s in values)
{
Console.WriteLine(s);
}
}
private static void RemoveDuplicatesOfLength(int dupeLength)
{
for (int i = 0; i < values.Count; i++)
{
if (i + dupeLength > values.Count)
break;
if (i + dupeLength + dupeLength > values.Count)
break;
var patternA = values.GetRange(i, dupeLength);
var patternB = values.GetRange(i + dupeLength, dupeLength);
bool isPattern = ComparePatterns(patternA, patternB);
if (isPattern)
{
values.RemoveRange(i, dupeLength);
}
}
}
private static bool ComparePatterns(List<string> pattern, List<string> candidate)
{
for (int i = 0; i < pattern.Count; i++)
{
if (pattern[i] != candidate[i])
return false;
}
return true;
}
}
</code></pre>
<p><em>fixed the initial values to match the questions values</em></p>
|
<p>I agree that if you can just dump the strings into a Set, then that might be the easiest solution. </p>
<p>If you don't have access to a Set implementation for some reason, I would just sort the strings alphabetically and then go through once and remove the duplicates. How to sort them and remove duplicates from the list will depend on what language and environment you are running your code. </p>
<p>EDIT: Oh, ick.... I see based on your clarification that you expect that patterns might occur even over separate lines. My approach won't solve your problem. Sorry. Here is a question for you. If I had the following file.</p>
<p>a</p>
<p>a</p>
<p>b</p>
<p>c</p>
<p>c</p>
<p>a</p>
<p>a</p>
<p>b</p>
<p>c</p>
<p>c</p>
<p>Would you expect it to simplify to </p>
<p>a</p>
<p>b</p>
<p>c</p>
| 8,121
|
<p>I have built a basic data entry application allowing users to browse external content in iframe and enter data quickly from the same page. One of the data variables is the URL.
Ideally I would like to be able to load the iframes current url into a textbox with javascript. I realize now that this is not going to happen due to security issues.</p>
<p>Has anyone done anything on the server side? or know of any .Net browser in browser controls. The ultimate goal is to just give the user an easy method of extracting the url of the page they are viewing in the iframe It doesn't necessarily HAVE to be an iframe, a browser in the browser would be ideal.</p>
<p>Thanks,
Adam</p>
|
<p>I did some tests in Firefox 3 comparing the value of <code>.src</code> and <code>.documentWindow.location.href</code> in an <code>iframe</code>. (Note: The <code>documentWindow</code> is called <code>contentDocument</code> in Chrome, so instead of <code>.documentWindow.location.href</code> in Chrome it will be <code>.contentDocument.location.href</code>.)</p>
<p><code>src</code> is always the last URL that was loaded in the iframe without user interaction. I.e., it contains the first value for the URL, or the last value you set up with Javascript from the containing window doing:</p>
<pre><code>document.getElementById("myiframe").src = 'http://www.google.com/';
</code></pre>
<p>If the user navigates inside the iframe, you can't anymore access the value of the URL using src. In the previous example, if the user goes away from www.google.com and you do:</p>
<pre><code>alert(document.getElementById("myiframe").src);
</code></pre>
<p>You will still get "<a href="http://www.google.com" rel="noreferrer">http://www.google.com</a>".</p>
<p><code>documentWindow.location.href</code> is only available if the iframe contains a page in the same domain as the containing window, but if it's available it always contains the right value for the URL, even if the user navigates in the iframe.</p>
<p>If you try to access <code>documentWindow.location.href</code> (or anything under <code>documentWindow</code>) and the iframe is in a page that doesn't belong to the domain of the containing window, it will raise an exception:</p>
<pre><code>document.getElementById("myiframe").src = 'http://www.google.com/';
alert(document.getElementById("myiframe").documentWindow.location.href);
Error: Permission denied to get property Location.href
</code></pre>
<p>I have not tested any other browser.</p>
<p>Hope it helps!</p>
|
<p>Does this help? </p>
<p><a href="http://www.quirksmode.org/js/iframe.html" rel="nofollow noreferrer">http://www.quirksmode.org/js/iframe.html</a></p>
<p>I only tested this in firefox, but if you have something like this:</p>
<pre><code><iframe name='myframe' id='myframe' src='http://www.google.com'></iframe>
</code></pre>
<p>You can get its address by using:</p>
<pre><code>document.getElementById('myframe').src
</code></pre>
<p>Not sure if I understood your question correctly but anyways :)</p>
| 6,610
|
<p>I am having some trouble with the <a href="http://code.google.com/apis/maps/documentation/reference.html" rel="nofollow noreferrer">Google Maps API</a>. I have an array which holds a ojbect I created to store points.</p>
<p>My array and class:</p>
<pre><code>var tPoints = [];
function tPoint(name) {
var id = name;
var points = [];
var pointsCount = 0;
...
this.getHeadPoint = function() { return points[pointsCount-1]; }
}
</code></pre>
<p>tPoint holds an array of <a href="http://code.google.com/apis/maps/documentation/reference.html#GLatLng" rel="nofollow noreferrer">GLatLng</a> points. I want to write a function to return a <a href="http://code.google.com/apis/maps/documentation/reference.html#GLatLngBounds" rel="nofollow noreferrer">GLatLngBounds</a> object which is extended from the current map bounds to show all the HeadPoints.</p>
<p>Heres what I have so far..</p>
<pre><code>function getBounds() {
var mBound = map.getBounds();
for (var i = 0; i < tPoints.length; i++) {
alert(mBound.getSouthWest().lat() + "," + mBound.getSouthWest().lng());
alert(mBound.getNorthEast().lat() + "," + mBound.getNorthEast().lng());
currPoint = trackMarkers[i].getHeadPoint();
if (!mBound.containsLatLng(currPoint)) {
mBound.extend(currPoint);
}
}
return mBound;
}
</code></pre>
<p>Which returns these values for the alert. (Generally over the US)<br /></p>
<blockquote>
<p>"19.64258,NaN"<br /> "52.69636,NaN"<br /> "i=0"<br />
"19.64258,NaN"<br /> "52.69636,-117.20701"<br /> "i=1"<br /></p>
</blockquote>
<p>I don't know why I am getting NaN back.
When I use the bounds to get a zoom level I think the NaN value is causing the map.getBoundsZoomLevel(bounds) to return 0 which is incorrect. Am I using <a href="http://code.google.com/apis/maps/documentation/reference.html#GLatLngBounds" rel="nofollow noreferrer">GLatLngBounds</a> incorrectly?</p>
|
<p>Maybe a CLR stored procedure is what you are looking for. These are generally used when you need to interact with the system in some way.</p>
|
<p>I still believe that a CLR procedure might be the best bet. So, I'm accepting that answer. However, either I'm not that bright or it's extremely difficult to implement. Our SQL Server service is running under a local account because, according to Mircosoft, that's the only way to get an iSeries linked server working from a 64-bit SQL Server 2005 instance. When we change the SQL Server service to run with a domain account, the xp_fileexist command works fine for files located on the network.</p>
<p>I created this CLR stored procedure and built it with the permission level set to External and signed it:</p>
<pre><code>using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.Security.Principal;
public partial class StoredProcedures
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void FileExists(SqlString fileName, out SqlInt32 returnValue)
{
WindowsImpersonationContext originalContext = null;
try
{
WindowsIdentity callerIdentity = SqlContext.WindowsIdentity;
originalContext = callerIdentity.Impersonate();
if (System.IO.File.Exists(Convert.ToString(fileName)))
{
returnValue = 1;
}
else
{
returnValue = 0;
}
}
catch (Exception)
{
returnValue = -1;
}
finally
{
if (originalContext != null)
{
originalContext.Undo();
}
}
}
}
</code></pre>
<p>Then I ran these TSQL commands:</p>
<pre><code>USE master
GO
CREATE ASYMMETRIC KEY FileUtilitiesKey FROM EXECUTABLE FILE = 'J:\FileUtilities.dll'
CREATE LOGIN CLRLogin FROM ASYMMETRIC KEY FileUtilitiesKey
GRANT EXTERNAL ACCESS ASSEMBLY TO CLRLogin
ALTER DATABASE database SET TRUSTWORTHY ON;
</code></pre>
<p>Then I deployed CLR stored proc to my target database from Visual Studio and used this TSQL to execute from SSMS logged in with windows authentication:</p>
<pre><code>DECLARE @i INT
--EXEC FileExists '\\\\server\\share\\folder\\file.dat', @i OUT
EXEC FileExists 'j:\\file.dat', @i OUT
SELECT @i
</code></pre>
<p>Whether I try a local file or a network file, I always get a 0. I may try again later, but for now, I'm going to try to go down a different road. If anyone has some light to shed, it would be much appreciated.</p>
| 3,736
|
<p>I am building a custom win32 control/widget and would like to change the cursor to a horizontal "splitter" symbol when hovering over a particular vertical line in the control. IE: I want to drag this vertical line (splitter bar) left and right (WEST and EAST).</p>
<p>Of the the system cursors (OCR_*), the only cursor that makes sense is the OCR_SIZEWE. Unfortunately, that is the big, awkward cursor the system uses when resizing a window. Instead, I am looking for the cursor that is about 20 pixels tall and around 3 or 4 pixel wide with two small arrows pointing left and right.</p>
<p>I can easily draw this and include it as a resource in my application but the cursor itself is so prevalent that I wanted to be sure it wasn't missing something.</p>
<p>For example: when you use the COM drag and drop mechanism (CLSID_DragDropHelper, IDropTarget, etc) you implicitly have access to the "drag" icon (little box under the pointer). I didn't see an explicit OCR_* constant for this guy ... so likewise, if I can't find this splitter cursor outright, I am wondering if it is part of a COM object or something else in the win32 lib.</p>
|
<p>There are all sorts of icons, cursors, and images in use throughout the Windows UI which are not publicly available to 3rd-party software. Of course, you could still load up the module in which they reside and use them, but there's really no guarantee your program will keep working after a system update / upgrade. </p>
<p>Include your own. The last thing you want is adding an extra dependency over a tiny little cursor.</p>
|
<p>I had this exact problem. When I looked back over some old code for a vertical splitter thinking I had an easy answer, it turned out that I had build and loaded my own resource:</p>
<pre>
SetCursor( LoadCursor( ghInstance, "IDC_SPLITVERT" ));
</pre>
<p>I vaguely remember investing some considerable time and effort into find the system way of doing it, so (my guess) is that there is not a system ICON readily available to do the job, so you are better off rolling your own.</p>
<p>This is one of those times when I would like to be wrong, as I would have liked there to be a system icon for this job.</p>
| 6,983
|
<p>I get an Access is Denied error message when I use the strong name tool to create a new key to sign a .NET assembly. This works just fine on a Windows XP machine but it does not work on my Vista machine.</p>
<pre><code>PS C:\users\brian\Dev\Projects\BELib\BELib> sn -k keypair.snk
Microsoft (R) .NET Framework Strong Name Utility Version 3.5.21022.8
Copyright (c) Microsoft Corporation. All rights reserved.
Failed to generate a strong name key pair -- Access is denied.
</code></pre>
<p>What causes this problem and how can I fix it?</p>
<hr>
<blockquote>
<p>Are you running your PowerShell or
Command Prompt as an Administrator? I
found this to be the first place to
look until you get used to User Access
Control or by turning User Access
Control off.</p>
</blockquote>
<p>Yes I have tried running PS and the regular command prompt as administrator. The same error message comes up.</p>
|
<blockquote>
<p>Yes I have tried running PS and the
regular command prompt as
administrator. The same error message
comes up.</p>
</blockquote>
<p>Another possible solution could be that you need to give your user account access to the key container located at C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys</p>
|
<p>Are you running your PowerShell or Command Prompt as an Administrator? I found this to be the first place to look until you get used to User Access Control or by turning User Access Control off.</p>
| 3,300
|
<p>We have, now, assertained that <em>inlined videos</em> (for want of a better description) are currently turned off (disabled) for SE 3D Printing, but can be turned on at any time, and there is no need to wait for the site to exit Beta, see <a href="https://3dprinting.meta.stackexchange.com/questions/226/is-the-inlining-videos-capability-turned-off-on-this-site">Is the "inlining videos" capability turned off on this site?</a></p>
<p>The question now is, should we enable it?</p>
<p>I have seen a few (2?) cases where the OP has linked to a video in order to succinctly describe their issue. As Ecnerwal points out in <a href="https://3dprinting.stackexchange.com/questions/4153/help-understanding-bridge-settings#answer-4157">their answer</a> to <a href="https://3dprinting.stackexchange.com/questions/4153/help-understanding-bridge-settings">Help understanding bridge settings</a>, watching videos, and in particular having to click on a link to watch them, can be somewhat onerous. Having the video inlined, <em>might</em> make it less so.</p>
<p>BTW, I don't know what [backend or UX] disadvantages there would be to switching it on, although there are these <a href="http://3dprinting.meta.stackexchange.com/questions/226/is-the-inlining-videos-capability-turned-off-on-this-site#answer-400">cautionary tales</a>.</p>
|
<p>Per answer to <a href="https://meta.stackexchange.com/questions/296832/what-are-the-limitations-in-beta">What are the limitations in Beta</a></p>
<p>"Inline videos is a feature that is off by default on all sites and only turned on if the community thinks it's necessary to improve the quality of a good portion of their question base." </p>
|
<p>A note of caution, <a href="https://stackoverflow.com/c/moderators/questions/257#answer-261">this post</a> on the Stack Moderators site, Pᴀᴜʟsᴛᴇʀ2's post, <a href="https://stackoverflow.com/c/moderators/questions/257">How do you request embedded video for your site?</a> - As mods can only follow these links I've included the content below:</p>
<blockquote>
<p>I don't know how exactly to request it, but I do want to point at one
pretty big downside.</p>
<p><strong>The player is pretty darn big.</strong> Plus, my experience is that it has a tendency to eat CPU cycles for breakfast.</p>
<p>I looked at the numbers <a href="https://space.meta.stackexchange.com/questions/883/are-there-ways-to-make-posts-with-images-better-for-low-connect-speed-users-doe/885#comment3547_885">about a year ago over on Space Exploration
Meta</a>.
What I found was:</p>
<blockquote>
<p>Loading <a href="https://space.stackexchange.com/q/21891/415">https://space.stackexchange.com/q/21891/415</a> without using the browser cache downloads 7642 KB for me just now. Of that,
<code>www.youtube.com</code> is responsible for 3182 KB and <code>i.stack.imgur.com</code>
another 2729 KB. Excluding just the embedded images and the
video-related downloads leaves about 1.7 MB to be downloaded. That's
still a sizable chunk of data for what basically amounts to a few
pages of text, but not quite as extreme as 7.6 MB.</p>
</blockquote>
<p>So one video embed adds about 3 MB download for everyone viewing the
post, regardless of whether or not they are in any way interested in
the video. (I think the video itself is downloaded on demand, so if
someone actually watches the video, that adds even more data, but at
that point at least they have some interest in it.) In situations
where connections are metered by the megabyte, this can add up
quickly, and is something that should be kept in mind before turning
on this feature. Not everyone is on a fast,
no-extra-charge-per-megabyte connection.</p>
<p>(Yes, I'm big on keeping text as mostly text. I'm old-fashioned in
that regard.)</p>
</blockquote>
<p>Also <a href="https://stackoverflow.com/c/moderators/questions/257#answer-260">this post</a>:</p>
<blockquote>
<blockquote>
<p>Are there any downsides to having embedded video (performance or otherwise)?</p>
</blockquote>
<p>Yep, <a href="https://meta.stackexchange.com/a/279637/295232">performance could be an issue</a>. Also, malicious users could post links to videos with ... questionable ... content (though this could be alleviated by requiring some reputation to post embedded videos, just as some sites do with pictures).</p>
</blockquote>
| 42
|
<p>How does one start development in Silverlight?</p>
<p>Does one need a new IDE? or Visual studio will support?</p>
|
<p>Yes there is tooling support for Visual Studio. It is still in Beta though.</p>
<p><a href="http://silverlight.net/GetStarted/" rel="nofollow noreferrer">Get Started Building Silverlight 2 Applications</a></p>
<p>1) Install Visual Studio 2008 then Install Silverlight Tools Beta 2 for Visual Studio 2008
This add-on to Visual Studio 2008 allows you to use .NET to create Silverlight 2 Beta 2 Web sites. The Silverlight 2 Beta 2 Runtime and the Silverlight 2 Beta 2 SDK are installed as part of this install. For additional information read the overview and the Silverlight 2 Beta 2 Readme Notes. Note if you have Visual Studio 2008 Service Pack 1 Beta installed, please see this information for details on installing correctly. </p>
<p>2) Install Expression Blend 2.5 June 2008 Preview
This is a preview version of Expression Blend for designing Silverlight 2 experiences. </p>
<p>3) Install Deep Zoom Composer
This tool allows you to prepare your images for use with the Deep Zoom feature in Silverlight 2. </p>
<p>One thing to watch out for is that Silverlight does not support Synchronous calls to the server. All calls are <a href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-3-using-networking-to-retrieve-data-and-populate-a-datagrid.aspx" rel="nofollow noreferrer">Asynchronous</a> as of <a href="http://petesbloggerama.blogspot.com/2008/07/omg-silverlight-asynchronous-is-evil.html" rel="nofollow noreferrer">this Beta</a>.</p>
|
<p>Dan Wahlin has some good Silverlight 2 videos at:</p>
<p><a href="http://weblogs.asp.net/dwahlin/archive/2008/03/07/silverlight-2-0-video-tutorials.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/dwahlin/archive/2008/03/07/silverlight-2-0-video-tutorials.aspx</a></p>
<p>They are quite helpful.</p>
<p>rp</p>
| 8,554
|
<p>I'm aware of <a href="http://www.fusioncharts.com/" rel="noreferrer">FusionCharts</a>, are there other good solutions, or APIs, for creating charts in Adobe Flash?</p>
|
<p>Is there a reason that you want it in Flash? If a plain, old PNG will work, try the <a href="http://code.google.com/apis/chart/" rel="noreferrer">Google Chart API</a>.</p>
|
<p>Adobe's data visualization package is now free after the release of Flash Builder 4.</p>
<p>Charting and other libraries are on this site - <a href="http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4" rel="nofollow noreferrer">http://opensource.adobe.com/wiki/display/flexsdk/Download+Flex+4</a></p>
| 2,468
|
<p>With the <em>Visual Studio 2005 C++ compiler</em>, I get the following warning when my code uses the <code>fopen()</code> and such calls:</p>
<pre class="lang-none prettyprint-override"><code>1>foo.cpp(5) : warning C4996: 'fopen' was declared deprecated
1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(234) : see declaration of 'fopen'
1> Message: 'This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
</code></pre>
<p>How do I prevent this?</p>
|
<p>It looks like Microsoft has deprecated lots of calls which use buffers to improve code security. However, the solutions they're providing aren't portable. Anyway, if you aren't interested in using the secure version of their calls (like <strong>fopen_s</strong>), you need to place a definition of <strong>_CRT_SECURE_NO_DEPRECATE</strong> before your included header files. For example:</p>
<pre><code>#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
</code></pre>
<p>The preprocessor directive can also be added to your project settings to effect it on all the files under the project. To do this add <strong>_CRT_SECURE_NO_DEPRECATE</strong> to <em>Project Properties -> Configuration Properties -> C/C++ -> Preprocessor -> Preprocessor Definitions</em>.</p>
|
<p>I also got the same problem. When I try to add the opencv library</p>
<pre><code>#include <opencv\cv.h>
</code></pre>
<p>I got not a warning but an error.</p>
<pre><code>error C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. c:\program files (x86)\opencv\build\include\opencv2\flann\logger.h
</code></pre>
<p>I also used the preprocessor directives as mentioned. But that didn't solve the problem.</p>
<p>I solved it by doing as follows:</p>
<ul>
<li><strong>Go to Properties -> C/C++ -> Precompiled Headers -> Choose Not Using Precompiled Headers in Precompiled Header.</strong></li>
</ul>
| 3,516
|
<p>I want to catch all unhandled exceptions thrown in a remote object on <em>the server</em> and log them there before I translate them into some custom exception so that specific exceptions do not cross the client/server boundary.</p>
<p>I think I have to use a custom channel sync, but can anyone confirm this and/or have any other advice to give? </p>
|
<p>I would use the Microsoft Enterprise Library Exception Handling app block -- it lets you handle errors and convert specific types of exception to a different type of exception before rethrowing to the client.</p>
|
<p>I would use the Microsoft Enterprise Library Exception Handling app block -- it lets you handle errors and convert specific types of exception to a different type of exception before rethrowing to the client.</p>
| 6,429
|
<p>Did you ever have to choose between WISA or LAMP at the beginning of a web project?</p>
<p>While pros and cons are littered around the net, it would be helpful to know about your real experience in coming up w/ criteria, evaluating, deciding, and reflecting upon your decision to go w/ either platform.</p>
|
<p>I think the first part is your Application. If you decide to go PHP, you almost automatically end up with LAMP, as WIMP or WISP stacks are quite rare (I think blog.stackoverflow.com runs on WIMP), and with .net you definitely want to go WISA.</p>
<p>So normally, it boils down to .net vs. PHP. (Ignoring Ruby, Python and all the other stuff for a moment). When you made that decision, the rest comes naturally or adapts into your environment (i.e. if all your admins in the company are windows admins, maybe WAMP works better for you)</p>
<p>I switched from PHP to .net about a year ago and I never looked back at PHP, but I never had to look at the bill for Windows and SQL Server licenses to be fair. Deployment on WISA has a much higher initial cost due to the licenses involved, whereas a LAMP Stack is free (Yes, MySQL is also free for commercial use).</p>
<hr>
<p>Addendum:<br>
All the funny acronyms stand for the combination of technologies: (L)inux or (W)indows, (A)pache or (I)IS, (M)ySQL or (S)QL Server, (P)hp or (A)SP.net.</p>
|
<p>I think the team is the biggest issue. WISA isn't universally worse or better than LAMP for any particular job. My expertize is in LAMP. I have very little experience with WISA, so I would never pick it. </p>
<p>It's more along the lines of photography -- if all your lenses were Canon's, why would you buy a Nikon body for a big gig?</p>
| 4,306
|
<p>I want to enable an user to be able to communicate with other users through a site. I know that ASP.net is stateless, but what can I use for this synced communication? Java servlets?</p>
|
<p>I don't think you need to set up Java just to use a servlet for this. I would use AJAX and the database. I don't know ASP.NET but I PHP is similar in this case, being also basically "stateless". If you want to display some kind of asynchronous communication between two different users, say, from two different sessions, without a lot of refreshing (like chat), you can have the AJAX page constantly poll the database for new messages, and display them when they come in. You can also use AJAX to insert the new messages, giving the user read/write access to this messages data structure. Since the "other" user is doing the same thing, user A should see new messages pop up when user B types them in.</p>
<p>Is that what you mean?</p>
|
<p>ASP.NET is "stateless" but it maintains state using Sessions. You can use them by default just using the Session[] keyword. </p>
<p>Look at <a href="http://msdn.microsoft.com/en-us/library/ms972429.aspx" rel="nofollow noreferrer">ASP.NET Session State</a> for some details from Microsoft.</p>
| 5,754
|
<p>I'd like to have a python program alert me when it has completed its task by making a beep noise. Currently, I use <code>import os</code> and then use a command line speech program to say "Process complete". I much rather it be a simple "bell."</p>
<p>I know that there's a function that can be used in <em>Cocoa</em> apps, <code>NSBeep</code>, but I don't think that has much anything to do with this.</p>
<p>I've also tried</p>
<pre class="lang-py prettyprint-override"><code>print(\a)
</code></pre>
<p>but that didn't work.</p>
<p>I'm using a Mac, if you couldn't tell by my <em>Cocoa</em> comment, so that may help.</p>
|
<p>Have you tried :</p>
<pre><code>import sys
sys.stdout.write('\a')
sys.stdout.flush()
</code></pre>
<p>That works for me here on Mac OS 10.5</p>
<p>Actually, I think your original attempt works also with a little modification:</p>
<pre><code>print('\a')
</code></pre>
<p>(You just need the single quotes around the character sequence).</p>
|
<p>By the way: there is a module for that. ;-)</p>
<p>Just install via pip:</p>
<pre class="lang-py prettyprint-override"><code>pip3 install mac_alerts
</code></pre>
<p>run your sound:</p>
<pre class="lang-py prettyprint-override"><code>from mac_alerts import alerts
alerts.play_error() # plays an error sound
</code></pre>
| 3,485
|
<p>Does anybody recommend a design pattern for taking a binary data file, parsing parts of it into objects and storing the resultant data into a database? </p>
<p>I think a similar pattern could be used for taking an XML or tab-delimited file and parse it into their representative objects.</p>
<p>A common data structure would include:</p>
<blockquote>
<p>(Header) (DataElement1) (DataElement1SubData1) (DataElement1SubData2)(DataElement2) (DataElement2SubData1) (DataElement2SubData2) (EOF)</p>
</blockquote>
<p>I think a good design would include a way to change out the parsing definition based on the file type or some defined metadata included in the header. So a <a href="http://www.oodesign.com/factory-method-pattern.html" rel="nofollow noreferrer">Factory Pattern</a> would be part of the overall design for the Parser part.</p>
|
<ol>
<li>Just write your file parser, using whatever techniques come to mind</li>
<li>Write lots of unit tests for it to make sure all your edge cases are covered</li>
</ol>
<p>Once you've done this, you will actually have a reasonable idea of the problem/solution.</p>
<p>Right now you just have theories floating around in your head, most of which will turn out to be misguided.</p>
<p>Step 3: Refactor mercilessly. Your aim should be to delete about half of your code</p>
<p>You'll find that your code at the end will either resemble an existing design pattern, or you'll have created a new one. You'll then be qualified to answer this question :-)</p>
|
<p>The Strategy pattern is maybe one you want to look at. The strategy being the file parsing algorithm.</p>
<p>Then you want a separate strategy for database insertion.</p>
| 3,276
|
<p>During a print a lot of plastic ended up ripping the nozzle's yellow insulation strap. </p>
<p>Can printing without this insulation around the fusion chamber damage the printer?</p>
<p>If there is no chance of damaging the printer, how likely is it that the prints will be affected by the absence of this insulation </p>
<p><a href="https://i.stack.imgur.com/CYGI7.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CYGI7.jpg" alt="highlight of the insulation strap"></a></p>
|
<p>Removing the insulation will not damage the printer, although it may affect the quality of the prints. The insulation is, after all, there for a purpose.</p>
<p>Allowing too much heat to escape radiatively from the heater block will reduce the maximum flow rate, since less energy will be available to heat the filament, and you may need to reduce your printing speeds or increase your nozzle temperature.</p>
<p>A bigger problem is that heat radiating from the heater block can cause already extruded filament to sag, especially when printing details and intricate infill. If the nozzle remains too long in any area, already extruded filament is likely to soften and deform. Without adequate insulation, the only way to counteract this is by increasing part cooling, and this will remove even more energy from the heater block.</p>
<p>Either fit new insulating tape or buy some silicone socks, since they are readily available for MK7/8/9 heater blocks. Then print a couple of Benchies, both with and without a sock, and compare the results.</p>
|
<p>Insulation of the nozzle is crucial. I removed it and put a silicon sock on a CR-10. I constantly got heat creeps even at 10C lower temp. Then I removed the sock and printed a 12 hour part with significant quality loss. It did finish the job. With silicon it stopped after 5-6 hours. I suppose that with the sock the upper part of the heat block which is uninsulated leaves more energy go up than without a silicon sock. Then I put cotton all around the heat block. I even put the cotton at the side of the thermistor. And kapton tape. The results are really really perfect. Always talking for the CR-10 stock nozzle and fans. If you don't have insulation you need better fans. All the heat goes up to the heatbreak and softens the fillament. </p>
| 1,314
|
<p>How to encode video on the fly and send it trough the network from C#?</p>
<p>Can't find a suitable library. I need to encode in WMV and don't mind if the actual encoding is made in C++ as long as the library has a .NET assembly available.</p>
<p>Thanks</p>
|
<p>I'm aware of <a href="http://ffmpeg.mplayerhq.hu/" rel="nofollow noreferrer">ffmpeg</a>, but it is native C code only. If you're ok with interoperability this may be your ticket.</p>
<p>Edit: It turns out someone already wrapped this in a .NET assembly. It's called <a href="http://www.intuitive.sk/fflib/" rel="nofollow noreferrer">FFlib.NET</a>.</p>
|
<p>Depending on what you are encoding (size, framerate, hardware, etc) real-time encoding may not even be possible. Video encoding is VERY CPU intensive.</p>
| 6,585
|
<p>Is there an efficient method of converting an integer into the written numbers, for example:</p>
<pre><code>string Written = IntegerToWritten(21);
</code></pre>
<p>would return "Twenty One".</p>
<p>Is there any way of doing this that doesn't involve a massive look-up table?</p>
|
<p>This should work reasonably well:</p>
<pre><code>public static class HumanFriendlyInteger
{
static string[] ones = new string[] { "", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine" };
static string[] teens = new string[] { "Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen" };
static string[] tens = new string[] { "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety" };
static string[] thousandsGroups = { "", " Thousand", " Million", " Billion" };
private static string FriendlyInteger(int n, string leftDigits, int thousands)
{
if (n == 0)
{
return leftDigits;
}
string friendlyInt = leftDigits;
if (friendlyInt.Length > 0)
{
friendlyInt += " ";
}
if (n < 10)
{
friendlyInt += ones[n];
}
else if (n < 20)
{
friendlyInt += teens[n - 10];
}
else if (n < 100)
{
friendlyInt += FriendlyInteger(n % 10, tens[n / 10 - 2], 0);
}
else if (n < 1000)
{
friendlyInt += FriendlyInteger(n % 100, (ones[n / 100] + " Hundred"), 0);
}
else
{
friendlyInt += FriendlyInteger(n % 1000, FriendlyInteger(n / 1000, "", thousands+1), 0);
if (n % 1000 == 0)
{
return friendlyInt;
}
}
return friendlyInt + thousandsGroups[thousands];
}
public static string IntegerToWritten(int n)
{
if (n == 0)
{
return "Zero";
}
else if (n < 0)
{
return "Negative " + IntegerToWritten(-n);
}
return FriendlyInteger(n, "", 0);
}
}
</code></pre>
<p>(Edited to fix a bug w/ million, billion, etc.)</p>
|
<p>Here is a <a href="http://forums.exchangecore.com/topic/684-convert-number-to-words-c-console-application/" rel="nofollow">C# Console Application</a> that will return whole numbers as well as decimals.</p>
| 2,538
|
<p>I’m new to 3D printing and have the Creality Ender 3 Pro. I work a lot with clay for earrings and wanted to design my own cutters with a sharp edge to create clean shapes.</p>
<p>I use PLA and have been using the speed and nozzle (0.4 mm) that was already set when I bought it. It’s been creating fine edges but I’d like to make it a lot sharper. Using the instructions from videos I saw online, I created the following "U" shape (extrusion of .5 mm Is the “cutting edge”. I started getting some weird bubbles too and am not sure what has created that either (see pic).</p>
<p>I use Fusion 360 to make the cookie/clay cutter and then send it to Ultimaker Cura to slice.</p>
<p>Any help with how to make it sharper and more clean cuts would be great!</p>
<p><a href="https://i.stack.imgur.com/0uMjD.jpg" rel="nofollow noreferrer" title="Cookie/clay cutter form"><img src="https://i.stack.imgur.com/0uMjD.jpg" alt="Cookie/clay cutter form" title="Cookie/clay cutter form" /></a></p>
|
<p>An extrusion width of 0.5 mm is too wide for making a sharp outline, I do use this sometimes for extrusion width for the infill.</p>
<p>Note that you can sand plastic (e.g. PLA or ABS) to sharpen the edge.</p>
|
<p>To build in 0scar's answer, standard nozzle width is 0.4 mm, so using a width of 0.5 mm will likely make the slicer extrude the edge as <em>two extrusion lines</em>, either with one of them very thin (which is hard to print precisely), or overextruded so that the total width is closer to 0.8 mm. You should probably aim for exactly the nozzle/line width, or since that sometimes causes slicing problems due to numerical inaccuracy, something like 5% over, with the slicer's "minimum flow" set to 10% or more so that a second line does not get laid down at all. You could also try reducing the line width below the nozzle width. Down to about 75% of the nozzle width should work pretty reliably; below that it's likely to have problems.</p>
<p>Aside from that, your print seems to have a lot of blobs and extrusion errors on it. To make this work well, you should try to find the causes of those issues too and get them fixed.</p>
| 1,650
|
<p>How would one configurably set http-headers to cache files in IIS >= 6?</p>
<p>Example:</p>
<ul>
<li><code>*.cache.*</code> => cache nearly forever</li>
<li><code>*.nocache.*</code> => never cache</li>
</ul>
<p>An example framework using this naming would be the GWT framework.</p>
|
<p>I think you're referring to setting the cache-control header.</p>
<p>See here <a href="http://support.microsoft.com/kb/247404" rel="nofollow noreferrer">http://support.microsoft.com/kb/247404</a></p>
|
<p><a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/23ea6f24-4b44-4fa0-a275-a1b907e1afb6.mspx?mfr=true" rel="nofollow noreferrer">http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/23ea6f24-4b44-4fa0-a275-a1b907e1afb6.mspx?mfr=true</a></p>
<p>Explains the different methods of caching data in IIS.</p>
| 9,933
|
<p>I wrote a quick program in python to add a gtk GUI to a cli program. I was wondering how I can create an installer using distutils. Since it's just a GUI frontend for a command line app it only works in *nix anyway so I'm not worried about it being cross platform.</p>
<p>my main goal is to create a .deb package for debian/ubuntu users, but I don't understand make/configure files. I've primarily been a web developer up until now.</p>
<p><strong>edit</strong>: Does anyone know of a project that uses distutils so I could see it in action and, you know, actually try building it?</p>
<h2>Here are a few useful links</h2>
<ul>
<li><p><a href="https://wiki.ubuntu.com/PackagingGuide/Python" rel="nofollow noreferrer">Ubuntu Python Packaging Guide</a></p>
<p>This Guide is <strong><em>very</em></strong> helpful. I don't know how I missed it during my initial wave of gooling. It even walks you through packaging up an existing python application</p></li>
<li><p><a href="https://wiki.ubuntu.com/MOTU/GettingStarted" rel="nofollow noreferrer">The Ubuntu MOTU Project</a></p>
<p>This is the official package maintaining project at ubuntu. Anyone can join, and there are lots of tutorials and info about creating packages, of all types, which include the above 'python packaging guide'.</p></li>
<li><p><a href="http://episteme.arstechnica.com/eve/forums/a/tpc/f/96509133/m/808004952931" rel="nofollow noreferrer">"Python distutils to deb?" - Ars Technica Forum discussion</a></p>
<p>According to this conversation, you can't just use distutils. It doesn't follow the debian packaging format (or something like that). I guess that's why you need dh_make as seen in the Ubuntu Packaging guide</p></li>
<li><p><a href="http://osdir.com/ml/linux.debian.devel.python/2004-10/msg00013.html" rel="nofollow noreferrer">"A bdist_deb command for distutils</a></p>
<p>This one has some interesting discussion (it's also how I found the ubuntu guide) about concatenating a zip-file and a shell script to create some kind of universal executable (anything with python and bash that is). weird. Let me know if anyone finds more info on this practice because I've never heard of it.</p></li>
<li><p><A href="http://mail.python.org/pipermail/distutils-sig/2000-May/001000.html" rel="nofollow noreferrer">Description of the deb format and how distutils fit in - python mailing list</a></p></li>
</ul>
|
<p>See the <a href="http://docs.python.org/dist/simple-example.html" rel="noreferrer">distutils simple example</a>. That's basically what it is like, except real install scripts usually contain a bit more information. I have not seen any that are fundamentally more complicated, though. In essence, you just give it a list of what needs to be installed. Sometimes you need to give it some mapping dicts since the source and installed trees might not be the same.</p>
<p>Here is a real-life (anonymized) example:</p>
<pre><code>#!/usr/bin/python
from distutils.core import setup
setup (name = 'Initech Package 3',
description = "Services and libraries ABC, DEF",
author = "That Guy, Initech Ltd",
author_email = "that.guy@initech.com",
version = '1.0.5',
package_dir = {'Package3' : 'site-packages/Package3'},
packages = ['Package3', 'Package3.Queries'],
data_files = [
('/etc/Package3', ['etc/Package3/ExternalResources.conf'])
])
</code></pre>
|
<p>distutils really isn't all that difficult once you get the hang of it. It's really just a matter of putting in some meta-information (program name, author, version, etc) and then selecting what files you want to include. For example, here's a sample distutils setup.py module from a decently complex python library:</p>
<p><a href="http://code.google.com/p/kamaelia/source/browse/trunk/Code/Python/Kamaelia/setup.py" rel="nofollow noreferrer">Kamaelia setup.py</a></p>
<p>Note that this doesn't deal with any data files or or whatnot, so YMMV.</p>
<p>On another note, I agree that the distutils documentation is probably some of python's worst documentation. It is extremely inclusive in some areas, but neglects some really important information in others.</p>
| 4,924
|
<p>This is pretty simple, I come from a swing/awt background.</p>
<p>I'm just wondering what the proper way to set the background color for a SWT widget is?</p>
<p>I've been trying:</p>
<pre><code>widget.setBackground( );
</code></pre>
<p>Except I have no idea how to create the color Object in SWT?</p>
|
<p>To create a color, try this:</p>
<pre><code>Device device = Display.getCurrent ();
Color red = new Color (device, 255, 0, 0);
</code></pre>
|
<p>Remember that in SWT you must explicitly dispose any resources that you create when you are done with them. This includes widgets, fonts, colors, images, displays, printers, and GCs. If you do not dispose these resources, eventually your application will reach the resource limit of your operating system and the application will cease to run.</p>
<p>See also: <a href="http://www.eclipse.org/articles/swt-design-2/swt-design-2.html" rel="noreferrer" title="Managing Operating System Resources in SWT">SWT: Managing Operating System Resources</a></p>
| 7,267
|
<p>I have the following code in a web.config file of the default IIS site.</p>
<pre><code><httpModules>
<add type="MDL.BexWebControls.Charts.ChartStreamHandler,Charts" name="ChartStreamHandler"/>
</httpModules>
</code></pre>
<p>Then when I setup and browse to a virtual directory I get this error</p>
<p>Could not load file or assembly 'Charts' or one of its dependencies. The system cannot find the file specified.</p>
<p>The virtual directory is inheriting the modules from the default web.config.</p>
<p>How do you stop this inheritance?</p>
|
<p>I've found the answer. Wrap the HttpModule section in location tags and set the inheritInChildApplications attribute to false.</p>
<pre><code><location path="." inheritInChildApplications="false">
<system.web>
<httpModules>
<add type="MDL.BexWebControls.Charts.ChartStreamHandler,Charts" name="ChartStreamHandler"/>
</httpModules>
</system.web>
</location>
</code></pre>
<p>Now any virtual directories will not inherit the settings in this location section.</p>
<p>@GateKiller This isn't another website, its a virtual directory so inheritance does occur.</p>
<p>@petrich I've had hit and miss results using <code><remove /></code>. I have to remember to add it to every virtual directory which is a pain.</p>
|
<p><a href="http://msdn.microsoft.com/en-us/library/ms178685.aspx" rel="nofollow noreferrer">According to Microsoft</a>, other websites do not inherit settings from the Default Website. Do you mean you are editing the default web.config which is located in the same folder as the machine.config?</p>
| 5,854
|
<p>What is the quickest way to come up to speed on OpenGL ES 1.x?</p>
<p>Let's assume I know nothing about OpenGL (which is not entirely true, but it's been a while since I last used OpenGL). I am most interested in learning this for iPhone-related development, but I'm interested in learning how it works on other platforms as well.</p>
<p>I've found the book <em>OpenGL ES 2.0 Programming Guide</em>, but I am concerned that it might not be the best approach because it focuses on 2.0 rather than 1.x. My understanding is that 2.0 is not backwards-compatible with 1.x, so I may miss out on some important concepts.</p>
<p>Note: For answers about learning general OpenGL, see <a href="https://stackoverflow.com/questions/62540/learning-opengl">https://stackoverflow.com/questions/62540/learning-opengl</a></p>
<hr>
<p>Some resources I've found:</p>
<ul>
<li><a href="http://khronos.org/opengles/1_X/" rel="nofollow noreferrer">http://khronos.org/opengles/1_X/</a></li>
<li><a href="http://www.imgtec.com/powervr/insider/sdk/KhronosOpenGLES1xMBX.asp" rel="nofollow noreferrer">http://www.imgtec.com/powervr/insider/sdk/KhronosOpenGLES1xMBX.asp</a></li>
<li><a href="https://rads.stackoverflow.com/amzn/click/com/0321336798" rel="nofollow noreferrer" rel="nofollow noreferrer">OpenGL Distilled</a> by Paul Martz (a good refresher on OpenGL basics)</li>
</ul>
|
<p>There is some documentation in iPhone SDK itself.</p>
<p>Other than that, just take what you know about OpenGL (or learn that via other means), and forget about all things that are "old cruft" (display lists, immediate mode, things that are in OpenGL but are not directly related to just drawing triangles). Basically, unlearn everything that has been declared deprecated in OpenGL 3.0.</p>
<p>GL ES 1.x is for pretty simple devices. What you have is a way to draw geometry (vertex buffers), manage textures and setup some fixed function state (lighting, texture combiners). That's pretty much all there is to it.</p>
|
<p>May I also suggest Android - it's easy to get and you can have a working simulator really quickly. Also, it uses v1.0 as far as I know. <br/>
There could be more tutorials, but even the APIDemos provided by Google has introduction to OpenGL ES. I certainly found it helpful.</p>
| 9,793
|
<p>What is the best way to measure exception handling overhead/performance in C++?</p>
<p>Please give standalone code samples.</p>
<p>I'm targeting Microsoft Visual C++ 2008 and gcc.</p>
<p>I need to get results from the following cases:</p>
<ol>
<li>Overhead when there are no try/catch blocks</li>
<li>Overhead when there are try/catch blocks but exceptions are not thrown</li>
<li>Overhead when exceptions are thrown</li>
</ol>
|
<p>Section 5.4 of the <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/TR18015.pdf" rel="noreferrer">draft Technical Report on C++ Performance</a> is entirely devoted to the overhead of exceptions. </p>
|
<p>Won't the answer depend on what cleanup has to happen as a result of a throw? If an excpetion is thrown that causes a whole load of objects to go out of scope up the stack, then that will add to the overhead.</p>
<p>In other words, I'm not sure if there is a an answer to the 3rd question that is independent of the specifics of the code.</p>
| 6,485
|
<p>For a given class I would like to have tracing functionality i.e. I would like to log every method call (method signature and actual parameter values) and every method exit (just the method signature). </p>
<p>How do I accomplish this assuming that: </p>
<ul>
<li>I don't want to use any 3rd party
AOP libraries for C#,</li>
<li>I don't want to add duplicate code to all the methods that I want to trace, </li>
<li>I don't want to change the public API of the class - users of the class should be able to call all the methods in exactly the same way. </li>
</ul>
<p>To make the question more concrete let's assume there are 3 classes: </p>
<pre><code> public class Caller
{
public static void Call()
{
Traced traced = new Traced();
traced.Method1();
traced.Method2();
}
}
public class Traced
{
public void Method1(String name, Int32 value) { }
public void Method2(Object object) { }
}
public class Logger
{
public static void LogStart(MethodInfo method, Object[] parameterValues);
public static void LogEnd(MethodInfo method);
}
</code></pre>
<p>How do I invoke <em>Logger.LogStart</em> and <em>Logger.LogEnd</em> for every call to <em>Method1</em> and <em>Method2</em> without modifying the <em>Caller.Call</em> method and without adding the calls explicitly to <em>Traced.Method1</em> and <em>Traced.Method2</em>?</p>
<p>Edit: What would be the solution if I'm allowed to slightly change the Call method?</p>
|
<p>C# is not an AOP oriented language. It has some AOP features and you can emulate some others but making AOP with C# is painful.</p>
<p>I looked up for ways to do exactly what you wanted to do and I found no easy way to do it.</p>
<p>As I understand it, this is what you want to do:</p>
<pre><code>[Log()]
public void Method1(String name, Int32 value);
</code></pre>
<p>and in order to do that you have two main options</p>
<ol>
<li><p>Inherit your class from MarshalByRefObject or ContextBoundObject and define an attribute which inherits from IMessageSink. <a href="http://www.developerfusion.co.uk/show/5307/3/" rel="noreferrer">This article</a> has a good example. You have to consider nontheless that using a MarshalByRefObject the performance will go down like hell, and I mean it, I'm talking about a 10x performance lost so think carefully before trying that.</p></li>
<li><p>The other option is to inject code directly. In runtime, meaning you'll have to use reflection to "read" every class, get its attributes and inject the appropiate call (and for that matter I think you couldn't use the Reflection.Emit method as I think Reflection.Emit wouldn't allow you to insert new code inside an already existing method). At design time this will mean creating an extension to the CLR compiler which I have honestly no idea on how it's done.</p></li>
</ol>
<p>The final option is using an <a href="http://en.wikipedia.org/wiki/Inversion_of_control" rel="noreferrer">IoC framework</a>. Maybe it's not the perfect solution as most IoC frameworks works by defining entry points which allow methods to be hooked but, depending on what you want to achive, that might be a fair aproximation.</p>
|
<ol>
<li>Write your own AOP library.</li>
<li>Use reflection to generate a logging proxy over your instances (not sure if you can do it without changing some part of your existing code).</li>
<li>Rewrite the assembly and inject your logging code (basically the same as 1).</li>
<li>Host the CLR and add logging at this level (i think this is the hardest solution to implement, not sure if you have the required hooks in the CLR though).</li>
</ol>
| 4,540
|
<p>Another SSRS question here: <br />
We have a development, a QA, a Prod-Backup and a Production SSRS set of servers. <br />
On our production and prod-backup, SSRS will go to sleep if not used for a period of time. <br /><br />
This does not occur on our development or QA server.
<br />In the corporate environment we're in, we don't have physical (or even remote login) access to these machines, and have to work with a team of remote administrators to configure our SSRS application.<br />
<br /> We have asked that they fix, if possible, this issue. So far, they haven't been able to identify the issue, and I would like to know if any of my peers know the answer to this question. Thanks.</p>
|
<p>For anybody using the integrated webserver that is built into SQL Reporting Services (and hence IIS may not even be installed on the box), the setting to control this actually lives in:</p>
<pre><code>C:\Program Files\Microsoft SQL Server\
MSRS10_50.MSSQLSERVER\Reporting Services\ReportServer\rsreportserver.config
</code></pre>
<p>Your directory may be different; version 10_50 maps to SQL 2008 R2.</p>
<p>You'll be looking for the setting called <code>RecycleTime</code>. <br />
Default is 720 (12 hours). Setting it to 0 will disable.</p>
|
<p>I vaguely recall having problems with SSRS on one machine when we changed the "Enable HTTP Keep-Alives" setting in IIS. Try toggling that checkbox (I don't remember whether it was checked or unchecked when it caused us problems).</p>
| 3,642
|
<p>I'm wondering if it's a good idea to make <strong>verifications</strong> in <strong>getters</strong> and <strong>setters</strong>, or elsewhere in the code.</p>
<p>This might surprise you be when it comes to <strong>optimizations</strong> and <strong>speeding</strong> up the code, I think you should not make verifications in getters and setters, but in the code where you're <strong>updating</strong> your files or database. Am I wrong?</p>
|
<p>Well, one of the reasons why classes usually contain private members with public getters/setters is exactly because they can verify data.</p>
<p>If you have a Number than can be between 1 and 100, i would definitely put something in the setter that validates that and then maybe throw an exception that is being caught by the code. The reason is simple: If you don't do it in the setter, you have to remember that 1 to 100 limitation every time you set it, which leads to duplicated code or when you forget it, it leads to an invalid state.</p>
<p>As for performance, i'm with Knuth here:</p>
<blockquote>
<p>"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil."</p>
</blockquote>
|
<p>Validation should be captured separately from getters or setters in a validation method. That way if the validation needs to be reused across multiple components, it is available.</p>
<p>When the setter is called, such a validation service should be utilized to sanitize input into the object. That way you know all information stored in an object is valid at all times.</p>
<p>You don't need any kind of validation for the getter, because information on the object is already trusted to be valid.</p>
<p>Don't save your validation until a database update!! It is better to <strong>fail fast</strong>.</p>
| 2,485
|
<p>I want to paint my ABS parts. But I foresee a problem that will arise from 0.16mm layer - those layers will be perfectly visible, even with primer. Sanding them wouldn't be a good idea, because walls are just 0.8-1mm thick, and probably acetone bath isn't right thing too. I want to use some sort of cement or paste, and cover parts with it using some paint scraper or knife before painting. Do cements suitable for this task exist? Would they stick to ABS?</p>
|
<p>The Prusha I3 design uses two rods to guide the Y axis, which moves along the rods on linear bearings. If the rods are not strictly planar, there will be movement of the bed as it moves to and fro. You would not be able to correct this with the leveling screws.</p>
<p>Be sure that the rods are planar, and that there is no torque on the bed from uneven rods. Even if the bed doesn't flex, the frame may flex if the rods are not planar.</p>
|
<p>The Prusha I3 design uses two rods to guide the Y axis, which moves along the rods on linear bearings. If the rods are not strictly planar, there will be movement of the bed as it moves to and fro. You would not be able to correct this with the leveling screws.</p>
<p>Be sure that the rods are planar, and that there is no torque on the bed from uneven rods. Even if the bed doesn't flex, the frame may flex if the rods are not planar.</p>
| 738
|
<p>Our security manager dynamically inserts a bit of javascript at the top of every html page when a page is requested by the client. It is inserted above the DOCTYPE statement. I think this might be the cause of the layout problems I am having.</p>
<p>Ideas anyone?</p>
|
<p>Yes, the DOCTYPE must come first.</p>
<p>The definition is here: <a href="http://www.w3.org/TR/REC-html40/struct/global.html" rel="noreferrer">http://www.w3.org/TR/REC-html40/struct/global.html</a>. Note that it says a document consists of three parts, and the DTD must be first.</p>
|
<p>It’s not a tag, but yup. Mainly because that’s the only way to get Internet Explorer (pre-version 8, I think) into standards mode.</p>
| 9,520
|
<p>Why isn't there a Team Foundation Server Express Edition?</p>
|
<p>Almost 3 years and 16 answers later,<a href="http://www.visualstudio.com/en-us/products/visual-studio-express-vs" rel="nofollow"><strong>TFS Express</strong></a> is now a fact.</p>
|
<p>No, from memory anything Team Foundation based costs a few times more than the professional versions. That's where Microsoft really makes its money.</p>
| 9,294
|
<p>I'm trying to upload an application to the iPhone App Store, but I get this error message from iTunes Connect:</p>
<blockquote>
<p>The binary you uploaded was invalid. The signature was invalid, or it was not signed with an Apple submission certificate.</p>
</blockquote>
<hr>
<p>Note: The details of original question have been removed, as this page has turned into a repository for all information about possible causes of that particular error message.</p>
<p>For general information on submitting iPhone applications to the App Store, see <a href="https://stackoverflow.com/questions/796482/steps-to-upload-an-iphone-application-to-the-appstore">Steps to upload an iPhone application to the AppStore</a>.</p>
|
<p>It's been my experience that Xcode occasionally gets confused about which signing certificate to use. I got into the habit of quitting and restarting Xcode after any change to the code signing settings (and doing a clean build) to work around this problem.</p>
|
<p>Just had this problem today but the answers here didn't help. I finally found the problem.</p>
<p>Make sure using pull down menu: <strong>Project>Edit Active Target</strong> "<em>ProjectName</em>" to change Code Signing to Distribution - I was selecting the Project in the Groups & Files pane and using the Info button which shows the <strong>PROJECT</strong> info rather than the <strong>TARGET</strong> info - very confusing! Only realized when I turned code signing off in the project and built and it still wanting to code sign!</p>
<p>I think this is why in Eddie's post he had to change it at the project.pbxproj level</p>
<p>Also on original post in 1st step:
1. In Xcode, select the Device|Release target
Surely it should be Device|Distribution target? (assuming this copied release and renamed it Distribution as per Apples instructions in the Provisioning Portal)</p>
| 7,028
|
<p>I just saw a really cool WPF twitter client that I think is developed by the Herding Code podcast guys <a href="http://www.herdingcode.com/" rel="noreferrer">HerdingCode</a> called <a href="http://code.google.com/p/wittytwitter/" rel="noreferrer">Witty</a>. (or at least, I see a lot of those guys using this client). This project is currently posted up on Google Code.</p>
<p>Many of the projects on Google Code use Subversion as the version control system (including Witty). Having never used Subversion, I'm not sure what to do to download the code. </p>
<p>On the source page for this project (<a href="http://code.google.com/p/wittytwitter/source/checkout" rel="noreferrer">google code witty source</a>) it gives the following instruction:</p>
<p><strong>Non-members may check out a read-only working copy anonymously over HTTP.</strong> <br>
<strong><em>svn checkout <a href="http://wittytwitter.googlecode.com/svn/trunk/" rel="noreferrer">http://wittytwitter.googlecode.com/svn/trunk/</a> wittytwitter-read-only</em></strong> </p>
<p>I'm confused as to where I am supposed to enter the above command so that I can download the code.</p>
<p>I have installed SVN and Tortoise (which I know almost nothing about). </p>
<p>Thanks for any help or simply pointing me in the right direction.</p>
<p>...Ed (@emcpadden)</p>
|
<p>After you install Tortoise (separate SVN client not required), create a new empty folder for the project somewhere and right click it in Windows. There should be an option for <code>SVN Checkout</code>. Choosing that option will open a dialog box. Paste the URL you posted above in the first textbox of that dialog box and click "OK".</p>
|
<p>The manual explains how to checkout code: </p>
<p><a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-checkout.html" rel="nofollow noreferrer">http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-checkout.html</a></p>
| 6,315
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.