instruction
stringlengths 27
22.5k
| chosen
stringlengths 27
28.2k
| rejected
stringlengths 19
24.9k
| __index_level_0__
int64 0
10k
|
|---|---|---|---|
<p>We have some Win32 console applications running on Windows Server 2003 Service Pack 2 that regularly fail with this:</p>
<blockquote>
<p>Error 1450 (<code>ERROR_NO_SYSTEM_RESOURCES</code>): "Insufficient system resources exist to complete the requested service."</p>
</blockquote>
<p>All the documentation we've found suggests it is linked to the number of <strong>Free System Page Table Entries</strong> running out. We have 16GB RAM in these machines and use the <code>/3GB</code> Operating System switch to squeeze the Windows kernel into 1GB and allow our processes access to 3GB of address space. This drastically reduces the total number of Free System Page Table Entries, so combined with our heavy use of MapViewOfFile() it is perhaps not surprising that the kernel page table entries are running out.</p>
<p>However, when using Performance Monitor to view the Free System Page Table Entries counter, the value is around 36,000 on reboot and <strong>doesn't go down when our application starts</strong>. I find it hard to believe that our application, which opens many large memory-mapped files, doesn't have any effect on the kernel page table. If we can't believe the counter, it's much more difficult to test the effect of any system changes we make.</p>
<p>There is a promising Knowledge Base article, <a href="http://support.microsoft.com/kb/894067" rel="nofollow noreferrer">The Performance tool does not accurately show the available Free System Page Table entries in Windows Server 2003</a>, but it says the problem has been fixed in Service Pack 1, and we are already on Service Pack 2.</p>
<p>Has anyone else struggled with or solved this issue?</p>
<p><strong>Update:</strong> I have checked !sysptes in windbg (debugging the kernel) and the value matches the performance counter, around 36,000. I guess this is most likely to mean that there really are that many free page table entries and Windows <em>is</em> telling the truth. It does leave the question of why we're getting 1450 errors though, if the PTEs are not running out.</p>
<p><strong>Further update:</strong> We never did get to the bottom of why the 1450 errors were occurring. <em>However</em>, instead we upgraded the OS on these servers to 64-bit Windows. This allows the existing 32-bit applications (without recompilation) to access a full 4GB of virtual address space, and lets the kernel memory area with those pesky Page Table Entries be as big as it likes too. I don't think we've had a 1450 error since.</p>
|
<p>Can you try the windbg command "!sysptes" to get System PTE Information? I'm not sure if you can do this with live kernel debug, you may have to get a memory dump.</p>
|
<p>I'm not sure why you assume that <code>ERROR_NO_SYSTEM_RESOURCES</code> is caused <em>only</em> by running out of free System Page Table Entries ? As far as I know, such generic error codes are used for more than one resource type. And in fact, the first Google hit suggests that running out of file cache memory may cause it too. (KB on an XP bug, which tripped this error mode).</p>
<p>In your case, I'd be checking the "Handle Count". Another possible problem is address space fragmentation. If you you want to create a 1GB file mapping view, you need 1GB of free address space, and it has to be contiguous. If you map a 1GB file, a 800 MB file, and a 1GB file, close the 800MB one and open a 900MB file, the 900MB file may not fit in the hole that's left.</p>
| 8,354
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/307291/how-does-the-google-did-you-mean-algorithm-work">How does the Google “Did you mean?” Algorithm work?</a> </p>
</blockquote>
<p>Suppose you have a search system already in your website. How can you implement the "Did you mean:<code><spell_checked_word></code>" like Google does in some <a href="http://www.google.com/search?hl=en&q=spellling&btnG=Search" rel="noreferrer">search queries</a>?</p>
|
<p>Actually what Google does is very much non-trivial and also at first counter-intuitive. They don't do anything like check against a dictionary, but rather they make use of statistics to identify "similar" queries that returned more results than your query, the exact algorithm is of course not known.</p>
<p>There are different sub-problems to solve here, as a fundamental basis for all Natural Language Processing statistics related there is one must have book: <a href="https://rads.stackoverflow.com/amzn/click/com/0262133601" rel="noreferrer" rel="nofollow noreferrer">Foundation of Statistical Natural Language Processing</a>.</p>
<p>Concretely to solve the problem of word/query similarity I have had good results with using <a href="http://en.wikipedia.org/wiki/Edit_distance" rel="noreferrer">Edit Distance</a>, a mathematical measure of string similarity that works surprisingly well. I used to use Levenshtein but the others may be worth looking into.</p>
<p>Soundex - in my experience - is crap.</p>
<p>Actually efficiently storing and searching a large dictionary of misspelled words and having sub second retrieval is again non-trivial, your best bet is to make use of existing full text indexing and retrieval engines (i.e. not your database's one), of which <a href="http://lucene.apache.org/java/docs/" rel="noreferrer">Lucene</a> is currently one of the best and coincidentally ported to many many platforms.</p>
|
<p>Soundex is good for phonetic matches, but works best with peoples' names (it was originally developed for census data)</p>
<p>Also check out Full-Text-Indexing, the syntax is different from Google logic, but it's very quick and can deal with similar language elements.</p>
| 6,272
|
<p>I found a nice model for a ship from the game "Eve". It doesn't have a flat bottom, so it needs support material. But Slic3r generates several dozen tiny support pillars, and one by one they break loose from the build plate. As they get tall, the leverage of course increases, and since they're so tiny they don't have much area in contact with the bed, so they separate. Eventually the whole model broke free, turned a bit, and since I had gone to dinner it kept printing... see below. I think the main problem is the poor support material geometry, but the controls in Slic3r for support material don't seem to give many options.</p>
<p>How can I get better support material layout? Oh, this is PLA, by the way.</p>
<p><a href="https://i.stack.imgur.com/d4sbr.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d4sbr.jpg" alt="Rifter fail"></a></p>
<p>(appending to question to be able to put in the picture)</p>
<p>I tried a bunch of things, and the MeshMixer support, plus fiddling with several settings, got it to come out pretty well. Thanks to all, esp. @Tormod!</p>
<p><a href="https://i.stack.imgur.com/gwngu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gwngu.jpg" alt="enter image description here"></a></p>
|
<p>I know many Slic3r users - myself included - add support material to the model itself <em>before</em> importing it into Slic3r. </p>
<p>I personally favour <a href="http://www.meshmixer.com/" rel="noreferrer">MeshMixer</a> for support generation, as the supports are much more predictable and easily removable. In complicated cases I also add supports in my CAD software. </p>
<p>Although a not free, the support generation in <a href="https://www.simplify3d.com/software/" rel="noreferrer">Simplify3D</a> is supposed to be great, allowing for custom placement.</p>
<p>I also found <a href="http://blog.think3dprint3d.com/2014/08/slicing-software-printed-support-review.html" rel="noreferrer">this review</a> that compares support settings in Meshmixer, Slic3r and Cura fairly well. Here is the summary:</p>
<blockquote>
<p><strong>Meshmixer</strong></p>
<p>This support was the most efficient in material use however it required the most manual tweaking to print properly. In addition the marks it left once removed were more noticeable than Cura and (sometimes) Slic3r. While the settings could probably be further modified to improve the performance this support type appears the most limited for future improvements.</p>
<p><strong>Slic3r</strong></p>
<p>The support's performance was variable - by far the best in some situations (fox's head and tale) however the worst to remove with the most obvious marks in other areas of the same model. This may be down to my chosen settings and with some more tweaking I may get better results. The most obvious general flaw is that it does not leave a big enough gap between the support and the unsupported areas of the model (like the foxes legs or the lower roots of the planter)</p>
<p><strong>Cura</strong></p>
<p>While some of the support left marks, overall it was the easiest to generate support which performed consistently well. Once again though slight tweaks could improve this further for specific models. </p>
<p>Overall Cura wins my "no time to tweak - got to make it work now" award.</p>
</blockquote>
|
<p>In my point of view it seems that the bed offset not optimal.
I see that you are using the blue tape, which is better than any other tape. As a next step I would recommend to try different types of glue.</p>
<p>I agree with Tormod Haugene and can also recommend Cura. You can also experiment there with a lot of parameters and after a time you will get a feeling how to print your things successfully.
Just take a look at the download page at Ultimaker for the application and if there are problems with the software you can feel free to report issues at GitHub.</p>
<p>Regards</p>
| 275
|
<p>I receive HTML pages from our creative team, and then use those to build aspx pages. One challenge I frequently face is getting the HTML I spit out to match theirs exactly. I almost always end up screwing up the nesting of <code><div></code>s between my page and the master pages.</p>
<p>Does anyone know of a tool that will help in this situation -- something that will compare 2 pages and output the structural differences? I can't use a standard diff tool, because IDs change from what I receive from creative, text replaces <i>lorem ipsum</i>, etc.. </p>
|
<p>You can use <a href="http://tidy.sourceforge.net/" rel="nofollow noreferrer">HTMLTidy</a> to convert the HTML to well-formed XML so you can use <a href="http://msdn.microsoft.com/en-us/library/aa302294.aspx" rel="nofollow noreferrer">XML Diff</a>, as Gulzar suggested.</p>
<pre><code>tidy -asxml index.html
</code></pre>
|
<p>winmerge is a good visual diff program</p>
| 7,114
|
<p>When downloading both Firefox and Chrome, I've noticed that the default version I got was in my native tongue of Hebrew. I personally don't like my applications in Hebrew, since I'm used to the English UI conventions embedded in me since long ago by:</p>
<ol>
<li><strong>The lack of choice:</strong> Most programs don't offer interfaces in multiple languages and when they do, those languages are usually English and the developer's native tongue.</li>
<li><strong>Programming languages</strong> which are almost completely bound to the English language.</li>
</ol>
<p>My question then is this:</p>
<ol>
<li>If you translate your applications, would you limit the UI to the user's native tongue or give them the choice by enabling more than one language pack by default?</li>
<li>Which language would your application default to (which is interesting mostly if you only install one language pack with your application)?</li>
</ol>
<p>And also generally I'd like to know how much value do you put into translating your applications on a whole.</p>
|
<p>I've helped develop an application that was used by Dutch, English, Spanish and Portuguese speaking users. Because the application installed from CD we just added all the language packs. Mostly because it saved us a lot of work not having to maintain 4 different versions.</p>
<p>If your application distributed from a website and you have to support more than only 4 languages I can imagine you don't want to let everyone download every language pack. But only distributing the native languages of people downloading the application seems a bit restrictive. Most people I know actually like their software in english. So at least adding the english language to all the versions makes sense.</p>
|
<p>I've never written an application for use by a large number of people, and never for anyone that didn't use English as their language, but if I did, I would probably take a route that installs all available language packs at install (unless the user did a custom install, where I would allow them to choose language packs) and then switch between languages as an option inside the program. If I had to only choose one language, I would choose English if I was doing all of the work, or the native language of the users if I had a translator.</p>
| 8,419
|
<p>I want to use the mouse scrollwheel in my OpenGL GLUT program to zoom in and out of a scene? How do I do that?</p>
|
<p>Note that venerable <a href="http://www.xmission.com/~nate/glut.html" rel="noreferrer">Nate Robin's GLUT</a> library doesn't support the scrollwheel. But, later implementations of GLUT like <a href="http://freeglut.sourceforge.net/" rel="noreferrer">FreeGLUT</a> do.</p>
<p>Using the scroll wheel in FreeGLUT is dead simple. Here is how:</p>
<p>Declare a callback function that shall be called whenever the scroll wheel is scrolled. This is the prototype:</p>
<pre><code>void mouseWheel(int, int, int, int);
</code></pre>
<p>Register the callback with the (Free)GLUT function <strong>glutMouseWheelFunc()</strong>.</p>
<pre><code>glutMouseWheelFunc(mouseWheel);
</code></pre>
<p>Define the callback function. The second parameter gives the direction of the scroll. Values of +1 is forward, -1 is backward.</p>
<pre><code>void mouseWheel(int button, int dir, int x, int y)
{
if (dir > 0)
{
// Zoom in
}
else
{
// Zoom out
}
return;
}
</code></pre>
<p>That's it!</p>
|
<p>observe case 3 and 4 in the switch statement below in the mouseClick callback</p>
<pre><code>glutMouseFunc(mouseClick);
</code></pre>
<p>... </p>
<pre><code>void mouseClick(int btn, int state, int x, int y) {
if (state == GLUT_DOWN) {
switch(btn) {
case GLUT_LEFT_BUTTON:
std::cout << "left click at: (" << x << ", " << y << ")\n";
break;
case GLUT_RIGHT_BUTTON:
std::cout << "right click at: (" << x << ", " << y << ")\n";
break;
case GLUT_MIDDLE_BUTTON:
std::cout << "middle click at: (" << x << ", " << y << ")\n";
break;
case 3: //mouse wheel scrolls
std::cout << "mouse wheel scroll up\n";
break;
case 4:
std::cout << "mouse wheel scroll down\n";
break;
default:
break;
}
}
glutPostRedisplay();
}
</code></pre>
| 3,515
|
<p>I have a Windows Form app with a TabControl. One of the TabPages in the TabControl contains a ToolStrip. Frequently, the Windows Form designer will spontaneously set the Visible property of the Toolstrip to False. To get the toolstrip to reappear in my form, I have to manually find the control and set the property back to True. It's really annoying.</p>
<p>Does anyone know why this happens, or how to stop it? I've tried setting the minimum height of the control to a non-zero value, but that has no effect.</p>
<p>I'm using VS2008, VB.NET and the .Net framework 2.0, however I've struggled with this problem in VS2005 too, in several different applications.</p>
|
<p>I may have found a workaround for this.</p>
<p>My ToolStrip was placed directly on the TabPage, docked to Top. However, I found <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=117176&wa=wsignin1.0" rel="noreferrer">a thread on Microsoft Connect</a> that described the same problem when the ToolStrip was in a ToolStripContainer on the TabPage. That problem was observed in a release candidate of VS2005, but supposedly fixed by Microsoft in September 2006.</p>
<p>As such, I changed my code to put the ToolStrip inside a ToolStripContainer, and now I am unable to reproduce the problem.</p>
|
<p>Open the designer code and explicitly set the control's visible property to true.</p>
<p><strong><em>Nick Hanshaw</em></strong></p>
| 8,142
|
<p>If I create a class like so: </p>
<pre><code>// B.h
#ifndef _B_H_
#define _B_H_
class B
{
private:
int x;
int y;
};
#endif // _B_H_
</code></pre>
<p>and use it like this:</p>
<pre><code>// main.cpp
#include <iostream>
#include <vector>
class B; // Forward declaration.
class A
{
public:
A() {
std::cout << v.size() << std::endl;
}
private:
std::vector<B> v;
};
int main()
{
A a;
}
</code></pre>
<p>The compiler fails when compiling <code>main.cpp</code>. Now the solution I know is to <code>#include "B.h"</code>, but I'm curious as to why it fails. Neither <code>g++</code> or <code>cl</code>'s error messages were very enlightening in this matter.</p>
|
<p>The compiler needs to know how big "B" is before it can generate the appropriate layout information. If instead, you said <code>std::vector<B*></code>, then the compiler wouldn't need to know how big B is because it knows how big a pointer is.</p>
|
<p>The reason you can't use a forward declaration is because the size of B is unknown.</p>
<p>There's no reason in your example that you can't include B.h inside of A.h, so what problem are you really trying to solve?</p>
<p><strong>Edit:</strong> There's another way to solve this problem, too: stop using C/C++! It's so 1970s... ;)</p>
| 5,801
|
<p>One of our weblogic 8.1s has suddenly started logging giant amounts of logs and filling the disk.</p>
<p>The logs giving us hassle resides in </p>
<pre><code>mydrive:\bea\weblogic81\common\nodemanager\NodeManagerLogs\generatedManagedServer1\managedserveroutput.log
</code></pre>
<p>and the entries in the logfile is just the some kind of entries repeated again and again. Stuff like</p>
<pre><code>19:21:24,470 DEBUG [StdRowLockSemaphore] Lock 'TRIGGER_ACCESS' returned by: LLL-SCHEDULER_QuartzSchedulerThread
19:21:31,923 DEBUG [StdRowLockSemaphore] Lock 'STATE_ACCESS' is deLLLred by: QuartzScheduler_LLL-SCHEDULER-NACDLLLF011219763113220_ClusterManager
19:21:31,923 DEBUG [StdRowLockSemaphore] Lock 'STATE_ACCESS' is being obtained: QuartzScheduler_LLL-SCHEDULER-NACDLLLF011219763113220_ClusterManager
19:21:31,923 DEBUG [StdRowLockSemaphore] Lock 'STATE_ACCESS' given to: QuartzScheduler_LLL-SCHEDULER-NACDLLLF011219763113220_ClusterManager
19:21:31,923 DEBUG [StdRowLockSemaphore] Lock 'TRIGGER_ACCESS' is deLLLred by: QuartzScheduler_LLL-SCHEDULER-NACDLLLF011219763113220_ClusterManager
</code></pre>
<p>...</p>
<pre><code>19:17:46,798 DEBUG [CascadingAction] cascading to saveOrUpdate: mypackage.config.common.Share
19:17:46,798 DEBUG [DefaultSaveOrUpdateEventListener] reassociated uninitialized proxy
19:17:46,798 DEBUG [Cascade] done processing cascade ACTION_SAVE_UPDATE for: mypackage.config.common.FileLocation
19:17:46,798 DEBUG [Cascade] processing cascade ACTION_SAVE_UPDATE for: mypackage.config.common.FileLocation
19:17:46,798 DEBUG [CascadingAction] cascading to saveOrUpdate: mypackage.config.common.Share
19:17:46,798 DEBUG [DefaultSaveOrUpdateEventListener] reassociated uninitialized proxy
</code></pre>
<p>I can't find any debug settings set anywhere.
I've looked in the Remote Start classpath and Arguments for the managed server.</p>
<p>Can anyone point me in the direction to gain control over this logfile?</p>
|
<p>Turn that into a spec:<br>
-that objects need to implement an interface in order to be allowed into the collection
Something like <code>ArrayList<ICloneable>()</code></p>
<p>Then you can be assured that you always do a deep copy - the interface should have a method that is guaranteed to return a deep copy. </p>
<p>I think that's the best you can do. </p>
|
<p>I suppose it is an ovbious answer:</p>
<p>Make a requisite for the classes stored in the collection to be cloneable. You could check that at insertion time or at retrieval time, whatever makes more sense, and throw an exception.</p>
<p>Or if the item is not cloneable, just fail back to the return by reference option.</p>
| 4,963
|
<p>I have a project to build a voting desktop application for a class in Java. While security isn't the focus of the project, I would like to be as realistic as I can. What are some of the primary tools to integrate security into a Java application.</p>
<p>Edit: I'm not primarily worried about physical security, we are simply building an application not a whole system. I want to ensure votes are recorded correctly and not able to be changed or read by someone else.</p>
|
<p>It really depends on what kind of security you are looking to integrate. Do you want security to ensure that the user isn't running any debuggers or such to flip bits in your application to change the votes? Do you want to ensure that the user doesn't install logging software to keep track of who voted for who? Do you want to ensure that the person who is supposed to be voting is actually voting? Security is a very broad subject, and it's hard to give an answer without knowing what exactly you are looking for.</p>
|
<p>I believe that physical security is more important for voting booth system rather than you know, code security.<br>
These machine by their very nature shouldn't be connected to any kind of public networks, especially not the the internet. But having a good physical security to prevent any sort of physical tampering is very important.</p>
| 4,900
|
<p>How do I rewrite a URL in ASP.NET?</p>
<p>I would like users to be able to go to</p>
<pre><code>http://www.website.com/users/smith
</code></pre>
<p>instead of</p>
<pre><code>http://www.website.com/?user=smith
</code></pre>
|
<p>Try the Managed Fusion Url Rewriter and Reverse Proxy:</p>
<p><a href="http://urlrewriter.codeplex.com" rel="noreferrer">http://urlrewriter.codeplex.com</a></p>
<p>The rule for rewriting this would be:</p>
<pre><code># clean up old rules and forward to new URL
RewriteRule ^/?user=(.*) /users/$1 [NC,R=301]
# rewrite the rule internally
RewriteRule ^/users/(.*) /?user=$1 [NC,L]
</code></pre>
|
<p>I have used an httpmodule for url rewriting from <a href="http://www.urlrewriting.net/" rel="nofollow noreferrer">www.urlrewriting.net</a> with great success (albeit I believe a much earlier, simpler version)</p>
<p>If you have very few actual rewriting rules then url mappings built in to .NET 2.0 are probably an easier option, there are a few write ups of these on the web, the <a href="https://web.archive.org/web/20210513223749/http://aspnet.4guysfromrolla.com/articles/011007-1.aspx" rel="nofollow noreferrer">4guysfromrolla</a> one seems fairly exhaustive but as you can see they don't support regular expression mappings are are as such rendered fairly useless in a dynamic environment (assuming "smith" in your example is not a special case then these would be of no use)</p>
| 2,444
|
<p>I'm looking to run Redmine, a Ruby on Rails app, on a VPS windows box. The only thing I can really think of is running a virtual Linux machine and hosting it from there. If that is my only option, am I going to run into problems running a virtual machine inside of a virtual machine?</p>
<p>Also, this will be an internal app, so performance isn't my number once concern.</p>
|
<p>Windows is not the usual place to deploy production Rails apps, but there are people who do it. Mongrel was originally written to give better deployment options for Windows. As it turned out the UNIX deployment options weren't that good either. :)</p>
<p>Start with the Ruby One Click installer so you have a sane installation of ruby and rubygems.</p>
<p>From there, you install the rails gem and the gem for your database like you normally would. Most if not all of the databases have Windows gems. </p>
<p>Make sure to install mongrel_service to be able to control each mongrel like a normal windows service. See <code>mongrel_rails service::install -h</code> for details.</p>
<p>Once you have your mongrels set up, it's similar to a UNIX deployment. You set up a reverse proxy, such as Apache2 and you're set.</p>
<p>You might run into some gems (such as <a href="http://backgroundrb.rubyforge.org/" rel="noreferrer">BackgroundRB</a>) that will not work under Windows because they have C code that either rely on UNIX libraries or expect a UNIX-like build system at installation time. However, all of the really important Rails gems, such as Mongrel and the database adapters, have gems with pre-built binaries available, so you'll be fine.</p>
|
<p>You can install SQLite and a Rails server like Mongrel on a Windows machine. I used Aptana to run a development environment, but I'm sure that there are better alternatives that don't require the IDE to be open to run. But this proves it is possible.</p>
| 5,600
|
<p>I am working with ASP.net.<br><br>
I am trying to call a method that exists on the base class for the page I am using. I want to call this method via Javascript and do not require any rendering to be handled by ASP.net.<br><br>
What would be the easiest way to accomplish this.
<br><br>
I have looked at PageMethods which for some reason are not working and found that a lot of other people have had trouble with them.</p>
|
<p>It depends on what the method relies on, but assuming it is a static method or that it does not rely on the Page Lifecycle to work, you could expose a webservice endpoint and hit that with whichever Javascript calling mechanism you would like to use.</p>
|
<p>As Thunder3 suggests, expose a Web Service. Once you have done this, you can register the webservice with the ScriptManager (or ScriptManagerProxy), which will cause a JavaScript wrapper to be generated. This wrapper gives you a good interface to the call.</p>
| 9,315
|
<p>Is there an easy way to capitalize the first letter of a string and lower the rest of it? Is there a built in method or do I need to make my own?</p>
|
<p><code>TextInfo.ToTitleCase()</code> capitalizes the first character in each token of a string.<br />
If there is no need to maintain Acronym Uppercasing, then you should include <code>ToLower()</code>.</p>
<pre><code>string s = "JOHN DOE";
s = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(s.ToLower());
// Produces "John Doe"
</code></pre>
<p>If CurrentCulture is unavailable, use:</p>
<pre><code>string s = "JOHN DOE";
s = new System.Globalization.CultureInfo("en-US", false).TextInfo.ToTitleCase(s.ToLower());
</code></pre>
<p>See the <a href="http://msdn2.microsoft.com/en-us/library/system.globalization.textinfo.totitlecase.aspx" rel="noreferrer">MSDN Link</a> for a detailed description.</p>
|
<p>Like edg indicated, you'll need a more complex algorithm to handle special names (this is probably why many places force everything to upper case).</p>
<p>Something like this untested c# should handle the simple case you requested:</p>
<pre><code>public string SentenceCase(string input)
{
return input(0, 1).ToUpper + input.Substring(1).ToLower;
}
</code></pre>
| 9,843
|
<p>I'm very new to 3D printing, but so far I've been able to print a couple things off Thingiverse without issue. However, as I'm trying to print another part, I've run into a situation where Cura is totally confused as to what's touching the buildplate and what isn't:</p>
<p><a href="https://i.stack.imgur.com/j56yL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/j56yL.png" alt="enter image description here"></a></p>
<p>All I did was use the "mirror" feature to put it in a better orientation for printing....</p>
<p>Any ideas what's going on here? I'm using Cura 3.4 for Linux.</p>
<hr>
<p><strong>Update:</strong> I tried using the rotation tool instead as suggested by Oscar, but I get the same result:</p>
<p><a href="https://i.stack.imgur.com/4v0HG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4v0HG.png" alt="enter image description here"></a></p>
<p><strong>Update 2:</strong> Hmm so even when I just import the part without doing anything else, Cura is still confused:</p>
<p><a href="https://i.stack.imgur.com/jschr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jschr.png" alt="enter image description here"></a></p>
|
<p>If you want to mirror the print to get the top to the bottom, and visa versa, you just need to rotate the part using the XYZ rotation tool. Mirroring is used to make a mirror image in the X-Z or Y-Z plane, not the X-Y plane. </p>
<p>You might just caught a bug, you could post that of their forum.</p>
<p>Update: </p>
<p>If that does not fix it, you might have an incorrect STL model, e.g. the normals of the faces are incorrect. You could try to fix this by repairing the model through an online service like <a href="https://service.netfabb.com" rel="nofollow noreferrer">this one</a>.</p>
|
<p>If you want to mirror the print to get the top to the bottom, and visa versa, you just need to rotate the part using the XYZ rotation tool. Mirroring is used to make a mirror image in the X-Z or Y-Z plane, not the X-Y plane. </p>
<p>You might just caught a bug, you could post that of their forum.</p>
<p>Update: </p>
<p>If that does not fix it, you might have an incorrect STL model, e.g. the normals of the faces are incorrect. You could try to fix this by repairing the model through an online service like <a href="https://service.netfabb.com" rel="nofollow noreferrer">this one</a>.</p>
| 977
|
<p>Here's the situation: I need to bind a WPF <code>FixedPage</code> against a <code>DataRow</code>. Bindings don't work against <code>DataRows</code>; they work against <code>DataRowViews</code>. I need to do this in the most generic way possible, as I know nothing about and have no control over what is in the <code>DataRow</code>. </p>
<p>What I need is to be able to get a <code>DataRowView</code> for a given <code>DataRow</code>. I can't use the <code>Find()</code> method on the <code>DefaultView</code> because that takes a key, and there is no guarantee the table will have a primary key set.</p>
<p>Does anybody have a suggestion as to the best way to go around this? </p>
|
<p>Not Exactly a sexy piece of code but their doesn't seem to be an automated way to find the row without just looping the table.</p>
<pre><code> DataRowView newRowView = null;
foreach (DataRowView tempRowView in myDataTable.DefaultView)
{
if (tempRowView.Row == rowToMatch)
newRowView = tempRowView;
}
if (newRow != null)
UseNewRowView(newRowView);
else
HandleRowNotFound();
</code></pre>
|
<pre><code>row.Table.DefaultView[row.Table.Rows.IndexOf(row)]
</code></pre>
<p>This is an okay answer. But if you find yourself in this situation, you should consider learning more about DataViews and how they are used, then refactor your code to be view-centric rather than table-centric.</p>
| 5,240
|
<p>I would like to call python script files from my c++ program.</p>
<p>I am not sure that the people I will distribute to will have python installed.</p>
|
<p>Boost has a python interface library which could help you.</p>
<p><a href="http://www.boost.org/doc/libs/release/libs/python/doc/index.html" rel="noreferrer">Boost.Python</a></p>
|
<p>Using Inter Process Communication (IPC) over socket can be a possible solution. Use a local network socket to listen/trasfer commands between both.</p>
| 7,155
|
<p>I am attempting to make my Ender 3 Pro print significantly faster than it is intended it I fear.</p>
<p>I hear a clicking noise coming from the extruder above 130 mm/s in Cura when it is going in long straight lines (I think my acceleration settings prevent it on shorter lines). I have seen this before when the bed is too close to the nozzle but I have auto bed leveling now and it is happening on all layers.</p>
<p>I have a standard extruder + Bowden tube setup. What can I do to make things go faster? I am less concerned about the quality of the print and more concerned about the speed.</p>
<p><a href="https://i.stack.imgur.com/sof1U.jpg" rel="nofollow noreferrer" title="Front View"><img src="https://i.stack.imgur.com/sof1U.jpg" alt="Front View" title="Front View" /></a></p>
<p><a href="https://i.stack.imgur.com/zta0M.jpg" rel="nofollow noreferrer" title="Top View"><img src="https://i.stack.imgur.com/zta0M.jpg" alt="Top View" title="Top View" /></a></p>
|
<p>I am still somewhat of a noob, but I have heard that your problem may be because the extruder is not getting the filament out fast enough. You are trying to extrude filament before it is sufficiently fluid. Try increasing your hotend temperature by 5 degrees.</p>
|
<p>You're likely hitting the thermal limit of your hot end.</p>
<p>The standard Creality hotend used in your printers maxes out at around 8-12 mm³/s.
To calculate your current volumetric speed, you can simply calculate</p>
<p><code>speed * layer height * extrusion width</code></p>
<p>With an 0.45 mm extrusion width and 0.2 mm layer heights, printing at 130 mm/s would put you at around 11,7 mm³/s - very high for the standard hot end.</p>
<p>Increasing temperatures as suggested in the other answer will help, but might reduce print quality on other layers / intricate structures.</p>
<p>The "proper" solution would be a Volcano or SuperVolcano hot end, or any of the other "high flow" alternatives.</p>
| 1,768
|
<p>I am looking for a method of storing Application Messages, such as</p>
<ul>
<li>"You have logged in successfully"</li>
<li>"An error has occurred, please call the helpdesk on x100"</li>
<li>"You do not have the authority to reset all system passwords" etc</li>
</ul>
<p>So that "when" the users decide they don't like the wording of messages I don't have to change the source code, recompile then redeploy - instead I just change the message store.</p>
<p>I really like the way that I can easily access strings in the web.config using keys and values.</p>
<pre><code>ConfigurationManager.AppSettings("LOGINSUCCESS");
</code></pre>
<p>However as I could have a large number of application messages I didn't want to use the web.config directly. I was going to add a 2nd web config file and use that but of course you can only have one per virtual directory.</p>
<p>Does anyone have any suggestions on how to do this without writing much custom code?</p>
|
<p>In your Web.config, under appSettings, change it to:</p>
<pre><code><appSettings file="StringKeys.config">
</code></pre>
<p>Then, create your StringKeys.config file and have all your keys in it.</p>
<p>You can still use the AppSettings area in the main web.config for any real application related keys.</p>
|
<p>You can use <a href="http://msdn.microsoft.com/en-us/library/system.resources.resourcemanager.aspx" rel="nofollow noreferrer">ResourceManager</a> class. See "ResourceManager and ASP.NET" article at <a href="http://msdn.microsoft.com/en-us/library/aa309419(VS.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa309419(VS.71).aspx</a></p>
| 5,024
|
<p>I'm running Visual Studio 2008 with the stuff-of-nightmares awful MS test framework. Trouble is that it's sending my CPU to 100% (well 25% on a quad-core).</p>
<p>My question is why can't Visual Studio run on more than one core? Surely M$ must have a sufficient handle on threading to get this to work.</p>
|
<p>I have VS2008 running on all 4 CPUs. Just set this environment variable / project flag.</p>
<p>/MP</p>
<p>(It can be set in C/C++ Settings, Advanced. In project settings)</p>
<p>Edit: The MP flag can also accept a number, e.g. /MP2 which means it will only run on 2 cores. Leaving it as just /MP means it will run on the maximum amount of cores.</p>
<p>Edit2: The MP flag is probably for the compiler only.</p>
|
<p>The /MP flag is only for builds, we at least it is according to this <a href="http://msdn.microsoft.com/en-us/library/bb385193.aspx" rel="nofollow noreferrer">msdn</a></p>
<p>Now I would love to be wrong about it, but im pretty sure its just for builds. Which of course is still very useful.</p>
| 7,749
|
<p>Are there any utilities or browser plugins that let you easily switch the version of the Flash player that is being used?</p>
|
<p>For Firefox 3.x on Window XP, Ubutntu Linux, and Mac OS X (Tiger and Leopard), <a href="http://www.sephiroth.it/firefox/flash_switcher/" rel="nofollow noreferrer">Flash Switcher</a> works well.</p>
|
<p>Found the following: <a href="http://www.google.be/search?q=firefox%20switch%20flash%20version" rel="nofollow noreferrer">http://www.google.be/search?q=firefox%20switch%20flash%20version</a></p>
<p><a href="http://www.sephiroth.it/weblog/archives/2006/10/flash_switcher_for_firefox.php" rel="nofollow noreferrer">http://www.sephiroth.it/weblog/archives/2006/10/flash_switcher_for_firefox.php</a> (seems nice)</p>
<p><a href="http://www.communitymx.com/content/article.cfm?page=2&cid=6FBA7" rel="nofollow noreferrer">http://www.communitymx.com/content/article.cfm?page=2&cid=6FBA7</a> (seems nicely integrated as well)</p>
<p><a href="https://addons.mozilla.org/nl/firefox/addon/5044" rel="nofollow noreferrer">https://addons.mozilla.org/nl/firefox/addon/5044</a> (from mozilla.org, must be good :p)</p>
| 9,884
|
<p>Let's say that you want to create a dead simple BlogEditor and, one of your ideas, is to do what Live Writer does and ask only the URL of the persons Blog. How can you detect what type of blog is it?</p>
<p>Basic detection can be done with the URL itself, such as “<a href="http://myblog.blogger.com" rel="nofollow noreferrer">http://myblog.blogger.com</a>” etc. But what if it's self hosted?</p>
<p>I'm mostly interested on how to do this in Java, but this question could be also used as a reference for any other language.</p>
|
<p>Many (most?) blogs will have a meta tag for "generator" which will list the blog engine. For example a blogger blog will contain the following meta tag: </p>
<pre><code><meta name="generator" content="Blogger" />
</code></pre>
<p>My Subtext blog shows the following generator meta tag: </p>
<pre><code><meta name="Generator" content="Subtext Version 1.9.5.177" />
</code></pre>
<p>This meta tag would be the first place to look. For blogs that don't set this meta tag in the source, you'd have to resort to looking for patterns to determine the blog type. </p>
|
<p>Some blogs provide a Generator meta tag - e.g. Wordpress - you could find out if there's any exceptions to this.</p>
<p>You'll have to be careful how you detect it though, Google surprised me with this line:</p>
<pre><code><meta content='blogger' name='generator'/>
</code></pre>
<p>Single quotes are blasphemy.</p>
| 4,609
|
<p>Encouraged by SO, I'm trying to write an ASP.NET site that uses OpenID for user authentication. It's a regular WinForms site (not MVC.NET), using the <a href="http://code.google.com/p/dotnetopenid/" rel="nofollow noreferrer">DotNetOpenId</a> library for authentication.</p>
<p>Is it safe for me to permit/deny administrative functions on the site by simply comparing the current session's "ClaimedID" (as returned in the OpenIdLogin_LoggedIn event, as member DotNetOpenId.RelyingParty,OpenIdEventArgs.Response.ClaimedIdentifier) to a known administrator's OpenID (i.e. mine)?</p>
<p>If so, is it safe for this ID to be visible (e.g. in open source code), or should it be "hidden" in a configuration file or a database row? (I know it's better design to make it configurable, my question is just about safety.)</p>
|
<p>Jarrett makes some good comments about using database tables.</p>
<p>Just to answer another one of your questions, no, it's not a confidentiality thing to put your OpenID in your code generally. If setting up roles seems overkill for your site, a simple equality check against your ClaimedIdentifier is just perfect. </p>
|
<p>My solution is to follow the same idea of the Roles table. After you've authenticated the user, look up that user's roles. If the user has role "Administrator" in the UserRoles table, then they can do whatever the Administrator can do.</p>
<p>I don't broadcast open ID's in my app. They're stored in the table. On every action result, I'm hitting the Users table, since I have also modified mine to store various user state information. With the exception of the home page, there is going to be some user information that I need from that table. I'm using LINQ, so I include the .LoadWith() to load the User with his list of roles when it serializes.</p>
| 8,109
|
<p>I've had a Windows app in production for a while now, and have it set up to send us error reports when it throws exceptions. Most of these are fairly descriptive and help me find the problem very quickly (I use the MS Application Exception Block). </p>
<p>On a few occasions I have reports that are issues that I can't reproduce, and seem to only happen on a few client machines. </p>
<p>I don't have physical access to these client machines, what are some strategies I can use for debugging? Would it be better to build some tracing into the code, or are there some other alternatives?</p>
<p>Thank you.</p>
<p>Edit: I should have been more clear: The error reports that I get do have the stack trace, but since it's production code, it doesn't indicate the exact line that caused the exception, just the method in which it was thrown.</p>
|
<p>One option is to generate a (mini-)dump file as close to the point where the exception is thrown as possible. This <a href="http://blogs.microsoft.co.il/blogs/sasha/archive/2008/05/28/programmatically-generating-a-dump-file.aspx" rel="nofollow noreferrer">article</a> talks about how to do this from managed code.</p>
<p>You could then load the dump file into Visual Studio or WinDbg and examine it with the aid of <a href="http://dotnetdebug.net/2006/03/20/loading-and-using-sos-from-within-visual-studio/" rel="nofollow noreferrer">SOS</a></p>
|
<p>I'd make use of the event log. Take a look here:</p>
<p><a href="http://support.microsoft.com/kb/307024" rel="nofollow noreferrer">http://support.microsoft.com/kb/307024</a></p>
| 7,613
|
<p>In the process of developing my first WCF service and when I try to use it I get "Method not Allowed" with no other explanation. </p>
<p>I've got my interface set up with the ServiceContract and OperationContract:</p>
<pre><code> [OperationContract]
void FileUpload(UploadedFile file);
</code></pre>
<p>Along with the actual method:</p>
<pre><code> public void FileUpload(UploadedFile file) {};
</code></pre>
<p>To access the Service I enter <a href="http://localhost/project/myService.svc/FileUpload" rel="noreferrer">http://localhost/project/myService.svc/FileUpload</a>
but I get the "Method not Allowed" error</p>
<p>Am I missing something?</p>
|
<p>Your browser is sending an HTTP GET request: Make sure you have the WebGet attribute on the operation in the contract:</p>
<pre><code>[ServiceContract]
public interface IUploadService
{
[WebGet()]
[OperationContract]
string TestGetMethod(); // This method takes no arguments, returns a string. Perfect for testing quickly with a browser.
[OperationContract]
void UploadFile(UploadedFile file); // This probably involves an HTTP POST request. Not so easy for a quick browser test.
}
</code></pre>
|
<p>Only methods with WebGet can be accessed from browser IE ; you can access other http verbs by just typing address</p>
<p>You can either try Restful service startup kit of codeples or use fiddler to test your other http verbs</p>
| 6,241
|
<p>OpenID is a great idea in principle, but the UI and the explanation as to why it is good are currently not tailored for general use -- what do you think it would take to make OpenID work for the general public? Can this be solved with technology, or is the problem so intrinsically hard that we are stuck with difficult explanations/multi-step registration procedures, numerous accounts, or poor security?</p>
|
<p>It needs to be much simpler: involve less knowledge of the concepts, and require fewer steps - preferably zero. When the technology works with little or no assistance, it'll take off.</p>
<p>The mechanics of OpenID credentials, providers and suppliers shouldn't need to be exposed to the user. People talk about educating the masses of internet users, but that's never going to happen - the masses never stop being stupid. If you want to appeal to the masses, you need to bring the technology down to meet their level instead. When a Google-affiliated site picks up that you're logged into Google and silently uses that account, it works without you ever having to tell it who you are. The fact that OpenID is so clumsy in comparison is why the big providers like Google are still avoiding it, and why the general public won't adopt it.</p>
<p>I think the developers of OpenID messed up when they used a URL rather than an email address for the IDs. People know what email addresses are, they already have one that's associated with them (or can get one easily), and email providers like Google and Microsoft are happy to adopt a role as portals. In fact, an automatic translation from email address to URL is all it would take:</p>
<blockquote>
<p>myname@example.com -> <a href="http://www.example.com/openid/myname" rel="nofollow noreferrer">http://www.example.com/openid/myname</a></p>
</blockquote>
|
<p>Make it less open.</p>
<p>i do not want the same identity on multiple sites.
i do not want to have to create a flickr account before StackOverflow will let me post.
i do not have to have to create a new flickr account for each website that i want to register with.</p>
| 7,354
|
<p>I want to make a project involving many small dots indents and I would like to know how I can calculate the smallest dot hole the Prusa i3 MK3S can extrude around on a layer using PLA. In other words, if I printer a mesh with circle shaped holes, how would I know the minimum diameter of the holes. Is it simply the same as the layer resolution (0.35 mm), filament size (1.75 mm), or is it something else?</p>
|
<p>There is no direct limit on the size of a hole in XY-plane (that means: oriented so that the hole is visible from above).</p>
<p>The movement accuracy of MK3S (and most other modern 3D printers) is about 0.01 mm. So theoretically you could move around a circle that has diameter of the (default) 0.4 mm extrusion width + 0.01 mm, and get a 0.01 mm hole in the middle of the circle.</p>
<p>In practice, the hole size will be limited by the repeatability of the extrusion width. If in the above example the extrusion width happens to be 0.41 mm instead, there would be no hole remaining.</p>
<p>On a well calibrated printer, 1/4th of the nozzle size should be manageable, i.e. for MK3S you should be able to get 0.1 mm holes quite reliably.</p>
|
<p>That depends on the ability how fast you get filament to stick to the build plate and whether the filament is loaded in the extruder. It also matters which size of nozzle you are using. The filament diameter has no influence other than smaller filament width (e.g. 1.75 mm) requires more length to extrude with respect to thicker filament (e.g 2.85 or 3.0 mm), and is therefore more precise to lay down (on the other side is the deviation on the filament diameter, i.e. manufacturing tolerance, larger than for thicker filament...).</p>
<p>If it does not stick you need more length, also, if the filament is not preloaded enough, the nozzle chamber needs to be filled first. Note that the printing of several small circles is a challenge, see e.g. <a href="/q/8709">"How do I get circles on small interior holes to adhere to the bed?"</a>.</p>
| 1,527
|
<p>We currently have quite a few tags about filament:</p>
<ul>
<li><a href="https://3dprinting.stackexchange.com/questions/tagged/filament" class="post-tag" title="show questions tagged 'filament'" rel="tag">filament</a></li>
<li><a href="https://3dprinting.stackexchange.com/questions/tagged/plastic-filament" class="post-tag" title="show questions tagged 'plastic-filament'" rel="tag">plastic-filament</a></li>
<li><a href="https://3dprinting.stackexchange.com/questions/tagged/thermoplastic-filament" class="post-tag" title="show questions tagged 'thermoplastic-filament'" rel="tag">thermoplastic-filament</a></li>
<li>etc.</li>
</ul>
<p>I feel like we need to clean these up and make clear what we'll use each tag for.</p>
<p>Thoughts?</p>
|
<p>All filament used in 3D printing is thermoplastic filament, so plastic-filament and thermoplastic-filament are redundant.</p>
|
<p>I see a form of hierarchy that could be used.</p>
<p>Depending on the question a higher level tag could be used or a more specific one for specific problems (or both tags even).</p>
<ul>
<li>Filament
<ul>
<li>Plastic Filament
<ul>
<li>ABS</li>
<li>PLA</li>
</ul></li>
<li>Water Soluble
<ul>
<li>PVA</li>
</ul></li>
<li>Flexible
<ul>
<li>NinjaFlex and similar</li>
<li>TPU</li>
</ul></li>
<li>Conductive</li>
<li>Metalic</li>
</ul></li>
<li>Resin</li>
<li>Powder</li>
<li>Full Color</li>
</ul>
<p>Feel free to edit to add more types</p>
| 13
|
<p>I'm looking for advice on how to dynamically create content in flash based on a database. Initially I was thinking that we would export the database to an XML file and use the built in Actionscript XML parser to take care of that, however the size of the XML file may prove prohibitive. </p>
<p>I have read about using an intermediary step (PHP, ASP) to retrieve information and pass it back as something that Actionscript can read, but I would prefer not to do that if possible. Has anyone worked with the <a href="http://code.google.com/p/assql/" rel="nofollow noreferrer">asSQL</a> libraries before? Or is there something else that I am missing?</p>
|
<p>If you plan to deploy your flash content to a website, you should use some sort of backend - otherwise you would have a potential security problem. I use remoting with <a href="http://www.amfphp.org/" rel="noreferrer">AMFPHP</a>, it has worked out really well.</p>
|
<p>The general practice that I've experienced is that if it's something like a config file or just a really small amount of data then you could probably get away with just having an XML file on the server with your SWF files.</p>
<p>If you want the data to be more dynamic or you anticipate changing it quite often I would definitely do as Nouveau has already said and use PHP or a similiar technology to output database queries into an XML structure for your flash to load.</p>
<p>If there is a lot of data however and you are really noticing your program choking or lagging on loading up the XML in that format I would definitely recommend remoting like Kristian has suggested, AMFPHP seems to be one of the more popular choices.</p>
<p>Check out grapefrukt's answer to another question about flash and database interaction<br>
<a href="https://stackoverflow.com/questions/38674/does-adobe-flash-support-databases#39266">Does Adobe Flash support databases?</a></p>
| 8,838
|
<p>How can I make a major upgrade to an installation set (MSI) built with <a href="http://en.wikipedia.org/wiki/WiX" rel="noreferrer">WiX</a> install into the same folder as the original installation?</p>
<p>The installation is correctly detected as an upgrade, but the directory selection screen is still shown and with the default value (not necessarily the current installation folder).</p>
<p>Do I have to do manual work like saving the installation folder in a registry key upon first installing and then read this key upon upgrade? If so, is there any example?</p>
<p>Or is there some easier way to achieve this in <a href="http://en.wikipedia.org/wiki/Windows_Installer" rel="noreferrer">MSI</a> or WiX?</p>
<p>As reference, I my current WiX file is below:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2003/01/wi">
<Product Id="a2298d1d-ba60-4c4d-92e3-a77413f54a53"
Name="MyCompany Integration Framework 1.0.0"
Language="1033"
Version="1.0.0"
Manufacturer="MyCompany"
UpgradeCode="9071eacc-9b5a-48e3-bb90-8064d2b2c45d">
<!-- Package information -->
<Package Keywords="Installer"
Id="e85e6190-1cd4-49f5-8924-9da5fcb8aee8"
Description="Installs MyCompany Integration Framework 1.0.0"
Comments="Installs MyCompany Integration Framework 1.0.0"
InstallerVersion="100"
Compressed="yes" />
<Upgrade Id='9071eacc-9b5a-48e3-bb90-8064d2b2c45d'>
<UpgradeVersion Property="PATCHFOUND"
OnlyDetect="no"
Minimum="0.0.1"
IncludeMinimum="yes"
Maximum="1.0.0"
IncludeMaximum="yes"/>
</Upgrade>
<!-- Useless but necessary... -->
<Media Id="1" Cabinet="MyCompany.cab" EmbedCab="yes" />
<!-- Precondition: .NET 2 must be installed -->
<Condition Message='This setup requires the .NET Framework 2 or higher.'>
<![CDATA[MsiNetAssemblySupport >= "2.0.50727"]]>
</Condition>
<Directory Id="TARGETDIR"
Name="SourceDir">
<Directory Id="MyCompany"
Name="MyCompany">
<Directory Id="INSTALLDIR"
Name="Integrat"
LongName="MyCompany Integration Framework">
<Component Id="MyCompanyDllComponent"
Guid="4f362043-03a0-472d-a84f-896522ce7d2b"
DiskId="1">
<File Id="MyCompanyIntegrationDll"
Name="IbIntegr.dll"
src="..\Build\MyCompany.Integration.dll"
Vital="yes"
LongName="MyCompany.Integration.dll" />
<File Id="MyCompanyServiceModelDll"
Name="IbSerMod.dll"
src="..\Build\MyCompany.ServiceModel.dll"
Vital="yes"
LongName="MyCompany.ServiceModel.dll" />
</Component>
<!-- More components -->
</Directory>
</Directory>
</Directory>
<Feature Id="MyCompanyProductFeature"
Title='MyCompany Integration Framework'
Description='The complete package'
Display='expand'
Level="1"
InstallDefault='local'
ConfigurableDirectory="INSTALLDIR">
<ComponentRef Id="MyCompanyDllComponent" />
</Feature>
<!-- Task scheduler application. It has to be used as a property -->
<Property Id="finaltaskexe"
Value="MyCompany.Integration.Host.exe" />
<Property Id="WIXUI_INSTALLDIR"
Value="INSTALLDIR" />
<InstallExecuteSequence>
<!-- command must be executed: MyCompany.Integration.Host.exe /INITIALCONFIG parameters.xml -->
<Custom Action='PropertyAssign'
After='InstallFinalize'>NOT Installed AND NOT PATCHFOUND</Custom>
<Custom Action='LaunchFile'
After='InstallFinalize'>NOT Installed AND NOT PATCHFOUND</Custom>
<RemoveExistingProducts Before='CostInitialize' />
</InstallExecuteSequence>
<!-- execute comand -->
<CustomAction Id='PropertyAssign'
Property='PathProperty'
Value='[INSTALLDIR][finaltaskexe]' />
<CustomAction Id='LaunchFile'
Property='PathProperty'
ExeCommand='/INITIALCONFIG "[INSTALLDIR]parameters.xml"'
Return='asyncNoWait' />
<!-- User interface information -->
<UIRef Id="WixUI_InstallDir" />
<UIRef Id="WixUI_ErrorProgressText" />
</Product>
</Wix>
</code></pre>
|
<p>There's an example in the WiX tutorial: <a href="https://www.firegiant.com/wix/tutorial/getting-started/where-to-install/" rel="nofollow noreferrer">https://www.firegiant.com/wix/tutorial/getting-started/where-to-install/</a></p>
<pre><code><Property Id="INSTALLDIR">
<RegistrySearch Id='AcmeFoobarRegistry' Type='raw'
Root='HKLM' Key='Software\Acme\Foobar 1.0' Name='InstallDir' />
</Property>
</code></pre>
<p>Of course, you've got to set the registry key as part of the install too. Stick this inside a component that's part of the original install:</p>
<pre><code><RegistryKey
Key="Software\Software\Acme\Foobar 1.0"
Root="HKLM">
<RegistryValue Id="FoobarRegInstallDir"
Type="string"
Name="InstallDir"
Value="[INSTALLDIR]" />
</RegistryKey>
</code></pre>
|
<p>You don't really need to separate RegistryKey from RegistryValue in a simple case like this. Also, using HKMU instead of HKLM takes care of it whether you're doing a machine or user install.</p>
<pre><code><RegistryValue
Root="HKMU"
Key="Software\[Manufacturer]\[ProductName]"
Name="InstallDir"
Type="string"
Value="[INSTALLDIR]"
KeyPath="yes" />
</code></pre>
| 7,983
|
<p>I'm designing an application which includes the need to log all incoming messages I receive from a Telnet connection. The text is largely plain though can include ANSI tags that provide text colour and formatting (16 colours, bold, underline, etc).</p>
<p>I'm would like to format my logs to store the text with formatting, date/time and potentially other meta data later. My first thoughts was all XML but this could impact my ability to write a fast search tool later. My current idea is Date/Time + text in one file with meta-data stored in another XML file, referenced by line number.</p>
<p>Is this a good solution? Also, where and how should I store the formatting commands? The original ANSI tags would disrupt the plain but having them in two different files might be awkward.</p>
<p>Additional: Thanks to some answers so far, though I should mention that most of the time the messages will be person to person communications rather than system messages. A more primitive IRC of sorts. Its up to my user to decide later (by adding meta data) which messages were important. This is the raw on the record log that filtered or edited logs might derive from.</p>
|
<p>My first suggestion would be to use a drop-in logging tool like log4net, which will make formatting much more automatic.</p>
<p>If you are going to go the route of two files (and I agree with Craig that a database is probably a better choice,) you can probably save yourself a lot of heartache by having one file that is as sparse as you can make it for later fast searches and one that holds all the information in one place (metadata and data) rather than creating a metadata-only format.</p>
|
<p>If you are catpuring logging information for future searching and anaylsis perhaps a database would be a better answer. </p>
<p>As for your solution. Flat files do not scale well at all where as a database scale much better. I wouldn't split the files either, that just compounds the scalability issue. If you have to use a flat file I would probably try keeping the meta data in a csv (less over head) and the data in a series of files indexed by the csv file. That way all the data doesn't impact your index file. Just my thoughts.</p>
| 7,347
|
<p>How would you go about finding out how much memory is being used by an object? I know it is possible to find out how much is used by a block of code, but not by an instantiated object (anytime during its life), which is what I want. </p>
|
<p><strong>There's no easy way to find out the memory size of a python object</strong>. One of the problems you may find is that Python objects - like lists and dicts - may have references to other python objects (in this case, what would your size be? The size containing the size of each object or not?). There are some pointers overhead and internal structures related to object types and garbage collection. Finally, some python objects have non-obvious behaviors. For instance, lists reserve space for more objects than they have, most of the time; dicts are even more complicated since they can operate in different ways (they have a different implementation for small number of keys and sometimes they over allocate entries).</p>
<p>There is a <a href="http://code.activestate.com/recipes/544288/" rel="noreferrer">big chunk of code</a> (and an <a href="http://code.activestate.com/recipes/546530/" rel="noreferrer">updated big chunk of code</a>) out there to try to best approximate the size of a python object in memory. </p>
<p>You may also want to check some <a href="http://mail.python.org/pipermail/python-list/2002-March/135223.html" rel="noreferrer">old description about PyObject</a> (the internal C struct that represents virtually all python objects).</p>
|
<p>For big objects you may use a somewhat crude but effective method:
check how much memory your Python process occupies in the system, then delete the object and compare.</p>
<p>This method has many drawbacks but it will give you a very fast estimate for very big objects.</p>
| 5,415
|
<p>Assume somebody has a Monoprice Maker Select and has changed from the original brass extruder gear to a <a href="https://www.wanhaouk.com/products/extruder-drive-gear" rel="nofollow noreferrer">D4 Plus</a> one, which is slightly smaller (10.6 vs 10.9 mm outer diameter).</p>
<p>This person might be wondering if he/she needs to compensate for this difference, and which setting that would be in Cura IIIP.</p>
<p>(Have never calibrated the extruder and am still not sure it is absolutely necessary, since the difference in the gear size is only 3%.)</p>
|
<p>If you change the extruder wheel for a different sized wheel, you need to calibrate the extruder to make sure that if you ask to extrude 100 mm it actually extrudes 100 mm. <a href="https://3dprinting.stackexchange.com/a/6484/5740">This answer</a> on the question "<a href="https://3dprinting.stackexchange.com/q/6483/5740">How do I calibrate the extruder of my printer?</a>" describes how to do that.</p>
<p>It is not required to flash your firmware. The G-code command <a href="https://reprap.org/wiki/G-code#M92:_Set_axis_steps_per_unit" rel="nofollow noreferrer"><code>M92</code></a> can be used to set the new amount of steps for the extruder. The Monoprice Maker Select has a Melzi control board that is running Repetier firmware. This G-code command is supported by Repetier firmware.</p>
<p>You need to be able to connect a so-called terminal to your printer. Applications as Repetier-Host, Pronterface, OctoPrint, and probably many more have so-called terminals where you can interface with the printer by sending command to it when the printer is connected through USB (please mind the communication speed of the board, called Baud rate, these are not the same for all boards).</p>
<p>Sending <code>M503</code> will report the current settings for <code>M92</code>, e.g.:</p>
<pre><code>M92 X100.00 Y100.00 Z400.00 E100.00
</code></pre>
<p>Extrude 100 mm without the hotend attached so you can measure the amount that is extruded. If that is 80 mm you need more steps <span class="math-container">$ \frac{100\ mm}{80\ mm} \times 100\ steps/mm = 125\ steps/mm $</span></p>
<p>You now need to send <code>M92 E125</code> and the new steps are set. Use <code>M500</code> to store the setting.</p>
<p>You could also change the flow extrusion parameter in your slicer, but it generally not good practice, it is better to fix the printer rather than adjusting in the slicer. However, if you do want to fix it in the slicer, as mentioned in the comments, you can also add steps setting in the start G-code script: <em>"To get around flashing the new values to the ROM, you can add this to the machine settings in Cura under "Start Gcode" this way it will append your values at the start of every print."</em>. Note that other slicers have similar functionality.</p>
|
<p>This will affect your extrusion rate. The best place to change this would be in your E steps located in the firmware but you can also compensate for this by changing the flow percentage in Cura, a setting of 103% (10.9/10.6) should get you close.</p>
| 1,061
|
<p>In Django's template language, you can use <code>{% url [viewname] [args] %}</code> to generate a URL to a specific view with parameters. How can you programatically do the same in Python code?</p>
<p>What I need is to create a list of menu items where each item has name, URL, and an active flag (whether it's the current page or not). This is because it will be a lot cleaner to do this in Python than the template language.</p>
|
<p>If you need to use something similar to the <code>{% url %}</code> template tag in your code, Django provides the <code>django.core.urlresolvers.reverse()</code>. The <code>reverse</code> function has the following signature:</p>
<pre><code>reverse(viewname, urlconf=None, args=None, kwargs=None)
</code></pre>
<p><a href="https://docs.djangoproject.com/en/dev/ref/urlresolvers/" rel="noreferrer">https://docs.djangoproject.com/en/dev/ref/urlresolvers/</a></p>
<p>At the time of this edit the import is <code>django.urls import reverse</code></p>
|
<p>Be aware that using <code>reverse()</code> requires that your urlconf module is 100% error free and can be processed - iow no <code>ViewDoesNotExist</code> errors or so, or you get the dreaded <code>NoReverseMatch</code> exception (errors in templates usually fail silently resulting in <code>None</code>).</p>
| 6,489
|
<p>In Java (or any other language with checked exceptions), when creating your own exception class, how do you decide whether it should be checked or unchecked?</p>
<p>My instinct is to say that a checked exception would be called for in cases where the caller might be able to recover in some productive way, where as an unchecked exception would be more for unrecoverable cases, but I'd be interested in other's thoughts.</p>
|
<p>Checked Exceptions are great, so long as you understand when they should be used. The Java core API fails to follow these rules for SQLException (and sometimes for IOException) which is why they are so terrible.</p>
<p><strong>Checked Exceptions</strong> should be used for <strong>predictable</strong>, but <strong>unpreventable</strong> errors that are <strong>reasonable to recover from</strong>.</p>
<p><strong>Unchecked Exceptions</strong> should be used for everything else.</p>
<p>I'll break this down for you, because most people misunderstand what this means.</p>
<ol>
<li><strong>Predictable but unpreventable</strong>: The caller did everything within their power to validate the input parameters, but some condition outside their control has caused the operation to fail. For example, you try reading a file but someone deletes it between the time you check if it exists and the time the read operation begins. By declaring a checked exception, you are telling the caller to anticipate this failure.</li>
<li><strong>Reasonable to recover from</strong>: There is no point telling callers to anticipate exceptions that they cannot recover from. If a user attempts to read from an non-existing file, the caller can prompt them for a new filename. On the other hand, if the method fails due to a programming bug (invalid method arguments or buggy method implementation) there is nothing the application can do to fix the problem in mid-execution. The best it can do is log the problem and wait for the developer to fix it at a later time.</li>
</ol>
<p>Unless the exception you are throwing meets <strong>all</strong> of the above conditions it should use an Unchecked Exception.</p>
<p><strong>Reevaluate at every level</strong>: Sometimes the method catching the checked exception isn't the right place to handle the error. In that case, consider what is reasonable for your own callers. If the exception is predictable, unpreventable and reasonable for them to recover from then you should throw a checked exception yourself. If not, you should wrap the exception in an unchecked exception. If you follow this rule you will find yourself converting checked exceptions to unchecked exceptions and vice versa depending on what layer you are in.</p>
<p>For both checked and unchecked exceptions, <strong>use the right abstraction level</strong>. For example, a code repository with two different implementations (database and filesystem) should avoid exposing implementation-specific details by throwing <code>SQLException</code> or <code>IOException</code>. Instead, it should wrap the exception in an abstraction that spans all implementations (e.g. <code>RepositoryException</code>).</p>
|
<p>The rule I use is: never use unchecked exceptions! (or when you don't see any way around it)</p>
<p>From the point of view of the developer using your library or the end-user using your library/application it really sucks to be confronted with an application that crashes due to an uncought exception. And counting on a catch-all is no good either.</p>
<p>This way the end user can still be presented with an error message, instead of the application completely disappearing.</p>
| 4,720
|
<p>I have a project that utilizes the javax.mail.internet.MimeMessage and other related classes that does mime parsing for emails that we receive. This needs to be ported to .NET.</p>
<p>What .Net 3rd party or built in library can I use to replace the Java classes that I'm using?</p>
<p>EDIT: Anything change in the last 9 months since I asked this question?</p>
|
<p>I've recently released <a href="https://github.com/jstedfast/MimeKit">MimeKit</a> which is far more robust than any of the other open source .NET MIME parser libraries out there and it's orders of magnitude faster as well due to the fact that it is an actual stream parser and not a recursive descent string parser (which also has the added benefit of it using a LOT less memory).</p>
<p>It has full support for S/MIME v3.2 (including compression, which none of the other libraries that claim "full" support actually support) and OpenPGP.</p>
<p>For SMTP, POP3, and IMAP you can use my <a href="https://github.com/jstedfast/MailKit">MailKit</a> library which supports a bunch of SASL authentication mechanisms including XOAUTH2 (used by Google). The SMTP client supports PIPELINING which can improve performance of sending mail and the IMAP client supports a growing number of extensions that allow clients to optimize their bandwidth as well.</p>
|
<p>Try using <a href="http://www.limilabs.com/mail/" rel="nofollow noreferrer">Mail.dll IMAP component</a>, it's on the market for quite a while, and is well tested.</p>
<pre><code>using(Imap imap = new Imap())
{
imap.Connect("imapServer");
imap.UseBestLogin("user", "password");
imap.SelectInbox();
List<long> uids = imap.SearchFlag(Flag.Unseen);
foreach (long uid in uids)
{
byte[] eml = imap.GetMessageByUID(uid);
IMail message = new MailBuilder()
.CreateFromEml(eml);
Console.WriteLine(message.Subject);
}
imap.Close();
}
</code></pre>
<p>Please note that Mail.dll is a commercial product that I've created.</p>
<p>You can download it here: <a href="http://www.limilabs.com/mail/" rel="nofollow noreferrer">http://www.limilabs.com/mail</a>.</p>
| 3,958
|
<p>Is there a way to embed a browser in Java? more specifically, is there a library that can emulate a browser?</p>
|
<p>Since JavaFX 2.0 you can use now <a href="http://docs.oracle.com/javafx/2.0/webview/jfxpub-webview.htm" rel="noreferrer">webview</a></p>
<p><img src="https://i.stack.imgur.com/WUfqs.png" alt="enter image description here"></p>
|
<p>If you look at The Minecraft launcher (the old one), look through LoginForm or LauncherFrame, you may be able to find out that method. There is a tutorial by kippykip on youtube on how to decompile and edit it: <a href="http://www.youtube.com/watch?v=n_bh-c2nO7k" rel="nofollow">here</a></p>
| 7,063
|
<p>Is there a way to combine Enums in VB.net?</p>
|
<p>I believe what you want is a flag type enum.</p>
<p>You need to add the Flags attribute to the top of the enum, and then you can combine enums with the 'Or' keyword.</p>
<p>Like this:</p>
<pre><code><Flags()> _
Enum CombinationEnums As Integer
HasButton = 1
TitleBar = 2
[ReadOnly] = 4
ETC = 8
End Enum
</code></pre>
<p><strong>Note:</strong> The numbers to the right are always twice as big (powers of 2) - this is needed to be able to separate the individual flags that have been set.</p>
<p>Combine the desired flags using the Or keyword:</p>
<pre><code>Dim settings As CombinationEnums
settings = CombinationEnums.TitleBar Or CombinationEnums.Readonly
</code></pre>
<p>This sets TitleBar and Readonly into the enum</p>
<p>To check what's been set:</p>
<pre><code>If (settings And CombinationEnums.TitleBar) = CombinationEnums.TitleBar Then
Window.TitleBar = True
End If
</code></pre>
|
<p>If you taking about using enum flags() there is a good article <a href="http://www.codeguru.com/vb/sample_chapter/article.php/c12963" rel="nofollow noreferrer" title="VB flags">here</a>.</p>
| 8,287
|
<p>I have been having some issues with my Cocoon Create Model Maker/Wanhao Duplicator i3 Mini. The hotend doesn't get up to temperature. </p>
<p>I will go to any of the heating functions (start print, preheat, add filament, etc.) and it will begin to reheat the nozzle. The temperature rises until eventually, it stops at any number that is not the desired print temp and the screen freezes. Sometimes it will stop at 150 °C sometimes 180 °C. It all seems quite random but the screen is frozen when this happens. </p>
<p>If anyone had any thoughts it would be much appreciated. My last printer was abandoned due to a similar issue and it's incredibly frustrating.</p>
|
<p>The solution was posted in a comment, as the asker hasn't posted an answer yet, it is answered in this community wiki answer:</p>
<blockquote>
<p>Ended up replacing the thermistor which solved the problem.</p>
</blockquote>
|
<p>Maybe, the thermistor is not fully seated and does not measure temperature effectively. </p>
<p>Try inserting the thermistor into the hole by filling the gaps with metal wire or conductive paste.</p>
| 1,436
|
<p>I can print a reasonably high quality print, but then there will be a millimetre or two of rubbish.</p>
<p><a href="https://i.stack.imgur.com/9ppdc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9ppdc.jpg" alt="Bad layer"></a>
<a href="https://i.stack.imgur.com/9kreD.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9kreD.jpg" alt="Bad layer"></a></p>
<p>This can happen at the start of a print, in the middle or at the end.</p>
<p>It doesn't seem to be bad G-code as I can reprint with good results.</p>
<p>There seems to be a correlation between the bad layers and walls. They seem to occurs when there is a transition to printing a horizontal wall.</p>
<p>The latter if there two images if the tail end of a thirteen hour print.</p>
<ol>
<li>What's causing this?</li>
<li>Is it something I can fix or is it that the (new) printer is failing?</li>
</ol>
|
<p>This can be caused by various problems, of which an <a href="/a/7901/5740">aforementioned</a> filament diameter is only one of multiple possible causes.</p>
<p>The observed phenomenon is called <strong><em>under-extrusion</em></strong>. Temporary under-extrusion can also be caused by filament friction on the spool, too low or too high filament extruder gear friction (pressure on the filament by the roller), or friction in a Bowden tube (dust particles). </p>
<p>Please ensure your spool unrolls freely (not entangled; entangled filament is audible like "ker-chunk" when the filament is rearranged on the spool by force of the extruder pulling) and check the extruder for friction or slip. If the extruder gear slips, this is also accompanied by an audible "click" that is called clicking. This generally implies that there is too much friction in the hot end, or an obstruction/clog.</p>
<p>Considering that your print recovers from the problem, and that it occurs randomly, the best guess is that your filament in entangled now and then.</p>
|
<p>One of the reasons for such a defect may be a local decrease in the diameter of the filament. Carefully check your filament.</p>
| 1,168
|
<p>MySQL has this incredibly useful yet proprietary <code>REPLACE INTO</code> SQL Command. </p>
<p>Can this easily be emulated in SQL Server 2005?</p>
<p>Starting a new Transaction, doing a <code>Select()</code> and then either <code>UPDATE</code> or <code>INSERT</code> and <code>COMMIT</code> is always a little bit of a pain, especially when doing it in the application and therefore always keeping 2 versions of the statement.</p>
<p>I wonder if there is an easy and <strong>universal</strong> way to implement such a function into SQL Server 2005?</p>
|
<p>This is something that annoys me about MSSQL (<a href="http://bizvprog.blogspot.com/2008/04/annoying-fundamental-flaw-with-sql.html" rel="noreferrer">rant on my blog</a>). I wish MSSQL supported <code>upsert</code>. </p>
<p>@Dillie-O's code is a good way in older SQL versions (+1 vote), but it still is basically two IO operations (the <code>exists</code> and then the <code>update</code> or <code>insert</code>)</p>
<p>There's a slightly better way on <a href="https://stackoverflow.com/questions/13540/insert-update-stored-proc-on-sql-server">this post</a>, basically:</p>
<pre><code>--try an update
update tablename
set field1 = 'new value',
field2 = 'different value',
...
where idfield = 7
--insert if failed
if @@rowcount = 0 and @@error = 0
insert into tablename
( idfield, field1, field2, ... )
values ( 7, 'value one', 'another value', ... )
</code></pre>
<p>This reduces it to one IO operations if it's an update, or two if an insert. </p>
<p>MS Sql2008 introduces <code>merge</code> from the SQL:2003 standard:</p>
<pre><code>merge tablename as target
using (values ('new value', 'different value'))
as source (field1, field2)
on target.idfield = 7
when matched then
update
set field1 = source.field1,
field2 = source.field2,
...
when not matched then
insert ( idfield, field1, field2, ... )
values ( 7, source.field1, source.field2, ... )
</code></pre>
<p>Now it's really just one IO operation, but awful code :-(</p>
|
<p>I wrote a <a href="http://www.samsaffron.com/blog/archive/2007/04/04/14.aspx" rel="nofollow noreferrer">blog post</a> about this issue.</p>
<p>The bottom line is that if you want cheap updates and want to be safe for concurrent usage, try:</p>
<pre><code>update t
set hitCount = hitCount + 1
where pk = @id
if @@rowcount < 1
begin
begin tran
update t with (serializable)
set hitCount = hitCount + 1
where pk = @id
if @@rowcount = 0
begin
insert t (pk, hitCount)
values (@id,1)
end
commit tran
end
</code></pre>
<p>This way you have 1 operation for updates and a max of 3 operations for inserts. So, if you are generally updating, this is a safe cheap option.</p>
<p>I would also be very careful not to use anything that is unsafe for concurrent usage. It's really easy to get primary key violations or duplicate rows in production.</p>
| 2,273
|
<p>In effect, if I have a <code>class c</code> and instances of <code>$c1</code> and <code>$c2</code>
which might have different private variable amounts but all their public methods return the same values I would like to be able to check that <code>$c1 == $c2?</code></p>
<p>Does anyone know an easy way to do this?</p>
|
<p>You can also implement a equal($other) function like</p>
<pre>
<?php
class Foo {
public function equals($o) {
return ($o instanceof 'Foo') && $o.firstName()==$this.firstName();
}
}
</pre>
<p>or use foreach to iterate over the public properties (this behaviour might be overwritten) of one object and compare them to the other object's properties.</p>
<pre>
<?php
function equalsInSomeWay($a, $b) {
if ( !($b instanceof $a) ) {
return false;
}
foreach($a as $name=>$value) {
if ( !isset($b->$name) || $b->$name!=$value ) {
return false;
}
}
return true;
}
</pre>
<p>(untested)</p>
<p>or (more or less) the same using the Reflection classes, see <a href="http://php.net/manual/en/language.oop5.reflection.php#language.oop5.reflection.reflectionobject" rel="nofollow noreferrer">http://php.net/manual/en/language.oop5.reflection.php#language.oop5.reflection.reflectionobject</a><br />
With reflection you might also implement a more duck-typing kind of comparision, if you want to, like "I don't care if it's an instance of or the same class as long as it has the same public methods and they return the 'same' values"<br />
it really depends on how you define "equal".</p>
|
<p>You can try writing a class of your own to plugin and write methods that do comparison based on what you define. For example:</p>
<pre><code>class Validate {
public function validateName($c1, $c2) {
if($c1->FirstName == "foo" && $c2->LastName == "foo") {
return true;
} else if (// someother condition) {
return // someval;
} else {
return false;
}
}
public function validatePhoneNumber($c1, $c2) {
// some code
}
}
</code></pre>
<p>This will probably be the only way where you wont have to modify the pre-existing class code</p>
| 7,954
|
<p>What are the best practices around creating flat file database structures in PHP?</p>
<p>A lot of more matured PHP flat file frameworks out there which I attempt to implement SQL-like query syntax which is over the top for my purposes in most cases. (I would just use a database at that point).</p>
<p>Are there any elegant tricks out there to get good performance and features with a small code overhead?</p>
|
<p>Well, what is the nature of the flat databases. Are they large or small. Is it simple arrays with arrays in them? if its something simple say userprofiles built as such:</p>
<pre><code>$user = array("name" => "bob",
"age" => 20,
"websites" => array("example.com","bob.example.com","bob2.example.com"),
"and_one" => "more");
</code></pre>
<p>and to save or update the <em>db record</em> for that user.</p>
<pre><code>$dir = "../userdata/"; //make sure to put it bellow what the server can reach.
file_put_contents($dir.$user['name'],serialize($user));
</code></pre>
<p>and to load the <em>record</em> for the user</p>
<pre><code>function &get_user($name){
return unserialize(file_get_contents("../userdata/".$name));
}
</code></pre>
<p>but again this implementation will vary on the application and nature of the database you need.</p>
|
<p>If you're going to use a flat file to persist data, use XML to structure the data. PHP has a <a href="http://uk.php.net/xml" rel="noreferrer">built-in XML parser</a>.</p>
| 2,251
|
<p>I need to convert a named instance of SQL server 2005, to a default instance.</p>
<p>Is there a way to do this without a reinstall?</p>
<hr>
<p>The problem is, 2 out of 6 of the developers, installed with a named instance. So its becoming a pain changing connection strings for the other 4 of us. I am looking for the path of least resistance to getting these 2 back on to our teams standard setup. </p>
<p>Each has expressed that this is going to be, too much trouble and that it will take away from their development time. I assumed that it would take some time to resolve, in the best interest of all involved, I tried combing through configuration apps installed and didn't see anything, so I figured someone with more knowledge of the inner workings would be here.</p>
|
<p>I also wanted to convert a named instance to default - my reason was to access it with just the machine name from various applications.</p>
<p>If you want to <em>access a named instance</em> from any connection string <em>without using the instance name</em>, and using only the server name and/or IP address, then you can do the following:</p>
<ul>
<li>Open <code>SQL Server Configuration Manager</code></li>
<li>Click <code>SQL Server Network Configuration</code></li>
<li>Click <code>Protocols for INSTANCENAME</code> you want to make available (i.e. SQLExpress)</li>
<li>Right-click <code>TCP/IP</code> and click <code>Enabled</code></li>
<li>Right-click <code>TCP/IP</code> and go to <code>Properties</code>
<ul>
<li>Go to the <code>IP Addresses</code> tab</li>
<li>Scroll down to the <code>IPAll</code> section</li>
<li>Clear the field <code>TCP Dynamic Ports</code> (i.e. <em>empty/blank</em>)</li>
<li>Set <code>TCP Port</code> to <code>1433</code></li>
<li>Click <code>Ok</code></li>
</ul></li>
<li>Go to <code>SQL Server Services</code></li>
<li>Right-click your <code>SQL Server (INSTANCENAME)</code> and click <code>Restart</code></li>
</ul>
<p><img src="https://i.stack.imgur.com/BZ5t4.jpg" alt="SQL Server Configuration Manager"></p>
<p>This will make the named instance listen on the default port. Note : You can have only one instance configured like this - no two instances can have same port on the IP All section unless the instance is a failover cluster.</p>
|
<p>You shouldn't ever really need to do this. Most software that <strong>claims</strong> to require the default instance (like Great Plains or Dynamics) doesn't actually.</p>
<p>If you repost with your situation (installed X, then Y, but need to accomplish Z) I bet you'll get some good workarounds.</p>
| 5,546
|
<p>How would you attach a propertychanged callback to a property that is inherited? Like such:</p>
<pre><code>class A {
DependencyProperty prop;
}
class B : A {
//...
prop.AddListener(PropertyChangeCallback);
}
</code></pre>
|
<p>(edited to remove recommendation to use DependencyPropertyDescriptor, which is not available in Silverlight)</p>
<p><a href="http://agsmith.wordpress.com/2008/04/07/propertydescriptor-addvaluechanged-alternative/" rel="nofollow noreferrer">PropertyDescriptor AddValueChanged Alternative</a></p>
|
<p>Have you tried a two way data binding between the two dependency properties?</p>
| 3,344
|
<p>We manufacture artificial corals for aquarium decorations.</p>
<p>We are trying to use 3D scanning and printing to duplicate live corals. Please see attached photos, left is 3D printed model, right is coral molded using resin.</p>
<p>The problem is lacking detail, the real corals have pores (tiny holes).</p>
<p>Can anybody please help to add pores to the 3D printed corals? Maybe using Blender 3D software?</p>
<p><a href="https://i.stack.imgur.com/6o2mq.jpg" rel="nofollow noreferrer" title="3D printed coral is lacking pores (tiny holes)"><img src="https://i.stack.imgur.com/6o2mq.jpg" alt="3D printed coral (left) vs resin molded coral (right)" title="3D printed coral is lacking pores (tiny holes)"></a></p>
<p><a href="https://i.stack.imgur.com/RxHVE.jpg" rel="nofollow noreferrer" title="3D printed coral (left) vs resin molded coral (right)"><img src="https://i.stack.imgur.com/RxHVE.jpg" alt="3D printed coral is lacking pores (tiny holes)" title="3D printed coral (left) vs resin molded coral (right)"></a></p>
|
<p>First thing to check it's, What printer are you using? is FDM or SLA/SLS? Technology used is the great bottleneck to achieve the results that you want to. </p>
<p>Also, going cheap in 3D printing it's a way to get bad results. A good setup it's really important to get a great XY and Z resolution. </p>
<p>FDM it's not able to achieve the same resolution as SLS/SLA has, but it's cheaper.</p>
<p>If you using FDM try reducing wall speed, that will increase the detail level. Using a smaller nozzle and lower layer settings will increase it as well.</p>
<p>EDIT: Also, you need to check in the 3D model how the model is. If the details that you're looking for are not there, there is nothing else to do but start doing it by hand.</p>
|
<p>Perhaps with the scanned data you could import it into some sort of 3D modeling application such as Blender and add the pores either manually or with a modifier. See <a href="https://docs.blender.org/manual/ko/dev/modeling/modifiers/index.html" rel="nofollow noreferrer">Blender - modifiers</a>.</p>
| 681
|
<p>Is there anything to the process of 3D printing that might make the dice unfair/land on a specific side more frequently? Or will any imperfections be negligible, thus making the dice fair? I'm more concerned about making a d20 than anything else, so focus on that shape if need be.</p>
<hr>
<p>I am using a MakerBot Replicator+ with FDM, so take this into consideration if it affects your answer, and if you believe a different printing process would have an advantage over this don't hesitate to include it.</p>
|
<h2>It probably won't be fair.</h2>
<p>Incidentally, I have a decent amount of experience with 3D printing.</p>
<p>It depends heavily on the particular technology that you're using to do the 3D printing, but nearly all forms of printing aren't perfect--depending on the design you make (solid? honeycombed? hollow?), there will be slight, or not-so-slight variations across the faces, which will result in an unfair die. In particular, the faces that are parallel to the build surface will probably be different compared to the ones that are angled.</p>
<p>You could probably deal with some of these problems with some kind of post-processing, but honestly at that point buying dice would be easier. 3D printing is for making custom or prototype objects, and isn't really suited to mass production of simple shapes like dice.</p>
<p>Even manufactured dice have some imperfections, and a slightly unfair die probably won't make much of a difference in gameplay, but it will be hard for you to determine whether the imperfections from 3D printing are severe enough to make the die unfair without rolling it many times and looking at its distribution. Again, at that point, it's easier to just buy the dice.</p>
<p>That being said, custom d20s can be super cool looking, and if you're going to 3D print something, might as well make it look cool...</p>
|
<p>Well it is a bit more complicated than that. Changes are the d20 you buy in the store is a bit more favored as well. Now we are talking statically, it will like one side over the other. As the difference in weight distribution is not drastic if you print it solid, it will not matter. In use you likely will not see it. </p>
<p>That said if you wanted to be extra sure.. I would use the 3d printed model, make a silicon mold with it. Then use Resin to make the dice. Now you can start making whole batches of dice as good as what you get in the store.</p>
<p>My final answer is, technically it will favor but you will not notice.</p>
| 525
|
<p>Not so long ago I was in an interview, that required solving two very interesting problems. I'm curious how would you approach the solutions.</p>
<p>Problem 1 :</p>
<p><strong>Product of everything except current</strong> </p>
<p>Write a function that takes as input two integer arrays of length len, input and index, and generates a third array, result, such that:
result[i] = product of everything in input except input[index[i]]</p>
<p>For instance, if the function is called with len=4, input={2,3,4,5}, and index={1,3,2,0}, then result will be set to {40,24,30,60}.</p>
<p>IMPORTANT: Your algorithm must run in linear time.</p>
<p>Problem 2 : ( the topic was in one of Jeff posts )</p>
<p><strong>Shuffle card deck evenly</strong></p>
<ol>
<li><p>Design (either in C++ or in C#) a class Deck to represent an ordered deck of cards, where a deck contains 52 cards, divided in 13 ranks (A, 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K) of the four suits: spades (?), hearts (?), diamonds (?) and clubs (?).</p></li>
<li><p>Based on this class, devise and implement an efficient algorithm to shuffle a deck of cards. The cards must be evenly shuffled, that is, every card in the original deck must have the same probability to end up in any possible position in the shuffled deck.
The algorithm should be implemented in a method shuffle() of the class Deck:
void shuffle()</p></li>
<li><p>What is the complexity of your algorithm (as a function of the number n of cards in the deck)?</p></li>
<li><p>Explain how you would test that the cards are evenly shuffled by your method (black box testing).</p></li>
</ol>
<p>P.S. I had two hours to code the solutions</p>
|
<p>First question: </p>
<pre><code>int countZeroes (int[] vec) {
int ret = 0;
foreach(int i in vec) if (i == 0) ret++;
return ret;
}
int[] mysticCalc(int[] values, int[] indexes) {
int zeroes = countZeroes(values);
int[] retval = new int[values.length];
int product = 1;
if (zeroes >= 2) { // 2 or more zeroes, all results will be 0
for (int i = 0; i > values.length; i++) {
retval[i] = 0;
}
return retval;
}
foreach (int i in values) {
if (i != 0) product *= i; // we have at most 1 zero, dont include in product;
}
int indexcounter = 0;
foreach(int idx in indexes) {
if (zeroes == 1 && values[idx] != 0) { // One zero on other index. Our value will be 0
retval[indexcounter] = 0;
}
else if (zeroes == 1) { // One zero on this index. result is product
retval[indexcounter] = product;
}
else { // No zeros. Return product/value at index
retval[indexcounter] = product / values[idx];
}
indexcouter++;
}
return retval;
}
</code></pre>
<p>Worst case this program will step through 3 vectors once.</p>
|
<p>Vaibhav, unfortunately we have to assume, that there could be a 0 in the input table.</p>
| 8,009
|
<p>I've used Apache CXF to expose about ten java classes as web services.</p>
<p>I've generated clients using CXF, Axis, and .NET.</p>
<p>In Axis and CXF a "Service" or "Locator" is generated.
From this service you can get a "Port".
The "Port" is used to make individual calls to the methods exposed by the web service.</p>
<p>In .NET the "Service" directly exposes the calls to the web service.</p>
<p>Can someone explain the difference between a port, a service, a locator, and an endpoint when it comes to web services?</p>
<p>Axis:</p>
<pre><code>PatientServiceImplServiceLocator locator =
new PatientServiceImplServiceLocator();
PatientService service = locator.getPatientServiceImplPort();
</code></pre>
<p>CXF:</p>
<pre><code>PatientServiceImplService locator = new PatientServiceImplService();
PatientService service = locator.getPatientServiceImplPort();
</code></pre>
<p>.net:</p>
<pre><code>PatientServiceImplService service = new PatientServiceImplService();
</code></pre>
|
<p>I found the information based on Kevin Kenny's answer, but I figured I'd post it here for others.</p>
<p>A WSDL document defines services as collections of network endpoints, or ports. In WSDL, the abstract definition of endpoints and messages is separated from their concrete network deployment or data format bindings. This allows the reuse of abstract definitions: messages, which are abstract descriptions of the data being exchanged, and port types which are abstract collections of operations. The concrete protocol and data format specifications for a particular port type constitutes a reusable binding. A port is defined by associating a network address with a reusable binding, and a collection of ports define a service. Hence, a WSDL document uses the following elements in the definition of network services:</p>
<ul>
<li><strong>Types</strong>– a container for data type definitions using some type system (such as XSD).</li>
<li><strong>Message</strong>– an abstract, typed definition of the data being communicated.</li>
<li><strong>Operation</strong>– an abstract description of an action supported by the service.</li>
<li><strong>Port Type</strong>–an abstract set of operations supported by one or more endpoints.</li>
<li><strong>Binding</strong>– a concrete protocol and data format specification for a particular port type.</li>
<li><strong>Port</strong>– a single endpoint defined as a combination of a binding and a network address.</li>
<li><strong>Service</strong>– a collection of related endpoints.</li>
</ul>
|
<p>As you already mentioned, those terms mean different things in different stacks - there is no one right generic answer for web services.</p>
| 3,264
|
<p>In a C++ Windows (XP and NT, if it makes a difference) application I'm working on, I need to get the network name associated with the computer the code is executing on, so that I can convert local filenames from C:\filename.ext to \\network_name\C$\filename.ext. How would I do this?</p>
<p>Alternatively, if there's a function that will just do the conversion I described, that would be even better. I looked into WNetGetUniversalName, but that doesn't seem to work with local (C drive) files.</p>
|
<p>You'll want Win32's GetComputerName:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms724295(VS.85).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms724295(VS.85).aspx</a></p>
|
<p>I agree with Pascal on using winsock's gethostname() function.
Here you go:</p>
<pre><code>#include <winsock2.h> //of course this is the way to go on windows only
#pragma comment(lib, "Ws2_32.lib")
void GetHostName(std::string& host_name)
{
WSAData wsa_data;
int ret_code;
char buf[MAX_PATH];
WSAStartup(MAKEWORD(1, 1), &wsa_data);
ret_code = gethostname(buf, MAX_PATH);
if (ret_code == SOCKET_ERROR)
host_name = "unknown";
else
host_name = buf;
WSACleanup();
}
</code></pre>
| 3,230
|
<p>We've been doing some printing with PETG filament on Ender 3 Pro printer and the result were awful:
<a href="https://i.stack.imgur.com/1k0ej.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/1k0ej.jpg" alt="Overview of failed PETG prints"></a></p>
<p>Here are settings we used:</p>
<ul>
<li>Extruder: 240 °C</li>
<li>Bed: ~70 °C (± 10 °C)</li>
<li>Speed: 80 mm/sec</li>
</ul>
<p>There are a few types of problems that we had:</p>
<ol>
<li><strong>Initially filament did not stick to the bed</strong> - those 3 items in the middle of the picture are example of this issue. This got fixed by increasing temperature of bed to 80 °C.</li>
<li><strong>At some point a piece would get dis-attached from the bed and would move around together with the extruder around</strong> - two prints in the upper right corner of the picture were cancelled for this reason.</li>
<li><strong>Models are very rough, like a cheaply made snowball</strong> - that tiny model in the upper left is suppose to be a cattle-bell. Could you tell?</li>
</ol>
<h2>Additional info</h2>
<p>Filament that we used indicated</p>
<ul>
<li>extruder temperature 230-240 °C</li>
<li>printing speed 40-90 mm/sec</li>
<li>no info about bed temperature </li>
</ul>
<h2>Question(s):</h2>
<ul>
<li>What are some optimal, tried and tested options for printing PETG? <sub>(Temperatures, speed, etc)</sub></li>
<li>What are some caveats/difficulties of working with PETG to look out for? <sub>(For example, I've read that PETG likes slower speeds. Is that true?)</sub></li>
<li>Is it possible that the model of 3D printer does not work well with this type of filament? <sub>(I don't have much experience printing so I can't know)</sub></li>
</ul>
|
<p>Slow down! </p>
<p>80 mm/s is much too fast for PETG. Try 45 or 50 mm/s instead, even for infill, supports, and other less-visible areas.</p>
|
<p>55 mm per second is the highest I would go with PETG.
Cleaning the nozzle more often helps.
Also check your PID for the nozzle temp, it could be inconsistent and PETG can be very finicky with temperature.</p>
| 1,359
|
<p>I'm building my own 3D printer (custom design, made by me and cut using a water cutting machine) but I have always had problems with the hotend clogging.</p>
<p>I have had four hotends:</p>
<ul>
<li>a J-Head;</li>
<li>a full metal;</li>
<li>a full metal made by me and;</li>
<li>my current hotend which is just a block of aluminium with a plaster cold-end 100% homemade with no precision at all.</li>
</ul>
<p>Believe it or not, this hotend is the only one that has finished a whole print (about 40 minutes), all of the others, with or without fans, haven't managed to finish one!</p>
<p>Well... this hotend has a 1.5mm hole so I guess that that's why it can print.</p>
<p>The problem with all of the others was that the 1.75mm PLA that I'm using clogged the hotend after two minutes.</p>
<p>Now I would like to buy a new, more precise, hotend. I'm using a Bowden extruder, can you suggest a good hotend?</p>
<p>This is my printer:</p>
<p><a href="https://s10.postimg.org/mhk71hq0p/IMG_20160302_204645713.jpg" rel="nofollow noreferrer"><img src="https://s10.postimg.org/mhk71hq0p/IMG_20160302_204645713.jpg" alt="Print1"></a>
<a href="https://s23.postimg.org/c7u1n63nf/IMG_20160302_204636873.jpg" rel="nofollow noreferrer"><img src="https://s23.postimg.org/c7u1n63nf/IMG_20160302_204636873.jpg" alt="Print2"></a></p>
|
<p>To make the <a href="https://3dprinting.stackexchange.com/questions/670/which-hotend-does-not-clog-and-is-good-to-use-with-a-bowden-1-75-mm-setup#comment-874">suggestion of Martin Carney</a> a real answer and shift things away from comments:</p>
<p>Yes, moisture and dust can be a problem. Find elaborations on the moisture here:
<a href="https://3dprinting.stackexchange.com/questions/84/does-filament-have-to-be-stored-in-an-airtight-environment">Does filament have to be stored in an airtight environment</a>.</p>
<p>Also, dust getting into the hot end won't make extrusion easier. (link with suitable information needed). There are filament cleaning 'devices' for print on thingiverse, have a look at things with the <a href="https://www.thingiverse.com/tag:filament_cleaner" rel="nofollow noreferrer">tag: filament cleaner</a>.</p>
<p>There are some other things that are mostly discussed in relation to hot-end clogging, which are printing speed, retract setting and what I would call hot-end resistance. For all of those, read through this thread and refine your question according to what you tried and what the results were:
<a href="https://3dprinting.stackexchange.com/questions/612/repeatedly-clogged-printrbot-simple-extruder">Repeatedly Clogged Printrbot Simple Extruder</a>.</p>
|
<p>To add to <a href="https://3dprinting.stackexchange.com/questions/670/which-hotend-does-not-clog-and-is-good-to-use-with-a-bowden-1-75-mm-setup#answer-699">kamuro's answer</a>, with respect to the dust aspect, the page <a href="http://www.felixprinters.com/knowledgebase/article/filament-not-extruding-clogged-hot-end.html" rel="nofollow noreferrer">Filament Not Extruding/ Clogged Hot-End</a> makes a couple of relevent points:</p>
<blockquote>
<ul>
<li><strong>Dust collector not applied around the filament:</strong> Filament attracts a lot of dust, which can potentially all come into the
hot-end. In some dusty environments this could cause a clogged hot-end
within a few hours.</li>
<li><strong>Clog from the inside of the hot-end:</strong> It could be that a big dust particle is inside the hot-end tip blocking it from the inside.
This can be solved by handdrilling the nozzle from the inside with a
2mm drill provided in our webshop.</li>
</ul>
</blockquote>
| 207
|
<p>We have only had activity on 3 questions in the past 2 days. It is recommended that we get 10 new questions per day. This is far below these goals.</p>
<p>What can we do to get more questions?</p>
|
<p>I wouldn't worry too much about it. </p>
<p>We're still currently in the private beta stage, and we'll be in this spot for another 9 days. After nearly two weeks of private beta, it's perfectly natural for activity to slow down. </p>
<h2>So what should you do?</h2>
<p>Don't lose out. Make sure that you keep your commitment to this strong. Keep active on meta, working through the queues and discussing site issues. </p>
<p>Quantity is not everything. Whatever you do, never sacrifice quality in these critical stages. Don't ask questions simply for the sake of asking: if you do, you're bailing out on the site. Continue answering questions with quality. If you start seeding the site with lower-quality questions, you'll destroy the site. I've seen this happen. You've got a reputation so far, make sure to keep it, or even improve it. </p>
|
<p>I agree with Erik. This is something we need to improve on if we want the site to be viable and <a href="https://stackoverflow.blog/2010/10/21/when-will-my-site-graduate/">Graduate from Beta</a>. Our Beta stats on <a href="http://area51.stackexchange.com/proposals/82438?phase=beta">Area51</a> need improvement.</p>
<p>We are doing great on answering questions (94%) - GREAT JOB!!!
We have the quality answers and users, now we need quantity to meet our Beta Goals.</p>
<p><strong>6,000 members is REALLY LOW.</strong></p>
<p>Forbes that <a href="https://www.forbes.com/sites/tjmccue/2016/04/25/wohlers-report-2016-3d-printer-industry-surpassed-5-1-billion/#1886464619a0" rel="nofollow noreferrer">"More than 278,000 desktop 3D printers (under $5,000) were sold worldwide..."</a> in 2016. I am SURE that the majority of the owners are looking for answers. In the past year since beta started, the 3D printing market has exploded (nearly 300K users); but, we have only added 50% do our user base (2K users). WHY?</p>
<p><strong>1.5 questions a day is (IMHO) DISMAL</strong>.</p>
<p>I am a member of a Facebook Group for just the Tronxy X1/X3.
It has 1,500 members (1/4 of what we have) and gets at least 10 questions/day.</p>
<p><strong>So, what can we do?</strong></p>
<p>Here is the <a href="https://meta.stackexchange.com/questions/252762/what-can-be-done-to-promote-beta-sites">same question</a> on Stack Exchange Meta and here are some SO Blog Posts on <a href="https://stackoverflow.blog/2011/05/31/community-promotion-ads/">Community Promotion Ads</a> and <a href="https://stackoverflow.blog/2010/08/23/a-recipe-to-promote-your-site/">A Recipe to Promote your Site</a></p>
<p><strong>So, Who is With Me?</strong><br>
<strong>Who wants this site THE SOURCE for 3D Printing questions and answers?</strong></p>
| 15
|
<p>I'm currently working on a large implementation of Class::DBI for an existing database structure, and am running into a problem with clearing the cache from Class::DBI. This is a mod_perl implementation, so an instance of a class can be quite old between times that it is accessed.
From the man pages I found two options:</p>
<pre><code>Music::DBI->clear_object_index();
</code></pre>
<p>And:</p>
<pre><code>Music::Artist->purge_object_index_every(2000);
</code></pre>
<p>Now, when I add clear_object_index() to the DESTROY method, it seems to run, but doesn't actually empty the cache. I am able to manually change the database, re-run the request, and it is still the old version.
purge_object_index_every says that it clears the index every n requests. Setting this to "1" or "0", seems to clear the index... sometimes. I'd expect one of those two to work, but for some reason it doesn't do it every time. More like 1 in 5 times.</p>
<p>Any suggestions for clearing this out?</p>
|
<p>The "<a href="http://wiki.class-dbi.com/wiki/Common_problems" rel="nofollow noreferrer">common problems</a>" page on the <a href="http://wiki.class-dbi.com/wiki" rel="nofollow noreferrer">Class::DBI wiki</a> has a <a href="http://wiki.class-dbi.com/wiki/Common_problems#Old_data_due_to_object_index" rel="nofollow noreferrer">section</a> on this subject. The simplest solution is to disable the live object index entirely using:</p>
<pre><code>$Class::DBI::Weaken_Is_Available = 0;
</code></pre>
|
<p>I should note that Class::DBI is deprecated and you should port your code to <a href="http://search.cpan.org/dist/DBIx-Class/" rel="nofollow noreferrer">DBIx::Class</a> instead.</p>
| 5,595
|
<p>What web site structure(s)/architecture(s) would the community swear by, with a narrowing down in the direction towards more of a small facebook style project?</p>
<p>I understand the question to be rather broad/subjective; but being relatively new to the area of web development, I find just looking at and learning from examples of working projects most times extremely helpful, and that at other times just blows my mind and changes how I construct future assignments.</p>
<p>With the latter paragraph in mind, does the community have any suggestions on places to look/articles to read?</p>
|
<p>I guess it depends on the technology you select. For web projects in general I've always employed (Web-)MVC for the past two years or so. The advantage being a clear seperation of frontend and backend in order to create a managable code base.</p>
<p>But that's as vague as a recommendation could be. :)</p>
<p>Aside from using a framework to build your site from scratch, you might also want to look into using what's already out there (in terms of open source). I'd recommend any kind of "community software" that's semi-established, well documented, not too often in the news because of security issues and offers API to extend its base. That could indeed jump start you on your facebook-esque site. ;)</p>
|
<p>Possibly a bit heavy for your immediate needs, but have you seen the <a href="http://oreilly.com/catalog/9780596000356/" rel="nofollow noreferrer">Polar bear</a>*? Well worth a browse in the library to see if it's what you require.</p>
<p>*<a href="http://oreilly.com/catalog/9780596000356/" rel="nofollow noreferrer">Information Architecture for the World Wide Web, Second Edition</a></p>
| 6,833
|
<p>Earlier today I successfully completed a small print (less than 1 hour) on our Tevo Tarantula. When it came time to print the next one, I started preheating for PLA and got an "E1 Thermal Runaway" error. I replaced the heating element with a backup and got no error on preheat.</p>
<p>With an estimated 5+ hrs printing time, the print got about 1 hour in before it quit with another "E1 Thermal Runaway" error. This is with a brand new heating element, the third in about as many months, and I don't do much printing at all.</p>
<p>Is this normal for the elements to be so shoddy or are there settings I need to be changing? I still have the first 2 elements that I thought had died but maybe that's not the issue at all so I'll hang onto them in case I'm overlooking some code to change in Marlin.</p>
<p>I've tried connecting and reconnecting both the wires for the heating element and for the thermistor. I've tightened and loosened the screw holding the thermistor in the heating block. While it did heat up momentarily, the error popped up again after less than a minute:</p>
<pre><code>23:40:57.529 : echo:DEBUG:INFO,ERRORS
23:41:04.974 : PID Autotune start
23:41:37.274 : Error:Heating failed, system stopped! Heater_ID: 0
23:41:37.274 : Error:Printer halted. kill() called!
</code></pre>
<p>How can I find out what is wrong?</p>
|
<h1>1 PID Tune</h1>
<p>Changing the thermosensor or the heater cartridge is a big change in the system: each of these items has internal errors differing them from each other item. If your thermosensor has a different standard resistance by a small way than the one before, if the resistance of the cartridge is different, then the chip gets readings it does not expect. This is why a change of either of these components (or to a different heater block size/material for the matter) one should run a PID tune, teaching the chip how the new sensor/cartridge behave.</p>
<p>To do this, connect to your Printer via an USB Cable and run a software that can send raw gcode. I prefer Repetier Host, but other software also works. I like to follow the instructions of the <a href="https://e3d-online.dozuki.com/Guide/V6+Assembly/6?lang=en#s87" rel="nofollow noreferrer">e3D v6 assembly manual</a>, but the video by <a href="https://www.youtube.com/watch?v=APzJfYAgFkQ" rel="nofollow noreferrer">Tom (Thomas Sanladererer)</a> and the <a href="https://reprap.org/wiki/PID_Tuning" rel="nofollow noreferrer">RepRap Wiki</a> have excellent explanations too.</p>
<ul>
<li>Send <code>M303 E0 S200 C8</code></li>
<li>wait for finishing</li>
<li>send <code>M301</code> with the values you just got returned. One example might read <code>M301 P17.28 I0.63 D118.87</code></li>
<li>sent <code>M500</code> to update your EEPROM</li>
</ul>
<hr />
<p>If this doesn't help, we might have a bigger problem, so let's go troubleshooting! Hardware first, then Firmware.</p>
<p>A few useful hints that Thomas Sanladerer found <a href="https://www.youtube.com/watch?v=ckQ9UWlmdVA" rel="nofollow noreferrer">when he was checking his printers for fire hazards</a>:</p>
<ul>
<li>A shorted out thermosensor (closed loop, 0-Resistance) triggers Maxtemp</li>
<li>A burnt out thermosensor (open loop) triggers Mintemp</li>
<li>A non-connected or burnt out (open loop) Cartridge triggers thermal runaway, as does any other error with the cartridge that leads to abnormal heating.</li>
</ul>
<h1>2 Check the Hardware</h1>
<p>Hardware can fail, we all know that. But luckily there are only 5 items involved that could fail:</p>
<h2>2.1 Check all connections</h2>
<p>If the heater cartridge is not connected properly, that will result in a Thermal Runaway Error, as the thermosensor does not detect any change.</p>
<p>A non connected thermosensor will trigger a mintemp error, a shorted thermosensor will trigger maxtemp error.</p>
<h2>2.2 Check the resistance of the heater cartridge</h2>
<p>A broken heater cartridge can have two results: either it conducts no electricity at all (for example if a lead is broken), or it acts as a jumper and has no resistance at all. To check this, use a multimeter and measure the resistance in Ohm by connecting it to the leads of the cartridge while it is dismounted. A broken circuit in the cartridge triggers Thermal Runaway, a shorted out cartridge can break the board in worst case. <a href="https://imgur.com/a/o4CXxCT" rel="nofollow noreferrer">A pictoral guide for analogue Multimeters.</a></p>
<p>My e3D light6 in my 12 V TronXY has a resistance of about 5.2 Ω. The Value you will get depends on what kind of heater cartridge you use. For reference: e3D Heater Cartridges are <a href="https://e3d-online.dozuki.com/Guide/V6+Assembly/6?lang=en#s87" rel="nofollow noreferrer">documented</a> to be around 4.8 Ω for 12 V & 30 W, 3.6 Ω for 12 V & 40 W, 19.2 Ω for 24 V 30 W and 14.4 Ω for 24 V 40 W.</p>
<p>If your Value is given as infinite or near 0 Ω, your heater cartridge is broken - Though having 3 defect heater cartridges seems unlikely on first glance, unless something shortens their lifespan considerably.</p>
<h2>2.3 Check your supply voltage</h2>
<p>Now comes a thing that can be <strong>dangerous</strong> for you will measure a live circuit. Be aware that you are working with <strong>live current</strong> when you do this. Do <strong>NOT</strong> bring your fingers into contact with unshielded wires!</p>
<p>Set your Multimeter to check the Voltage. Connect the test probes to the output of the power supply that runs into the board. Power up the voltage supply. It should read close to 12 or 24V, depending on your machine.</p>
<h2>2.4 Check the voltage given by the board</h2>
<p>Again, this is measuring <strong>live current</strong> and can be <strong>dangerous</strong>. Use maximum care not to fry yourself!</p>
<p>If your Power supply is working, then it might be the board that is not allowing the current to get the heater cartridge. So we need to measure if it gets power. Since I=U/R, and we have established that R is not 0 or infinity (see above), we can establish if there is I by simply measuring U, which is the voltage.</p>
<p>Mount the tips of your multimeter into the clamps that should take the leads for the heater cartridge and set it to measure the Voltage. Make sure they have contact. Connect the machine to power and start it up. Order it to heat up the cartridge. It should show a voltage that is similar to your supply voltage (12/24V).</p>
<h2>2.5 Thermosensor</h2>
<p>The Thermosensor <em>might</em> trigger an error if it is faulty but not entirely broken. A broken thermosensor should trigger <code>MINTEMP</code> for a broken open and <code>MAXTEMP</code> for a shorted out sensor. The only way to test this would be to measure it against items of known temperature, for example using the bed sensor as Benchmark.</p>
<h1>3 Check the Firmware</h1>
<h2>3.1 Thermosensor settings</h2>
<p>In some cases, the temperature tables of the thermosensors are not compatible and one has to change the settings for that in the firmware. One of the best rundowns I know is in the e3D <a href="https://e3d-online.dozuki.com/Guide/Lite6+Marlin+Configuration/27?lang=en" rel="nofollow noreferrer">light6</a>/<a href="https://e3d-online.dozuki.com/Guide/V6+Marlin+Configuration/5?lang=en" rel="nofollow noreferrer">v6</a> firmware manual, if you need more help than this.</p>
<p>In the Marlin 1.9 you do this in <code>Configuation.h</code>, under the header Thermal Settings. In my Ender 3 this is done in line 289:</p>
<pre><code>#define TEMP_SENSOR_0 5
</code></pre>
<p>That means, that my temperature sensor 0 (the one in the hotend) is of type 5, where type 5 is defined in the block above. The relevant line 256 of my file reads:</p>
<pre><code> * 5 : 100K thermistor - ATC Semitec 104GT-2 (Used in ParCan & J-Head) (4.7k pullup)
</code></pre>
<p>The most common choice in Chinese hotends to use this very 4.7-kiloohm pullup thermistor table, and the actual specific table for most of these is reasonably close to the 5. Other thermosensors can be reasonably overlapping, but in case you change the style of thermosensor, it is generally advised to change this value accordingly<sup>1</sup>. <strong>Always</strong> run a PID tuning after changing the thermosensor table!</p>
<h2>3.2 Thermal Runaway Protection</h2>
<p>The settings for the Thermal Runaway Protection might be worth a look. Maybe it is a little trigger happy? <code>Configuration_adv.h</code> contains a block titled Thermal Settings, containing when to trigger the emergency shutdown. For my Ender3 it reads like this:</p>
<pre><code>#if ENABLED(THERMAL_PROTECTION_HOTENDS)
#define THERMAL_PROTECTION_PERIOD 40 // Seconds
#define THERMAL_PROTECTION_HYSTERESIS 4 // Degrees Celsius
</code></pre>
<p>From your error log, I guess that your printer has the second line as 30 seconds. It would be technically safe to increase this time to up to 120 seconds, but I strongly suggest not to go over 60 seconds.</p>
<p><sup>1 - I had switched the whole hotend on my TronXY X1 for an e3D light6, and it only needed a PID tune, but in <em>theory</em> I should have also swapped the Firmware to reflect that - but, as said, luckily many Chinese printers use the table 5 even if they are not using the sensor. Table 5 was <em>made</em> for the thermosensors used by e3D.</sup></p>
|
<p>@Trish gives a lot of good info, but:</p>
<p><strong>I don't think your heating element is the problem, I think the thermistor is, or a flaky connection between it and your board.</strong></p>
<p>The termistor senses the temperature of your heater (you also have one on a heat bed), and tells the electronics when to heat, and when it's hot enough. Now imagine if the sensor is broken or the cable gets loose: the electronics will think it's too cold and just heat forever.</p>
<p>This causes a fire hasard, so most electronics doesn't let the heater go full out for too long time, and ends it all with a "Thermal Runaway" if it happens.</p>
<p>So check that your temp is read correctly, even when you move the cables, and if that isn't it, buy a pack of thermistors (or what's compatible with your printer).</p>
<p>Good luck!</p>
<p>Source: been there done that :-)</p>
| 1,122
|
<p>I can download a file from Tinkercad as any of these:</p>
<pre><code>.STL
.OBJ
.X3D
.VRML
</code></pre>
<p>Is there a way to convert any of those file types to .DWG?</p>
|
<p>For designing your part, especially considering the repetitive mathematics involved, I would consider to learn to use OpenSCAD. I've learned the program and it fits your modeling requirement quite well. I feel it's easy to learn and is somewhat easier for folks who have a programming background. I don't have one, but it's still a logical progression to learn this program.</p>
<p>Regarding the SLS aspect, that also jumped out at me as a suitable answer. Solid shapes require to have "drain holes" to reduce the amount of powder consumed by the process.</p>
<p>I am assembling a Sintratec SLS printer and your model is the sort of thing I would enjoy to create with the printer. I've not yet listed my Sintratec printer on 3dhubs to solicit business, simply because it's not yet a fully assembled printer!</p>
<p>I did a quick Google search for "openscad tetrahedral honeycomb" and found this link:</p>
<p><a href="http://forum.openscad.org/Beginner-Honeycomb-advice-needed-td4556.html" rel="nofollow noreferrer">http://forum.openscad.org/Beginner-Honeycomb-advice-needed-td4556.html</a></p>
<p>The result is more a polygonal honeycomb, not a true 3d tetrahedron, but it's a start. The file that created it is fewer than a few dozen lines of code.</p>
<p>The post is old enough that the internal links no longer work but the OP posted his module code and that does work:</p>
<p><a href="https://i.stack.imgur.com/rO5Je.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rO5Je.png" alt="enter image description here"></a></p>
<p>I'm not sure how personal contact works in stackexchange, but I'd be willing to work with you regarding creating your code and if the printer ever gets assembled, printing out your part.</p>
<p><a href="https://i.stack.imgur.com/hohRb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hohRb.png" alt="enter image description here"></a></p>
<p>Adding a picture again, to show the latest revision, based on the updated information:</p>
<p><a href="https://i.stack.imgur.com/Gna6W.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Gna6W.png" alt="enter image description here"></a></p>
|
<p>In short, I don't think printing the full tetrahedral honeycomb design is a good approach considering the application of the part. Here are few things to note when attempting to 3D print the tetrahedral honeycomb:</p>
<p>I wouldn't recommend trying to 3D print this with a an FDM/FFF printer as you will most likely need supports and there would not be enough strength laterally. You may be able to <em>print</em> the design using SLA, but handling would be very difficult before post-processing as the part is very brittle post-print until a heat treat or curing process is done to chemically solidify. The post-process of the SLA could determine how strong the part is (ie. stainless steel powder, infused with bronze in a heat treat process would be good for such a part).</p>
<p>While SLS may be the best method for 3D printing this type of design, for that size part (30x30x10cm) you're looking at an expensive print regardless of whether or not you print it yourself.</p>
<p>Instead, I would highly recommend finding (or designing your own) a joint connector that would allow you to join wood/plastic dowels in the tetrahedral honeycomb shape. Not only will this be cheaper for you in the long run (easier to replace a few broken segments than an entire 3D printed model), but it could provide more structural strength for something that could potentially get banged around, like a tricopter.</p>
<p>For example, <a href="http://www.thingiverse.com/thing:176263" rel="nofollow noreferrer">this model</a> on Thingiverse (not my model) shows an example of how you can utilize 3D printing complex or custom joints that allow you to connect dowels in the shape you're looking for. It'd kind of be like building with <a href="https://www.google.com/search?q=k'nex&hl=en&biw=1920&bih=918&site=webhp&source=lnms&tbm=isch&sa=X&ved=0ahUKEwjurNmd2fzLAhVL1mMKHZ9RA44Q_AUIBygC" rel="nofollow noreferrer">K'Nex</a>.</p>
<p>As far as designing said joint, you could model a single "inner" joint that has 18 connectors (8 on XY plane, 6 on YZ plane, and 4 on XZ plane). Below is a crude example of what I mean drawn in Google SketchUp:
<a href="https://i.stack.imgur.com/dlTMG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dlTMG.png" alt="enter image description here"></a></p>
| 247
|
<p>I'm trying to redirect requests for a wildcard domain to a sub-directory.<br />
ie. <code>something.blah.example.com</code> --> <code>blah.example.com/something</code></p>
<p>I don't know how to get the subdomain name to use in the rewrite rule.</p>
<p><strong>Final Solution:</strong></p>
<pre><code>RewriteCond %{HTTP_HOST} !^blah\.example\.com
RewriteCond %{HTTP_HOST} ^([^.]+)
RewriteRule ^(.*) /%1/$1 [L]
</code></pre>
<p>Or as pointed out by pilif</p>
<pre><code>RewriteCond %{HTTP_HOST} ^([^.]+)\.blah\.example\.com$
</code></pre>
|
<p>You should have a look at the <a href="http://httpd.apache.org/docs/2.2/rewrite/" rel="noreferrer" title="URL Rewriting Guide">URL Rewriting Guide</a> from the apache documentation.</p>
<p>The following is untested, but it should to the trick:</p>
<pre><code>RewriteCond %{HTTP_HOST} ^([^.]+)\.blah\.domain\.com$
RewriteRule ^/(.*)$ http://blah.domain.com/%1/$1 [L,R]
</code></pre>
<p>This only works if the subdomain contains no dots. Otherwise, you'd have to alter the Regexp in RewriteCond to match any character which should still work due to the anchoring, but this certainly feels safer.</p>
|
<p>@Sam</p>
<p>your RewriteCond line is wrong. The expansion of the variable is triggered with %, not $.</p>
<pre><code>RewriteCond %{HTTP_HOST} ^([^\.]+)\.media\.xnet\.tk$
^
</code></pre>
<p>that should do the trick</p>
| 7,210
|
<p>I'm working on a web service at the moment and there is the potential that the returned results could be quite large ( > 5mb). </p>
<p>It's perfectly valid for this set of data to be this large and the web service can be called either sync or async, but I'm wondering what people's thoughts are on the following:</p>
<ol>
<li><p>If the connection is lost, the
entire resultset will have to be
regenerated and sent again. Is there
any way I can do any sort of
"resume" if the connection is lost
or reset?</p></li>
<li><p>Is sending a result set this large even appropriate? Would it be better to implement some sort of "paging" where the resultset is generated and stored on the server and the client can then download chunks of the resultset in smaller amounts and re-assemble the set at their end?</p></li>
</ol>
|
<p>I have seen all three approaches, <strong>paged</strong>, <strong>store and retrieve</strong>, and <strong>massive push</strong>.</p>
<p>I think the solution to your problem depends to some extent on why your result set is so large and how it is generated. Do your results grow over time, are they calculated all at once and then pushed, do you want to stream them back as soon as you have them?</p>
<h2><strong>Paging Approach</strong></h2>
<p>In my experience, using a paging approach is appropriate when the client needs quick access to reasonably sized chunks of the result set similar to pages in search results. Considerations here are overall chattiness of your protocol, caching of the entire result set between client page requests, and/or the processing time it takes to generate a page of results.</p>
<h2><strong>Store and retrieve</strong></h2>
<p>Store and retrieve is useful when the results are not random access and the result set grows in size as the query is processed. Issues to consider here are complexity for clients and if you can provide the user with partial results or if you need to calculate all results before returning anything to the client (think sorting of results from distributed search engines).</p>
<h2><strong>Massive Push</strong></h2>
<p>The massive push approach is almost certainly flawed. Even if the client needs all of the information and it needs to be pushed in a monolithic result set, I would recommend taking the approach of <code>WS-ReliableMessaging</code> (either directly or through your own simplified version) and chunking your results. By doing this you </p>
<ol>
<li>ensure that the pieces reach the client </li>
<li>can discard the chunk as soon as you get a receipt from the client</li>
<li>can reduce the possible issues with memory consumption from having to retain 5MB of XML, DOM, or whatever in memory (assuming that you aren't processing the results in a streaming manner) on the server and client sides.</li>
</ol>
<p>Like others have said though, don't do anything until you know your result set size, how it is generated, and overall performance to be actual issues.</p>
|
<p>I somewhat disagree with secretGeek's comment:</p>
<blockquote>
<p>That's already happening for you -- it's called tcp/ip ;-) Re-implementing that could be overkill.</p>
</blockquote>
<p>There are times when you may want to do just this, but really only from a UI perspective. If you implement some way to either stream the data to the client (via something like a pushlets mechanism), or chunk it into pages as you suggest, you can then load some really small subset on the client and then slowly build up the UI with the full amount of data.</p>
<p>This makes for a slicker, speedier UI (from the user's perspective), but you have to evaluate if the extra effort will be worthwhile... because I don't think it will be an insignificant amount of work.</p>
| 3,291
|
<p>How do I get Perl to read the contents of a given directory into an array?</p>
<p><a href="https://en.wikipedia.org/wiki/Grave_accent#Use_in_programming" rel="noreferrer">Backticks</a> can do it, but is there some method using 'scandir' or a similar term?</p>
|
<pre><code>opendir(D, "/path/to/directory") || die "Can't open directory: $!\n";
while (my $f = readdir(D)) {
print "\$f = $f\n";
}
closedir(D);
</code></pre>
<p>EDIT: Oh, sorry, missed the "into an array" part:</p>
<pre><code>my $d = shift;
opendir(D, "$d") || die "Can't open directory $d: $!\n";
my @list = readdir(D);
closedir(D);
foreach my $f (@list) {
print "\$f = $f\n";
}
</code></pre>
<p>EDIT2: Most of the other answers are valid, but I wanted to comment on <a href="https://stackoverflow.com/questions/22566/how-do-i-read-in-the-contents-of-a-directory-in-perl#24436">this answer</a> specifically, in which this solution is offered:</p>
<pre><code>opendir(DIR, $somedir) || die "Can't open directory $somedir: $!";
@dots = grep { (!/^\./) && -f "$somedir/$_" } readdir(DIR);
closedir DIR;
</code></pre>
<p>First, to document what it's doing since the poster didn't: it's passing the returned list from <a href="http://perldoc.perl.org/functions/readdir.html" rel="noreferrer">readdir()</a> through a <a href="http://perldoc.perl.org/functions/grep.html" rel="noreferrer">grep()</a> that only returns those values that are files (as opposed to directories, devices, named pipes, etc.) and that do not begin with a dot (which makes the list name <code>@dots</code> misleading, but that's due to the change he made when copying it over from the readdir() documentation). Since it limits the contents of the directory it returns, I don't think it's technically a correct answer to this question, but it illustrates a common idiom used to filter filenames in <a href="http://en.wikipedia.org/wiki/Perl" rel="noreferrer">Perl</a>, and I thought it would be valuable to document. Another example seen a lot is:</p>
<pre><code>@list = grep !/^\.\.?$/, readdir(D);
</code></pre>
<p>This snippet reads all contents from the directory handle D <strong>except</strong> '.' and '..', since those are very rarely desired to be used in the listing.</p>
|
<p>from: <a href="http://perlmeme.org/faqs/file_io/directory_listing.html" rel="nofollow noreferrer">http://perlmeme.org/faqs/file_io/directory_listing.html</a></p>
<pre><code>#!/usr/bin/perl
use strict;
use warnings;
my $directory = '/tmp';
opendir (DIR, $directory) or die $!;
while (my $file = readdir(DIR)) {
next if ($file =~ m/^\./);
print "$file\n";
}
</code></pre>
<p>The following example (based on a code sample from perldoc -f readdir) gets all the files (not directories) beginning with a period from the open directory. The filenames are found in the array @dots.</p>
<pre><code>#!/usr/bin/perl
use strict;
use warnings;
my $dir = '/tmp';
opendir(DIR, $dir) or die $!;
my @dots
= grep {
/^\./ # Begins with a period
&& -f "$dir/$_" # and is a file
} readdir(DIR);
# Loop through the array printing out the filenames
foreach my $file (@dots) {
print "$file\n";
}
closedir(DIR);
exit 0;
closedir(DIR);
exit 0;
</code></pre>
| 4,260
|
<p>How can I find any unused functions in a PHP project?</p>
<p>Are there features or APIs built into PHP that will allow me to analyse my codebase - for example <a href="http://ie.php.net/manual/en/language.oop5.reflection.php" rel="noreferrer">Reflection</a>, <a href="http://php.net/manual/en/function.token-get-all.php" rel="noreferrer"><code>token_get_all()</code></a>?</p>
<p>Are these APIs feature rich enough for me not to have to rely on a third party tool to perform this type of analysis?</p>
|
<p>Thanks Greg and Dave for the feedback. Wasn't quite what I was looking for, but I decided to put a bit of time into researching it and came up with this quick and dirty solution:</p>
<pre><code><?php
$functions = array();
$path = "/path/to/my/php/project";
define_dir($path, $functions);
reference_dir($path, $functions);
echo
"<table>" .
"<tr>" .
"<th>Name</th>" .
"<th>Defined</th>" .
"<th>Referenced</th>" .
"</tr>";
foreach ($functions as $name => $value) {
echo
"<tr>" .
"<td>" . htmlentities($name) . "</td>" .
"<td>" . (isset($value[0]) ? count($value[0]) : "-") . "</td>" .
"<td>" . (isset($value[1]) ? count($value[1]) : "-") . "</td>" .
"</tr>";
}
echo "</table>";
function define_dir($path, &$functions) {
if ($dir = opendir($path)) {
while (($file = readdir($dir)) !== false) {
if (substr($file, 0, 1) == ".") continue;
if (is_dir($path . "/" . $file)) {
define_dir($path . "/" . $file, $functions);
} else {
if (substr($file, - 4, 4) != ".php") continue;
define_file($path . "/" . $file, $functions);
}
}
}
}
function define_file($path, &$functions) {
$tokens = token_get_all(file_get_contents($path));
for ($i = 0; $i < count($tokens); $i++) {
$token = $tokens[$i];
if (is_array($token)) {
if ($token[0] != T_FUNCTION) continue;
$i++;
$token = $tokens[$i];
if ($token[0] != T_WHITESPACE) die("T_WHITESPACE");
$i++;
$token = $tokens[$i];
if ($token[0] != T_STRING) die("T_STRING");
$functions[$token[1]][0][] = array($path, $token[2]);
}
}
}
function reference_dir($path, &$functions) {
if ($dir = opendir($path)) {
while (($file = readdir($dir)) !== false) {
if (substr($file, 0, 1) == ".") continue;
if (is_dir($path . "/" . $file)) {
reference_dir($path . "/" . $file, $functions);
} else {
if (substr($file, - 4, 4) != ".php") continue;
reference_file($path . "/" . $file, $functions);
}
}
}
}
function reference_file($path, &$functions) {
$tokens = token_get_all(file_get_contents($path));
for ($i = 0; $i < count($tokens); $i++) {
$token = $tokens[$i];
if (is_array($token)) {
if ($token[0] != T_STRING) continue;
if ($tokens[$i + 1] != "(") continue;
$functions[$token[1]][1][] = array($path, $token[2]);
}
}
}
?>
</code></pre>
<p>I'll probably spend some more time on it so I can quickly find the files and line numbers of the function definitions and references; this information is being gathered, just not displayed.</p>
|
<p>afaik there is no way. To know which functions "are belonging to whom" you would need to execute the system (runtime late binding function lookup). </p>
<p>But Refactoring tools are based on static code analysis. I really like dynamic typed languages, but in my view they are difficult to scale. The lack of safe refactorings in large codebases and dynamic typed languages is a major drawback for maintainability and handling software evolution.</p>
| 3,263
|
<p>I have a third-party app that creates HTML-based reports that I need to display. I have <em>some</em> control over how they look, but in general it's pretty primitive. I <em>can</em> inject some javascript, though. I'd like to try to inject some jQuery goodness into it to tidy it up some. One specific thing I would like to do is to take a table (an actual HTML <table>) that always contains one row and a variable number of columns and magically convert that into a tabbed view where the contents (always one <div> that I can supply an ID if necessary) of each original table cell represents a sheet in the tabbed view. I haven't found any good (read: simple) examples of re-parenting items like this, so I'm not sure where to begin. Can someone provide some hints on how I might try this?</p>
|
<p>Given a html page like this:</p>
<pre><code><body><br/>
<table id="my-table">`<br/>
<tr><br/>
<td><div>This is the contents of Column One</div></td><br/>
<td><div>This is the contents of Column Two</div></td><br/>
<td><div>This is the contents of Column Three</div></td><br/>
<td><div>Contents of Column Four blah blah</div></td><br/>
<td><div>Column Five is here</div></td><br/>
</tr><br/>
</table><br/>
</body><br/>
</code></pre>
<p>the following jQuery code converts the table cells into tabs (tested in FF 3 and IE 7)</p>
<pre><code>$(document).ready(function() {
var tabCounter = 1;
$("#my-table").after("<div id='tab-container' class='flora'><ul id='tab-list'></ul></div>");
$("#my-table div").appendTo("#tab-container").each(function() {
var id = "fragment-" + tabCounter;
$(this).attr("id", id);
$("#tab-list").append("<li><span><a href='#" + id + "'>Tab " + tabCounter + "</a></span></li>");
tabCounter++;
});
$("#tab-container > ul").tabs();
});
</code></pre>
<p>To get this to work I referenced the following jQuery files</p>
<ul>
<li>jquery-latest.js</li>
<li>ui.core.js</li>
<li>ui.tabs.js</li>
</ul>
<p>And I referenced the flora.all.css stylesheet. Basically I copied the header section from the <a href="http://docs.jquery.com/UI/Tabs#Example" rel="nofollow noreferrer">jQuery tab example</a> </p>
|
<p>You could do this with jQuery but it may make additional maintenance a nightmare. I would recommend against doing this / screen scraping because if the source ever changes so does your work around.</p>
| 7,773
|
<p>I prefer dark backgrounds for coding, and I've downloaded a jar file containing an IntelliJ IDEA color theme that has a dark background. How do I tell IntelliJ about it?</p>
|
<p>Go to File->Import Settings... and select the jar settings file</p>
<p>Update as of <strong>IntelliJ 2020</strong>:</p>
<p>Go to File -> Manage IDE Settings -> Import Settings...</p>
|
<p>Find the .jar theme file in your disk. Drag the file into PhpStorm window and voila !</p>
| 6,025
|
<p>What do you think the future of GPU as a CPU initiatives like CUDA are? Do you think they are going to become mainstream and be the next adopted fad in the industry? Apple is building a new framework for using the GPU to do CPU tasks and there has been alot of success in the Nvidias CUDA project in the sciences. Would you suggest that a student commit time into this field?</p>
|
<p>First of all I don't think this questions really belongs on SO.</p>
<p>In my opinion the GPU is a very interesting alternative whenever you do vector-based float mathematics. However this translates to: It will not become mainstream. Most mainstream (Desktop) applications do very few floating-point calculations.</p>
<p>It has already gained traction in games (physics-engines) and in scientific calculations. If you consider any of those two as "mainstream", than yes, the GPU will become mainstream.</p>
<p>I would not consider these two as mainstream and I therefore think, the GPU will raise to be the next adopted fad in the mainstream industry.</p>
<p>If you, as a student have any interest in heavily physics based scientific calculations, you should absolutely commit some time to it (GPUs are very interesting pieces of hardware anyway).</p>
|
<p>With so much untapped power I cannot see how it would go unused for too long. The question is, though, how the GPU will be used for this. CUDA seems to be a good guess for now but other techologies are emerging on the horizon which might make it more approachable by the average developer.</p>
<p>Apple have recently announced OpenCL which they claim is much more than CUDA, yet quite simple. I'm not sure what exactly to make of that but the khronos group (The guys working on the OpenGL standard) are working on the OpenCL standard, and is trying to make it highly interoperable with OpenGL. This might lead to a technology which is better suited for normal software development.</p>
<p>It's an interesting subject and, incidentally, I'm about to start my master thesis on the subject of how best to make the GPU power available to the average developers (if possible) with CUDA as the main focus.</p>
| 4,778
|
<p>I'm using Cura and it removes my holes and deletes sections of the print and disconnects parts. In Blender it looks as it should be, as I designed it. I know there are a few mishaps inside (not manifold) but is there a way to fill in everything on the inside. I only care about the externally facing faces. This is extremely infuriating I hope someone can tell me how to force Cura to print what is originally seen in the .stl.</p>
<p><a href="https://i.stack.imgur.com/vhECG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vhECG.png" alt="Blender as it should look" /></a></p>
<p><a href="https://i.stack.imgur.com/spmc4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/spmc4.png" alt="Again how I designed it." /></a></p>
<p><a href="https://i.stack.imgur.com/R5IEQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R5IEQ.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/XhOsa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XhOsa.png" alt="enter image description here" /></a></p>
<p>These are photos of how it should look.</p>
<p>Now these next photos are how Cura previews it. Not only does it fill in the holes (no, fill holes isn't enabled) it adds huge gaps in the side and bottom of the print as can be seen.</p>
<p><a href="https://i.stack.imgur.com/nhQv4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nhQv4.png" alt="All messed up." /></a></p>
<p><a href="https://i.stack.imgur.com/H1eTp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/H1eTp.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/Q51Me.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q51Me.png" alt="enter image description here" /></a></p>
<p>How can I force Cura to print what I see in blender in the original .stl?</p>
<p>I am exporting in Blender to .stl and opening that in Cura.</p>
<hr />
<p>I was able to fix it partially by fixing normals in Blender but there is still this:</p>
<p><a href="https://i.stack.imgur.com/Rjk38.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rjk38.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/lFOfR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lFOfR.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/wPoMg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wPoMg.png" alt="enter image description here" /></a></p>
<p><a href="https://i.stack.imgur.com/Z2Uuy.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Z2Uuy.png" alt="enter image description here" /></a></p>
|
<p>It's common for modeling software to flip normals, causing what you describe. You said,</p>
<blockquote>
<p>I only care about the externally facing faces.</p>
</blockquote>
<p>But are you sure they are truly externally facing? Turn on normals in Blender and ensure that all the arrows/pointers are external.</p>
<p>Another problem that can generate the results you're seeing are self-intersecting surfaces, non-manifold edges, and a couple others that are explained in a <a href="https://www.3dhubs.com/knowledge-base/fixing-most-common-stl-file-errors/" rel="nofollow noreferrer">3dhubs article.</a> Correcting those problems involve a bit more examination and trouble shooting.</p>
<p>The slicing software prefers to have clean, well defined triangular surfaces in order to create a print file. When something is amiss, you get results you've presented.</p>
<p>With the STL in hand, I opened it in Meshmixer (free) and immediately was given a clue.</p>
<p><a href="https://i.stack.imgur.com/oITba.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oITba.png" alt="STL image in meshmixer" /></a></p>
<p>The zebra-stripes are reversed normals.</p>
<p>Here's another error point, difficult to see clearly in flat 2D image, but panning and zooming and orbiting and all those 3D manipulating things shows there's nothing there:</p>
<p><a href="https://i.stack.imgur.com/FrtCK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FrtCK.png" alt="broken corner" /></a></p>
<p>The other end of this not-joined area shows a bit better:</p>
<p><a href="https://i.stack.imgur.com/IH41m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IH41m.png" alt="other broken corner" /></a></p>
<p>After selecting all I could find/locate, I did the reverse normals and here's a slightly improved result:</p>
<p><a href="https://i.stack.imgur.com/GcpRG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GcpRG.png" alt="corrected part" /></a></p>
<p>Unfortunately, the other borked up portions prevented meshmixer from performing a suitable auto-repair, completely destroying the model in the process.</p>
<p>Those joint corners and any other colored lines have to be addressed individually.</p>
|
<p>Okay, so like suggested I put it into 3D Builder (A free Windows 3D modeling program). I imported it as an stl, then exported it as an stl and imported that stl into Cura. And lo and behold all problems were gone! If you are having a similar issue give that a try! The 3D Builder program and similar ones are designed to export for the sole purpose of 3D printing so it automatically fixes these issues! If this doesn't work try editing yours in edit mode (Blender) a bit so it makes it easier for 3D Builder to fix it.</p>
| 1,891
|
<p>The ASP.NET AJAX <strong>ModalPopupExtender</strong> has <code>OnCancelScript</code> and <code>OnOkScript</code> properties, but it doesn't seem to have an <code>OnShowScript</code> property. I'd like to specify a javascript function to run each time the popup is shown.</p>
<p>In past situations, I set the <code>TargetControlID</code> to a dummy control and provide my own control that first does some JS code and then uses the JS methods to show the popup. But in this case, I am showing the popup from both client and server side code.</p>
<p>Anyone know of a way to do this?</p>
<p>BTW, I needed this because I have a textbox in the modal that I want to make a TinyMCE editor. But the TinyMCE init script doesn't work on invisible textboxes, so I had to find a way to run it at the time the modal was shown</p>
|
<p>hmmm... I'm <em>pretty sure</em> that there's a shown event for the MPE... this is off the top of my head, but I think you can add an event handler to the shown event on page_load</p>
<pre><code>function pageLoad()
{
var popup = $find('ModalPopupClientID');
popup.add_shown(SetFocus);
}
function SetFocus()
{
$get('TriggerClientId').focus();
}
</code></pre>
<p>i'm not sure tho if this will help you with calling it from the server side tho</p>
|
<p>If you are using a button or hyperlink or something to trigger the popup to show, could you also add an additional handler to the onClick event of the trigger which should still fire the modal popup and run the javascript at the same time?</p>
| 2,738
|
<p>Can I use three-phase stepper motors with pololu style stepper drivers? If not, what kind of drivers support three-phase motors?</p>
|
<p>Three phase stepper motors are superior in several ways: <a href="http://www.fullingmotorusa.com/the-new-range-of-3-phase-stepper-motors/" rel="nofollow noreferrer">see this advertising literature.</a> Unfortunately for using this with simple stepper drivers, they have an extra coil of wire that simple drivers have no way to control. Two phase motors have two isolated coils, while three phase motors have three coils connected in a star configuration.</p>
<p>Texas Instruments offers this design suggestion for using three-phase motors: <a href="http://www.ti.com/lit/ug/tiducn7/tiducn7.pdf" rel="nofollow noreferrer">TI White Paper</a>. Ultimately, it is driven by three synchronized PWM signals connected to three H-bridges, each driving one of the three motor wires. One could build a board with a micro-controller that accepted step and direction pulses and output the three-phase drive. At that level, you could substitute the micro-control-plus-H-bridge board for the Pololu-style driver in an existing 3D printer framework. You would need to configure the steps-per-mm correctly for the new drive system. </p>
<p>If you did this, and the sales literature is correct, you should get quieter operation with higher torque. How that would affect operation would depend on the torque of the motor, the rotating mass of the motor, and the gearing or belt drive you use. </p>
<p>Like two-phase motors, high torque at high speed requires driving the motor with a voltage much higher than the "specified" steady-state motor voltage.</p>
|
<p>3D printers typically use bipolar two-phase stepper motors, and it is possible that Pololu-style carriers for stepper-motor drivers only support such motors.</p>
<p>Certainly, drivers for three-phase stepper motors exist, for example, the Trinamic TMC5062, but I cannot find any Pololu-style carriers for this chip. Even if a Pololu-style carrier can be sourced, it is not certain that existing 3D-printer firmware can be configured to control it.</p>
<p>If you are thinking about re-purposing some three-phase motors, I would advise that you purchase standard bipolar motors, instead. Bipolar two-phase motors suitable for 3D printing are not that expensive.</p>
<p><a href="http://www.trinamic.com/fileadmin/assets/Support/Appnotes/AN030-TMC5062_3_Phase_Motor.pdf" rel="nofollow noreferrer">Trinamic TMC5062</a></p>
| 1,324
|
<p>I need to read from a variety of different text files (I've some delimited files and some fixed width files). I've considered parsing the files line by line (slow using the File.ReadLine type methods) and reading the file using the ODBC text driver (faster) but does anyone have any other (better) suggestions? I'm using .NET/C#.</p>
|
<p>I'm not sure you could really do a text-and-Excel file parser, not unless by Excel file you mean a comma/pipe/tab delimited file, which is actually just another text file. Reading actual excel files require you to use the MS Office libraries.</p>
<p>For delimited text file parsing, you could look into <a href="http://www.filehelpers.com/" rel="nofollow noreferrer">FileHelpers</a> -- open source and they pretty much have it covered. Not sure if it will match your speed requirements though.</p>
|
<p>The File reading process is not slow if you read all file at once using the File class and the methods suggested by John. Depending upon the file's size and what you want to do with them, it may use more or less memory. I'd suggest you try with File.ReadAllText (or whatever is appropriate for you)</p>
| 5,436
|
<p>My Zortrax M200 has a skipping extruder motor, I’ve checked the seating of all connections and 3 different (electronic ribbon) cables and still can’t fix the issue. The gear is clean and have tried fresh filament. </p>
<ul>
<li>Does anyone have any possible thoughts on why this happens?</li>
</ul>
<p>The extruded motor will move in the desired direction and then skip back. </p>
<p>Loading the filament is fine. Tried new nozzles, blockages checked, etc.</p>
|
<p>Every time I've had an extruder "skip", it was actually because some condition was causing excessive back-pressure. Either the hot end isn't hot enough, the nozzle is too close to the bed, or something has clogged the nozzle.</p>
<p>If there is a "skipping" noise, then this is almost certainly the problem. When a stepper can not advance, the magnetic field will continue to "step". After the rotor is behind the steps by 180 degrees of field phase (which might be only a fraction of a degree os stepper motor shaft rotation), the rotor will snap back to re-align with the magnetic field. The sudden movement of the rotor and the release of compression on the filament often makes a loud clicking or thumping noise. If you can see the gear, it will jump backward and then rotate slowly forward before jumping backward again.</p>
<p>To see if it is the drivers, try extruding with no filament, or if you can, try moving filament through the extruder. If it doesn't move at all, or doesn't move under light drag, it may be the driver, the wiring, or perhaps the motor.</p>
|
<ol>
<li><p>Check the pins on the motor. Are they bent? If yes - straighten them out with a screw driver. </p></li>
<li><p>This could be a stepper driver problem. If it is then bad luck. Zortrax hard solders their stepper drivers onto their control board (this sucks and is a pure monetization related move by them). </p></li>
</ol>
<p>This results in you having to get a whole new set of connector cables and or new control boards every time something goes wrong.</p>
<p>Ask for a control board replacement with new connector cables, if your machine is still under warranty it should be free of charge.</p>
<p>Switch to different or cheaper machines like Wanhaos or Ultimakers if you want the same ease of use and cheap part replacement. </p>
| 936
|
<p>Given a path such as <code>"mydir/myfile.txt"</code>, how do I find the file's absolute path in Python? E.g. on Windows, I might end up with:</p>
<pre><code>"C:/example/cwd/mydir/myfile.txt"
</code></pre>
|
<pre><code>>>> import os
>>> os.path.abspath("mydir/myfile.txt")
'C:/example/cwd/mydir/myfile.txt'
</code></pre>
<p>Also works if it is already an absolute path:</p>
<pre><code>>>> import os
>>> os.path.abspath("C:/example/cwd/mydir/myfile.txt")
'C:/example/cwd/mydir/myfile.txt'
</code></pre>
|
<p>In case someone is using python and linux and looking for full path to file:</p>
<pre><code>>>> path=os.popen("readlink -f file").read()
>>> print path
abs/path/to/file
</code></pre>
| 7,460
|
<p>How do I call MySQL stored procedures from Perl? Stored procedure functionality is fairly new to MySQL and the MySQL modules for Perl don't seem to have caught up yet.</p>
|
<p>There's an example in the <a href="http://search.cpan.org/dist/DBD-mysql/lib/DBD/mysql.pm#MULTIPLE_RESULT_SETS" rel="nofollow noreferrer">section on Multiple result sets in the DBD::mysql docs</a>.</p>
|
<p><em>Hi, similar to above but using SQL exec. I could not get the CALL command to work. You will need to fill in anything that is within square brackets and remove the square brackets.</em> </p>
<pre>
use DBI;
#START: SET UP DATABASE AND CONNECT
my $host = '*[server]*\\*[database]*';
my $database = '*[table]*';
my $user = '*[user]*';
my $auth = '*[password]*';
my $dsn = "dbi:ODBC:Driver={SQL Server};Server=$host;Database=$database";
my $dbh = DBI->connect($dsn, $user, $auth, { RaiseError => 1 });
#END : SET UP DATABASE AND CONNECT
$sql = "exec *[stored procedure name]* *[param1]*,*[param2]*,*[param3]*;";
$sth = $dbh->prepare($sql);
$sth->execute or die "SQL Error: $DBI::errstr\n";
</pre>
| 8,968
|
<p>I have come across a lot of optimization tips which say that you should mark your classes as sealed to get extra performance benefits.</p>
<p>I ran some tests to check the performance differential and found none. Am I doing something wrong? Am I missing the case where sealed classes will give better results?</p>
<p>Has anyone run tests and seen a difference?</p>
<p>Help me learn :)</p>
|
<p>The JITter will sometimes use non-virtual calls to methods in sealed classes since there is no way they can be extended further.</p>
<p>There are complex rules regarding calling type, virtual/nonvirtual, and I don't know them all so I can't really outline them for you, but if you google for sealed classes and virtual methods you might find some articles on the topic.</p>
<p>Note that any kind of performance benefit you would obtain from this level of optimization should be regarded as last-resort, always optimize on the algorithmic level before you optimize on the code-level.</p>
<p>Here's one link mentioning this: <a href="http://codebetter.com/blogs/patricksmacchia/archive/2008/01/05/rambling-on-the-sealed-keyword.aspx" rel="noreferrer">Rambling on the sealed keyword</a></p>
|
<p>Run this code and you'll see that sealed classes are 2 times faster:</p>
<pre><code>class Program
{
static void Main(string[] args)
{
Console.ReadLine();
var watch = new Stopwatch();
watch.Start();
for (int i = 0; i < 10000000; i++)
{
new SealedClass().GetName();
}
watch.Stop();
Console.WriteLine("Sealed class : {0}", watch.Elapsed.ToString());
watch.Start();
for (int i = 0; i < 10000000; i++)
{
new NonSealedClass().GetName();
}
watch.Stop();
Console.WriteLine("NonSealed class : {0}", watch.Elapsed.ToString());
Console.ReadKey();
}
}
sealed class SealedClass
{
public string GetName()
{
return "SealedClass";
}
}
class NonSealedClass
{
public string GetName()
{
return "NonSealedClass";
}
}
</code></pre>
<p>output:
Sealed class : 00:00:00.1897568
NonSealed class : 00:00:00.3826678</p>
| 2,432
|
<p>I've been looking at the Ender series and decided to take the plunge. But I'm unsure on electrical matters. The 110 or 220 volt switch, I assume goes to 220 V as I live in the UK but my main question is, from what I've read they come with an EU plug and a uk adapter, is it safer to switch to a 'kettle lead' for it to have it's own fuse and be grounded or is the adapter it comes with fine? <em>(I've never been a fan of adapter and I've read in different places that they're fine or that they are horrible.)</em> </p>
<p>Please help as if I need to buy a cable I'll do it the same time I buy the printer. Thank you all in advance for any help I get, hope to join this community properly as soon as the printers come back in stock anywhere.</p>
|
<p>The fuse <em>may</em> be academic, because there might be an integrated fuseholder in the PSU itself. That said, adding another fuse in the form of a proper UK plug certainly won't hurt. </p>
<p>I'd certainly do this, too. Fuseless plugs have no place in my home/workplace</p>
<p>For the rest - yes, the 220V position for the switch is good. Grounding, again, certainly can't hurt, but the PSU is probably double-insulated, which doesn't require it.</p>
|
<h1>Safety First!</h1>
<p>To guarantee proper grouning and avoid putting the machine on a static charge level against the ground of the house you need to properly connect the ground wires to the ground wire of the house. This is done by using a grounded power cord with a <strong>C13-plug on the machine end</strong> and a proper, grounded plug fitting your sockets on the other end.</p>
<h2>Proper plugs</h2>
<p>In most of the continental EU (safe France), you usually can use a Shuko (Schutzkontakt) TypeF/CEE 7/3 while the Type E+F/CEE 7/7 plug adds France on the house end, as these are proper grounded 3-wire plugs. But in the UK you need a <strong>Type G/BS 1363 plug</strong>, with or without a fuse.</p>
<h2>Fuses</h2>
<p>Because the machine operates on mains voltage in the PSU, it usually already has a fuse mounted inside the PSU, so a fused plug is not strictly needed, however it is not a bad idea to include an extra fuse - technically you'd end with 3 in total if you are properly grounded because the circuits breaker-box fuse is there too.</p>
<h2>Wire Extensions</h2>
<p>What would be a bad idea though is to use any extension cord in the wiring that is not grounded because it might use a plastic ground pin or lack the metal contact surface needed to ground the cord.</p>
<h2>Improper plugs</h2>
<p>A 2-wire "Europlug". Europlug CEE 7/16 is only rated for 250V/2.5A and <strong>not grounded</strong>, thus it is <strong>not</strong> suitable for operating a 3D printer , and I strongly advise <strong>not</strong> to use a gritish folding plug either as it is not grounded!</p>
<h1>Safety Mantra!</h1>
<p>Let me reiterate this: <strong>Only use grounded connections from machine to socket or you risk creating a charge on the machine!</strong></p>
<p>Check your socket's ground if you are not sure it is properly installed. For further information, I strongly suggest watch <a href="https://www.youtube.com/watch?v=v1OuYg7AJjw" rel="nofollow noreferrer">Angus (Makers Muse)</a> with how he discovered a problem with his extension cords leading to a potential dangerous charge on his machine and <a href="https://www.youtube.com/watch?v=3jYZDLOV4Jc" rel="nofollow noreferrer">DIY3D Tech</a> explaining the basics of the problem and how to solve it to you again!</p>
| 1,654
|
<p>I want to implement an ISAPI filter like feature using HttpModule in IIS7 running under IIS Integrated Request Processing Pipeline mode.</p>
<p>The goal is to look at the incoming request at the Web Server level, and inject some custom HttpHeaders into the request. <code>(for ex: HTTP\_EAUTH\_ID)</code></p>
<p>And later in the page lifecycle of an ASPX page, i should be able to use that variable as</p>
<pre><code>string eauthId = Request.ServerVariables["HTTP\_EAUTH\_ID"].ToString();
</code></pre>
<p>So implementing this module at the Web Server level, is it possible to alter the ServerVariables collection ?? </p>
|
<p><a href="http://msdn.microsoft.com/en-us/library/system.web.httprequest.servervariables.aspx" rel="nofollow noreferrer">HttpRequest.ServerVariables</a> Property is a read-only collection. So, you cannot directly modify that. I would suggest storing your custom data in <a href="http://www.odetocode.com/Articles/111.aspx" rel="nofollow noreferrer">httpcontext</a> (or global application object or your database) from your httpmodule and then reading that shared value in the aspx page.</p>
<p>If you still want to modify server variables, there is a hack technique mentioned in this <a href="http://forums.asp.net/t/1125149.aspx" rel="nofollow noreferrer">thread</a> using Reflection.</p>
|
<p>I believe the server variables list only contains the headers sent from the browser to the server.</p>
| 8,564
|
<p>While I know IronRuby isn't quite ready for the world to use it, I was wondering if anyone here tried it and tested how well it faired against the other Rubies out there in terms of raw performance?</p>
<p>If so, what are the results, and how did you go about measuring the performance (which benchmarks etc)?</p>
<p><strong>Edit</strong>: The IronRuby team maintains a site on how they compare to Ruby MRI 1.8 at <a href="http://ironruby.info/" rel="nofollow noreferrer">http://ironruby.info/</a>. Below the spec pass rate table, they also have some information on how IronRuby performs on these specs. This table is not continuously updated, but I assume they update it often enough (you can see the last update at the top of the page).</p>
|
<p>According to this article <a href="http://www.iunknown.com/2008/05/ironruby-and-rails.html" rel="nofollow noreferrer">http://www.iunknown.com/2008/05/ironruby-and-rails.html</a>. In may performance was nowhere near where they expected it to be. I heard in <a href="http://altnetpodcast.com/episodes/9-state-of-ironruby" rel="nofollow noreferrer">http://altnetpodcast.com/episodes/9-state-of-ironruby</a> (3 days ago) that they're still working on performance. I guess they put compatability first and are now trying to get the performance up to par with other ruby implementations out there.</p>
<p>As far as I understand they're not nearly as performant as Iron Python that is developed by the same team. I don't know if this is because Iron Ruby is using the DLR a lot more and that still needs to be optimized or if they need to optimize the Iron Ruby implementation itself more. But I guess it is good news because they can get it a lot faster. So if you're already happy with performance you'll get a lot happier.</p>
|
<p>I have used it and it has worked great for what I have done. However my measuring of performance isn't really scientific, because it was all visual. However I did notice that IronRuby seemed a little more snappier when I compared the two program on equal tasks. I really think this had to do more with the strong and tight binding with IIS that .NET has more than the speed of the framework.</p>
<p>But I could totally be wrong, because I didn't really stress my applications to the levels that Twitter might see. But from my .NET experience I know it would hold up just as well if not better than current production Ruby applications.</p>
<p>By the way I tested Ruby using FastCGI under IIS.</p>
| 5,913
|
<p>In particular, I have to extract all the messages and attachments from Lotus Notes files in the fastest and most reliable way. Another point that may be relevant is that I need to do this from a secondary thread.</p>
<p><strong>Edit</strong></p>
<p>Thanks for the answers - both of which are good. I should provide more background information. </p>
<p>We currently have a WinForms application with a background thread using the Notes COM API. </p>
<p>However it seems to be unstable. (Of course it may be we are doing something wrong.) For example, we have found we have to preinitialize the Notes session on the main thread or else the call to session.CreateDXLExporter() on the background thread throws an exception.</p>
|
<p>I really do hate that NotesSession COM object.</p>
<p>You cannot use it in another thread than the thread it was initialized.
Threads in .NET are fibers, the real underlying thread may change at any time.</p>
<p>So I suggest using it this way, in a <em>using</em> block :</p>
<pre><code>Imports Domino
Imports System.Threading
Public Class AffinitedSession
Implements IDisposable
Private _session As NotesSession
Public Sub New(ByVal pass As String)
Thread.BeginThreadAffinity()
_session = New NotesSession()
_session.Initialize(pass)
End Sub
Public ReadOnly Property NotesSession() As NotesSession
Get
Return _session
End Get
End Property
Private disposedValue As Boolean = False ' To detect redundant calls
' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean)
If Not Me.disposedValue Then
If disposing Then
' TODO: free other state (managed objects).
End If
' TODO: free your own state (unmanaged objects).
' TODO: set large fields to null.
_session = Nothing
Thread.EndThreadAffinity()
End If
Me.disposedValue = True
End Sub
#Region " IDisposable Support "
' This code added by Visual Basic to correctly implement the disposable pattern.
Public Sub Dispose() Implements IDisposable.Dispose
' Do not change this code. Put cleanup code in Dispose(ByVal disposing As Boolean) above.
Dispose(True)
GC.SuppressFinalize(Me)
End Sub
#End Region
End Class
</code></pre>
<p>Notice the Thread.BeginThreadAffinity() and the Thread.EndThreadAffinity()</p>
<p>Those are your friends.</p>
<p>Cheers !</p>
|
<p>I would personally do this native in Notes in either LotusScript or Java. You can do a scheduled agent in Notes much easier than a service in C#.</p>
| 6,693
|
<p>I'm in the process of starting a User Group in my area related to .NET development. The format of the community will be the average free food, presentation, and then maybe free swag giveaway.</p>
<p>What would you, as a member of a user community, look for in order to keep you coming back month to month?</p>
|
<p>It's true that some of the talks out there are very rudimentary, unfortunately some times the bulk of your crowd may need that. I consider myself a novice in a lot of fields, but I've attend talks that I thought were beneath me and still people were asking very basic questions. Perhaps it would be worth having a bi-monthly user group, one week for entry level and one week for advanced. It doesn't necessarily have to mean twice the work if you can get someone to help you coordinate a lot of the work will overlap. On the other hand you might just need to feel out the members of the group and see what their average skill level is and play to that.</p>
|
<p>If there isn't beer, its not a good enough user group to attend. The open source guys get this. Their user group meetings are funner, and more dynamic because of this. Just make it BYOB and it'll naturally get better in my experience.</p>
| 3,128
|
<p>After a couple of hours fighting with the <a href="http://gallery.menalto.com/" rel="nofollow noreferrer">Gallery2</a> <a href="http://codex.gallery2.org/Gallery2:Modules:rss" rel="nofollow noreferrer">RSS module</a> and getting only the message, "no feeds have yet been defined", I gave up. Based on <a href="http://www.google.com/search?q=%22no+feeds+have+yet+been+defined%22" rel="nofollow noreferrer">a Google search for "no feeds have yet been defined"</a>, this is a pretty common problem. Do you have any tips and/or tricks for getting the Gallery2 RSS module to work? Or any tips for a relatively-PHP-ignorant developer trying to debug problems with this PHP application?</p>
|
<p>My eventual (and hopefully temporary) solution to this problem was a Python CGI script. My script follows for anyone who might find it useful (despite the fact that this is a total hack). </p>
<pre><code>#!/usr/bin/python
"""A CGI script to produce an RSS feed of top-level Gallery2 albums."""
#import cgi
#import cgitb; cgitb.enable()
from time import gmtime, strftime
import MySQLdb
ALBUM_QUERY = '''
select g_id, g_title, g_originationTimestamp
from g_Item
where g_canContainChildren = 1
order by g_originationTimestamp desc
limit 0, 20
'''
RSS_TEMPLATE = '''Content-Type: text/xml
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>TITLE</title>
<link>http://example.com/gallery2/main.php</link>
<description>DESCRIPTION</description>
<ttl>1440</ttl>
%s
</channel>
</rss>
'''
ITEM_TEMPLATE = '''
<item>
<title>%s</title>
<link>http://example.com/gallery2/main.php?g2_itemId=%s</link>
<description>%s</description>
<pubDate>%s</pubDate>
</item>
'''
def to_item(row):
item_id = row[0]
title = row[1]
date = strftime("%a, %d %b %Y %H:%M:%S GMT", gmtime(row[2]))
return ITEM_TEMPLATE % (title, item_id, title, date)
conn = MySQLdb.connect(host = "HOST",
user = "USER",
passwd = "PASSWORD",
db = "DATABASE")
curs = conn.cursor()
curs.execute(ALBUM_QUERY)
print RSS_TEMPLATE % ''.join([ to_item(row) for row in curs.fetchall() ])
curs.close()
</code></pre>
|
<p>Well, I am unsure this can help you but here is a very simple RSS that was presented as solution in another topic:</p>
<p><a href="https://stackoverflow.com/questions/82872/php-rss-builder#84601">PHP RSS Builder</a></p>
| 2,899
|
<p>I have a Queue<T> object that I have initialised to a capacity of 2, but obviously that is just the capacity and it keeps expanding as I add items. Is there already an object that automatically dequeues an item when the limit is reached, or is the best solution to create my own inherited class?</p>
|
<p>I've knocked up a basic version of what I'm looking for, it's not perfect but it'll do the job until something better comes along.</p>
<pre><code>public class LimitedQueue<T> : Queue<T>
{
public int Limit { get; set; }
public LimitedQueue(int limit) : base(limit)
{
Limit = limit;
}
public new void Enqueue(T item)
{
while (Count >= Limit)
{
Dequeue();
}
base.Enqueue(item);
}
}
</code></pre>
|
<p>You can use a <a href="https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.linkedlist-1?view=netcore-3.1" rel="nofollow noreferrer"><code>LinkedList<T></code></a> and add thread safety:</p>
<pre><code>public class Buffer<T> : LinkedList<T>
{
private int capacity;
public Buffer(int capacity)
{
this.capacity = capacity;
}
public void Enqueue(T item)
{
// todo: add synchronization mechanism
if (Count == capacity) RemoveLast();
AddFirst(item);
}
public T Dequeue()
{
// todo: add synchronization mechanism
var last = Last.Value;
RemoveLast();
return last;
}
}
</code></pre>
<p>One thing to note is the default enumeration order will be LIFO in this example. But that can be overridden if necessary.</p>
| 2,368
|
<p>When I cut (kill) text in Emacs 22.1.1 (in its own window on X, in KDE, on Kubuntu), I can't paste (yank) it in any other application.</p>
|
<p>Insert the following into your <code>.emacs</code> file:</p>
<pre><code>(setq x-select-enable-clipboard t)
</code></pre>
|
<p>What I do is to use a good terminal tool (PuTTY on Windows, Konsole or Terminal on Linux) that has copy facilities built-in.</p>
<p>In PuTTY, you highlight the text you want with the mouse and then paste it elsewhere. Right-clicking in a PuTTY window pastes the contents of the Windows copy/paste buffer.</p>
<p>In Konsole or Terminal on Linux, you highlight what you want then press Shift+Ctrl+C for copy and Shift+Ctrl+V for paste.</p>
<p>In the win32 compile of emacs, yanking text does put it on the copy/paste buffer .. most of the time.</p>
<p>On Mac OS X, the Apple-key chortcuts work fine, because Terminal traps them.</p>
<p>There is no direct way of doing it on the commandline because the shell does not maintain a copy/paste buffer for each application. bash <em>does</em> maintain a copy/paste buffer for itself, and, by default, emacs ^k/^y shortcuts work.</p>
| 8,989
|
<p>I'm working with my ASP.NET development team to try and create "better" <em>(i.e. cleaner)</em> HTML when rendering pages. At the moment, .NET has a nasty tendency to do things like dump JavaScript into the page, making it a mandatory requirement on form controls and not allowing forms to work when JS isn't available. In some instances, we're struggling to overcome this without having to add a notable chunk to development time estimates.</p>
<p>I've worked with MVC before - via Struts in Java - and found that in that instance, I was able to keep HTML pages exactly as I'd wanted them to be. <em>(This viewpoint is based on the "best case" static HTML I typically developed beforehand, then handed over to the Java programmers to fill in the holes.)</em></p>
<p>This worked out really well and we were able to produce some of the "best" web pages from a CMS that I've seen. Could .NET MVC give me the separation I need, or would it be a false economy to put aside valuable development time to test this?</p>
<p>If .NET MVC isn't going to give me this fine-grained control over separation, any recommendations for .NET coding practices, libraries, etc. which might would be really helpful.</p>
|
<p>The ASP.NET MVC Framework would give you a much more familiar separation. Because there is no viewstate, etc in the MVC Framework you won't have to worry about JavaScript being dumped into your pages. The only JavaScript calls you see will be ones that you manually add.</p>
<p>You can, for the most part, separate HTML / CSS / JS like you would in a different framework.</p>
|
<p>Asp.Net MVC will help you keep html/css/js separate in that it will present fewer features that would prevent you from keeping them separate.</p>
<p>For example Html helpers typically return just that: Html. From that point you are free to choose to keep all style information associated only by class attributes. </p>
<p>Consider also looking into the practices you usually follow with a library like jQuery. It's an excellent example of how to keep the scripted functionality entirely in your js and out of your html by applying the event handling behaviors to the elements on page load based on things like element type, class and id.</p>
| 8,043
|
<p>As far as I know, foreign keys (FK) are used to aid the programmer to manipulate data in the correct way. Suppose a programmer is actually doing this in the right manner already, then do we really need the concept of foreign keys?</p>
<p>Are there any other uses for foreign keys? Am I missing something here?</p>
|
<p>Foreign keys help enforce referential integrity at the data level. They also improve performance because they're normally indexed by default.</p>
|
<p>Yes. The ON DELETE [RESTRICT|CASCADE] keeps developers from stranding data, keeping the data clean. I recently joined a team of Rails developers who did not focus on database constraints such as foreign keys.</p>
<p>Luckily, I found these: <a href="http://www.redhillonrails.org/foreign_key_associations.html" rel="nofollow noreferrer">http://www.redhillonrails.org/foreign_key_associations.html</a> -- RedHill on Ruby on Rails plug-ins generate foreign keys using the <a href="http://en.wikipedia.org/wiki/Convention_over_configuration" rel="nofollow noreferrer">convention over configuration</a> style. A migration with <em>product_id</em> will create a foreign key to the <em>id</em> in the <em>products</em> table. </p>
<p>Check out the other great plug-ins at <a href="http://www.redhillonrails.org/" rel="nofollow noreferrer">RedHill</a>, including migrations wrapped in transactions. </p>
| 3,926
|
<p>I'm trying to set up <a href="http://octoprint.org/" rel="nofollow noreferrer">OctoPrint</a> on my Linux Ubuntu 16.04 desktop to work with my Micro3D printer. The printer works fine on Mac and Windows:
<a href="https://i.stack.imgur.com/Kmil9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kmil9.png" alt="enter image description here"></a></p>
<p>I've installed OctoPrint with the <a href="https://github.com/donovan6000/M3D-Fio" rel="nofollow noreferrer">M3D Fio Plugin Manager</a>. I can see the files in <code>~/.octoprint/</code> fine and I can even turn the printer fan on/off, move the extruder, etc. through OctoPrint:
<a href="https://i.stack.imgur.com/qyeCZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qyeCZ.png" alt="enter image description here"></a></p>
<p>But when I press the blue "Print button", there is no response. Also the files in the "upload" section are greyed out. Must I download a slicing program or something? I'm new with 3D printing in general but not with Linux. Grateful for help!</p>
|
<p>I just discovered that OctoPrint only reads .gcode files for printing (apparently, unless you have a slicing software embedded in it), so I installed <a href="http://slic3r.org/download" rel="nofollow">Slic3r</a> separately, and ran</p>
<pre><code>./slic3r mystlfile.stl
</code></pre>
<p>to generate a .gcode file (in the executable directory).</p>
<p>Then I uploaded the .gcode file to OctoPrint and things got moving.</p>
|
<p>For me it sounds like you've missed to install the CuraEngine for slicing, but I'm only guessing, as I'm not using OctoPrint at all.</p>
<p>Instead I'm using Cura directly and save gcode to a SD or use USB printing for quick/small prints.</p>
<p>Regrads ;)</p>
| 281
|
<p>I have an existing GUI application that should have been implemented as a service. Basically, I need to be able to remotely log onto and off of the Windows 2003 server and still keep this program running.</p>
<p>Is this even possible?</p>
<p>EDIT: Further refinement here... I do not have the source, it's not my application.</p>
|
<p>Windows services cannot have GUIs, so you will need to either get rid of the GUI or separate your application into two pieces - a service with no UI, and a "controller" application. If you have the source code, converting the non-GUI code into a service is easy - Visual Studio has a 'Windows Service' project type that takes care of the wrapping for you, and there is a simple walkthrough that shows you how to create a deployment project that will take care of installation.</p>
<p>If you opt for the second route and need to put some of the original GUI code into a controller, the controller and service can communicate via WCF, .NET Remoting or plain socket connections with a protocol you define yourself. If you use Remoting, be sure to use a "chunky" interface that transfers data with as few method invocations as possible - each call has a fair amount of overhead.</p>
<p>If the UI is fairly simple, you may be able to get away with using configuration files for input and log files or the Windows Event Log for output.</p>
|
<p>First I would have to ask why your service needs a user interface. Most likely it does not but you probably need a client that gets data from this service. The reason services don't usually have GUI's is they may not have a window environment to run in. Services can start and run without a user logged in to the machine. In this case there would be no desktop for the service GUI to run in.</p>
<p>Having said that you can set properties on the service to run as a user as suggested by Mark. You can also specify in the properties of the service to "Allow service to interact with desktop". Only do this if you know a user will be logged in.</p>
| 7,667
|
<p>I'm wondering if there are any good .NET recommendation algorithms available in open source projects, whether attached to a search engine or not. By recommendation I mean something that accepts a full-text article and recommends other articles from its index based on keyword similarity.</p>
<p>At the high end there are document classification engines like Autonomy; at the low-end spam filters and blog "related posts" widgets. Possibly advertisement-to-article matching, too. I'd like to incorporate one into a project but can't afford the high end and the low end seems to all be LAMP-based.</p>
<p>[Sorry, one answer asked for clarification: What I'm looking for is ideally a standalone library, but I'm willing to adapt good source code as necessary. The end result is that I need to be able to create a C# service that accepts an arbitrary amount of text and returnsa list of similar previously-indexed articles. Basicallly, the exact thing that StackOverflow itself does as you are submitting a question!]</p>
<p>Thanks!
Steve</p>
|
<p>I think that in StackOverflow they extract all common english words from the text and then compare this words with the remaining words of other posts to get the "Related" posts.</p>
|
<p>Question is not very clear (algorithm or library???) but only thing that comes to mind is Lucene.NET, the porting of the popular Lucene library on the .Net framework. HTH.</p>
| 9,759
|
<p>I've used Trac/Subversion before and really like the integration. My current project is using Mercurial for distributed development and it'd be nice to be able to track issues/bugs and have this be integrated with Mercurial. I realized this could be tricky with the nature of DVCS.</p>
|
<p><a href="http://trac.edgewall.org/wiki/TracMercurial" rel="noreferrer">TracMercurial</a> integrates Trac with Mercurial. <a href="http://www.assembla.com/" rel="noreferrer">Assembla</a> provides free Mercurial hosting with Trac integration.</p>
<p>The idea is that you have a central repository as your master and upload all the subsidiary changes from local repositories into the main one.</p>
|
<p>If you're open to another suggestion, you can try <a href="http://www.mrzv.org/software/artemis/" rel="nofollow noreferrer">Artemis</a>.</p>
<p>Though I haven't used it yet, it looks easy enough.</p>
| 4,025
|
<p><strong>Model:</strong> Infitary M508</p>
<p><strong>Details:</strong> The filament is stuck in the extruder preheated for PLA (the filament is PLA 1.75 white). The extruder's motor works and the filament is in the hole of the extruder (not somewhere else). I took the fan covering the motor apart, to show what is inside, so you might see it on the attached image:</p>
<p><a href="https://i.stack.imgur.com/znCxG.png" rel="noreferrer"><img src="https://i.stack.imgur.com/znCxG.png" alt="enter image description here"></a></p>
<p>You might also see this video for details: <a href="https://www.youtube.com/watch?v=R8rYGhuYWvc" rel="noreferrer">https://www.youtube.com/watch?v=R8rYGhuYWvc</a></p>
<p>I'm able to pull the filament out, when I uncouple the motor's gear, but it doesn't go through the extruder when I push it in.</p>
<p>What can I do to fix this? Thanks!</p>
<p>P.S. It's the first start of the printer.</p>
|
<p>Unfortunately you're going to have to tear the extruder head apart and clean the nozzle. There are kits like the following (found on Amazon - No affiliation):</p>
<p><a href="https://i.stack.imgur.com/aDs2P.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aDs2P.jpg" alt="enter image description here"></a></p>
<p>This will give you everything you need to clear the nozzle. The only other solution is to replace the nozzle and extruder tube. The filament is stuck in either or both of these parts. </p>
<p>(As an aside ... a wise person < <em>cough</em> > @0scar < <em>cough</em> > once told me I should keep extras of these parts, as well as the thermister and heating elements on hand. Treat them as disposable parts ... once they're dead, just replace them.)</p>
<p>What you need to figure out though, is why it clogged in the first place. More than likely you tried to extrude filament before the nozzle was up to temperature. If your readout said it was good, then you need to get a no-touch thermometer and check the nozzle for the proper temperature prior to printing to ensure it's all good.</p>
|
<p>Unfortunately you're going to have to tear the extruder head apart and clean the nozzle. There are kits like the following (found on Amazon - No affiliation):</p>
<p><a href="https://i.stack.imgur.com/aDs2P.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aDs2P.jpg" alt="enter image description here"></a></p>
<p>This will give you everything you need to clear the nozzle. The only other solution is to replace the nozzle and extruder tube. The filament is stuck in either or both of these parts. </p>
<p>(As an aside ... a wise person < <em>cough</em> > @0scar < <em>cough</em> > once told me I should keep extras of these parts, as well as the thermister and heating elements on hand. Treat them as disposable parts ... once they're dead, just replace them.)</p>
<p>What you need to figure out though, is why it clogged in the first place. More than likely you tried to extrude filament before the nozzle was up to temperature. If your readout said it was good, then you need to get a no-touch thermometer and check the nozzle for the proper temperature prior to printing to ensure it's all good.</p>
| 1,312
|
<p>Is there a specific name for that problem? What causes this, and is there a way how to solve it? </p>
<p>Printed with PLA, 2 mm nozzle diameter, 0.2 mm layer height, 20-60 mm/s, 200 °C extruder, 60 °C bed.</p>
<p></p>
<p><a href="https://i.stack.imgur.com/aSzrJ.jpg" rel="noreferrer" title="Top"><img src="https://i.stack.imgur.com/aSzrJ.jpg" alt="Top" title="Top"></a></p>
<p><a href="https://i.stack.imgur.com/nCgam.jpg" rel="noreferrer" title="Bottom"><img src="https://i.stack.imgur.com/nCgam.jpg" alt="Bottom" title="Bottom"></a></p>
|
<p>I have experienced this problem. This picture is one that I could have taken. </p>
<p>It has always been because I was putting too much plastic into the available space.</p>
<p>This has been caused two things: overextrusion -- squirting out too much plastic for the intended layer height, and the bed being too "high" so that the gap between the nozzle and the bed is too thin.</p>
<p>In both cases, too much plastic is trying to be placed in too small a volume. The plastic has to go somewhere, and ripples follow. Because the nozzle rubs against the adjacent lines which have already been deposited, an up-bump pushes up the nozzle on the line beside the bump, and a coherent pattern of ripples can form.</p>
<p>The "bump up" is a real effect from the elasticity of the Z-axis, including all the resulting strains of twisting and lifting the nozzle.</p>
|
<p>This could be a number of things, I personally think it could be either over extrusion or an issue with one of the belts. Depending on the printer, you may need to manually go in and adjust your steps per millimeter, which you should be able to find a guide on. If that doesn't work, then look into belt tension adjustment. Hope this is able to help! I like to use the <a href="https://www.simplify3d.com/support/print-quality-troubleshooting/over-extrusion/" rel="nofollow noreferrer">Simplify3D Print Quality Guide</a> for situations like this, it tends to be very useful.</p>
| 1,394
|
<p>I am trying to use a stringstream object in VC++ (VStudio 2003) butI am getting an error when I use the overloaded << operator to try and set some manipulators. </p>
<p>I am trying the following: </p>
<pre><code>int SomeInt = 1;
stringstream StrStream;
StrStream << std::setw(2) << SomeInt;
</code></pre>
<p>This will not compile (error C2593: 'operator <<' is ambiguous).<br>
Does VStudio 2003 support using manipulators in this way?<br>
I know that I can just set the width directly on the stringstream object e.g. StrStream.width(2);<br>
I was wondering why the more usual method doesn't work?</p>
|
<p>Are you sure you included all of the right headers? The following compiles for me in VS2003:</p>
<pre><code>#include <iostream>
#include <sstream>
#include <iomanip>
int main()
{
int SomeInt = 1;
std::stringstream StrStream;
StrStream << std::setw(2) << SomeInt;
return 0;
}
</code></pre>
|
<p>You probably just forgot to include iomanip, but I can't be sure because you didn't include code for a complete program there.</p>
<p>This complete program works fine over here using VS 2003:</p>
<pre><code>#include <sstream>
#include <iomanip>
int main()
{
int SomeInt = 1;
std::stringstream StrStream;
StrStream << std::setw(2) << SomeInt;
}
</code></pre>
| 9,504
|
<p><em>The pictures explain my problem. I have already tried to reduce the retraction but that showed no effect. Thank you for your help.</em> </p>
<p>The effect is a total stop of the print (no material is extruded).</p>
<ul>
<li>Creality CR 10</li>
<li>Cura 3.4.1</li>
</ul>
<p>I recently added this new feeder aluminium block because the 3D printed stock version was bad quality.</p>
<p><a href="https://i.stack.imgur.com/05Kkq.jpg" rel="nofollow noreferrer" title="Filament not entering Bowden tube"><img src="https://i.stack.imgur.com/05Kkq.jpg" alt="Filament not entering Bowden tube" title="Filament not entering Bowden tube"></a></p>
<p><a href="https://i.stack.imgur.com/qzUD5.jpg" rel="nofollow noreferrer" title="Close up"><img src="https://i.stack.imgur.com/qzUD5.jpg" alt="Close up" title="Close up"></a></p>
|
<p>This is typically caused by resistance in the tube or hotend but in your case it appears to be mostly caused by a very poorly designed extruder. The filament needs to be constrained closer to the drive gear. You may be able to drill out the PTC connector to allow the PTFE tube to reach closer to the gears or print a spacer to fit in between but you need to support the filament in that gap.</p>
<p>You can try raising the hotend temperature as a band-aid until you can fix the problem, do not exceed 240 C if you have a PTFE lined hotend. Long retractions can also pull molten filament into the cold zone where it solidifies and make extrusion harder.</p>
<p>As an example, here is a picture of a Bondtech BMG extruder. Note how the extruder constrains the filament path all the way from the drive gear to the hotend entrance. While this example is extreme for normal PLA/PETG/ABS, it is required for flexible filament. A 4mm gap (or closer) should be fine for PLA/PETG/ABS or other hard filaments.</p>
<p><a href="https://i.stack.imgur.com/Sj0N9.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Sj0N9.png" alt="enter image description here"></a></p>
|
<p>You just have to cut the filament at a 45° angle. Then push down the extruder and push the filament in. Then heat up the nozzle. Next, hand feed the filament until the filament starts oozing out.</p>
| 1,039
|
<p>What is the simplest and most elegant way to simulate the hover pseudo-class for non-Anchor tags in IE6?</p>
<p>I am specifically trying to change the cursor in this instance to that of a pointer.</p>
|
<p>I think the simplest way is to use the <a href="http://www.xs4all.nl/~peterned/csshover.html" rel="nofollow noreferrer">hover.htc</a> approach. You add the hover.htc file to your site, then reference it in your stylesheet:</p>
<pre class="lang-css prettyprint-override"><code>body { behavior:url("csshover.htc"); }
</code></pre>
<p>If you want to keep things as clean as possible, you can use IE conditional comments so that line is only rendered users with IE6.</p>
|
<p>I liked the mouseover/out best since I actually already needed to swap the image anyhow. I really should have thought of doing this with javascript to begin with.</p>
<p>Thanks for the quick answers.</p>
<p>@Joseph</p>
<p>Thanks for that link. I had never heard of this technique before and really like the idea.</p>
<p>I will definitely try that out and see how I fare with it.</p>
| 5,721
|
<p>I'm getting this problem:</p>
<pre><code>PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for chris.mahan@gmail.com in c:\inetpub\wwwroot\mailtest.php on line 12
</code></pre>
<p>from this script:</p>
<pre><code><?php
$to = "chris.mahan@gmail.com";
$subject = "test";
$body = "this is a test";
if (mail($to, $subject, $body)){
echo "mail sent";
}
else {
echo "problem";
}
?>
</code></pre>
<p>section from php.ini on the server:</p>
<pre><code>[mail function]
; For Win32 only.
SMTP = server.domain.com; for Win32 only
smtp_port = 25
; For Win32 only.
sendmail_from = support@domain.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =
</code></pre>
<p>(note that "server" and "domain" refer accurately to the actual server and domain name)</p>
<p>In IIS, SMTP is running. Under <code>"Access"</code> tab, <code>"Relay"</code> button, the Select which computers may relay through this virtual server is set to <code>checkbox "only the list below"</code> and on the list is <code>"127.0.0.1(xxx.xxx.xxx.xxx)" (x's representing actual server IP address).</code></p>
<p>Server is running <code>Windows Server 2003 Service Pack 2</code>, fully patched as of 5 PM Sept 1st 2008. I assume it is running <code>IIS7</code> (how to check?).</p>
<p>Any ideas?</p>
<p>In reponse to <a href="https://stackoverflow.com/users/2257/espo">Espo</a>: This machine is hosted at a datacenter. We do not want to use a gmail account (were doing it, want to move away from that). Windows server 2003 comes with its own SMTP server.</p>
<p>Update: Per Yaakov Ellis' advice, I dropped all relay restrictions and added the server IP to the allowed list (using the reverse DNS button provided) and the thing started working.</p>
<p>Thanks to both Espo and Yaakov for helping me out.</p>
|
<p>Try removing the IP restrictions for Relaying in the SMTP server, and opening it up to all relays. If it works when this is set, then you know that the problem has to do with the original restrictions. In this case, it may be a DNS issue, or perhaps you had the wrong IP address listed.</p>
|
<p>@Espo: I'll do that re KB153119. Thanks.</p>
<p>About the mail server: I hear you. </p>
<p>I'll update when I uncover more.</p>
| 5,991
|
<p>Let me start by saying that I do not advocate this approach, but I saw it recently and I was wondering if there was a name for it I could use to point the guilty party to. So here goes.</p>
<p>Now you have a method, and you want to return a value. You <em>also</em> want to return an error code. Of course, exceptions are a much better choice, but for whatever reason you want an error code instead. Remember, I'm playing devil's advocate here. So you create a generic class, like this:</p>
<pre><code>class FunctionResult<T>
{
public T payload;
public int result;
}
</code></pre>
<p>And then declare your functions like this:</p>
<pre><code>FunctionResult<string> MyFunction()
{
FunctionResult<string> result;
//...
return result;
}
</code></pre>
<p>One variation on this pattern is to use an enum for the error code instead of a string. Now, back to my question: is there a name for this, and if so what is it?</p>
|
<p>I'd agree that this isn't specifically an antipattern. It might be a smell depending upon the usage. There are reasons why one would actually not want to use exceptions (e.g. the errors being returned are not 'exceptional', for starters).</p>
<p>There are instances where you want to have a service return a common model for its results, including both errors and good values. This might be wrapped by a low level service interaction that translates the result into an exception or other error structure, but at the level of the service, it lets the service return a result and a status code without having to define some exception structure that might have to be translated across a remote boundary.</p>
<p>This code may not necessarily be an error either: consider an HTTP response, which consists of a lot of different data, including a status code, along with the body of the response.</p>
|
<p>In defense of the anti-pattern designation, this code lends itself to being used in a few ways:</p>
<ol>
<li>Object x = MyFunction().payload; <em>(ignoring the return result - very bad)</em> </li>
<li>int code = MyFunction().result; <em>(throwing away the payload - may be okay if that's the intended use.)</em> </li>
<li>FunctionResult x = MyFunction(); //... <em>(a bunch of extra FunctionResult objects and extra code to check them all over the place)</em></li>
</ol>
<p>If you need to use return codes, that's fine. But then use return codes. Don't try to pack an extra payload in with it. That's what <em>ref</em> and <em>out</em> parameters (C#) are for. Nullable types might be an exception, but only because there's extra sugar baked in the language to support it.</p>
<p>If you still disagree with this assessment, DOWNVOTE this answer (not the whole question). If you do think it's an anti-pattern, then UPVOTE it. We'll use this answer to see what the community thinks.</p>
| 9,831
|
<p>As the title mentions, I have a timeout callback handler on an ajax call, and I want to be able to test that condition but nothing is coming to mind immediately on ways I can force my application to hit that state, any suggestions?</p>
|
<p>First off, I think you need to be clearer in your question - what technology are you using and where is this process that is timing out - server-side or client-side?</p>
<p>If you want to have the server-side code take a long time and you are using .NET, place this line in the method you call server-side:</p>
<pre><code>System.Threading.Thread.Sleep(timeoutMilliseconds);
</code></pre>
<p>As long as you use a number sufficient so that your client-side code assumes the server has timed out, you should be good.</p>
|
<p><a href="http://developer.yahoo.com/yui/connection/" rel="nofollow noreferrer">YUI Connection Manager</a> allows you to introduce slowdown in your Javascript to test AJAX against latency.</p>
| 4,312
|
<p>Okay, here is the 411 - I have the following event handler in my Global.asax.cs file:</p>
<pre><code>private void Global_PostRequestHandlerExecute(object sender, EventArgs e)
{
if (/* logic that determines that this is an ajax call */)
{
// we want to set a cookie
Response.Cookies.Add(new HttpCookie("MyCookie", "true"));
}
}
</code></pre>
<p>That handler will run during Ajax requests (as a result of the Ajax framework I am using), as well as at other times - the condition of the if statement filters out non-Ajax events, and works just fine (it isn't relevant here, so I didn't include it for brevity's sake).</p>
<p>It suffices us to say that this works just fine - the cookie is set, I am able to read it on the client, and all is well up to that point.</p>
<p>Now for the part that drives me nuts.</p>
<p>Here is the JavaScript function I am using to delete the cookie:</p>
<pre><code>function deleteCookie(name) {
var cookieDate = new Date();
cookieDate.setTime(cookieDate.getTime() - 1);
document.cookie = (name + "=; expires=" + cookieDate.toGMTString());
}
</code></pre>
<p>So, of course, at some point after the cookie is set, I delete it like so:</p>
<pre><code>deleteCookie("MyCookie");
</code></pre>
<p>Only, that doesn't do the job; the cookie still exists. So, anyone know why?</p>
|
<p>you have to delete your cookie at the same path where you created it.
so create your cookie with path=/ and delte it with path=/ as well..</p>
|
<p>Are we sure there's no code that sets the Cookie to HttpOnly (we're not missing anything above)? The HttpOnly property will stop (modern) browsers from modifying the cookie. I'd be interested to see if you can kill it server side like Rob suggests.</p>
| 7,970
|
<p>At the company I work for we have a "Utility" project that is referenced by pretty much ever application we build. It's got lots of things like NullHelpers, ConfigSettingHelpers, Common ExtensionMethods etc.</p>
<p>The way we work is that when we want to make a new project, we get the latest version of the project from source control add it to the solution and then reference the project from any new projects that get added to the solution.</p>
<p>This has worked ok, however there have been a couple of instances where people have made "breaking changes" to the common project, which works for them, but doesn't work for others.</p>
<p>I've been thinking that rather than adding the common library as a project reference perhaps we should start developing the common library as a standalone dll and publish different versions and target a particular version for a particular project so that changes can be made without any risk to other projects using the common library.</p>
<p>Having said all that I'm interested to see how others reference or use their common libraries.</p>
|
<p>That's exactly what we're doing. We have a Utility project which has some non project specific useful functions. We increase the version manually (minor), build the project in Release version, sign it and put it to a shared location.</p>
<p>People then use the specific version of the <em>library</em>.</p>
<p>If some useful methods are implemented in some specific projects which could find their way into main Utility project, we put the to a special helper class in the project, and mark them as a possible Utility candidate (simple //TODO). At the end of the project, we review the candidates and if they stick, we move them to the main <em>library</em>.</p>
<p>Breaking changes are a no-no and we mark methods and classes as [Obsolete] if needed. </p>
<p>But, it doesn't really matter because we increase the version on every publish.</p>
<p>Hope this helps.</p>
|
<p>I've had the <em>EXACT</em> same issue!</p>
<p>I used to use project references, but it all seems to go bad, when as you say, you have many projects referencing it.</p>
<p>I now compile to a DLL, and set the CopyLocal property for the DLL reference to false after the first build (otherwise I find it can override sub projects and just become a mess).</p>
<p>I guess in theory it should probably be GAC'ed, but if its a problem that is changing a lot (as mine is) this can become problematic..</p>
| 6,268
|
<p>As stated in the title, i'm looking for an XML schema (XSD-file) for the Glade markup language?</p>
<p>Wikipedia states that <strong>Glade</strong> is a schema based markup language (<a href="http://en.wikipedia.org/wiki/List_of_XML_Schemas#Graphical_User_Interfaces" rel="nofollow noreferrer">list of schemas at wikipedia</a>). I tried to search the web, wikipedia and the glade website,but i couldn't find an XSD for Glade.</p>
<p>Thx,
Juve</p>
|
<p>There's nothing that will explicitly tie down the glade to an particular schema since it's all run-time based.</p>
<p>You may find the .defs files generated by PyGTK useful. If you really need an XSD file, you should be able to create one from these files.</p>
<p><a href="http://svn.gnome.org/viewvc/pygtk/trunk/gtk/gtk-base-types.defs?view=markup" rel="nofollow noreferrer">This</a> looks like the main one, there's more in that directory.</p>
|
<p>Thx, this is a first start. I assume there is no document that is more explicit that this DTD? This DTD only specyfies what (global) tags can be used. Especially for the tag <widget> i would like a have constraints on the attribute "class" (as supported by XSD). The XSD should cover that there are only certain values for the <widgets'> "class" attribute, like GtKTreeView, etc.</p>
| 9,061
|
<p>I have an SSIS package that exports data to a couple of Excel files for transfer to a third party. To get this to run as a scheduled job on a 64-bit server I understand that I need to set the step as a CmdExec type and call the 32-bit version of DTExec. But I don't seem to be able to get the command right to pass in the connection string for the Excel files.</p>
<p>So far I have this: </p>
<pre><code>DTExec.exe /SQL \PackageName /SERVER OUR2005SQLSERVER /CONNECTION
LETTER_Excel_File;\""Provider=Microsoft.Jet.OLEDB.4.0";"Data
Source=""C:\Temp\BaseFiles\LETTER.xls";"Extended Properties=
""Excel 8.0;HDR=Yes"" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING E
</code></pre>
<p>This gives me the error: <strong><code>Option "Properties=Excel 8.0;HDR=Yes" is not valid.</code></strong></p>
<p>I've tried a few variations with the Quotation marks but have not been able to get it right yet.</p>
<p>Does anyone know how to fix this?</p>
<p><strong><code>UPDATE:</code></strong></p>
<p>Thanks for your help but I've decided to go with CSV files for now, as they seem to just work on the 64-bit version.</p>
|
<p>This step-by-step example is for others who might stumble upon this question. This example uses <em>SSIS 2005</em> and uses <em>SQL Server 2005 64-bit edition server</em> to run the job.</p>
<p>The answer here concentrates only on fixing the error message mentioned in the question. The example will demonstrate the steps to recreate the issue and also the cause of the issue followed by how to fix it.</p>
<p><strong><code>NOTE:</code></strong> I would recommend using the option of storing the package configuration values in database or using indirect XML configuration with the help of Environment Variables. Also, the steps to create Excel file would be done using a template which would then archived by moving to a different folder. These steps are not discussed in this post. As mentioned earlier, the purpose of this post is to address the error.</p>
<p>Let’s proceed with the example. I have also blogged about this answer, which can be found in <a href="http://learnbycoding.com/2011/07/accessing-excel-data-source-from-an-ssis-package-that-is-deployed-on-a-64-bit-server/" rel="nofollow noreferrer">this link</a>. It is the same answer.</p>
<p>Create an SSIS package (<a href="http://learnbycoding.com/2011/07/creating-a-simple-ssis-package-using-bids/" rel="nofollow noreferrer">Steps to create an SSIS package</a>). This example uses BIDS 2005. I have named the package in the format YYYYMMDD_hhmm in the beginning followed by SO stands for Stack Overflow, followed by the SO question id, and finally a description. I am not saying that you should name your package like this. This is for me to easily refer this back later. Note that I also have a Data Sources named Adventure Works. I will be using Adventure Works data source, which points to AdventureWorks database downloaded from <a href="http://msftdbprodsamples.codeplex.com/" rel="nofollow noreferrer">this link</a>. The example uses SQL Server 2008 R2 database. Refer screenshot <strong>#1</strong>.</p>
<p>In the AdventureWorks database, create a stored procedure named <em>dbo.GetCurrency</em> using the below given script.</p>
<pre><code>CREATE PROCEDURE [dbo].[GetCurrency]
AS
BEGIN
SET NOCOUNT ON;
SELECT
TOP 10 CurrencyCode
, Name
, ModifiedDate
FROM Sales.Currency
ORDER BY CurrencyCode
END
GO
</code></pre>
<p>On the package’s Connection Manager section, right-click and select <em>New Connection From Data Source</em>. On the <em>Select Data Source</em> dialog, select <em>Adventure Works</em> and click OK. You should now see the Adventure Works data source under the <em>Connection Managers</em> section.</p>
<p>On the package’s Connection Managers section, right-click again but this time select <em>New Connection…</em>. This is to create the Excel connection. On the Add SSIS Connection Manager, select <em>EXCEL</em>. On the Excel Connection Manager, enter the path <em>C:\Temp\Template.xls</em>. When we deploy it to the server, we will change this path. I have selected Excel version <em>Microsoft Excel 97-2005</em> and chose to leave the checkbox <em>First row has column names</em> checked so that the create the Excel file is created column headers. Click <em>OK</em>. Rename the Excel connection to <em>Excel</em>, just to keep it simple. Refer screenshots <strong>#2</strong> - <strong>#7</strong>.</p>
<p>On the package, create the following variable. Refer screenshot <strong>#8</strong>.</p>
<ul>
<li><em>SQLGetData</em>: This variable is of type String. This will contain the Stored Procedure execution statement. This example uses the value <em>EXEC dbo.GetCurrency</em></li>
</ul>
<p>Screenshot <strong>#9</strong> shows the output of the stored procedure execution statement <em>EXEC dbo.GetCurrency</em></p>
<p>On the package’s Control Flow tab, place a <code>Data Flow task</code> and name it as Export to Excel. Refer screenshot <strong>#10</strong>.</p>
<p>Double-click on the Data Flow Task to switch to the Data Flow tab.</p>
<p>On the Data Flow tab, place an <code>OLE DB Source</code> to connect to the SQL Server data to fetch the data from the stored procedure and name it as SQL. Double-click on the OLE DB Source to bring up the OLE DB Source Editor. On the Connection Manager section, select <em>Adventure Works</em> from the OLE DB connection manager, select SQL command from variable from Data access mode and select the variable <em>User::SQLGetData</em> from the Variable name drop down. On the Columns section, make sure the column names are mapped correctly. Click OK to close the OLE DB Source Editor. Refer screenshots <strong>#11</strong> and <strong>#12</strong>.</p>
<p>On the Data Flow tab, place an <code>Excel Destination</code> to insert the data into the Excel file and name it as Excel. Double-click on the Excel Destination to open the Excel Destination Editor. On the Connection Manager section, select Excel from the OLE DB connection manager and select Table or view from Data access mode. At this point, we don’t have an Excel because while creating the Excel connection manager, we simply specified the path but never created the file. Hence, there won’t be any values in the drop down Name of the Excel sheet. So, click the <em>New…</em> button (the second New one) to create a new Excel sheet. On the Create Table window, BIDS automatically provide a create sheet based on the incoming data source. You can change the values according to your preferences. I will simply click OK by retaining the default value. The name of the sheet will be populated in the drop down Name of the Excel sheet. The name of the sheet is taken from the task name, here in this case the Excel Destination, which we have named it as Excel. On the Mappings section, make sure the column names are mapped correctly. Click OK to close the Excel Destination Editor. Refer screenshots <strong>#13</strong> - <strong>#16</strong>.</p>
<p>Once the data flow task is configured, it should look like as shown in screenshot <strong>#17</strong>.</p>
<p>Execute the package by pressing F5. Screenshots <strong>#18</strong> - <strong>#21</strong> show the successful execution of the package in both Control Flow and Data Flow Task. Also, the file is generated in the path <em>C:\Temp\Template.xls</em> provided in the Excel connection and the data shown in the stored procedure execution output matches with the data written to the file.</p>
<p>The package developed on my local machine in the folder path <em>C:\Learn\Learn.VS2005\Learn.SSIS</em>. Now, we need to deploy the files on to the Server that hosts the 64-bit version of the SQL Server to schedule a job. So, the folder on the server would be <em>D:\SSIS\Practice</em>. Copy the package file (<strong>.dtsx</strong>) from the local machine and paste it in the server folder. Also, in order for the package to run correctly, we need to have the Excel spreadsheet present on the server. Otherwise, the validation will fail. Usually, I create a Template folder that will contain the empty Excel spreadsheet file that matches the output. Later, during run time I will change the Excel output path to a different location using package configuration. For this example, I am going to keep it simple. So, let’s copy the Excel file generated in the local machine in the path <em>C:\Temp\Template.xls</em> to the server location <em>D:\SSIS\Practice</em>. I want the SQL job to generate the file in the name Currencies.xls. So, rename the file Template.xls to <em>Currencies.xls</em>. Refer screenshot <strong>#22</strong>.</p>
<p>To show that I am indeed going to run the job on the server in a 64-bit edition of SQL Server, I executed the command SELECT @@version on the SQL Server and screenshot <strong>#23</strong> shows the results.</p>
<p>We will use <em>Execute Package Utility</em> (dtexec.exe) to generate the command line parameters. Log into the server which will run the SSIS package in an SQL job. Double-click on the package file, this will bring the Execute Package Utility. On the General section, select File system from Package source. Click on the Ellipsis and browse to the package path. On the Connection Managers section, select Excel and change the path inside the Excel file from C:\Temp\Template.xls to D:\SSIS\Practice\Currencies.xls. The changes made in the Utility will generate a command line accordingly on the Command Line section. On the Command Line section, copy the Command line that contains all the necessary parameters. We are not going to execute the package from here. Click <em>Close</em>. Refer screenshots <strong>#24</strong> - <strong>#26</strong>.</p>
<p>Next, we need to set up a job to run the SSIS package. We cannot choose SQL Server Integration Services Package type because that will run under 64-bit and won’t find the Excel connection provider. So, we have to run it as <code>Operating System (CmdExec)</code> job type. Go to SQL Server Management Studio and connect to the Database Engine. Expand SQL Server Agent and right-click on Jobs node. Select New Job…. On the General section of the Job Properties window, provide the job name as 01_SSIS_Export_To_Excel, Owner will be the user creating the job. I have a Category named SSIS, so I will select that but the default category is <em>[Uncategorized (Local)]</em> and provide a brief description. On the Steps section, click <em>New…</em> button. This will bring Job Step properties. On the General section of the Job Step properties, provide Step name as Export to Excel, Select type <code>Operating system (CmdExec)</code>, leave the default Run as account as SQL Server Agent Service Account and provide the following Command. Click OK. On the New Job window, Click OK. Refer screenshots <strong>#27</strong> - <strong>#31</strong>.</p>
<pre><code>C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\DTExec.exe /FILE
"D:\SSIS\Practice\20110723_1015_SO_21448_Excel_64_bit_Error.dtsx"
/CONNECTION Excel;"\"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\SSIS\Practice\Currencies.xls;Extended Properties=""EXCEL 8.0;HDR=YES"";\""
/MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING EWCDI
</code></pre>
<p>The new job should appear under SQL Server Agent –> Jobs node. Right-click on the newly created job 01_SSIS_Export_To_Excel and select <em>Start Job at Step…</em>, this will commence the job execution. The job will fail as expected because that is the context of this issue. Click Close to close the Start Jobs dialog. Refer screenshots <strong>#32</strong> and <strong>#33</strong>.</p>
<p>Let’s take a look at what happened. Go to SQL Server Agent and Jobs node. Right-click on the job 01_SSIS_Export_To_Excel and select View History. This will bring the Log File Viewer window. You can notice that the job failed. Expand the node near the red cross and click on the line that Step ID value of 1. At the bottom section, you can see the error message <strong><code>Option “8.0;HDR=YES’;” is not valid.</code></strong> Click Close to close the Log File Viewer window. Refer screenshots <strong>#34</strong> and <strong>#35</strong>.</p>
<p>Now, right-click on the job and select Properties to open the Job Properties. You can also double-click on the job to bring the Job Properties window. Click on the Steps on the left section. and click Edit. Replace the command with the following command and click OK. Click OK on the Job Properties to close the window. Right-click on the job 01_SSIS_Export_To_Excel and select Start Job at Step…, this will commence the job execution. The job will fail execute successfully. Click Close to close the Start Jobs dialog. Let’s take a look at the history. Right-click on the job 01_SSIS_Export_To_Excel and select View History. This will bring the Log File Viewer window. You can notice that the job succeeded during the second run. Expand the node near the green tick cross and click on the line that Step ID value of 1. At the bottom section, you can see the message Option The step succeeded. Click Close to close the Log File Viewer window. The file D:\SSIS\Practice\Currencies.xls will be successfully populated with the data. If you execute the job successfully multiple times, the data will get appended to the file and you will find more data. As I mentioned earlier, this is not the right-way to generate the files. This example was created to demonstrate a fix for this issue. Refer screenshots <strong>#36</strong> - <strong>#38</strong>.</p>
<p>Screenshot <strong>#39</strong> shows the differences between the working and the non-working command line arguments. The one on the right is the working command line and the left one is incorrect. It required another double quotes with backslash escape sequence to fix the error. There could be other ways to fix this well but this option seems to work.</p>
<p>Thus, the example demonstrated a way to fix the command line argument issue while accessing Excel data source from an SSIS package that is deployed on a 64-bit server.</p>
<p>Hope that helps someone.</p>
<p><strong>Screenshots:</strong></p>
<p><strong>#1:</strong> Solution_Explorer</p>
<p><img src="https://i.stack.imgur.com/8LXYw.png" alt="Solution_Explorer"></p>
<p><strong>#2:</strong> New_Connection_Data_Source</p>
<p><img src="https://i.stack.imgur.com/kLUaJ.png" alt="New_Connection_Data_Source"></p>
<p><strong>#3:</strong> Select_Data_Source</p>
<p><img src="https://i.stack.imgur.com/dctco.png" alt="Select_Data_Source"></p>
<p><strong>#4:</strong> New_Connection</p>
<p><img src="https://i.stack.imgur.com/ENgBq.png" alt="New_Connection"></p>
<p><strong>#5:</strong> Add_SSIS_Connection_Manager</p>
<p><img src="https://i.stack.imgur.com/e477v.png" alt="Add_SSIS_Connection_Manager"></p>
<p><strong>#6:</strong> Excel_Connection_Manager</p>
<p><img src="https://i.stack.imgur.com/rLuSb.png" alt="Excel_Connection_Manager"></p>
<p><strong>#7:</strong> Connection_Managers</p>
<p><img src="https://i.stack.imgur.com/Tw4K1.png" alt="Connection_Managers"></p>
<p><strong>#8:</strong> Variables</p>
<p><img src="https://i.stack.imgur.com/wOuU5.png" alt="Variables"></p>
<p><strong>#9:</strong> Stored_Procedure_Output</p>
<p><img src="https://i.stack.imgur.com/mynyS.png" alt="Stored_Procedure_Output"></p>
<p><strong>#10:</strong> Control_Flow</p>
<p><img src="https://i.stack.imgur.com/DTucs.png" alt="enter image description here"></p>
<p><strong>#11:</strong> OLE_DB_Source_Connections_Manager</p>
<p><img src="https://i.stack.imgur.com/tLHQP.png" alt="OLE_DB_Source_Connections_Manager"></p>
<p><strong>#12:</strong> OLE_DB_Source_Columns</p>
<p><img src="https://i.stack.imgur.com/uxZZ4.png" alt="OLE_DB_Source_Columns"></p>
<p><strong>#13:</strong> Excel_Destination_Editor_New</p>
<p><img src="https://i.stack.imgur.com/nyUgx.png" alt="Excel_Destination_Editor_New"></p>
<p><strong>#14:</strong> Excel_Destination_Create_Table</p>
<p><img src="https://i.stack.imgur.com/UN5xT.png" alt="Excel_Destination_Create_Table"></p>
<p><strong>#15:</strong> Excel_Destination_Edito</p>
<p><img src="https://i.stack.imgur.com/RdH54.png" alt="Excel_Destination_Edito"></p>
<p><strong>#16:</strong> Excel_Destination_Mappings</p>
<p><img src="https://i.stack.imgur.com/iPO8y.png" alt="Excel_Destination_Mappings"></p>
<p><strong>#17:</strong> Data_Flow</p>
<p><img src="https://i.stack.imgur.com/wLxa4.png" alt="Data_Flow"></p>
<p><strong>#18:</strong> Successful_Package_Execution_Control</p>
<p><img src="https://i.stack.imgur.com/TZ0ou.png" alt="Successful_Package_Execution_Control"></p>
<p><strong>#19:</strong> Successful_Package_Execution_Data_Flow</p>
<p><img src="https://i.stack.imgur.com/FI6VA.png" alt="Successful_Package_Execution_Data_Flow"></p>
<p><strong>#20:</strong> C_Temp_File_Created</p>
<p><img src="https://i.stack.imgur.com/VMjnn.png" alt="C_Temp_File_Created"></p>
<p><strong>#21:</strong> Data_Populated</p>
<p><img src="https://i.stack.imgur.com/IYhUg.png" alt="Data_Populated"></p>
<p><strong>#22:</strong> File_On_Server</p>
<p><img src="https://i.stack.imgur.com/k7hKu.png" alt="File_On_Server"></p>
<p><strong>#23:</strong> SQL_Server_Version</p>
<p><img src="https://i.stack.imgur.com/n2gpY.png" alt="SQL_Server_Version"></p>
<p><strong>#24:</strong> Execute_Package_Utility_General</p>
<p><img src="https://i.stack.imgur.com/ZNCW0.png" alt="Execute_Package_Utility_General"></p>
<p><strong>#25:</strong> Execute_Package_Utility_Connection_Managers</p>
<p><img src="https://i.stack.imgur.com/o39ar.png" alt="Execute_Package_Utility_Connection_Managers"></p>
<p><strong>#26:</strong> Execute_Package_Utility_Command_Line</p>
<p><img src="https://i.stack.imgur.com/mq9Ts.png" alt="Execute_Package_Utility_Command_Line"></p>
<p><strong>#27:</strong> Job_New_Job</p>
<p><img src="https://i.stack.imgur.com/Dx17J.png" alt="Job_New_Job"></p>
<p><strong>#28:</strong> New_Job_General</p>
<p><img src="https://i.stack.imgur.com/Wwk7H.png" alt="New_Job_General"></p>
<p><strong>#29:</strong> New_Job_Step</p>
<p><img src="https://i.stack.imgur.com/5VDWF.png" alt="New_Job_Step"></p>
<p><strong>#30:</strong> New_Job_Step_General </p>
<p><img src="https://i.stack.imgur.com/MTXMT.png" alt="New_Job_Step_General"></p>
<p><strong>#31:</strong> New_Job_Steps_Added</p>
<p><img src="https://i.stack.imgur.com/p9IeS.png" alt="New_Job_Steps_Added"></p>
<p><strong>#32:</strong> Job_Start_Job_at_Step</p>
<p><img src="https://i.stack.imgur.com/Qpef2.png" alt="Job_Start_Job_at_Step"></p>
<p><strong>#33:</strong> SQL_Job_Execution_Failure</p>
<p><img src="https://i.stack.imgur.com/qSPdR.png" alt="SQL_Job_Execution_Failure"></p>
<p><strong>#34:</strong> View_History</p>
<p><img src="https://i.stack.imgur.com/xZqWk.png" alt="View_History"></p>
<p><strong>#35:</strong> SQL_Job_Error_Message</p>
<p><img src="https://i.stack.imgur.com/oYovo.png" alt="SQL_Job_Error_Message"></p>
<p><strong>#36:</strong> SQL_Job_Execution_Success</p>
<p><img src="https://i.stack.imgur.com/fYeKc.png" alt="SQL_Job_Execution_Success"></p>
<p><strong>#37:</strong> SQL_Job_Success_Message</p>
<p><img src="https://i.stack.imgur.com/3yEQe.png" alt="SQL_Job_Success_Message"></p>
<p><strong>#38:</strong> Excel_File_Generated</p>
<p><img src="https://i.stack.imgur.com/ovlVm.png" alt="Excel_File_Generated"></p>
<p><strong>#39:</strong> Command_Comparison</p>
<p><img src="https://i.stack.imgur.com/2h7mX.png" alt="39_Command_Comparison"></p>
|
<p>I kinda did what Dr Zim did but I copied the DTExec file <code>C:\Program Files (x86)\Microsoft SQL Server\90\DTS\Binn\DTExec.exe</code> to <code>C:\Program Files\Microsoft SQL Server\90\DTS\Binn\</code> folder but named the 32 bit one to DTExec32.exe</p>
<p>then I was able to run my SSIS script through a stored proc:</p>
<pre><code>set @params = '/set \package.variables[ImportFilename].Value;"\"' + @FileName + '\"" '
set @cmd = 'dtexec32 /SQ "' + @packagename + ' ' + @params + '"'
--DECLARE @returncode int
exec master..xp_cmdshell @cmd
--exec @returncode = master..xp_cmdshell @cmd
--select @returncode
</code></pre>
| 4,160
|
<p>Why is it that if I execute a gcode command that causes the stepper motor to turn in reverse (any negative move on the X axis), after the step it will emit a high pitched whine until it gets another command to rotate in its forward direction?</p>
<p>Executing multiple reverse commands will cause the tone to vary in frequency each step, and always it goes away after another step in the opposite (forward) direction. </p>
<p>Sometimes.</p>
<p>And other times it does it in both directions, but only on every other step. One step +X its there, next step its gone, next step its back, and so on...</p>
<p>Then they also make a different noise when idle, before I disable them with the "disable steppers" command.</p>
<p>What are these noises?</p>
<p>And is it bad to leave the motors in this state? Will it burn them out?</p>
|
<p>When idle, the stepper is stationary, no rotation.</p>
<p>Normal standard electric motors will start spinning as soon as you apply power to them. However, steppers only rotate when a magnetic field is applied<sup>1)</sup>:</p>
<blockquote>
<p>Stepper motors effectively have multiple "toothed" electromagnets
arranged around a central gear-shaped piece of iron. The
electromagnets are energized by an external driver circuit or a micro
controller. To make the motor shaft turn, first, one electromagnet is
given power, which magnetically attracts the gear's teeth. When the
gear's teeth are aligned to the first electromagnet, they are slightly
offset from the next electromagnet. This means that when the next
electromagnet is turned on and the first is turned off, the gear
rotates slightly to align with the next one. From there the process is
repeated. Each of those rotations is called a "step", with an integer
number of steps making a full rotation. In that way, the motor can be
turned by a precise angle.</p>
<p>The motor's position can then be commanded to move and hold at one of
these steps without any position sensor for feedback (an open-loop
controller), as long as the motor is carefully sized to the
application in respect to torque and speed.</p>
</blockquote>
<p>When you power the printer and energyze the steppers there is no movement, but, the magnetic coils in the stepper are activated to hold the rotor in position. This is controlled by the stepper driver. The creation of the signal for the magnetic coils is causing the noise. It is a function of the driver type, micro-stepping setting, the stepper motor inductance, current setting and supply voltage.</p>
<p>If the stepper motor, stepper driver and power supply can take it, increasing the current setting of the driver may lower the noise.</p>
<p>Turning off the steppers (disabling them with <a href="https://reprap.org/wiki/G-code" rel="nofollow noreferrer">G-code</a> using <code>M2</code>, <code>M18</code>, or <code>M84</code> depending on your firmware) will stop the noise, but you will easily lose the current position as it is not hold into place anymore.</p>
<hr />
<p><sup>1)</sup> source <a href="https://en.wikipedia.org/wiki/Stepper_motor" rel="nofollow noreferrer">Wikipedia</a></p>
|
<p>this is normalISH for stepper motors. they have a fair ammount of current pulsing through them at relatively high frequencies, coils and other parts that will vibrate. if it quite loud you can look into the boards that drive them, depending on your printer they are replaceable, and better 'drivers' send cleaner signals that make less noise. however: if your motors get hot or start making clicking noises, or stop randomly, or acting up more significantly, you should look adjusting how much current they are getting. search for stepper motor calibration, basically you need to adjust the ammount of current the motors are getting, but if the machine prints normally, then this is not something you want to play with. you can also probably find the data sheet for your motor, they are usually rated to operate up to about 50C</p>
| 1,138
|
<p>How do you schedule a Windows Mobile application to periodically start up to perform some background processing. For example, assume I'm writing an email client and want to check for email every hour, regardless of whether my app is running at the time.</p>
<p>The app is a native C/C++ app on Windows Mobile 5.0 or later.</p>
|
<p>the function you need is:</p>
<p><code>CeRunAppAtTime( appname, time )</code></p>
<p>that isn't the exact signature, there is also <code>CeRunAppAtEvent</code>, they should both be in the MSDN docs (but linking is useless the way MSDN urls always change)</p>
<p>The normal way to use these (and <code>RunAppAtTime</code> in the managed world via <code>OpenNETCF.Win32.Notify</code> ) is that for periodic execution, every time your app runs, it will rescedule itself for its next run-time.</p>
<p>If your app is running, the new instance should bring up the already running process. If it isn't running, then it is just like starting up normally - from mmory it passes some argument to the process so it can tell it is being scheduled and not started some other way.</p>
|
<p>Use CeSetUserNotificationEx instead of CeRunAppAtTime (as this is deprecated).</p>
| 7,088
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.