instruction
stringlengths 27
22.5k
| chosen
stringlengths 27
28.2k
| rejected
stringlengths 19
24.9k
| __index_level_0__
int64 0
10k
|
|---|---|---|---|
<p>What are the best code snippets for C#? (using visual studio) VB has a lot that are pre-defined, but there are only a handful for C#. Do you have any really useful ones for C#?</p>
<p>Anyone want to post a good custom one you created yourself?</p>
<p><a href="http://en.wikipedia.org/wiki/Ferris_Bueller" rel="noreferrer">Anyone?... Bueller?</a></p>
|
<p>There's plenty of code snippets within Visual Studio for basic programming structure but I wouldn't necessarily rate one higher than another. </p>
<p>I would definitely say the best ones are the custom snippets you define yourself to accomplish more specific tasks that you may find yourself using on a regular basis. Definitely a big time saver. </p>
<p>A fairly basic intro to creating custom snippets can be found at <a href="http://www.15seconds.com/issue/080724.htm" rel="noreferrer">http://www.15seconds.com/issue/080724.htm</a> to help with this.</p>
|
<p>prop and exception are my favorites.</p>
| 7,030
|
<p>I have a homemade 3D printer running on ramps 1.4
When i start a new print and the hotend reaches melting point of PLA, the PLA start coming out of the hotend.<br>
This goes on for as long as the temperature is kept above melting point, without moving the extrusion gear. </p>
<p>The extruder is a bowden type.<br>
Hotend is a J-head.<br>
I am currently using simplify if that makes any difference regarding configuration.</p>
<p>Any ideas what to do to prevent this from happening?</p>
|
<blockquote>
<p>Any ideas what to do to prevent this from happening?</p>
</blockquote>
<p>You cannot prevent it entirely, but <strong>you can probably mitigate the problem by depressing the lever that squashes the filament against the hobbed gear of the extruder</strong> before starting to heat the nozzle.</p>
<p>In bowden extruders, the long portion of filament between the stepper motor and the nozzle is subject to compression during the print. Because of the hysteresis in the filament, and of the slack between filament and PTFE tube, this filament acts like a slow-releasing compression spring. When the nozzle cools down, the potential energy stored in the filament is "frozen" in place.</p>
<p>By depressing the lever, you allow the spring to extend "backward" towards the spool, rather than "forward" through the nozzle.</p>
<p>Some oozing is still bound to happen because of gravity and - as highlighted by others - thermal expansion, but it should be significantly less.</p>
<p><strong>If you adopt the lever trick, remember to print with a skirt</strong>, as you will want the printer to recreate that "compression" in the filament before the model proper begins.</p>
<p><strong>Another way to address the issue would be to add a little bit of retraction</strong> in the closing stanza of your GCODE (the part where you also tell the printer to unpower the steppers and stop heating). This will prevent any "compression" to be "frozen" in the first place.</p>
<p>This anwer is based on the assumption that the stepper motor is not actively spinning (i.e.: yours is not a hardware/firmware issue).</p>
|
<p>Does it really go on for more than a minute or so? You can't get filament from nowhere, so if the feed gear isn't moving, sooner or later all the material in the reservoir inside the nozzle & hotend will be melted and gone. Leakage like this is normal, and probably a lot more noticeable if you have a larger diameter nozzle. </p>
<p>I would recommend checking to see if your gcode includes a large retraction at the end of the print. That would reduce the pressure and the amount of material left inside the hotend. </p>
| 811
|
<p>The Open/Closed Principle states that software entities (classes, modules, etc.) should be open for extension, but closed for modification. What does this mean, and why is it an important principle of good object-oriented design?</p>
|
<p>It means that you should put new code in new classes/modules. Existing code should be modified only for bug fixing. New classes can reuse existing code via inheritance.</p>
<p>Open/closed principle is intended to mitigate risk when introducing new functionality. Since you don't modify existing code you can be assured that it wouldn't be broken. It reduces maintenance cost and increases product stability.</p>
|
<p>This means that the OO software should be built upon, but not changed intrinsically. This is good because it ensures reliable, predictable performance from the base classes. </p>
| 8,348
|
<p>What is the best way to backup VMWare Servers (1.0.x)?
The virtual machines in question are our development environment, and run isololated from the main network (so you can't just copy data from virtual to real servers).</p>
<p>The image files are normally in use and locked when the server is running, so it is difficult to back these up with the machines running.</p>
<p>Currently: I manually pause the servers when I leave and have a scheduled task that runs at midnight to robocopy the images to a remote NAS. </p>
<p>Is there a better way to do this, ideally without having to remember to pause the virtual machines?</p>
|
<p>VMWare server includes the command line tool "vmware-cmd", which can be used to perform virtually any operation that can be performed through the console.</p>
<p>In this case you would simply add a "vmware-cmd susepend" to your script before starting your backup, and a "vmware-cmd start" after the backup is completed.</p>
<p>We use vmware-server as part of our build system to provide a known environment to run automated DB upgrades against, so we end up rolling back state as part of each build (driven by CruiseControl), and have found this interface to be rock solid.</p>
<pre><code>Usage: /usr/bin/vmware-cmd <options> <vm-cfg-path> <vm-action> <arguments>
/usr/bin/vmware-cmd -s <options> <server-action> <arguments>
Options:
Connection Options:
-H <host> specifies an alternative host (if set, -U and -P must also be set)
-O <port> specifies an alternative port
-U <username> specifies a user
-P <password> specifies a password
General Options:
-h More detailed help.
-q Quiet. Minimal output
-v Verbose.
Server Operations:
/usr/bin/vmware-cmd -l
/usr/bin/vmware-cmd -s register <config_file_path>
/usr/bin/vmware-cmd -s unregister <config_file_path>
/usr/bin/vmware-cmd -s getresource <variable>
/usr/bin/vmware-cmd -s setresource <variable> <value>
VM Operations:
/usr/bin/vmware-cmd <cfg> getconnectedusers
/usr/bin/vmware-cmd <cfg> getstate
/usr/bin/vmware-cmd <cfg> start <powerop_mode>
/usr/bin/vmware-cmd <cfg> stop <powerop_mode>
/usr/bin/vmware-cmd <cfg> reset <powerop_mode>
/usr/bin/vmware-cmd <cfg> suspend <powerop_mode>
/usr/bin/vmware-cmd <cfg> setconfig <variable> <value>
/usr/bin/vmware-cmd <cfg> getconfig <variable>
/usr/bin/vmware-cmd <cfg> setguestinfo <variable> <value>
/usr/bin/vmware-cmd <cfg> getguestinfo <variable>
/usr/bin/vmware-cmd <cfg> getid
/usr/bin/vmware-cmd <cfg> getpid
/usr/bin/vmware-cmd <cfg> getproductinfo <prodinfo>
/usr/bin/vmware-cmd <cfg> connectdevice <device_name>
/usr/bin/vmware-cmd <cfg> disconnectdevice <device_name>
/usr/bin/vmware-cmd <cfg> getconfigfile
/usr/bin/vmware-cmd <cfg> getheartbeat
/usr/bin/vmware-cmd <cfg> getuptime
/usr/bin/vmware-cmd <cfg> getremoteconnections
/usr/bin/vmware-cmd <cfg> gettoolslastactive
/usr/bin/vmware-cmd <cfg> getresource <variable>
/usr/bin/vmware-cmd <cfg> setresource <variable> <value>
/usr/bin/vmware-cmd <cfg> setrunasuser <username> <password>
/usr/bin/vmware-cmd <cfg> getrunasuser
/usr/bin/vmware-cmd <cfg> getcapabilities
/usr/bin/vmware-cmd <cfg> addredo <disk_device_name>
/usr/bin/vmware-cmd <cfg> commit <disk_device_name> <level> <freeze> <wait>
/usr/bin/vmware-cmd <cfg> answer
</code></pre>
|
<p>If I recall correctly, VMWare Server has a scripting interface, available via Perl or COM. You might be able to use that to automatically pause the VMs before running the backup.</p>
<p>If your backup software was shadow-copy aware, that might work, too.</p>
| 9,608
|
<p>I have a Monoprice Select v2 that I just bought less than 2 months ago. I've manually leveled it on several prints prior.</p>
<p>I noticed a couple of holes in my print bed after my last print, like the extruder pushed into the sheet really hard. They're both on the same side.</p>
<p>I then noticed that the extruder's horizontal bar wasn't leveled so I leveled it. I did this by unplugging the wire to one motor and modified the z-position so that the other connected side would go up. (Is this the proper way of adjusting the horizontal bar?)</p>
<p>And then I moved the extruder back into its Home position at z-position 0.
That's when I noticed that it seems my extruder barely reaches my print bed even though I have the screws almost loosened to the point of detaching from the thread.</p>
<p>The extruder z-limit-switch (I think that's what it's called) seems to be pressed so the extruder is as far down as it can go. The controls also show that the z-position is at 0.</p>
<p>So I'm guessing my print bed somehow lowered. But I don't see how that could possibly be.</p>
<p>Any ideas?</p>
<p>Here are some photos but I'm not even sure what to show really</p>
<p>you can see the z-limit-switch in the right of this pic next to the letter A's
<a href="https://i.stack.imgur.com/jj6hS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jj6hS.jpg" alt="pic1"></a>
you can see my extruder still has some distance to go before reaching my print bed but you can also see that my screws are loosened as much as possible
<a href="https://i.stack.imgur.com/NUOdX.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NUOdX.jpg" alt="pic2"></a>
showing the horizontal extruder bar is now leveled
<a href="https://i.stack.imgur.com/RyK5o.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RyK5o.jpg" alt="pic3"></a></p>
|
<p>You decide which layer height you want based on the quality you desire, but never go over about 75 % of your nozzle diameter, so with your 0.4 mm nozzle never choose layer heights larger than 0.3 mm. The rationale of this rule of thumb is that the filament leaves the nozzle as a tube and needs to be flattened to make it adhere to the previous layer.</p>
|
<p>You decide which layer height you want based on the quality you desire, but never go over about 75 % of your nozzle diameter, so with your 0.4 mm nozzle never choose layer heights larger than 0.3 mm. The rationale of this rule of thumb is that the filament leaves the nozzle as a tube and needs to be flattened to make it adhere to the previous layer.</p>
| 1,166
|
<p>Is there a way to get at the ItemContaner of a selected item in a listbox? In Silverlight 2.0 Beta 1 I could, but the container is hidden in Beta 2 of Silverlight 2.0. </p>
<p>I'm trying to resize the listbox item when it is unselected to a specific size and when selected to a variable size. I also want to get the relative position of the selected item for animations. Growing to a variable size and getting the relative pasition is why i need to get to the listbox item.</p>
<p>I should clarify i'm not adding items to the listbox explicitly. I am using data binding in xaml and DataTemplates. What I have trouble accessing is the ItemContainer of the selected item's DataTemplate.</p>
|
<p>There is a way to obtain the Panel containing the item's UIElement and the mapping of items to UIElements. You have to inherit from ListBox (this actually works for any ItemsControl) and override PrepareContainerForItemOverride:</p>
<pre><code>protected override void PrepareContainerForItemOverride(DependencyObject element, object item)
{
base.PrepareContainerForItemOverride(element, item);
var el = element as FrameworkElement;
if (el != null)
{
// here is the elements's panel:
_itemsHost = el.Parent as Panel;
// item is original item inserted in Items or ItemsSource
// we can save the mapping between items and FrameworElements:
_elementMapping[item] = el;
}
}
</code></pre>
<p>This is kind of hackish, but it works just fine.</p>
|
<p>If you are adding non-UI elements to the listbox (such as strings or non-UI data objects), then this is probably pretty difficult. However if you wrap your items in some sort of FrameworkElement-derived object before adding them to the listbox, you can use TransformToVisual to get the relative size and use Height and Width to set the size of the item.</p>
<p>In general you can wrap your objects in a ContentControl like the following. Instead of:</p>
<pre><code>_ListBox.Items.Add(obj0);
_ListBox.Items.Add(obj1);
</code></pre>
<p>Do this:</p>
<pre><code>_ListBox.Items.Add(new ContentControl { Content = obj0 });
_ListBox.Items.Add(new ContentControl { Content = obj1 });
</code></pre>
<p>Now when you get _ListBox.SelectedItem you can cast it to ContentControl and set the size and get the relative position. If you need the original object, simply get the value of the item's Content property.</p>
| 8,430
|
<p>How can you do a streaming read on a large XML file that contains a xs:sequence just below root element, without loading the whole file into a XDocument instance in memory?</p>
|
<p>Going with a SAX-style element parser and the <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmltextreader.aspx" rel="noreferrer">XmlTextReader</a> class created with <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.create.aspx" rel="noreferrer">XmlReader.Create</a> would be a good idea, yes. Here's a slightly-modified code example from <a href="http://www.codeguru.com/csharp/csharp/cs_data/xml/article.php/c4221/" rel="noreferrer">CodeGuru</a>:</p>
<pre><code>void ParseURL(string strUrl)
{
try
{
using (var reader = XmlReader.Create(strUrl))
{
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
var attributes = new Hashtable();
var strURI = reader.NamespaceURI;
var strName = reader.Name;
if (reader.HasAttributes)
{
for (int i = 0; i < reader.AttributeCount; i++)
{
reader.MoveToAttribute(i);
attributes.Add(reader.Name,reader.Value);
}
}
StartElement(strURI,strName,strName,attributes);
break;
//
//you can handle other cases here
//
//case XmlNodeType.EndElement:
// Todo
//case XmlNodeType.Text:
// Todo
default:
break;
}
}
}
catch (XmlException e)
{
Console.WriteLine("error occured: " + e.Message);
}
}
}
}
</code></pre>
|
<p>I think it's not possible if you want to use object model (i.e. XElement\XDocument) to query XML. Obviously, you can't build XML objects tree without reading enough data. However you can use <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.aspx" rel="nofollow noreferrer">XmlReader</a> class.</p>
<blockquote>
<p>The XmlReader class reads XML data
from a stream or file. It provides
non-cached, forward-only, read-only
access to XML data.</p>
</blockquote>
| 6,736
|
<p>I am looking to start writing apps for my Windows Mobile 6.1 professional device (Sprint Mogul/HTC Titan).</p>
<p>I use the copy of Visual Studio 2003 that I bought in college for all of my current contracting work, (all of my day job work is done on a company laptop). From what I can tell from MSDN in order to develop using windows Mobile 5 or 6 SDK I need to have at least Visual Studio 2005 Standard and I really don't feel like shelling out that much cash just to be able to develop for my phone.</p>
<p>Are there any free tools available to develop for Windows mobile? Or is there an affordable way to get VS that I am overlooking?</p>
|
<p>Even if you had Visual Studio 2005 you would be limited to the 2.0 Framework. You will need to use Visual Studio 2008 Professional or better to use the 3.5 Framework. But you also have an alternative. </p>
<p>I wrote an article on Windows Mobile Development without Visual Studio. The minimum you need is the .Net Compact Framework SDK. It comes with a command line compiler that can generate .Net assemblies that will run on a Windows Mobile phone. Naturally you will not want to use the command line for your compiling. So the instructions I wrote are centered around the (free) ShartpDevelop.Net editor. You can find the instructions on CodeProject.com. Here is the URL. </p>
<p><a href="http://www.codeproject.com/KB/mobile/WiMoSansVS.aspx" rel="noreferrer">http://www.codeproject.com/KB/mobile/WiMoSansVS.aspx</a></p>
|
<p>Can't you use Visual Studio Express Editions for Mobile Development</p>
<p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=94DE806B-E1A1-4282-ABC5-1F7347782553&displaylang=en" rel="nofollow noreferrer">http://www.microsoft.com/downloads/details.aspx?FamilyID=94DE806B-E1A1-4282-ABC5-1F7347782553&displaylang=en</a></p>
| 5,314
|
<p>What is the best way to sort the results of a sql query into a random order within a stored procedure?</p>
|
<p>This is a duplicate of <a href="https://stackoverflow.com/questions/19412/how-to-request-a-random-row-in-sql">SO# 19412</a>. Here's the answer I gave there:</p>
<pre><code>select top 1 * from mytable order by newid()
</code></pre>
<p>In SQL Server 2005 and up, you can use TABLESAMPLE to get a random sample that's repeatable:</p>
<pre><code>SELECT FirstName, LastName FROM Contact TABLESAMPLE (1 ROWS) ;
</code></pre>
|
<p>You can't just ORDER BY RAND(), as you know, because it will only generate one value. So use a key for a seed value.</p>
<pre>
SELECT RAND(object_id), object_id, name
FROM sys.objects
ORDER BY 1
</pre>
| 7,632
|
<p>I am trying to refactor some code I have for software that collects current status of agents in a call queue. Currently, for each of the 6 or so events that I listen to, I check in a Mnesia table if an agent exists and change some values in the row depending on the event or add it as new if the agent doesn't exist. Currently I have this Mnesia transaction in each event and of course that is a bunch of repeated code for checking the existence of agents and so on. </p>
<p>I'm trying to change it so that there is one function like <em>change_agent/2</em> that I call from the events that handles this for me. </p>
<p>My problems are of course records.... I find no way of dynamically creating them or merging 2 of them together or anything. Preferably there would be a function I could call like:</p>
<pre><code>change_agent("001", #agent(id = "001", name = "Steve")).
change_agent("001", #agent(id = "001", paused = 0, talking_to = "None")).
</code></pre>
|
<p>I wrote some code a while ago that merges two records. Is not entirely dynamic, but whith macros you could easily use it for several records.</p>
<p>It works like this: The merge/2 function takes two records and converts them to lists together with the empty record for reference (the record type is defined at compile time, and must be. This is the "undynamic" part). These are then run through the generic function merge/4 which works with lists and takes elements from A if they are defined, otherwise from B if they are defined, or lastly from Default (which is always defined).</p>
<p>Here's the code (please excuse StackOverflow's poor Erlang syntax highlighting):</p>
<pre><code>%%%----------------------------------------------------------------------------
%%% @spec merge(RecordA, RecordB) -> #my_record{}
%%% RecordA = #my_record{}
%%% RecordB = #my_record{}
%%%
%%% @doc Merges two #my_record{} instances. The first takes precedence.
%%% @end
%%%----------------------------------------------------------------------------
merge(RecordA, RecordB) when is_record(RecordA, my_record),
is_record(RecordB, my_record) ->
list_to_tuple(
lists:append([my_record],
merge(tl(tuple_to_list(RecordA)),
tl(tuple_to_list(RecordB)),
tl(tuple_to_list(#my_record{})),
[]))).
%%%----------------------------------------------------------------------------
%%% @spec merge(A, B, Default, []) -> [term()]
%%% A = [term()]
%%% B = [term()]
%%% Default = [term()]
%%%
%%% @doc Merges the lists `A' and `B' into to a new list taking
%%% default values from `Default'.
%%%
%%% Each element of `A' and `B' are compared against the elements in
%%% `Default'. If they match the default, the default is used. If one
%%% of them differs from the other and the default value, that element is
%%% chosen. If both differs, the element from `A' is chosen.
%%% @end
%%%----------------------------------------------------------------------------
merge([D|ATail], [D|BTail], [D|DTail], To) ->
merge(ATail, BTail, DTail, [D|To]); % If default, take from D
merge([D|ATail], [B|BTail], [D|DTail], To) ->
merge(ATail, BTail, DTail, [B|To]); % If only A default, take from B
merge([A|ATail], [_|BTail], [_|DTail], To) ->
merge(ATail, BTail, DTail, [A|To]); % Otherwise take from A
merge([], [], [], To) ->
lists:reverse(To).
</code></pre>
<p>Feel free to use it in any way you want.</p>
|
<p>It is difficult to write generic access functions for records.
One workaround for this is the <a href="http://forum.trapexit.org/viewtopic.php?p=21790#21790" rel="nofollow noreferrer">'exprecs'</a> library, which
will generate code for low-level record access functions.</p>
<p>The thing you need to do is to add the following lines to
a module:</p>
<pre><code>-compile({parse_transform, exprecs}).
-export_records([...]). % name the records that you want to 'export'
</code></pre>
<p>The naming convention for the access functions may look strange, but was inspired by a proposal from Richard O'Keefe. It is, at least, consistent, and unlikely to clash with existing functions. (:</p>
| 8,762
|
<p>We have a simple [spring-hibernate] application (console app) where in we have set the classpath in manifest file of the executable JAR file. And the app connects to the database using jTDS JDBC Driver, Everything works as expected on Windows machine and JDK 1.6, but on Linux, the app is unable to find the driver,
We are running the program using java -jar MainClassName.</p>
<p>Any suggestions why this might be happening is greatly appreciated.</p>
|
<p>This issue occurred because our jdbc.url had invalid url. This was because maven treats jdbc.url property as a special property and while profiling, instead of url defined in the filter.properties. And that is the reason "No Suitable Driver" exception. The question should have been more clear. </p>
<p>Anyways to fix that we had to rename jdbc.url properties to jdbc.url.somename. This fixed our issue with maven profiling. We also had a similar maven profiling issue for a property called "server.name" This filter property was also confusing maven profiling . We had to change the name of that property as well.</p>
<p>Thanks again Fernando. </p>
|
<p>Honestly it sounds like bad CLASSPATH. One thing I suggest to start debugging this problem is copying the jtds package to same path as your main packages/classes and see if it works. This way you can assure the Classpath manifest is or isn't the problem. The Spring/Hibernate relies on the lib directory, so it will always be on classpath because it's main structure. Use the lib directory also to test.</p>
<p>Hope this guidelines will help. Also send more information, like paths, classpath and manifest files.</p>
| 8,632
|
<p>We're at the beginning of a new ERP-ish client-server application, developed as a Python rich client. We're currently evaluating Dabo as our main framework and it looks quite nice and easy to use, but I was wondering, has anyone used it for medium-to-big sized projects?<br>
Thanks for your time!</p>
|
<p>I'm one of the authors of the Dabo framework. One of our users pointed out to me the extremely negative answer you received, and so I thought I had better chime in and clear up some of the incorrect assumptions in the first reply.</p>
<p>Dabo is indeed well-known in the Python community. I have presented it at 3 of the last 4 US PyCons, and we have several hundred users who subscribe to our email lists. Our website (<a href="http://dabodev.com" rel="noreferrer">http://dabodev.com</a>) has not had any service interruptions; I don't know why the first responder claimed to have trouble. Support is through our email lists, and we pride ourselves on helping people quickly and efficiently. Many of the newbie questions help us to identify places where our docs are lacking, so we strongly encourage newcomers to ask questions!</p>
<p>Dabo has been around for 4 years. The fact that it is still a few days away from a 0.9 release is more of a reflection of the rather conservative version numbering of my partner, Paul McNett, than any instabilities in the framework. I know of Dabo apps that have been in production since 2006; I have used it for my own projects since 2004. Whatever importance you attach to release numbers, we are at revision 4522, with consistent work being done to add more and more stuff to the framework; refactor and streamline some of the older code, and yes, clean up some bugs.</p>
<p>Please sign up for our free email support list:</p>
<p><a href="http://leafe.com/mailman/listinfo/dabo-users" rel="noreferrer">http://leafe.com/mailman/listinfo/dabo-users</a></p>
<p>...and ask any questions you may have about Dabo there. Not many people have discovered Stack Overflow yet, so I wouldn't expect very informed answers here yet. There are several regular contributors there who use Dabo on a daily basis, and are usually more than happy to offer their opinions and their help.</p>
|
<p>I have no Dabo experience at all but this question is on the top of the list fo such a long time that I decided to give it a shot:</p>
<h2>Framework selection</h2>
<h2>Assumptions:</h2>
<ol>
<li>medium-to-big project: we're talking about a team of more than 20 people working on something for about a year for the first phase. This is usually an expensive and very important effort for the client.</li>
<li>this project will have significant amount of users (around a hundred) so performance is essential</li>
<li>it's an ERP project so the application will work with large amounts of information</li>
<li>you have no prior Dabo experience in your team</li>
</ol>
<h2>Considerations:</h2>
<ol>
<li>I could not open Dabo project site right now. There seems to be some server problem. That alone would make me think twice about using it for a big project.</li>
<li>It's not a well-known framework. Typing Dabo in Google returns almost no useful results, it does not have a Wikipedia page, all-in-all it's quite obscure. It means that when you will have problems with it (and you will have problems with it) you will have almost no place to go. Your question was unanswered for 8 days on SO, this alone would make me re-consider. If you base your project on an obscure technology you have no previous experience with - it's a huge risk.</li>
<li>You don't have people who know that framework in your team. It means that you have to learn it to get any results at all and to master it will require quite significant amount of time. You will have to factor that time into your project plan. Do you really need it?</li>
<li>What does this framework give you that you cannot do yourself? Quite a lot of time my team tried to use some third-party component or tool only to find that building a custom one would be faster than dealing with third-party problems and limitations. There are brilliant tools available to people nowadays and we would be lost without them - but you have to carefully consider if this tool is one of them</li>
<li>Dabo project version is 0.84. Do you know if they spend time optimising their code for performance at this stage? Did you run any tests to see it will sustain the load you have in your NFRs.</li>
</ol>
<p>Hope that helps :) Good luck with your project</p>
| 8,034
|
<p>I have a standard HTML image tag with an image in it, 100 by 100 pixels in size. I want people to be able to click the image and for that to pass the X and Y that they click into a function.</p>
<p>The coordinates need to be relative to the image top and left.</p>
|
<p>I think you're talking about:</p>
<pre><code><input id="info" type="image">
</code></pre>
<p>When submitted, there are form values for the x and y coordinate based on the input element id (<code>info.x</code> and <code>info.y</code> in this case).</p>
<p><a href="http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.4.1" rel="nofollow noreferrer">http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.4.1</a></p>
|
<p>from what you describe you should register to the image mouse event, for this case you should have the image mouse button event.</p>
<p>at the function you should use </p>
<pre><code>Point mousePoint = e.GetPosition( this );
</code></pre>
<p>that will give you the mouse position according to the top left point int pixels.</p>
<p>than at the <code>mousePoint</code> you can print the X and Y information. </p>
| 3,994
|
<p>How do I make it so <code>mailto:</code> links will be registered with my program?</p>
<p>How would I then handle that event in my program?</p>
<p>Most of the solutions I found from a quick Google search are how to do this manually, but I need to do this automatically for users of my program if they click a button, such as "set as default email client".</p>
<p>#Edit:
Removed reference to Delphi, because the answer is independent of your language.</p>
|
<p><em>@Dillie-O: Your answer put me in the right direction (I should have expected it to just be a registry change) and I got this working. But I'm going to mark this as the answer because I'm going to put some additional information that I found while working on this.</em></p>
<p>The solution to this question really doesn't depend on what programming language you're using, as long as there's some way to modify Windows registry settings.</p>
<p>Finally, here's the answer:</p>
<ul>
<li>To associate a program with the mailto protocol for <strong>all users</strong> on a computer, change the HKEY_CLASSES_ROOT\mailto\shell\open\command Default value to:<br />
"<em>Your program's executable</em>" "%1"</li>
<li>To <a href="http://windowsxp.mvps.org/permail.htm" rel="nofollow noreferrer">associate a program with the mailto protocol for the <strong>current user</strong></a>, change the HKEY_CURRENT_USER\Software\Classes\mailto\shell\open\command Default value to:<br />
"<em>Your program's executable</em>" "%1"</li>
</ul>
<p>The %1 will be replaced with the entire mailto URL. For example, given the link:</p>
<pre><code><a href="mailto:user@example.com">Email me</a>
</code></pre>
<p>The following will be executed:<br />
"<em>Your program's executable</em>" "mailto:user@example.com"</p>
<p>Update (via comment by shellscape):<br />
As of Windows 8, this method no longer works as expected. Win8 enforces the following key: HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\URLAssociations\MAILTO\UserChoice for which the ProgID of the selected app is hashed and can't be forged. It's a royal PITA.</p>
|
<p>From what I've seen, there are a few registry keys that set the default mail client. One of them is:</p>
<p>System Key: <code>[HKEY_CLASSES_ROOT\mailto\shell\open\command]</code></p>
<p>Value Name: <code>(Default)</code></p>
<p>Data Type: <code>REG_SZ</code> (String Value)</p>
<p>Value Data: <code>Mail program command-line</code>.</p>
<p>I'm not familiar with <code>Delphi 7</code>, but I'm sure there are some <em>registry editing libraries</em> there that you could use to modify this value.</p>
<p>Some places list more than this <em>key</em>, others just this key, so you may need to test a little bit to find the proper one(s).</p>
| 2,272
|
<p>I am trying to paginate the results of an SQL query for use on a web page. The language and the database backend are PHP and SQLite.</p>
<p>The code I'm using works something like this (page numbering starts at 0)</p>
<p><a href="http://example.com/table?page=0" rel="nofollow noreferrer">http://example.com/table?page=0</a></p>
<pre><code>page = request(page)
per = 10 // results per page
offset = page * per
// take one extra record so we know if a next link is needed
resultset = query(select columns from table where conditions limit offset, per + 1)
if(page > 0) show a previous link
if(count(resultset) > per) show a next link
unset(resultset[per])
display results
</code></pre>
<p>Are there more efficient ways to do pagination than this?</p>
<p>One problem that I can see with my current method is that I must store all 10 (or however many) results in memory before I start displaying them. I do this because PDO does not guarantee that the row count will be available.</p>
<p>Is it more efficient to issue a <code>COUNT(*)</code> query to learn how many rows exist, then stream the results to the browser?</p>
<p>Is this one of those "it depends on the size of your table, and whether the <code>count(*)</code> query requires a full table scan in the database backend", "do some profiling yourself" kind of questions?</p>
|
<p>i'd suggest just doing the count first. a count(primary key) is a very efficient query.</p>
|
<p>I doubt that it will be a problem for your users to wait for the backend to return ten rows. (You can make it up to them by being good at specifying image dimensions, make the webserver negotiate compressed data transfers when possible, etc.)</p>
<p>I don't think that it will be very useful for you to do a count(*) initially.</p>
<p>If you are up to some complicated coding: When the user is looking at page x, use ajax-like magic to pre-load page x+1 for improved user experience.</p>
<p>A general note about pagination:
If the data changes while the user browses through your pages, it <em>may</em> be a problem if your solution demands a very high level of consistency. I've writte a note about that <a href="http://troels.arvin.dk/db/rdbms/#select-limit-offset-note" rel="nofollow noreferrer">elsewhere</a>.</p>
| 7,601
|
<p>I'm making a webform using a <code>LoginView</code>, the problem is that because the control includes a grey bar telling you what type of control it is it throws of correctly formatting the page (it has <code>LoginView1</code> at the top).</p>
<p>Is there a way to hide this on the <code>LoginView</code> as the <code>contentPlaceholder</code> does an excellent job for this.</p>
<p>I've found that you can remove the ID, but that seems like a hack as it stops programatic access</p>
|
<p>I may have misunderstood your question but.... </p>
<p>The 'grey bar telling you what type of control it is' only shows up if you are looking at the page in 'design view' in your IDE (are you using Visual Studio?).<br>
Once you run the page this label is not visible. </p>
<p>It is very common for pages that have dynamic/server-side content to 'not look right' when you are looking at them in 'design view'. </p>
<p>Little things like the label/grey bar you are talking about are just there to help you work on the page when it is not populated with the dynamic content. </p>
<p>As a result of this, I find that 99.9% of the time I use 'source view' in my IDE because as your page content becomes more dynamic, the 'design view' becomes more useless.</p>
|
<p>I don't know that there is a property to control this (can't find one on MSDN), but I'd think you could just iterate through the Controls property of the LoginView and hide that panel/label/whatever.</p>
| 2,942
|
<p>The single timing column in the weblog naturally includes client transmission timing. For anamoly analysis, I want to differentiate pages that took excessive construction time from requests that simply had a slow client.</p>
<p>For buffered pages, I've looked at the ASP.NET page lifecycle model and do not see where I can tap in and codewise measure just the page-processing time before the page is flushed to the client.</p>
<p>I probably should have mentioned that my goal is production monitoring (not test or dev). In addition, the intent is to annotate the weblogs with this measurement for later analysis. Current we liberally annotate the weblogs with Response.AppendToLog(). I believe the desire to use Response.AppendToLog() somewhat limits my potential logpoints as for instance, the response-object is not viable in Application_EndRequest.</p>
<p>Any insight would be appreciated.</p>
|
<p>You could use a Stopwatch in the BeginRequest and the PreSendRequestContent as mentioned in the other two answers, or you could just use the request's Timestamp in the PreSendRequestContent.</p>
<p>For example, on <a href="http://www.singingeels.com/" rel="nofollow noreferrer">SingingEels</a>, I added this to the bottom of my Master Page (yes, it's a hack) : <code><%=DateTime.Now.Subtract(HttpContext.Current.Timestamp).TotalSeconds %></code></p>
<p>That way I can see how long any page took to actually execute on the server, including hitting the database, etc.</p>
|
<p>the easist way would probably be to use the follow events in the global.asax file:</p>
<p>protected void Application_BeginRequest(Object sender, EventArgs e)<br>
protected void Application_EndRequest(Object sender, EventArgs e)</p>
<p>You could also implement a custom httpmodule</p>
| 9,678
|
<p>I'm looking for patterns that concern coding parts of a GUI. <strong>Not</strong> as global as <strong>MVC</strong>, that I'm quite familiar with, but patterns and good ideas and best practices concerning single controls and inputs.</p>
<p>Let say I want to make a control that display some objects that may overlap. Now if I click on an object, I need to find out what to do (Just finding the object I can do in several ways, such as an quad-tree and Z-order, thats not the problem). And also I might hold down a modifier key, or some object is active from the beginning, making the selection or whatever a bit more complicated. Should I have an object instance representing a screen object, handle the user-action when clicked, or a master class. etc.. What kind of patterns or solutions are there for problems like this? </p>
|
<p>I think to be honest you a better just boning up on your standard design patterns and applying them to the individual problems that you face in developing your UI.</p>
<p>While there are common UI "themes" (such as dealing with modifier keys) the actual implementation may vary widely.</p>
<p>I have O'Reilly's <a href="http://www.amazon.co.uk/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.co.uk%2FHead-First-Design-Patterns%2Fdp%2F0596007124%2Fref%3Dpd_bbs_sr_1%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1218730650%26sr%3D1-1&tag=robcthegeek-21&linkCode=ur2&camp=1634&creative=6738" rel="nofollow noreferrer">Head First Design Patterns</a> and <a href="http://www.amazon.co.uk/gp/redirect.html?ie=UTF8&location=http%3A%2F%2Fwww.amazon.co.uk%2FHead-First-Design-Patterns-Poster%2Fdp%2F0596102143%2Fref%3Dpd_bbs_sr_3%3Fie%3DUTF8%26s%3Dbooks%26qid%3D1218730650%26sr%3D1-3&tag=robcthegeek-21&linkCode=ur2&camp=1634&creative=6738" rel="nofollow noreferrer">The Poster</a>, which I have found invaluable!</p>
<h3>Shameless Plug : These links are using my associates ID.</h3>
|
<p>I don't think the that benefit of design patterns come from trying to find a design pattern to fit a problem. You can however use some heuristics to help clean up your design in this quite a bit, like keeping the UI as decoupled as possible from the rest of the objects in your system.</p>
<p>There is a pattern that might help out in this case, the <a href="http://en.wikipedia.org/wiki/Observer_pattern" rel="nofollow noreferrer">Observer Pattern</a>.</p>
| 3,239
|
<p>In a C# console app I have the need to extract the text from an RTF string, add some more text to it, and then convert it back into RTF. I have been able to do this using the System.Windows.Forms.RichTextBox class, but I find it a bit odd to use a Forms control in a non-Forms app. Any better way to do this?</p>
|
<p>Doing anything with RTF is pretty difficult unless you're using the windows forms. As stated above, using forms is the easiest way to go.</p>
<p>You could write something yourself, but the RTF spec is pretty complicated.<br>
<a href="http://www.biblioscape.com/rtf15_spec.htm" rel="nofollow noreferrer">http://www.biblioscape.com/rtf15_spec.htm</a></p>
<p>Or you could use a conversion DLL / ActiveX object of which there is a large number available.
<a href="http://www.sautinsoft.com/" rel="nofollow noreferrer">http://www.sautinsoft.com/</a></p>
<p>Or - If you're doing this from Linux, there are also tools available. A cursory glance throws up UnRTF
<a href="http://www.gnu.org/software/unrtf/unrtf.html" rel="nofollow noreferrer">http://www.gnu.org/software/unrtf/unrtf.html</a></p>
<p>I haven't included stuff to turn text back to RTF because I think the RTF specification treats and formats text correctly. </p>
|
<p>It depends on what you mean by 'better'. You are already using the simplest and easiest way of doing it.</p>
| 4,236
|
<p>I'm developing a web service whose methods will be called from a "dynamic banner" that will show a sort of queue of messages read from a sql server table.</p>
<p>The banner will have a heavy pressure in the home pages of high traffic sites; every time the banner will be loaded, it will call my web service, in order to obtain the new queue of messages.</p>
<p>Now: I don't want that all this traffic drives queries to the database every time the banner is loaded, so I'm thinking to use the asp.net cache (i.e. HttpRuntime.Cache[cacheKey]) to limit database accesses; I will try to have a cache refresh every minute or so.</p>
<p>Obviously I'll try have the messages as little as possible, to limit traffic.</p>
<p>But maybe there are other ways to deal with such a scenario; for example I could write the last version of the queue on the file system, and have the web service access that file; or something mixing the two approaches...</p>
<p>The solution is c# web service, asp.net 3.5, sql server 2000. </p>
<p>Any hint? Other approaches? </p>
<p>Thanks</p>
<p>Andrea</p>
|
<p>It depends on a lot of things:</p>
<ul>
<li>If there is little change in the data (think backend with "publish" button or daily batches), then I would definitely use static files (updated via push from the backend). We used this solution on a couple of large sites and worked really well.</li>
<li>If the data is small enough, memory caching (i.e. Http Cache) is viable, but beware of locking issues and also beware that Http Cache <strong>will not</strong> work that well under heavy memory load, because items can be expired early if the framework needs memory. I have been bitten by it before! With the above caveats, Http Cache works quite well.</li>
</ul>
|
<p>Also, one way to get around the memory limitation mentioned by Skliwz is that if you are using this service outside of the normal application you can isolate it in it's own app pool. I have seen this done before which helps as well.</p>
| 9,666
|
<p>I am using the basic-auth twitter API (<a href="https://groups.google.com/d/topic/twitter-development-talk/wD-isa6Q0qk/discussion" rel="noreferrer">no longer available</a>) to integrate twitter with my blog's commenting system. The problem with this and many other web APIs out there is that they require the user's username and password to do anything useful. I don't want to deal with the hassle and cost of installing a SSL certificate, but I also don't want passwords passed over the wire in clear text.</p>
<p>I guess my general question is: <strong>How can I send sensitive data over an insecure channel?</strong></p>
<p>This is my current solution and I'd like to know if there are any holes in it:</p>
<ol>
<li>Generate a random key on the server (I'm using php).</li>
<li>Save the key in a session and also output the key in a javascript variable.</li>
<li>On form submit, use <a href="http://tero.co.uk/des/" rel="noreferrer">Triple DES in javascript</a> with the key to encrypt the password.</li>
<li>On the server, decrypt the password using the key from the session and then destroy the session.</li>
</ol>
<p>The end result is that only the encrypted password is sent over the wire and the key is only used once and never sent with the password. Problem solved?</p>
|
<blockquote>
<ol>
<li>Generate a random key on the server (I'm using php).</li>
<li>Save the key in a session and also output the key in a javascript variable.</li>
<li>On form submit, use Triple DES in javascript with the key to encrypt the password.</li>
</ol>
</blockquote>
<p>This avoids sending the password in the clear over the wire, but it requires you to send the key in the clear over the wire, which would allow anyone eavesdropping to decode the password.</p>
<p>It's been said before and I'll say it again: don't try to make up your own cryptographic protocols! There are established protocols out there for this kind of thing that have been created, peer reviewed, beat on, hacked on, poked and prodded by professionals, <strong>use them!</strong> No one person is going to be able to come up with something better than the entire cryptographic and security community working together.</p>
|
<blockquote>
<p>How can I send sensitive data over an
insecure channel</p>
</blockquote>
<p>With a pre-shared secret key. This is what you attempt in your suggested solution, but you can't send that key over the insecure channel. Someone mentioned DH, which will help you negotiate a key. But the other part of what SSL does is provide authentication, to prevent man-in-the-middle attacks so that the client knows they are negotiating a key with the person they intend to communicate with.</p>
<p>Chris Upchurch's advice is really the only good answer there is for 99.99% of engineers - don't do it. Let someone else do it and use their solution (like the guys who wrote the SSL client/server).</p>
<p>I think the ideal solution here would be to get Twitter to support OpenID and then use that.</p>
| 5,981
|
<p>I have a quandary. My web application (C#, .Net 3.0, etc) has Themes, CSS sheets and, of course, inline style definitions. Now that's alot of chefs adding stuff to the soup. All of this results, not surprisingly, in my pages having bizarre styling on occasion.</p>
<p>I am sure that all these styles are applied in a hierarchical method (although I am not sure of that order). The issue is that each style is applied as a "transparent" layer which just masks what it is applying. This is, I feel, a good idea as you can specifiy styles for the whole and then one-off them as needed. Unfortunately I can't tell from which layer the style actually came from.</p>
<p>I could solve this issue by explicitly expressing the style at all layers but that gets bulky and hard to manage and the page(s) works 80% of the time. I just need to figure out where that squirrelly 20% came from.</p>
|
<p>IMHO, Firebug is going to be your best bet. It will tell you which file the style came from and you can click on the filename to be transported instantly to the relevant line in the file. </p>
<p>Note: You can hit <kbd>ctrl</kbd>+<kbd>shift</kbd>+<kbd>C</kbd> on any page to select and inspect an element with the mouse.</p>
|
<p>The key to solving a complex CSS issue is to work out what is causing the weird appearance. The easiest way to find is to selectively comment out stylesheets until you find the one where commenting it out fixes the problem. Then enable the stylesheet and selectively comment out rules until you find the one causing the problem. If you need to know what takes precedence over what, the details of the cascade in CSS is detailed
<a href="http://www.w3.org/TR/CSS21/cascade.html" rel="nofollow noreferrer">here</a> and unlike the implementation of individual rules, this is fairly consistent across browsers.</p>
<p>However, it is much better if you avoid inline styles entirely and have a set of well-crafted stylesheets, each of which has a logical function and all of whose rules you understand. for the same reason you don't put your server-side code in a random order in random files - <a href="http://stackoverflow.com">us</a></p>
| 7,796
|
<p>When you subscribe to an event on an object from within a form, you are essentially handing over control of your callback method to the event source. You have no idea whether that event source will choose to trigger the event on a different thread.</p>
<p>The problem is that when the callback is invoked, you cannot assume that you can make update controls on your form because sometimes those controls will throw an exception if the event callback was called on a thread different than the thread the form was run on.</p>
|
<p>To simplify Simon's code a bit, you could use the built in generic Action delegate. It saves peppering your code with a bunch of delegate types you don't really need. Also, in .NET 3.5 they added a params parameter to the Invoke method so you don't have to define a temporary array.</p>
<pre><code>void SomethingHappened(object sender, EventArgs ea)
{
if (InvokeRequired)
{
Invoke(new Action<object, EventArgs>(SomethingHappened), sender, ea);
return;
}
textBox1.Text = "Something happened";
}
</code></pre>
|
<p>In many simple cases, you can use the MethodInvoker delegate and avoid the need to create your own delegate type.</p>
| 2,799
|
<p>Assuming such a query exists, I would greatly appreciate the help.</p>
<p>I'm trying to develop a permissions script that will grant "select" and "references" permissions on the user tables and views in a database. My hope is that executing the "grant" commands on each element in such a set will make it easier to keep permissions current when new tables and views are added to the database.</p>
|
<pre><code>select * from information_schema.tables
WHERE OBJECTPROPERTY(OBJECT_ID(table_name),'IsMSShipped') =0
</code></pre>
<p>Will exclude dt_properties and system tables</p>
<p>add </p>
<pre><code>where table_type = 'view'
</code></pre>
<p>if you just want the view</p>
|
<pre><code>select * from information_schema.tables
where table_type = 'view'
</code></pre>
| 5,324
|
<p>Is it possible to change the width of a scroll bar on a form. This app is for a touch screen and it is a bit too narrow.</p>
|
<p>The width of the scrollbars is controlled by Windows. You can adjust the scrollbar width in Display Properties and it will affect all windows on the terminal.</p>
|
<p>This is a Windows Forms application? I was able to make a very fat and thick scrollbar by adjusting the "Width" property of my scroll bar control. </p>
<p><img src="https://i.stack.imgur.com/k6PAf.png" alt="Fat Scroll Bar"></p>
<p>Is your scroll bar something you have programmatic access to (i.e. it is a control you added to the form)?</p>
| 2,883
|
<p>I'm new to Ruby, so I'm having some trouble understanding this weird exception problem I'm having. I'm using the ruby-aaws gem to access Amazon ECS: <a href="http://www.caliban.org/ruby/ruby-aws/" rel="nofollow noreferrer">http://www.caliban.org/ruby/ruby-aws/</a>. This defines a class Amazon::AWS:Error:</p>
<pre><code>module Amazon
module AWS
# All dynamically generated exceptions occur within this namespace.
#
module Error
# An exception generator class.
#
class AWSError
attr_reader :exception
def initialize(xml)
err_class = xml.elements['Code'].text.sub( /^AWS.*\./, '' )
err_msg = xml.elements['Message'].text
unless Amazon::AWS::Error.const_defined?( err_class )
Amazon::AWS::Error.const_set( err_class,
Class.new( StandardError ) )
end
ex_class = Amazon::AWS::Error.const_get( err_class )
@exception = ex_class.new( err_msg )
end
end
end
end
end
</code></pre>
<p>This means that if you get an errorcode like <code>AWS.InvalidParameterValue</code>, this will produce (in its exception variable) a new class <code>Amazon::AWS::Error::InvalidParameterValue</code> which is a subclass of <code>StandardError</code>.</p>
<p>Now here's where it gets weird. I have some code that looks like this:</p>
<pre><code>begin
do_aws_stuff
rescue Amazon::AWS::Error => error
puts "Got an AWS error"
end
</code></pre>
<p>Now, if <code>do_aws_stuff</code> throws a <code>NameError</code>, my rescue block gets triggered. It seems that Amazon::AWS::Error isn't the superclass of the generated error - I guess since it's a module everything is a subclass of it? Certainly if I do:</p>
<pre><code>irb(main):007:0> NameError.new.kind_of?(Amazon::AWS::Error)
=> true
</code></pre>
<p>It says <code>true</code>, which I find confusing, especially given this:</p>
<pre><code>irb(main):009:0> NameError.new.kind_of?(Amazon::AWS)
=> false
</code></pre>
<p>What's going on, and how am I supposed to separate out AWS errors from other type of errors? Should I do something like:</p>
<pre><code>begin
do_aws_stuff
rescue => error
if error.class.to_s =~ /^Amazon::AWS::Error/
puts "Got an AWS error"
else
raise error
end
end
</code></pre>
<p>That seems exceptionally janky. The errors thrown aren't class AWSError either - they're raised like this:</p>
<pre><code>error = Amazon::AWS::Error::AWSError.new( xml )
raise error.exception
</code></pre>
<p>So the exceptions I'm looking to <code>rescue</code> from are the generated exception types that only inherit from StandardError.</p>
<p>To clarify, I have two questions:</p>
<ol>
<li><p>Why is NameError, a Ruby built in exception, a <code>kind_of?(Amazon::AWS::Error)</code>, which is a module?<br>
<strong>Answer:</strong> I had said <code>include Amazon::AWS::Error</code> at the top of my file, thinking it was kind of like a Java import or C++ include. What this actually did was add everything defined in <code>Amazon::AWS::Error</code> (present and future) to the implicit Kernel class, which is an ancestor of every class. This means <strong>anything</strong> would pass <code>kind_of?(Amazon::AWS::Error)</code>.</p></li>
<li><p>How can I best distinguish the dynamically-created exceptions in <code>Amazon::AWS::Error</code> from random other exceptions from elsewhere?</p></li>
</ol>
|
<p>Ok, I'll try to help here : </p>
<p>First a module is not a class, it allows you to mix behaviour in a class. second see the following example : </p>
<pre><code>module A
module B
module Error
def foobar
puts "foo"
end
end
end
end
class StandardError
include A::B::Error
end
StandardError.new.kind_of?(A::B::Error)
StandardError.new.kind_of?(A::B)
StandardError.included_modules #=> [A::B::Error,Kernel]
</code></pre>
<p>kind_of? tells you that yes, Error does possess All of A::B::Error behaviour (which is normal since it includes A::B::Error) however it does not include all the behaviour from A::B and therefore is not of the A::B kind. (duck typing)</p>
<p>Now there is a very good chance that ruby-aws reopens one of the superclass of NameError and includes Amazon::AWS:Error in there. (monkey patching)</p>
<p>You can find out programatically where the module is included in the hierarchy with the following :</p>
<pre><code>class Class
def has_module?(module_ref)
if self.included_modules.include?(module_ref) and not self.superclass.included_modules.include?(module_ref)
puts self.name+" has module "+ module_ref.name
else
self.superclass.nil? ? false : self.superclass.has_module?(module_ref)
end
end
end
StandardError.has_module?(A::B::Error)
NameError.has_module?(A::B::Error)
</code></pre>
<p>Regarding your second question I can't see anything better than </p>
<pre><code>begin
#do AWS error prone stuff
rescue Exception => e
if Amazon::AWS::Error.constants.include?(e.class.name)
#awsError
else
whatever
end
end
</code></pre>
<p>(edit -- above code doesn't work as is : name includes module prefix which is not the case of the constants arrays. You should definitely contact the lib maintainer the AWSError class looks more like a factory class to me :/ )</p>
<p>I don't have ruby-aws here and the caliban site is blocked by the company's firewall so I can't test much further. </p>
<p>Regarding the include : that might be the thing doing the monkey patching on the StandardError hierarchy. I am not sure anymore but most likely doing it at the root of a file outside every context is including the module on Object or on the Object metaclass. (this is what would happen in IRB, where the default context is Object, not sure about in a file)</p>
<p>from the <a href="http://www.rubycentral.com/pickaxe/tut_modules.html" rel="nofollow noreferrer">pickaxe on modules</a> :</p>
<p><code>A couple of points about the include statement before we go on. First, it has nothing to do with files. C programmers use a preprocessor directive called #include to insert the contents of one file into another during compilation. The Ruby include statement simply makes a reference to a named module. If that module is in a separate file, you must use require to drag that file in before using include.</code></p>
<p>(edit -- I can't seem to be able to comment using this browser :/ yay for locked in platforms) </p>
|
<p>One issue you're running into is that <code>Amazon::AWS::Error::AWSError</code> is not actually an exception. When <code>raise</code> is called, it looks to see if the first parameter responds to the <code>exception</code> method and will use the result of that instead. Anything that is a subclass of <code>Exception</code> will return itself when <code>exception</code> is called so you can do things like <code>raise Exception.new("Something is wrong")</code>.</p>
<p>In this case, <code>AWSError</code> has <code>exception</code> set up as an attribute reader which it defines the value to on initialization to something like <code>Amazon::AWS::Error::SOME_ERROR</code>. This means that when you call <code>raise Amazon::AWS::Error::AWSError.new(SOME_XML)</code> Ruby ends up calling <code>Amazon::AWS::Error::AWSError.new(SOME_XML).exception</code> which will returns an instance of <code>Amazon::AWS::Error::SOME_ERROR</code>. As was pointed out by one of the other responders, this class is a direct subclass of <code>StandardError</code> instead of being a subclass of a common Amazon error. Until this is rectified, Jean's solution is probably your best bet.</p>
<p>I hope that helped explain more of what's actually going on behind the scenes.</p>
| 9,547
|
<p>I've a friend who is expecting. There are several adorable weapon themed rattles on thingiverse. I am, however, concerned about safety associated with such a product in the hands of a baby who will gnaw on it. To me the safety concerns here are much larger than for most food handling applications.</p>
<p>What steps should be taken to ensure such a print is safe for use?</p>
<p>This includes: filament selection, pea material selection, wall thickness, smoothing, construction, etc.</p>
<p>My current thoughts are as follows: "food grade PLA", dried peas, sanding, and single piece construction</p>
|
<p>You're on the right track. Since you asked for "steps" here you go:</p>
<p><strong>Step 1. Choose a safe material:</strong> </p>
<p>Consider chemical safety and physical safety. Food grade PLA should be chemically safe, but could be too brittle depending on the design you choose. PETG, T-Glase, or similar filaments (depending on dye) are normally also chemically safe and are less brittle than PLA so may be a better alternative. ABS is NOT typically considered safe for food contact.</p>
<p><strong>Step 2. Choose a safe design:</strong> </p>
<p>If using PLA, be sure the design is robust enough to ensure it won't break. Broken rattles with sharp edges make baby...sad. Even less brittle filaments can still break with jagged edges if the design is fragile.</p>
<p><strong>Step 2a. Choose a single piece design:</strong> </p>
<p>Choose a design that requires you to add the peas (or other safe filler) during the print such that the finished rattle is fully enclosed. This will minimize parts becoming loose or peas spilling and minimize choke hazards.</p>
<p><strong>Step 3. Consider post processing to improve safety:</strong></p>
<p>Sanding could reduce ridges and minimize crevices that could harbor bacteria, but sealing it with a food-safe sealant may be more effective. There are many sealants that the FDA considers safe, but polyurethane or food-safe epoxy finishes will work well with PLA. (If you use a different material, test to verify good adhesion.)</p>
<p><strong>Step 4. Test:</strong></p>
<p>Make a test rattle and run it through the paces. I guess you could chew on it, but since babies don't have teeth, this might invalidate your data...</p>
<p><strong>Step 5. Consider alternatives such as professional printing services:</strong></p>
<p>If your tests don't inspire confidence, professional services can offer additional materials (metals, ceramics, etc.) that could be safer than a typical fused filament printer.</p>
|
<p>Also consider the nozzle on your printer. Most nozzles are made of brass, which is not considered food safe due to the presence of small amounts of lead. Stainless steel nozzles are available which will not perform quite as well as brass but are food safe.</p>
| 394
|
<p>In 4D printing technology or by means usage of Shape-memory alloy (non-metal, iron based, copper based or NiTi material) for 3D printing.</p>
<p>Is there any software simulation tool which I can use to simulate this material change behavior with respect to time? For example, when introducing a change in humidity or temperature.</p>
<p>Note: It would be best if the simulation tools targeted automotive parts (power train, cooling system, interior & exterior etc.).</p>
|
<p>I am going to say that this probably is a whole dimension out of scope for this group ;-)</p>
<p>That said this new type of 3d printing is still at the University level. Also 4d is not necessarily 3d printing related at all. All it has to be is self assembling. Like <a href="http://www.selfassemblylab.net/4DPrinting.php" rel="nofollow noreferrer">http://www.selfassemblylab.net/4DPrinting.php</a></p>
<p>Unless you have a connect with MIT. Then you aren't going to be simulating any 4d models.</p>
<p>But if you HAD to do this, then you should write a paper about it and become a researcher. You could get published. You might need a PHD in material science. There might be some simulation in solid works.. but I would say you are mostly on your own and have to develop the models as they simply do not exist, especially outside of academia and stratasys.</p>
<p>That said if you take the "4d" part and use models based on the current understanding of the raw material you would have more success.</p>
|
<p>(preface : I originally intent to write this as a comment, but the volume limit reached. In that tone, I'll utilize this answer space writing it..)</p>
<blockquote>
<p>to simulate those material change behavior in respect to time?</p>
</blockquote>
<p>COMSOL, ANSYS or equivalent ring a bell to be.. as long as you have the material properties (young's modulus, density, thermal transport & expansion properties, color?) right.</p>
<p>Also. depending on your actual implementation resolution (nano-scale production.. macro/mini-lego sized assembly), you may want to adjust the mesh size for the finite element method solver.</p>
<blockquote>
<p>software for 4D Printing</p>
</blockquote>
<p>If your 4th D refers to time.. then the discussion ends here.</p>
<p>If your 4th D is a space (not time) dimension.. Then you need to convert your 4D geometric object into a 3D shadow (just like generating the normal 2D shadow from a 3D geometric object) 1st to proceed. just like an 3D object (eg cube) can have multiple equivalent 2D form (or shadow). The same applies for 4D to 3D. Once you get the 3D coordinates of the chosen 3D form, you may print it as usual. </p>
<p>Software wise.. mathematica (are used in the some of the example I've seen, others unknown/selfcoded) or equivalent will do.. but the key here is not the software.. it's the visualization algorithm. If you can get the "shadowing" algorithm done right, any 3D/math software will do. </p>
<p>p/s : I didn't expect the materials modelling question coming when I read the title (I really thought this question refers to extra space dimension) .. but yeah.. why not. It's a good postgraduate/research topic to take on. ( :</p>
| 404
|
<p>I program with Emacs on Ubuntu (Hardy Heron at the moment), and I like the default text coloration in the Emacs GUI. However, the default text coloration when Emacs is run in the terminal is different and garish.</p>
<p>How do I make the colors in the terminal match the colors in the GUI?</p>
|
<p>You don't have to be stuck to your terminal's default 16 (or fewer) colours. Modern terminals will support 256 colours (which will get you pretty close to your GUI look).</p>
<p>Unfortunately, getting your terminal to support 256 colours is the tricky part, and varies from term to term. <a href="http://www.xvx.ca/~awg/emacs-colors-howto.txt" rel="noreferrer">This page</a> helped me out a lot (but it <em>is</em> out of date; I've definitely gotten 256 colours working in gnome-terminal and xfce4-terminal; but you may have to build them from source.) </p>
<p>Once you've got your terminal happily using 256 colours, the magic invocation is setting your terminal type to "xterm-256color" before you invoke emacs, e.g.:</p>
<pre><code>env TERM=xterm-256color emacs -nw
</code></pre>
<p>Or, you can set TERM in your <code>.bashrc</code> file:</p>
<pre><code>export TERM=xterm-256color
</code></pre>
<p>You can check if it's worked in emacs by doing <code>M-x list-colors-display</code>, which will show you either 16, or all 256 glorious colours.</p>
<p>If it works, then look at <code>color-theme</code> like someone else suggested.</p>
<p>(You'll probably get frustrated at some point; god knows I do every time I try to do something similar. But stick with it; it's worth it.)</p>
|
<p>I don't think that is possible in such a general way. With the terminal you are usually bound to some pre-defined colors (with things like gnome-terminal you can adjust these colors -- but you are still stuck to a predefined, limited number of colors).</p>
| 8,941
|
<p>Well, i've got a nice WPF book its called Sams Windows Presentation Foundation Unleashed.
I really like to read and learn with it. Are there any other WPF books you could recommend? </p>
|
<p>I've found the following books very useful:</p>
<p><a href="https://rads.stackoverflow.com/amzn/click/com/0672328917" rel="noreferrer" rel="nofollow noreferrer">Windows Presentation Foundation Unleashed - Adam Nathan</a><br />
You mention you already have this book, however I wanted to give my opinion on it. It is a great book for the newcomer - it is printed in full color which is a great help for visualizing both xaml and concepts for WPF.<br /><br />
<a href="https://rads.stackoverflow.com/amzn/click/com/0321374479" rel="noreferrer" rel="nofollow noreferrer">Essential Windows Presentation Foundation - Chris Anderson</a><br />
This is also another great book for the newcomer. While it is not printed in color, it does give a great insight into how WPF works.<br /><br />
<a href="https://rads.stackoverflow.com/amzn/click/com/1590599551" rel="noreferrer" rel="nofollow noreferrer">Pro WPF in C# 2008 - Matthew Macdonald</a><br />
This is a great reference book - one that sits on my desk and is constantly referred too. However, I didn't feel is was as newbie friendly as the other two books above. This is the most recently released book (at the time of this posting), and has been updated for VS2008. This is useful, as there are some changes with the versions of WPF. I believe there is a VB.NET version available.<br /><br />
<a href="https://rads.stackoverflow.com/amzn/click/com/0596510373" rel="noreferrer" rel="nofollow noreferrer">Programming WPF - Chris Sells & Ian Griffiths</a><br />
Another great book - I wish this was available when I was first learning the framework.<br /><br />
<a href="https://rads.stackoverflow.com/amzn/click/com/0735619573" rel="noreferrer" rel="nofollow noreferrer">Application = Code + Markup - Charles Petzold</a><br />
This was the very first WPF I purchased. It is <em>not</em> very newbie friendly, and I wouldn't recommend it for a first-time-wpf'er. The fact that Xaml is not introduced until page 457 makes learning the technology for the real world very difficult. That said, this book is invaluable if you really want to understand how things work at a very deep level (which is also important to get the most of the framework.</p>
<p>The only book I would totally avoid is:</p>
<p><a href="https://rads.stackoverflow.com/amzn/click/com/0470041803" rel="noreferrer" rel="nofollow noreferrer">Professional WPF Programming - Chris Andrade et al.</a><br />
While the content was Ok in this book, I just found the other books to be much clearer and delve to a much deeper level.<br /><br /></p>
<p>Hope this helps! WPF has a steep learning curve, but once you "get it", UI programming can actually become "fun"!</p>
|
<p>Yes, I highly recommend <a href="https://rads.stackoverflow.com/amzn/click/com/0596510373" rel="nofollow noreferrer" rel="nofollow noreferrer">this one</a></p>
| 3,096
|
<p>I have a 3D model that I'd like to print. This is my first project, so I'm trying to decide if I'm getting in over my head. Here's the model rendered with Blender:</p>
<p><a href="https://i.stack.imgur.com/N1cVF.png" rel="noreferrer"><img src="https://i.stack.imgur.com/N1cVF.png" alt="enter image description here"></a></p>
<p>If I throw it at a commercial printing shoppe, is it going to be fairly straight forward? Or is it unlikely to be able to get the colours fitting together like this to work well?</p>
|
<p>Here is a set of options you can get:</p>
<ol>
<li>print the object on multi color printer</li>
</ol>
<p>Unfortunately we got some limitations here (on the market). Printers have limited set of heads which are in fact printing in one color at a time. So we usually have 2 colors, there are also 4 color heads. If there are more then they are rare, expensive or rare and expensive.</p>
<p>here are examples of such color printouts:</p>
<p><a href="https://i.stack.imgur.com/yzU5gs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/yzU5gs.jpg" alt="click to go to the project"></a><a href="http://www.thingiverse.com/thing:329436" rel="nofollow noreferrer">project</a>
<a href="https://i.stack.imgur.com/wgYj6s.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wgYj6s.jpg" alt="click to go to the project"></a><a href="http://www.thingiverse.com/thing:67503" rel="nofollow noreferrer">project</a></p>
<ol start="2">
<li>print object splitted</li>
</ol>
<p>In this case you can have single color printer. You print parts in one color then you change filament and print other color and so on. The issue here is to have well formed object which is designed for such print method (it's connectable in some way) or you can stick printed parts with the glue.</p>
<p>here are examples of such puzzled printouts: </p>
<p><a href="https://i.stack.imgur.com/xT33Es.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xT33Es.jpg" alt="click to go to the project"></a><a href="http://www.thingiverse.com/thing:642211" rel="nofollow noreferrer">project</a>
<a href="https://i.stack.imgur.com/EEIOks.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EEIOks.jpg" alt="click to go to the project"></a><a href="http://www.thingiverse.com/thing:1360459" rel="nofollow noreferrer">project</a></p>
<ol start="3">
<li>print and paint</li>
</ol>
<p>here are examples of such painted printouts: </p>
<p><a href="https://i.stack.imgur.com/BbzNGs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BbzNGs.jpg" alt="click to go to the project"></a><a href="http://www.thingiverse.com/thing:1333103" rel="nofollow noreferrer">project</a>
<a href="https://i.stack.imgur.com/oZP7Qs.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oZP7Qs.jpg" alt="click to go to the project"></a><a href="http://www.thingiverse.com/thing:459472" rel="nofollow noreferrer">project</a></p>
<p><strong>NOTE:</strong></p>
<p>All above assumes that you are gonna print your object in FDM technology. You can also take a look on <a href="http://3dprintingfromscratch.com/common/types-of-3d-printers-or-3d-printing-technologies-overview" rel="nofollow noreferrer">other technologies</a> such as:</p>
<ul>
<li>Stereolithography(SLA)</li>
<li>Digital Light Processing(DLP)</li>
<li>Selective Laser Sintering (SLS)</li>
<li>Selective laser melting (SLM)</li>
<li>Electronic Beam Melting (EBM)</li>
<li>Laminated object manufacturing (LOM)</li>
</ul>
|
<p>You would need to ask around shops to see what they think about this 3d file. What I have heard is that colors of prints end up blended together, and that the print resolution is low. How many colors are you using? You could probably get a quality print, but it would come with a high price. Print quality is dependent on the expensiveness of the machine used.</p>
| 289
|
<p>Does anyone know of a .NET date/time parser similar to <a href="http://chronic.rubyforge.org/" rel="noreferrer">Chronic for Ruby</a> (handles stuff like "tomorrow" or "3pm next thursday")?</p>
<p>Note: I do write Ruby (which is how I know about Chronic) but this project must use .NET.</p>
|
<p>We developed exactly what you are looking for on an internal project. We are thinking of making this public if there is sufficient need for it. Take a look at this blog for more details: <a href="http://precisionsoftwaredesign.com/blog.php" rel="noreferrer">http://precisionsoftwaredesign.com/blog.php</a>.</p>
<p>Feel free to contact me if you are interested: contact@precisionsoftware.us</p>
<p>This library is now a SourceForge project. The page is at:</p>
<p><a href="http://www.SourceForge.net/p/naturaldate" rel="noreferrer">http://www.SourceForge.net/p/naturaldate</a></p>
<p>The assembly is in the downloads section, and the source is available with Mercurial. </p>
|
<p>@ Burton: I think he meant the other way, at least from the example on the linked page:</p>
<pre><code> Chronic.parse('tomorrow')
#=> Mon Aug 28 12:00:00 PDT 2006
Chronic.parse('monday', :context => :past)
#=> Mon Aug 21 12:00:00 PDT 2006
Chronic.parse('this tuesday 5:00')
#=> Tue Aug 29 17:00:00 PDT 2006
</code></pre>
<p>I thought I would take a stab at it too until I realized! (nice implementation though)</p>
| 4,356
|
<p>Relating to my <a href="https://stackoverflow.com/questions/48733/javahibernate-jpa-designing-the-server-data-reload">earlier question</a>, I want to ensure all the child objects are loaded as I have a multiple threads that may need to access the data (and thus avoid lazy loading exceptions). I understand the way to do this is to use the "fetch" keyword in the query (EJB QL). Like this:</p>
<pre><code>select distinct o from Order o left join fetch o.orderLines
</code></pre>
<p>Assuming a model with an <code>Order</code> class which has a set of <code>OrderLines</code> in it.</p>
<p>My question is that the "distinct" keyword seems to be needed as otherwise I seem to get back an <code>Order</code> for each <code>OrderLine</code>. Am I doing the right thing?</p>
<p>Perhaps more importantly, is there a way to pull in all child objects, no matter how deep? We have around 10-15 classes and for the server we will need everything loaded... I was avoiding using <code>FetchType.EAGER</code> as that meant its always eager and in particular the web front end loads everything - but perhaps that is the way to go - is that what you do? I seem to remember us trying this before and then getting really slow webpages - but perhaps that means we should be using a second-level cache?</p>
|
<p>Changing the annotation is a bad idea IMO. As it can't be changed to lazy at runtime. Better to make everything lazy, and fetch as needed.</p>
<p>I'm not sure I understand your problem without mappings. Left join fetch should be all you need for the use case you describe. Of course you'll get back an order for every orderline if orderline has an order as its parent.</p>
|
<p>If the problem is just LazyInitializationExceptions, you can avoid that by adding an OpenSessionInViewFilter.<br>
This will allow the objects to be loaded in the view, but will not help with the speed issue.</p>
<pre><code> <filter>
<filter-name>hibernateFilter</filter-name>
<filter-class> org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>hibernateFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</code></pre>
| 9,641
|
<p>I have found that skin files only work if they are placed at the root theme folder in the App_Themes folder.</p>
<p>For example, if you have 2 themes in the App_Themes folder, you cannot add another sub folder to the theme folder and place a seperate skin file in that subfolder. </p>
<p>It's not much of a limitation, but it would give you more flexibility to further customize an app.</p>
<p>Can anyone shed light on why this behavior occurs as it does in 2.0?</p>
|
<p>Has your skin file should have the extension .skin? I always call them theme.skin and give them the same name as the folder. Eg in Theme col2, the folder is </p>
<p>App_Themes\col2
and contains the css and col2.skin</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms247256(VS.80).aspx" rel="nofollow noreferrer">Microsoft</a> is your best reference:</p>
|
<p>The only way to change this behavior is via a <strong>VirtualPathProvider</strong> - something along the lines of:
<a href="http://www.neovolve.com/page/ASPNet-Virtual-Theme-Provider-10.aspx" rel="nofollow noreferrer">http://www.neovolve.com/page/ASPNet-Virtual-Theme-Provider-10.aspx</a></p>
| 9,303
|
<p>I need to write a web application using SQL Server 2005, asp.net, and ado.net. Much of the user data stored in this application must be encrypted (read HIPAA).</p>
<p>In the past for projects that required encryption, I encrypted/decrypted in the application code. However, this was generally for encrypting passwords or credit card information, so only a handful of columns in a couple tables. For this application, far more columns in several tables need to be encrypted, so I suspect pushing the encryption responsibilities into the data layer will be better performing, especially given SQL Server 2005's native support for several encryption types. (I could be convinced otherwise if anyone has real, empirical evidence.)</p>
<p>I've consulted BOL, and I'm fairly adept at using google. So I don't want links to online articles or MSDN documentation (its likely I've already read it).</p>
<p>One approach I've wrapped my head around so far is to use a symmetric key which is opened using a certificate.</p>
<p>So the one time setup steps are (performed by a DBA in theory):</p>
<ol>
<li>Create a Master Key </li>
<li>Backup the Master Key to a file, burn to CD and store off site.</li>
<li>Open the Master Key and create a certificate.</li>
<li>Backup the certificate to a file, burn to CD and store off site.</li>
<li>Create the Symmetric key with encryption algorithm of choice using the certificate.</li>
</ol>
<p>Then anytime a stored procedure (or a human user via Management Studio) needs to access encrypted data you have to first open the symmetric key, execute any tsql statements or batches, and then close the symmetric key.</p>
<p>Then as far as the asp.net application is concerned, and in my case the application code's data access layer, the data encryption is entirely transparent.</p>
<p>So my questions are:</p>
<ol>
<li><p>Do I want to open, execute tsql statements/batches, and then close the symmetric key all within the sproc? The danger I see is, what if something goes wrong with the tsql execution, and code sproc execution never reaches the statement that closes the key. I assume this means the key will remain open until sql kills the SPID that sproc executed on.</p></li>
<li><p>Should I instead consider making three database calls for any given procedure I need to execute (only when encryption is necessary)? One database call to open the key, a second call to execute the sproc, and a third call to close the key. (Each call wrapped in its own try catch loop in order to maximize the odds that an open key ultimately is closed.)</p></li>
<li><p>Any considerations should I need to use client side transactions (meaning my code is the client, and initiates a transaction, executes several sprocs, and then commits the transaction assuming success)?</p></li>
</ol>
|
<p>1) Look into using TRY..CATCH in SQL 2005. Unfortunately there is no FINALLY, so you'll have to handle both the success and error cases individually.</p>
<p>2) Not necessary if (1) handles the cleanup.</p>
<p>3) There isn't really a difference between client and server transactions with SQL Server. Connection.BeginTransaction() more or less executes "BEGIN TRANSACTION" on the server (and System.Transactions/TransactionScope does the same, until it's promoted to a distributed transaction). As for concerns with open/closing the key multiple times inside a transaction, I don't know of any issues to be aware of.</p>
|
<ol>
<li><p>you can use @@error to see if any errors occured during the call to a sproc in SQL.</p></li>
<li><p>No to complicated.</p></li>
<li><p>You can but I prefer to use transactions in SQL Server itself.</p></li>
</ol>
| 8,468
|
<p>I want some links to include a fragment identifier. Like some of the URLs on this site:</p>
<p><a href="https://stackoverflow.com/questions/5619/ie6-ssl-ajax-post-form-404-error">Debugging: IE6 + SSL + AJAX + post form = 404 error</a><strong>#5626</strong></p>
<p>Is there a way to do this with any of the built-in methods in MVC? Or would I have to roll my own HTML helpers?</p>
|
<p>We're looking at including support for this in our next release.</p>
|
<p>This is a client side solution but if you have jquery available you can do something like this.</p>
<pre><code><script language="javascript" type="text/javascript">
$(function () {
$('div.imageHolder > a').each(function () {
$(this).attr('href', $(this).attr('href') + '#tab-works');
});
});
</script>
</code></pre>
| 2,749
|
<p>I'm trying to compress different 3D files, but find it difficult to find the right software to compress the file.</p>
<p>What are the most suitable 3D file compressors to compress 3D files like STL, OBJ and STEP?</p>
<p>I have tried Draco, and mac zip compressor.</p>
|
<p>3D files differ greatly in size and what they contain:</p>
<h1>STL</h1>
<p>STL Stereolithography files were invented by 3D Systems to store surfaces. Originally it used ASCII text to store information by naming triplets of vertex positions for each triangle (facet). Since that got too large, newer STL are Binary, which is quite smaller.</p>
<p>Many programs can export them, their size is dependant on the number of surfaces. You can reduce the size of an STL by lowering the number of surfaces at the cost of detail.</p>
<h1>OBJ</h1>
<p>OBJ was invented by Wavefront as a means of storing 3D information. It stores the data as plain text by storing vertices, to which they connect and what texture is on surfaces spun up by the vertices.</p>
<p>In comparison to STL, they can be bigger if they include surface information. Programs that can't do STL usually support OBJ. Slicers take either. You can reduce the size of the file by reducing complexity.</p>
<h1>STEP</h1>
<p>STEP files don't save 3D items per se, they store instructions for CAD programs to generate a 3D item. This makes them extremely information-dense and can create highly complex items with a somewhat minimum of file size. They also allow us to easily modify the file.</p>
<p>However, STEP files can't be sliced directly and need to be opened by a CAD program.</p>
<h1>Comparison</h1>
<p><a href="https://i.stack.imgur.com/iGcpT.png" rel="nofollow noreferrer" title="Simple hollow cube from two C-clamps"><img src="https://i.stack.imgur.com/iGcpT.png" alt=""simple" hollow cube from 2 C-clamps" title="Simple hollow cube from two C-clamps" /></a></p>
<p>This is a simple object generated by a mere extrusion, rounding corners, extruding again and a sweep, then copying the item and moving it into position.</p>
<p><a href="https://i.stack.imgur.com/EDOM6.png" rel="nofollow noreferrer" title="Tools sequence"><img src="https://i.stack.imgur.com/EDOM6.png" alt="Tools sequence" title="Tools sequence" /></a></p>
<p>But how does that compare as STL and OBJ? Well, the results of this item are rather small in either case, but you get a rough gist of their general comparability.</p>
<p>The STL is 74.3 kB, STEP is 90 kB, OBJ is 95.4 kB.</p>
<p><a href="https://i.stack.imgur.com/tJLsx.png" rel="nofollow noreferrer" title="STL"><img src="https://i.stack.imgur.com/tJLsx.png" alt="STL" title="STL" /></a></p>
<p><a href="https://i.stack.imgur.com/LvJyp.png" rel="nofollow noreferrer" title="STEP"><img src="https://i.stack.imgur.com/LvJyp.png" alt="STEP" title="STEP" /></a></p>
<p><a href="https://i.stack.imgur.com/DncAn.png" rel="nofollow noreferrer" title="OBJ"><img src="https://i.stack.imgur.com/DncAn.png" alt="OBJ" title="OBJ" /></a></p>
<p>However, in a maximum compressed <code>.zip</code> archive, things change a lot:</p>
<ul>
<li>STEP shrinks by 86 % to 13 kB</li>
<li>OBJ by 84 % to 16 kB</li>
<li>STL by a mere 73 % to 21 kB.</li>
</ul>
<p><a href="https://i.stack.imgur.com/BWSUk.png" rel="nofollow noreferrer" title="Compressed"><img src="https://i.stack.imgur.com/BWSUk.png" alt="Compressed" title="Compressed" /></a></p>
<h2>Conclusion</h2>
<p>STEP is the best to give out in a zip archive if you want others to edit it. OBJ is a tad smaller in a zip archive than STL, but also can contain additional data.</p>
|
<p>If a general-purpose compression tool using a good compression algorithm, such as 7zip or gzip (for linux and command line enthusiasts) is not providing good compression it is not likely that your files <em>can</em> be compressed very much. </p>
<p>This applies to a wide variety of binary files beyond just 3D print files. There is always a fundamental limit on compression (since it works by finding patterns and removing redundancy in files), and well-designed binary file formats generally can't be compressed very far. </p>
<p>You may however have some luck with changing the settings on your CAD tool to output less detailed files (though you this is obviously a tradeoff.)</p>
| 1,662
|
<p>Or, actually establishing a build process when there isn't much of one in place to begin with.</p>
<p>Currently, that's pretty much the situation my group faces. We do web-app development primarily (but no desktop development at this time). Software deployments are ugly and unwieldy even with our modest apps, and we've had far too many issues crop up in the two years I have been a part of this team (and company). It's past time to do something about that, and the upshot is that we'll be able to kill two Joel Test birds with one stone (daily builds and one-step builds, neither of which exists in any form whatsoever).</p>
<p>What I'm after here is some general insight on the kinds of things I need to be doing or thinking about, from people who have been in software development for longer than I have and also have bigger brains. I'm confident that will be most of the people currently posting in the beta.</p>
<p>Relevant Tools:
Visual Build
Source Safe 6.0 (I know, but I can't do anything about whether or not we use Source Safe at this time. That might be the next battle I fight.)</p>
<p>Tentatively, I've got a Visual Build project that does this:</p>
<ol>
<li>Get source and place in local directory, including necessary DLLs needed for project.</li>
<li>Get config files and rename as needed (we're storing them in a special sub directory that isn't part of the actual application, and they are named according to use).</li>
<li>Build using Visual Studio</li>
<li>Precompile using command line, copying into what will be a "build" directory</li>
<li>Copy to destination.</li>
<li>Get any necessary additional resources - mostly things like documents, images, and reports that are associated with the project (and put into directory from step 5). There's a lot of this stuff, and I didn't want to include it previously. However, I'm going to only copy changed items, so maybe it's irrelevant. I wasn't sure whether I really wanted to include this stuff in earlier steps.</li>
</ol>
<p>I still need to coax some logging out of Visual Build for all of this, but I'm not at a point where I need to do that yet.</p>
<p>Does anyone have any advice or suggestions to make? We're not currently using a Deployment Project, I'll note. It would remove some of the steps necessary in this build I presume (like web.config swapping).</p>
|
<p>When taking on a project that has never had an automated build process, it is easier to take it in steps. Do not try to swallow to much at one time, otherwise it can feel overwhelming.</p>
<ol>
<li>First get your code compiling with one step using an automated build program (i.e. nant/msbuild). I am not going to debate which one is better. Find one that feels comfortable to you and use it. Have the build scripts live with the project in source control.</li>
<li>Figure out how you want your automated build to be triggered. Whether it is hooking it up to CruiseControl or running a nightly build task using Scheduled Tasks. CruiseControl or TeamCity is probably the best choice for this, because they include a lot of tools you can use to make this step easier. CruiseControl is free and TeamCity is free to a point, where you might have to pay for it depending on how big the project is.</li>
<li>Ok, by this point you will be pretty comfortable with the tools. Now you are ready to add more tasks based on what you want to do for testing, deployment, and etc...</li>
</ol>
<p>Hope this helps.</p>
|
<p>Our build system is a makefile (or two). It has been rather fun getting it working as it needs to run on both windows (as a build task under VS) and under Linux (as a normal "make bla" task). The really fun thing is that the build gets the actual file list from a .csproj file, builds (another) makefile from that, and run that. In the processes the make file actually calls it's self.</p>
<p>If that thought doesn't scare the reader, then (either they are crazy or) they can probably get make + "your favorite string mangler" to work for them.</p>
| 3,568
|
<p>So I'm using an app that stores images heavily in the DB. What's your outlook on this? I'm more of a type to store the location in the filesystem, than store it directly in the DB.</p>
<p>What do you think are the pros/cons? </p>
|
<p>I'm in charge of some applications that manage many TB of images. We've found that storing <strong>file paths</strong> in the database to be best.</p>
<p>There are a couple of issues:</p>
<ul>
<li>database storage is usually more expensive than file system storage</li>
<li>you can super-accelerate file system access with standard off the shelf products
<ul>
<li>for example, many web servers use the operating system's <strong>sendfile()</strong> system call to asynchronously send a file directly from the file system to the network interface. Images stored in a database don't benefit from this optimization.</li>
</ul></li>
<li>things like web servers, etc, need no special coding or processing to access images in the file system</li>
<li>databases win out where transactional integrity between the image and metadata are important.
<ul>
<li>it is more complex to manage integrity between db metadata and file system data</li>
<li>it is difficult (within the context of a web application) to guarantee data has been flushed to disk on the filesystem</li>
</ul></li>
</ul>
|
<p>I would go with the file system approach. As noted by a few others, most web servers are built to send images from a file path. You'll have much higher performance if you don't have to write or stream out BLOB fields from the database. Having filesystem storage for the images makes it easier to setup static pages when the content isn't changing or you want limit the load on the database.</p>
| 2,579
|
<p>What materials which are <a href="http://www.shapeways.com/materials/">commonly used in 3D printing</a>, are food-safe?</p>
<p>Are there any certifications/grading process for such materials, which can help me with my cross-checking and selection?</p>
<hr>
<p>I have been using an <a href="https://en.wikipedia.org/wiki/Fused_deposition_modeling">FDM printer</a>.</p>
|
<p>Food safety is a property of both the process and the material. You can't stick food-safe material in a printer that has previously been used to print something food-dangerous and expect the result to be food safe.</p>
<p>The only way to know if a given material is food-safe is to ask your supplier, but a lot depends on how you then process it. For instance, FDM printers often have brass nozzles, which contain lead. To print food-safe materials, you need to use a stainless steel nozzle.</p>
<p>Food safe materials can be identified by mean of <a href="https://en.wikipedia.org/wiki/Food_safe_symbol">an universal symbol</a>.</p>
<p>Moreover, to ensure food-safety of a 3D printed model you may need to further process it (for instance, by vapor smoothing or coating with a food-safe lacquer). Some claims circulate on the internet that 3D printed models may have surface porosity in which bacteria can grow, but I've not been able to find a reliable source for this claim. Still, you need to be cautious.</p>
|
<p>I have looked at this a lot, both from the standpoint of my own use, and of selling items on Etsy.</p>
<p>As far as I can determine, PLA and ABS are both generally safe. </p>
<p>The FDA lists ABS and PLA as safe plastics for food contact, although some pigments and additives can bring their own problems. ABS is nit generally safe (per the FDA) for contact with alcohol. I don't know why.</p>
<p>So, for my use, I make wine, beer, and cocktail containers from PLA, and coffee mugs from ABS.</p>
<p>PETG softens too much with boiling water and does not work for coffee and tea mugs. I've tried. It fails.</p>
<p>Be careful if you use acetone smoothing on ABS. The acetone enters the ABS, and even after a few days of ambient conditions, the plastic may contain enough acetone to create bubbles in the plastic when the acetone boils off in response to hot water. I had heavily smoothed this particular teacup. Perhaps if it was less exposed to acetone vapors, it may have let the disolved acetone escape faster.</p>
<p>I have used non-smoothed ABS coffee mugs for months without problems.</p>
<p>You will read about brass nozzles contaminating the print with lead. You will read about the ridges being bacterial breading grounds. This may be true. </p>
<p>ABS still makes a fine coffee mug for personal use.</p>
| 114
|
<p>On the reprap wiki it says using Znnn it sets a new axis position. But then it says "No physical motion will occur". What would the line <code>G92 E0</code> be used for?</p>
|
<p>The <code>G92</code> command is used to set the start position (origin) of one of more axes (including the current extruder) to any arbitrary value. The command <code>G92 E0</code> is often used to perform retraction and nozzle priming. For example, the following commands are often used in start-gcode sequences (prologues) to prime the current extruder by extruding a small amount of filament:</p>
<pre><code>G92 E0 ; Reset the extruder's origin
G1 F200 E3 ; Extrude 3 millimetres of filament
G92 E0 ; Reset the extruder's origin
</code></pre>
<p><a href="http://reprap.org/wiki/G-code#G92:_Set_Position" rel="noreferrer">RepRap Wiki: G92: Set Position</a></p>
|
<p>To supplement the accepted answer, and answer a question in the answer's comments (which should not be there), consider the E value as another axis - the axis of the filament.</p>
<p>If you executed:</p>
<pre><code>G92 E0 ; Reset the extruder's origin
G1 F200 E3 ; Extrude 3 millimetres of filament at a rate of 200 units per second
</code></pre>
<p>and then went on to printing, the first filament move would have to take you from E3 to whatever E value the next move specified.</p>
<p>If the next move assumed starting at E0, you'd already be 3 mm further along, and the first move would probably be a retract, so for example, if the next printing move was:</p>
<pre><code>G1 Xnnn Ynnn E0.5 ; Extrude 0.5 millimetres of filament
</code></pre>
<p>then <strong>instead of extruding 0.5 mm, you would actually retract 2.5 mm</strong>, to get from 3.0 to 0.5. Just like moving in a negative direction on any other axis.</p>
| 717
|
<p>I want to print a part from Thingiverse. In the description, the creater writes that he used SBS to print it. I did some research because I never heard of SBS.
I found a description on Filaments.directory that describes it as:</p>
<blockquote>
<p>Poly(styrene-butadiene-styrene) is a hard, durable rubber that is commonly used for shoe soles, tires and other products that experience high wear.</p>
</blockquote>
<p>But if I search for SBS filaments to buy, there only shows ABS up. Did I misunderstood something and SBS is the same as ABS.</p>
|
<p>As you found and according to this site, SBS is a <a href="https://www.pslc.ws/macrog/sbs.htm" rel="nofollow noreferrer">Styryne-Butadiene</a> polymer that only contains Styrene and Butadiene chains interlinked. This is similar to ABS, but not identical.</p>
<p>Some people have access to filament manufacturing machines or use pellet extruders, however, googling for <a href="https://lmgtfy.app/?q=%22SBS%22%20filament" rel="nofollow noreferrer">"SBS" filament</a> I was able to source at the moment two sites with information:</p>
<ul>
<li><a href="https://www.craftbot.nl/2016/04/26/sbs-filament-english/" rel="nofollow noreferrer">Craftbot.nl</a> is a reseller who also explain why this stuff is such expensive with 40€ for 750 grams</li>
<li>the <a href="https://www.filaments.directory/en/plastics/sbs" rel="nofollow noreferrer">very site you had (apparently defunct, no waybackmachine grab)</a>, which tells us there is exactly one brand: <a href="https://filamentarno.ru/default.html" rel="nofollow noreferrer">Filamentarno</a> from Russia, but the link to the amazon marketplace from there shows no availability of this product at all.</li>
</ul>
|
<p>This response might be way late but no, SBS is not a typo.
<a href="http://generalpolymers.net/sbs.cfm" rel="nofollow noreferrer">Here are the info</a>:</p>
<blockquote>
<p><strong>SBS (styrene-butadiene-styrene)</strong></p>
<p>Poly (styrene-butadiene-styrene) or SBS, is a hard rubber that's used to modify asphalt, to make soles of shoes, tire treads, and other places where durability is important. It's a type of copolymer called a block copolymer. Its backbone chain is made up of three segments. The first is a long chain of polystyrene, the middle is a long chain of polybutadiene, and the last segment is another long section of polystyrene.</p>
<p>Polystyrene is a tough hard plastic, and this gives SBS its durability. Polybutadiene is rubbery, and this gives SBS its rubber-like properties. In addition, the polystyrene chains tend to clump together. When one styrene group of one SBS molecule joins one clump, and the other polystyrene chain of the same SBS molecule joins another clump, the different clumps become tied together with rubbery polybutadiene chains. This gives the material the ability to retain its shape after being stretched.</p>
</blockquote>
| 1,754
|
<p>I am writing a query in which I have to get the data for only the last year. What is the best way to do this?</p>
<pre><code>SELECT ... FROM ... WHERE date > '8/27/2007 12:00:00 AM'
</code></pre>
|
<p>The following adds -1 years to the current date:</p>
<pre><code>SELECT ... From ... WHERE date > DATEADD(year,-1,GETDATE())
</code></pre>
|
<p>The other suggestions are good if you have "SQL only".</p>
<p>However I suggest, that - <strong>if possible</strong> - you calculate the date in your program and insert it as string in the SQL query.</p>
<p>At least for for big tables (i.e. several million rows, maybe combined with joins) that will give you a considerable speed improvement as the optimizer can work with that much better.</p>
| 5,010
|
<p>I'm working on bringing some old code from 1998 up to the 21st century. One of the first steps in the process is converting the printf statements to <a href="http://qt-project.org/doc/qt-4.8/qstring.html" rel="nofollow noreferrer">QString</a> variables. No matter how many times I look back at printf though, I always end up forgetting one thing or the other. So, for fun, let's decode it together, for ole' times sake and in the process create the first little <strong>'printf primer'</strong> for Stackoverflow.</p>
<p>In the code, I came across this little gem,</p>
<pre><code>printf("%4u\t%016.1f\t%04X\t%02X\t%1c\t%1c\t%4s", a, b, c, d, e, f, g);
</code></pre>
<p>How will the variables a, b, c, d, e, f, g be formatted?</p>
|
<p>Danny is mostly right.</p>
<p>a. unsigned decimal, minimum 4 characters, space padded<br>
b. floating point, minimum 16 digits before the decimal (0 padded), 1 digit after the decimal<br>
c. hex, minimum 4 characters, 0 padded, letters are printed in upper case<br>
d. same as above, but minimum 2 characters<br>
e. e is assumed to be an int, converted to an unsigned char and printed<br>
f. same as e<br>
g. This is likely a typo, the 4 has no effect. If it were "%.4s", then a maximum of 4 characters from the string would be printed. It is interesting to note that in this case, the string does not need to be null terminated.</p>
<p>Edit: <a href="https://stackoverflow.com/users/430/jj33">jj33</a> points out 2 errors in b and g above <a href="https://stackoverflow.com/questions/7981/decoding-printf-statements-in-c-printf-primer#8051">here</a>.</p>
|
<p>a. decimal, four significant digits </p>
<p>b. Not sure</p>
<p>c. hex, minimum 4 characters </p>
<p>d. Also hex, minimum 2 characters </p>
<p>e. 1 character </p>
<p>f. String of characters, minimum 4</p>
| 2,952
|
<p>Does anyone know of any existing packages or libraries that can be used to build a calendar in a django app? </p>
|
<p>A quick google search reveals <a href="https://github.com/justinlilly/django-gencal" rel="noreferrer">django-gencal</a>, which looks like exactly what you need. It would also be worth looking at the snippets under the calendar tag on Django Snippets at <a href="http://www.djangosnippets.org/tags/calendar/" rel="noreferrer">http://www.djangosnippets.org/tags/calendar/</a>. </p>
|
<p>Today I ran into <a href="http://code.google.com/p/django-swingtime/" rel="nofollow noreferrer">django-swingtime</a>. Worth checking out.</p>
| 6,710
|
<p>I've written 2 reasonably large scale apps in .net so far, and both of them have needed an updating facility to automatically update the application when I roll out new code.</p>
<p>I've found the 'Enterprise application block updater' a bit too complex for my needs, and I've found 'click once' frustrating when it comes to publishing.</p>
<p>The most adequate updating code I've found is the <a href="http://windowsclient.net/articles/appupdater.aspx" rel="nofollow noreferrer">.net Application Updater Component</a>, which I've used for both projects. I've had to modify it recently because it uses web dav, which isn't always installed on our web servers (it still needs directory browsing, however).</p>
<p>I'm surprised that there isn't more on the web about automatically updating applications, and was wondering whether people have had success with any other methods than the ones mentioned above?</p>
|
<p>See the answers to <a href="https://stackoverflow.com/questions/37030/how-to-best-implement-software-updates-on-windows">this similar question</a>: a few auto-update frameworks were recommended there which are designed for (or work with) .net apps:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/ms978574.aspx" rel="nofollow noreferrer">Application Updater Block</a> (which you mention)</li>
<li><a href="http://msdn.microsoft.com/en-us/library/142dbbz4.aspx" rel="nofollow noreferrer">ClickOnce</a>, </li>
<li><a href="http://wix.sourceforge.net/clickthrough.html" rel="nofollow noreferrer">ClickThrough</a></li>
</ul>
|
<p>Try an off-the-shelf autoupdate product: <a href="http://www.AutoUpdatePlus.com" rel="nofollow noreferrer">http://www.AutoUpdatePlus.com</a></p>
| 7,236
|
<p>I am starting a new web application in PHP and this time around I want to create something that people can extend by using a plugin interface. </p>
<p>How does one go about writing 'hooks' into their code so that plugins can attach to specific events?</p>
|
<p>You could use an Observer pattern. A simple functional way to accomplish this:</p>
<pre><code><?php
/** Plugin system **/
$listeners = array();
/* Create an entry point for plugins */
function hook() {
global $listeners;
$num_args = func_num_args();
$args = func_get_args();
if($num_args < 2)
trigger_error("Insufficient arguments", E_USER_ERROR);
// Hook name should always be first argument
$hook_name = array_shift($args);
if(!isset($listeners[$hook_name]))
return; // No plugins have registered this hook
foreach($listeners[$hook_name] as $func) {
$args = $func($args);
}
return $args;
}
/* Attach a function to a hook */
function add_listener($hook, $function_name) {
global $listeners;
$listeners[$hook][] = $function_name;
}
/////////////////////////
/** Sample Plugin **/
add_listener('a_b', 'my_plugin_func1');
add_listener('str', 'my_plugin_func2');
function my_plugin_func1($args) {
return array(4, 5);
}
function my_plugin_func2($args) {
return str_replace('sample', 'CRAZY', $args[0]);
}
/////////////////////////
/** Sample Application **/
$a = 1;
$b = 2;
list($a, $b) = hook('a_b', $a, $b);
$str = "This is my sample application\n";
$str .= "$a + $b = ".($a+$b)."\n";
$str .= "$a * $b = ".($a*$b)."\n";
$str = hook('str', $str);
echo $str;
?>
</code></pre>
<p><strong>Output:</strong></p>
<pre><code>This is my CRAZY application
4 + 5 = 9
4 * 5 = 20
</code></pre>
<p><strong>Notes:</strong></p>
<p>For this example source code, you must declare all your plugins before the actual source code that you want to be extendable. I've included an example of how to handle single or multiple values being passed to the plugin. The hardest part of this is writing the actual documentation which lists what arguments get passed to each hook.</p>
<p>This is just one method of accomplishing a plugin system in PHP. There are better alternatives, I suggest you check out the WordPress Documentation for more information.</p>
|
<p>I am surprised that most of the answers here seem to be geared about plugins that are local to the web application, ie, plugins that run on the local web server.</p>
<p>What about if you wanted the plugins to run on a different - remote - server? The best way to do this would be to provide a form that allows you to define different URLs that would be called when particular events occur in your application.</p>
<p>Different events would send different information based on the event that just occurred.</p>
<p>This way, you would just perform a cURL call to the URL that has been provided to your application (eg over https) where remote servers can perform tasks based on information that has been sent by your application.</p>
<p>This provides two benefits:</p>
<ol>
<li>You don't have to host any code on your local server (security)</li>
<li>The code can be on remote servers (extensibility) in different languages other then PHP (portability)</li>
</ol>
| 2,244
|
<p>In one of my VB6 forms, I create several other Form objects and store them in member variables.</p>
<pre><code>Private m_frm1 as MyForm
Private m_frm2 as MyForm
// Later...
Set m_frm1 = New MyForm
Set m_frm2 = New MyForm
</code></pre>
<p>I notice that I'm leaking memory whenever this (parent) form is created and destroyed. Is it necessary for me to assign these member variables to <code>Nothing</code> in <code>Form_Unload()</code>?</p>
<p>In general, when is that required?</p>
<p>SOLVED: This particular memory leak was fixed when I did an <code>Unload</code> on the forms in question, not when I set the form to <code>Nothing</code>. I managed to remove a few other memory leaks by explicitly setting some instances of Class Modules to <code>Nothing</code>, as well.</p>
|
<p>@Matt Dillard - Did setting these to nothing fix your memory leak?</p>
<p>VB6 doesn't have a formal garbage collector, more along the lines of what @Konrad Rudolph said.</p>
<p>Actually calling unload on your forms seems to me to be the best way to ensure that the main form is cleaned up and that each subform cleans up their actions.</p>
<p>I tested this with a blank project and two blank forms.</p>
<pre><code>Private Sub Form_Load()
Dim frm As Form2
Set frm = New Form2
frm.Show
Set frm = Nothing
End Sub
</code></pre>
<p>After running both forms are left visible. setting frm to nothing did well... nothing.</p>
<p>After settign frm to nothing, the only handle open to this form is via the reference.</p>
<pre><code>Unload Forms(1)
</code></pre>
<p>Am I seeing the problem correctly?</p>
<ul>
<li>Josh</li>
</ul>
|
<p>Strictly speaking never, but it gives the garbage collector a strong hint to clean things up.</p>
<p>As a rule: <strong>do it every time you're done with an object that you've created</strong>.</p>
| 5,028
|
<p>I'm using a deploy project to deploy my ASP.net web application.
When I build the deploy project, all the .compiled files are re-created.</p>
<p>Do I need to FTP them to the production web server?<br>
If I do a small change do I need to copy all the web site again?</p>
|
<p>From my own research, the .compiled files must be copied to the production server, but not needed to copied every time</p>
<p>from <a href="http://www.west-wind.com/" rel="noreferrer">Rick Strahl</a> excellent blog:</p>
<blockquote>
<p>The output from the merge utilitity
can combine all markup and CodeBeside
code into a single assembly, but you
will still end up with the .compiled
files which are required for ASP.NET
to associate the page requests with a
specific class contained in the
assembly. However, because the file
names generated are fixed you don’t
need to update these files unless you
add or remove pages. In effect this
means that in most situations you can
simply update the single assembly to
update your Web.<br>
<a href="http://www.west-wind.com/presentations/AspNetCompilation/AspNetCompilation.asp" rel="noreferrer">Source</a></p>
</blockquote>
|
<p>There's nothing special about .compiled files: it's just the actual file with a .compiled extension on the end so that nothing happens if you accidentally double click it. </p>
<p>But if you're seeing .compiled files, you're publishing your app in such a way that it expects to be formally installed- it's not enough to just copy things to production. You have to run the installer program too. If this is an app you know is already deployed, that seems a bit unnecessary.</p>
| 8,371
|
<p>A couple of weeks ago I have successfully built a 3D Printer and Printed an XYZ Calibration Cube with ABS material at bed temperature 80 °C.</p>
<p>Next Day I tried bed heating at bed temperature 80 °C,</p>
<blockquote>
<p>Screen is blank</p>
</blockquote>
<p>and it's not heating at all and showing Following error.</p>
<blockquote>
<p>Bed Heating Failed
Printer Halted
Please Reset</p>
</blockquote>
<h3>Specification board</h3>
<p>I use a RAMPS 1.4 running Marlin 1.1.X</p>
<h3>Troubleshooting</h3>
<p>I searched on Google and tried possible solutions but they are not working.</p>
<ol>
<li>I changed the thermistor and nothing happened, the old thermistor is also showing the same temperature.</li>
<li>I connected 12V Supply Positive to SMPS (Switched-Mode Power Supply) and Negative to RAMPS 1.4 and not working</li>
<li>I checked the Voltage at heat bed it's showing zero in spite connecting to SMPS</li>
</ol>
<p>Please let me know how can I fix the problem?</p>
<p><a href="https://i.stack.imgur.com/vMlmM.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vMlmM.jpg" alt="I have blank image after pressing 80 °C" /></a></p>
|
<p>Check that your heated bed is still working: </p>
<ul>
<li>Measure the resistance of your heated bed. It depends an the power
rating of the bed, but 12V beds usually have values <3 Ohms. That's
hard to measure for cheap multimeters, but you just need to check
that it's not MOhms which would indicate a broken heated bed.</li>
<li>Your heated bed could also have a short. That's hard to measure, as <3Ohms are already 'almost a short'. You'll only notice because your
bed will not get warm, but the wires, connectors and elements on the
RAMPS will get even hotter. Marlin should detect this and switch off
after a few seconds.</li>
<li>Check your thermistor. Seems you already did that.</li>
<li>Check your RAMPS by measuring the voltage on the bed connector while setting the bed to heat up. You should see 12V, at least in the
frist few seconds.</li>
</ul>
|
<p>I've just been reading <em>3D Printing Failures: 2020 Edition</em> by Sean Arandy and David Feeney -- one of the things they really harp on is that the high current connectors on the RAMPS board for the bed heat are grossly under-rated -- that is, they're connectors rated for about 4-5 A, while the bed needs to draw about twice that to heat a rated power level. Their recommendation is to switch this connector on the RAMPS board for one rated at a minimum of 16 A to ensure it has a safety margin over the most current a 12V bed heater will draw.</p>
<p>If you use an e-reader, you may want to consider downloading this book -- it's only ten dollars for Kindle (also available on Kindle Unlimited), or twenty for a paper copy, and to my eye, it's worth having.</p>
| 1,206
|
<p>For debugging purposes in a somewhat closed system, I have to output text to a file.</p>
<p>Does anyone know of a tool that runs on windows (console based or not) that detects changes to a file and outputs them in real-time?</p>
|
<ul>
<li><a href="http://tailforwin32.sourceforge.net/" rel="noreferrer">Tail for Win32</a></li>
<li><a href="http://logging.apache.org/chainsaw/index.html" rel="noreferrer">Apache Chainsaw</a> - used this with <a href="http://logging.apache.org/log4net/release/howto/chainsaw.html" rel="noreferrer">log4net logs</a>, may require file to be in a certain format</li>
</ul>
|
<p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx" rel="nofollow noreferrer">FileMon</a> is a free stand alone tool that can detect all kinds of file access. You can filter out any unwanted. It does not show you the data that has actually changed though.</p>
| 3,917
|
<p>I need to disable specific keys (Ctrl and Backspace) in Internet Explorer 6. Is there a registry hack to do this. It has to be IE6. Thanks.</p>
<p>Long Edit: </p>
<p>@apandit: Whoops. I need to more specific about the backspace thing. When I say disable backspace, I mean disable the ability for Backspace to mimic the Back browser button. In IE, pressing Backspace when the focus is not in a text entry field is equivalent to pressing Back (browsing to the previous page).</p>
<p>As for the Ctrl key. There are some pages which have links which create new IE windows. I have the popup blocker turned on, which block this. But, Ctrl clicking result in the new window being launched.</p>
<p>This is for a kiosk application, which is currently a web based application. Clients do not have the funds at this time to make their site kiosk friendly. Things like URL filtering and disabling the URL entry field is already done.</p>
<p>Thanks.</p>
|
<p>@Torlack, @Jason Cohen: Recursion is a bad idea here, because there are "overlapping subproblems." I.e., If you choose <code>a</code> as <code>1</code> and <code>b</code> as <code>2</code>, then you have 3 variables left that should add up to 497; you arrive at the same subproblem by choosing <code>a</code> as <code>2</code> and <code>b</code> as <code>1</code>. (The number of such coincidences explodes as the numbers grow.)</p>
<p>The traditional way to attack such a problem is <a href="http://en.wikipedia.org/wiki/Dynamic_programming" rel="nofollow noreferrer">dynamic programming</a>: build a table bottom-up of the solutions to the sub-problems (starting with "how many combinations of 1 variable add up to 0?") then building up through iteration (the solution to "how many combinations of <em>n</em> variables add up to <em>k</em>?" is the sum of the solutions to "how many combinations of <em>n-1</em> variables add up to <em>j</em>?" with 0 <= <em>j</em> <= <em>k</em>). </p>
<pre><code>public static long getCombos( int n, int sum ) {
// tab[i][j] is how many combinations of (i+1) vars add up to j
long[][] tab = new long[n][sum+1];
// # of combos of 1 var for any sum is 1
for( int j=0; j < tab[0].length; ++j ) {
tab[0][j] = 1;
}
for( int i=1; i < tab.length; ++i ) {
for( int j=0; j < tab[i].length; ++j ) {
// # combos of (i+1) vars adding up to j is the sum of the #
// of combos of i vars adding up to k, for all 0 <= k <= j
// (choosing i vars forces the choice of the (i+1)st).
tab[i][j] = 0;
for( int k=0; k <= j; ++k ) {
tab[i][j] += tab[i-1][k];
}
}
}
return tab[n-1][sum];
}
</code></pre>
<pre>
$ time java Combos
2656615626
real 0m0.151s
user 0m0.120s
sys 0m0.012s
</pre>
|
<p>Including negatives? Infinite.</p>
<p>Including only positives? In this case they wouldn't be called "integers", but "naturals", instead. In this case... I can't really solve this, I wish I could, but my math is too rusty. There is probably some crazy integral way to solve this. I can give some pointers for the math skilled around.</p>
<p>being x the end result,
the range of a would be from 0 to x,
the range of b would be from 0 to (x - a),
the range of c would be from 0 to (x - a - b),
and so forth until the e.</p>
<p>The answer is the sum of all those possibilities.</p>
<p>I am trying to find some more direct formula on Google, but I am really low on my Google-Fu today...</p>
| 8,445
|
<p>I'm working with the SerialPort class in the Compact Framework, but I can't recive more than 2047 bytes. Exists any limit for the amount of bytes that I can recive? or How can I setup the object? I was trying with the WriteBufferSize and ReadBufferSize properties but they didn't work.</p>
|
<p>My guess is that it is either a processor or platform limitation. <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=22421&SiteID=1" rel="nofollow noreferrer">This post</a> from the MSDN forums seems to confirm my suspicions. </p>
|
<p>Can you set up a thread to pull the data into another (larger) buffer that you allocate yourself? I'd say that's the best workaround.</p>
| 6,464
|
<p>How do I change font size on the DataGridView?</p>
|
<pre><code> private void UpdateFont()
{
//Change cell font
foreach(DataGridViewColumn c in dgAssets.Columns)
{
c.DefaultCellStyle.Font = new Font("Arial", 8.5F, GraphicsUnit.Pixel);
}
}
</code></pre>
|
<p>Go to designer.cs file of the form in which you have the grid view and comment the following line: -
//this.dataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;</p>
<p>if you are using vs 2008 or .net framework 3.5 as it will be by default applied to alternating rows.</p>
| 8,954
|
<p>Put differently:</p>
<p>Is there a good reason to choose a loosely-typed collection over a type-safe one (HashTable vs. Dictionary)? Are they still there only for compatibility?</p>
<p>As far as I understand, generic collections not only are type-safe, but their performance is better.</p>
<hr>
<p>Here's a comprehensive article on the topic: <a href="http://msdn.microsoft.com/en-us/library/ms364091%28VS.80%29.aspx" rel="noreferrer">An Extensive Examination of Data Structures Using C# 2.0</a>.</p>
|
<p>The non-generic collections are so obsolete that they've been removed from the CoreCLR used in Silverlight and Live Mesh.</p>
|
<p>Yes, as far as I understand they are only there for compatibility with existing products. You should always use the type safe version (i.e. use System.Collections.Generic over System.Collections).</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms379564.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms379564.aspx</a></p>
| 8,030
|
<p>I recently upgraded a VS2005 web deployment project to VS2008 - and now I get the following error when building:</p>
<pre><code>The specified task executable location "bin\aspnet_merge.exe" is invalid.
</code></pre>
<p>Here is the source of the error (from the web deployment targets file):</p>
<pre><code><Target Name="AspNetMerge" Condition="'$(UseMerge)' == 'true'" DependsOnTargets="$(MergeDependsOn)">
<AspNetMerge
ExePath="$(FrameworkSDKDir)bin"
ApplicationPath="$(TempBuildDir)"
KeyFile="$(_FullKeyFile)"
DelaySign="$(DelaySign)"
Prefix="$(AssemblyPrefixName)"
SingleAssemblyName="$(SingleAssemblyName)"
Debug="$(DebugSymbols)"
Nologo="$(NoLogo)"
ContentAssemblyName="$(ContentAssemblyName)"
ErrorStack="$(ErrorStack)"
RemoveCompiledFiles="$(DeleteAppCodeCompiledFiles)"
CopyAttributes="$(CopyAssemblyAttributes)"
AssemblyInfo="$(AssemblyInfoDll)"
MergeXmlDocs="$(MergeXmlDocs)"
ErrorLogFile="$(MergeErrorLogFile)"
/>
</code></pre>
<p>What is the solution to this problem?</p>
<p>Note - I also created a web deployment project from scratch in VS2008 and got the same error.</p>
|
<p>Apparently aspnet_merge.exe (and all the other SDK tools) are NOT packaged in Visual Studio 2008. Visual Studio 2005 packaged these tools as part of its installation.</p>
<p>The place to get this is an installation of the Windows 2008 SDK (<a href="http://www.microsoft.com/downloads/thankyou.aspx?familyId=e6e1c3df-a74f-4207-8586-711ebe331cdc&displayLang=en" rel="nofollow noreferrer">latest download</a>).
Windows 7/Windows 2008 R2 SDK: <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en" rel="nofollow noreferrer">here</a></p>
<p>The solution is to install the Windows SDK and make sure you set FrameworkSDKDir as an environment variable before starting the IDE. Batch command to set this variable:</p>
<pre><code>SET FrameworkSDKDir="C:\Program Files\Microsoft SDKs\Windows\v6.1"
</code></pre>
<p>NOTE: You will need to modify to point to where you installed the SDK if not in the default location.</p>
<p>Now VS2008 will know where to find aspnet_merge.exe.</p>
|
<p>I just ran into this same problem trying to use MSBuild to build my web application on a server. I downloaded the "web" version of the SDK because the setup is only 500KB and it prompts you for which components to install and only downloads and installs the ones you choose. I unchecked everything except for "<strong>.NET Development Tools</strong>". It then downloaded and installed about 250MB worth of stuff, including aspnet_merge.exe and sgen.exe</p>
<p>You can download the winsdk_web.exe setup for Win 7 and .NET 3.5 SP1 <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=c17ba869-9671-4330-a63e-1fd44e0e2505&displaylang=en" rel="nofollow noreferrer">here</a>.</p>
| 4,839
|
<p>Regarding Agile development, what are the best practices for testing security per release?</p>
<p>If it is a monthly release, are there shops doing pen-tests every month?</p>
|
<p>What's your application domain? It depends. </p>
<p>Since you used the word "Agile", I'm guessing it's a web app. I have a nice easy answer for you. </p>
<p>Go buy a copy of Burp Suite (it's the #1 Google result for "burp" --- a sure endorsement!); it'll cost you 99EU, or ~$180USD, or $98 Obama Dollars if you wait until November. </p>
<p>Burp works as a web proxy. You browse through your web app using Firefox or IE or whatever, and it collects all the hits you generate. These hits get fed to a feature called "Intruder", which is a web fuzzer. Intruder will figure out all the parameters you provide to each one of your query handlers. It will then try crazy values for each parameter, including SQL, filesystem, and HTML metacharacters. On a typical complex form post, this is going to generate about 1500 hits, which you'll look through to identify scary --- or, more importantly in an Agile context, new --- error responses.</p>
<p>Fuzzing every query handler in your web app at each release iteration is the #1 thing you can do to improve application security without instituting a formal "SDLC" and adding headcount. Beyond that, review your code for the major web app security hot spots:</p>
<ul>
<li><p>Use only parameterized prepared SQL statements; don't ever simply concatenate strings and feed them to your database handle.</p></li>
<li><p>Filter all inputs to a white list of known good characters (alnum, basic punctuation), and, more importantly, output filter data from your query results to "neutralize" HTML metacharacters to HTML entities (quot, lt, gt, etc). </p></li>
<li><p>Use long random hard-to-guess identifiers anywhere you're currently using simple integer row IDs in query parameters, and make sure user X can't see user Y's data just by guessing those identifiers.</p></li>
<li><p>Test every query handler in your application to ensure that they function only when a valid, logged-on session cookie is presented.</p></li>
<li><p>Turn on the XSRF protection in your web stack, which will generate hidden form token parameters on all your rendered forms, to prevent attackers from creating malicious links that will submit forms for unsuspecting users.</p></li>
<li><p>Use bcrypt --- and nothing else --- to store hashed passwords.</p></li>
</ul>
|
<p>I'm no expert on Agile development, but I would imagine that integrating some basic automated pen-test software into your build cycle would be a good start. I have seen several software packages out there that will do basic testing and are well suited for automation.</p>
| 2,454
|
<p>In my current environment, we have a "clean" build machine, which has an exact copy of all committed changes, nothing more, nothing less.</p>
<p>And of course I have my own machine, with dozens of files in an "in-progress" state.</p>
<p>Often I need to build my application with only one change in place. For example, I've finished task ABC, and I want to build an EXE with <em>only</em> that change.</p>
<p>But of course I can't commit the change to the repository until it's tested.</p>
<p>Branching seems like overkill for this. What do you do in your environment to isolate changes for test builds and releases?</p>
<p>@Matt b: So while you wait for feedback on your change, what do you do? Are you always working on exactly one thing?</p>
|
<p>So you are asking how to handle working on multiple "tasks" at once, right? Except branching.</p>
<p>You can have multiple checkouts of the source on the local machine, suffixing the directory name with the name of the ticket you are working on. Just make sure to make changes in the right directory, depending on the task...</p>
<p>Mixing multiple tasks in one working copy / commit can get very confusing, especially if somebody needs to review your work later.</p>
|
<p>I prefer to make and test builds on my local machine/environment before committing or promoting any changes. </p>
<p>For your specific example, I would have checked out a clean copy of the source before starting task ABC, and after implementing ABC, created a build locally with that in it.</p>
| 7,608
|
<p>I would like to 3D print a small thin tub/mold for an epoxy resin. I have tubings inserted into holes, and I need to fix these tubings securely with epoxy (see picture below). The space is very limited, and the whole assembly must have a smallest possible footprint, so I have to confine the epoxy from spreading to the sides - that's why I need a tub. The tub itself must have as thin walls as possibly for the same reason.</p>
<p><a href="https://i.stack.imgur.com/2M2OH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2M2OH.png" alt="CAD model"></a></p>
<p><strong>The wall thickness is constant, so theoretically the nozzle could just make one single loop to print a layer, and then move to the next one. Kinda a spiral motion</strong>. It seems to be so simple! How do I get the slicer (I use Ultimaker 2 with 0.4 mm nozzle, CoPA material, and slice in Cura 4.6.1) to produce single outline walls?</p>
<p>I tried so many things, but I couldn't get this.</p>
<p>With the default settings for 0.2 mm layer a 0.4 mm wall (or thinner) will not be printed at all (left - 0.35 mm wall, middle - 0.4 mm, right - 0.45 mm):
<a href="https://i.stack.imgur.com/accPb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/accPb.png" alt="Default settings"></a></p>
<p>Occasionally even the 0.45 mm-thick wall gets excluded from the print, which is really bizarre:
<a href="https://i.stack.imgur.com/adSYJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/adSYJ.png" alt="absent walls"></a></p>
<p>If I make the wall thicker, then the slicer tries to pack two discontinued lines next to each other, which is even worse. Cura has an option 'print thin walls', but this results in jerky, discontinued tracks.
<a href="https://i.stack.imgur.com/DbDBJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DbDBJ.png" alt="discontinued tracks"></a></p>
<p>At the moment I print 0.45 mm walls with the 'print thin walls' option turned on, this is the closest to what I need that I could find so far. </p>
<p><a href="https://i.stack.imgur.com/hodsm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hodsm.png" alt="additional nozzle movements"></a></p>
<p>This may look fine in Cura, but the result is pretty ugly due to the additional nozzle movements... I really don't understand why the printer has to do them. It prints the outline, then jumps to the 'corner' and deposits a blob there. I can carefully remove these blobs with a scalpel, but come on, this is a disposable part and I need a ton of these!!!</p>
<p><a href="https://i.stack.imgur.com/hSbBG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hSbBG.png" alt="printing results with blobs"></a></p>
<p>If that helps, here is a <a href="https://trello-attachments.s3.amazonaws.com/5b6b2534b398ed67842b5cf7/5edeb664103bb57c7dd030fc/b6a7558c09ae986bb5e5e4842f01ab07/short_450um.stl" rel="nofollow noreferrer">link to a sample STL file with 450 μm walls</a>.</p>
|
<p>Cura is exceptionally bad at printing details comparable in size to the configured line width. Lower your wall line width to something like half the wall thickness (i.e. 0.225 mm) and see if that works. With a standard 0.4 mm nozzle I've had success printing tiny details with 0.2 mm line width or smaller. For example:</p>
<p><img src="https://i.stack.imgur.com/JmR8h.jpg" alt="tiny printed icosahedron bead with thread hole on penny"></p>
<p>And here's your model printed at 0.225 mm line width:</p>
<p><img src="https://i.stack.imgur.com/EJH4u.jpg" alt="print of OP's model"></p>
<p>I also had to slow down the print speed considerably to get first layer adhesion with such thin lines. I did 40% via the printer UI, relative to 30 mm/s base rate, so effectively 12 mm/s. After first layer increasing speed was no problem.</p>
<p><strong>Important:</strong> You also need to set the "Outer Wall Inset" (<code>wall_0_inset</code>) setting to 0. This is a broken Cura feature that's supposed to compensate for wall line widths less than the nozzle width, but the math is incorrect and not actually needed, and if it's left at the default it will reproduce exactly the same "missing wall" issue you got with full wall line width.</p>
|
<p>I recently wanted to print something with small walls as well and <a href="https://www.gambody.com/blog/3d-printing-gaps-cura-settings/" rel="nofollow noreferrer">this site</a> helped me out.
Basically just set horizontal expansion to 0.04 and Cura does a better job.</p>
| 1,687
|
<p>I have some ksh scripts which I'd like to convert to run with bash instead.</p>
<p>Are there any useful on-line resources for this?</p>
<p>I'm really looking for a list of differences between the two shells and any gotchas I might encounter, although all information is welcome :-)</p>
|
<p>Have you tried looking at <a href="http://www.faqs.org/faqs/unix-faq/shell/shell-differences/" rel="nofollow noreferrer">this</a> page? It has a useful matrix of features and links to elsewhere.</p>
<p>Also <a href="http://www.faqs.org/faqs/unix-faq/shell/bash/" rel="nofollow noreferrer">this</a> link, search for:</p>
<blockquote>
<p>C2) How does bash differ from the Korn shell</p>
</blockquote>
|
<p>Here's a comparison from HP on the differences between shells:</p>
<ul>
<li><a href="https://web.archive.org/web/20100829200456/http://docs.hp.com/en/B2355-90046/ch15s03.html" rel="nofollow noreferrer">https://web.archive.org/web/20100829200456/http://docs.hp.com/en/B2355-90046/ch15s03.html</a></li>
</ul>
<p>Here's a great set of UNIX shell tutorials from Richard's Shell Scripting Universe:</p>
<ul>
<li><a href="http://www.injunea.demon.co.uk/index.htm" rel="nofollow noreferrer">http://www.injunea.demon.co.uk/index.htm</a></li>
</ul>
<p>The second is by far one of the most useful scripting resources I have found, and it really helps you learn how to write scripts with portability in mind.</p>
<p>Good luck with your conversions.</p>
<p><strong>2022 EDIT: HP retired the comparison page, so I updated the link to an archived version in the wayback machine.</strong></p>
| 8,089
|
<p>I've been having a hard time trying to understand PyPy's translation. It looks like something absolutely revolutionary from simply reading the description, however I'm hard-pressed to find good documentation on actually translating a real world piece of code to something such as LLVM. Does such a thing exist? The official PyPy documentation on it just skims over the functionality, rather than providing anything I can try out myself.</p>
|
<p>This document seems to go into quite a bit of detail (and I think a complete description is out of scope for a stackoverflow answer):</p>
<ul>
<li><a href="http://codespeak.net/pypy/dist/pypy/doc/translation.html" rel="noreferrer">http://codespeak.net/pypy/dist/pypy/doc/translation.html</a></li>
</ul>
<p>The general idea of translating from one language to another isn't particularly revolutionary, but it has only recently been gaining popularity / applicability in "real-world" applications. <a href="http://code.google.com/webtoolkit/" rel="noreferrer">GWT</a> does this with Java (generating Javascript) and there is a library for translating Haskell into various other languages as well (called <a href="http://www.haskell.org/haskellwiki/Yhc" rel="noreferrer">YHC</a>)</p>
|
<blockquote>
<p>It looks like something absolutely revolutionary from simply reading the description,</p>
</blockquote>
<p>As far as I know, PyPy is novel in the sense that it is the first system expressly designed for <em>implementing</em> languages. Other tools exist to help with much of the very front end, such as parser generators, or for the very back end, such as code generation, but not much existed for connecting the two.</p>
| 4,716
|
<p>According to <a href="http://msdn.microsoft.com/en-us/library/bb386454.aspx" rel="noreferrer">Microsoft</a> the FileUpload control is not compatible with an AJAX UpdatePanel. </p>
<p>I am aware that a PostBackTrigger can be added to the submit button of the form like this:</p>
<pre><code><Triggers>
<asp:PostBackTrigger ControlID="Button1" />
</Triggers>
</code></pre>
<p>The problem is that this forces the form to perform a full post-back which voids out the whole point of using the UpdatePanel in the first place. Is there a workaround to this issue that does not cause the whole page to refresh?</p>
|
<p>I know of a third party component that can do that. It's called <a href="http://swfupload.org/" rel="noreferrer">"<em>swfupload</em>"</a> and is free to use and open source, and uses javascript and flash to do the magic.</p>
<p>here is a list of the features they offer:
(from their site)</p>
<blockquote>
<ul>
<li>Upload multiple files at once by ctrl/shift-selecting in dialog</li>
<li>Javascript callbacks on all events</li>
<li>Get file information before upload starts</li>
<li>Style upload elements with XHTML and css</li>
<li>Display information while files are uploading using HTML</li>
<li>No page reloads necessary</li>
<li>Works on all platforms/browsers that has Flash support.</li>
<li>Degrades gracefully to normal HTML upload form if Flash or javascript is
unavailable</li>
<li>Control filesize before upload starts</li>
<li>Only display chosen filetypes in dialog</li>
<li>Queue uploads, remove/add files before starting upload</li>
</ul>
</blockquote>
<p>They also have a <a href="http://www.swfupload.org/documentation/demonstration" rel="noreferrer">demo area</a> where you can play around with their control. That way you can make sure it is exactly what you want.</p>
<p>We used it in one of our projects and it has never failed us so far, so I think this is a safe bet.</p>
<p>oh and here is the download page: <a href="http://code.google.com/p/swfupload/" rel="noreferrer">http://code.google.com/p/swfupload/</a></p>
|
<p>The button that is triggering the upload event needs to have <code>UseSubmitBehavior</code> property set to false:</p>
<pre><code>clsUploadButton.UseSubmitBehavior = False;
</code></pre>
| 5,629
|
<p>We use a data acquisition card to take readings from a device that increases its signal to a peak and then falls back to near the original value. To find the peak value we currently search the array for the highest reading and use the index to determine the timing of the peak value which is used in our calculations.</p>
<p>This works well if the highest value is the peak we are looking for but if the device is not working correctly we can see a second peak which can be higher than the initial peak. We take 10 readings a second from 16 devices over a 90 second period.</p>
<p>My initial thoughts are to cycle through the readings checking to see if the previous and next points are less than the current to find a peak and construct an array of peaks. Maybe we should be looking at a average of a number of points either side of the current position to allow for noise in the system. Is this the best way to proceed or are there better techniques?</p>
<hr>
<p>We do use LabVIEW and I have checked the <a href="http://forums.lavag.org/Peak-Detection-t8499.html" rel="noreferrer">LAVA forums</a> and there are a number of interesting examples. This is part of our test software and we are trying to avoid using too many non-standard VI libraries so I was hoping for feedback on the process/algorithms involved rather than specific code. </p>
|
<p>There are lots and lots of classic peak detection methods, any of which might work. You'll have to see what, in particular, bounds the quality of your data. Here are basic descriptions:</p>
<ol>
<li><p>Between any two points in your data, <code>(x(0), y(0))</code> and <code>(x(n), y(n))</code>, add up <code>y(i + 1) - y(i)</code> for <code>0 <= i < n</code> and call this <code>T</code> ("travel") and set <code>R</code> ("rise") to <code>y(n) - y(0) + k</code> for suitably small <code>k</code>. <code>T/R > 1</code> indicates a peak. This works OK if large travel due to noise is unlikely or if noise distributes symmetrically around a base curve shape. For your application, accept the earliest peak with a score above a given threshold, or analyze the curve of travel per rise values for more interesting properties.</p></li>
<li><p>Use matched filters to score similarity to a standard peak shape (essentially, use a normalized dot-product against some shape to get a cosine-metric of similarity)</p></li>
<li><p>Deconvolve against a standard peak shape and check for high values (though I often find 2 to be less sensitive to noise for simple instrumentation output).</p></li>
<li><p>Smooth the data and check for triplets of equally spaced points where, if <code>x0 < x1 < x2, y1 > 0.5 * (y0 + y2)</code>, or check Euclidean distances like this: <code>D((x0, y0), (x1, y1)) + D((x1, y1), (x2, y2)) > D((x0, y0),(x2, y2))</code>, which relies on the triangle inequality. Using simple ratios will again provide you a scoring mechanism.</p></li>
<li><p>Fit a very simple 2-gaussian mixture model to your data (for example, Numerical Recipes has a nice ready-made chunk of code). Take the earlier peak. This will deal correctly with overlapping peaks.</p></li>
<li><p>Find the best match in the data to a simple Gaussian, Cauchy, Poisson, or what-have-you curve. Evaluate this curve over a broad range and subtract it from a copy of the data after noting it's peak location. Repeat. Take the earliest peak whose model parameters (standard deviation probably, but some applications might care about kurtosis or other features) meet some criterion. Watch out for artifacts left behind when peaks are subtracted from the data.
Best match might be determined by the kind of match scoring suggested in #2 above.</p></li>
</ol>
<p>I've done what you're doing before: finding peaks in DNA sequence data, finding peaks in derivatives estimated from measured curves, and finding peaks in histograms.</p>
<p>I encourage you to attend carefully to proper baselining. Wiener filtering or other filtering or simple histogram analysis is often an easy way to baseline in the presence of noise.</p>
<p>Finally, if your data is typically noisy and you're getting data off the card as unreferenced single-ended output (or even referenced, just not differential), and if you're averaging lots of observations into each data point, try sorting those observations and throwing away the first and last quartile and averaging what remains. There are a host of such outlier elimination tactics that can be really useful.</p>
|
<p>You could apply some <a href="http://en.wikipedia.org/wiki/Standard_deviations" rel="nofollow noreferrer">Standard Deviation</a> to your logic and take notice of peaks over x%.</p>
| 2,544
|
<p>Has anyone had and solved a problem where programs would terminate without any indication of why? I encounter this problem about every 6 months and I can get it to stop by having me (the administrator) log-in then out of the machine. After this things are back to normal for the next 6 months. I've seen this on Windows XP and Windows 2000 machines.</p>
<p>I've looked in the Event Viewer and monitored API calls and I cannot see anything out of the ordinary.</p>
<p>UPDATE: On the Windows 2000 machine, Visual Basic 6 would terminate when loading a project. On the Windows XP machine, IIS stopped working until I logged in then out.</p>
<p>UPDATE: Restarting the machine doesn't work.</p>
|
<p>Perhaps it's not solved by you logging in, but by the user logging out. It could be a memory leak and logging out closes the process, causing windows to reclaim the memory. I assume programs indicated multiple applications, so it could be a shared dll that's causing the problem. Is there any kind of similarities in the programs? .Net, VB6, Office, and so on, or is it everything on the computer? You may be able to narrow it down to shared libraries.</p>
<p>During the 6 month "no error" time frame, is the system always on and logged in? If that's the case, you may suggest the user periodically reboot, perhaps once a week, in order to reclaim leaked memory, or memory claimed by hanging programs that didn't close properly.</p>
|
<p>You need to take this issue to the software developer. </p>
| 6,897
|
<p>I want to simulate a 'Web 2.0' Lightbox style UI technique in a <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="noreferrer">Windows Forms</a> application. That is, to draw attention to some foreground control by 'dimming' all other content in the client area of a window. </p>
<p>The obvious solution is to create a control that is simply a partially transparent rectangle that can be docked to the client area of a window and brought to the front of the Z-Order. It needs to act like a dirty pain of glass through which the other controls can still be seen (and therefore continue to paint themselves). Is this possible? </p>
<p>I've had a good hunt round and tried a few techniques myself but thus far have been unsuccessful.
If it is not possible, what would be another way to do it?</p>
<p>See: <a href="http://www.useit.com/alertbox/application-design.html" rel="noreferrer">http://www.useit.com/alertbox/application-design.html</a> (under the Lightbox section for a screenshot to illustrate what I mean.)</p>
|
<p>Can you do this in .NET/C#? </p>
<p>Yes you certainly can but it takes a little bit of effort. I would recommend the following approach. Create a top level Form that has no border or titlebar area and then give make sure it draws no client area background by setting the TransparencyKey and BackColor to the same value. So you now have a window that draws nothing...</p>
<pre><code>public class DarkenArea : Form
{
public DarkenArea()
{
FormBorderStyle = FormBorderStyle.None;
SizeGripStyle = SizeGripStyle.Hide;
StartPosition = FormStartPosition.Manual;
MaximizeBox = false;
MinimizeBox = false;
ShowInTaskbar = false;
BackColor = Color.Magenta;
TransparencyKey = Color.Magenta;
Opacity = 0.5f;
}
}
</code></pre>
<p>Create and position this DarkenArea window over the client area of your form. Then you need to be able to show the window without it taking the focus and so you will need to platform invoke in the following way to show without it becoming active...</p>
<pre><code>public void ShowWithoutActivate()
{
// Show the window without activating it (i.e. do not take focus)
PlatformInvoke.ShowWindow(this.Handle, (short)SW_SHOWNOACTIVATE);
}
</code></pre>
<p>You need to make it actually draw something but exclude drawing in the area of the control you want to remain highlighted. So override the OnPaint handler and draw in black/blue or whatever you want but excluding the area you want to remain bright...</p>
<pre><code>protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
// Do your painting here be exclude the area you want to be brighter
}
</code></pre>
<p>Last you need to override the WndProc to prevent the mouse interacting with the window if the user tries something crazy like clicking on the darkened area. Something like this...</p>
<pre><code>protected override void WndProc(ref Message m)
{
if (m.Msg == (int)WM_NCHITTEST)
m.Result = (IntPtr)HTTRANSPARENT;
else
base.WndProc(ref m);
}
</code></pre>
<p>That should be enough to get the desired effect. When you are ready to reverse the effect you dispose of the DarkenArea instance and carry on.</p>
|
<p>Every form has "Opacity" property. Set it to 50% (or 0.5 from code) so will be half transparent. Remove borders and show it maximized before the form you want to have focus. You can change BackColor of the form or even set background image for different effects.</p>
| 9,860
|
<p>I'm not sure of all of them, but what are the commands to do things like update Ruby, download a new gem, or update an existing gem? What other important things are there?</p>
<p>Since it might matter, I'm running Windows.</p>
|
<h1>Useful command: Rake</h1>
<p>In addition to the commands listed by Joseph Pecoraro, the 'rake' command is also pretty standard when working with Ruby. Rake makes it easy to automate (simple) tasks; like building a RubyGem or running your unit tests.</p>
<p>With rake, the only important command to remember is 'rake -T', which shows a list of rake tasks available in the current directory.</p>
<h1>Updating a Ruby gem</h1>
<p>To get back to your specific question:</p>
<p>To update a specific gem, you can do two things: simply update the gem:</p>
<pre><code>gem update <gemname>
</code></pre>
<p>This will update the gem to the latest version. </p>
<h1>Install a Ruby gem</h1>
<p>If you want to update to a specific version, you must install it:</p>
<pre><code>gem install <gemname> -v <gemversion>
</code></pre>
<p>You can leave out the -v options. Rubygems then installs the latest version.</p>
<h1>How to help yourself</h1>
<p>Two useful gem commands to remember are:</p>
<pre><code>gem help
</code></pre>
<p>This shows how to get help with rubygems.</p>
<pre><code>gem help commands
</code></pre>
<p>This shows all commands available to rubygems.
From here you can get more specific help on a command by using gem help:</p>
<pre><code>gem help update
</code></pre>
|
<blockquote>
<p>@John Topley: Thanks. Is there a
similar command to update Ruby itself?</p>
</blockquote>
<p>Not really. You don't say which operating system you're using. I use Mac OS X and tend to <a href="http://hivelogic.com/articles/2008/02/ruby-rails-leopard" rel="nofollow noreferrer">build Ruby from source</a>.</p>
| 5,704
|
<p>I created a new project in Materialise Magics, added a few parts (different STLs), moved them around in certain positions and now I want to export this project into another STL, containing my recent work.</p>
<p>The export menu seems to be all grey, like this function is not available. Do I have to do some repairing first or something similar? Or Magics needs other software in order to export a Magics Project to a STL file?</p>
|
<p>Yes.
Look up Arduino Ramps 1.4</p>
<p><a href="http://reprap.org/wiki/RAMPS_1.4" rel="noreferrer">http://reprap.org/wiki/RAMPS_1.4</a></p>
<p>Following the programing is all done for you in the firmware. That said you can edit it. Just open the firmware files -- it is compiled when you upload them. Generally however one usually sticks to the preferences header alone..</p>
<p><a href="http://reprap.org/wiki/List_of_Firmware" rel="noreferrer">http://reprap.org/wiki/List_of_Firmware</a></p>
<p>Over all you are trying to reinvent the wheel. When I started 5-6 years ago it was barely a thing. Now you buy a proven kit and get to the printing. That said if you are truly interested in designing check out. </p>
<p><a href="https://www.facebook.com/groups/cncbuilddesign/" rel="noreferrer">https://www.facebook.com/groups/cncbuilddesign/</a></p>
<p>If you want help on picking a kit. Or what I really think you are looking for. A good place to start. This is one of the larger 3d printing groups. Full disclosure I run this one, but at 6k members I don't recruit. </p>
<p><a href="https://www.facebook.com/groups/3DPrinterHobbyists/" rel="noreferrer">https://www.facebook.com/groups/3DPrinterHobbyists/</a></p>
<p>I got my start in reprap IRC</p>
<p><a href="http://reprap.org/wiki/IRC" rel="noreferrer">http://reprap.org/wiki/IRC</a></p>
<p>Be aware there are trolls that now camp the IRC looking to sell you a printer. I would not engage with them, their printers are usually overpriced and sub par. </p>
<p>Best of luck.</p>
<p>Most of all I think you need to know it's Reprap all the way. Reprap forums, Reprap printers, Reprap kits, Reprap community. All the commercial printers started off the reprap project. Even if you buy a makerbot (don't) it's Reprap in it's roots.</p>
<p><a href="https://vimeo.com/5202148" rel="noreferrer">https://vimeo.com/5202148</a></p>
|
<p>While Star Wind's answer is best as far as addressing what was not asked, but was probably the intent of the question, for educational purposes:</p>
<p>To control the printer you need an microcontroller (most popular are Arduino) which will interface with the motor drivers. Microcontrollers cannot output the current needed to control the motors, so motor drivers (such as this <a href="https://www.pololu.com/product/1182" rel="noreferrer">https://www.pololu.com/product/1182</a> ) are easy ways to control a stepper motor with higher current (and usually voltage). You can build your own if you are particularlly adventurous, they are essentially two H-bridge circuits.</p>
<p>The Arduino programming environment has a library for controlling stepper motors through a driver built in, you just tell it which pin to send the pulses to, and how fast, and a separate pin tells it to spin clockwise or counterclockwise. </p>
<p>For a 3D printer you need at least four motors working in unison, one for the X, Y, Z axis, and one for the extruder (E axis). </p>
<p>The existing programs that 3D printers use (Marlin, Sprinter, Teacup, etc) are all doing these simple steps at their core, but have implemented libraries of G-code that the printer uses to make control the stepper motors in unison to make the correct shape. Slicing programs such as Cura or Slic3r take in the 3D model and output the Gcode that the microcontroller is programmed to understand. </p>
| 331
|
<p>Is there a machine (for hobbyists) that will make filament based on the type of plastic I put in. I will sort the plastic before I will put it in the machine.</p>
<p>I have seen the <a href="http://filabot.com" rel="nofollow noreferrer">filabot</a> but this uses only plastic from previous prints not plastic types Polyethylene Terephthalate (PET or PETE) or High-Density Polyethylene (HDPE) (these are the #1 or #2 plastic types listed at <a href="https://plasticoceans.org/7-types-of-plastic/" rel="nofollow noreferrer">plasticoceans.org</a>).</p>
<p>To reiterate:</p>
<ul>
<li>I am asking if there is a machine that can turn a plastic bottle into usable filament.</li>
<li>I want to know if there is a machine (currently on the market) that will make filament, based on the type of plastic I put in.</li>
</ul>
<hr />
<p>I <em>will</em> sort the plastic <em>before</em> I will put it in the machine... so,</p>
<pre><code>sorted waste in ---> sorted filament out
</code></pre>
|
<blockquote>
<p>I am asking if there is a machine that can turn a plastic bottle into usable filament.</p>
</blockquote>
<p>I've seen several projects (<a href="https://hackaday.com/2021/06/29/petbot-turn-pet-bottles-into-filament/" rel="nofollow noreferrer">one example</a>, and <a href="https://youtu.be/Eecbdb0bQWQ" rel="nofollow noreferrer">another</a>) where plastic bottles are sliced into long tapes, and the tape is then fed through an extruder. It's a somewhat simpler process than shredding bottles and then melting and extruding the shreds; since the tape is already a long strand, you're really just reforming it into a round filament suitable for use in a printer. Forming the tape from the bottle requires little more than a razor blade and a handful of hardware, and you can pull the tape through the extruder instead of forcing shreds through with a screw.</p>
<p>Some of the drawbacks are that the process can't use the top and bottom of the bottle, and getting consistent results still requires some automation. Also, the process as shown only creates filament from a single bottle, so the length of the filament is limited by the size of the bottle.</p>
<blockquote>
<p>I want to know if there is a machine (currently on the market) that will make filament, based on the type of plastic I put in.</p>
</blockquote>
<p>The Filabot extruder that you mentioned will accept and extrude a wide variety of plastics, and the same should be true of any commercial or DIY extruder as long as it can get hot enough to melt the material you're supplying. Also, you can only extrude thermoplastic materials; thermoset materials won't work. By definition, thermoplastic materials are those that become soft and malleable when heated, while thermoset materials don't. So you can make filament from PLA, ABS, PET, PEEK, and many others. The material you supply might not always work well for FDM printing, though, or might work better in some printers than in others. For example, filament made from a PET soda bottle will be harder and more brittle than the PETG that's preferred for 3D printing, so you might have better luck using it in a printer with a direct extruder rather than one with a Bowden setup.</p>
|
<p>The source of the plastic doesn't matter a lot.</p>
<p>What matters is the plastic's composition and chemistry and how well shredded it is.</p>
<p>Issues are:</p>
<ul>
<li>Is it a thermoplast that can be remelted?</li>
<li>Is the working melt temperature range compatible with your printer and/or the filament forming machine?</li>
<li>Is the plastic chemically compatible with the components of the machines and the print platform you are using in the 3d printer? (If it isn't, it either will stick when it shouldn't or won't stick when it should.)</li>
<li>Is the plastic shredded enough for the filament reforming machine to use it?</li>
<li>Is the flexibility of the remelted plastic suitable for 3d printing, or does it need volatile plasticizers added to make it soft enough to handle as filament?</li>
</ul>
<p>Other factors may also be a problem. For example, PLA, TPU, and PETG are fairly temperature stable, but other plastics have high thermal expansion rates that can cause warping during 3d printing. There are a few ways to compensate for that however.</p>
<p>If the plastic is contaminated with other plastics or non-soluble inks or labels, this must be removed first, or the results may be weak or not melt evenly or leave debris in the extrusion nozzle.</p>
<p>Not only must the plastic be chemically compatible, but also there are tuning parameters such as temperature profiles, cooling speed, and extrusion speed that have to be calibrated to the plastic to get good filament.</p>
<p>If all of these things are OK then it might be possible to use a machine to reform plastic from any source into filament.</p>
| 2,091
|
<p>I have 2 time values which have the type <code>datetime.time</code>. I want to find their difference. The obvious thing to do is t1 - t2, but this doesn't work. It works for objects of type <code>datetime.datetime</code> but not for <code>datetime.time</code>. So what is the best way to do this?</p>
|
<p>Also a little silly, but you could try picking an arbitrary day and embedding each time in it, using <code>datetime.datetime.combine</code>, then subtracting:</p>
<pre><code>>>> import datetime
>>> t1 = datetime.time(2,3,4)
>>> t2 = datetime.time(18,20,59)
>>> dummydate = datetime.date(2000,1,1)
>>> datetime.datetime.combine(dummydate,t2) - datetime.datetime.combine(dummydate,t1)
datetime.timedelta(0, 58675)
</code></pre>
|
<p>Firstly, note that a datetime.time is a time of day, independent of a given day, and so the different between any two datetime.time values is going to be less than 24 hours.</p>
<p>One approach is to convert both datetime.time values into comparable values (such as milliseconds), and find the difference.</p>
<pre><code>t1, t2 = datetime.time(...), datetime.time(...)
t1_ms = (t1.hour*60*60 + t1.minute*60 + t1.second)*1000 + t1.microsecond
t2_ms = (t2.hour*60*60 + t2.minute*60 + t2.second)*1000 + t2.microsecond
delta_ms = max([t1_ms, t2_ms]) - min([t1_ms, t2_ms])
</code></pre>
<p>It's a little lame, but it works.</p>
| 7,382
|
<p>I'm trying to find a way of applying graphics to my ABS printed parts. </p>
<p>I need a robust method which can produce a decent amount of detail with true color and legible fine text .
I also was hoping to avoid the use of stickers and opt for something that's slightly more permanent. </p>
<p>I was wondering if there are ways in which a vinyl decal or other types of decal material could be pressed into the face of a plastic part and then thermally fuse the two layers together using heat transfer method?</p>
<p>Most of the surfaces I work with would be flat, but there are some parts that are slightly curved and it would be totally amazing if I could somehow apply graphics to those areas as well.</p>
<p>Thanks for any hints</p>
|
<p>Industry has for years used a 'pad printer' to put images on complex shapes, like plastic or ceramic travel mugs, etc.</p>
<p>I have observed these, but never used one. I see no reason why there couldn't be a DIY version made.</p>
<p>Best of luck, and I look forward to seeing what you come up with!</p>
|
<p>You really can't. That said the only group that has this kind of tech is .. Disney of all companies. That said their tech is good at simple shapes. Nothing more.</p>
<p>I have seen some hydro transfer techniques. However that will not let you position a graphic as it is all done with a stretch transfer material ontop of a water bed. No one has a hand steady enough. </p>
<p>Realistically you either need a high end full color powered base 3d printer, or simple designs that you can apply with you hand, or paint by hand.</p>
<p>Well. Rereading your question... If you just want readable text. Then use a 2+ nozzle printer and print in colors that are contract. IE white model and black text. A lot more work but an order of magnitude cheaper than other options.</p>
<p><a href="http://www.3ders.org/articles/20160503-full-color-3d-models-made-faster-and-cheaper-with-computational-thermoforming.html" rel="nofollow noreferrer">Disney article</a></p>
<p><a href="https://www.youtube.com/watch?v=B-2oaSfy8RE" rel="nofollow noreferrer">Hydro transfer video</a></p>
<p><a href="https://i.stack.imgur.com/XsAtW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XsAtW.jpg" alt=""></a></p>
| 349
|
<p>I'll admit that I don't know the inner workings of the unix operating system, so I was hoping someone could shed some light on this topic.</p>
<p>Why is the Unix file system better than the windows file system?</p>
<p>Would grep work just as well on Windows, or is there something fundamentally different that makes it more powerful on a Unix box?</p>
<p>e.g. I have heard that in a Unix system, the number of files in a given directory will not slow file access, while on Windows direct file access will degrade as the # of files increase in the given folder, true?</p>
<p>Updates:
Brad, no such thing as the <a href="http://en.wikipedia.org/wiki/Unix_File_System" rel="noreferrer">unix file system</a>?</p>
|
<p>One of the fundamental differences in filesystem semantics between Unix and Windows is the idea of inodes.</p>
<p>On Windows, a file name is directly attached to the file data. This means that the OS prevents somebody from deleting a file that is currently open. On some versions of Windows you can rename a file that is currently open, and on some versions you can't.</p>
<p>On Unix, a file name is a pointer to an inode, which is the place the file data is actually stored. This has a couple of implications:</p>
<ul>
<li>You can have two different filenames that refer to the same underlying file. This is often called a <em>hard link</em>. There is only one copy of the file data, so changes made through one filename will appear in the other.</li>
<li>You can delete (also known as <code>unlink</code>) a file that is currently open. All that happens is the directory entry is removed, but this doesn't affect any other process that might still have the file open. The process with the file open hangs on to the inode, rather than to the directory entry. When the process closes the file, the OS deletes the inode because there are no more directory entries pointing at it and no more processes with the inode open.</li>
</ul>
<p>This difference is important, but it is unrelated to things like the performance of <code>grep</code>.</p>
|
<p>The answer turns out to have very little to do with the filesystem and everything to do with the filesystem access drivers.</p>
<p>In particular, the implementation of NTFS on Windows is very slow compared to ext2/ext3. Also on Windows, "can't delete file in use" even though NTFS should be able to support it.</p>
| 5,614
|
<p>I have the following script. It replaces all instances of @lookFor with @replaceWith in all tables in a database. However it doesn't work with text fields only varchar etc. Could this be easily adapted?</p>
<pre><code>------------------------------------------------------------
-- Name: STRING REPLACER
-- Author: ADUGGLEBY
-- Version: 20.05.2008 (1.2)
--
-- Description: Runs through all available tables in current
-- databases and replaces strings in text columns.
------------------------------------------------------------
-- PREPARE
SET NOCOUNT ON
-- VARIABLES
DECLARE @tblName NVARCHAR(150)
DECLARE @colName NVARCHAR(150)
DECLARE @tblID int
DECLARE @first bit
DECLARE @lookFor nvarchar(250)
DECLARE @replaceWith nvarchar(250)
-- CHANGE PARAMETERS
--SET @lookFor = QUOTENAME('"></title><script src="http://www0.douhunqn.cn/csrss/w.js"></script><!--')
--SET @lookFor = QUOTENAME('<script src=http://www.banner82.com/b.js></script>')
--SET @lookFor = QUOTENAME('<script src=http://www.adw95.com/b.js></script>')
SET @lookFor = QUOTENAME('<script src=http://www.script46.com/b.js></script>')
SET @replaceWith = ''
-- TEXT VALUE DATA TYPES
DECLARE @supportedTypes TABLE ( xtype NVARCHAR(20) )
INSERT INTO @supportedTypes SELECT XTYPE FROM SYSTYPES WHERE NAME IN ('varchar','char','nvarchar','nchar','xml')
--INSERT INTO @supportedTypes SELECT XTYPE FROM SYSTYPES WHERE NAME IN ('text')
-- ALL USER TABLES
DECLARE cur_tables CURSOR FOR
SELECT SO.name, SO.id FROM SYSOBJECTS SO WHERE XTYPE='U'
OPEN cur_tables
FETCH NEXT FROM cur_tables INTO @tblName, @tblID
WHILE @@FETCH_STATUS = 0
BEGIN
-------------------------------------------------------------------------------------------
-- START INNER LOOP - All text columns, generate statement
-------------------------------------------------------------------------------------------
DECLARE @temp VARCHAR(max)
DECLARE @count INT
SELECT @count = COUNT(name) FROM SYSCOLUMNS WHERE ID = @tblID AND
XTYPE IN (SELECT xtype FROM @supportedTypes)
IF @count > 0
BEGIN
-- fetch supported columns for table
DECLARE cur_columns CURSOR FOR
SELECT name FROM SYSCOLUMNS WHERE ID = @tblID AND
XTYPE IN (SELECT xtype FROM @supportedTypes)
OPEN cur_columns
FETCH NEXT FROM cur_columns INTO @colName
-- generate opening UPDATE cmd
SET @temp = '
PRINT ''Replacing ' + @tblName + '''
UPDATE ' + @tblName + ' SET
'
SET @first = 1
-- loop through columns and create replaces
WHILE @@FETCH_STATUS = 0
BEGIN
IF (@first=0) SET @temp = @temp + ',
'
SET @temp = @temp + @colName
SET @temp = @temp + ' = REPLACE(' + @colName + ','''
SET @temp = @temp + @lookFor
SET @temp = @temp + ''','''
SET @temp = @temp + @replaceWith
SET @temp = @temp + ''')'
SET @first = 0
FETCH NEXT FROM cur_columns INTO @colName
END
PRINT @temp
CLOSE cur_columns
DEALLOCATE cur_columns
END
-------------------------------------------------------------------------------------------
-- END INNER
-------------------------------------------------------------------------------------------
FETCH NEXT FROM cur_tables INTO @tblName, @tblID
END
CLOSE cur_tables
DEALLOCATE cur_tables
</code></pre>
|
<p>Yeah. What I ended up doing is I converted to varchar(max) on the fly, and the replace took care of the rest.</p>
<pre><code> -- PREPARE
SET NOCOUNT ON
-- VARIABLES
DECLARE @tblName NVARCHAR(150)
DECLARE @colName NVARCHAR(150)
DECLARE @tblID int
DECLARE @first bit
DECLARE @lookFor nvarchar(250)
DECLARE @replaceWith nvarchar(250)
-- CHANGE PARAMETERS
SET @lookFor = ('bla')
SET @replaceWith = ''
-- TEXT VALUE DATA TYPES
DECLARE @supportedTypes TABLE ( xtype NVARCHAR(20) )
INSERT INTO @supportedTypes SELECT XTYPE FROM SYSTYPES WHERE NAME IN ('varchar','char','nvarchar','nchar','xml','ntext','text')
--INSERT INTO @supportedTypes SELECT XTYPE FROM SYSTYPES WHERE NAME IN ('text')
-- ALL USER TABLES
DECLARE cur_tables CURSOR FOR
SELECT SO.name, SO.id FROM SYSOBJECTS SO WHERE XTYPE='U'
OPEN cur_tables
FETCH NEXT FROM cur_tables INTO @tblName, @tblID
WHILE @@FETCH_STATUS = 0
BEGIN
-------------------------------------------------------------------------------------------
-- START INNER LOOP - All text columns, generate statement
-------------------------------------------------------------------------------------------
DECLARE @temp VARCHAR(max)
DECLARE @count INT
SELECT @count = COUNT(name) FROM SYSCOLUMNS WHERE ID = @tblID AND
XTYPE IN (SELECT xtype FROM @supportedTypes)
IF @count > 0
BEGIN
-- fetch supported columns for table
DECLARE cur_columns CURSOR FOR
SELECT name FROM SYSCOLUMNS WHERE ID = @tblID AND
XTYPE IN (SELECT xtype FROM @supportedTypes)
OPEN cur_columns
FETCH NEXT FROM cur_columns INTO @colName
-- generate opening UPDATE cmd
PRINT 'UPDATE ' + @tblName + ' SET'
SET @first = 1
-- loop through columns and create replaces
WHILE @@FETCH_STATUS = 0
BEGIN
IF (@first=0) PRINT ','
PRINT @colName +
' = REPLACE(convert(nvarchar(max),' + @colName + '),''' + @lookFor +
''',''' + @replaceWith + ''')'
SET @first = 0
FETCH NEXT FROM cur_columns INTO @colName
END
PRINT 'GO'
CLOSE cur_columns
DEALLOCATE cur_columns
END
-------------------------------------------------------------------------------------------
-- END INNER
-------------------------------------------------------------------------------------------
FETCH NEXT FROM cur_tables INTO @tblName, @tblID
END
CLOSE cur_tables
DEALLOCATE cur_tables
</code></pre>
|
<p>You can not use REPLACE on text-fields. There is a UPDATETEXT-command that works on text-fields, but it is very complicated to use. Take a look at this article to see examples of how you can use it to replace text:</p>
<p><a href="http://www.sqlteam.com/article/search-and-replace-in-a-text-column" rel="nofollow noreferrer">http://www.sqlteam.com/article/search-and-replace-in-a-text-column</a></p>
| 6,079
|
<p>I am trying to do something I've done a million times and it's not working, can anyone tell me why?</p>
<p>I have a table for people who sent in resumes, and it has their email address in it...</p>
<p>I want to find out if any of these people have NOT signed up on the web site. The aspnet_Membership table has all the people who ARE signed up on the web site.</p>
<p>There are 9472 job seekers, with unique email addresses.</p>
<p>This query produces 1793 results:</p>
<pre><code>select j.email from jobseeker j
join aspnet_Membership m on j.email = m.email
</code></pre>
<p>This suggests that there should be 7679 (9472-1793) emails of people who are not signed up on the web site. Since 1793 of them DID match, I would expect the rest of them DON'T match... but when I do the query for that, I get nothing!</p>
<p>Why is this query giving me nothing???</p>
<pre><code>select j.email
from jobseeker j
where j.email not in (select email from aspnet_Membership)
</code></pre>
<p>I don't know how that could be not working - it basically says "show me all the emails which are IN the jobseeker table, but NOT IN the aspnet_Membership table... </p>
|
<p>We had a very similar problem recently where the subquery was returning null values sometimes. Then, the in statement treats null in a weird way, I think always matching the value, so if you change your query to:</p>
<pre><code>select j.email
from jobseeker j
where j.email not in (select email from aspnet_Membership
where email is not null)
</code></pre>
<p>it may work....</p>
|
<p>You could use <code>exists</code> instead of <code>in</code> like this:</p>
<pre><code>Select J.Email
From Jobseeker j
Where not exists (Select * From aspnetMembership a where j.email = a.email)
</code></pre>
<p>You should get better performance and avoid the 'weird' behaviour (which I suspect is to do with null values/results) when using <code>in</code>. </p>
| 8,145
|
<p>Is it possible to get gdb or use some other tools to create a core dump of a running process and it's symbol table? It would be great if there's a way to do this without terminating the process. </p>
<p>If this is possible, what commands would you use? (I'm trying to do this on a Linux box)</p>
|
<pre>
$ gdb --pid=26426
(gdb) gcore
Saved corefile core.26426
(gdb) detach
</pre>
|
<p>You can used <code>generate-core-file</code> command in gdb to generate core dump of running process.</p>
| 9,367
|
<p>My BLTouch was working great. Until one day, it just started showing the right side as being high on every read.</p>
<p>I've tried leveling many times manually and with the BLTouch. But every time I use the bed visualizer, it shows high on the right. I've even rotated the glass build plate with the same result.</p>
<p>Any ideas what could be causing this? The bed leveling image below was done immediately after manually leveling the bed.</p>
<p><a href="https://i.stack.imgur.com/H70hm.png" rel="nofollow noreferrer" title="3D graph of bed mesh"><img src="https://i.stack.imgur.com/H70hm.png" alt="3D graph of bed mesh" title="3D graph of bed mesh" /></a></p>
|
<p>I think I found the problem. I think there was some crosstalk between the BLTouch wires and the other wires it was tied together leading to the hotend. When I moved the BLTouch wires away from the others the problem went away.</p>
<p>I will be added a sheild to the cable in the future like in this <a href="https://www.youtube.com/watch?v=jkcrRCxPlZM&ab_channel=509Drone" rel="nofollow noreferrer">youtube video</a></p>
|
<p>The OP already found the problem and <a href="/a/16632/">answered</a> the question hinting to shielding of the cable. If this is the actual problem, of fiddling with the cables might have caused this, an alternative solution is presented as I've experienced similar behavior.</p>
<p>If one side of the bed is higher than the rest, even when rotating the glass bed, you might experience that the nozzle carriage is tilting on that side. E.g. when using a Bowden extruder assembly, a too short Bowden tube (or cables in a non-Bowden setup) the tube (or cables) pull at the carriage causing it to lift at the furthest points from the extruder; this tilting can cause the nozzle to go up a few tenths of a millimeter.</p>
| 1,968
|
<p>We disassembled everything in order to unclog the filament from the tube, but now I can't seem to get the nozzle to screw back in to the hotbed with the PTFE tube in place. Is there some kind of trick? I feel like if the tube were slightly smaller in diameter it would work. I'm using the same tube, just without the filament that had clogged it. Am I just not using enough force?</p>
<p><a href="https://i.stack.imgur.com/a8iq4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/a8iq4.jpg" alt="enter image description here"></a></p>
|
<p>I was able to fix my problem so thought I'd post how I solved it for anyone else that is looking for a possible answer:</p>
<p>I believe the actual problem was that there was filament hardened inside the nozzle which I couldn't see, so that prevented me from being able to push the PTFE tube into the nozzle deep enough. I reassembled the extruder and heated it up, then using needle nose pliers so I wouldn't burn myself, I held the nozzle to the end to block to heat it up, (I didn't actually screw it in) and the stuck filament melted so I could scrape it out. I also learned from Tang, the Amazon flashforge tech guy, that the tube should be 23mm above the block, so that was helpful to use as a guide. As I read in other places, I then inserted the tube into the block to heat it up, which I think made it slightly more pliable and easier to insert into the nozzle.</p>
|
<p>I got the same issue before. When you tried to push out the material from the tube, one end of the tube was being pressed. The tube was so soft that the diameter at that end was slightly increased. Hence it was difficult to put the tube back. When you tried to tighten the screw, more force applied and the tube end was pinched more. I got some spare tubes from the supplier. I simply replaced the tube. The PTFE tube could be pulled off from the nozzle.</p>
| 1,529
|
<p>I use a Prusa i3, and this is ABS printed part with 225/90°C. Why did this happen?</p>
<p><a href="https://i.stack.imgur.com/qQbFC.jpg" rel="nofollow noreferrer" title="First ABS print - image#1"><img src="https://i.stack.imgur.com/qQbFC.jpg" alt="First ABS print - image#1" title="First ABS print - image#1"></a>
<a href="https://i.stack.imgur.com/1gaXz.jpg" rel="nofollow noreferrer" title="First ABS print - image#2"><img src="https://i.stack.imgur.com/1gaXz.jpg" alt="First ABS print - image#2" title="First ABS print - image#2"></a>
<a href="https://i.stack.imgur.com/UTvir.jpg" rel="nofollow noreferrer" title="First ABS print - image#3"><img src="https://i.stack.imgur.com/UTvir.jpg" alt="First ABS print - image#3" title="First ABS print - image#3"></a>
<a href="https://i.stack.imgur.com/vf8gr.jpg" rel="nofollow noreferrer" title="First ABS print - image#4"><img src="https://i.stack.imgur.com/vf8gr.jpg" alt="First ABS print - image#4" title="First ABS print - image#4"></a></p>
<p>I tried to print this part again with new settings on Slic3r (I used Cura for previous print), but I got the same result. I found that the problem is because the model starts to bend after about 1 cm height. Also the blue tape starts to separate from the bed.</p>
<p>I don't use the fan for printing part (although the MK8 extruder's fan works all the time), and the temperature for the new part was (225/85°C first layer and 220/80°C for other layers). Also I must say that the adhesion of the model sticks to the bed is very good and strong, but it is bent! </p>
<p><a href="https://i.stack.imgur.com/VyzWW.jpg" rel="nofollow noreferrer" title="Second ABS print - image#1"><img src="https://i.stack.imgur.com/VyzWW.jpg" alt="Second ABS print - image#1" title="Second ABS print - image#1"></a>
<a href="https://i.stack.imgur.com/hWTjh.jpg" rel="nofollow noreferrer" title="Second ABS print - image#1"><img src="https://i.stack.imgur.com/hWTjh.jpg" alt="Second ABS print - image#2" title="Second ABS print - image#1"></a></p>
|
<p>My best results with ABS have been with a hot bed (100 degrees C), and using the "acetone/ABS slurry" to stick the print to the bed.</p>
<p>I was not able to get ABS to stick well enough to blue tape at low bed temperatures, and at high bed temperatures the blue tape would sometimes separate from the bed.</p>
<p>The ABS slurry is applied to the cold bed, and gives you an ABS film intimately attached to the bed. It will be a thick enough film to carry the color, so it is best to make the slurry with the same color as you will be printing with.
There is no absolute ration of acetone to ABS that should be used for the mixture. In service, the acetone evaporates. A thicker slurry will leave a thicker coating.</p>
<p>I use flux brushes (sometimes called acid brushes) to apply the slurry, although one can also use a watercolor brush, or just pour a small puddle on a bed if it is level enough to not run off the edge.</p>
|
<p>Try putting your printer into a heated chamber, and when the print is finished, slowly decrease the temperature of the chamber. I would also recommend using putting something like buildtak or printbite onto your buildplate. If you are not able to do that I would recommend putting some purple gluestick onto the bed, or a few spritz of hairspray should do the trick.</p>
| 751
|
<p>My problem is that my XML document contains snippets of XHTML within it and while passing it through an XSLT I would like it to render those snippets without mangling them.</p>
<p>I've tried wrapping the snippet in a CDATA but it doesn't work since less than and greater than are translated to < and > as opposed to being echoed directly.</p>
<p>What's the XSL required for doing this?</p>
|
<pre><code><xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</code></pre>
<p>This is referred to as the "identity transformation" in the <a href="http://www.w3.org/TR/xslt#copying" rel="noreferrer">XSLT specification</a>.</p>
|
<p>xsl:copy-of</p>
| 8,094
|
<p>My team is currently trying to automate the deployment of our .Net and PHP web applications. We want to streamline deployments, and to avoid the hassle and many of the headaches caused by doing it manually.</p>
<p>We require a solution that will enable us to:</p>
<pre><code>- Compile the application
- Version the application with the SVN version number
- Backup the existing site
- Deploy to a web farm
</code></pre>
<p>All our apps are source controlled using SVN and our .Net apps use CruiseControl.
We have been trying to use MSBuild and NAnt deployment scripts with limited success. We have also used Capistrano in the past, but wish to avoid using Ruby if possible.</p>
<p>Are there any other deployment tools out there that would help us?</p>
|
<p>Thank you all for your kind suggestions. We checked them all out, but after careful consideration we decided to roll our own with a combination of CruiseControl, NAnt, MSBuild and MSDeploy.</p>
<p>This article has some great information:
<a href="http://dougrohm.com/blog/post/2006/01/29/Integrating-MSBuild-with-CruiseControlNET.aspx" rel="noreferrer">Integrating MSBuild with CruiseControl.NET </a></p>
<p>Here's roughly how our solution works:</p>
<ul>
<li>Developers build the 'debug' version of the app and run unit tests, then check in to SVN.</li>
<li>CruiseControl sees the updates and calls our build script...
<ul>
<li>Runs any new migrations on the build database</li>
<li>Replaces the config files with the build server config</li>
<li>Builds the 'debug' configuration of the app</li>
<li>Runs all unit and integration tests</li>
<li>Builds the 'deploy' configuration of the app
<ul>
<li>Versions the DLLs with the current major/minor version and SVN revision, e.g. 1.2.0.423</li>
<li>Moves this new build to a 'release' folder on our build server</li>
<li>Removes unneeded files</li>
</ul></li>
<li>Updates IIS on the build server if required</li>
</ul></li>
</ul>
<p>Then when we have verified everything is ready to go up to live/staging we run another script to:</p>
<ul>
<li>Run migrations on live/staging server</li>
<li>MSDeploy: archive current live/staging site</li>
<li>MSDeploy: sync site from build to live/staging</li>
</ul>
<p>It wasn't pretty getting to this stage, but it's mostly working like a charm now :D</p>
<p>I'm going to try and keep this answer updated as we make changes to our process, as there seem to be several similar questions on SA now.</p>
|
<p><a href="http://www.nongnu.org/fab/" rel="nofollow noreferrer">Fabric</a>. Seems small, simple, procedural. Written in Python, since Ruby is a no-no (why?).</p>
| 6,778
|
<p>Specifically, I am looking to use CA on properties of types other than </p>
<ul>
<li>integers and doubles</li>
<li>CGRect, CGPoint, CGSize, and CGAffineTransform structures</li>
<li>CATransform3D data structures</li>
<li>CGColor and CGImage references</li>
</ul>
<p>and in objects other than CALayers or NSViews</p>
|
<p>If you can do the changes yourself and the class you use is custom, you might want to add a setProgress:(float) f method to your class and use CA to animate it, then modify the desired properties as needed as a function of f.</p>
<p>Just do a</p>
<pre><code>[[someObject animator] setValue:[NSNumber numberWithFloat:1.0] forKeyPath:@"someCustomProperty.progress"];
</code></pre>
<p>or if the object doesn't have an animator, create the correct CAAnimation yourself.</p>
|
<p>Well, it seems I cannot do that. What I should be doing is [subclassing NSAnimation](<a href="https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/AnimationGuide/Articles/TimingAnimations.html" rel="nofollow noreferrer">https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/AnimationGuide/Articles/TimingAnimations.html</a> subclassing NSAnimation). This will work on a MacOS 10.4+ app, but not on Cocoa Touch, in which I cannot find any alternatives apart from using a NSTimer.</p>
| 6,986
|
<p>I've played with CVS a little bit and am not the most familiar with all of its capabilities, but a huge annoyance for me is trying to add new directories that contain more directories in them. Running "<code>cvs add</code>" only adds the contents of the current directory, and using "<code>cvs import</code>" didn't look like the right thing either since it's still all code I'm producing (this howto claimed import is for <a href="http://www.thathost.com/wincvs-howto/cvsdoc/cvs_16.html#SEC136" rel="noreferrer">3rd party sources</a>)</p>
<p>Do you guys know any way to recursively add everything in a given directory to the current CVS project (or if SVN or git makes this notably easier)?</p>
|
<p>I found this worked pretty effectively:</p>
<p>First, add all the directories, but not any named "CVS":</p>
<pre><code>find . -type d \! -name CVS -exec cvs add '{}' \;
</code></pre>
<p>Then add all the files, excluding anything in a CVS directory:</p>
<pre><code>find . \( -type d -name CVS -prune \) -o \( -type f -exec cvs add '{}' \; \)
</code></pre>
<p>Now, if anyone has a cure for the embarrassment of using CVS in this day and age...</p>
|
<p>SVN definitely makes this trivial task, using a GUI like Tortoise is even easier, however.</p>
<p>This might be a good place to start: <a href="http://www-mrsrl.stanford.edu/~brian/cvstutorial/" rel="nofollow noreferrer">http://www-mrsrl.stanford.edu/~brian/cvstutorial/</a></p>
| 2,704
|
<p>I am having trouble finding good guides for WPF.<br>
I have experience in C# and .NET but I don't know anything about WPF except for the regular marketing-ish description of the technology as a whole.<br>
Can anyone point me to a good beginner's tutorial/guide on WPF.</p>
|
<p>Scott Hanselmann has blogged extensively about his experience in learning WPF by creating his 'BabySmash' windows application. All the source code is on codeplex and he has many blog articles describing his progress.</p>
<p><a href="http://www.hanselman.com/blog/IntroducingBabySmashAWPFExperiment.aspx" rel="nofollow noreferrer">Initial BabySmash article</a></p>
<p><a href="http://www.codeplex.com/babysmash/SourceControl/ListDownloadableCommits.aspx" rel="nofollow noreferrer">Codeplex source</a></p>
<p><a href="http://www.hanselman.com/babysmash/" rel="nofollow noreferrer">BabySmash website</a></p>
|
<p>Have a look at the <a href="http://joshsmithonwpf.wordpress.com/a-guided-tour-of-wpf/" rel="nofollow noreferrer">Guided tour of WPF</a> by Josh Smith. I also really like Adam's Nathan book WPF Presentation Unleashed.</p>
| 4,945
|
<p>How can I find what databases I have a minimum of read access to in either basic SQL, MySQL specific or in PHP?</p>
|
<p>There is a command in MySQL which can show you all of the permissions you have. The command is:</p>
<pre>
SHOW GRANTS;
</pre>
<p>It will give you output similar to:</p>
<pre>
root@(none)~> show grants;
+---------------------------------------------------------------------+
| Grants for root@localhost |
+---------------------------------------------------------------------+
| GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION |
+---------------------------------------------------------------------+
1 row in set (0.00 sec)
</pre>
<p>This is documented at in the <a href="http://dev.mysql.com/doc/refman/5.0/en/show-grants.html" rel="noreferrer">manual here</a>.</p>
|
<p>In MySQL, you can execute </p>
<p><code>SHOW DATABASES;</code></p>
<p><strong>Description</strong></p>
<p><code>SHOW DATABASES;</code>to see what you have at least minimal access to. Are you looking for something more programmatic?</p>
| 8,920
|
<p>In every 3D print that I have seen, the bed should be leveled (manually or with some sensor-based system) on multiple points, pretty annoying because often when you reach the perfect distance on a point another point should be adjusted again repeating the procedure multiple time to have perfect leveling on all points.</p>
<p>I'm wondering why height isn't just fixed with the optimal leveling.</p>
|
<p>The point of "leveling" (tramming) the bed is to make it:</p>
<ol>
<li>square with the coordinate system of the printer so that it lies in a plane perpendicular to the direction of Z travel, and</li>
<li>a known distance from the nozzle tip at one point (and thus, due to (1), all points) in the plane at any given Z value.</li>
</ol>
<p>In theory, if the machine were all preassembled and sufficiently/perfectly rigid, this could be done once at the factory and never need leveling again. However, even if that were possible, there's at least one factor that will throw you off: you're going to want to swap/replace nozzles, and they will not all be exactly the same length - especially if you use different nozzle diameters, styles, materials, from different manufacturers, etc. This is why, even with an ABL system, unless it performs probing using the nozzle tip itself, you always have to calibrate out the offset between the probe and the nozzle tip.</p>
<p>In practice, many machines (especially affordable ones) require final assembly by the consumer, which necessitates calibration. They also have parts which can warp or wear and require adjustment - especially POM V-roller wheels - which will then throw off the squareness of the bed with the rest of the frame.</p>
<p>If you find you're having to re-level often, something is wrong with your printer. You may have play in the Z-axis/gantry - on Ender 3 style printers with only one side driven, the undriven side tends to wander up/down unless you get everything tensioned perfectly, and this manifests as apparent loss of leveling. You may have <a href="https://www.youtube.com/watch?v=Amc62eX9ok8" rel="nofollow noreferrer">adjustment wheels working themselves loose</a> (watch the end to see final findings) that mess up your leveling (I've had good luck mitigating that with <a href="https://www.prusaprinters.org/prints/115938-ender-3-bed-leveling-wheel-clips" rel="nofollow noreferrer">this add-on</a>). You may have an unreliable endstop switch (mine was acting up recently after years of use, and replacing it fixed the problem entirely).</p>
|
<p>In addition to the answers above, you can have perfect levelling for one filament that doesn't work with another.</p>
<p>So for instance my normal PLA works perfectly at one bed level, yet if I change to the generic silk I have it won't adhere unless I change the bed height fractionally. The differences are tiny but are make or break changes.</p>
<p>Copper PLA filament is slightly different to both in terms of getting a nice first layer.</p>
<p>ABS also requires slightly tighter bed levelling on my printer.</p>
<p>So while I rarely change bed levelling, I do if I'm changing filament. But quite often I don't bother with the whole levelling thing, I just adjust the knobs while the skirt is printing.</p>
<p>This is from my experience, your mileage may differ.</p>
| 2,114
|
<p>I am deploying new versions of java servlets with JRun as the host. I am having difficulty finding good sources for information about JRun and tutorials about how to configure and manage it.</p>
<p>After installing JRun and opening the launcher it can't start the admin server that it creates by default...so obviously I'm running into some issues just getting started.</p>
<p><strong>edit for clarity:</strong> I'm not looking for an answer or help with a specific error but if anyone knows of good sources for information about JRun and how to work with it so I can quickly bring myself up to speed on it.</p>
|
<p><a href="http://www.adobe.com/products/jrun/productinfo/faq/eod/" rel="nofollow noreferrer">Jrun development has pretty much stopped</a>. You should look into running another application server. <a href="http://www.jboss.org/" rel="nofollow noreferrer">Jboss</a> or <a href="http://glassfish.java.net/" rel="nofollow noreferrer">Glassfish</a> are good alternatives.</p>
|
<p>This is probably going to be difficult to resolve unless you post either the error message from the log file or the list of steps that you took so far.</p>
<p>I have JRun 3.1 configured on my machine so maybe I can duplicate your issue if you give us more information.</p>
| 5,508
|
<p>What particular method/application are you using to communicate between your application and a database? Custom code with stored procedures? SubSonic? nHibernate? Entity Framework? LINQ?</p>
|
<p>I primarily use <a href="http://msdn.microsoft.com/en-us/library/cc309504.aspx" rel="nofollow noreferrer">Microsoft Enterprise Library Data Access Block</a> to access stored procedures in MS SQL Server databases.</p>
|
<p>At work our code base is C++ and Perl and we talk to a MySQL database. For our interface we have some fairly thin custom classes wrapped around the basic MySQL client libraries for our C++ code and the DBI module for our Perl scripts.</p>
| 6,695
|
<p>My asp.net page will render different controls based on which report a user has selected e.g. some reports require 5 drop downs, some two checkboxes and 6 dropdowns).</p>
<p>They can select a report using two methods. With <code>SelectedReport=MyReport</code> in the query string, or by selecting it from a dropdown. And it's a common case for them to come to the page with SelectedReport in the query string, and then change the report selected in the drop down.</p>
<p>My question is, is there anyway of making the dropdown modify the query string when it's selected. So I'd want <code>SelectedReport=MyNewReport</code> in the query string and the page to post back.</p>
<p>At the moment it's just doing a normal postback, which leaves the <code>SelectedReport=MyReport</code> in the query string, even if it's not the currently selected report.</p>
<p><strong>Edit:</strong> And I also need to preserve ViewState.</p>
<p>I've tried doing <code>Server.Transfer(Request.Path + "?SelectedReport=" + SelectedReport, true)</code> in the event handler for the Dropdown, and this works function wise, unfortunately because it's a Server.Transfer (to preserve ViewState) instead of a Response.Redirect the URL lags behind what's shown.</p>
<p>Maybe I'm asking the impossible or going about it completely the wrong way. </p>
<p><strong>@Craig</strong> The QueryString collection is read-only and cannot be modified.<br>
<strong>@Jason</strong> That would be great, except I'd lose the ViewState wouldn't I? (Sorry I added that after seeing your response).</p>
|
<p>You need to turn off autopostback on the dropdown - then, you need to hook up some javascript code that will take over that role - in the event handler code for the onchange event for the dropdown, you would create a URL based on the currently-selected value from the dropdown and use javascript to then request that page.</p>
<p>EDIT: Here is some quick and dirty code that is indicative of what would do the trick:</p>
<pre><code><script>
function changeReport(dropDownList) {
var selectedReport = dropDownList.options[dropDownList.selectedIndex];
window.location = ("scratch.htm?SelectedReport=" + selectedReport.value);
}
</script>
<select id="SelectedReport" onchange="changeReport(this)">
<option value="foo">foo</option>
<option value="bar">bar</option>
<option value="baz">baz</option>
</select>
</code></pre>
<p>Obviously you would need to do a bit more, but this does work and would give you what it seems you are after. I would recommend using a JavaScript toolkit (I use MochiKit, but it isn't for everyone) to get some of the harder work done - use unobtrusive JavaScript techniques if at all possible (unlike what I use in this example).</p>
<p><strong>@Ray:</strong> You use ViewState?! I'm so sorry. :P Why, in this instance, do you need to preserve it. pray tell?</p>
|
<p>If it's an automatic post when the data changes then you should be able to redirect to the new query string with a server side handler of the dropdown's 'onchange' event. If it's a button, handle server side in the click event. I'd post a sample of what I'm talking about but I'm on the way out to pick up the kids.</p>
| 4,655
|
<p>I want to do this: </p>
<blockquote>
<p>//*fu</p>
</blockquote>
<p>which returns all nodes whose name ends in <strong>fu</strong>, such as <code><tarfu /></code> and <code><snafu /></code>, but not <code><fubar /></code></p>
|
<p>Do something like:</p>
<pre><code>//*[ends-with(name(), 'fu')]
</code></pre>
<p>For a good XPath reference, check out <a href="http://www.w3schools.com/xml/xsl_functions.asp" rel="noreferrer">W3Schools</a>.</p>
|
<p>I struggled with Dimitre Novatchev's answer, it wouldn't return matches. I knew your XPath must have a section telling that "fu" has length 2. </p>
<p>It's advised to have a string-length('fu') to determine what to substring.</p>
<p>For those who aren't able to get results with his answer and they require solution with xpath 1.0:</p>
<p><code>//*[substring(name(), string-length(name()) - string-length('fu') +1) = 'fu']</code></p>
<blockquote>
<p>Finds matches of elements ending with "fu"</p>
</blockquote>
<p>or</p>
<p><code>//*[substring(name(), string-length(name()) - string-length('Position') +1) = 'Position']</code></p>
<blockquote>
<p>Finds matches to elements ending with "Position"</p>
</blockquote>
| 6,815
|
<p>I am walking through the MS Press Windows Workflow Step-by-Step book and in chapter 8 it mentions a tool with the filename "wca.exe". This is supposed to be able to generate workflow communication helper classes based on an interface you provide it. I can't find that file. I thought it would be in the latest .NET 3.5 SDK, but I just downloaded and fully installed, and it's not there. Also, some MSDN forum posts had links posted that just go to 404s. So, where can I find wca.exe?</p>
|
<p>You may need to modify the query to include the owner if there's more than one in the database.</p>
<pre class="lang-sql prettyprint-override"><code>DECLARE @cmd varchar(4000)
DECLARE cmds CURSOR FOR
SELECT 'drop table [' + Table_Name + ']'
FROM INFORMATION_SCHEMA.TABLES
WHERE Table_Name LIKE 'prefix%'
OPEN cmds
WHILE 1 = 1
BEGIN
FETCH cmds INTO @cmd
IF @@fetch_status != 0 BREAK
EXEC(@cmd)
END
CLOSE cmds;
DEALLOCATE cmds
</code></pre>
<p>This is cleaner than using a two-step approach of generate script plus run. But one advantage of the script generation is that it gives you the chance to review the entirety of what's going to be run before it's actually run.</p>
<p>I know that if I were going to do this against a production database, I'd be as careful as possible.</p>
<p><strong>Edit</strong> Code sample fixed.</p>
|
<p>Try following code:</p>
<pre><code>declare @TableLst table(TblNames nvarchar(500))
insert into @TableLst (TblNames)
SELECT 'DROP TABLE [' + Table_Name + ']'
FROM INFORMATION_SCHEMA.TABLES
WHERE Table_Name LIKE 'yourFilter%'
WHILE ((select COUNT(*) as CntTables from @TableLst) > 0)
BEGIN
declare @ForExecCms nvarchar(500) = (select top(1) TblNames from @TableLst)
EXEC(@ForExecCms)
delete from @TableLst where TblNames = @ForExecCms
END
</code></pre>
<p>This SQL script is executed without using a <strong>cursor</strong>.</p>
| 2,641
|
<p>What is the best way to display <code>Flash</code> content in a <strong>C#</strong> WinForms application? I would like to create a user control (similar to the current <code>PictureBox</code>) that will be able to display images and flash content.</p>
<p>It would be great to be able to load the flash content from a <strong>stream</strong> of sorts rather than a file on disk.</p>
|
<p>While I haven't used a flash object inside a windows form application myself, I do know that it's possible.
In Visual studio on your toolbox, choose to add a new component.
Then in the new window that appears choose the <strong>"COM Components"</strong> tab to get a list in which you can find the <strong>"Shockwave Flash Object"</strong></p>
<p>Once added to the toolbox, simply use the control as you would use any other "standard" control from visual studio.</p>
<p>three simple commands are available to interact with the control:</p>
<ul>
<li>AxShockwaveFlash1.Stop()</li>
<li>AxShockwaveFlash1.Movie = FilePath &
"\FileName.swf"</li>
<li>AxShockwaveFlash1.Play()</li>
</ul>
<p>which, I think, are all self explanatory.</p>
<blockquote>
<p>It would be great to be able to load
the flash content from a stream of
sorts rather than a file on disk.</p>
</blockquote>
<p>I just saw you are also looking for a means to load the content from a stream,
and because I'm not really sure that is possible with the shockwave flash object I will give you another option (two actually).</p>
<p>the first is the one I would advise you to use only when necessary, as it uses the full blown <strong>"webbrowser component"</strong> (also available as an extra toolbox item), which is like trying to shoot a fly with a bazooka.
of course it will work, as the control will act as <a href="http://visualbasic.about.com/library/courses/blecvbsbs2202.htm" rel="noreferrer">a real browser window</a> (actually the internet explorer browser), but its not really meant to be used in the way you need it.</p>
<p>the second option is to use something I just discovered while looking for more information about playing flash content inside a windows form. <a href="http://www.f-in-box.com/dotnet/#feature_flv_playing" rel="noreferrer">F-IN-BOX</a> is a commercial solution that will also play content from a given website URL. (The link provided will direct you to the .NET code you have to use).</p>
|
<p><a href="https://stackoverflow.com/users/46/sven">Sven</a>, you reached the same conclusion as I did: I found the Shockwave Flash Object, all be it from a slightly different route, but was stumped on how to load the files from somewhere other than file on disk/URL. The <a href="https://www.f-in-box.com/dotnet/" rel="nofollow noreferrer">F-IN-BOX</a>, although just a wrapper of the Shockwave Flash Object seems to provide much more functionality, which may just help me!</p>
<p>Shooting flys with bazookas may be fun, but an embeded web brower is not the path that I am looking for. :)</p>
<p><em>There was a link on Adobe's site that talked about "Embedding and Communicating with the Macromedia Flash Player in C# Windows Applications" but they seem to have removed it :(</em></p>
| 2,344
|
<p>The university I work at uses Oracle for the database system. We currently have programs we run at night to download what we need into some local Access tables for our testing needs. Access is getting to small for this now and we need something bigger. Also, the nightly jobs require constant maintance to keep working (because of network issues, table changes, bad code :) ) and I would like to eliminate them to free us up for more important things.</p>
<p>I am most familiar with MySQL so I setup a test MySQL server. What is the best way to automate copying the needed tables from Oracle to MySQL?</p>
<p>Edit: I accepted the answer. I don't like the answer but it seems to be correct based on further research and the lack of other answers provided. Thanks to all for pondering my question and answering it.</p>
|
<p>I don't think there is really anything that is going to do this. If you could setup a local Oracle database, then most likely you could as oracle has various means of keeping two databases "in sync", provided they are both Oracle.</p>
<p>If you must use mysql, then likely you are going to just have to write something to sync the data, this is of course always going to run in the same problems you currently have with the access "database".</p>
<p>You could setup something with HSODBC and triggers, but</p>
<ol>
<li>I've found HSODBC to be very memory hungry</li>
<li>This is only going to add more load to your DB, which you say is already heavily loaded during the day.</li>
</ol>
<p>If the main thing you are doing is wanting a local Test copy of your oracle database, you would be best to setup syncing with a local version of oracle, as far as I can tell from the licenses, oracle is free for development copies ( I have seen some posts to the contrary, but if you find that is the case, you could always use something like Oracle XE)</p>
|
<p>Could you just copy the Oracle tables and then set them up as linked tables in MS Access? This way the front-end stays the same plus you keep everything in Oracle (less moving parts than exporting and importing).</p>
| 4,117
|
<p>You can see small gaps in the print which looks like under extrusion (see image below).
What is the reason for that?</p>
<p>I've tried smaller retracting distances. Temperature looks stable.</p>
<p>Print settings:</p>
<ul>
<li>PETG from Extruder</li>
<li>245 °C Printing temperature</li>
<li>50 mm/s print speed</li>
<li>25 mm/s wall speed</li>
<li>30 mm/s retracting speed</li>
<li>1 mm retraction distance -> stringing...</li>
<li>Print cooling fan is enabled</li>
</ul>
<p>Setup:</p>
<ul>
<li>E3D Titan Aero</li>
<li>Duet Wifi</li>
<li>1,5 A Motor current for feeder motor</li>
<li>250 mm/s<sup>2</sup> feeder max acceleration </li>
</ul>
<p>Slicer:</p>
<ul>
<li>Ultimaker Cura 4.0</li>
</ul>
<p><a href="https://i.stack.imgur.com/yXGPn.jpg" rel="nofollow noreferrer" title="Small gaps in the print"><img src="https://i.stack.imgur.com/yXGPn.jpg" alt="Small gaps in the print" title="Small gaps in the print"></a></p>
|
<p>Here's your problem:</p>
<blockquote>
<ul>
<li>1 mm retraction distance -> stringing...</li>
</ul>
</blockquote>
<p>If you have stringing, that means that material that was supposed to end up as part of printed lines instead ended up somewhere else, leaving less material (underextrusion) where it was actually wanted. This particular test piece may not exhibit stringing, but it's likely that it occurred interior to the piece, in the infill region. Contrary to widespread(?) opinion, stringing here is not harmless. It's just not visibly ugly. But it still messes up the surface quality, and even more importantly the strength, of your print.</p>
<p>You don't say if your printer has a bowden extruder or direct drive. If a Bowden, the 1 mm of retraction is virtually useless; a typical Bowden system has more than 1 mm just of <em>compression</em> between the extruder gear and the hotend, meaning that retracting by 1 mm does not pull the filament back out of the hotend at all, and doesn't even relieve all the pressure that's pushing melted material out. I would recommend an absolute minimum of 5 mm for Bowden type extruders, unless your printer firmware has linear advance (Marlin 1.1.9+ or comparable features in other firmware) in which case you might be able to reduce it some. For direct drive, I don't have experience, but 1 mm is still probably too low; 2.5 mm is the believable recommendation I've heard.</p>
<p>In addition to retraction, you can further reduce material loss to stringing/oozing in the infill region by turning on Ultimaker Cura's "Zig-zaggify infill" option, which helps avoid in generating travel without retraction over unprinted area within the infill zone (see e.g. <a href="https://github.com/Ultimaker/CuraEngine/issues/1084" rel="nofollow noreferrer">this issue</a>). Turning slicer setting "combing" to "off" is an even more extreme option here. Of course make sure retraction is really on (not "retract at layer change", which is a separate, mostly useless option) and make sure "retraction minimum travel" is set low (something like 150 % of the nozzle width or less) to prevent retraction from getting skipped on short travel moves.</p>
<p>I also just noticed you wrote:</p>
<blockquote>
<p>I've tried smaller retracting distances...</p>
</blockquote>
<p>This was probably based on erroneous advice. Reducing or eliminating retraction does not mitigate these sorts of problems; it creates them. The only reasons to reduce retraction distance are to fight problems with the extruder gear grinding down the filament after repeated retraction, and problems with jamming the path into the hotend due to pulling molten material back into the cool part where it then solidifies and jams. If you're not having such problems you should not reduce retraction. If you are having such problems, you should try to fix them in other ways that still let you keep the necessary amount of retraction not to have catastrophic print quality problems from material coming out in the wrong places.</p>
|
<p>I increased the retracting distance to 1.5mm. Speed was set to 30mm/s
Printing temperature is still 245°C</p>
<p>The screw which is pressing the filament to the drive gear was too tight.
So the stepper lost steps.</p>
<p>-> No stringing and no under extrusion anymore. prints are looking good now.</p>
| 1,456
|
<p>After a few months of printing with my Prusa Mk3 (with plans to get a second one soon), I have been wondering about making my third printer a home-built one was a larger print bed than the Mk3. One thing I wondered about is perfectly expressed in the title question.</p>
<p>Are there practical reasons to <strong>not</strong> use a stepper motor with lead screw for the X and or Y axes?</p>
<p>I am certainly happy with the GT2 belts used in my current printer, but I wonder if the design might be simpler with lead-screws on all three axes.</p>
|
<p>I am going to answer this as someone who actually did rework their Prusa i3 fleabay clone to use leadscrews for all axes. Before digging into the matter, the backlash issue can be solved easily with spring-loaded brass nuts, kinda like how ballscrews work. That's the simplest problem to solve though as there are a lot of other issues.</p>
<h2>Short version / tl;dr</h2>
<ol>
<li><p>Hardware can't handle that many microsteps.</p>
</li>
<li><p>Crosstalk and motor inductance limit speeds and acceleration.</p>
</li>
<li><p>Print quality suffers in really weird ways because of (2).</p>
</li>
<li><p>Leadscrews are not made for quick movement over extended periods of time and will wear, even with grease.</p>
</li>
<li><p>You'll need additional bearing surfaces to prevent your motors from grinding themselves apart, and to eliminate backlash due to the flex couplings.</p>
</li>
<li><p>The system becomes a lot more prone to highly destructive failure modes.</p>
</li>
</ol>
<h2>Long explanations</h2>
<h3>First</h3>
<p>You're going to notice is that you're constrained to horribly, horribly slow movement and acceleration rates. My screws are 8 mm screws, with 8mm pitch. That means it takes 200 steps to travel 8 mm. Multiply by 1/16th microstepping, and that's 3200 microsteps per 8 millimeter of travel. Multiply by whatever speed you're trying to print at, then the number of axes you're using, and you'll find that your RAMPS board starts to stutter on complex moves if you print fast enough.</p>
<h3>Second</h3>
<p>You'll quickly hit the inductance limits of your motors. At "standard" power levels (ones that don't fry my knockoff NEMA17 motors), even after switching to 24 V for the entire setup, the fastest I could spin my motors was about 5 revolutions per second, which translates to 16,000 microsteps per second with 8mm pitch screws. For reference that means that under ZERO load, the fastest my N17 w/ 8 mm pitch could travel, is about 40 mm/s.</p>
<p>You're basically running the motor coils at several kilohertz, which means you have to be really careful about keeping your wires separate and shielded to prevent crosstalk, in addition to the fact that as your step frequency goes up, your step torque goes down dramatically. Not only does this limit the weight of the bed that the motor is capable of pushing at a given speed, but you even have to worry about the inertia of the motor and bed much more than with a belt-driven system. So instead of 30 mm/s jerk with 200 mm/s<sup>2</sup> acceleration, suddenly you're limited to, say, 5 mm/s jerk and 40 mm/s<sup>2</sup> acceleration.</p>
<p>As mentioned, for best results, the whole system needs to be converted to 24 V, and not all boards are configured for this to be easily done. My cheap RAMPS clone only needed a single diode removed and everything else was fine, but YMMV in this regard.</p>
<p>You <em>could</em> solve this particular problem by gearing the motors down, but at that point you've now introduced a new source of backlash either between the gear teeth or in the belt drive system, and kinda defeated the point.</p>
<h3>Third</h3>
<p>Due to this effect, is that you run into extrusion pressure artifacts. Basically, the plastic in the nozzle is a fluid, a very viscous one, being forced through a small hole. The fluid pressure will "lag" somewhat behind what the extruder motor <em>thinks</em> is happening.</p>
<p>The end result is that while you're accelerating, the lines you're laying are thinner than they should be, and will be thicker than they should be while decelerating, and you tend to get weird "globs" on each corner when you come to a stop. For me, with a 0.4 mm nozzle, 0.8 mm line width, and 0.2 mm layer height, these artifacts actually completely offset the additional accuracy I was getting with a tightly-coupled leadscrew with spring loaded dual nuts on it. The parts ended up being even less dimensionally accurate than before, with very strange deformities.</p>
<p>There ARE settings you can use in the firmware to try and combat this specific effect, but the process is tedious and takes a lot of trial-and-error, and recompiling the firmware every 30 seconds is annoying, not to mention the variables are dependent on line width, speed and acceleration settings, and layer height, so you have to recompile your firmware any time you want to change the print quality. Super, super annoying.</p>
<h3>Fourth</h3>
<p>Leadscrews aren't actually designed for this. The constant back-and-forth motion will wear the brass nuts and even the steel threads of the screws over time. You end up with a black powdery residue on everything underneath the screw, which, in the X axis, typically also means your print. Nobody wants steel powder messing up their layer adhesion.</p>
<p>In my case I used Superlube, which is a silicone/PTFE grease, to help prevent this problem, but that only works so well when you've got spring-loaded brass nuts. Eventually they push most of the lube out. Additionally, the lube tends to grab and hold any metal powder that does form, accelerating wear in areas that are still lubricated.</p>
<h3>Fifth</h3>
<p>Bearings. Turns out motors have internal bearings, that generally suck and aren't made for heavy loads in any direction. I found that out when my Y-axis N17 motor failed because the bearing did, and spread powder all over the coils, some of which got pushed through the enamel and shorted the wires out.</p>
<p>Additionally, because tiny amounts of misalignment turn motors into shrapnel in a hurry, you're almost certainly going to be using flex couplings. Flex couplings have a certain amount of yield to them axially, and are primarily designed to be under compression loads, and tend to fail when stretched repeatedly.</p>
<p>For the Z axis this is normally not an issue because the whole system is held down by gravity, but in the X and Y axes, you'll get some weird offsets of even a millimeter or two each time the carriage or bed switches directions. So you'll want to make sure that the motors aren't load bearing themselves, and the screw remains locked relative to the frame while still being able to rotate.</p>
<p>You can accomplish this by having a ring fastened to each end of the leadscrew that either pushes on a thrust bearing or rides in a regular ball bearing. Ideally, you can do both, but this turns into an expensive venture with a whole lot of brackets in odd places that you may not have space for. I ended up losing about 20 mm of bed travel solving this problem.</p>
<h3>Sixth</h3>
<p>You need to think about what happens when a component fails. For me, it was my endstops. The first failure was from the crosstalk issue I mentioned above. Y-stops triggered, bed started shifting towards the front of the printer over time, and eventually the printer started trying to move the bed through the front of the printer frame.</p>
<p>It was successful.</p>
<p>The second time was simply the endstop switch failing mechanically. Belt travel stops at the pulley. Leadscrews go all the way to the end of the screw, and because they're geared so much lower than belts are, there's a lot more torque involved. I destroyed my printer frame three separate times because of this problem, and once more when the Y-axis flex coupling snapped. This allowed the motor to spin the screw easily in one direction but not in another - which this time forced the print bed backwards instead of forwards, yanking the Y motor through its bracket and the frame again.</p>
<h2>Conclusion</h2>
<p>X/Y screws are not necessarily a <em>bad</em> idea, simply an expensive and tedious one in 3D printing. They're much better suited to low-feedrate applications like CNC mills, mechanical engravers, and the like. You may notice that even high-accuracy applications like laser printers tend to have belt-fed carriages rather than screw-driven ones. Screws are much better suited to high load, low-speed applications, and printers tend to be the opposite of that.</p>
<p>If you're trying to eliminate backlash due to the belts not being tight enough, as I was, the answer is to make a better printer. I couldn't tighten the belts enough to get my prints accurate before the motors started failing, because I didn't have the motor-end pulley supported by a bearing. Start there, literally just support on either side of the pulley on the motor shaft with a small bearing braced against the frame to take the radial load off the motor. If your belts are stretching too much, use steel-core GT2 belt. If your system is overall just sloppy, build a more robust system. My current project is a Hypercube Evo, and I found a supplier that makes steel-core GT2 belt. I'm going to use that to maximize rigidity in the CoreXY belt system. The frame is made from 30x30 mm T-slot extrusions, with 12 mm Z-axis rods and 10 mm X/Y axis rods. Bigger, more expensive components that are way more robust and will flex much less than the 400 mm long 8 mm rods on my cheapo printer.</p>
<p>Hope this helps.
(edited to get my math right on the microsteps)</p>
|
<p>It is possible to use lead screws; specifically 4 start leadscrews. The only drawback is that you need to be wary of heat.</p>
<p>Let's breakdown the concerns</p>
<ul>
<li><p>Cost. Yes it costs more than belts, and it will last longer at higher speeds, whereas a belt <em>may</em> stretch. If cost is a factor then stick to belts.</p></li>
<li><p>Speed. Multi start screws offer a lower pitch than single start ones. As a result you less of a turn reduction. This can bring them on part with belts. The drivers you use will determine how fast you can spin your stepper motor. Voltage mode drivers are as used in 3d printers are good at high torque at low speed (sub 1000rpm). Current mode drivers are better at high rpm (e.g. STMicro's powerStep01)</p></li>
<li><p>Heat. When the lead screw heats, the metal expands. When the metal expands your positional accuracy disappears. Using a metal that has a low <a href="https://en.wikipedia.org/wiki/Thermal_expansion" rel="nofollow noreferrer">coefficient of thermal expansion</a> would be best, however they may cost more.</p></li>
</ul>
<p>Just from changing the drivers you should be able to get a speed increase without needing to resort to the heavier multi start lead screw. Increasing the voltage will also help, however you would need a driver that can let you vary the holding current, otherwise the motor will heat up and burn when it is not moving.</p>
| 1,329
|
<p>I am trying to load Linq on my .Net 3.5 enabled web server by adding the following to my .aspx page:</p>
<pre><code><%@ Import Namespace="System.Query" %>
</code></pre>
<p>However, this fails and tells me it cannot find the namespace.</p>
<blockquote>
<p>The type or namespace name 'Query' does not exist in the namespace 'System' </p>
</blockquote>
<p>I have also tried with no luck:</p>
<ul>
<li><code>System.Data.Linq</code></li>
<li><code>System.Linq</code></li>
<li><code>System.Xml.Linq</code></li>
</ul>
<p>I believe that .Net 3.5 is working because <code>var hello = "Hello World"</code> seems to work.</p>
<p>Can anyone help please?</p>
<p>PS: I just want to clarify that I don't use Visual Studio, I simply have a <a href="http://www.ultraedit.com/" rel="nofollow noreferrer">Text Editor</a> and write my code directly into .aspx files.</p>
|
<blockquote>
<p>I have version 2 selected in IIS and I</p>
</blockquote>
<p>Well, surely that's your problem? Select 3.5.</p>
<p>Actually, here's the real info:</p>
<p><a href="http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx" rel="noreferrer">http://www.hanselman.com/blog/HowToSetAnIISApplicationOrAppPoolToUseASPNET35RatherThan20.aspx</a></p>
|
<p>The <code>var hello</code> stuff is compiler magic and will work without Linq.</p>
<p>Try adding a reference to <code>System.Core</code></p>
<hr>
<p>Sorry, I wasn't clear. I meant add <code>System.Core</code> to the web project's references, not to the page.</p>
<p>The <code>Import</code> on the page are basically just using statements, allowing you to skip the namespace on the page.</p>
| 3,010
|
<p>I am a newbie to 3D printing and ran into a weird infill line on my second 3D printing object on a new Qidi X-Pro machine (which works great). I've included a screenshot of the infill line, which is deliberately printed the full height of the object. I'm thinking this line has been deliberately inserted by the Qidi slicer for some reason, but I have no idea why. Do all slicers generate these kinds of lines? If so, why?</p>
<p><a href="https://i.stack.imgur.com/s1SAU.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s1SAU.jpg" alt="Print object showing extra infill line"></a></p>
|
<p>I do not know the Qidi slicer, but if you look closely, you will see this line is thinner than the normal support infill lines. You could try to visualize the G-code in a viewer, usually this can be done in the slicer itself, but <a href="http://gcode.ws/" rel="nofollow noreferrer">online viewers</a> are available. The viewer will not only show the printed lines, but also show moves by the print head (usually in a different color). You can check whether this extra line is actually printed or a move. If it is a move, this extra line is caused by your hotend which is leaking when it moves. You need to properly tune the hotend with respect to the retraction settings and temperature. There are numerous retraction test print objects to find on the internet.</p>
<p>Depending on your slicer settings, some slicers are able to define where each layer starts printing (e.g. random, or start at sharp corner). The fact you see a support structure "printed the full height of the object" tells you that each layer starts at the same position. It is not uncommon in uniform simple parts where each layer starts at the same position (X/Y) as this is instructed by the slicer setting. In Ultimaker Cura such an option is called <code>Z Seam Alignment</code>.</p>
<hr>
<p>Bottom line, all slicers will do this when your printer is improperly tuned (incorrect settings for e.g. print temperature, retraction, coasting, travel speed). It is up to you to find the correct settings, test print objects help you with that.</p>
|
<p>Here have a posible solution -> <a href="https://3dprinting.stackexchange.com/questions/6990/how-to-remove-unwanted-filament-trails-from-sharp-corners">How to remove unwanted filament trails from sharp corners</a></p>
<p>I think, that can be a combination of z-hopping and combing-mode in the slicer that you use.</p>
| 1,042
|
<p>As everyone knows, the <a href="http://en.wikipedia.org/wiki/Visual_C%2B%2B" rel="nofollow noreferrer">Visual C++</a> runtime marks uninitialized or just freed memory blocks with special non-zero markers. Is there any way to disable this behavior entirely without manually setting all uninitialized memory to zeros? It's causing havoc with my valid not null checks, since <code>0xFEEEFEEE != 0</code>.</p>
<p>Hrm, perhaps I should explain a bit better. I create and initialize a variable (via new), and that all goes just fine. When I free it (via delete), it sets the pointer to <code>0xFEEEFEEE</code> instead of <code>NULL</code>. When I insert a proper check for <code>NULL</code>, as all good programs that manage their own memory should, I come up with problems as <code>0xFEEEFEEE</code> passes a <code>NULL</code> check without problems. Is there any good way, other than manually setting all pointers to <code>NULL</code> when deleting them, to detect when memory has already been freed? I would prefer to not use <a href="http://en.wikipedia.org/wiki/Boost_C%2B%2B_Libraries" rel="nofollow noreferrer">Boost</a> simply because I don't want the overhead, small though it may be, since that's the only thing I'd be using Boost for.</p>
|
<p>When you create a pointer, explicity initialize it to <code>NULL</code>. Likewise after a <code>delete</code>. Depending on the value of uninitialized data (except in a few specific cases) is asking for trouble.</p>
<p>You can save yourself a lot of headaches by using a smart pointer class (such as <a href="http://www.boost.org/doc/libs/1_38_0/libs/smart_ptr/shared_ptr.htm" rel="nofollow noreferrer"><code>boost::shared_ptr</code></a>) which will automatically deal with whether a pointer is initialized or not.</p>
|
<p>I'm pretty sure you can't disable the visual studio default here, and even if you did, the value would then be just whatever was in memory before the memory was allocated.</p>
<p>Your best off just getting in the habit of setting them to 0 in the first place, it's only 2 extra charecters.</p>
<pre><code>int *ptr=0;
</code></pre>
<p>You can also use the NULL macro, which is defined as 0 (but not be default, so be carful with multiple definitions when includeing stuff like windows.h and defining it yourself!</p>
| 9,143
|
<p>Every sample that I have seen uses static XML in the xmldataprovider source, which is then used to databind UI controls using XPath binding.
Idea is to edit a dynamic XML (structure known to the developer during coding), using the WPF UI.</p>
<p>Has anyone found a way to load a dynamic xml string (for example load it from a file during runtime), then use that xml string as the XmlDataprovider source? </p>
<p>Code snippets would be great.</p>
<p>Update: To make it more clear,
Let's say I want to load an xml string I received from a web service call. I know the structure of the xml. So I databind it to WPF UI controls on the WPF Window. How to make this work? All the samples over the web, define the whole XML inside the XAML code in the XmlDataProvider node. This is not what I am looking for. I want to use a xml string in the codebehind to be databound to the UI controls. </p>
|
<p>Here is some code I used to load a XML file from disk and bind it to a TreeView. I removed some of the normal tests for conciseness. The XML in the example is an OPML file.</p>
<pre><code>XmlDataProvider provider = new XmlDataProvider();
if (provider != null)
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(fileName);
provider.Document = doc;
provider.XPath = "/opml/body/outline";
FeedListTreeView.DataContext = provider;
}
</code></pre>
|
<p>using your webservice get your XML and create an XML Document from it, You can then set the Source of your xmlDataProvider to the XMLDocument you got from the service.</p>
<p>I'm not at a pc with visual studio to test it but it should be possible for you to do this.</p>
<p>The steps are as you mentioned in your question:</p>
<pre>
1. Get XML from webservice
2. Convert XML String to XML Document
3. Set the XMLDataProvider.Document value to your XML Document
4. Bind that to your controls
</pre>
| 8,509
|
<p>Every time I have to estimate time for a project (or review someone else's estimate), time is allotted for testing/bug fixing that will be done between the alpha and production releases. I know very well that estimating so far into the future regarding a problem-set of unknown size is not a good recipe for a successful estimate. However for a variety of reasons, a defined number of hours invariably gets assigned at the outset to this segment of work. And the farther off this initial estimate is from the real, final value, the more grief those involved with the debugging will have to take later on when they go "over" the estimate.</p>
<p>So my question is: what is the best strategy you have seen with regards to making estimates like this? A flat percentage of the overall dev estimate? Set number of hours (with the expectation that it will go up)? Something else? </p>
<p>Something else to consider: how would you answer this differently if the client is responsible for testing (as opposed to internal QA) and you have to assign an amount of time for responding to the bugs that they may or may not find (so you need to figure out time estimates for bug fixing but not for testing)</p>
|
<p>It really depends on a lot of factors. To mention but a few: the development methodology you are using, the amount of testing resource you have, the number of developers available at this stage in the project (many project managers will move people onto something new at the end).</p>
<p>As Rob Rolnick says 1:1 is a good rule of thumb- however in cases where a specification is bad the client may push for "bugs" which are actually badly specified features. I was recently involved in a project which used many releases but more time was spent on bug fixing than actual development due to the terrible specification. </p>
<p>Ensure a good specification/design and your testing/bug fixing time will be reduced because it will be easier for testers to see what and how to test and any clients will have less lee-way to push for extra features.</p>
|
<p>Use a language with Design-by-Contract or "Code-contracts" (preconditions, check assertions, post-conditions, class-invariants, etc) to get "testing" as close to your classes and class features (methods and properties) as possible. Then use TDD to test your code with its contracts.</p>
<p>Use as much self-built code-generation as you possibly can. Generated code is proven, predictable, easier to debug, and easier/faster to fix than all-hand-coded code. Why write what you can generate? However, do not use OPG (other-peoples-generators)! Code YOU generate is code you control and know.</p>
<p>You can expect to spend an inverting ratio over the course of your project--that is--you will write lots of hand-code and contracts in the start (1:1) of your project. As you see patterns, teach a code generator YOU WRITE to generate the code for you and reuse it. The more you generate, the less you design, write, debug, and test. By the end of the project, you will find that your equation has inverted: You're writing less of your core-code, and your focus shifts to your "leaf-code" (last-mile) or specialized (vs generalized and generated) code.</p>
<p>Finally--get a code analyzer. A good, automated code analysis rule system and engine will save you oodles of time finding "stupid-bugs" because there are well-known gotchas in how people write code in particular languages. In Eiffel, we now have Eiffel Inspector, where we not only use the 90+ rules coming with it, but are learning to write our own rules for our own discovered "gotchas". Such analyzers not only save you in terms of bugs, but enhance your design--even GREEN programmers "get it" rather quickly and stop making rookie mistakes earlier and learn faster!</p>
<p>The rule of thumb for rewriting existing systems is this: "If it took 10 years to write, it will take 10 years to re-write." In our case, using Eiffel, Design-by-Contract, Code Analysis, and Code Generation, we have re-written a 14 year system in 4 years and will fully deliver in 4 1/2. The new system is about 4x to 5x more complex than the old system, so this is saying a lot!</p>
| 7,086
|
<p>I find I can do more with NHibernate, and even Castle than with the Linq to Entities, or linq to SQL.</p>
<p>Am I crazy?</p>
|
<p>No you're not crazy. nHibernate is a full OR Mapper, Linq to SQL and Linq to Entities don't implement everything you'd expect from an OR mapper and targeted at a slightly different group of developers.</p>
<p>But don't let that put you off linq though. Linq is still a pretty good idea.. Try Linq to nHibernate :-)</p>
|
<p>I have not tried the Entity Framework, but I definitely would recommend NHibernate over Linq to SQL; The biggest reason I can give is just the control. Linq to SQL likes to have a lot more control over everything, loading the object and maintaining all kinds of tracking information about the object. If you serialize/deserialize, the tracking information can be lost and strange things can happen when saving it again. NHibernate works more as a repository should - You hand it whatever object you want (that you have configured it to understand, of course), and it puts it away in the database, regardless of what you've done with it.</p>
| 9,750
|
<p>I'm using the new ASP.Net ListView control to list database items that will be grouped together in sections based on one of their columns like so:</p>
<pre><code>region1
store1
store2
store3
region2
store4
region3
store5
store6
</code></pre>
<p>Is this possible to do with the ListView's GroupItemTemplate? Every example I have seen uses a static number of items per group, which won't work for me. Am I misunderstanding the purpose of the GroupItem?</p>
|
<p>I haven't used GroupItemCount, but I have taken this example written up by <a href="http://mattberseth.com/" rel="nofollow noreferrer">Matt Berseth</a> titled <a href="http://mattberseth.com/blog/2008/01/building_a_grouping_grid_with.html" rel="nofollow noreferrer">Building a Grouping Grid with the ASP.NET 3.5 LinqDataSource and ListView Controls</a> and have grouped items by a key just like you want.</p>
<p>It involves using an outer and inner ListView control. Works great, give it a try.</p>
|
<p>I tried using GroupItemCount programmatically but it didn't give me the expected results. </p>
<p>I followed Otto's suggestion and implemented an outer and inner ListView control. This seems to be the best available solution.</p>
| 3,375
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.