instruction
stringlengths 27
22.5k
| chosen
stringlengths 27
28.2k
| rejected
stringlengths 19
24.9k
| __index_level_0__
int64 0
10k
|
|---|---|---|---|
<p>A while back, I had worked on building a <a href="https://biber-boote.ch/yostwerks/SeaCruiser.html" rel="nofollow noreferrer">Yostwerks Sea Cruiser</a>. Now I'm thinking of trying to create a 3D printable (or 3D millable) version of the plans.</p>
<p>The original design uses cross-sections cut from a half-inch thick HDPE sheet. However, I am considering changing this out for one of the easier to print materials, but I cannot find any comparative information about stiffness HDPE versus other 3D printing materials.</p>
<p>Can I get a suggestion for a alternative to HDPE that is as stiff or stiffer as well as same density or lighter. The Kayak frame is expected to be compressing the cross-sections.</p>
<p>An example set of cross-sections is as below:
<img src="https://biber-boote.ch/yostwerks/images/NewSections.jpg" alt="Kayak Frame Cross sections"></p>
<p>Please note that I have also considering changing the shape of the cross-sections to make stiffer yet lighter cross sections, but that will require some trade-off between portable sized cross-sections versus the stiffness of the cross-sections.</p>
|
<p>According to <a href="https://omnexus.specialchem.com/polymer-properties/properties/stiffness" rel="nofollow noreferrer">the chart on this page</a> HDPE has a flexural modulus of between 0.75 and 1.575 Gpa; meanwhile PETG has a flexural modulus of 2.20 Gpa, meaning PETG is the stiffer material.</p>
<p>HDPE, by definition, has a density greater than 0.941g/cc. PETG has a density of about 1.25g/cc.</p>
<p>So while PETG may be denser (depending on the HDPE used), it is more rigid, while not being too rigid.</p>
<p>PETG is quite printable using FDM. If you were printing at a higher temperature and high % infill, I could see it holding up well enough. I've printed heavy duty parts with it using a 0.8mm nozzle.</p>
|
<p>Because of the inherent nature of FDM, material properties will most certainly be always lower than casted/extruded sheet material. Furthermore, your question implies to use the same geometry of the ribs, I doubt whether there will be a filament that is able to get close to your requirements regarding strength and stiffness (for the same geometry). Your best choice for filament would be a high strength filament type like PC, certain co-polyester and ABS. But, I'm more inclined to say that this whole question is more of a design issues rather than material selection issue. For that reason I struggled to vote to close as being off topic for this site. In aerospace engineering t-stiffeners are used to make panels, e.g. wing or hull sections, more stiff by riveting T-profile shaped aluminium stiffeners onto the panels, this is something you could consider (bolt on aluminium profiles), as well as incorporating these stiff ridges directly printed in your design, but that would change the shape of the ribs.</p>
| 1,080
|
<p>I was reading googlebooks on chrome, where they talk about why they decided to spin up a process to host browser tab, every time you created a new tab.'
So </p>
<p>2 tabs = 2 chrome processes</p>
<p>3 tabs = 3 chrome processes and so on .. right??</p>
<p>But i opened up some 20 or so tabs, but in task manager, i could only find 3 chrome processes.. </p>
<p>What is going on??</p>
<p>I was taught that creating a process is an expensive proposition in terms of resources needed, and there are other light weight options available (like app domains in .net for ex)..
So is chrome taking some hybrid approach?? Create few processes and then start hosting additional tabs inside those limited set of processes??</p>
|
<p>it's being hosted in the first process. open up chrome. you'll see 2 processes (manager and initial tab). then open 10 more tabs, you'll notice the second process's memory jump a lot. then type in google.com or something into the first tab, and you'll see a new process get spawned.</p>
<p>also notice, if you do shift+esc and brink up the task manager in chrome, all those tabs will be grouped together, one w/ memory, the others without.</p>
|
<p>Process creation is relatively expensive, certainly compared to thread creation. But the frequency of process creation in Chrome is <em>very</em> slow, so the real issue is the amount of resource overhead vs other techniques.</p>
<p>The Google team figured that the benefits of a separate process model justified the resource costs. Given the current resources on desktop machines this trade off makes a lot of sense.</p>
| 6,439
|
<p>I find that the .NET event model is such that I'll often be raising an event on one thread and listening for it on another thread. I was wondering what the cleanest way to marshal an event from a background thread onto my UI thread is.</p>
<p>Based on the community suggestions, I've used this:</p>
<pre><code>// earlier in the code
mCoolObject.CoolEvent+=
new CoolObjectEventHandler(mCoolObject_CoolEvent);
// then
private void mCoolObject_CoolEvent(object sender, CoolObjectEventArgs args)
{
if (InvokeRequired)
{
CoolObjectEventHandler cb =
new CoolObjectEventHandler(
mCoolObject_CoolEvent);
Invoke(cb, new object[] { sender, args });
return;
}
// do the dirty work of my method here
}
</code></pre>
|
<p>A couple of observations:</p>
<ul>
<li>Don't create simple delegates explicitly in code like that unless you're pre-2.0 so you could use: </li>
</ul>
<pre class="lang-cs prettyprint-override"><code> BeginInvoke(new EventHandler<CoolObjectEventArgs>(mCoolObject_CoolEvent),
sender,
args);
</code></pre>
<ul>
<li><p>Also you don't need to create and populate the object array because the args parameter is a "params" type so you can just pass in the list.</p></li>
<li><p>I would probably favor <code>Invoke</code> over <code>BeginInvoke</code> as the latter will result in the code being called asynchronously which may or may not be what you're after but would make handling subsequent exceptions difficult to propagate without a call to <code>EndInvoke</code>. What would happen is that your app will end up getting a <code>TargetInvocationException</code> instead.</p></li>
</ul>
|
<p>I am using something like</p>
<pre><code>Invoke((Action)(() =>
{
//your code
}));
</code></pre>
| 4,238
|
<p>I recently got a 3D printer and have been experimenting with it a lot, resulting in a lot of failed prints (as well as successes, fortunately).</p>
<p>I'd like to, if possible, find a way to reuse the material from these failed prints. I am thinking about two methods:</p>
<ol>
<li>The obvious thing to do with the material is to chuck it in an old toaster oven and reuse it for injection molding. Is this something that is reasonably easy to do? If so, what temperature would be reasonable to use? What materials would be good to use for the mold? (off the top of my head, silicone or printed ABS with some kind of sealant seem the most promising)</li>
<li>Are there other ways to easily reuse the material? I've noticed that when PLA is heated to somewhere around 50-60 degrees C (120-150 F) it becomes somewhat soft and malleable. Does anyone have experience molding hot PLA?</li>
</ol>
<p>EDIT:</p>
<p>To be clear, I'm specifically asking about ways to reuse scrap PLA material, not just leftover filament, and not ways to turn it back into filament or to just recycle it. I'm particularly interested in the viability of the two methods I suggested, and if anyone has experience (positive or negative) with either I'd like to hear about it.</p>
|
<p>Here is a great article on the subject, <a href="https://www.3dhubs.com/talk/thread/how-make-your-own-filament-recycling-old-3d-prints-part-1" rel="nofollow noreferrer">How to make your own filament by recycling old 3D prints | Part 1</a>.</p>
<p>At $20/kg for new material, it is going to be hard for recycling to break even; but, if the cost is not your concern, there are some options.</p>
<p>Here is another creative option that I just saw... Cue amazing electric guitar riff:</p>
<p><a href="https://i.stack.imgur.com/4Ur4H.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4Ur4H.jpg" alt="Angus Young - ACDC"></a></p>
<ul>
<li>Guitar Picks (and jewelry)</li>
</ul>
<p>Here is the video: <a href="https://www.youtube.com/watch?v=42c8go9A7HQ" rel="nofollow noreferrer">Failed Print Recycling Revisited // Guitar Picks, Earrings, and More</a>.</p>
|
<p>I ended up buying a little handheld 3D pen. It comes in handy when printing models that require assembly. You can use the leftover filament in the 3D pen. If you don't have a 3D pen, you can use a soldering iron (as long as you can control the temp) to weld items together. I works well for part repairs and assembly.</p>
<p>The 3D pens is also handy for quick simple prints, as mentioned above. A guitar pick is a good idea and very easy to make with the 3D pen. </p>
<p>As for making your own filament, there are a couple of machines I would recommend looking into.</p>
<p>First you will need something to prep the material. This <a href="http://filamaker.eu/product/harddrive-destroyer/" rel="nofollow noreferrer">shredder</a> will help.</p>
<p>To make your own filament, here are a couple of options</p>
<ol>
<li><a href="http://www.thingiverse.com/thing:145500" rel="nofollow noreferrer">DIY</a></li>
<li><a href="http://d3dinnovations.com/filafab/" rel="nofollow noreferrer">Off the shelf</a></li>
</ol>
<p>Regarding Injection Molding, I have never done it, however found some <a href="https://www.rtpcompany.com/technical-info/molding-guidelines/pla-compounds/" rel="nofollow noreferrer">good info</a> on molding PLA.</p>
| 598
|
<p>In the project I am currently working on, we have the need to develop a web chat application, not a very complex chat, just a way to connect two people to talk about a very specific topic, we don't need any kind of authentication for one of the two users, we don't have to support emoticons, avatars, or stuff like that.</p>
<p>Some project members suggested that we could use XMPP through BOSH, I said that is like trying to catch a fish with a boat's net, and proposed a simpler method, like a simple Ajax/MySQL web chat, but we're worried about the performance hit in the server because of the constant polling of many chats open at the same time.</p>
<p>Has anyone done something like this before? What would you recommend? </p>
|
<p>You might also want to look into <a href="http://en.wikipedia.org/wiki/Comet_(programming)" rel="noreferrer">Comet</a>.</p>
<p>It's used by GTalk, Meebo, and many <a href="http://ajaxian.com/archives/comet-a-new-approach-to-ajax-applications" rel="noreferrer">other chat applications</a>. A few years ago when I was experimenting with it, there weren't very many libraries or details about server architecture to implement it, but it looks like there is a lot more stuff out now.</p>
<p>Have a look at the <a href="http://cometdproject.dojotoolkit.org/" rel="noreferrer">cometd</a> project for more technical information.</p>
|
<p>I thought everyone used cometd for this sort of thing. </p>
| 5,601
|
<p>I have a Printrboard rev. D which includes Allegro A4982 drivers. I would like to replace them, but it appears that newer TMC drivers all require several pins for proper operation.</p>
<p><a href="https://i.stack.imgur.com/ZnRf5.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZnRf5.png" alt="enter image description here"></a></p>
<p>How can I upgrade the drivers in the Printrboard rev. D?</p>
|
<p>The developers from the Klipper firmware confirmed that Klipper doesn't care about the native functions of each pin, therefore it is indeed possible to use the expansion pins for controlling (including UART) TMC stepper drivers.</p>
<p>At this point I cannot confirm, but maybe Marlin allows the same by updating the pin assignments in the source code.</p>
|
<p>You can't. In fact, pretty much all boards with directly soldered drivers are not upgradable.</p>
<p>I'd recommend to buy a proper, contemporary, customizable board like the SKR 1.3 for TMCs.
The Fysetc F6 would also work, but uses "custom" connectors and is still AVR based.</p>
| 1,498
|
<p>Does anyone here know any resources on how to get started writing a plugin for Google's Picasa? I love it for photo management, but I have some ideas for how it could be better.</p>
<ul>
<li>Riya-esque facial search: given a large enough corpus of faces and pictures (people tend to be repeated often in individuals' albums (family, friends), I would think some semi-workable version of this could be done. And with 13+ gigs/7 years of photos, it would be very nice for search.</li>
<li>Upload to Facebook EDIT: <a href="http://apps.new.facebook.com/picasauploader/" rel="nofollow noreferrer">Someone already made a very nice version</a></li>
<li>Upload to any non-Google property, actually.</li>
</ul>
<p>I know there are certain APIs and a Picasa2Flickr plugin out there, and I was wondering if anyone had seen any resources on this topic or had any experience</p>
|
<p>there is a an <a href="http://picasa2flickr.sourceforge.net/index.html#about" rel="nofollow noreferrer">Opensource Project</a> which created a "Upload To FlickR" Plugin. Maybe you could use it as an startingpoint... </p>
|
<p>I would start with the Picasa API:</p>
<p><a href="http://code.google.com/apis/picasaweb/overview.html" rel="nofollow noreferrer">Picasa API</a></p>
| 3,481
|
<p>We have a rather large SVN repository. Doing SVN updates are taking longer and longer the more we add code. We added <code>svn:externals</code> to folders that were repeated in some projects like the <a href="http://en.wikipedia.org/wiki/CKEditor" rel="noreferrer">FCKeditor</a> on various websites. This helped, but not that much.</p>
<p>What is the best way to reduce update time and boost SVN speed?</p>
|
<p>If it's an older SVN repository (or even quite new, but wasn't setup optimally), it maybe using the older BDB style of repository database. <a href="http://svn.apache.org/repos/asf/subversion/trunk/notes/fsfs" rel="noreferrer">http://svn.apache.org/repos/asf/subversion/trunk/notes/fsfs</a> has notes on the new one. To change from one to another isn;t too hard - dump the entire history, re-initialise it with the new svn format of file system and re-import. It may also be useful at the same time to filter the repo-dump to remove entire checkins of useless information (I, for example, have removed 20MB+ tarball files that someone had checked in).</p>
<p>As far as general speed goes - a quality (speedy) hard-drive and extra memory for OS-based caching would be hard to fault in terms of increasing the speed of how SVN will work.</p>
<p>On the client side, if you have tortoisesvn setup through PuttyAgent for SSH access to an external repository machine, you can also enable SSH compression, which can also help.</p>
<p><strong>Edit:</strong> SVN v1.5 also has the <a href="http://svnbook.red-bean.com/en/1.5/svn.reposadmin.maint.html#svn.reposadmin.maint.tk.fsfsreshard" rel="noreferrer">fsfs-reshard.py</a> tool which can help split a FSFS based svn repository into a number of directories - which can themselves be linked onto different drive spindles. If you have thousands of revisions, that can also help - if for no other reason than finding one file among thousands takes time (and you tell tell if thats a problem by looking at the IOwait times)</p>
|
<p>If you have many folders in the root of repository and your local copy reflects the repository, then try to slit monolithic local copy into many separated downloadable folders and update these folders separately too, It will be really faster than one big folder.</p>
| 9,091
|
<p>What are some toolkits for developing 2D games in Python? An option that I have heard of is Pygame, but is there anything that has more range to do more things? What are the good and bad parts about the modules?</p>
|
<p>I use <a href="http://www.pygame.org/news.html" rel="nofollow noreferrer">pygame</a> myself and it is very good. It has good documentation and tutorials, and is quite well designed. I've also heard wonderful reviews of <a href="http://www.pyglet.org/" rel="nofollow noreferrer">pyglet</a>.</p>
|
<p>I've only heard people talk about pygame. It has tons of followers & plenty of functionality.</p>
<p>Recently I saw <a href="https://rads.stackoverflow.com/amzn/click/com/1590598725" rel="nofollow noreferrer" rel="nofollow noreferrer">this book</a> at barnes & noble which I might check out one day. It looked good.</p>
| 5,492
|
<p>Using VS2008, C#, .Net 2 and Winforms how can I make a regular Button look "pressed"?
Imagine this button is an on/off switch.
<code>ToolStripButton</code> has the Checked property, but the regular Button does not.</p>
|
<p>One method you can used to obtain this option is by placing a "CheckBox" object and changing its "Appearance" from "Normal" to "Button" this will give you the same functionality that I believe you are looking for.</p>
|
<p>I think you may need a <code>ToggleButton</code>. You can take a look at third party vendors of WinForms components such as Telerik, DevExpress, ComponentFactory, ViBlend which provide such control. They all provide toggle buttons.</p>
| 2,690
|
<p>I need to do date arithmetic in Unix shell scripts that I use to control the execution of third party programs. </p>
<p>I'm using a function to increment a day and another to decrement: </p>
<pre><code>IncrementaDia(){
echo $1 | awk '
BEGIN {
diasDelMes[1] = 31
diasDelMes[2] = 28
diasDelMes[3] = 31
diasDelMes[4] = 30
diasDelMes[5] = 31
diasDelMes[6] = 30
diasDelMes[7] = 31
diasDelMes[8] = 31
diasDelMes[9] = 30
diasDelMes[10] = 31
diasDelMes[11] = 30
diasDelMes[12] = 31
}
{
anio=substr($1,1,4)
mes=substr($1,5,2)
dia=substr($1,7,2)
if((anio % 4 == 0 && anio % 100 != 0) || anio % 400 == 0)
{
diasDelMes[2] = 29;
}
if( dia == diasDelMes[int(mes)] ) {
if( int(mes) == 12 ) {
anio = anio + 1
mes = 1
dia = 1
} else {
mes = mes + 1
dia = 1
}
} else {
dia = dia + 1
}
}
END {
printf("%04d%02d%02d", anio, mes, dia)
}
'
}
if [ $# -eq 1 ]; then
tomorrow=$1
else
today=$(date +"%Y%m%d")
tomorrow=$(IncrementaDia $hoy)
fi
</code></pre>
<p>but now I need to do more complex arithmetic. </p>
<p>What it's the best and more compatible way to do this?</p>
|
<p>Assuming you have <a href="http://www.gnu.org/software/coreutils/manual/coreutils.html#date-invocation" rel="noreferrer">GNU date</a>, like so:</p>
<pre><code>date --date='1 days ago' '+%a'
</code></pre>
<p>And <a href="http://www.gnu.org/software/coreutils/manual/coreutils.html#Date-input-formats" rel="noreferrer">similar phrases</a>.</p>
|
<p>This works for me:</p>
<pre><code>TZ=GMT+6;
export TZ
mes=`date --date='2 days ago' '+%m'`
dia=`date --date='2 days ago' '+%d'`
anio=`date --date='2 days ago' '+%Y'`
hora=`date --date='2 days ago' '+%H'`
</code></pre>
| 2,820
|
<p>I write tools that are used in a shared workspace. Since there are multiple OS's working in this space, we generally use Python and standardize the version that is installed across machines. However, if I wanted to write some things in C, I was wondering if maybe I could have the application wrapped in a Python script, that detected the operating system and fired off the correct version of the C application. Each platform has GCC available and uses the same shell.</p>
<p>One idea was to have the C compiled to the users local ~/bin, with timestamp comparison with C code so it is not compiled each run, but only when code is updated. Another was to just compile it for each platform, and have the wrapper script select the proper executable.</p>
<p>Is there an accepted/stable process for this? Are there any catches? Are there alternatives (assuming the absolute need to use native C code)?</p>
<p><em>Clarification: Multiple OS's are involved that do not share ABI. Eg. OS X, various Linuxes, BSD etc. I need to be able to update the code in place in shared folders and have the new code working more or less instantaneously. Distributing binary or source packages is less than ideal.</em></p>
|
<p>Launching a Python interpreter instance just to select the right binary to run would be much heavier than you need. I'd distribute a shell .rc file which provides aliases.</p>
<p>In /shared/bin, you put the various binaries: /shared/bin/toolname-mac, /shared/bin/toolname-debian-x86, /shared/bin/toolname-netbsd-dreamcast, etc. Then, in the common shared shell .rc file, you put the logic to set the aliases according to platform, so that on OSX, it gets alias toolname=/shared/bin/toolname-mac, and so forth.</p>
<p>This won't work as well if you're adding new tools all the time, because the users will need to reload the aliases.</p>
<p>I wouldn't recommend distributing tools this way, though. Testing and qualifying new builds of the tools should be taking up enough time and effort that the extra time required to distribute the tools to the users is trivial. You seem to be optimizing to reduce the distribution time. Replacing tools that quickly in a live environment is all too likely to result in lengthy and confusing downtime if anything goes wrong in writing and building the tools--especially when subtle cross-platform issues creep in.</p>
|
<p>You know, you should look at static linking.</p>
<p>These days, we all have HUGE hard drives, and a few extra megabytes (for carrying around libc and what not) is really not that big a deal anymore. </p>
<p>You could also try running your applications in chroot() jails and distributing those.</p>
| 6,099
|
<p>I have an object that has cutouts in it (alignment pins fit in the cutouts). The shape of the hole is a right triangle with the point clipped off to create a flat surface in the deep part of the hole.</p>
<p>When I print the object in vertical orientation the wall in the deepest part of the cutout is printed properly. But when I print the same object laying down flat on the build plate, the internal wall is not printed and I can see the infill grid through the hole where the wall is supposed to be. </p>
<p>I sliced the object with a slicer based off a recent Cura version. I'm using the same STL to print the object vertically and horizontally.</p>
<p>Why is this occurring? Is there anything I can do about it other than printing vertically? (Because I have a need to print the real part horizontally. The part shown here is just a thin test piece.) Thank you
<a href="https://i.stack.imgur.com/s3p0E.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s3p0E.jpg" alt="Same object showing vertical / horizontal printing orientations"></a>
<a href="https://i.stack.imgur.com/LB0ES.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LB0ES.jpg" alt="The horizontal print position does not print the inner wall of the hole"></a></p>
<p>Here is a picture showing what the (Cura-derived) slicer does with the model in horizontally-printed position. I checked the layer display in the vertically-printed instance, and the missing wall was correctly rendered and visible.</p>
<p>I guess this is some kind of a slicer bug.</p>
<p><a href="https://i.stack.imgur.com/f3hg3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/f3hg3.jpg" alt="Layer view showing the missing back wall"></a></p>
<p>Here is a large-scale picture of what the cutout shape looks like. This picture is of the protrusion tab that fits into the hole. But the same shape was used to cut the hole in the object.</p>
<p><a href="https://i.stack.imgur.com/v07oz.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v07oz.jpg" alt="The shape used to cut the hole"></a></p>
<p>Here is another instance of the same problem. This time, I made up a simple block component, a simple cylinder component, aligned the cylinder into the block volume, and did a combine/cut operation in Fusion to cut a hole in the block (visible in the STL file). As you can see from the (Cura-derived) slicer layer image below, the same problem exists - no wall at the back of the cut when printing in the horizontal position. If I draw a sketch on the block and extrude/cut into the block, I get the same results. I also tried cutting the cylindrical hole, creating a "tin can" shell cylinder with an explicit bottom-of-the-can surface, sliding the open can into the cut hole, and joining the can to the block. Same results. The explicit bottom 0.5 mm surface of the can disappears in the horizontal slicing position. Strange.</p>
<p><a href="https://i.stack.imgur.com/162io.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/162io.jpg" alt="Simple cylinder component used as a cutting tool to cut into a block shows the same missing back wall problem."></a></p>
<p>UPDATE:</p>
<p>The test object is just a simple block with a cylinder extruded into the block as a cutout. As simple as simple can be. I have determined that Cura 3.5.0 works properly (Cura v3.6.0 is available). </p>
<p>I am using the Qidi slicer v5.0.7 latest, which uses an earlier version of Cura (I don't know which one; I have sent them an email to find out).</p>
<p>I have determined that the Qidi slicer behaves properly if the cutout cylinder diameter is 6mm or larger. But at 5mm, the slicer will not generate a back wall in the cut. The square/triangular cutouts in the example objects below are all 5 mm or less. My installed Cura 3.5.0 generates a proper back wall even at 5 mm. Therefore, it must be a bug in the Qidi slicer, which uses an older version of Cura. </p>
<p>As a workaround, I will increase the size of my cutouts to 6 mm. When Qidi updates to a newer version of Cura (they are currently using 3.3), the problem should go away.</p>
|
<p>I think this is caused by the shape of the hole. The shape is parabolic or circular, this means that if you slice it as in the green part, the slicer determines the placing of the layers along the curvature. If it has a shallow curvature, and slicing layer height is relatively thick, the curvature of the object cannot be followed. But, if you have more than 1 top layer, this usually should not be visible. I don't think that you have a single layer, so this is a pretty odd anomaly that I have not seen yet (that you look at the infill without top layers).</p>
<p>You could get past this by using a local different infill, e.g. 100 % infill. You can look at <a href="https://3dprinting.stackexchange.com/a/6523/5740">this answer</a> of <a href="https://3dprinting.stackexchange.com/q/6522/5740">the question: "Different infill in the same part"</a>. This should help you out printing in your preferred orientation.</p>
|
<p>I think this is caused by the shape of the hole. The shape is parabolic or circular, this means that if you slice it as in the green part, the slicer determines the placing of the layers along the curvature. If it has a shallow curvature, and slicing layer height is relatively thick, the curvature of the object cannot be followed. But, if you have more than 1 top layer, this usually should not be visible. I don't think that you have a single layer, so this is a pretty odd anomaly that I have not seen yet (that you look at the infill without top layers).</p>
<p>You could get past this by using a local different infill, e.g. 100 % infill. You can look at <a href="https://3dprinting.stackexchange.com/a/6523/5740">this answer</a> of <a href="https://3dprinting.stackexchange.com/q/6522/5740">the question: "Different infill in the same part"</a>. This should help you out printing in your preferred orientation.</p>
| 1,148
|
<p>What options are there in the industry for enterprise reporting? I'm currently using SSRS 2005, and know that there is another version coming out with the new release of MSSQL.</p>
<p>But, it seems like it might also be a good time to investigate the market to see what else is out there.</p>
<p>What have you encountered? Do you like it/dislike it? Why?</p>
<p>Thank you.</p>
|
<p>I've used Cognos Series 7, Cognos Series 8, Crystal Reports, Business Objects XI R2 WebIntelligence, Reporting Services 2000, Reporting Services 2005, and Reporting Services 2008. Here's my feedback on what I've learned:</p>
<p><strong>Reporting Services 2008/2005/2000</strong></p>
<p>PROS</p>
<ol>
<li><p>Cost: Cheapest enterprise business intelligence solution if you are using MS SQL Server as a back-end. You also have a best-in-class ETL solution at no additional cost if you throw in SSIS.</p></li>
<li><p>Most Flexible: Most flexible reporting solution I've ever used. It has always met all my business needs, particularly in its latest incarnation.</p></li>
<li><p>Easily Scalable: We initially used this as a departmental solution supporting about 20 users. We eventually expanded it to cover a few thousand users. Despite having a really bad quality virtual server located in a remote data center, we were able to scale to about 50-100 concurrent user requests. On good hardware at a consulting gig, I was able to scale it to a larger set of concurrent users without any issues. I've also seen implementations where multiple SSRS servers were deployed in different countries and SSIS was used to synch the data in the back-ends. This allowed for solid performance in a distributed manner at almost no additional cost.</p></li>
<li><p>Source Control Integration: This is CRITICAL to me when developing reports with my business intelligence teams. No other BI suite offers an out-of-box solution for this that I've ever used. Every other platform I used either required purchasing a 3rd party add-in or required you to promote reports between separate development, test, and production environments.</p></li>
<li><p>Analysis Services: I like the tight integration with Analysis Services between SSRS and SSIS. I've read about instances where Oracle and DB2 quotes include installing a SQL Server 2005 Analysis Services server for OLAP cubes.</p></li>
<li><p>Discoverability: No system has better discoverability than SSRS. There are more books, forums, articles, and code sites on SSRS than any other BI suite that I've ever used. If I needed to figuire out how to do something in SSRS, I could almost always find it with a few minutes or hours of work.</p></li>
</ol>
<p>CONS</p>
<ol>
<li><p>IIS Required for SSRS 2005/2000: Older versions of SSRS required installing IIS on the database server. This was not permissible from an internal controls perspective when I worked at a large bank. We eventually implemented SSRS without authorized approval from IT operations and basically asked for forgiveness later. <strong>This is not an issue in SSRS 2008 since IIS is no longer required.</strong></p></li>
<li><p>Report Builder: The web-based report builder was non-existant in SSRS 2000. The web-based report builder in SSRS 2005 was difficult to use and did not have enough functionality. The web-based report builder in SSRS 2008 is definitely better, but it is still too difficult to use for most business users.</p></li>
<li><p>Database Bias: It works best with Microsoft SQL Server. It isn't great with Oracle, DB2, and other back-ends.</p></li>
</ol>
<p><strong>Business Objects XI WebIntelligence</strong></p>
<p>PROS</p>
<ol>
<li><p>Ease of Use: Easiest to use for your average non-BI end-user for developing ad hoc reports.</p></li>
<li><p>Database Agnostic: Definitely a good solution if you expect to use Oracle, DB2, or another database back-end.</p></li>
<li><p>Performant: Very fast performance since most of the page navigations are basically file-system operations instead of database-calls.</p></li>
</ol>
<p>CONS</p>
<ol>
<li><p>Cost: Number one problem. If I want to scale up my implementation of Business Objects from 30 users to 1000 users, then SAP will make certain to charge you a few hundred thousands of dollars. And that's just for the Business Objects licenses. Add in the fact that you will also need database server licenses, you are now talking about a very expensive system. Of course, that could be the personal justification for getting Business Objects: if you can convince management to purchase a very expensive BI system, then you can probably convince management to pay for a large BI department.</p></li>
<li><p>No Source Control: Lack of out-of-the-box source control integration leads to errors in accidentally modifying and deploying old report definitions by mistake. The "work-around" for this is promote reports between environments -- a process that I do NOT like to do since it slows down report development and introduces environmental differences variables.</p></li>
<li><p>No HTML Email Support: You cannot send an HTML email via a schedule. I regularly do this in SSRS. You can buy an expensive 3rd party add-in to do this, but you shouldn't have to spend more money for this functionality.</p></li>
<li><p>Model Bias: Report development requires universes -- basically a data model. That's fine for ad hoc report development, but I prefer to use stored procedures to have full control of performance. I also like to build flat tables that are then queried to avoid costly complex joins during report run-time. It is silly to have to build universes that just contain flat tables that are only used by one report. You shouldn't have to build a model just to query a table. Store procedure support is also not supported out of the box without hacking the SQL Overrides.</p></li>
<li><p>Poor Parameter Support: Parameter support is terrible in BOXI WebIntelligence reports. Although I like the meta-data refresh options for general business users, it just isn't robust enough when trying to setup schedules. I almost always have to clone reports and alter the filters slightly which leads to unnecessary report definition duplication. SSRS beats this hands down, particularly since you can make the value and the label have different values -- unlike BOXI.</p></li>
<li><p>Inadequate Report Linking Support: I wanted to store one report definition in a central folder and then create linked reports for other users. However, I quickly found out end-users needed to have full rights on the parent object to use the object in their own folder. This defeated the entire purpose of using a linked report object. Give me SSRS!</p></li>
<li><p>Separate CMC: Why do you have to launch another application just to manage your object security? Worse, why isn't the functionality identical between CMC and InfoSys? For example, if you want to setup a scheduled report to retry on failed attempts, then you can specify the number of retries and the retry interval in CMC. However, you can't do this in InfoSys and you can't see the information either. InfoSys allows you to setup event-driven schedules and CMC does not support this feature.</p></li>
<li><p>Java Version Dependency: BOXI works great on end-user machines so long as they are running the same version of java as the server. However, once a newer version of java is installed on your machine, things starts to break. We're running Java 1.5 on our BOXI R2 server (the default java client) and almost everyone in the company is on Java 1.6. If you use Java 1.6, then prompts can freeze your IE and FoxFire sessions or crash your report builder unexpectedly.</p></li>
<li><p>Weak Discoverability: Aside from BOB (Business Objects Board), there isn't much out there on the Internet regarding troubleshooting Business Objects problems.</p></li>
</ol>
<p><strong>Cognos Series 8</strong></p>
<p>PROS</p>
<ol>
<li><p>Ease of Use: Although BOXI is easier to use for writing simple reports for general business users, Cognos is a close 2nd in this area.</p></li>
<li><p>Database Agnostic: Like BOXI this is definitely a good solution if you expect to use Oracle, DB2, or another database back-end.</p></li>
<li><p>FrameWork Manager: This is definitely a best-in-class meta-data repository. BOXI's universe builder wishes it was half as good. This tool is well suited to promoting packages across Development, Test, and Production environments.</p></li>
</ol>
<p>CONS</p>
<ol>
<li><p>Cost: Same issue as Business Objects. Similar cost structure. Similar database licensing requirements as well.</p></li>
<li><p>No Source Control: Same issue as Business Objects. I'm not aware of any 3rd party tools that resolve this issue, but they might exist.</p></li>
<li><p>Model Bias: Same issue as Business Objects. Has better support for stored procedures in FrameWork Manager, though.</p></li>
<li><p>Poor Parameter Support: Same issue as Business Objects. Has better support for creating prompt-pages if you can code in Java. Buggy behavior, though, when users click the back-button to return to the prompt-page. SSRS beats this out hands-down.</p></li>
<li><p>Inadequate Error Handling: Error messages in Cognos are nearly impossible to decipher. They generally give you a long negative number and a stack dump as part of the error message. I don't know how many times we "resolved" these error messages by rebuilding reports from scratch. For some reason, it is pretty easy to corrupt a report definition.</p></li>
<li><p>No Discoverability: It is very hard to track down any answers on how to troubleshoot problems or to implement functionality in Cognos. There just isn't adequate community support in Internet facing websites for the products.</p></li>
</ol>
<p>As you can guess from my answer, I believe Microsoft's BI suite is the best platform on the market. However, I must state that most articles I've read on comparisons of BI suites usually do not rate Microsoft's offering as well as SAP's Business Objects and Cognos's Series 8 products. Also, I've also seen Microsoft come out on the bottom in internal reviews of BI Suites in two separate companies after they were review by the reigning CIO's. In both instances, though, it seemed like it all boiled down to wanting to be perceived as a major department that justified a large operating budget.</p>
|
<p>Crystal Reports by <a href="http://businessobjects.com" rel="nofollow noreferrer">Business Objects</a> seems to be a popular choice.</p>
<p>I never wrote any reports in it myself, but others in my team who did sometimes struggled getting the more complex reports to work.</p>
<p>It also might be a bit pricey, depending on your budget.</p>
| 3,748
|
<p>I am not sure whether is it possible to change attribute's parameter during runtime? For example, inside an assembly I have the following class</p>
<pre><code>public class UserInfo
{
[Category("change me!")]
public int Age
{
get;
set;
}
[Category("change me!")]
public string Name
{
get;
set;
}
}
</code></pre>
<p>This is a class that is provided by a third party vendor and <strong>I can't change the code</strong>. But now I found that the above descriptions are not accurate, and I want to change the "change me" category name to something else when i bind an instance of the above class to a property grid.</p>
<p>May I know how to do this?</p>
|
<p>Well you learn something new every day, apparently I lied:</p>
<blockquote>
<p>What isn’t generally realised is that
you can change attribute <strong>instance</strong> values fairly
easily at runtime. The reason is, of
course, that the instances of the
attribute classes that are created are
perfectly normal objects and can be
used without restriction. For example,
we can get the object:</p>
<pre><code>ASCII[] attrs1=(ASCII[])
typeof(MyClass).GetCustomAttributes(typeof(ASCII), false);
</code></pre>
<p>…change the value of its public variable and show that it has changed:</p>
<pre><code>attrs1[0].MyData="A New String";
MessageBox.Show(attrs1[0].MyData);
</code></pre>
<p>…and finally create another instance
and show that its value is unchanged:</p>
<pre><code>ASCII[] attrs3=(ASCII[])
typeof(MyClass).GetCustomAttributes(typeof(ASCII), false);
MessageBox.Show(attrs3[0].MyData);
</code></pre>
</blockquote>
<p><a href="http://www.vsj.co.uk/articles/display.asp?id=713" rel="noreferrer">http://www.vsj.co.uk/articles/display.asp?id=713</a></p>
|
<p>You can change Attribute values at runtime at Class level (not object):</p>
<pre><code>var attr = TypeDescriptor.GetProperties(typeof(UserContact))["UserName"].Attributes[typeof(ReadOnlyAttribute)] as ReadOnlyAttribute;
attr.GetType().GetField("isReadOnly", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(attr, username_readonly);
</code></pre>
| 7,429
|
<p>We just added an autoupdater in our software and got some bug report saying
that the autoupdate wouldn't complete properly because the downloaded file's sha1 checksum wasn't matching. We're hosted on Amazon S3...</p>
<p>That's either something wrong with my code or something wrong with S3.</p>
<p>I reread my code for suspicious stuff and wrote a simple script downloading and checking the checksum of the downloaded file, and indeed got a few errors once in while (1 out of 40 yesterday). Today it seems okay.</p>
<p>Did you experience that kind of problem? Is there some kind of workaround ?</p>
<p>extra info: test were ran in Japan.</p>
|
<p>Amazon's S3 will occasionally fail with errors during uploads or downloads -- generally "500: Internal Server" errors. The error rate is normally pretty low, but it can spike if the service is under heavy load. The error rate is never 0%, so even at the best of times the occasional request will fail.</p>
<p>Are you checking the HTTP response code in your autoupdater? If not, you should check that your download succeeded (HTTP 200) before you perform a checksum. Ideally, your app should retry failed downloads, because transient errors are an unavoidable "feature" of S3 that clients need to deal with.</p>
<p>It is worth noting that if your clients are getting 500 errors, you will probably not see any evidence of these in the S3 server logs. These errors seem to occur before the request reaches the service's logging component.</p>
|
<p>More than sending bad data, I think I got an ERROR403. If I just try again it's usually ok.</p>
<p>And I agree : I saw a lot of report about people talking about amazon being totally down, but nobody talking about a "sometimes my access is refused" error, so I guess there might be an error on my side. I just set up the log on amazon.</p>
<p>Anyway thank you! I'll follow your advise and stop blaming "the other guy".</p>
| 5,141
|
<p>I have a third party library that internally constructs and uses the SqlConnection class. I can inherit from the class, but it has a ton of overloads, and so far I have been unable to find the right one. What I'd like is to tack on a parameter to the connection string being used.</p>
<p>Is there a way for me to put a breakpoint in the .NET library core itself? Specifically in the constructors of the SqlConnection class, so that I can look at the stack trace and see where it is actually being constructed?</p>
<p>Barring that, is there some other way I can do this?</p>
<p>Specifically, what I want to do is to tack on the <em>Application Name</em> parameter, so that our application is more easily identified on the server when looking at connections.</p>
<hr>
<p><strong>Edit</strong>: Well, it appears I need more help. I think I've enabled everything related to symbol server support, and I've noticed that the directory I configured has filled up with directories that contain .pdb files. Still, I can't get the actual source to the SqlConnection class to become available.</p>
<p>Is there some definite guide to how to do this successfully?</p>
|
<p>You can <a href="http://www.wintellect.com/cs/blogs/jrobbins/archive/2008/01/17/additional-net-framework-source-code-debugging-tricks.aspx" rel="nofollow noreferrer">download .NET source code</a> and set break point right in .NET FW source code.</p>
<p>You can use <a href="http://www.codeplex.com/NetMassDownloader" rel="nofollow noreferrer">NetMassDownloader</a> to grab .NET sources quickly.</p>
|
<p>OK, if you want definitive guide, here it is:</p>
<p><a href="http://blogs.msdn.com/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx" rel="nofollow noreferrer">Configuring Visual Studio to Debug .NET Framework Source Code</a></p>
<p>If you want some help, go ahead and tell use which steps did you perform?</p>
| 8,644
|
<p>I want to keep logs of some things that people do in my app, in some cases so that it can be undone if needed.</p>
<p>Is it best to store such logs in a file or a database? I'm completely at a loss as to what the pros and cons are except that it's another table to setup.</p>
<p>Is there a third (or fourth etc) option that I'm not aware of that I should look into and learn about?</p>
|
<p>You will almost certainly want to use a database for flexible, record based access and to take advantage of the database's ability to handle concurrent data access. If you need to track information that may need to be undone, having it in a structured format is a benefit, as is having the ability to update a row indicating when and by whom a given transaction has been undone. </p>
<p>You likely only want to write to a file if very high performance is an issue, or if you have very unstructured or large amounts of data per record that might be unweidly to store in a database. Note that Unless your application has a very large number of transactions database speed is unlikely to be an issue. Also note that if you are working with a file you'll need to handle concurrent access (read / write / locking) very carefully which is likely not something you want to have to deal with.</p>
|
<p>I'd use a database simply for maintainability - also multiple edits on a file may cause some getting missed out.</p>
| 5,653
|
<p>Assume you are doing something like the following</p>
<pre><code>List<string> myitems = new List<string>
{
"Item 1",
"Item 2",
"Item 3"
};
ComboBox box = new ComboBox();
box.DataSource = myitems;
ComboBox box2 = new ComboBox();
box2.DataSource = myitems
</code></pre>
<p>So now we have 2 combo boxes bound to that array, and everything works fine. But when you change the value of one combo box, it changes BOTH combo boxes to the one you just selected.</p>
<p>Now, I know that Arrays are always passed by reference (learned that when i learned C :D), but why on earth would the combo boxes change together? I don't believe the combo box control is modifying the collection at all. </p>
<p>As a workaround, don't this would achieve the functionality that is expected/desired</p>
<pre><code>ComboBox box = new ComboBox();
box.DataSource = myitems.ToArray();
</code></pre>
|
<p>This has to do with how data bindings are set up in the dotnet framework, especially the <code>BindingContext</code>. On a high level it means that if you haven't specified otherwise each form and all the controls of the form share the same <code>BindingContext</code>. When you are setting the <code>DataSource</code> property the <code>ComboBox</code> will use the <code>BindingContext</code> to get a <code>ConcurrenyMangager</code> that wraps the list. The <code>ConcurrenyManager</code> keeps track of such things as the current selected position in the list. </p>
<p>When you set the <code>DataSource</code> of the second <code>ComboBox</code> it will use the same <code>BindingContext</code> (the forms) which will yield a reference to the same <code>ConcurrencyManager</code> as above used to set up the data bindings.</p>
<p>To get a more detailed explanation see <a href="https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.bindingcontext" rel="nofollow noreferrer">BindingContext</a>.</p>
|
<p>A better workaround (depending on the size of the datasource) is to declare two <code>BindingSource</code> objects (new as of 2.00) bind the collection to those and then bind those to the comboboxes.</p>
<p>I enclose a complete example.</p>
<pre><code>using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
private BindingSource source1 = new BindingSource();
private BindingSource source2 = new BindingSource();
public Form1()
{
InitializeComponent();
Load += new EventHandler(Form1Load);
}
void Form1Load(object sender, EventArgs e)
{
List<string> myitems = new List<string>
{
"Item 1",
"Item 2",
"Item 3"
};
ComboBox box = new ComboBox();
box.Bounds = new Rectangle(10, 10, 100, 50);
source1.DataSource = myitems;
box.DataSource = source1;
ComboBox box2 = new ComboBox();
box2.Bounds = new Rectangle(10, 80, 100, 50);
source2.DataSource = myitems;
box2.DataSource = source2;
Controls.Add(box);
Controls.Add(box2);
}
}
}
</code></pre>
<p>If you want to confuse yourself even more then try always declaring bindings in the constructor. That can result in some <em>really</em> curious bugs, hence I always bind in the Load event.</p>
| 2,292
|
<p><a href="https://www.thingiverse.com/thing:4195002" rel="nofollow noreferrer">A part</a> I've printed (on a Monoprice Maker Select V2, sliced with Cura) has a small peg on it, which is an unsupported overhanging section of the model.</p>
<p>The first few layers of the peg end up a mess of PLA spaghetti. Here I've rotated the part to get a better shot, normally it would be printed on its side.</p>
<p><a href="https://i.stack.imgur.com/lawtn.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lawtn.jpg" alt="enter image description here"></a></p>
<p>I've done test prints that contain L-shaped overhangs and they worked ok, so I'm not sure what's broken about this one.</p>
<p>One guess I have is that because the peg is relatively low to the heated build plate, the material isn't cooling as quickly, and it needs to be more rigid in order for subsequent layers to print.</p>
<p>I also tried with supports but I found it too hard to remove.</p>
|
<p>Unsupported parts need to be printed with support. If your supports are too hard to remove, try the Tree Support setting and make sure that your support structure is set up with a gap to the actual print. As we don't know which slier you use, I can't go into more details here.</p>
|
<p>You could try printing slower and/or increase cooling ( possibly even a cooler bed temp) if you absolutely want to avoid supports, or just use supports with a support interface and tweak support distance.</p>
| 1,605
|
<p>WebKit/Safari supports the console object, which is similar to what Firebug does. But what exactly is supported? There is a <a href="http://getfirebug.com/wiki/index.php/Console_API" rel="noreferrer">console documentation for Firebug</a>, but where can I find the console documentation for Safari/WebKit?</p>
|
<p>Supported methods were originally:</p>
<ul>
<li><code>console.log()</code></li>
<li><code>console.error()</code></li>
<li><code>console.warn()</code></li>
<li><code>console.info()</code></li>
</ul>
<p>Newer versions of WebKit also add the following methods making the WebKit console API almost identical to <a href="http://getfirebug.com/wiki/index.php/Console_API" rel="noreferrer">Firebug's console API</a>:</p>
<ul>
<li><code>console.count()</code></li>
<li><code>console.debug()</code></li>
<li><code>console.profileEnd()</code></li>
<li><code>console.trace()</code></li>
<li><code>console.dir()</code></li>
<li><code>console.dirxml()</code></li>
<li><code>console.assert()</code></li>
<li><code>console.time()</code></li>
<li><code>console.profile()</code></li>
<li><code>console.timeEnd()</code></li>
<li><code>console.group()</code></li>
<li><code>console.groupEnd()</code></li>
</ul>
<p>(New information based on the WebKit nightly build WebKit-SVN-r37126, at the time of writing these methods aren't available in Safari)</p>
|
<p>The Console object appearantly has a built-in 'API', in the form of a 'private property' you can reveal by doing this in the Webkit javascript-console</p>
<pre><code>> for(o in console) console.dir(o)
_commandLineAPI
log
warn
…
</code></pre>
<p>_commandLineAPI:</p>
<pre><code>> console.dir(_commandLineAPI)
CommandLineAPI
$0: "—"
$1: "—"
$2: "—"
$3: "—"
$4: "—"
$$: bound: function () {
$x: bound: function (xpath, context) {
clear: bound: function () {
copy: bound: function (object) {
dir: bound: function () {
dirxml: bound: function () {
inspect: bound: function (object) {
keys: bound: function (object) {
monitorEvents: bound: function (object, types) {
profile: bound: function () {
profileEnd: bound: function () {
unmonitorEvents: bound: function (object, types) {
values: bound: function (object) {
__proto__: CommandLineAPI
</code></pre>
| 7,944
|
<p>I would like to buy a 3D printer, but I'm concerned about the health risks that are associated with its operation. Some groups of scientists say it can be <a href="http://www.techworld.com/news/personal-tech/scientists-warn-of-3d-printing-health-effects-as-tech-hits-high-street-3460992/">harmful</a> for humans.</p>
<p>What do I need to consider before buying a 3D printer if I care about my health? Are there any safe printers?</p>
|
<p>There is very little information about safety available, as home 3D printers are relatively new. However, plastics such as ABS have a long history in making plastic products, and a study found that at traditional manufacturing methods (such as injection molding and hot wire cutting) <a href="http://annhyg.oxfordjournals.org/content/57/3/399">do not release dangerous levels of carcinogens and/or respiratory sensitizers in to the air</a>.</p>
<p>Of course, 3D printers are not among the processes covered in the study. In home 3D printing circles, <a href="http://www.sciencedirect.com/science/article/pii/S1352231013005086">this study</a> that looks at ultrafine particle (UFP) emissions, is often cited. It finds that printing ABS releases relatively high levels of UFP's and PLA releases significantly fewer (but still quite a large amount). However, it is unclear whether/how dangerous these UFP's are in the amounts emitted.</p>
<p>It is often suggested that PLA, partly because of the reduced UFP emissions is safer to print than ABS, partly because of its "natural" origins as it can be derived from materials such as cornstarch. I would caution against this line of reasoning since "natural" materials can still be poisonous (snake venom is natural, after all) and the cornstarch is heavily processed so it hardly resembles its original form. The lower UFP emissions may suggest it is safer, but the study is only quantitative, not qualitative.</p>
<p>That said, PLA does probably pose less of a risk (despite my earlier argumentation against "natural" materials, PLA does play quite nicely with the human body), but I contend the risk with ABS is not too large anyways, given that it has been safely used in factories for decades.</p>
<p><a href="http://fire.nist.gov/bfrlpubs/fire86/art017.html">Another study</a> is often miscited, supposedly saying that 3D printing ABS releases hydrogen cyanide. The study only looks at the thermal decomposition of ABS, which happens at significantly higher temperatures than are reached during printing (but a significantly malfunctioning printer might cause toxic gasses to be released, but I contend that at that point you should worry about your printer being on fire, rather than temporary exposure to some toxins).</p>
<p>There are no printers out there that are fundamentally safer than others. However, some printers have an enclosure (containing the fumes) and some even have a carbon filter and a fan for fume extraction. If you would like to err on the side of caution, this might be a good choice (but again, it is not clear if a carbon filter is totally effective).</p>
<p>Finally, as printers are generally quite noisy it tends to be preferrable to keep your printer in a separate room from where you usually work. In this case, fume exposure (during the few minutes that you go to check on your print) is minimal, and the potential advantages of a "safer" printers or using "safer" materials diminish.</p>
<p>Incidental exposure as a hobbyist is probably not a big deal; workers in factories are exposed to the fumes of melted plastic their entire lives and they don't seem to be dropping dead. On the other hand, if you are going to be printing structurally then it is probably preferable to move your printer to a separate room, if not because of health and safety because of the noise.</p>
|
<p>Apart from the inherent process itself and direct health hazards from that, many 3D printers also require some complementary technology to work.</p>
<p><a href="/questions/tagged/fdm" class="post-tag" title="show questions tagged 'fdm'" rel="tag">fdm</a> printers have a printing head that needs to move around in 3D space. <strong>Moving machinery parts can be a hazard</strong>. In a home/hobbyist environment with children for example, I would recommend to buy a printer with a housing. </p>
<p>"open" designs often feature <strong>bare electronics</strong> mounted directly to the printer structure. This rises the possibility of short circuits and electric shock.</p>
<p>The printers that heat material often do so at very high temperatures. <strong>Hot parts of the printer</strong> should not be touched.</p>
| 83
|
<p>Has anyone got a working solution without some Java/COM-bridge? E.g. process the Email as a file (.msg) rather than locating the data that is referenced in the Clipboard?</p>
|
<p>Maybe this is a solution for your problem:
<a href="http://sourceforge.net/projects/javaoutlookdd/" rel="nofollow">http://sourceforge.net/projects/javaoutlookdd/</a>
It allows to handle outlook items like File objects during drag&drop.</p>
|
<p>I assume that you've already ruled out the tools in "org.eclipse.swt.dnd" for some reason? There are some examples <a href="http://www.java2s.com/Code/Java/SWT-JFace-Eclipse/Clipboard.htm" rel="nofollow noreferrer">here</a> on how to go about using them, in case you haven't. If what you really want to do is drag&drop, you're going to have to do some work with those tools. At that point, really the question becomes, what format is it in on the clipboard, vs in a file, and which is easier to integrate into your app. </p>
| 4,281
|
<p>I've generated some JSON and I'm trying to pull it into an object in JavaScript. I keep getting errors. Here's what I have:</p>
<pre><code>var data = '{"count" : 1, "stack" : "sometext\n\n"}';
var dataObj = eval('('+data+')');
</code></pre>
<p>This gives me an error: </p>
<pre><code>unterminated string literal
</code></pre>
<p>With <code>JSON.parse(data)</code>, I see similar error messages: "<code>Unexpected token ↵</code>" in Chrome, and "<code>unterminated string literal</code>" in Firefox and IE.</p>
<p>When I take out the <code>\n</code> after <code>sometext</code> the error goes away in both cases. I can't seem to figure out why the <code>\n</code> makes <code>eval</code> and <code>JSON.parse</code> fail. </p>
|
<p>This is what you want:</p>
<pre><code>var data = '{"count" : 1, "stack" : "sometext\\n\\n"}';
</code></pre>
<p>You need to escape the <code>\</code> in your string (turning it into a double-<code>\</code>), otherwise it will become a newline in the JSON source, not the JSON data.</p>
|
<p>I encountered that problem while making a class in PHP 4 to emulate json_encode (available in PHP 5). Here's what I came up with:</p>
<pre><code>class jsonResponse {
var $response;
function jsonResponse() {
$this->response = array('isOK'=>'KO', 'msg'=>'Undefined');
}
function set($isOK, $msg) {
$this->response['isOK'] = ($isOK) ? 'OK' : 'KO';
$this->response['msg'] = htmlentities($msg);
}
function setData($data=null) {
if(!is_null($data))
$this->response['data'] = $data;
elseif(isset($this->response['data']))
unset($this->response['data']);
}
function send() {
header('Content-type: application/json');
echo '{"isOK":"' . $this->response['isOK'] . '","msg":' . $this->parseString($this->response['msg']);
if(isset($this->response['data']))
echo ',"data":' . $this->parseData($this->response['data']);
echo '}';
}
function parseData($data) {
if(is_array($data)) {
$parsed = array();
foreach ($data as $key=>$value)
array_push($parsed, $this->parseString($key) . ':' . $this->parseData($value));
return '{' . implode(',', $parsed) . '}';
}
else
return $this->parseString($data);
}
function parseString($string) {
$string = str_replace("\\", "\\\\", $string);
$string = str_replace('/', "\\/", $string);
$string = str_replace('"', "\\".'"', $string);
$string = str_replace("\b", "\\b", $string);
$string = str_replace("\t", "\\t", $string);
$string = str_replace("\n", "\\n", $string);
$string = str_replace("\f", "\\f", $string);
$string = str_replace("\r", "\\r", $string);
$string = str_replace("\u", "\\u", $string);
return '"'.$string.'"';
}
}
</code></pre>
<p>I followed the rules mentioned <a href="http://www.json.org/fatfree.html" rel="nofollow noreferrer">here</a>. I only used what I needed, but I figure that you can adapt it to your needs in the language your are using. The problem in my case wasn't about newlines as I originally thought, but about the / not being escaped. I hope this prevent someone else from the little headache I had figuring out what I did wrong.</p>
| 6,345
|
<p>Effectively I want to give numeric scores to alphabetic grades and sum them. In Excel, putting the <code>LOOKUP</code> function into an array formula works:</p>
<pre><code>{=SUM(LOOKUP(grades, scoringarray))}
</code></pre>
<p>With the <code>VLOOKUP</code> function this does not work (only gets the score for the first grade). Google Spreadsheets does not appear to have the <code>LOOKUP</code> function and <code>VLOOKUP</code> fails in the same way using:</p>
<pre><code>=SUM(ARRAYFORMULA(VLOOKUP(grades, scoresarray, 2, 0)))
</code></pre>
<p>or</p>
<pre><code>=ARRAYFORMULA(SUM(VLOOKUP(grades, scoresarray, 2, 0)))
</code></pre>
<p>Is it possible to do this (but I have the syntax wrong)? Can you suggest a method that allows having the calculation in one simple cell like this rather than hiding the lookups somewhere else and summing them afterwards?</p>
|
<p>I'm afraid I think the answer is no. From the help text on
<a href="http://docs.google.com/support/spreadsheets/bin/answer.py?answer=71291&query=arrayformula&topic=&type=" rel="nofollow noreferrer">http://docs.google.com/support/spreadsheets/bin/answer.py?answer=71291&query=arrayformula&topic=&type=</a></p>
<blockquote>
<p>The real power of ARRAYFORMULA comes when you take the result from one of those computations and wrap it inside a formula that does take array or range arguments: SUM, MAX, MIN, CONCATENATE,</p>
</blockquote>
<p>As vlookup takes a single cell to lookup (in the first argument) I don't think you can get it to work, without using a separate range of lookups.</p>
|
<p>I know this thread is quite old, but I'd been struggling with this same problem for some time. I finally came across a solution (well, Frankenstiened one together). It's only slightly more elegant, but should be able to work with large data sets without trouble.</p>
<p>The solution uses the following:</p>
<pre><code>=ARRAYFORMULA(SUM(INDIRECT(ADDRESS(MATCH(), MATCH())))
</code></pre>
<p>as a surrogate for the vlookup function.</p>
<p>I hope this helps someone!</p>
| 4,744
|
<p>This is not specific to any language, it´s just about best practices. I am using JPA/Hibernate (but it could be any other ORM solution) and I would like to know how do you guys deal with this situation:
Let´s suppose that you have a query returning something that is not represented by any of your domain classes.
Do you create a specific class to represent that specific query?
Do you return the query in some other kind of object (array, map...)
Some other solutions?
I would like to know about your experiences and best practices.</p>
<p>P.S.
Actually I am creating specific objetcs for specific queries.</p>
|
<p>We have a situation that sounds similar to yours.</p>
<p>We use separate objects for reporting data that spans several domain objects. Our convention is that these will be backed by a view in the database, so we have come to call them view objects. We generally use them for summarising complex data into a flat format.</p>
|
<p>I typically write a function that performs a query using SQL and then puts the results into either a list or dictionary (in Java, I'd use either an ArrayList or a HashMap).</p>
<p>If I found myself doing this a lot, I'd probably create a new file to hold all of these queries. Otherwise I'd just make them functions in whatever file they were needed/used.</p>
<p>Since we're talking Java specifically, I would certainly not create a new class in a separate file. However, for queries needed in only one class, you could create a private static inner class with only the function(s) needed to generate the query(s) needed by that class.</p>
| 7,482
|
<p>In postgis, is the <code>ST_GeomFromText</code> call very expensive? I ask mostly because I have a frequently called query that attempts to find the point that is nearest another point that matches some criteria, and which is also within a certain distance of that other point, and the way I currently wrote it, it's doing the same <code>ST_GeomFromText</code> twice:</p>
<pre><code> $findNearIDMatchStmt = $postconn->prepare(
"SELECT internalid " .
"FROM waypoint " .
"WHERE id = ? AND " .
" category = ? AND ".
" (b.category in (1, 3) OR type like ?) AND ".
" ST_DWithin(point, ST_GeomFromText(?," . SRID .
" ),". SMALL_EPSILON . ") " .
" ORDER BY ST_Distance(point, ST_GeomFromText(?,", SRID .
" )) " .
" LIMIT 1");
</code></pre>
<p>Is there a better way to re-write this?</p>
<p>Slightly OT: In the preview screen, all my underscores are being rendered as <code>& # 9 5 ;</code> - I hope that's not going to show up that way in the post.</p>
|
<p>Go to about:ubiquity in Firefox. Under the section "subscribed feeds" there should be an option to unsubscribe to command feeds you no longer desire.</p>
<p>Also, if you clear your entire browser history, it will delete all command feeds (this will be fixed by 0.2)</p>
|
<p>Check this out:
<a href="http://getsatisfaction.com/mozilla/topics/how_do_you_edit_delete_the_default_ubiquity_commands_verbs" rel="nofollow noreferrer">http://getsatisfaction.com/mozilla/topics/how_do_you_edit_delete_the_default_ubiquity_commands_verbs</a></p>
<p>Also, you can find a utility to reset your ubiquity to default in \extensions\ubiquity@labs.mozilla.com\chrome\content\reset.html
EDIT1: The above file does nothing, please ignore.</p>
<p>EDIT2 (answer?): You can use the ffx addon SQLite Manager to open the \ubiquity_ann.sqlite database and remove all rows for the command you want to delete (there will be several rows, but they are identified by the url the script came from and so easy to identify). When you restart firefox, the command will be gone.
(The code that populates the Commands page uses javascript to create an instance of UbiquitySetup object, and executes the method .createServices().commandSource which reads that SQLite database directly for a list of commands (returning an object or array of objects/commands to iterate through). This seems to delete the command itself, since it will no longer be found in ubiquity or the command list.)</p>
<p>Good luck.</p>
| 5,686
|
<p>Let's say I had a program in C# that did something computationally expensive, like encoding a list of WAV files into MP3s. Ordinarily I would encode the files one at a time, but let's say I wanted the program to figure out how many CPU cores I had and spin up an encoding thread on each core. So, when I run the program on a quad core CPU, the program figures out it's a quad core CPU, figures out there are four cores to work with, then spawns four threads for the encoding, each of which is running on its own separate CPU. How would I do this?</p>
<p>And would this be any different if the cores were spread out across multiple physical CPUs? As in, if I had a machine with two quad core CPUs on it, are there any special considerations or are the eight cores across the two dies considered equal in Windows?</p>
|
<p>Don't bother doing that.</p>
<p>Instead use the <a href="http://msdn.microsoft.com/en-us/library/system.threading.threadpool.aspx" rel="noreferrer">Thread Pool</a>. The thread pool is a mechanism (actually a class) of the framework that you can query for a new thread.</p>
<p>When you ask for a new thread it will either give you a new one or enqueue the work until a thread get freed. In that way the framework is in charge on deciding wether it should create more threads or not depending on the number of present CPUs.</p>
<p>Edit: In addition, as it has been already mentioned, the OS is in charge of distributing the threads among the different CPUs.</p>
|
<p>One of the reasons you should not (as has been said) try to allocated this sort of stuff yourself, is that you just don't have enough information to do it properly, particularly into the future with NUMA, etc. </p>
<p>If you have a thread read-to-run, and there's a core idle, the kernel <em>will</em> run your thread, don't worry.</p>
| 5,226
|
<p>With SVN, I had a single big repository I kept on a server, and checked-out on a few machines. This was a pretty good backup system, and allowed me easily work on any of the machines. I could checkout a specific project, commit and it updated the 'master' project, or I could checkout the entire thing.</p>
<p>Now, I have a bunch of git repositories, for various projects, several of which are on github. I also have the SVN repository I mentioned, imported via the git-svn command..</p>
<p>Basically, I like having all my code (not just projects, but random snippets and scripts, some things like my CV, articles I've written, websites I've made and so on) in one big repository I can easily clone onto remote machines, or memory-sticks/harddrives as backup.</p>
<p>The problem is, since it's a private repository, and git doesn't allow checking out of a specific folder (that I could push to github as a separate project, but have the changes appear in both the master-repo, and the sub-repos)</p>
<p>I <em>could</em> use the git submodule system, but it doesn't act how I want it too (submodules are pointers to other repositories, and don't really contain the actual code, so it's useless for backup)</p>
<p>Currently I have a folder of git-repos (for example, ~/code_projects/proj1/.git/ ~/code_projects/proj2/.git/), and after doing changes to proj1 I do <code>git push github</code>, then I copy the files into ~/Documents/code/python/projects/proj1/ and do a single commit (instead of the numerous ones in the individual repos). Then do <code>git push backupdrive1</code>, <code>git push mymemorystick</code> etc</p>
<p>So, the question: How do your personal code and projects with git repositories, and keep them synced and backed-up?</p>
|
<p>I would <strong>strongly</strong> advise against putting unrelated data in a given
Git repository. The overhead of creating new repositories is quite
low, and that is a <em>feature</em> that makes it possible to keep
different lineages completely separate.</p>
<p>Fighting that idea means ending up with unnecessarily tangled history,
which renders administration more difficult and--more
importantly--"archeology" tools less useful because of the resulting
dilution. Also, as you mentioned, Git assumes that the "unit of
cloning" is the repository, and practically has to do so because of
its distributed nature.</p>
<p>One solution is to keep every project/package/etc. as its own <em>bare</em>
repository (i.e., without working tree) under a blessed hierarchy,
like:</p>
<pre><code>/repos/a.git
/repos/b.git
/repos/c.git
</code></pre>
<p>Once a few conventions have been established, it becomes trivial to
apply administrative operations (backup, packing, web publishing) to
the complete hierarchy, which serves a role not entirely dissimilar to
"monolithic" SVN repositories. Working with these repositories also
becomes somewhat similar to SVN workflows, with the addition that one
<em>can</em> use local commits and branches:</p>
<pre><code>svn checkout --> git clone
svn update --> git pull
svn commit --> git push
</code></pre>
<p>You can have multiple remotes in each working clone, for the ease of
synchronizing between the multiple parties:</p>
<pre><code>$ cd ~/dev
$ git clone /repos/foo.git # or the one from github, ...
$ cd foo
$ git remote add github ...
$ git remote add memorystick ...
</code></pre>
<p>You can then fetch/pull from each of the "sources", work and commit
locally, and then push ("backup") to each of these remotes when you
are ready with something like (note how that pushes the <em>same</em> commits
and history to each of the remotes!):</p>
<pre><code>$ for remote in origin github memorystick; do git push $remote; done
</code></pre>
<p>The easiest way to turn an existing working repository <code>~/dev/foo</code>
into such a bare repository is probably:</p>
<pre><code>$ cd ~/dev
$ git clone --bare foo /repos/foo.git
$ mv foo foo.old
$ git clone /repos/foo.git
</code></pre>
<p>which is mostly equivalent to a <code>svn import</code>--but does not throw the
existing, "local" history away.</p>
<p>Note: <em>submodules</em> are a mechanism to include shared <em>related</em>
lineages, so I indeed wouldn't consider them an appropriate tool for
the problem you are trying to solve.</p>
|
<p>There is another method for having nested git repos, but it doesn't solve the problem you're after. Still, for others who are looking for the solution I was:</p>
<p>In the top level git repo just hide the folder in .gitignore containing the nested git repo. This makes it easy to have two separate (but nested!) git repos.</p>
| 5,745
|
<p>I'm having trouble with events in Internet Explorer 7.</p>
<p>When I have a form with <strong>two or more</strong> <code>input[type=text]</code> and I press enter, the events occurs in this order:</p>
<ol>
<li>submit button (<code>onClick</code>)</li>
<li>form (<code>onSubmit</code>)</li>
</ol>
<p>Sample code:</p>
<pre><code><form onSubmit="{alert('form::onSubmit'); return false;}">
<input type="text">
<input type="text">
<input type="submit" onClick="{alert('button::onClick');}">
</form>
</code></pre>
<p>If I have only <strong>one</strong> <code>input[type=text]</code> and I press enter the submit button <code>onClick</code> event doesn't fire. Sample code:</p>
<pre><code><form onSubmit="{alert('form::onSubmit'); return false;}">
<input type="text">
<input type="submit" onClick="{alert('button::onClick');}">
</form>
</code></pre>
|
<p>The button's onclick should (I think) only fire if the button is actually clicked (or when the focus is on it and the user clicks enter), unless you've added logic to change that.</p>
<p>Is the addition of the extra textbox possibly changing the tab order of your elements (perhaps making the button the default control in that case)?</p>
|
<p>You might want to include a dummy hidden input element to recreate the situation where you had two input elements... that way, you'll get both of the events fired</p>
<pre><code><FORM onSubmit="{alert('form::onSubmit'); return false;}">
<INPUT TYPE="text">
<input type="hidden" name="dummy">
<INPUT TYPE="submit" onClick="{alert('buttom::onClick');}">
</FORM>
</code></pre>
<p>IE has a lot of confusing fixes that needs to be done for improving compatibility of our code</p>
| 3,071
|
<p>I'm writing my first iPhone app, so I haven't gotten around to figuring out much in the way of debugging.
Essentially my app displays an image and when touched plays a short sound.
When compiling and building the project in XCode, everything builds successfully, but when the app is run in the iPhone simulator, it crashes.</p>
<p>I get the following error:</p>
<pre><code>Application Specific Information:
iPhone Simulator 1.0 (70), iPhone OS 2.0 (5A331)
*** Terminating app due to uncaught exception 'NSUnknownKeyException',
reason: '[<UIView 0x34efd0> setValue:forUndefinedKey:]: this class is not key value
coding-compliant for the key kramerImage.'
</code></pre>
<p>kramerImage here is the image I'm using for the background.</p>
<p>I'm not sure what NSUnknownKeyException means or why the class is not key value coding-compliant for the key.</p>
|
<p>(This isn't really iPhone specific - the same thing will happen in regular Cocoa).</p>
<p>NSUnknownKeyException is a common error when using <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/KeyValueCoding.html" rel="nofollow noreferrer">Key-Value Coding</a> to access a key that the object doesn't have.</p>
<p>The properties of most Cocoa objects can be accessing directly:</p>
<pre><code>[@"hello world" length] // Objective-C 1.0
@"hello world".length // Objective-C 2.0
</code></pre>
<p>Or via Key-Value Coding:</p>
<pre><code>[@"hello world" valueForKey:@"length"]
</code></pre>
<p>I would get an NSUnknownKeyException if I used the following line:</p>
<pre><code>[@"hello world" valueForKey:@"purpleMonkeyDishwasher"]
</code></pre>
<p>because NSString does not have a property (key) called 'purpleMonkeyDishwasher'.</p>
<p>Something in your code is trying to set a value for the key 'kramerImage' on an UIView, which (apparently) doesn't support that key. If you're using Interface Builder, it might be something in your nib.</p>
<p>Find where 'kramerImage' is being used, and try to track it down from there.</p>
|
<p>It seems you are doing</p>
<pre><code>@interface MyFirstIphoneAppViewController : UIViewController<> {
UIImageView *InitialkramerImage;
}
@property(nonatomic,retain) IBOutlet UIImageView *InitialkramerImage;
</code></pre>
<p>Then after synthesizing that imageview, When you open "MyFirstIphoneAppViewController.xib" in Interface Builder, you are taking an Image View from Tool(menu)/Library den linking that outlet to the 'InitialkramerImage' from the Files Owner of "MyFirstIphoneAppViewController.xib". Then you saved the project. But after that you might change the name of the outlet variable "InitialkramerImage" to "kramerImage". So, after doing this </p>
<pre><code>@interface MyFirstIphoneAppViewController : UIViewController<> {
UIImageView *kramerImage;
}
@property(nonatomic,retain) IBOutlet UIImageView *kramerImage;
</code></pre>
<p>and saving the project when you run it, There is no existance of the outlet of "InitialkramerImage" in the "MyFirstIphoneAppViewController.xib". So, when you run the project there will be no outlet referencing from Imageview to the 'kramerImage' and </p>
<blockquote>
<p>"For displaying the view,
UIViewController will try to find the
outlet to "InitialkramerImage" which
is not existing."</p>
</blockquote>
<p>So, It will throw the "NSUnknownKeyException". </p>
<blockquote>
<p>You can check the missing outlet by
opening the nib(.xib) file then right
clicking on the 'Files Owner' of that.</p>
</blockquote>
| 6,828
|
<p>I'm stuck on a fix to a legacy Visual C++ 6 app. In the C++ DLL source I have put</p>
<pre><code>extern "C" _declspec(dllexport) char* MyNewVariable = 0;
</code></pre>
<p>which results in MyNewVariable showing up (nicely undecorated) in the export table (as shown by dumpbin /exports blah.dll). However, I can't figure out how to declare the variable so that I can access it in a C source file. I have tried various things, including</p>
<pre><code>_declspec(dllimport) char* MyNewVariable;
</code></pre>
<p>but that just gives me a linker error:</p>
<p>unresolved external symbol "__declspec(dllimport) char * MyNewVariable" (__imp_?MyNewVariable@@3PADA)</p>
<pre><code>extern "C" _declspec(dllimport) char* MyNewVariable;
</code></pre>
<p>as suggested by Tony (and as I tried before) results in a different expected decoration, but still hasn't removed it:</p>
<p>unresolved external symbol __imp__MyNewVariable</p>
<p>How do I write the declaration so that the C++ DLL variable is accessible from the C app?</p>
<hr>
<h2>The Answer</h2>
<p>As identified by botismarius and others (many thanks to all), I needed to link with the DLL's .lib. To prevent the name being mangled I needed to declare it (in the C source) with no decorators, which means I needed to use the .lib file.</p>
|
<p>you must link against the lib generated after compiling the DLL. In the linker options of the project, you must add the <code>.lib</code> file. And yes, you should also declare the variable as:</p>
<pre><code>extern "C" { declspec(dllimport) char MyNewVariable; }
</code></pre>
|
<p>I've never used _declspec(dllimport) when I was programming in Windows. You should be able to simply declare </p>
<pre><code>extern "C" char* MyNewVariable;
</code></pre>
<p>and link to the .libb created when DLL was compiled.</p>
| 8,044
|
<p>I took a look at the "Beginner's Guide to LINQ" post here on StackOverflow (<a href="https://stackoverflow.com/questions/8050/beginners-guide-to-linq">Beginners Guide to LINQ</a>), but had a follow-up question:</p>
<p>We're about to ramp up a new project where nearly all of our database op's will be fairly simple data retrievals (there's another segment of the project which already writes the data). Most of our other projects up to this point make use of stored procedures for such things. However, I'd like to leverage LINQ-to-SQL if it makes more sense.</p>
<p>So, the question is this: For simple data retrievals, which approach is better, LINQ-to-SQL or stored procs? Any specific pro's or con's?</p>
<p>Thanks.</p>
|
<p>Some advantages of LINQ over sprocs:</p>
<ol>
<li><strong>Type safety</strong>: I think we all understand this.</li>
<li><strong>Abstraction</strong>: This is especially true with <a href="http://msdn.microsoft.com/en-us/library/bb386964.aspx" rel="noreferrer">LINQ-to-Entities</a>. This abstraction also allows the framework to add additional improvements that you can easily take advantage of. <a href="http://msdn.microsoft.com/en-us/magazine/cc163329.aspx" rel="noreferrer">PLINQ</a> is an example of adding multi-threading support to LINQ. Code changes are minimal to add this support. It would be MUCH harder to do this data access code that simply calls sprocs.</li>
<li><strong>Debugging support</strong>: I can use any .NET debugger to debug the queries. With sprocs, you cannot easily debug the SQL and that experience is largely tied to your database vendor (MS SQL Server provides a query analyzer, but often that isn't enough).</li>
<li><strong>Vendor agnostic</strong>: LINQ works with lots of databases and the number of supported databases will only increase. Sprocs are not always portable between databases, either because of varying syntax or feature support (if the database supports sprocs at all).</li>
<li><strong>Deployment</strong>: Others have mentioned this already, but it's easier to deploy a single assembly than to deploy a set of sprocs. This also ties in with #4.</li>
<li><strong>Easier</strong>: You don't have to learn T-SQL to do data access, nor do you have to learn the data access API (e.g. ADO.NET) necessary for calling the sprocs. This is related to #3 and #4.</li>
</ol>
<p>Some disadvantages of LINQ vs sprocs:</p>
<ol>
<li><strong>Network traffic</strong>: sprocs need only serialize sproc-name and argument data over the wire while LINQ sends the entire query. This can get really bad if the queries are very complex. However, LINQ's abstraction allows Microsoft to improve this over time.</li>
<li><strong>Less flexible</strong>: Sprocs can take full advantage of a database's featureset. LINQ tends to be more generic in it's support. This is common in any kind of language abstraction (e.g. C# vs assembler).</li>
<li><strong>Recompiling</strong>: If you need to make changes to the way you do data access, you need to recompile, version, and redeploy your assembly. Sprocs can <em>sometimes</em> allow a DBA to tune the data access routine without a need to redeploy anything.</li>
</ol>
<p>Security and manageability are something that people argue about too.</p>
<ol>
<li><strong>Security</strong>: For example, you can protect your sensitive data by restricting access to the tables directly, and put ACLs on the sprocs. With LINQ, however, you can still restrict direct access to tables and instead put ACLs on updatable table <em>views</em> to achieve a similar end (assuming your database supports updatable views). </li>
<li><strong>Manageability</strong>: Using views also gives you the advantage of shielding your application non-breaking from schema changes (like table normalization). You can update the view without requiring your data access code to change.</li>
</ol>
<p>I used to be a big sproc guy, but I'm starting to lean towards LINQ as a better alternative in general. If there are some areas where sprocs are clearly better, then I'll probably still write a sproc but access it using LINQ. :)</p>
|
<p>Both LINQ and SQL have their places. Both have their disadvantages and advantages.</p>
<p>Sometimes for complex data retrieval you might need stored procs. And sometimes you may want other people to use your stored proc in Sql Server Management Studio.</p>
<p>Linq to Entities is great for fast CRUD development.</p>
<p>Sure you can build an app using only one or the other. Or you can mix it up. It all comes down to your requirements. But SQL stored procs will no go away any time soon.</p>
| 3,535
|
<p>Are there any systems out there where one can check in changes for a website and have that automatically update the website. </p>
<p>The website effetively runs off the latest stable build the whole time without the need to ftp the files to the server.</p>
|
<p>I would look into using a <a href="http://svnbook.red-bean.com/en/1.4/svn.ref.reposhooks.post-commit.html" rel="nofollow noreferrer">post-commit hook</a> to update the site when changes are made. This could be something as simple as using "svn export" to export the current state of the repository to the live website location. Of course, this has performance considerations if your site has lots of content, so you may want to do something more sophisticated and only push updates for content that was changed in the commit.</p>
|
<p>SVN's post_commit hook is ideal for things like this.</p>
<p><a href="http://amiworks.co.in/talk/ads-automatic-deployment-script/" rel="nofollow noreferrer">ADS (automatic deployment script</a> looks like a solution to this, but I've never tried it - just found it with a few seconds of Googling.</p>
| 9,662
|
<p>Does anyone here use VB.NET and have a strong preference for or against using <code>IsNothing</code> as opposed to <code>Is Nothing</code> (for example, <code>If IsNothing(anObject)</code> or <code>If anObject Is Nothing...</code>)? If so, why?</p>
<p>EDIT: If you think they're both equally acceptable, do you think it's best to pick one and stick with it, or is it OK to mix them?</p>
|
<p>If you take a look at the MSIL as it's being executed you'll see that it doesn't compile down to the exact same code. When you use IsNothing() it actually makes a call to that method as opposed to just evaluating the expression. </p>
<p>The reason I would tend to lean towards using "Is Nothing" is when I'm negating it becomes "IsNot Nothing' rather than "Not IsNothing(object)" which I personally feel looks more readable.</p>
|
<p>Is Nothing requires an object that has been assigned to the value Nothing. IsNothing() can take any variable that has not been initialized, including of numeric type. This is useful for example when testing if an optional parameter has been passed.</p>
| 2,763
|
<p>I recall seeing that it's possible to "bake" or "anneal" or even "remelt" PLA prints to strengthen them. As I understand it, the main effect is improving layer adhesion, which is the main source of weakness in tension in the original Z-axis direction.</p>
<p>Yes, I can print with a hotter nozzle (up to a point) to increase layer adhesion, print with a larger nozzle orifice, print with increased layer height, print slower -- but at a minimum those require reslicing, and affect print appearance (hotter nozzle causes stringing, thicker layers are more visible, etc.).</p>
<p>Baking a print does none of that, as long as it's supported (often done by bedding it in salt).</p>
<p><strong>Question is, how hot?</strong> I presume I don't want to go all the way to printing temperature of 180-220 °C, but the plastic transition level of roundly 50 °C isn't hot enough for this.</p>
|
<p>I've only annealed PEEK personally, but a quick search returns varying recommendations:</p>
<ul>
<li><p><a href="https://all3dp.com/2/annealing-pla-prints-for-strength-easy-ways/" rel="nofollow noreferrer">All3DP</a>
recommends 1 hour at 70 °C.</p>
</li>
<li><p><a href="https://x3d.com.au/blogs/tips-and-tricks/pla-baking-the-secret-to-a-stronger-and-more-rigid-pla" rel="nofollow noreferrer">X3D</a>
recommends 1 hour at 110 °C.</p>
</li>
<li><p><a href="https://www.matterhackers.com/articles/how-to-anneal-tough-pla-and-htpla" rel="nofollow noreferrer">Matterhackers</a>
recommends 10 minutes at 105 °C for Tough PLA or HTPLA.</p>
</li>
<li><p>A post on
<a href="https://www.reddit.com/r/3Dprinting/comments/3a1qdy/baking_filament/" rel="nofollow noreferrer">Reddit</a>
recommends "a few hours" at 110 °C.</p>
</li>
</ul>
<p>I'd do a test suite with pieces at 70 °, 90 °, and 110 °C for an hour each and test/compare.</p>
<p>Be mindful of any chemicals that might be released.</p>
|
<p>I've only annealed PEEK personally, but a quick search returns varying recommendations:</p>
<ul>
<li><p><a href="https://all3dp.com/2/annealing-pla-prints-for-strength-easy-ways/" rel="nofollow noreferrer">All3DP</a>
recommends 1 hour at 70 °C.</p>
</li>
<li><p><a href="https://x3d.com.au/blogs/tips-and-tricks/pla-baking-the-secret-to-a-stronger-and-more-rigid-pla" rel="nofollow noreferrer">X3D</a>
recommends 1 hour at 110 °C.</p>
</li>
<li><p><a href="https://www.matterhackers.com/articles/how-to-anneal-tough-pla-and-htpla" rel="nofollow noreferrer">Matterhackers</a>
recommends 10 minutes at 105 °C for Tough PLA or HTPLA.</p>
</li>
<li><p>A post on
<a href="https://www.reddit.com/r/3Dprinting/comments/3a1qdy/baking_filament/" rel="nofollow noreferrer">Reddit</a>
recommends "a few hours" at 110 °C.</p>
</li>
</ul>
<p>I'd do a test suite with pieces at 70 °, 90 °, and 110 °C for an hour each and test/compare.</p>
<p>Be mindful of any chemicals that might be released.</p>
| 1,988
|
<p>I have a folder in my web server used for the users to upload photos using an ASP page.</p>
<p>Is it safe enough to give IUSR write permissions to the folder? Must I secure something else?
I am afraid of hackers bypassing the ASP page and uploading content directly to the folder.</p>
<p>I'm using ASP classic and IIS6 on Windows 2003 Server. The upload is through HTTP, not FTP.</p>
<p>Edit: Changing the question for clarity and changing my answers as comments.</p>
|
<p>also, I would recommend not to let the users upload into a folder that's accessible from the web. Even the best MIME type detection may fail and you absolutely don't want users to upload, say, an executable disguised as a jpeg in a case where your MIME sniffing fails, but the one in IIS works correctly.</p>
<p>In the PHP world it's even worse, because an attacker could upload a malicious PHP script and later access it via the webserver.</p>
<p>Always, always store the uploaded files in a directory somewhere outside the document root and access them via some accessing-script which does additional sanitizing (and at least explicitly sets a image/whatever MIME type.</p>
|
<p>You'll have to grant write permissions, but you can check the file's mime type to ensure an image. You can use FSO as so:</p>
<pre><code>set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.GetFile("upload.jpg")
'image mime types or image/jpeg or image/gif, so just check to see if "image" is instr
if instr(f.type, "image") = 0 then
f.delete
end if
set f=nothing
set fs=nothing
</code></pre>
<p>Also, most upload COM objects have a type property that you could check against before writing the file.</p>
| 4,256
|
<p>How to determine the applications associated with a particular extension (e.g. .JPG) and then determine where the executable to that application is located so that it can be launched via a call to say System.Diagnostics.Process.Start(...).</p>
<p>I already know how to read and write to the registry. It is the layout of the registry that makes it harder to determine in a standard way what applications are associated with an extension, what are there display names, and where their executables are located.</p>
|
<p>Sample code:</p>
<pre><code>using System;
using Microsoft.Win32;
namespace GetAssociatedApp
{
class Program
{
static void Main(string[] args)
{
const string extPathTemplate = @"HKEY_CLASSES_ROOT\{0}";
const string cmdPathTemplate = @"HKEY_CLASSES_ROOT\{0}\shell\open\command";
// 1. Find out document type name for .jpeg files
const string ext = ".jpeg";
var extPath = string.Format(extPathTemplate, ext);
var docName = Registry.GetValue(extPath, string.Empty, string.Empty) as string;
if (!string.IsNullOrEmpty(docName))
{
// 2. Find out which command is associated with our extension
var associatedCmdPath = string.Format(cmdPathTemplate, docName);
var associatedCmd =
Registry.GetValue(associatedCmdPath, string.Empty, string.Empty) as string;
if (!string.IsNullOrEmpty(associatedCmd))
{
Console.WriteLine("\"{0}\" command is associated with {1} extension", associatedCmd, ext);
}
}
}
}
}
</code></pre>
|
<p>The file type associations are stored in the Windows registry, so you should be able to use the <a href="http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.aspx#Mtps_DropDownFilterText" rel="nofollow noreferrer">Microsoft.Win32.Registry class</a> to read which application is registered for which file format.</p>
<p>Here are two articles that might be helpful:</p>
<ul>
<li><a href="http://www.informit.com/articles/article.aspx?p=26957" rel="nofollow noreferrer">Reading and Writing the Registry in .NET</a></li>
<li><a href="http://www.dotnetspider.com/resources/988-Windows-Registry-using-C.aspx" rel="nofollow noreferrer">Windows Registry Using C#</a></li>
</ul>
| 4,459
|
<p>I´ve tried tunning printer settings with different Nozzle(190-210 ºC)/ Bed(0-60 ºC) Temperatures, Fan Speeds (0-100 %), Cura and Slicer adjustemens but nothing worked. I still get the same bubbles in the first 3 mm of every print.
I also tried a glass bed and the magnetic bed that comes with Ender 3 pro and the result is still the same.
The last thing I tried was moving the 0 position of the Z axis 10 mm up, but it didn´work.</p>
<p>What else could I try? Any idea of which could be the issue. Thanks in advance.</p>
<p><a href="https://i.stack.imgur.com/xpCwy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xpCwy.jpg" alt="enter image description here"></a></p>
<p><a href="https://i.stack.imgur.com/Q32Pv.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q32Pv.jpg" alt="enter image description here"></a></p>
|
<p>It seems like your bed might be too close to the nozzle, hence the large elephants foot (bulge on the first layer). You can try using babystep Z to increase the distance between the nozzle and the bed and see how that works out. I think you might need to reduce the flow multiplier (extrusion multiplier) a little too.</p>
|
<p>It seems like your bed might be too close to the nozzle, hence the large elephants foot (bulge on the first layer). You can try using babystep Z to increase the distance between the nozzle and the bed and see how that works out. I think you might need to reduce the flow multiplier (extrusion multiplier) a little too.</p>
| 1,637
|
<p>It's big problem to convert mod_rewrite rules to lighttpd format</p>
|
<p>It is generally a case of just going through one by one and converting them. I don't know of any automated means,</p>
<p>The docs - <a href="http://redmine.lighttpd.net/projects/1/wiki/Docs:ModRewrite" rel="nofollow noreferrer">http://redmine.lighttpd.net/projects/1/wiki/Docs:ModRewrite</a> - has the regexes available, and some examples.</p>
<p>if there are any particularly problematical items, I'd edit the question to show them, and ask for the answers here.</p>
|
<p>url rewriting does not work within a $HTTP["url"] conditional. [<a href="http://forum.lighttpd.net/topic/1092#3028]" rel="nofollow noreferrer">http://forum.lighttpd.net/topic/1092#3028]</a></p>
| 8,777
|
<p>I have an asp.net web page written in C#.<br>
Using some javascript I popup another .aspx page which has a few controls that are filled in and from which I create a small snippet of text.<br>
When the user clicks OK on that dialog box I want to insert that piece of text into a textbox on the page that initial "popped up" the dialog/popup page. </p>
<p>I'm guessing that this will involve javascript which is not a strong point of mine.</p>
<p>How do I do this?</p>
|
<p>You will have to do something like:</p>
<pre><code>parent.opener.document.getElemenyById('ParentTextBox').value = "New Text";
</code></pre>
|
<p>What you could do is create an ajax modal pop-up instead of a new window. The semantic and aesthetic value is greater not to mention the data-passing is much easier.</p>
<p><a href="http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx" rel="nofollow noreferrer">http://www.asp.net/ajax/ajaxcontroltoolkit/samples/modalpopup/modalpopup.aspx</a></p>
| 7,892
|
<p>I have the following HTML (note the CSS making the background black and text white)</p>
<pre><code><html>
<select id="opts" style="background-color: black; color: white;">
<option>first</option>
<option>second</option>
</select>
</html>
</code></pre>
<p>Safari is smart enough to make the small triangle that appears to the right of the text the same color as the foreground text.</p>
<p>Other browsers basically ignore the CSS, so they're fine too.</p>
<p>Firefox 3 however applies the background color but leaves the triangle black, so you can't see it, like this</p>
<p><img src="https://i.stack.imgur.com/Mvc7a.jpg" alt="Example"></p>
<p>I can't find out how to fix this - can anyone help? Is there a <code>-moz-select-triangle-color</code> or something obscure like that?</p>
|
<p>Must be a <code>Vista</code> problem. I have <code>XP SP 2</code> and it looks normal. </p>
|
<blockquote>
<p>I dropped that code into a file and pushed it to ff3 and I don't see what you see...the arrow is default color with gray background and black arrow.</p>
<p>Are you styling scrollbars too?</p>
</blockquote>
<p>I've updated the post, the HTML in there is now literally <em>all</em> the html that is being loaded, no other CSS/JS or anything, and it still looks exactly as posted in the pic.</p>
<p>Note I'm on vista. It may do different things on XP, I haven't checked</p>
| 4,891
|
<p>I need to use XmlRpc in C++ on a Windows platform. Despite the fact that my friends assure me that XmlRpc is a "widely available standard technology", there are not many libraries available for it. In fact I only found one library to do this on Windows, (plus another one that claims "you'll have to do a lot of work to get this to compile on Windows). The library I found was Chris Morley's "XmlRpc++". However, it doesn't have support for SSL.</p>
<p>My question therefore is: what library should I be using? </p>
|
<p>I've written my own C++ library. It's available at sourceforge:
<a href="http://sourceforge.net/projects/xmlrpcc4win/" rel="noreferrer">xmlrpcc4win</a></p>
<p>The reason I wrote it rather than using Chris Morley's was that:</p>
<ul>
<li>The Windows "wininet.lib" library gives you all the functionality for handling Http requests, so I'd rather use that. As a result, I only needed 1700 LOC.</li>
<li>"wininet.lib", and therefore my implementation, supports HTTPS</li>
<li>Chris Morley's use of STL containers was quite inefficient (Chris, mail me if you read this).</li>
</ul>
|
<p>There are dozens of implementations of the XML-RPC <a href="http://www.xmlrpc.com/directory/1568/implementations" rel="nofollow noreferrer">implementations</a>, some in C++, but most in other languages. For example, besides XmlRpc++ there is also <a href="http://xmlrpc-c.sourceforge.net/" rel="nofollow noreferrer">XML-RPC for C and C++</a>. Here is a <a href="http://tldp.org/HOWTO/XML-RPC-HOWTO/xmlrpc-howto-c.html" rel="nofollow noreferrer">HOWTO</a> on how the XML-RPC for C and C++ library can be used.</p>
<p>The XML-RPC specification is somewhat simple and it would not be difficult to implement your own XML-RPC client. Not to mention, it would also be possible to take an existing XML-RPC implementation in C and bring into your C++ project.</p>
<p>The XML-RPC <a href="http://www.xmlrpc.com/" rel="nofollow noreferrer">home page</a> also provides a lot of useful information.</p>
| 9,364
|
<p>This is a difficult and open-ended question I know, but I thought I'd throw it to the floor and see if anyone had any interesting suggestions.</p>
<p>I have developed a code-generator that takes our python interface to our C++ code (generated via SWIG) and generates code needed to expose this as WebServices. When I developed this code I did it using TDD, but I've found my tests to be brittle as hell. Because each test essentially wanted to verify that for a given bit of input code (which happens to be a C++ header) I'd get a given bit of outputted code I wrote a small engine that reads test definitions from XML input files and generates test cases from these expectations.</p>
<p>The problem is I dread going in to modify the code at all. That and the fact that the unit tests themselves are a: complex, and b: brittle.</p>
<p>So I'm trying to think of alternative approaches to this problem, and it strikes me I'm perhaps tackling it the wrong way. Maybe I need to focus more on the outcome, IE: does the code I generate actually run and do what I want it to, rather than, does the code look the way I want it to.</p>
<p>Has anyone got any experiences of something similar to this they would care to share?</p>
|
<p>I started writing up a summary of my experience with my own code generator, then went back and re-read your question and found you had already touched upon the same issues yourself, focus on the execution results instead of the code layout/look.</p>
<p>Problem is, this is hard to test, the generated code might not be suited to actually run in the environment of the unit test system, and how do you encode the expected results?</p>
<p>I've found that you need to break down the code generator into smaller pieces and unit test those. Unit testing a full code generator is more like integration testing than unit testing if you ask me.</p>
|
<p>Yes, results are the ONLY thing that matters. The real chore is writing a framework that allows your generated code to run independently... spend your time there.</p>
| 3,225
|
<p>Why should I or shouldn't I use dirty reads:</p>
<pre><code>set transaction isolation level read uncommitted
</code></pre>
<p>in SQL Server?</p>
|
<p>From <a href="http://msdn.microsoft.com/en-us/library/aa259216(SQL.80).aspx" rel="noreferrer">MSDN</a>:</p>
<blockquote>
<p>When this option is set, it is possible to read uncommitted or dirty data; values in the data can be changed and rows can appear or disappear in the data set before the end of the transaction. </p>
</blockquote>
<p>Simply put, when you are using this isolation level, and you are performing multiple queries on an active table as part of one transaction, there is no guarantee that the information returned to you within different parts of the transaction will remain the same. You could query the same data twice within one transaction and get different results (this might happen in the case where a different user was updating the same data in the midst of your transaction). This can obviously have severe ramifications for parts of your application that rely on data integrity.</p>
|
<p>The Thing is when you want to read the data before committing, we can do with the help of set transaction isolation level read uncommitted, the data may, or may not change.</p>
<p>We can read the data by using the query:</p>
<pre><code>Select * from table_name with(nolock)
</code></pre>
<p>This is applicable to only read uncommitted isolation level.</p>
| 4,119
|
<p>I have a Microsoft keyboard with a series of non-standard buttons such as "Mail", "Search" , "Web/Home" etc.</p>
<p>It would be nice to be able to bind these keys so they execute arbitrary programs.</p>
<p>Does anybody know how to do this in Debian Etch?</p>
|
<p>I can't say for certain because I'm not using Debian but if you're using Gnome the easiest way is to run gnome-keybinding-properties (System > Preferences > Keyboard Shortcuts)</p>
<p>Instead of typing a shortcut such as <kbd>Ctrl</kbd>+<kbd>M</kbd>, hit the button on your keyboard.</p>
<p>If you would prefer to do this via command line or with a different desktop environment, this may help: <a href="http://www.tldp.org/HOWTO/Keyboard-and-Console-HOWTO-14.html" rel="nofollow noreferrer">Unusual keys and keyboards</a></p>
|
<p>I used Gizmo Daemon for my PowerMate under Debian - it supports fancy keyboard keys as well (although I haven't tried it for those keys). Hacking on gizmod to get it to do what I wanted was pretty easy.</p>
<p><a href="http://gizmod.sourceforge.net/" rel="nofollow noreferrer">Gizmo Daemon</a></p>
| 2,851
|
<p>I’ve writen a little python script that just pops up a message box containing the text passed on the command line. I want to pop it up only when the window —resulting from a previous call— is not open.</p>
<pre><code>from Tkinter import *
import tkMessageBox
root = Tk()
root.withdraw()
# TODO not if a window with this title exists
tkMessageBox.showinfo("Key you!", " ".join(sys.argv[1:]))
</code></pre>
<p>Any idea how to check that?</p>
|
<p>I believe you want:</p>
<pre><code>if 'normal' != root.state():
tkMessageBox.showinfo("Key you!", " ".join(sys.argv[1:]))
</code></pre>
|
<p>The previous answer works accordingly to the code you have provided. You say it does not work because the answerer complies with "sois bête et discipliné" rule in that he did not add <code>root.mainloop()</code> to his code since your question does not either.</p>
<p>By adding the later line, for some reason caused by the event loop, you should test the exact string "withdrawn" as follows:</p>
<pre><code>import tkinter as tk
from tkinter import messagebox
import sys
root = tk.Tk()
root.withdraw()
if 'withdrawn' != root.state():
messagebox.showinfo("Key you!", sys.argv[1:])
root.mainloop()
</code></pre>
<p>Note: do not run this code otherwise your Terminal session will hang up. To circumvent this discomfort, you will have to reset the window state using either <code>root.state("normal")</code> which will lead to the message box to disappear as if a click on the Ok button occurred, or <code>root.iconify()</code> through which you can stop the Terminal session to hang up by right clicking on the tkinter icon appearing on your OS taskbar.</p>
| 6,745
|
<p>I'd like to rollback a change I made recently in TFS. In Subversion, this was pretty straightforward. However, it seems to be an incredible headache in TFS:</p>
<h3>Option 1: Get Prior Version</h3>
<ol>
<li>Manually get prior version of each file</li>
<li>Check out for edit</li>
<li>Fail - the checkout (in VS2008) forces me to get the latest version</li>
</ol>
<h3>Option 2: Get TFS Power Tools</h3>
<ol>
<li>Download Team Foundation Power Tools</li>
<li>Issue rollback command from cmd line</li>
<li>Fail - it won't work if there are any other pending changes</li>
</ol>
<h3>Option 3: Manually Undo Changes</h3>
<ol>
<li>manually undo my changes, then commit a new changeset</li>
</ol>
<h3>Question</h3>
<p>How do I rollback to a previous changeset in TFS?</p>
|
<ol>
<li>Download and install <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=15836" rel="noreferrer">Team Foundation Power Tools</a>. </li>
<li>Open up the Visual Studio command prompt</li>
<li>Navigate to the directory on the file system that TFS is mapped to. If you don't do this you'll get an "Unable to determine the workspace" error when you try to roll back</li>
<li>Make sure everything else is checked in or shelved</li>
<li>run tfpt rollback to bring up the interface. </li>
<li>Choose the changesets you want to rollback</li>
<li>Check in the new versions of the files you rolled back</li>
</ol>
<p>The big disadvantage of the tool is that it will want to refresh everything in your workspace before you can merge. I got around this issue by creating a new workspace just for the rollback which mapped directly to the place in the source tree where the affected files were. </p>
<p>If you need help to figure out which changesets to roll back, I find the code review tool in the free <a href="http://www.attrice.info/cm/tfs/" rel="noreferrer">Team Foundation Side Kicks</a> add-in very helpful.</p>
|
<p>The solution above is for TFS2008. TFS2010 has built-in rollback feature. see <a href="http://www.edsquared.com/2010/02/02/Rollback+Or+Undo+A+Changeset+In+TFS+2010+Version+Control.aspx" rel="nofollow">this</a> article for details.</p>
| 5,256
|
<p>I have a cheap cartesian printer with the usual arrangement - X axis with three linear bearings, build plate moving as Y axis on three linear bearings as well, Z axis with lead screws. After about 2 kg of filament printed, I can see that one of the linear bearings (the single bearing on one side of the Y axis) is leaving an almost black residue at the front of the axis. I have thoroughly oiled all of the bearings before mounting them and repeated that after about 1 kg of filament printed. No other bearing is showing this issue, and the black goo appears only on the front side of the rod, not the back side. What might cause this goo - is the bearing breaking up or is it just some residue from the manufacturing process that is slowly being pushed out of the bearing?</p>
|
<p>After completion of the print job, I was able to perform a closer inspection. The black goo contains metallic particles, and the rail the bearings are riding on has a visible groove - which means replacing both the bearings and the rail.</p>
|
<p>Your new oil butted out the old graphite lubricant. </p>
<p>Don't know about the metal particles though, might be dust, or your new oil caused damage to the bearings and/or rails.</p>
| 520
|
<p>I'm programming WCF using the ChannelFactory which expects a type in order to call the CreateChannel method. For example: </p>
<pre><code>IProxy proxy = ChannelFactory<IProxy>.CreateChannel(...);
</code></pre>
<p>In my case I'm doing routing so I don't know what type my channel factory will be using. I can parse a message header to determine the type but I hit a brick wall there because even if I have an instance of Type I can't pass that where ChannelFactory expects a generic type. </p>
<p>Another way of restating this problem in very simple terms would be that I'm attempting to do something like this:</p>
<pre><code>string listtype = Console.ReadLine(); // say "System.Int32"
Type t = Type.GetType( listtype);
List<t> myIntegers = new List<>(); // does not compile, expects a "type"
List<typeof(t)> myIntegers = new List<typeof(t)>(); // interesting - type must resolve at compile time?
</code></pre>
<p>Is there an approach to this I can leverage within C#?</p>
|
<p>What you are looking for is MakeGenericType</p>
<pre><code>string elementTypeName = Console.ReadLine();
Type elementType = Type.GetType(elementTypeName);
Type[] types = new Type[] { elementType };
Type listType = typeof(List<>);
Type genericType = listType.MakeGenericType(types);
IProxy proxy = (IProxy)Activator.CreateInstance(genericType);
</code></pre>
<p>So what you are doing is getting the type-definition of the generic "template" class, then building a specialization of the type using your runtime-driving types.</p>
|
<p>Here's a question: Do you <i>really</i> need to create a channel with the exact contract type in your specific case?</p>
<p>Since you're doing routing, there's a very good chance you could simply deal with the generic channel shapes. For example, if you're routing a one-way only message, then you could create a channel to send the message out like this:</p>
<pre><code>ChannelFactory<IOutputChannel> factory = new ChannelFactory<IOutputChannel>(binding, endpoint);
IOutputChannel channel = factory.CreateChannel();
...
channel.SendMessage(myRawMessage);
</code></pre>
<p>If you needed to send to a two-way service, just use IRequestChannel instead.</p>
<p>If you're doing routing, it is, in general, a lot easier to just deal with generic channel shapes (with a generic catch-all service contract to the outside) and just make sure the message you're sending has all the right headers and properties.</p>
| 9,293
|
<p>We have a web application that uses SQL Server 2008 as the database. Our users are able to do full-text searches on particular columns in the database. SQL Server's full-text functionality does not seem to provide support for hit highlighting. Do we need to build this ourselves or is there perhaps some library or knowledge around on how to do this? </p>
<p>BTW the application is written in C# so a .Net solution would be ideal but not necessary as we could translate.</p>
|
<p>Expanding on Ishmael's idea, it's not the final solution, but I think it's a good way to start. </p>
<p>Firstly we need to get the list of words that have been retrieved with the full-text engine: </p>
<pre><code>declare @SearchPattern nvarchar(1000) = 'FORMSOF (INFLECTIONAL, " ' + @SearchString + ' ")'
declare @SearchWords table (Word varchar(100), Expansion_type int)
insert into @SearchWords
select distinct display_term, expansion_type
from sys.dm_fts_parser(@SearchPattern, 1033, 0, 0)
where special_term = 'Exact Match'
</code></pre>
<p>There is already quite a lot one can expand on, for example the search pattern is quite basic; also there are probably better ways to filter out the words you don't need, but it least it gives you a list of stem words etc. that would be matched by full-text search.</p>
<p>After you get the results you need, you can use RegEx to parse through the result set (or preferably only a subset to speed it up, although I haven't yet figured out a good way to do so). For this I simply use two while loops and a bunch of temporary table and variables:</p>
<pre><code>declare @FinalResults table
while (select COUNT(*) from @PrelimResults) > 0
begin
select top 1 @CurrID = [UID], @Text = Text from @PrelimResults
declare @TextLength int = LEN(@Text )
declare @IndexOfDot int = CHARINDEX('.', REVERSE(@Text ), @TextLength - dbo.RegExIndexOf(@Text, '\b' + @FirstSearchWord + '\b') + 1)
set @Text = SUBSTRING(@Text, case @IndexOfDot when 0 then 0 else @TextLength - @IndexOfDot + 3 end, 300)
while (select COUNT(*) from @TempSearchWords) > 0
begin
select top 1 @CurrWord = Word from @TempSearchWords
set @Text = dbo.RegExReplace(@Text, '\b' + @CurrWord + '\b', '<b>' + SUBSTRING(@Text, dbo.RegExIndexOf(@Text, '\b' + @CurrWord + '\b'), LEN(@CurrWord) + 1) + '</b>')
delete from @TempSearchWords where Word = @CurrWord
end
insert into @FinalResults
select * from @PrelimResults where [UID] = @CurrID
delete from @PrelimResults where [UID] = @CurrID
end
</code></pre>
<p><strong>Several notes:</strong><br>
1. Nested while loops probably aren't the most efficient way of doing it, however nothing else comes to mind. If I were to use cursors, it would essentially be the same thing?<br>
2. <code>@FirstSearchWord</code> here to refers to the first instance in the text of one of the original search words, so essentially the text you are replacing is only going to be in the summary. Again, it's quite a basic method, some sort of text cluster finding algorithm would probably be handy.<br>
3. To get RegEx in the first place, you need CLR user-defined functions.</p>
|
<p>You might be missing the point of the database in this instance. Its job is to return the data to you that satisfies the conditions you gave it. I think you will want to implement the highlighting probably using regex in your web control.</p>
<p>Here is something a quick search would reveal.</p>
<p><a href="http://www.dotnetjunkies.com/PrintContent.aspx?type=article&id=195E323C-78F3-4884-A5AA-3A1081AC3B35" rel="nofollow noreferrer">http://www.dotnetjunkies.com/PrintContent.aspx?type=article&id=195E323C-78F3-4884-A5AA-3A1081AC3B35</a></p>
| 9,454
|
<p>I use an Ender 3, with cheap Amazon "Eryone PLA", which states a range from 190-220 °C, 1.75 mm dia. I have had this for about a year.</p>
<p>I use the rough build plate, not the glass. I have tried my best to level the bed but I am an amateur</p>
<p>I was originally getting poor adhesion so I cleaned the bed, levelled it, increased filament temp to 196 °C and heated the bed to 40 °C, with no fans in a house around 20 °C with not much airflow.</p>
<p>This helped adhesion, but my layers are very messy - the first perimeter may adhere correctly, but subsequent layers curl off, meaning the inner passes lift off the build plate. Attempting to persevere, pulling out these regions causes the blobby, ridged mess shown below. This is still the first layer. </p>
<p>I have noticed the extruder makes a knocking noise every so often, and the edges of prints can be so thin they are translucent.</p>
<p>I've browsed the web for common 3D printing errors but nothing I've found or tried has helped.</p>
<p><a href="https://i.stack.imgur.com/tOT5H.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tOT5H.jpg" alt="print"></a></p>
|
<p>This is clearly overextrusion relative to the volume the material is being deposited into, but that doesn't necessarily mean your extrusion rate is wrong. It could be:</p>
<ul>
<li>Nozzle smashed down into the bed (bed way too high) but somehow still extruding</li>
<li>Problem in Z axis movement preventing the head from moving up the right amount for each layer (possibly not moving up at all?)</li>
<li>Extrusion (flow) increased significantly above 100% in slicer</li>
<li>Wrong extruder steps/mm setting (usually controlled on printer not slicer, though you can send a setting in the start gcode)</li>
<li>Misconfigued filament diameter (unlikely since there's no common setting smaller than 1.75 mm; larger setting would under-extrude)</li>
</ul>
|
<p>Bad filament is my answer. I bought PRLine and both print terrible like your picture. Suspect 2 factors, one is that the line is less than 1.75, so they underextrude and so you see those lines and in some cases gaps, second is the material itself is slippery suggesting to me that it has florinated additives.</p>
| 1,621
|
<p>Can anyone recommend a good binary XML format? It's for a JavaME application, so it needs to be a) Easy to implement on the server, and b) Easy to write a low-footprint parser for on a low-end JavaME client device.</p>
<p>And it goes without saying that it needs to be smaller than XML, and faster to parse.</p>
<hr>
<p>The data would be something akin to SVG.</p>
|
<p>You might want to take a look at <a href="http://en.wikipedia.org/wiki/WBXML" rel="noreferrer">wbxml</a> (Wireless Binary XML) it is optimized for size, and often used on mobile phones, but it is not optimized for parsing speed.</p>
|
<p>It very much depends on the target device. If you have JSR172 available, then you are done with the parsing, the runtime does it for you. And XML is mainly about making your own format. As was alredy stated if your goal is performance, than XML is probably not the best way to go and you will end up doing some binary stuff.</p>
| 3,003
|
<p>What is the SQL query to select all of the MSSQL Server's logins?</p>
<p>Thank you. More than one of you had the answer I was looking for:</p>
<pre><code>SELECT * FROM syslogins
</code></pre>
|
<p>Is this what you're after?</p>
<pre><code>select * from master.syslogins
</code></pre>
|
<p>Have a look in the syslogins or sysusers tables in the master schema. Not sure if this still still around in more recent MSSQL versions though. In MSSQL 2005 there are views called sys.syslogins and sys.sysusers.</p>
| 5,793
|
<p>I'm trying to pick up ruby by porting a medium-sized (non-OO) perl program. One of my personal idioms is to set options like this:</p>
<pre><code>use Getopt::Std;
our $opt_v; # be verbose
getopts('v');
# and later ...
$opt_v && print "something interesting\n";
</code></pre>
<p>In perl, I kind of grit my teeth and let $opt_v be (effectively) a global. </p>
<p>In ruby,the more-or-less exact equivalent would be </p>
<pre><code>require 'optparse'
opts.on("-v", "--[no-]verbose", TrueClass, "Run verbosely") {
|$opt_verbose|
}
opts.parse!
end
</code></pre>
<p>where $opt_verbose is a global that classes could access. Having classes know about global flags like that seems ... er ... wrong. What's the OO-idiomatic way of doing this?</p>
<ul>
<li>Let the main routine take care of all option-related stuff and have the classes just return things to it that it decides how to deal with?</li>
<li>Have classes implement optional behaviour (e.g., know how to be verbose) and set a mode via an attr_writer sort of thing?</li>
</ul>
<p><em>updated:</em> Thanks for the answers suggesting optparse, but I should have been clearer that it's not <em>how</em> to process command-line options I'm asking about, but more the relationship between command-line options that effectively set a global program state and classes that should ideally be independent of that sort of thing.</p>
|
<p>A while back I ran across <a href="http://blog.toddwerth.com/entries/5" rel="nofollow noreferrer">this blog post</a> (by Todd Werth) which presented a rather lengthy skeleton for command-line scripts in Ruby. His skeleton uses a hybrid approach in which the application code is encapsulated in an application class which is instantiated, then executed by calling a "run" method on the application object. This allowed the options to be stored in a class-wide instance variable so that all methods in the application object can access them without exposing them to any other objects that might be used in the script.</p>
<p>I would lean toward using this technique, where the options are contained in one object and use either attr_writers or option parameters on method calls to pass relevant options to any additional objects. This way, any code contained in external classes can be isolated from the options themselves -- no need to worry about the naming of the variables in the main routine from within the <code>thingy</code> class if your options are set with a <code>thingy.verbose=true</code> attr_writer or <code>thingy.process(true)</code> call.</p>
|
<p>The <a href="http://www.rubyinside.com/trollop-command-line-option-parser-for-ruby-944.html" rel="nofollow noreferrer">first hit</a> on google for "<a href="http://www.google.com/search?q=processing%20command%20line%20options%20in%20ruby&sourceid=mozilla2&ie=utf-8&oe=utf-8" rel="nofollow noreferrer">processing command line options in ruby</a>" is an article about <a href="http://trollop.rubyforge.org/" rel="nofollow noreferrer">Trollop</a> which seems to be a good tool for this job.</p>
| 5,965
|
<p>If I am 3D printing on my Ender 3, and I pause the print, the extruder lets out more filament for like 2 seconds. This leaves a glob of dry filament on my print, which the could contact the nozzle tip, causing it to slide the build platform.</p>
<p>I have fixed the build platform sliding problem by attaching the included clips. However, another problem remains. Once the glob is made, the filament dropped on top of it gets pushed up, making the print not be even, which ruins the print. I don't think I did anything wrong on the setup, but it might just be that the extruder doesn't stop in time? Did I do anything wrong is is this an issue among all Ender 3s?</p>
<ul>
<li>I use the Creality Ender 3</li>
</ul>
|
<p>They're caused by filament being pulled during travel so they qualify as stringing.</p>
<p>You need to look at your retraction and heat, speed as well makes a difference. You can try combing and other things or just pull them off.</p>
|
<p>You should provide a better picture, i.e. a finished print.</p>
<p>Stringing is generally something you don't worry about - adjust your retraction settings a tiny bit to retract more.
I didn't see what software you used, that will help with where the settings are.</p>
<p>Also the plate is very different from the rest of the layers, it could just be a leveling issue.</p>
| 2,217
|
<p>I am looking for attributes I can use to ensure the best runtime performance for my .Net application by giving hints to the loader, JIT compiler or ngen.</p>
<p>For example we have <a href="http://msdn.microsoft.com/en-us/library/k2wxda47.aspx" rel="noreferrer">DebuggableAttribute</a> which should be set to not debug and not disable optimization for optimal performance.</p>
<pre><code>[Debuggable(false, false)]
</code></pre>
<p>Are there any others I should know about?</p>
|
<p>Ecma-335 specifies some more CompilationRelaxations for relaxed exception handling (so-called e-relaxed calls) in Annex F "Imprecise faults", but they have not been exposed by Microsoft.</p>
<p>Specifically CompilationRelaxations.RelaxedArrayExceptions and CompilationRelaxations.RelaxedNullReferenceException are mentioned there.</p>
<p>It'd be intersting what happens when you just try some integers in the CompilationRelaxationsAttribute's ctor ;)</p>
|
<p>I found another: <a href="http://msdn.microsoft.com/en-us/library/system.resources.neutralresourceslanguageattribute.aspx" rel="nofollow noreferrer">NeutralResourcesLanguageAttribute</a>. According to <a href="http://blogs.msdn.com/bclteam/archive/2005/10/11/479330.aspx" rel="nofollow noreferrer">this</a> blog post it helps the loader in finding the right satellite assemblies faster by specifying the culture if the current (neutral) assembly.</p>
<pre><code>[NeutralResourcesLanguageAttribute("nl", UltimateResourceFallbackLocation.MainAssembly)]
</code></pre>
| 9,555
|
<p>My license for Whole Tomatoes Visual AssistX is about to expire and I'm not really planning on renewing it. I use it for spell checking but that's about it. The refactoring abilities have been a little disappointing. Before I just jump into Resharper though what are your thoughts on other possible plugins?</p>
|
<p>The other major player would be DevExpress and their CodeRush and Refactor products. <a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/Refactoring/" rel="nofollow noreferrer">Found here.</a></p>
|
<p><a href="http://mztools.com/index.aspx" rel="nofollow noreferrer">MZ-Tools</a> is really good as well.</p>
| 3,262
|
<p>I've recently initialized OctoPi onto my Raspberry Pi, proceeded to connect it to my local internet, and then connected it to my FlashForge Creator Pro (2014 edition)</p>
<p>Everything seemed to be going smoothly until I tried to connect to the printer; the Pi didn't seem to be able to pick up a usable Baudrate (after being trying out all of the usable ones).</p>
<p>For example, when trying out 9600, I would get:</p>
<blockquote>
<p>Trying baudrate: 9600</p>
<p>Send: N0 M110 N0*125</p>
<p>Recv: ��r># ���& �</p>
</blockquote>
<p>What should I do to fix the problem?</p>
<hr />
<p><em>Note that I got the same types of messages back (with garbled 'special' characters) when trying using the "<strong>auto connect</strong>" feature.</em></p>
|
<p>I got the same problem.<br>
Auto-detect baud rate was not working too.<br>
So I manually tried every baud-rate and finally found one working, for me it was 115200.<br>
Good luck!</p>
|
<p>Install GPX via command line. To do this, type</p>
<p><code>/home/pi/oprint/bin/pip install "https://markwal.github.io/octoprint-download/OctoPrint-GPX.tgz"</code>
then go ahead and restart octoprint and try connecting again.</p>
| 522
|
<p>I'm struggling with my new printer, and I just want to make sure that I have the basic configured correctly. </p>
<p>What motherboard ID in <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/Configuration.h" rel="nofollow noreferrer"><code>configuration.h</code></a> is appropriate for MKS BASE V1.5 in Marlin Firmware?</p>
|
<p>Marlin appears to support older versions of the board (and possibly this one) according to this line </p>
<pre><code>#define BOARD_MKS_13 47 // MKS v1.3 or 1.4 (maybe higher)
</code></pre>
<p>in <code>boards.h</code> which can be found <a href="https://github.com/MarlinFirmware/Marlin/blob/RC/Marlin/boards.h" rel="nofollow noreferrer">here</a>. </p>
<p>The company also has a <a href="https://web.archive.org/web/20180223090126/http://osoyoo.com/2016/06/30/mks-1-4-3d-printer-board-marlin-firmware-installation-guide/" rel="nofollow noreferrer">guide</a> and looks to provide pre-configured (but not fully configured?) downloads of Marlin. They have different links for different displays but then ask you to change lines manually but don't mention changing the board so I have no idea what they are doing or what is different between the downloads.</p>
<p>It appears either way you go (Marlin from Github or from Osoyoo) you will need to change some lines to get each axis to behave correctly.</p>
|
<p>A more recent version of Marlin Firmware (<em>version 1.1.9 is the last release of this branch, new developments are done in the 2.x branch</em>) nowadays has a separate board constant for the MKS BASE v1.5 board (<code>BOARD_MKS_BASE_15</code>) as can be found in <a href="https://github.com/MarlinFirmware/Marlin/blob/1.1.x/Marlin/boards.h" rel="nofollow noreferrer">boards.h</a>.</p>
<p>The following line quotes the constant for this board from the file:</p>
<blockquote>
<p><code>#define BOARD_MKS_BASE_15 405 // MKS v1.5 with Allegro A4982 stepper drivers</code></p>
</blockquote>
| 583
|
<p>Do you know if I can use Visio to forward-engineer a sequence diagram into code (c#)?</p>
<p>Can it be done with Visio alone or do I need a plugin?</p>
<p>What about other diagrams?</p>
|
<p>You have to get the Visio that for users of Visual Studio. See this link: <a href="http://msdn.microsoft.com/en-us/library/ms182014.aspx" rel="nofollow noreferrer">Visio for Enterprise Architects</a> for more details. The code generation capabilities are fairly weak and you might end up getting Visio into an inconsistent state. I know that Visio will let you forward and reverse engineer both code and databases, but both capabilities are very limited and I don't recommend doing it.</p>
<p>In my opinion, Visio is a diagramming tool and it should be treated as such.</p>
|
<p>To the best of my knowledge, Visio can only forward-engineer code from class models. </p>
<p>As sequence diagrams only really show paths of communication between objects, I suspect that they do not contain the necessary information, except perhaps in trivial cases, for generating code. </p>
<p>Objects with any sort of complex behaviour patterns are likely to involve changing run-time states, of which sequence diagrams aren't really capable of capturing.</p>
| 4,582
|
<p>So the ADO.NET Entity Framework has gotten a little bit of bad press (in the form of blog entries and a petition) but I don't want to rush to judgement. I'm limited in time for experimentation but I was wondering has anyone worked with it yet with more empirical feedback? </p>
<p>Finally, what are thoughts on using NHibernate which has been around for a long time and <em>may</em> be more mature than the ADO.NET Entity Framework.</p>
|
<p>NHibernate may be more mature. That does not necessarily mean it is a "better" solution. Having used it at my job for some time, I would personally prefer to use almost anything than NHibernate (even straight SQL, if migration were remotely feasible). The number of error messages thrown by NHibernate that don't mean anything (or that do mean something but should never occur) is absolutely staggering, as are some of its default behaviours (such as flushing the session once for each object returned in a Find).</p>
<p>Personally, when I have a choice, I use LINQ to SQL for all database work.</p>
|
<p>I do have a problem with SubSonic. SubSonic choked to death on tables with same name but different schema. I don't want to discuss the best practices of building a database, because I did not make the call to do so.( When it comes to raise voice make a point and keep the job, I'd rather keep my job. :) )</p>
| 3,875
|
<p>I have a VB.net test application that clicks a link that opens the Microsoft Word application window and displays the document. How do I locate the Word application window so that I can grab some text from it?</p>
|
<p>This method has several limitations, but I still find it very useful. I'll list the limitations (I know of) up front and let whoever wants to use it do so at their own risk.</p>
<ol>
<li>The original version I posted over-reported time spent in recursive calls (as pointed out in the comments to the answer).</li>
<li>It's not thread safe, it wasn't thread safe before I added the code to ignore recursion and it's even less thread safe now.</li>
<li>Although it's very efficient if it's called many times (millions), it will have a measurable effect on the outcome so that scopes you measure will take longer than those you don't.</li>
</ol>
<hr>
<p>I use this class when the problem at hand doesn't justify profiling all my code or I get some data from a profiler that I want to verify. Basically it sums up the time you spent in a specific block and at the end of the program outputs it to the debug stream (viewable with <a href="http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx" rel="nofollow noreferrer">DbgView</a>), including how many times the code was executed (and the average time spent of course)).</p>
<pre><code>#pragma once
#include <tchar.h>
#include <windows.h>
#include <sstream>
#include <boost/noncopyable.hpp>
namespace scope_timer {
class time_collector : boost::noncopyable {
__int64 total;
LARGE_INTEGER start;
size_t times;
const TCHAR* name;
double cpu_frequency()
{ // cache the CPU frequency, which doesn't change.
static double ret = 0; // store as double so devision later on is floating point and not truncating
if (ret == 0) {
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
ret = static_cast<double>(freq.QuadPart);
}
return ret;
}
bool in_use;
public:
time_collector(const TCHAR* n)
: times(0)
, name(n)
, total(0)
, start(LARGE_INTEGER())
, in_use(false)
{
}
~time_collector()
{
std::basic_ostringstream<TCHAR> msg;
msg << _T("scope_timer> ") << name << _T(" called: ");
double seconds = total / cpu_frequency();
double average = seconds / times;
msg << times << _T(" times total time: ") << seconds << _T(" seconds ")
<< _T(" (avg ") << average <<_T(")\n");
OutputDebugString(msg.str().c_str());
}
void add_time(__int64 ticks)
{
total += ticks;
++times;
in_use = false;
}
bool aquire()
{
if (in_use)
return false;
in_use = true;
return true;
}
};
class one_time : boost::noncopyable {
LARGE_INTEGER start;
time_collector* collector;
public:
one_time(time_collector& tc)
{
if (tc.aquire()) {
collector = &tc;
QueryPerformanceCounter(&start);
}
else
collector = 0;
}
~one_time()
{
if (collector) {
LARGE_INTEGER end;
QueryPerformanceCounter(&end);
collector->add_time(end.QuadPart - start.QuadPart);
}
}
};
}
// Usage TIME_THIS_SCOPE(XX); where XX is a C variable name (can begin with a number)
#define TIME_THIS_SCOPE(name) \
static scope_timer::time_collector st_time_collector_##name(_T(#name)); \
scope_timer::one_time st_one_time_##name(st_time_collector_##name)
</code></pre>
|
<p>The article <em>Code profiler and optimizations</em> has lots of information about C++ code profiling and also has a free download link to a program/class that will show you a graphic presentation for different code paths/methods.</p>
| 8,646
|
<p>Is it possible to create "federated" Subversion servers?
As in one server at location A and another at location B that sync up their local versions of the repository automatically. That way when someone at either location interacts with the repository they are accessing their respective local server and therefore has faster response times.</p>
|
<p>This is more or less the perfect use case for <a href="http://svk.bestpractical.com/view/HomePage" rel="nofollow noreferrer">SVK</a>. SVK is a command line front end for subversion that works with an entire local copy of the repository. So your commits, updates, etc. work on the local repository and you can then sync with a master. I would generally recommend SVK over plain subversion anyway as it makes a lot of things nicer. No .svn folders, better branching and merging, better conflict resolution.</p>
|
<p>Its probably not exactly what your looking for, but you may be able to implement OS level clustering.</p>
| 2,408
|
<p>What's the cleanest, most effective way to validate decimal numbers in JavaScript?</p>
<p>Bonus points for:</p>
<ol>
<li>Clarity. Solution should be clean and simple.</li>
<li>Cross-platform.</li>
</ol>
<p>Test cases:</p>
<pre><code>01. IsNumeric('-1') => true
02. IsNumeric('-1.5') => true
03. IsNumeric('0') => true
04. IsNumeric('0.42') => true
05. IsNumeric('.42') => true
06. IsNumeric('99,999') => false
07. IsNumeric('0x89f') => false
08. IsNumeric('#abcdef') => false
09. IsNumeric('1.2.3') => false
10. IsNumeric('') => false
11. IsNumeric('blah') => false
</code></pre>
|
<p><a href="https://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric/174921#174921">@Joel's answer</a> is pretty close, but it will fail in the following cases:</p>
<pre><code>// Whitespace strings:
IsNumeric(' ') == true;
IsNumeric('\t\t') == true;
IsNumeric('\n\r') == true;
// Number literals:
IsNumeric(-1) == false;
IsNumeric(0) == false;
IsNumeric(1.1) == false;
IsNumeric(8e5) == false;
</code></pre>
<p>Some time ago I had to implement an <code>IsNumeric</code> function, to find out if a variable contained a numeric value, <strong>regardless of its type</strong>, it could be a <code>String</code> containing a numeric value (I had to consider also exponential notation, etc.), a <code>Number</code> object, virtually anything could be passed to that function, I couldn't make any type assumptions, taking care of type coercion (eg. <code>+true == 1;</code> but <code>true</code> shouldn't be considered as <code>"numeric"</code>).</p>
<p>I think is worth sharing this set of <a href="http://run.plnkr.co/plunks/93FPpacuIcXqqKMecLdk/" rel="noreferrer"><strong>+30 unit tests</strong></a> made to numerous function implementations, and also share the one that passes all my tests:</p>
<pre><code>function isNumeric(n) {
return !isNaN(parseFloat(n)) && isFinite(n);
}
</code></pre>
<p><strong>P.S.</strong> <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isNaN" rel="noreferrer">isNaN</a> & <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite" rel="noreferrer">isFinite</a> have a confusing behavior due to forced conversion to number. In ES6, <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isNaN" rel="noreferrer">Number.isNaN</a> & <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isFinite" rel="noreferrer">Number.isFinite</a> would fix these issues. Keep that in mind when using them. </p>
<hr>
<p><strong>Update</strong> :
<a href="https://github.com/jquery/jquery/blob/2.2-stable/src/core.js#L215" rel="noreferrer">Here's how jQuery does it now (2.2-stable)</a>: </p>
<pre><code>isNumeric: function(obj) {
var realStringObj = obj && obj.toString();
return !jQuery.isArray(obj) && (realStringObj - parseFloat(realStringObj) + 1) >= 0;
}
</code></pre>
<p><strong>Update</strong> :
<a href="https://github.com/angular/angular/blob/4.3.x/packages/common/src/pipes/number_pipe.ts#L172" rel="noreferrer">Angular 4.3</a>:</p>
<pre><code>export function isNumeric(value: any): boolean {
return !isNaN(value - parseFloat(value));
}
</code></pre>
|
<p>The following may work as well.</p>
<pre><code>function isNumeric(v) {
return v.length > 0 && !isNaN(v) && v.search(/[A-Z]|[#]/ig) == -1;
};
</code></pre>
| 3,870
|
<p>The need arose, in our product, to determine how long the current user has been logged on to Windows (specifically, Vista). It seems there is no straight forward API function for this and I couldn't find anything relevant with WMI (although I'm no expert with WMI, so I might have missed something).</p>
<p>Any ideas?</p>
|
<p>For people not familiar with WMI (like me), here are some links:</p>
<ul>
<li>MSDN page on using WMI from various languages: <a href="http://msdn.microsoft.com/en-us/library/aa393964(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa393964(VS.85).aspx</a></li>
<li>reference about Win32_Session: <a href="http://msdn.microsoft.com/en-us/library/aa394422(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa394422(VS.85).aspx</a>, but the objects in Win32_session are of type Win32_LogonSession (<a href="http://msdn.microsoft.com/en-us/library/aa394189(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa394189(VS.85).aspx</a>), which has more interesting properties.</li>
<li><a href="http://www.ks-soft.net/hostmon.eng/wmi/index.htm" rel="nofollow noreferrer">WMI Explorer</a> - a tool you can use to easily run queries like the one Michal posted.</li>
</ul>
<p>And here's example querying Win32_Session from VBS:</p>
<pre><code>strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" _
& strComputer & "\root\cimv2")
Set sessions = objWMIService.ExecQuery _
("select * from Win32_Session")
For Each objSession in sessions
Wscript.Echo objSession.StartTime
Next
</code></pre>
<p>It alerts 6 sessions for my personal computer, perhaps you can filter by LogonType to only list the real ("interactive") users. I couldn't see how you can select the session of the "current user".</p>
<p>[edit] and here's a result from Google to your problem: <a href="http://forum.sysinternals.com/forum_posts.asp?TID=3755" rel="nofollow noreferrer">http://forum.sysinternals.com/forum_posts.asp?TID=3755</a></p>
|
<p>Using WMI, the Win32Session is a great start. As well, it should be pointed out that if you're on a network you can use Win32_NetworkLoginProfile to get all sorts of info.</p>
<pre><code>Set logins = objWMIService.ExecQuery _
("select * from Win32_NetworkLoginProfile")
For Each objSession in logins
Wscript.Echo objSession.LastLogon
Next
</code></pre>
<p>Other bits of info you can collect include the user name, last logoff, as well as various profile related stuff.</p>
| 3,451
|
<p>I am looking for the temperature rating for hardboard. I want to use that as the base for my printer enclosure. </p>
<p>It has proven incredible hard get a ball-park figure from Google. </p>
<p>So, what is the maximum safe temperature for a hardboard panel at long term? (considering a print job can easily take 6 hours).</p>
<p>PS: if you have used a hardboard to build your enclosure, your experience might be helpful.</p>
|
<p>Hardboard is called <em>Masonite</em> here in the States because that is the trade name of the product. If you look up the <a href="http://www.gunnersens.co.nz/images/stories/products/Masonite%20Standard/specs/Australian_Hardboards_Masonite_MSDS.pdf" rel="noreferrer">Material Safety Data Sheet</a> you will see Masonite it states the following (Section 5):</p>
<blockquote>
<p>Auto-ignition Temperature (°C): >200 degrees Celsius</p>
</blockquote>
<p>In Section 7, it states:</p>
<blockquote>
<p>These boards are flammable but difficult to ignite.</p>
</blockquote>
<p>Furthermore in Section 10, it states:</p>
<blockquote>
<p><strong>Conditions to avoid:</strong> Avoid sources of radiant heat and flame; and avoid sparks and sources of ignition in all electrical equipment, including dust extraction equipment.
Avoid excessive build up of dust from boards.</p>
</blockquote>
<p>The hot end works of printers are neither radiant heat, nor flames, nor sparks. Yes, you'll have a buildup of heat within the working confines of an enclosure, but if you are only using it for a base there should be absolutely no issues. If you were to build an entire enclosure from hardboard, you could put a thermal probe inside with the printer to ensure it doesn't get too hot, but realistically, it will never get hot enough within the enclosure to light the hardboard on fire.</p>
|
<p>Masonite or hardboard is a high-density board without a resin. It is <a href="https://www.chromaluxe.com/wp-content/uploads/SDS-Hardboard-Universal-Woods.pdf" rel="nofollow noreferrer">listed</a> at around 200 to 275 °C for its autoignition temperature. Just for comparison, let's look at similar products.</p>
<p>Medium-density fiberboard (MDF) is similar to hardboard but bonded with a resin, offering a smoother surface and is <a href="https://www.westfraser.com/sites/default/files/products/MDF/WP-GoldPlus%202013.pdf" rel="nofollow noreferrer">listed</a> at 200 to 275 °C, so pretty close.</p>
<p>The heavier High-density fiberboard variant is <a href="http://www.clarionindustries.com/assets/files/Clarion-msds-hdf.pdf" rel="nofollow noreferrer">listed</a> with about the same temperatures of about 200 to 275 °C.</p>
<p>Oriented Strand Board (OSB) is <a href="http://www.langboard.com/osb/data/osb_msds.pdf" rel="nofollow noreferrer">listed</a> at 200 to 260 °C.</p>
<h2>Conclusion</h2>
<p>All the materials have very similar autoignition temperatures, so none of them particularly shines over the other. Using a proper fire safety procedure is highly encouraged, even though the ambient temperature in the enclosure should not reach even close to the 200 °C unless the printer has a freak accident and catches fire itself.</p>
<ul>
<li>A smoke detector is a must.</li>
<li>Some kind of cooling method that keeps the inside at a temperature down is highly encouraged. A simple temperature activated fan might help in this.</li>
<li>Lining the inside of the box with a thicker aluminium or copper tape can help to even out the temperature over the surfaces faster, preventing the formation of hotspots that might otherwise reach dangerous temperatures. <a href="https://uk.rs-online.com/web/c/adhesives-sealants-tapes/tapes/copper-tapes/" rel="nofollow noreferrer">Copper tapes</a> are more expensive than <a href="https://uk.rs-online.com/web/c/adhesives-sealants-tapes/tapes/aluminium-tapes/" rel="nofollow noreferrer">Aluminium tapes</a> but have a better heat transfer coefficient.<sup>1</sup></li>
<li>Including an automatic fire suppression system could be an option.</li>
</ul>
<p><sup>1 - The RS Catalogue was just chosen for ease of navigation. <a href="https://www.mcmaster.com/" rel="nofollow noreferrer">McMaster Carr</a> does list special <a href="https://www.mcmaster.com/catalog/125/3591" rel="nofollow noreferrer">heat shielding tape</a> in both thin and aluminium as well as <a href="https://www.mcmaster.com/catalog/125/3587" rel="nofollow noreferrer">copper and aluminium foil</a> tapes. I am not affiliated to either.</sup></p>
| 1,239
|
<p>We've been having some issues with a SharePoint instance in a test
environment. Thankfully this is not production ;) The problems started
when the disk with the SQL Server databases and search index ran out
of space. Following this, the search service would not run and search
settings in the SSP were not accessible. Reclaiming the disk space did
not resolve the issue. So rather than restoring the VM, we decided to
try to fix the issue.</p>
<p>We created a new SSP and changed the association of all services to
the new SSP. The old SSP and it's databases were then deleted. Search
results for PDF files are no longer appearing, but the search works
fine otherwise. MySites also works OK.</p>
<p>Following the implementation of this change, these problems occur:</p>
<blockquote>
<p>1) An audit failure message started appearing in the application event log, for 'DOMAIN\SPMOSSSvc' which is the MOSS farm account.</p>
</blockquote>
<pre><code>Event Type: Failure Audit
Event Source: MSSQLSERVER
Event Category: (4)
Event ID: 18456
Date: 8/5/2008
Time: 3:55:19 PM
User: DOMAIN\SPMOSSSvc
Computer: dastest01
Description:
Login failed for user 'DOMAIN\SPMOSSSvc'. [CLIENT: <local machine>]
</code></pre>
<blockquote>
<p>2) SQL Server profiler is showing queries from SharePoint that reference the old
(deleted) SSP database.</p>
</blockquote>
<p>So...</p>
<ul>
<li>Where would these references to DOMAIN\SPMOSSSvc and the old SSP
database exist?</li>
<li>Is there a way to 'completely' remove the SSP from the server, and
re-create? The option to delete was not available (greyed out) when a
single SSP is in place.</li>
</ul>
|
<p>As Daniel McPherson said, this is caused when SSPs are deleted but the associated
job are not and attempt to communicate with the deleted database.<br><br>If the SSP
database has been deleted or a problem occurred when deleting an SSP, the job may
not be deleted. When the job attempts to run, it will fail since the database no
longer exists.</p>
<p>Follow the steps Daniel mentioned:<br>
1. Go to SQL Server Management Studio <br>
2. Disable the job called SSPNAME_JobDeleteExpiredSessions, right click and choose Disable Job.</p>
|
<p>Have you tried removing the SSP using the command line? I found this worked once when we had a broken an SSP and just wanted to get rid of it.</p>
<p>The command is:</p>
<pre><code>stsadm.exe -o deletessp -title <sspname> [-deletedatabases]
</code></pre>
<p>The <code>deletedatbases</code> switch is optional.</p>
<hr>
<p>Also, check in Central Administration under Job Definitions and Job Schedules to ensure no SSP related jobs are still running</p>
| 2,675
|
<p>I am using .Net 2 and the normal way to store my settings. I store my custom object serialized to xml. I am trying to retrieve the default value of the property (but without reseting other properties). I use:</p>
<pre><code>ValuationInput valuationInput = (ValuationInput) Settings.Default.Properties["ValuationInput"].DefaultValue;
</code></pre>
<p>But it seems to return a string instead of ValuationInput and it throws an exception. </p>
<p>I made a quick hack, which works fine:</p>
<pre><code>string valuationInputStr = (string)
Settings.Default.Properties["ValuationInput"].DefaultValue;
XmlSerializer xmlSerializer = new XmlSerializer(typeof(ValuationInput));
ValuationInput valuationInput = (ValuationInput) xmlSerializer.Deserialize(new StringReader(valuationInputStr));
</code></pre>
<p>But this is really ugly - when I use all the tool to define a strongly typed setting, I don't want to serialize the default value myself, I would like to read it the same way as I read the current value: <code>ValuationInput valuationInput = Settings.Default.ValuationInput;</code></p>
|
<p>BEX=Buffer overflow exception. See <a href="http://technet.microsoft.com/en-us/library/cc738483.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/library/cc738483.aspx</a> for details. However, c000000d is STATUS_INVALID_PARAMETER; the technet article talks primarily about status c0000005 or c0000409 (access violation/DEP)</p>
|
<p>Most likely there is an addon that is messing with IE.</p>
<p>You can try this.
1. Open IE
2. Switch to the Advanced tab.
3. Click the Reset Internet Explorer Settings button.
4. Click Reset to confirm the operation.
5. Click Close when the resetting process finished.
6. Uncheck Enable third-party browser extensions option in the Settings box.
7. Click Apply, click OK.</p>
<p>After this, check to see if it works and if it does, enable one addon at a time until you find the culprit. Then uninstall it and reinstall it if you need it.</p>
| 7,492
|
<p>I'm planning to make an LCD Resin printer. I'm still learning and I found out that I need daylight resin (which hardens when white light comes from the LCD).</p>
<p>If I search for "Daylight resin" on Google, the only "useful" result I find is for <a href="https://photocentric3d.com/daylightresins/?v=9b6a28c805e0" rel="nofollow noreferrer">Photocentric</a>.</p>
<p><a href="https://i.stack.imgur.com/WWTR9m.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WWTR9m.jpg" alt="Photocentric Resin"></a></p>
<p>Photocentric sells Daylight resins and the prices seem to be good too; however, I'm trying to search for alternatives. I'm not interested in something cheaper, I'd like to choose a resin which has more colors. Photocentric's hard resin only comes in cream/green/gray colors. I would need at least white/black/transparent resin.</p>
<p>Is it the only option we have? Are there any other manufacturer out there which produces Daylight resin/LCD-hardening resin with a variety of colors?</p>
|
<p>It looks like <a href="https://store.ono3d.net/" rel="nofollow noreferrer">Ono</a> may fit what you are looking for.
They have several colors listed on their site.</p>
<p>Red <a href="https://i.stack.imgur.com/Em8Uu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Em8Uu.jpg" alt="enter image description here"></a> Blue<a href="https://i.stack.imgur.com/encJ8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/encJ8.jpg" alt="enter image description here"></a></p>
<p>Yellow<a href="https://i.stack.imgur.com/jJS6t.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jJS6t.jpg" alt="enter image description here"></a> Black<a href="https://i.stack.imgur.com/lhsdQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lhsdQ.jpg" alt="enter image description here"></a></p>
<p>Clear<a href="https://i.stack.imgur.com/fwl5J.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fwl5J.jpg" alt="enter image description here"></a> Creamy White <a href="https://i.stack.imgur.com/XGmSp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XGmSp.jpg" alt="enter image description here"></a></p>
<p>They also have a flexible resin and a low temperature "casting" resin.</p>
<p>It is unclear if the resin is available now or if it is preorder.</p>
|
<p>ONO, as mentioned previously. But I do believe that resin will be rather expensive. Along the lines of $15 per 100ml. Since their resin sales are geared towards their printer (small, resin based printer that uses your smart phone as the light source) they sell smaller portions, as their printer can't hold all that much. Not quite sure if you can order larger quantities at a discount directly from them. But at this stage, they are rather difficult to get ahold of via internet communication. That may change if and when they fulfill their KS commitments.</p>
| 658
|
<p>What's the easiest way to do an "instring" type function with a regex? For example, how could I reject a whole string because of the presence of a single character such as <code>:</code>? For example: </p>
<ul>
<li><code>this</code> - okay</li>
<li><code>there:is</code> - not okay because of <code>:</code></li>
</ul>
<p>More practically, how can I match the following string: </p>
<pre><code>//foo/bar/baz[1]/ns:foo2/@attr/text()
</code></pre>
<p>For any node test on the xpath that doesn't include a namespace?</p>
<pre><code>(/)?(/)([^:/]+)
</code></pre>
<p>Will match the node tests but includes the namespace prefix which makes it faulty.</p>
|
<p>I'm still not sure whether you just wanted to detect if the Xpath contains a namespace, or whether you want to remove the references to the namespace. So here's some sample code (in C#) that does both.</p>
<pre><code>class Program
{
static void Main(string[] args)
{
string withNamespace = @"//foo/ns2:bar/baz[1]/ns:foo2/@attr/text()";
string withoutNamespace = @"//foo/bar/baz[1]/foo2/@attr/text()";
ShowStuff(withNamespace);
ShowStuff(withoutNamespace);
}
static void ShowStuff(string input)
{
Console.WriteLine("'{0}' does {1}contain namespaces", input, ContainsNamespace(input) ? "" : "not ");
Console.WriteLine("'{0}' without namespaces is '{1}'", input, StripNamespaces(input));
}
static bool ContainsNamespace(string input)
{
// a namspace must start with a character, but can have characters and numbers
// from that point on.
return Regex.IsMatch(input, @"/?\w[\w\d]+:\w[\w\d]+/?");
}
static string StripNamespaces(string input)
{
return Regex.Replace(input, @"(/?)\w[\w\d]+:(\w[\w\d]+)(/?)", "$1$2$3");
}
}
</code></pre>
<p>Hope that helps! Good luck.</p>
|
<p>I dont know regex syntax very well but could you not do:</p>
<p><code>[any alpha numeric]\*:[any alphanumeric]\*</code></p>
<p>I think something like that should work no?</p>
| 3,140
|
<p>Currently, I'm attempting to make multiple beziers have equidistant points. I'm currently using cubic interpolation to find the points, but because the way beziers work some areas are more dense than others and proving gross for texture mapping because of the variable distance. <strong>Is there a way to find points on a bezier by distance rather than by percentage? Furthermore, is it possible to extend this to multiple connected curves?</strong></p>
|
<p>distance between P_0 and P_3 (in cubic form), yes, but I think you knew that, is straight forward.</p>
<p>Distance on a curve is just arc length:</p>
<p><a href="http://www.codecogs.com/eq.latex?%5Cint_%7Bt_0%7D%5E%7Bt_1%7D%20%7B%20|P'(t)|%20dt" rel="nofollow noreferrer">fig 1 http://www.codecogs.com/eq.latex?%5Cint_%7Bt_0%7D%5E%7Bt_1%7D%20%7B%20|P'(t)|%20dt</a></p>
<p>where:</p>
<p><a href="http://www.codecogs.com/eq.latex?P%27(t)%20=%20[%7Bx%27,y%27,z%27%7D]%20=%20[%7B%5Cfrac%7Bdx(t)%7D%7Bdt%7D,%5Cfrac%7Bdy(t)%7D%7Bdt%7D,%5Cfrac%7Bdz(t)%7D%7Bdt%7D%7D]" rel="nofollow noreferrer">fig 2 http://www.codecogs.com/eq.latex?P%27(t)%20=%20[%7Bx%27,y%27,z%27%7D]%20=%20[%7B%5Cfrac%7Bdx(t)%7D%7Bdt%7D,%5Cfrac%7Bdy(t)%7D%7Bdt%7D,%5Cfrac%7Bdz(t)%7D%7Bdt%7D%7D]</a></p>
<p><a href="http://steve.hollasch.net/cgindex/curves/cbezarclen.html" rel="nofollow noreferrer">(see the rest)</a></p>
<p>Probably, you'd have t_0 = 0, t_1 = 1.0, and dz(t) = 0 (2d plane).</p>
|
<p>I know this is an old question but I recently ran into this problem and created a <code>UIBezierPath</code> extention to solve for an <code>X</code> coordinate given a <code>Y</code> coordinate and vise versa. Written in swift. </p>
<p><a href="https://github.com/rkotzy/RKBezierMath" rel="nofollow">https://github.com/rkotzy/RKBezierMath</a></p>
<pre><code>extension UIBezierPath {
func solveBezerAtY(start: CGPoint, point1: CGPoint, point2: CGPoint, end: CGPoint, y: CGFloat) -> [CGPoint] {
// bezier control points
let C0 = start.y - y
let C1 = point1.y - y
let C2 = point2.y - y
let C3 = end.y - y
// The cubic polynomial coefficients such that Bez(t) = A*t^3 + B*t^2 + C*t + D
let A = C3 - 3.0*C2 + 3.0*C1 - C0
let B = 3.0*C2 - 6.0*C1 + 3.0*C0
let C = 3.0*C1 - 3.0*C0
let D = C0
let roots = solveCubic(A, b: B, c: C, d: D)
var result = [CGPoint]()
for root in roots {
if (root >= 0 && root <= 1) {
result.append(bezierOutputAtT(start, point1: point1, point2: point2, end: end, t: root))
}
}
return result
}
func solveBezerAtX(start: CGPoint, point1: CGPoint, point2: CGPoint, end: CGPoint, x: CGFloat) -> [CGPoint] {
// bezier control points
let C0 = start.x - x
let C1 = point1.x - x
let C2 = point2.x - x
let C3 = end.x - x
// The cubic polynomial coefficients such that Bez(t) = A*t^3 + B*t^2 + C*t + D
let A = C3 - 3.0*C2 + 3.0*C1 - C0
let B = 3.0*C2 - 6.0*C1 + 3.0*C0
let C = 3.0*C1 - 3.0*C0
let D = C0
let roots = solveCubic(A, b: B, c: C, d: D)
var result = [CGPoint]()
for root in roots {
if (root >= 0 && root <= 1) {
result.append(bezierOutputAtT(start, point1: point1, point2: point2, end: end, t: root))
}
}
return result
}
func solveCubic(a: CGFloat?, var b: CGFloat, var c: CGFloat, var d: CGFloat) -> [CGFloat] {
if (a == nil) {
return solveQuadratic(b, b: c, c: d)
}
b /= a!
c /= a!
d /= a!
let p = (3 * c - b * b) / 3
let q = (2 * b * b * b - 9 * b * c + 27 * d) / 27
if (p == 0) {
return [pow(-q, 1 / 3)]
} else if (q == 0) {
return [sqrt(-p), -sqrt(-p)]
} else {
let discriminant = pow(q / 2, 2) + pow(p / 3, 3)
if (discriminant == 0) {
return [pow(q / 2, 1 / 3) - b / 3]
} else if (discriminant > 0) {
let x = crt(-(q / 2) + sqrt(discriminant))
let z = crt((q / 2) + sqrt(discriminant))
return [x - z - b / 3]
} else {
let r = sqrt(pow(-(p/3), 3))
let phi = acos(-(q / (2 * sqrt(pow(-(p / 3), 3)))))
let s = 2 * pow(r, 1/3)
return [
s * cos(phi / 3) - b / 3,
s * cos((phi + CGFloat(2) * CGFloat(M_PI)) / 3) - b / 3,
s * cos((phi + CGFloat(4) * CGFloat(M_PI)) / 3) - b / 3
]
}
}
}
func solveQuadratic(a: CGFloat, b: CGFloat, c: CGFloat) -> [CGFloat] {
let discriminant = b * b - 4 * a * c;
if (discriminant < 0) {
return []
} else {
return [
(-b + sqrt(discriminant)) / (2 * a),
(-b - sqrt(discriminant)) / (2 * a)
]
}
}
private func crt(v: CGFloat) -> CGFloat {
if (v<0) {
return -pow(-v, 1/3)
}
return pow(v, 1/3)
}
private func bezierOutputAtT(start: CGPoint, point1: CGPoint, point2: CGPoint, end: CGPoint, t: CGFloat) -> CGPoint {
// bezier control points
let C0 = start
let C1 = point1
let C2 = point2
let C3 = end
// The cubic polynomial coefficients such that Bez(t) = A*t^3 + B*t^2 + C*t + D
let A = CGPointMake(C3.x - 3.0*C2.x + 3.0*C1.x - C0.x, C3.y - 3.0*C2.y + 3.0*C1.y - C0.y)
let B = CGPointMake(3.0*C2.x - 6.0*C1.x + 3.0*C0.x, 3.0*C2.y - 6.0*C1.y + 3.0*C0.y)
let C = CGPointMake(3.0*C1.x - 3.0*C0.x, 3.0*C1.y - 3.0*C0.y)
let D = C0
return CGPointMake(((A.x*t+B.x)*t+C.x)*t+D.x, ((A.y*t+B.y)*t+C.y)*t+D.y)
}
// TODO: - future implementation
private func tangentAngleAtT(start: CGPoint, point1: CGPoint, point2: CGPoint, end: CGPoint, t: CGFloat) -> CGFloat {
// bezier control points
let C0 = start
let C1 = point1
let C2 = point2
let C3 = end
// The cubic polynomial coefficients such that Bez(t) = A*t^3 + B*t^2 + C*t + D
let A = CGPointMake(C3.x - 3.0*C2.x + 3.0*C1.x - C0.x, C3.y - 3.0*C2.y + 3.0*C1.y - C0.y)
let B = CGPointMake(3.0*C2.x - 6.0*C1.x + 3.0*C0.x, 3.0*C2.y - 6.0*C1.y + 3.0*C0.y)
let C = CGPointMake(3.0*C1.x - 3.0*C0.x, 3.0*C1.y - 3.0*C0.y)
return atan2(3.0*A.y*t*t + 2.0*B.y*t + C.y, 3.0*A.x*t*t + 2.0*B.x*t + C.x)
}
}
</code></pre>
| 3,166
|
<p>My FDM printer bed moves on the Y-axis and the print head moves on the X-axis and raises on the Z-axis. When printing rectangular objects (a model of Notre Dame in this case), are there print detail quality advantages to aligning the model perpendicular to the X or Y axis, or at 45 degrees? Part strength is not an issue and support is not needed.</p>
<p>Thanks.</p>
|
<p>In short: Not really.</p>
<p>longer version: It depends.</p>
<p>The main culprit of losing details in this case would be the weight and speed of the thing moving. So if you have a heavy X-axis carriage, acceleration and decelerating the carriage won't be instant. Same with the bed (Y-axis).</p>
<p>Another culprit can be slop in the system, so check your linear bearings and belt tension.</p>
<p>Also keep in mind that you are printing on the bed, so the weight of the Y-axis increases while the print progresses. This shouldn't be a problem for small prints, but if your print becomes bigger it can decrease the quality. Another factor is that every print will bend a little the higher it gets, so if you print a tall slender object, don't accelerate the bed too fast ;)</p>
<p>To summarize, for high detailed prints:</p>
<ul>
<li>Lower the speed</li>
<li>Check the system for slop (tighten belts, and align linear bearings)</li>
<li>Take the lightest axis for the highest detail (keep the weight of the print in mind)</li>
</ul>
<p>One thing that you can do to test your machine is to test the ghosting on each axis (<a href="https://www.thingiverse.com/thing:277394" rel="nofollow noreferrer">https://www.thingiverse.com/thing:277394</a>).</p>
|
<p>I'm under the impression that your question hints on rectilinear motion by aligning the print part to the axes motion of the printer. So, placing it under 45° would suggest movement of both steppers to make a straight line opposed to one stepper movement for a straight line.</p>
<p>Basically, the weight of the carriage and the play in the system determine the quality of the details. Not how much steppers are involved to print the part. As an example, CoreXY or H-bot style printers use 2 steppers to print a straight line and a single stepper to print diagonally. These printers are capable of producing very accurate prints.</p>
<p>On a Prusa i3 style printer it is not expected to see large differences unless you print very fast so that the inertia or play take a predominant role in the quality.</p>
| 1,301
|
<p>I thought I have already had and fixed every problem one could possibly have with a 3D printer. Guess I was wrong.</p>
<p>I haven't used my Creality CR-10 for a few weeks, everything was working the last time I tried. Today I wanted to print something minor and the printer just randomly paused a few times in the middle of the print.</p>
<p>To be exact, it seems that after a few G-code commands have been executed the printer just freezes for like 10 seconds and then continues like nothing happened. This occurred a few times and every time the nozzle is melting the surrounding plastic and extruding a little which ruins the print.</p>
<p>I have tried:</p>
<ul>
<li>Print from SD Card</li>
<li>Print from Laptop via USB connection to Ultimaker Cura</li>
<li>Print different models at different settings</li>
</ul>
<p>My theory is that either there is a core problem with how Ultimaker Cura exports the G-code files or something is wrong with the printer software. I thought that maybe re-installing the firmware might fix it but I heard that that is a risky process. What do I do?</p>
|
<p><strong>Edit: The z-hop problem has been fixed in Cura 4.2.</strong></p>
<hr>
<p>This is a known issue with Cura 4.1 when z-hop is enabled.</p>
<p>If you touch the z-axis motor frame while it is apparently stationary, you may feel it is actually moving.</p>
<p>The solution is to set a value (I used something like 250 in conjunction with an Ender 3) for the "Maximum Z Speed".</p>
<p>First you need to get the setting to be visible, so go to the "Settings" menu and choose "Configure setting visibility...":</p>
<p><a href="https://i.stack.imgur.com/LrN1v.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LrN1v.png" alt="Configure setting visibility dialog"></a></p>
<p>Then in the "Print settings" panel:</p>
<p><a href="https://i.stack.imgur.com/Jzm3u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jzm3u.png" alt="Print settings panel"></a></p>
<p>The full story is available on GitHub at <a href="https://github.com/Ultimaker/Cura/issues/5753" rel="nofollow noreferrer">[4.1 - current master branch] Z feed rates #5753</a>.</p>
|
<p>I experienced the same with 4.1. Everything went back to normal after going back to 4.0 despite that all settings were identical as far as I could see. I compared the two g-code files using a simple file comparison tool. They were very different, hardly anything was the same. I still need to figure out what they mean. The model and thus the g-code files are far to large to go through. So, I will have to use a simple and small model to start unraveling what those differences mean.</p>
| 1,351
|
<p>I am printing ABS in an enclosure and most of the prints have worked out well with minor tweaking. However, the top layer always seems to split or skip a step (not sure which).</p>
<p><a href="https://i.stack.imgur.com/ZtGE7.jpg" rel="nofollow noreferrer" title="Split top layer"><img src="https://i.stack.imgur.com/ZtGE7.jpg" alt="Split top layer" title="Split top layer" /></a></p>
<p><a href="https://i.stack.imgur.com/aXANy.jpg" rel="nofollow noreferrer" title="Layer was peeled of on previous prints"><img src="https://i.stack.imgur.com/aXANy.jpg" alt="Layer was peeled of on previous prints" title="Layer was peeled of on previous prints" /></a></p>
<p>The cube is sliced in Ultimaker Cura 4.3.0 with 0.2 mm layer height, 0.4 mm nozzle, 80 °C bed on lexan and a 235 °C hotend.</p>
<p>The G-code to the calibration cube/chep's calibration cube is attached: <a href="https://drive.google.com/file/d/1GekxfKeUgv337_r0DeJ6_2JTWV_fT1_R/view?usp=sharing" rel="nofollow noreferrer"><code>PI3XL_CHEPCalibrationCube.gcode</code></a>.</p>
<p>While I'm on the subject of slicing and calibration my calibration angle is coming out as before in Simplify3D, this time the layers look great but the onion skinning within the print itself so I could actually separate the calibration angle like an onion.</p>
|
<p>Since it happens in the same place each time, it's either G-code or mechanical. I've seen things like this happen with dirty gantries, or a dirty Z-axis guide.</p>
<p>If it's not mechanical, there may be something in the G-code that causes it, such as too many retractions in one area, or similar.</p>
|
<p>Personally, I have dealt with this problem myself! I messed around with the slicer a little bit, and I found that if you make the print layer height 0.15 or 0.10 mm, it will be better. The image you attached looks as though the printer was splitting a step and only printing that part. I can't think of a reason why it would do that. I also can't find anything online, so I would just play with the print settings or change the layer height until it comes out how you want it.</p>
| 1,499
|
<p>In C#, if I need to open an HTTP connection, download XML and get one value from the result, how would I do that?</p>
<p>For consistency, imagine the webservice is at www.webservice.com and that if you pass it the POST argument fXML=1 it gives you back </p>
<pre><code><xml><somekey>somevalue</somekey></xml>
</code></pre>
<p>I'd like it to spit out "somevalue".</p>
|
<p>I use this code and it works great:</p>
<pre><code>System.Xml.XmlDocument xd = new System.Xml.XmlDocument;
xd.Load("http://www.webservice.com/webservice?fXML=1");
string xPath = "/xml/somekey";
// this node's inner text contains "somevalue"
return xd.SelectSingleNode(xPath).InnerText;
</code></pre>
<hr>
<p>EDIT: I just realized you're talking about a webservice and not just plain XML. In your Visual Studio Solution, try right clicking on References in Solution Explorer and choose "Add a Web Reference". A dialog will appear asking for a URL, you can just paste it in: "<a href="http://www.webservice.com/webservice.asmx" rel="nofollow noreferrer">http://www.webservice.com/webservice.asmx</a>". VS will autogenerate all the helpers you need. Then you can just call:</p>
<pre><code>com.webservice.www.WebService ws = new com.webservice.www.WebService();
// this assumes your web method takes in the fXML as an integer attribute
return ws.SomeWebMethod(1);
</code></pre>
|
<p>It may also be worth adding that if you need to specifically use POST rather than SOAP then you can configure the web service to receive POST calls:</p>
<p>Check out the page on MSDN:
<a href="http://msdn.microsoft.com/en-us/library/aa719747(VS.71).aspx" rel="nofollow noreferrer">Configuration Options for XML Web Services Created Using ASP.NET</a></p>
| 7,405
|
<p>Is there a reliable way to detect whether or not WinHelp is installed on Windows Vista or newer versions of Windows? If possible, I'd like a solution that's not specific to any particular version of Windows.</p>
<p>I've posted this question to other message boards and got back answers regarding the size of Winhlp32.exe before and after installing WinHelp and Registry entries that Microsoft has documented, but none of them were correct.</p>
|
<p>The download for WinHelp from Microsoft appears to be a hotfix (.msu) that enables the WinHelp program. This would explain why the size/registry keys don't change as the hotfix is just a "delta" change from the orginal file. </p>
<p>Since it's a hotfix, this means that you should be able to query the installed hotfixes for your OS.</p>
<p>The following command generates a .htm document listing all of the installed hotfixes.</p>
<pre><code>wmic qfe list full /format:htable >C:\hotfixes.htm
</code></pre>
<p>The table generated lists the Knowledge Base articles corresponding to the hotfix that is installed. You can search for "917607" because that should be present if you've installed the WinHelp hotfix. You may be able to pass in different options to the utility to perform a better search. NOTE - The wmic command requires admin privileges to run.</p>
<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=6EBCFAD9-D3F5-4365-8070-334CD175D4BB&displaylang=en" rel="nofollow noreferrer">Link to Microsoft KB Article on WinHelp</a></p>
|
<p>I hate to say it, but move on from WinHelp. It's been deprecated for a reason. We were able to migrate to a .chm in only a few hours. It's pretty straight-forward to use the newer help authoring tools, and newer formats like .chm give you benefits like cascading style sheets. </p>
| 9,114
|
<p>I'm having issues with my SQL Reporting Services reports. I'm using a custom font for report headers, and when deployed to the server it does not render correctly when I print or export to PDF/TIFF. I have installed the font on the server. Is there anything else I need to do in order to use custom fonts?</p>
<p>When viewing the font in the browser it looks correct - since all client computers have the font installed...</p>
<hr>
<p>Thanks Ryan, your post to the FAQ solved the problem. Installing the fonts on the server fixes the print problem, as well as problems with charts (which are also rendered on the server). Like you point out (as well as being mentioned in the FAQ) Reporting Services 2005 does not do font embedding in PDF files. I guess that is okay for now - the most important part was being able to hit print and get the correct fonts.</p>
<p>The reason the fonts didn't show up straight away is answered in the FAQ:</p>
<blockquote>
<p><strong>Q: I've installed the font on my client/server but I still see ?'s or
black boxes. Why?</strong> A: For the client
machine, closing all instances of the
PDF viewer then reopening them should
fix the issue.</p>
<p>For the server, restarting the
services should allow the PDF renderer
to pick up the new font information.</p>
<p>Unfortunately, I have also seen times
where I needed a full machine reboot
to get the client/server to recognize
the newly installed font.</p>
</blockquote>
|
<p>The PDF files served up from SSRS, like many PDF files, have embedded postscript fonts. So, the local fonts used in the report are converted to a best matching postscript font when the conversion takes place so the PDF is totally portable without relying on locally installed fonts. </p>
<p>You can see the official MS guidelines and font requirements for SSRS PDF exports here: <a href="http://technet.microsoft.com/en-us/library/ms159713(SQL.90).aspx" rel="nofollow noreferrer">SQL Server 2005 Books Online (September 2007) Designing for PDF Output</a>. Also, this post should provide some help as well: <a href="http://blogs.msdn.com/donovans/pages/reporting-services-pdf-renderer-faq.aspx" rel="nofollow noreferrer">Reporting Services: PDF Renderer FAQ</a></p>
<hr>
<p>Aspose apparently also has a component that claims to be able to add custom embedded fonts in SQL Report PDFs. </p>
<p>See <a href="http://www.aspose.com/community/blogs/aspose.pdf/archive/2008/05/02/aspose-pdf-for-reporting-services-v1-3-0-0-released.aspx" rel="nofollow noreferrer">Aspose.Pdf for Reporting Services</a></p>
<blockquote>
<p>Aspose.Pdf for Reporting Services
makes it possible generating PDF
reports in Microsoft SQL Server 2000
and 2005 Reporting Services. Some
advanced features like XMP metadata,
<strong>custom embedded font</strong> and rendering
watermark for pages are now supported.
All RDL report features including
sections, images, charts, tables,
matrices, headers and footers are
converted with the highest degree of
precision to PDF.</p>
</blockquote>
<p>I've not tried this component, so I can only share what it claims to be able to do.</p>
|
<p>We had to install NeoDynamic barcode software to render the barcode as an image since we can't include the barcode fonts in PDF exports.</p>
| 3,988
|
<p>The web applications I develop often require co-dependent configuration settings and there are also settings that have to change as we move between each of our environments.</p>
<p>All our settings are currently simple key-value pairs but it would be useful to create custom config sections so that it is obvious when two values need to change together or when the settings need to change for an environment.</p>
<p>What's the best way to create custom config sections and are there any special considerations to make when retrieving the values?</p>
|
<p><strong>Using attributes, child config sections and constraints</strong></p>
<p>There is also the possibility to use attributes which automatically takes care of the plumbing, as well as providing the ability to easily add constraints.</p>
<p>I here present an example from code I use myself in one of my sites. With a constraint I dictate the maximum amount of disk space any one user is allowed to use.</p>
<p>MailCenterConfiguration.cs:</p>
<pre><code>namespace Ani {
public sealed class MailCenterConfiguration : ConfigurationSection
{
[ConfigurationProperty("userDiskSpace", IsRequired = true)]
[IntegerValidator(MinValue = 0, MaxValue = 1000000)]
public int UserDiskSpace
{
get { return (int)base["userDiskSpace"]; }
set { base["userDiskSpace"] = value; }
}
}
}
</code></pre>
<p>This is set up in web.config like so</p>
<pre><code><configSections>
<!-- Mailcenter configuration file -->
<section name="mailCenter" type="Ani.MailCenterConfiguration" requirePermission="false"/>
</configSections>
...
<mailCenter userDiskSpace="25000">
<mail
host="my.hostname.com"
port="366" />
</mailCenter>
</code></pre>
<p><strong>Child elements</strong></p>
<p>The child xml element <em>mail</em> is created in the same .cs file as the one above. Here I've added constraints on the port. If the port is assigned a value not in this range the runtime will complain when the config is loaded.</p>
<p>MailCenterConfiguration.cs:</p>
<pre><code>public sealed class MailCenterConfiguration : ConfigurationSection
{
[ConfigurationProperty("mail", IsRequired=true)]
public MailElement Mail
{
get { return (MailElement)base["mail"]; }
set { base["mail"] = value; }
}
public class MailElement : ConfigurationElement
{
[ConfigurationProperty("host", IsRequired = true)]
public string Host
{
get { return (string)base["host"]; }
set { base["host"] = value; }
}
[ConfigurationProperty("port", IsRequired = true)]
[IntegerValidator(MinValue = 0, MaxValue = 65535)]
public int Port
{
get { return (int)base["port"]; }
set { base["port"] = value; }
}
</code></pre>
<p><strong>Use</strong></p>
<p>To then use it practically in code, all you have to do is instantiate the MailCenterConfigurationObject, this will <strong>automatically</strong> read the relevant sections from web.config.</p>
<p>MailCenterConfiguration.cs</p>
<pre><code>private static MailCenterConfiguration instance = null;
public static MailCenterConfiguration Instance
{
get
{
if (instance == null)
{
instance = (MailCenterConfiguration)WebConfigurationManager.GetSection("mailCenter");
}
return instance;
}
}
</code></pre>
<p>AnotherFile.cs</p>
<pre><code>public void SendMail()
{
MailCenterConfiguration conf = MailCenterConfiguration.Instance;
SmtpClient smtpClient = new SmtpClient(conf.Mail.Host, conf.Mail.Port);
}
</code></pre>
<p><strong>Check for validity</strong></p>
<p>I previously mentioned that the runtime will complain when the configuration is loaded and some data does not comply to the rules you have set up (e.g. in MailCenterConfiguration.cs). I tend to want to know these things as soon as possible when my site fires up. One way to solve this is load the configuration in _Global.asax.cx.Application_Start_ , if the configuration is invalid you will be notified of this with the means of an exception. Your site won't start and instead you will be presented detailed exception information in the <a href="http://www.codinghorror.com/blog/images/yellow-screen-of-death-large.png" rel="noreferrer">Yellow screen of death</a>.</p>
<p>Global.asax.cs</p>
<pre><code>protected void Application_ Start(object sender, EventArgs e)
{
MailCenterConfiguration.Instance;
}
</code></pre>
|
<p>You can accomplish this with Section Handlers. There is a basic overview of how to write one at <a href="http://www.codeproject.com/KB/aspnet/ConfigSections.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/aspnet/ConfigSections.aspx</a> however it refers to app.config which would be pretty much the same as writing one for use in web.config. This will allow you to essentially have your own XML tree in the config file and do some more advanced configuration.</p>
| 2,435
|
<p>I've inherited a .NET application that automatically updates it's version number with each release. The problem, as I see it, is the length and number of digits in the version number.</p>
<p>An example of the current version number format is <code>3.5.3167.26981</code> which is a mouthful for the users to say when they are reporting bugs.</p>
<p>What I would like is something more like this: <code>3.5 (build 3198)</code>. I would prefer to manually update the major and minor versions, but have the build number update automatically.</p>
<p>Even better, I don't want the build number to increment unless I am compiling in RELEASE mode.</p>
<p>Anyone know if there is a way to do this -- and how?</p>
|
<p>In one of the project files, probably AssemblyInfo.cs, the assembly version attribute is set to <code>[assembly: AssemblyVersion("3.5.*")]</code> or something similar. The * basically means it lets Visual Studio automatically set the build and revision number. </p>
<p>You can change this to a hard coded value in the format <code><major version>.<minor version>.<build number>.<revision></code></p>
<p>You are allowed to use any or all of the precision. For instance 3.5 or 3.5.3167 or 3.5.3167.10000.</p>
<p>You can also use compiler conditions to change the versioning based on whether you're doing a debug build or release build.</p>
|
<p>At a previous company we did something like this by writing an Ant task to get the current Subversion changeset string, which we used as the build number, appended after the major, minor, and tertiary numbers. You could do something like this with Visual Studio as well.</p>
| 6,206
|
<p>I'm writing this question here hoping someone will be able to help me with the fixing process that I'm currently involved in!</p>
<p>Last week during a printing session my Ultimaker original unexpectedly stop working. The problem was on the extruder step motor which push the filament from the back and literally is not moving anymore! The first thing I have done was to check if the motor was burn or something similar. So I swap the extruder motor with the X-axis one and it then worked fine. </p>
<p>Then later the X-axis motor into the extruder connector and is not moving! so I decided to check the step driver and they seems to work all well. So the problem must be on the Arduino or on the motherboard! I bought new step driver a new step motor and new Arduino + motherboard, connected all up and nothing, still not working for the same reason! It is just the extruder motor that won't work anymore!</p>
<p>Do you guys have some idea or tips to find out what the problem can be or how can be fixed in alternative ways? Your help will be much appreciated and looking forward for some answers.</p>
|
<p>I'm not sure I know exactly what is wrong or what steps you've taken so far, but it seems like your extruder motor is broken and you've narrowed the problem down to electronics.
<br>
If so, replacing the Arduino, motor, and driver leaves only the Ultimaker PCB as the source of the problem. I would suggest ordering another - but not until you've contacted Ultimaker with the problem you're outlining here.</p>
|
<p>Your title says "x-axis" but your description leads me to think that your extruder is the part that's not working. Here are some tips which may (or may not) help...</p>
<ul>
<li>Make sure your extruder is not clogged.</li>
<li>Make sure your temperature setting is high enough to allow the filament to melt quickly enough to support your print speed. If your extruder stepper is getting very hot, you may be pushing it too hard. Modern stepper drivers have various protections that will cause them to shut down in this situation. (Over current or thermal shutdown being the most likely in this case)</li>
<li>If you swap stepper motors and swap stepper drivers and the issue stays with your extruder, look for other things that you haven't swapped. </li>
<li>You haven't swapped the extruder, so the problem could be there as I mentioned above. </li>
<li>If you haven't swapped wires, the problem could be there...I've struggled through troubleshooting many times because of intermittent connections in wires. Since 3d printers have moving wires, this is a prime suspect in older machines.</li>
<li>Rule out all of the easy and cheap stuff before you conclude that it must be the main board...it could be, but it's probably not.</li>
<li>Seek help in the Ultimaker forums or with their technical support. Printers, like cars, tend to have certain things that are more prone to failure as the machines get old and worn. The Ultimaker techs will know these things and can help you pin down your issue.</li>
</ul>
<p>Good luck! I hope you solve your issue and that this answer is helpful. :-)</p>
| 379
|
<p>I wanted to build a 4-wheel ground robot vehicle with a payload of 25 kg for outdoor use, but I wanted to make the frame/chassis using a 3D printer. The outside temperature ranges between 30 °C-35 °C and the humidity is 70-90%. I think the vehicle would be outside for 4 hours at a time. The dimensions of the vehicle would be about 1.0 m x 0.8 m x 0.8 m (LxWxH). From other stack exchange questions and some reading online, my choices have come down to ASA, PC, and Nylon. It's important that the printed part doesn't deform outside. I think I'm leaning towards Nylon for tensile strength, toughness, and heat deflection, but I don't know how the Nylon printed part will hold in high humidity.</p>
<p>Has anyone had experience with Nylon in the outdoor conditions I mentioned? Was it difficult to print a large surface area Nylon part (I'm thinking of printing with the filament directly coming out of an active dryer)? Which bed surface were you using? Would you recommend any other filaments?</p>
|
<p>The application doesn't look to be demanding at all from a material point of view. Operation below 40 °C and 70-90% RH is not that special.</p>
<p>Once taken out PLA for creep, most rigid filaments would work. Nylon deform under constant stress, so screws may get loose over time.</p>
<p>PETG, ABS, ABS+ (TitanX/niceABS are about as easy to print as PLA), ASA, ...</p>
<p>For ease of print, PETG or ABS+ should be fine, but ABS will deform more before breaking, while PETG tends to shatter when it breaks.</p>
|
<p>My first choice for this would be PET. Not PETG, which is a mess of blobbing, stringing, warping, creep under load, etc., but real PET, also known as BPET (bottle PET) or HTPET (high temperature PET, because it needs high temperatures to print and has high HDT)</p>
<p>Unlike ASA, PC, and nylon, PET is easy to print. It does not need a heated chamber or even a heated bed (although it does a little better with the bed a little above room temperature, at 30-45°C) and you don't have to fight with warping or compensate for significant part shrinkage.</p>
<p>The HTPET I use is rated for high HDT, 87°C as-is, and 100°C annealed. You can probably arrange for it to self-anneal during the printing process with the right settings; I'm planning to experiment with this at some point. To give you an idea how readily it anneals, the smokestack of a Benchy tends to anneal while printing it just from the accumulation of heat in a small area.</p>
<p>It needs high print temperatures. 275°C is about the minimum. The manufacturer of the HTPET I used recommends 285°C for high speed, but I've found flow increases all the way up to around 320°C if you want to go faster.</p>
<p>It is somewhat hard to find PET filament, despite it being fairly easy to make your own from recycling bottles. I would not really recommend that for your project because it's hard to get perfect flow to simultaneously ensure precision and part strength. There are at least a few manufacturers selling it in the US and probably elsewhere though.</p>
| 2,195
|
<p>What's the simplest way of blocking a thread until a file has been unlocked and is accessible for reading and renaming? For example, is there a WaitOnFile() somewhere in the .NET Framework?</p>
<p>I have a service that uses a FileSystemWatcher to look for files that are to be transmitted to an FTP site, but the <em>file created</em> event fires before the other process has finished writing the file.</p>
<p>The ideal solution would have a timeout period so the thread doesn't hang forever before giving up.</p>
<p>Edit: After trying out some of the solutions below, I ended up changing the <em>system</em> so that all files wrote to <code>Path.GetTempFileName()</code>, then performed a <code>File.Move()</code> to the final location. As soon as the <code>FileSystemWatcher</code> event fired, the file was already complete.</p>
|
<p>This was the answer I gave on a <a href="https://stackoverflow.com/questions/41290/file-access-strategy-in-a-multi-threaded-environment-web-app#41559">related question</a>:</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>I do it the same way as Gulzar, just keep trying with a loop.</p>
<p>In fact I don't even bother with the file system watcher. Polling a network drive for new files once a minute is cheap.</p>
| 7,350
|
<p>Is it correct to link a static library (.lib) compiled with VS 2005 with a program which is compiled with VS 2008? Both library and my program are written in C++. This program is run on Windows Mobile 6 Professional emulator.</p>
<p>This seems to work, there are no linking errors. However the program crashes during startup because strange things happen inside the linked library. E.g. lib can return a vector of characters with size of big negative number.</p>
<p>There are no such problems when the program is compiled with VS 2005.</p>
<p>What is even more strange the problem is only when using release configuration for the build. When compiling using debug configuration the problem doesn't occur.</p>
|
<p>VS2005 and VS2008 use different STL implementations. When the VS2005 code returns a vector, the object has memory layout different from what VS2008 expects. That should be the reason for the broken values you see in the returned date.</p>
<p>As a rule of thumb, you should always compile all C++ modules of a project with the same compiler and all settings/#defines equal.</p>
<p>One particular #define that causes similar behaviour is the SECURE_SCL #define of VS2008. Two modules compiled with different settings will create exactly your problems, because #defining SECURE_SCL introduces more member variables to various C++ library classes.</p>
|
<p><strong>Addition:</strong> As <a href="https://stackoverflow.com/a/49423/4792058">Timbo has pointed out</a>, VS 2005 and VS 2008 use different STL implementations. However, you can use VS 2008 to build against the old STL if VS 2005 is installed, too:</p>
<ol>
<li><p>Open your library project in VS 2008.</p></li>
<li><p>Go to Tools > Options > Projects and Solutions > VC++ Directories</p></li>
<li><p>Select your device platform in the drop-down at the top.</p></li>
<li><p>Change the paths from the VS9 to the VS8 folders.</p></li>
</ol>
<p>This way, you can use VS 2008 to build libraries for use with VS 2005. (Worked for me.)</p>
| 7,184
|
<p>I'm very new to 3D printing and I've had numerous failed prints. Sometimes, the print is good but while trying to get it off the base I end up bending or breaking the print.</p>
<p>My question is: How to I print and make it easier to release from the plate?</p>
<p>I'm printing with PETG, PLA and ABS. At the moment, it's PETG that is giving me trouble.</p>
<p>My printer is a QIDITECH Dual Extruder.</p>
<p>I found this:</p>
<p><a href="https://all3dp.com/1/remove-3d-print-from-bed-stuck-glass/" rel="nofollow noreferrer">https://all3dp.com/1/remove-3d-print-from-bed-stuck-glass/</a></p>
<p><a href="https://www.youtube.com/watch?v=V6fudqMEGyI" rel="nofollow noreferrer">https://www.youtube.com/watch?v=V6fudqMEGyI</a></p>
<p>I haven't tried any of the proposed solutions yet.</p>
|
<p>I would reccomend heating up the base a bit. If your printer doesnt come with such an option, try heat-gun.</p>
|
<p>I use multiple layers of Elmer's white glue on the glass bed (five layers I think). The glue is PVA which provides a textured surface onto which the PETG adheres. It sticks better when the bed is hot than when the bed is cold. I use a bed temp of 58 degrees on my Anet A8. I have found out that the temp reported by the Anet is lower than the temperature that I measured the surface of the glass to be with my temperature probe. The PETG removes some of the layers of PVA when it comes off. For this reason I'm constantly needing to add more glue to the area that was printed, until the surface is so uneven that I have to remove the glass plate, clean it and start over again. If you take this advice, never flip the glass plate over onto the bare aluminum with the glue on it, as it will stick very firmly! </p>
<p>My colleague in work who has the same Anet A8 uses a glue stick in place of white glue. He also has a good experience printing PETG in this manner. I have tried his glue stick method, and found it difficult to clean when it's time to clean the glass. Now I live by my white glue method.</p>
<p>To apply the glue I use a foam artist's brush to make the layer nice and even. I let each layer dry before I apply the subsequent layers. After each use I quickly wash the brush because the glue will harden in the foam and cause the brush to wear out.</p>
<p>I also use this method with PLA, and TPU.</p>
| 765
|
<p>Can anyone recommend a library for chart generation (bar charts, pie charts etc.) which runs on both Java and .Net?</p>
|
<p><a href="http://www.advsofteng.com/" rel="noreferrer">ChartDirector</a> is fantastic and supports more than just Java and .NET.</p>
|
<p>Flash Charts.<br>
<a href="http://www.fusioncharts.com/free/Gallery.asp" rel="nofollow noreferrer">http://www.fusioncharts.com/free/Gallery.asp</a></p>
| 4,677
|
<p><a href="http://en.wikipedia.org/wiki/Project_Darkstar" rel="nofollow noreferrer">Project Darkstar</a> was the topic of the monthly <a href="http://www.javasig.com/meeting/home.xhtml" rel="nofollow noreferrer">JavaSIG</a> meeting down at the Google offices in NYC last night. For those that don't know (probably everyone), Project Darkstar is a framework for massively multiplayer online games that attempts to take care of all of the "hard stuff." The basic idea is that you write your game server logic in such a way that all operations are broken up into tiny tasks. You pass these tasks to the Project Darkstar framework which handles distributing them to a specific node in the cluster, any concurrency issues, and finally persisting the data.</p>
<p>Apparently doing this kind of thing is a much different problem for video games than it is for enterprise applications. Jim Waldo, who gave the lecture, claims that MMO games have a DB read/write ratio of 50/50, whereas enterprise apps are more like 90% read, 10% write. He also claims that most existing MMOs keep everything in memory exlcusively, and only dump to a DB every 6 hours of so. This means if a server goes down, you would lose all of the work since the last DB dump.</p>
<p>Now, the project itself sounds really cool, but I don't think the industry will accept it. First, you have to write your server code in Java. The client code can be written in anything (Jim claims ActionScript 3 is the most popular, follow by C++), but the server stuff has to be Java. Sounds good to me, but I really get the impression that everyone in the games industry hates Java.</p>
<p>Second, unlike other industries where developers prefer to use existing frameworks and libraries, the guys in the games industry seem to like to write everything themselves. Not only that, they like to rewrite everything for every new game they produce. Things are starting to change where developers are using Havok for physics, Unreal Engine 3 as their platform, etc., but for the most part it looks like everything is still proprietary.</p>
<p>So, are the guys at Project Darkstar just wasting their time? Can a general framework like this really work for complex games with the performance that is required? Even if it does work, are game companies willing to use it?</p>
|
<p><strong>Edit: This was written before Oracle bought Sun and started a rampage to kill everything that does not make them a billion $ per day. See the comments for an OSS Fork.</strong> <em>I still stand by my opinion that stuff like that (MMO Middleware) is realistic, you just need a company that doesn't suck behind it.</em></p>
<p>The Market may be dominated by few large games, but that does not mean that there is not a lot of room for more niche games. Lets face it: If you want to reach 100.000+ players, you're ending up building your own technology stack, at least for the critical core. That's what CCP did for EVE Online (<a href="http://myeve.eve-online.com/devblog.asp?a=blog&bid=584" rel="noreferrer">StacklessIO</a>), that's what Blizzard did for World of Warcraft (although they do use many third-party libraries), that's what Mythic did for Warhammer Online (although they are based on Gamebryo).</p>
<p>However, if you aim to be a small, niche MMO (like the dozens of Free-to-Play/Itemshop MMOs), then getting the Network stuff right is just insanely hard, data consistency is even harder and scalability is the biggest b*tch.</p>
<p>But game technology is not your only problem - you also need to tackle Billing. Credit Card only? Have fun selling in Germany then, people there want ELV. That's where you need a reliable billing provider, but you still need to wire in the billing application with your accounts to make sure that accounts are blocked/reactivated when the billing fails.</p>
<p>There are some companies already offering "MMO Infratructure Services" (i.e. <a href="http://www.e-eis.com/cms/front_content.php?changelang=2" rel="noreferrer">Arvato's EEIS</a>), but the bottom line is: Stuff like Project Darkstar IS realistic, but assuming that you can build a Multi-Billion-MMO entirely on a Third Party Stack is optimistic, possibly idealistic.</p>
<p>But then again, entirely inventing all of the technology is even more stupid - use the Third Party stuff that you need (i.e. Billing, Font Rendering, Audio Output...), but <a href="http://www.codinghorror.com/blog/archives/001172.html" rel="noreferrer">write the stuff that really makes or breaks your business</a> (i.e. Network stack, User interface etc.) on your own. (Note: Jeff's posting may be <a href="http://damilare.net/random-talks/dare-obasanjo-vs-jeff-atwood-on-html-validation/" rel="noreferrer">a bit flawed</a>, but the overall direction is correct IMHO.)</p>
<p>Addendum: Also, the game industry does license and reuse engines a lot. The most prominent game Engines are the <a href="http://en.wikipedia.org/wiki/Unreal_Engine" rel="noreferrer">Unreal Engine</a>, <a href="http://en.wikipedia.org/wiki/Source_Engine" rel="noreferrer">Source Engine</a> and <a href="http://en.wikipedia.org/wiki/Id_tech" rel="noreferrer">id Tech</a>, which fuel dozens, if not hundreds of games. But there are some lesser-known (outside of the industry) engines. There is <a href="http://en.wikipedia.org/wiki/Gamebryo" rel="noreferrer">Gamebryo</a>, the Middleware behind games like Civilization 4 and Fallout 3, there was <a href="http://en.wikipedia.org/wiki/RenderWare" rel="noreferrer">RenderWare</a> that is now only EA-in-House, but used in games like Battlefield 2 or The Sims 3. There is the open source <a href="http://www.ogre3d.org/" rel="noreferrer">Ogre3d</a>, which was used in <a href="http://www.dtp-entertainment.com/en/games/game_detail.php?id=2973&landid=1" rel="noreferrer">some</a> commercial <a href="http://www.venetica-game.com/" rel="noreferrer">titles</a>. If you're just looking for Sound, there's stuff like <a href="http://www.fmod.org/" rel="noreferrer">FMOD</a> or if you want to do font-rendering, why not give <a href="http://www.freetype.org/" rel="noreferrer">FreeType</a> a spin?</p>
<p>What I'm saying is: Third-Party Engines/Middleware do exist, and they ARE being successfully used since more than a decade (I know for sure that id's Wolfenstein Engine was licensed to other companies, and that was 1992), even by big companies in multi-million-dollar titles. The important thing is the support, because a good engine with no help in case of an issue is pretty much worthless or at least very expensive if the developer has to spend their game-development-time with unneccessary debugging of the Engine.</p>
<p>If the Darkstar folks manage to get the support side right and 2 or 3 higher profile titles out, I do believe it could succeed in opening the MMO market to a lot more smaller developers and indies.</p>
|
<p>I don't work in the games industry, but it sounds to me like this will do the same thing for video games as the Quake and Half-Life engines did. That is they will promote getting young developers interested in the industry and promote development of indie games. </p>
<p>From what I can tell, video game companies do not reuse most of their code, because if they do it implies that their new game is just a rehash of an old one. Everyone wants a cool new physics engine, better graphics, new ways to play the game. Most video game engines and frameworks are made for a specific scenario and thus are not very bendable to other situations. </p>
<p>Maybe Darkstar will get it right though, but I kinda doubt it, since generalizing only works for so much.</p>
| 4,036
|
<p>In Lucene if you had multiple indexes that covered only one partition each. Why does the same search on different indexes return results with different scores? The results from different servers match exactly. </p>
<p>i.e. if I searched for :</p>
<ul>
<li>Name - John Smith</li>
<li>DOB - 11/11/1934</li>
</ul>
<p><strong>Partition 0</strong> would return a score of 0.345</p>
<p><strong>Partition 1</strong> would return a score of 0.337</p>
<p>Both match exactly on name and DOB.</p>
|
<p>The <a href="http://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/search/Similarity.html" rel="noreferrer">scoring</a> contains the Inverse Document Frequency(IDF). If the term "John Smith" is in one partition, 0, 100 times and in partition 1, once. The score for searching for John Smith would be higher search in partition 1 as the term is more scarce.</p>
<p>To get round this you would wither have to have your index being over all partitions, or you would need to override the IDF.</p>
|
<p>You may also be interested in the output of the <a href="https://lucene.apache.org/core/3_6_2/api/all/org/apache/lucene/search/IndexSearcher.html#explain(org.apache.lucene.search.Query,%20int)" rel="noreferrer"><code>explain()</code> method</a>, and the resulting <a href="https://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/search/Explanation.html" rel="noreferrer"><code>Explanation</code> object</a>, which will give you an idea of how things are scored the way they are.</p>
| 2,287
|
<p>What's a good program to record videos or screencasts being played on screen?</p>
|
<p>I've had success with Camtasia / CamStudio. Check out <a href="http://showmedo.com" rel="nofollow noreferrer">http://showmedo.com</a> for tutorials. It's a little recursive though - it would be better to capture it from source.</p>
|
<p>If you're using Vista the latest version of <a href="http://www.fraps.com/" rel="nofollow noreferrer">Fraps</a> might also do what you need. I haven't tried it for that, though, just games</p>
| 8,415
|
<p>In a VB.NET WinForms project, I get an exception</p>
<blockquote>
<p>Cannot access a disposed of object</p>
</blockquote>
<p>when closing a form. It occurs very rarely and I cannot recreate it on demand. The stack trace looks like this:</p>
<pre><code>Cannot access a disposed object. Object name: 'dbiSchedule'.
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.PointToScreen(Point p)
at Dbi.WinControl.Schedule.dbiSchedule.a(Boolean A_0)
at Dbi.WinControl.Schedule.dbiSchedule.a(Object A_0, EventArgs A_1)
at System.Windows.Forms.Timer.OnTick(EventArgs e)
at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
</code></pre>
<p>The dbiSchedule is a schedule control from Dbi-tech. There is a timer on the form that updates the schedule on the screen every few minutes.</p>
<p>Any ideas what is causing the exception and how I might go about fixing it? or even just being able to recreate it on demand?</p>
<hr>
<p>Hej! Thanks for all the answers. We do stop the Timer on the FormClosing event and we do check the IsDisposed property on the schedule component before using it in the Timer Tick event but it doesn't help.</p>
<p>It's a really annoying problem because if someone did come up with a solution that worked - I wouldn't be able to confirm the solution because I cannot recreate the problem manually.</p>
|
<p>Try checking the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.isdisposed.aspx" rel="noreferrer">IsDisposed</a> property before accessing the control. You can also check it on the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.form.formclosing.aspx" rel="noreferrer">FormClosing</a> event, assuming you're using the FormClosed event.</p>
<blockquote>
<p>We do stop the Timer on the
FormClosing event and we do check the
IsDisposed property on the schedule
component before using it in the Timer
Tick event but it doesn't help.</p>
</blockquote>
<p>Calling GC.Collect before checking IsDisposed may help, but be careful with this. Read this article by Rico Mariani "<a href="http://blogs.msdn.com/ricom/archive/2004/11/29/271829.aspx" rel="noreferrer">When to call GC.Collect()</a>".</p>
|
<p>because the solution folder was inside OneDrive folder.</p>
<p>If you moving the solution folders out of the one drive folder made the errors go away.</p>
<p>best</p>
| 4,928
|
<p>Is there a way I can configure the MidPointRounding enumeration default setting in a config file (I.e. web.config or app.config) I have a considerable source code base, and I need to configure at the application scope how rounding will occur, whether used in Math.Round or decimal type rounding... I would like to do this in order to get consistent rounding results throughout the application without changing every line that works with a decimal type or uses Math.Round....</p>
|
<p>You can play games with post-compile tools that alter the assembly to call your function instead of Math.Round. However, I would just bite the bullet and change the source code.</p>
|
<p>Enum.Parse() is your friend here</p>
<pre><code>MyEnum GetEnumValue(string enumString) {
return (MyEnum)Enum.Parse(typeof(MyEnum),enumString);
}
</code></pre>
<p>Obviously you'd also need some error-checking on the string you're getting from you're config file in which case you might want to return a default.</p>
| 8,911
|
<p>Does anyone know of a similar product to Citrix Server that'll run on the Mac OS?</p>
<p>Essentially, I'm looking to allow multiple remote users to log in to the same OSX Server at the same time (with full visual desktop, not SSH).</p>
|
<p>OS X's Quartz window server has no remoting abilities, unlike <a href="http://en.wikipedia.org/wiki/Display_PostScript" rel="nofollow noreferrer">its predecessor</a>. X11 <em>does</em>, but 'native' OS X applications don't use that; of the few Mac apps typically run in X11 (such as GIMP or CrossOver), none are specific to the Mac, so you might as well run them on a different OS.</p>
<p>That said, if all you want is to visually remote-control a session, it is possible to use VNC or a derivative, such as Apple Remote Desktop. Since 10.4, this allows for multiple simultaneous sessions, <a href="http://www.redstonesoftware.com/products/vine_viewer/multidesktop" rel="nofollow noreferrer">as implemented with Vine Server</a>. Remote Desktop also has other abilities such as remotely installing and updating software.</p>
<p>(Unlike Citrix and X11, VNC does <em>not</em> send drawing commands over the network; it instead transmits a compressed image representation pixel-per-pixel.)</p>
<p>You should specify your exact needs. <strong>You will not get a Citrix-like experience where you can run single Mac apps in their own remote session.</strong> You will, however, get remote graphical control, and that <em>may</em> be more than enough for you.</p>
|
<p>John Vasileff,</p>
<p>Back to My Mac is a tunnelling / NAT traversal technique that enables the use of any networking (including VNC-based remote control). iChat screen sharing, Finder Screen Sharing and Remote Desktop all use VNC. Apple does not offer any non-VNC solutions.</p>
| 7,098
|
<p>I'm embedding the Google Maps Flash API in Flex and it runs fine locally with the watermark on it, etc. When I upload it to the server (flex.mydomain.com) I get a sandbox security error listed below: </p>
<pre><code>SecurityError: Error #2121: Security sandbox violation: Loader.content: http://mydomain.com/main.swf?Fri, 12 Sep 2008 21:46:03 UTC cannot access http://maps.googleapis.com/maps/lib/map_1_6.swf. This may be worked around by calling Security.allowDomain.
at flash.display::Loader/get content()
at com.google.maps::ClientBootstrap/createFactory()
at com.google.maps::ClientBootstrap/executeNextFrameCalls()
</code></pre>
<p>Does anyone have any experience with embedding the Google Maps Flash API into Flex components and specifically settings security settings to make this work? I did get a new API key that is registered to my domain and am using that when it's published.</p>
<p>I've tried doing the following in the main application as well as the component:</p>
<pre><code>Security.allowDomain('*')
Security.allowDomain('maps.googleapis.com')
Security.allowDomain('mydomain.com')
</code></pre>
|
<p>This sounds like a <code>crossdomain.xml</code> related problem. I did a quick search and there seems to be many people with the same issue. Some proxy requests through XMLHttpRequest etc..</p>
<p><a href="http://code.google.com/p/gdata-issues/issues/detail?id=406" rel="nofollow noreferrer">Issue 406: Add crossdomain.xml for Google Accounts</a></p>
|
<p>Thanks for the help. Apparently this has something to do with including the Flex app on an ASP.NET page. When I moved it over to a flat HTML file, it worked fine. I don't have time to fully investigate right now, but that seems to have fixed it.</p>
| 8,485
|
<p>I'm writing an ASP.Net webform with some DropDownList controls on it. Then user changes selected item in one of dropdowns, ASP.Net doesn't seem to handle SelectedIndexChanged event until form is submitted with a 'Submit' button click.
How do I make my dropdowns handle SelectedIndexChanged instantly?</p>
<p>P.S. It's a classic question I have answered too many times, but it seems no one asked it before on stackoverflow.</p>
|
<p>Setting the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.listcontrol.autopostback(VS.71).aspx" rel="noreferrer">AutoPostback</a> property to true will cause it to postback when the selection is changed. Please note that this requires javascript to be enabled.</p>
|
<p>Set the AutoPostBack property of DropDownList to true.</p>
| 9,551
|
<p>In C, are the shift operators (<code><<</code>, <code>>></code>) arithmetic or logical?</p>
|
<p>According to <a href="https://rads.stackoverflow.com/amzn/click/com/0131103628" rel="noreferrer" rel="nofollow noreferrer">K&R 2nd edition</a> the results are implementation-dependent for right shifts of signed values.</p>
<p><a href="http://en.wikipedia.org/wiki/Arithmetic_shift" rel="noreferrer">Wikipedia</a> says that C/C++ 'usually' implements an arithmetic shift on signed values.</p>
<p>Basically you need to either test your compiler or not rely on it. My VS2008 help for the current MS C++ compiler says that their compiler does an arithmetic shift.</p>
|
<p>According to many <a href="/questions/tagged/c" class="post-tag" title="show questions tagged 'c'" rel="tag">c</a> compilers:</p>
<ol>
<li><code><<</code> is an arithmetic left shift or bitwise left shift.</li>
<li><code>>></code> is an arithmetic right shiftor bitwise right shift.</li>
</ol>
| 2,918
|
<p>When compiling my C++ .Net application I get 104 warnings of the type:</p>
<pre><code>Warning C4341 - 'XX': signed value is out of range for enum constant
</code></pre>
<p>Where XX can be</p>
<ul>
<li>WCHAR</li>
<li>LONG</li>
<li>BIT</li>
<li>BINARY</li>
<li>GUID</li>
<li>...</li>
</ul>
<p>I can't seem to remove these warnings whatever I do. When I double click on them it takes me to a part of my code that uses OdbcParameters - any when I try a test project with all the rest of my stuff but no OdbcParameters it doesn't give the warnings.</p>
<p>Any idea how I can get rid of these warnings? They're making real warnings from code I've actually written hard to see - and it just gives me a horrible feeling knowing my app has 104 warnings!</p>
|
<p>This is a <a href="http://forums.msdn.microsoft.com/en-US/vclanguage/thread/7bc77d72-c223-4d5e-b9f7-4c639c68b624/" rel="nofollow noreferrer">compiler bug</a>. Here's <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=159519&SiteID=1" rel="nofollow noreferrer">another post</a> confirming it's a known issue. I've got the same issue in one of my projects and there's no way to prevent it from being triggered unless you have some way of avoiding the use of OdbcParameter. The most conservative way to suppress only the buggy warnings is to use</p>
<pre><code>#pragma warning( push )
#pragma warning( disable: 4341 )
// code affected by bug
#pragma warning( pop )
</code></pre>
|
<p>Either wait for a compiler fix or dont <code>#include</code> code that triggers it.</p>
<p>[A verbose way of saying you probably can't.]</p>
| 3,838
|
<p>How can I assign a keyboard shortcut to a VBA macro in Outlook 2007?</p>
<p>I know how to create a tool for the macro and put it in a menu with an underscore shortcut. This solution requires me to use a shortcut of <kbd>Alt</kbd> + <kbd>{menu key}</kbd> + <kbd>{tool key}</kbd>. What if I want to assign it to <kbd>Alt</kbd> + <kbd>F12</kbd> or something like that?</p>
<p>The Visual Basic Editor is assigned to the keyboard shortcut <kbd>Alt</kbd> + <kbd>F11</kbd> in Outlook 2007. I want to assign a keyboard shortcut like that to a macro, or if necessary a macro on a tool in either a menu or a toolbar.</p>
|
<p>Since Outlook doesn't have the OnKey event, the easiest way is to assign a toolbar button to the macro and put an ampersand in its name somewhere. This only works if your shortcut letter doesn't conflict with an existing shortcut.</p>
<p>You may also have luck with setting a global hotkey, but it's usually more pain then it's worth:</p>
<p><a href="http://www.mvps.org/vbvision/_samples/HotKey_Demo.zip" rel="noreferrer">http://www.mvps.org/vbvision/_samples/HotKey_Demo.zip</a></p>
|
<p>Since Outlook doesn't have the OnKey event, the easiest way is to assign a toolbar button to the macro and put an ampersand in its name somewhere. This only works if your shortcut letter doesn't conflict with an existing shortcut.</p>
<p>You may also have luck with setting a global hotkey, but it's usually more pain then it's worth:</p>
<p><a href="http://www.mvps.org/vbvision/_samples/HotKey_Demo.zip" rel="noreferrer">http://www.mvps.org/vbvision/_samples/HotKey_Demo.zip</a></p>
| 8,127
|
<p>I'm looking for a way to find a the windows login associated with a specific group. I'm trying to add permissions to a tool that only allows names formatted like:</p>
<pre><code>DOMAIN\USER
DOMAIN\GROUP
</code></pre>
<p>I have a list of users in active directory format that I need to add:</p>
<pre><code>ou=group1;ou=group2;ou=group3
</code></pre>
<p>I have tried adding DOMAIN\Group1, but I get a 'user not found' error.</p>
<p>P.S. should also be noted that I'm not a Lan admin </p>
|
<p>Programatically or Manually?</p>
<p>Manually, i prefer <a href="http://technet.microsoft.com/en-us/sysinternals/bb963907.aspx" rel="noreferrer">AdExplorer</a>, which is a nice Active directory Browser. You just connect to your domain controller and then you can look for the user and see all the details. Of course, you need permissions on the Domain Controller, not sure which though.</p>
<p>Programatically, it depends on your language of couse. On .net, the <a href="http://msdn.microsoft.com/en-us/library/system.directoryservices.aspx" rel="noreferrer">System.DirectoryServices</a> Namespace is your friend. (I don't have any code examples here unfortunately)</p>
<p>For Active Directory, I'm not really an expert apart from how to query it, but here are two links I found useful:</p>
<p><a href="http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm" rel="noreferrer">http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm</a></p>
<p><a href="http://en.wikipedia.org/wiki/Active_Directory" rel="noreferrer">http://en.wikipedia.org/wiki/Active_Directory</a> (General stuff about the Structure of AD)</p>
|
<p>OU is an Organizational Unit (sort of like a Subfolder in Explorer), not a Group, Hence group1, 2 and 3 are not actually groups.</p>
<p>You are looking for the DN Attribute, also called "distinguishedName". You can simply use DOMAIN\DN once you have that.</p>
<p>Edit: For groups, the CN (Common Name) could also work. </p>
<p>The full string from Active Directory normally looks like this:</p>
<blockquote>
<p>cn=Username,cn=Users,dc=DomainName,dc=com</p>
</blockquote>
<p>(Can be longer or shorter, but the important bit is that the "ou" part is worthless for what you're trying to achieve.</p>
| 4,351
|
<p>What are the ways that you use to model and retrieve hierarchical info in a database? </p>
|
<p>The definitive pieces on this subject have been written by Joe Celko, and he has worked a number of them into a book called Joe Celko's Trees and Hierarchies in SQL for Smarties.</p>
<p>He favours a technique called directed graphs. An introduction to his work on this subject can be found <a href="http://web.archive.org/web/20081102031702/http://www.intelligententerprise.com/001020/celko.jhtml" rel="nofollow noreferrer">here</a></p>
|
<p>If you're using SQL Server 2005 then <a href="https://web.archive.org/web/20210927200924/http://www.4guysfromrolla.com/webtech/071906-1.shtml" rel="nofollow noreferrer">this link</a> explains how to retrieve hierarchical data.</p>
<p>Common Table Expressions (CTEs) can be your friends once you get comfortable using them.</p>
| 5,977
|
<p>I'm working with LINQ for the first time and wanted to get the Mapping to work when I have a money type in SQL, but my domain object property is of type double. How can I express this in the XML file, or in code so that the mapping does not throw the usual "invalid cast" exception?</p>
|
<p>In the DBML XML file, you can set the Expression attribute of a Column element to something like this:</p>
<pre><code> <Column Name="Table1.Amount" DbType="smallint" Type="System.Int32"
Expression="CAST(Table1.Amount as int)" />
</code></pre>
|
<p>pretty sure Money maps to System.Decimal</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb386947.aspx" rel="nofollow noreferrer">Check here</a></p>
| 3,698
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.